remove meta.LnumberToken and meta.DnumberToken

This commit is contained in:
z7zmey 2018-10-25 13:43:04 +03:00
parent 379032b8c5
commit 0d3a222673
8 changed files with 12 additions and 22 deletions

View File

@ -12,8 +12,6 @@ const (
IncludeOnceToken IncludeOnceToken
ExitToken ExitToken
IfToken IfToken
LnumberToken
DnumberToken
StringVarnameToken StringVarnameToken
NumStringToken NumStringToken
InlineHTMLToken InlineHTMLToken

View File

@ -4,9 +4,9 @@ package meta
import "strconv" import "strconv"
const _TokenName_name = "NodeStartNodeEndMagicConstantTokenIncludeTokenIncludeOnceTokenExitTokenIfTokenLnumberTokenDnumberTokenStringVarnameTokenNumStringTokenInlineHTMLTokenEncapsedAndWhitespaceTokenEchoTokenDoTokenWhileTokenEndwhileTokenForInitSemicolonTokenForCondSemicolonTokenForTokenEndforTokenForeachTokenEndforeachTokenDeclareTokenEnddeclareTokenAsTokenSwitchTokenEndswitchTokenCaseTokenDefaultTokenBreakTokenContinueTokenGotoTokenFunctionTokenConstTokenReturnTokenTryTokenCatchTokenFinallyTokenThrowTokenUseTokenInsteadofTokenGlobalTokenVarTokenUnsetTokenIssetTokenEmptyTokenClassTokenTraitTokenInterfaceTokenExtendsTokenImplementsTokenDoubleArrowTokenListTokenArrayTokenCallableTokenStartHeredocTokenCurlyOpenTokenPaamayimNekudotayimTokenUseLeadingNsSeparatorTokenNsSeparatorTokenEllipsisTokenEvalTokenRequireTokenRequireOnceTokenLogicalOrTokenLogicalXorTokenLogicalAndTokenInstanceofTokenNewAnchorCloneTokenElseifTokenElseTokenEndifTokenPrintTokenYieldTokenStaticTokenAbstractTokenFinalTokenPrivateTokenProtectedTokenPublicTokenIncTokenDecTokenYieldFromTokenObjectOperatorTokenIntCastTokenDoubleCastTokenStringCastTokenArrayCastTokenObjectCastTokenBoolCastTokenUnsetCastTokenCoalesceTokenSpaceshipTokenPlusEqualTokenMinusEqualTokenMulEqualTokenPowEqualTokenDivEqualTokenConcatEqualTokenModEqualTokenAndEqualTokenOrEqualTokenXorEqualTokenSlEqualTokenSrEqualTokenBooleanOrTokenBooleanAndTokenPowTokenSlTokenSrTokenIsIdenticalTokenIsNotIdenticalTokenIsEqualTokenIsNotEqualTokenIsSmallerOrEqualTokenIsGreaterOrEqualTokenHaltCompilerTokenCaseSeparatorTokenDoubleQuoteTokenBackquoteTokenOpenCurlyBracesTokenCloseCurlyBracesTokenSemiColonTokenColonTokenOpenParenthesisTokenCloseParenthesisTokenOpenSquareBracketCloseSquareBracketQuestionMarkTokenAmpersandTokenMinusTokenPlusTokenExclamationMarkTokenTildeTokenAtTokenCommaTokenVerticalBarTokenEqualTokenCaretTokenAsteriskTokenSlashTokenPercentTokenLessTokenGreaterTokenDotToken" const _TokenName_name = "NodeStartNodeEndMagicConstantTokenIncludeTokenIncludeOnceTokenExitTokenIfTokenStringVarnameTokenNumStringTokenInlineHTMLTokenEncapsedAndWhitespaceTokenEchoTokenDoTokenWhileTokenEndwhileTokenForInitSemicolonTokenForCondSemicolonTokenForTokenEndforTokenForeachTokenEndforeachTokenDeclareTokenEnddeclareTokenAsTokenSwitchTokenEndswitchTokenCaseTokenDefaultTokenBreakTokenContinueTokenGotoTokenFunctionTokenConstTokenReturnTokenTryTokenCatchTokenFinallyTokenThrowTokenUseTokenInsteadofTokenGlobalTokenVarTokenUnsetTokenIssetTokenEmptyTokenClassTokenTraitTokenInterfaceTokenExtendsTokenImplementsTokenDoubleArrowTokenListTokenArrayTokenCallableTokenStartHeredocTokenCurlyOpenTokenPaamayimNekudotayimTokenUseLeadingNsSeparatorTokenNsSeparatorTokenEllipsisTokenEvalTokenRequireTokenRequireOnceTokenLogicalOrTokenLogicalXorTokenLogicalAndTokenInstanceofTokenNewAnchorCloneTokenElseifTokenElseTokenEndifTokenPrintTokenYieldTokenStaticTokenAbstractTokenFinalTokenPrivateTokenProtectedTokenPublicTokenIncTokenDecTokenYieldFromTokenObjectOperatorTokenIntCastTokenDoubleCastTokenStringCastTokenArrayCastTokenObjectCastTokenBoolCastTokenUnsetCastTokenCoalesceTokenSpaceshipTokenPlusEqualTokenMinusEqualTokenMulEqualTokenPowEqualTokenDivEqualTokenConcatEqualTokenModEqualTokenAndEqualTokenOrEqualTokenXorEqualTokenSlEqualTokenSrEqualTokenBooleanOrTokenBooleanAndTokenPowTokenSlTokenSrTokenIsIdenticalTokenIsNotIdenticalTokenIsEqualTokenIsNotEqualTokenIsSmallerOrEqualTokenIsGreaterOrEqualTokenHaltCompilerTokenCaseSeparatorTokenDoubleQuoteTokenBackquoteTokenOpenCurlyBracesTokenCloseCurlyBracesTokenSemiColonTokenColonTokenOpenParenthesisTokenCloseParenthesisTokenOpenSquareBracketCloseSquareBracketQuestionMarkTokenAmpersandTokenMinusTokenPlusTokenExclamationMarkTokenTildeTokenAtTokenCommaTokenVerticalBarTokenEqualTokenCaretTokenAsteriskTokenSlashTokenPercentTokenLessTokenGreaterTokenDotToken"
var _TokenName_index = [...]uint16{0, 9, 16, 34, 46, 62, 71, 78, 90, 102, 120, 134, 149, 175, 184, 191, 201, 214, 235, 256, 264, 275, 287, 302, 314, 329, 336, 347, 361, 370, 382, 392, 405, 414, 427, 437, 448, 456, 466, 478, 488, 496, 510, 521, 529, 539, 549, 559, 569, 579, 593, 605, 620, 636, 645, 655, 668, 685, 699, 723, 749, 765, 778, 787, 799, 815, 829, 844, 859, 874, 883, 893, 904, 913, 923, 933, 943, 954, 967, 977, 989, 1003, 1014, 1022, 1030, 1044, 1063, 1075, 1090, 1105, 1119, 1134, 1147, 1161, 1174, 1188, 1202, 1217, 1230, 1243, 1256, 1272, 1285, 1298, 1310, 1323, 1335, 1347, 1361, 1376, 1384, 1391, 1398, 1414, 1433, 1445, 1460, 1481, 1502, 1519, 1537, 1553, 1567, 1587, 1608, 1622, 1632, 1652, 1673, 1690, 1708, 1725, 1739, 1749, 1758, 1778, 1788, 1795, 1805, 1821, 1831, 1841, 1854, 1864, 1876, 1885, 1897, 1905} var _TokenName_index = [...]uint16{0, 9, 16, 34, 46, 62, 71, 78, 96, 110, 125, 151, 160, 167, 177, 190, 211, 232, 240, 251, 263, 278, 290, 305, 312, 323, 337, 346, 358, 368, 381, 390, 403, 413, 424, 432, 442, 454, 464, 472, 486, 497, 505, 515, 525, 535, 545, 555, 569, 581, 596, 612, 621, 631, 644, 661, 675, 699, 725, 741, 754, 763, 775, 791, 805, 820, 835, 850, 859, 869, 880, 889, 899, 909, 919, 930, 943, 953, 965, 979, 990, 998, 1006, 1020, 1039, 1051, 1066, 1081, 1095, 1110, 1123, 1137, 1150, 1164, 1178, 1193, 1206, 1219, 1232, 1248, 1261, 1274, 1286, 1299, 1311, 1323, 1337, 1352, 1360, 1367, 1374, 1390, 1409, 1421, 1436, 1457, 1478, 1495, 1513, 1529, 1543, 1563, 1584, 1598, 1608, 1628, 1649, 1666, 1684, 1701, 1715, 1725, 1734, 1754, 1764, 1771, 1781, 1797, 1807, 1817, 1830, 1840, 1852, 1861, 1873, 1881}
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

@ -7302,7 +7302,7 @@ yydefault:
yyVAL.node.SetPosition(yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token)) yyVAL.node.SetPosition(yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
// save comments // save comments
yyDollar[1].token.Meta.SetTokenName(meta.LnumberToken).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)
} }
@ -7316,7 +7316,7 @@ yydefault:
yyVAL.node.SetPosition(yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token)) yyVAL.node.SetPosition(yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
// save comments // save comments
yyDollar[1].token.Meta.SetTokenName(meta.DnumberToken).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

@ -4886,7 +4886,7 @@ common_scalar:
$$.SetPosition(yylex.(*Parser).positionBuilder.NewTokenPosition($1)) $$.SetPosition(yylex.(*Parser).positionBuilder.NewTokenPosition($1))
// save comments // save comments
$1.Meta.SetTokenName(meta.LnumberToken).AppendTo($$.GetMeta()) $1.Meta.SetTokenName(meta.NodeStart).AppendTo($$.GetMeta())
yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL)
} }
@ -4898,7 +4898,7 @@ common_scalar:
$$.SetPosition(yylex.(*Parser).positionBuilder.NewTokenPosition($1)) $$.SetPosition(yylex.(*Parser).positionBuilder.NewTokenPosition($1))
// save comments // save comments
$1.Meta.SetTokenName(meta.DnumberToken).AppendTo($$.GetMeta()) $1.Meta.SetTokenName(meta.NodeStart).AppendTo($$.GetMeta())
yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL)
} }

