remove meta.IncludeToken

This commit is contained in:
z7zmey 2018-10-26 12:01:47 +03:00
parent 5159b0f473
commit fb6d21fe6e
8 changed files with 7 additions and 11 deletions

View File

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

View File

@ -4,9 +4,9 @@ package meta
import "strconv"
const _TokenName_name = "NodeStartNodeEndIncludeTokenIncludeOnceTokenIfTokenStringVarnameTokenNumStringTokenInlineHTMLTokenEchoTokenDoTokenWhileTokenEndwhileTokenForInitSemicolonTokenForCondSemicolonTokenForTokenEndforTokenForeachTokenEndforeachTokenDeclareTokenEnddeclareTokenAsTokenSwitchTokenEndswitchTokenCaseTokenDefaultTokenBreakTokenContinueTokenGotoTokenFunctionTokenConstTokenReturnTokenTryTokenCatchTokenFinallyTokenThrowTokenInsteadofTokenGlobalTokenVarTokenUnsetTokenIssetTokenClassTokenTraitTokenInterfaceTokenExtendsTokenImplementsTokenDoubleArrowTokenListTokenCallableTokenCurlyOpenTokenPaamayimNekudotayimTokenUseLeadingNsSeparatorTokenNsSeparatorTokenEllipsisTokenRequireTokenRequireOnceTokenLogicalOrTokenLogicalXorTokenLogicalAndTokenInstanceofTokenNewAnchorElseifTokenElseTokenEndifTokenPrintTokenYieldTokenAbstractTokenFinalTokenPrivateTokenProtectedTokenPublicTokenIncTokenDecTokenYieldFromTokenObjectOperatorTokenCoalesceTokenSpaceshipTokenPlusEqualTokenMinusEqualTokenMulEqualTokenPowEqualTokenDivEqualTokenConcatEqualTokenModEqualTokenAndEqualTokenOrEqualTokenXorEqualTokenSlEqualTokenSrEqualTokenBooleanOrTokenBooleanAndTokenPowTokenSlTokenSrTokenIsIdenticalTokenIsNotIdenticalTokenIsEqualTokenIsNotEqualTokenIsSmallerOrEqualTokenIsGreaterOrEqualTokenHaltCompilerTokenCaseSeparatorTokenBackquoteTokenOpenCurlyBracesTokenCloseCurlyBracesTokenSemiColonTokenColonTokenOpenParenthesisTokenCloseParenthesisTokenOpenSquareBracketCloseSquareBracketQuestionMarkTokenAmpersandTokenMinusTokenPlusTokenCommaTokenVerticalBarTokenEqualTokenCaretTokenAsteriskTokenSlashTokenPercentTokenLessTokenGreaterTokenDotToken"
const _TokenName_name = "NodeStartNodeEndIncludeOnceTokenIfTokenStringVarnameTokenNumStringTokenInlineHTMLTokenEchoTokenDoTokenWhileTokenEndwhileTokenForInitSemicolonTokenForCondSemicolonTokenForTokenEndforTokenForeachTokenEndforeachTokenDeclareTokenEnddeclareTokenAsTokenSwitchTokenEndswitchTokenCaseTokenDefaultTokenBreakTokenContinueTokenGotoTokenFunctionTokenConstTokenReturnTokenTryTokenCatchTokenFinallyTokenThrowTokenInsteadofTokenGlobalTokenVarTokenUnsetTokenIssetTokenClassTokenTraitTokenInterfaceTokenExtendsTokenImplementsTokenDoubleArrowTokenListTokenCallableTokenCurlyOpenTokenPaamayimNekudotayimTokenUseLeadingNsSeparatorTokenNsSeparatorTokenEllipsisTokenRequireTokenRequireOnceTokenLogicalOrTokenLogicalXorTokenLogicalAndTokenInstanceofTokenNewAnchorElseifTokenElseTokenEndifTokenPrintTokenYieldTokenAbstractTokenFinalTokenPrivateTokenProtectedTokenPublicTokenIncTokenDecTokenYieldFromTokenObjectOperatorTokenCoalesceTokenSpaceshipTokenPlusEqualTokenMinusEqualTokenMulEqualTokenPowEqualTokenDivEqualTokenConcatEqualTokenModEqualTokenAndEqualTokenOrEqualTokenXorEqualTokenSlEqualTokenSrEqualTokenBooleanOrTokenBooleanAndTokenPowTokenSlTokenSrTokenIsIdenticalTokenIsNotIdenticalTokenIsEqualTokenIsNotEqualTokenIsSmallerOrEqualTokenIsGreaterOrEqualTokenHaltCompilerTokenCaseSeparatorTokenBackquoteTokenOpenCurlyBracesTokenCloseCurlyBracesTokenSemiColonTokenColonTokenOpenParenthesisTokenCloseParenthesisTokenOpenSquareBracketCloseSquareBracketQuestionMarkTokenAmpersandTokenMinusTokenPlusTokenCommaTokenVerticalBarTokenEqualTokenCaretTokenAsteriskTokenSlashTokenPercentTokenLessTokenGreaterTokenDotToken"
var _TokenName_index = [...]uint16{0, 9, 16, 28, 44, 51, 69, 83, 98, 107, 114, 124, 137, 158, 179, 187, 198, 210, 225, 237, 252, 259, 270, 284, 293, 305, 315, 328, 337, 350, 360, 371, 379, 389, 401, 411, 425, 436, 444, 454, 464, 474, 484, 498, 510, 525, 541, 550, 563, 577, 601, 627, 643, 656, 668, 684, 698, 713, 728, 743, 752, 763, 772, 782, 792, 802, 815, 825, 837, 851, 862, 870, 878, 892, 911, 924, 938, 952, 967, 980, 993, 1006, 1022, 1035, 1048, 1060, 1073, 1085, 1097, 1111, 1126, 1134, 1141, 1148, 1164, 1183, 1195, 1210, 1231, 1252, 1269, 1287, 1301, 1321, 1342, 1356, 1366, 1386, 1407, 1424, 1442, 1459, 1473, 1483, 1492, 1502, 1518, 1528, 1538, 1551, 1561, 1573, 1582, 1594, 1602}
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}
func (i TokenName) String() string {
if i < 0 || i >= TokenName(len(_TokenName_index)-1) {

View File

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

View File

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

View File

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

View File

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

View File

@ -1356,11 +1356,8 @@ func (p *Printer) printExprFunctionCall(n node.Node) {
func (p *Printer) printExprInclude(n node.Node) {
nn := n.(*expr.Include)
p.printMeta(nn, meta.NodeStart)
p.printMeta(nn, meta.IncludeToken)
io.WriteString(p.w, "include")
p.Print(nn.Expr)
p.printMeta(nn, meta.NodeEnd)
}

View File

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