remove meta.IncludeOnceToken

This commit is contained in:
z7zmey 2018-10-26 12:02:41 +03:00
parent fb6d21fe6e
commit 6995b20aef
8 changed files with 7 additions and 11 deletions

View File

@ -7,7 +7,6 @@ type TokenName int
const ( const (
NodeStart TokenName = iota NodeStart TokenName = iota
NodeEnd NodeEnd
IncludeOnceToken
IfToken IfToken
StringVarnameToken StringVarnameToken
NumStringToken NumStringToken

View File

@ -4,9 +4,9 @@ package meta
import "strconv" import "strconv"
const _TokenName_name = "NodeStartNodeEndIncludeOnceTokenIfTokenStringVarnameTokenNumStringTokenInlineHTMLTokenEchoTokenDoTokenWhileTokenEndwhileTokenForInitSemicolonTokenForCondSemicolonTokenForTokenEndforTokenForeachTokenEndforeachTokenDeclareTokenEnddeclareTokenAsTokenSwitchTokenEndswitchTokenCaseTokenDefaultTokenBreakTokenContinueTokenGotoTokenFunctionTokenConstTokenReturnTokenTryTokenCatchTokenFinallyTokenThrowTokenInsteadofTokenGlobalTokenVarTokenUnsetTokenIssetTokenClassTokenTraitTokenInterfaceTokenExtendsTokenImplementsTokenDoubleArrowTokenListTokenCallableTokenCurlyOpenTokenPaamayimNekudotayimTokenUseLeadingNsSeparatorTokenNsSeparatorTokenEllipsisTokenRequireTokenRequireOnceTokenLogicalOrTokenLogicalXorTokenLogicalAndTokenInstanceofTokenNewAnchorElseifTokenElseTokenEndifTokenPrintTokenYieldTokenAbstractTokenFinalTokenPrivateTokenProtectedTokenPublicTokenIncTokenDecTokenYieldFromTokenObjectOperatorTokenCoalesceTokenSpaceshipTokenPlusEqualTokenMinusEqualTokenMulEqualTokenPowEqualTokenDivEqualTokenConcatEqualTokenModEqualTokenAndEqualTokenOrEqualTokenXorEqualTokenSlEqualTokenSrEqualTokenBooleanOrTokenBooleanAndTokenPowTokenSlTokenSrTokenIsIdenticalTokenIsNotIdenticalTokenIsEqualTokenIsNotEqualTokenIsSmallerOrEqualTokenIsGreaterOrEqualTokenHaltCompilerTokenCaseSeparatorTokenBackquoteTokenOpenCurlyBracesTokenCloseCurlyBracesTokenSemiColonTokenColonTokenOpenParenthesisTokenCloseParenthesisTokenOpenSquareBracketCloseSquareBracketQuestionMarkTokenAmpersandTokenMinusTokenPlusTokenCommaTokenVerticalBarTokenEqualTokenCaretTokenAsteriskTokenSlashTokenPercentTokenLessTokenGreaterTokenDotToken" const _TokenName_name = "NodeStartNodeEndIfTokenStringVarnameTokenNumStringTokenInlineHTMLTokenEchoTokenDoTokenWhileTokenEndwhileTokenForInitSemicolonTokenForCondSemicolonTokenForTokenEndforTokenForeachTokenEndforeachTokenDeclareTokenEnddeclareTokenAsTokenSwitchTokenEndswitchTokenCaseTokenDefaultTokenBreakTokenContinueTokenGotoTokenFunctionTokenConstTokenReturnTokenTryTokenCatchTokenFinallyTokenThrowTokenInsteadofTokenGlobalTokenVarTokenUnsetTokenIssetTokenClassTokenTraitTokenInterfaceTokenExtendsTokenImplementsTokenDoubleArrowTokenListTokenCallableTokenCurlyOpenTokenPaamayimNekudotayimTokenUseLeadingNsSeparatorTokenNsSeparatorTokenEllipsisTokenRequireTokenRequireOnceTokenLogicalOrTokenLogicalXorTokenLogicalAndTokenInstanceofTokenNewAnchorElseifTokenElseTokenEndifTokenPrintTokenYieldTokenAbstractTokenFinalTokenPrivateTokenProtectedTokenPublicTokenIncTokenDecTokenYieldFromTokenObjectOperatorTokenCoalesceTokenSpaceshipTokenPlusEqualTokenMinusEqualTokenMulEqualTokenPowEqualTokenDivEqualTokenConcatEqualTokenModEqualTokenAndEqualTokenOrEqualTokenXorEqualTokenSlEqualTokenSrEqualTokenBooleanOrTokenBooleanAndTokenPowTokenSlTokenSrTokenIsIdenticalTokenIsNotIdenticalTokenIsEqualTokenIsNotEqualTokenIsSmallerOrEqualTokenIsGreaterOrEqualTokenHaltCompilerTokenCaseSeparatorTokenBackquoteTokenOpenCurlyBracesTokenCloseCurlyBracesTokenSemiColonTokenColonTokenOpenParenthesisTokenCloseParenthesisTokenOpenSquareBracketCloseSquareBracketQuestionMarkTokenAmpersandTokenMinusTokenPlusTokenCommaTokenVerticalBarTokenEqualTokenCaretTokenAsteriskTokenSlashTokenPercentTokenLessTokenGreaterTokenDotToken"
var _TokenName_index = [...]uint16{0, 9, 16, 32, 39, 57, 71, 86, 95, 102, 112, 125, 146, 167, 175, 186, 198, 213, 225, 240, 247, 258, 272, 281, 293, 303, 316, 325, 338, 348, 359, 367, 377, 389, 399, 413, 424, 432, 442, 452, 462, 472, 486, 498, 513, 529, 538, 551, 565, 589, 615, 631, 644, 656, 672, 686, 701, 716, 731, 740, 751, 760, 770, 780, 790, 803, 813, 825, 839, 850, 858, 866, 880, 899, 912, 926, 940, 955, 968, 981, 994, 1010, 1023, 1036, 1048, 1061, 1073, 1085, 1099, 1114, 1122, 1129, 1136, 1152, 1171, 1183, 1198, 1219, 1240, 1257, 1275, 1289, 1309, 1330, 1344, 1354, 1374, 1395, 1412, 1430, 1447, 1461, 1471, 1480, 1490, 1506, 1516, 1526, 1539, 1549, 1561, 1570, 1582, 1590} var _TokenName_index = [...]uint16{0, 9, 16, 23, 41, 55, 70, 79, 86, 96, 109, 130, 151, 159, 170, 182, 197, 209, 224, 231, 242, 256, 265, 277, 287, 300, 309, 322, 332, 343, 351, 361, 373, 383, 397, 408, 416, 426, 436, 446, 456, 470, 482, 497, 513, 522, 535, 549, 573, 599, 615, 628, 640, 656, 670, 685, 700, 715, 724, 735, 744, 754, 764, 774, 787, 797, 809, 823, 834, 842, 850, 864, 883, 896, 910, 924, 939, 952, 965, 978, 994, 1007, 1020, 1032, 1045, 1057, 1069, 1083, 1098, 1106, 1113, 1120, 1136, 1155, 1167, 1182, 1203, 1224, 1241, 1259, 1273, 1293, 1314, 1328, 1338, 1358, 1379, 1396, 1414, 1431, 1445, 1455, 1464, 1474, 1490, 1500, 1510, 1523, 1533, 1545, 1554, 1566, 1574}
func (i TokenName) String() string { func (i TokenName) String() string {
if i < 0 || i >= TokenName(len(_TokenName_index)-1) { if i < 0 || i >= TokenName(len(_TokenName_index)-1) {

View File

@ -9441,7 +9441,7 @@ yydefault:
yyVAL.node.SetPosition(yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[2].node)) yyVAL.node.SetPosition(yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[2].node))
// save comments // save comments
yyDollar[1].token.Meta.SetTokenName(meta.IncludeOnceToken).AppendTo(yyVAL.node.GetMeta()) yyDollar[1].token.Meta.SetTokenName(meta.NodeStart).AppendTo(yyVAL.node.GetMeta())
yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL)
} }

View File

@ -6844,7 +6844,7 @@ internal_functions_in_yacc:
$$.SetPosition(yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $2)) $$.SetPosition(yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $2))
// save comments // save comments
$1.Meta.SetTokenName(meta.IncludeOnceToken).AppendTo($$.GetMeta()) $1.Meta.SetTokenName(meta.NodeStart).AppendTo($$.GetMeta())
yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL)
} }