View File

@ -6911,7 +6911,7 @@ yydefault:
yyVAL.node.SetPosition(yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token)) yyVAL.node.SetPosition(yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
// save comments // save comments
yyDollar[1].token.Meta.SetTokenName(meta.LnumberToken).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)
} }
@ -6925,7 +6925,7 @@ yydefault:
yyVAL.node.SetPosition(yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token)) yyVAL.node.SetPosition(yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
// save comments // save comments
yyDollar[1].token.Meta.SetTokenName(meta.DnumberToken).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

@ -4321,7 +4321,7 @@ scalar:
$$.SetPosition(yylex.(*Parser).positionBuilder.NewTokenPosition($1)) $$.SetPosition(yylex.(*Parser).positionBuilder.NewTokenPosition($1))
// save comments // save comments
$1.Meta.SetTokenName(meta.LnumberToken).AppendTo($$.GetMeta()) $1.Meta.SetTokenName(meta.NodeStart).AppendTo($$.GetMeta())
yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL)
} }
@ -4333,7 +4333,7 @@ scalar:
$$.SetPosition(yylex.(*Parser).positionBuilder.NewTokenPosition($1)) $$.SetPosition(yylex.(*Parser).positionBuilder.NewTokenPosition($1))
// save comments // save comments
$1.Meta.SetTokenName(meta.DnumberToken).AppendTo($$.GetMeta()) $1.Meta.SetTokenName(meta.NodeStart).AppendTo($$.GetMeta())
yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL)
} }

