remove meta.PrintToken

This commit is contained in:
z7zmey 2018-10-26 12:31:30 +03:00
parent 7995d41139
commit 41a9409cbe
8 changed files with 7 additions and 9 deletions

View File

@ -63,7 +63,6 @@ const (
ElseifToken ElseifToken
ElseToken ElseToken
EndifToken EndifToken
PrintToken
YieldToken YieldToken
AbstractToken AbstractToken
FinalToken FinalToken

View File

@ -4,9 +4,9 @@ package meta
import "strconv" import "strconv"
const _TokenName_name = "NodeStartNodeEndIfTokenStringVarnameTokenNumStringTokenInlineHTMLTokenEchoTokenDoTokenWhileTokenEndwhileTokenForInitSemicolonTokenForCondSemicolonTokenForTokenEndforTokenForeachTokenEndforeachTokenDeclareTokenEnddeclareTokenAsTokenSwitchTokenEndswitchTokenCaseTokenDefaultTokenBreakTokenContinueTokenGotoTokenFunctionTokenConstTokenReturnTokenTryTokenCatchTokenFinallyTokenThrowTokenInsteadofTokenGlobalTokenVarTokenUnsetTokenClassTokenTraitTokenInterfaceTokenExtendsTokenImplementsTokenDoubleArrowTokenCallableTokenCurlyOpenTokenPaamayimNekudotayimTokenUseLeadingNsSeparatorTokenNsSeparatorTokenEllipsisTokenRequireTokenRequireOnceTokenLogicalOrTokenLogicalXorTokenLogicalAndTokenInstanceofTokenElseifTokenElseTokenEndifTokenPrintTokenYieldTokenAbstractTokenFinalTokenPrivateTokenProtectedTokenPublicTokenIncTokenDecTokenYieldFromTokenObjectOperatorTokenCoalesceTokenSpaceshipTokenPlusEqualTokenMinusEqualTokenMulEqualTokenPowEqualTokenDivEqualTokenConcatEqualTokenModEqualTokenAndEqualTokenOrEqualTokenXorEqualTokenSlEqualTokenSrEqualTokenBooleanOrTokenBooleanAndTokenPowTokenSlTokenSrTokenIsIdenticalTokenIsNotIdenticalTokenIsEqualTokenIsNotEqualTokenIsSmallerOrEqualTokenIsGreaterOrEqualTokenHaltCompilerTokenCaseSeparatorTokenBackquoteTokenOpenCurlyBracesTokenCloseCurlyBracesTokenSemiColonTokenColonTokenOpenParenthesisTokenCloseParenthesisTokenOpenSquareBracketCloseSquareBracketQuestionMarkTokenAmpersandTokenMinusTokenPlusTokenCommaTokenVerticalBarTokenEqualTokenCaretTokenAsteriskTokenSlashTokenPercentTokenLessTokenGreaterTokenDotToken" const _TokenName_name = "NodeStartNodeEndIfTokenStringVarnameTokenNumStringTokenInlineHTMLTokenEchoTokenDoTokenWhileTokenEndwhileTokenForInitSemicolonTokenForCondSemicolonTokenForTokenEndforTokenForeachTokenEndforeachTokenDeclareTokenEnddeclareTokenAsTokenSwitchTokenEndswitchTokenCaseTokenDefaultTokenBreakTokenContinueTokenGotoTokenFunctionTokenConstTokenReturnTokenTryTokenCatchTokenFinallyTokenThrowTokenInsteadofTokenGlobalTokenVarTokenUnsetTokenClassTokenTraitTokenInterfaceTokenExtendsTokenImplementsTokenDoubleArrowTokenCallableTokenCurlyOpenTokenPaamayimNekudotayimTokenUseLeadingNsSeparatorTokenNsSeparatorTokenEllipsisTokenRequireTokenRequireOnceTokenLogicalOrTokenLogicalXorTokenLogicalAndTokenInstanceofTokenElseifTokenElseTokenEndifTokenYieldTokenAbstractTokenFinalTokenPrivateTokenProtectedTokenPublicTokenIncTokenDecTokenYieldFromTokenObjectOperatorTokenCoalesceTokenSpaceshipTokenPlusEqualTokenMinusEqualTokenMulEqualTokenPowEqualTokenDivEqualTokenConcatEqualTokenModEqualTokenAndEqualTokenOrEqualTokenXorEqualTokenSlEqualTokenSrEqualTokenBooleanOrTokenBooleanAndTokenPowTokenSlTokenSrTokenIsIdenticalTokenIsNotIdenticalTokenIsEqualTokenIsNotEqualTokenIsSmallerOrEqualTokenIsGreaterOrEqualTokenHaltCompilerTokenCaseSeparatorTokenBackquoteTokenOpenCurlyBracesTokenCloseCurlyBracesTokenSemiColonTokenColonTokenOpenParenthesisTokenCloseParenthesisTokenOpenSquareBracketCloseSquareBracketQuestionMarkTokenAmpersandTokenMinusTokenPlusTokenCommaTokenVerticalBarTokenEqualTokenCaretTokenAsteriskTokenSlashTokenPercentTokenLessTokenGreaterTokenDotToken"
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, 460, 472, 487, 503, 516, 530, 554, 580, 596, 609, 621, 637, 651, 666, 681, 696, 707, 716, 726, 736, 746, 759, 769, 781, 795, 806, 814, 822, 836, 855, 868, 882, 896, 911, 924, 937, 950, 966, 979, 992, 1004, 1017, 1029, 1041, 1055, 1070, 1078, 1085, 1092, 1108, 1127, 1139, 1154, 1175, 1196, 1213, 1231, 1245, 1265, 1286, 1300, 1310, 1330, 1351, 1368, 1386, 1403, 1417, 1427, 1436, 1446, 1462, 1472, 1482, 1495, 1505, 1517, 1526, 1538, 1546} 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, 460, 472, 487, 503, 516, 530, 554, 580, 596, 609, 621, 637, 651, 666, 681, 696, 707, 716, 726, 736, 749, 759, 771, 785, 796, 804, 812, 826, 845, 858, 872, 886, 901, 914, 927, 940, 956, 969, 982, 994, 1007, 1019, 1031, 1045, 1060, 1068, 1075, 1082, 1098, 1117, 1129, 1144, 1165, 1186, 1203, 1221, 1235, 1255, 1276, 1290, 1300, 1320, 1341, 1358, 1376, 1393, 1407, 1417, 1426, 1436, 1452, 1462, 1472, 1485, 1495, 1507, 1516, 1528, 1536}
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

@ -6581,7 +6581,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.PrintToken).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

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

View File

@ -6498,7 +6498,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.PrintToken).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

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

View File

@ -1493,7 +1493,6 @@ func (p *Printer) printExprPrint(n node.Node) {
nn := n.(*expr.Print) nn := n.(*expr.Print)
p.printMeta(nn, meta.NodeStart) p.printMeta(nn, meta.NodeStart)
p.printMeta(nn, meta.PrintToken)
io.WriteString(p.w, "print") io.WriteString(p.w, "print")
p.Print(nn.Expr) p.Print(nn.Expr)

View File

@ -4027,7 +4027,7 @@ func TestPrinterPrintPrint(t *testing.T) {
&meta.Data{ &meta.Data{
Type: meta.WhiteSpaceType, Type: meta.WhiteSpaceType,
Value: " ", Value: " ",
TokenName: meta.PrintToken, TokenName: meta.NodeStart,
}, },
}, },
Expr: &expr.Variable{ Expr: &expr.Variable{