View File

@ -8087,7 +8087,7 @@ yydefault:
yyVAL.node.SetPosition(yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[2].node)) yyVAL.node.SetPosition(yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[2].node))
// save comments // save comments
yyDollar[1].token.Meta.SetTokenName(meta.IncludeOnceToken).AppendTo(yyVAL.node.GetMeta()) yyDollar[1].token.Meta.SetTokenName(meta.NodeStart).AppendTo(yyVAL.node.GetMeta())
yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL)
} }

View File

@ -5390,7 +5390,7 @@ internal_functions_in_yacc:
$$.SetPosition(yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $2)) $$.SetPosition(yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $2))
// save comments // save comments
$1.Meta.SetTokenName(meta.IncludeOnceToken).AppendTo($$.GetMeta()) $1.Meta.SetTokenName(meta.NodeStart).AppendTo($$.GetMeta())
yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL)
} }

View File

@ -1364,11 +1364,8 @@ func (p *Printer) printExprInclude(n node.Node) {
func (p *Printer) printExprIncludeOnce(n node.Node) { func (p *Printer) printExprIncludeOnce(n node.Node) {
nn := n.(*expr.IncludeOnce) nn := n.(*expr.IncludeOnce)
p.printMeta(nn, meta.NodeStart) p.printMeta(nn, meta.NodeStart)
p.printMeta(nn, meta.IncludeOnceToken)
io.WriteString(p.w, "include_once") io.WriteString(p.w, "include_once")
p.Print(nn.Expr) p.Print(nn.Expr)
p.printMeta(nn, meta.NodeEnd) p.printMeta(nn, meta.NodeEnd)
} }

View File

@ -3565,7 +3565,7 @@ func TestPrinterPrintIncludeOnce(t *testing.T) {
&meta.Data{ &meta.Data{
Type: meta.WhiteSpaceType, Type: meta.WhiteSpaceType,
Value: " ", Value: " ",
TokenName: meta.IncludeOnceToken, TokenName: meta.NodeStart,
}, },
}, Expr: &scalar.String{Value: "'path'"}, }, Expr: &scalar.String{Value: "'path'"},
}) })