View File

@ -549,22 +549,14 @@ func (p *Printer) printNameRelative(n node.Node) {
func (p *Printer) printScalarLNumber(n node.Node) { func (p *Printer) printScalarLNumber(n node.Node) {
nn := n.(*scalar.Lnumber) nn := n.(*scalar.Lnumber)
p.printMeta(nn, meta.NodeStart) p.printMeta(nn, meta.NodeStart)
p.printMeta(nn, meta.LnumberToken)
io.WriteString(p.w, nn.Value) io.WriteString(p.w, nn.Value)
p.printMeta(nn, meta.NodeEnd) p.printMeta(nn, meta.NodeEnd)
} }
func (p *Printer) printScalarDNumber(n node.Node) { func (p *Printer) printScalarDNumber(n node.Node) {
nn := n.(*scalar.Dnumber) nn := n.(*scalar.Dnumber)
p.printMeta(nn, meta.NodeStart) p.printMeta(nn, meta.NodeStart)
p.printMeta(nn, meta.DnumberToken)
io.WriteString(p.w, nn.Value) io.WriteString(p.w, nn.Value)
p.printMeta(nn, meta.NodeEnd) p.printMeta(nn, meta.NodeEnd)
} }

View File

@ -531,7 +531,7 @@ func TestPrinterPrintScalarLNumber(t *testing.T) {
&meta.Data{ &meta.Data{
Type: meta.WhiteSpaceType, Type: meta.WhiteSpaceType,
Value: " ", Value: " ",
TokenName: meta.LnumberToken, TokenName: meta.NodeStart,
}, },
}, },
Value: "1", Value: "1",
@ -554,7 +554,7 @@ func TestPrinterPrintScalarDNumber(t *testing.T) {
&meta.Data{ &meta.Data{
Type: meta.WhiteSpaceType, Type: meta.WhiteSpaceType,
Value: " ", Value: " ",
TokenName: meta.DnumberToken, TokenName: meta.NodeStart,
}, },
}, },
Value: ".1", Value: ".1",