remove meta.VariableToken meta.DollarOpenCurlyBracesToken meta.DollarToken and fix go_dumper

This commit is contained in:
z7zmey 2018-10-24 22:32:35 +03:00
parent fd87c9cc34
commit 5e964e074b
14 changed files with 975 additions and 969 deletions

View File

@ -17,7 +17,6 @@ const (
DnumberToken
StringToken
StringVarnameToken
VariableToken
NumStringToken
InlineHTMLToken
EncapsedAndWhitespaceToken
@ -66,8 +65,6 @@ const (
ArrayToken
CallableToken
StartHeredocToken
DollarOpenCurlyBracesToken
DollarCloseCurlyBracesToken
CurlyOpenToken
PaamayimNekudotayimToken
NamespaceToken
@ -150,7 +147,6 @@ const (
ExclamationMarkToken // '!'
TildeToken // '~'
AtToken // '@'
DollarToken // '$'
CommaToken // ','
VerticalBarToken // '|'
EqualToken // '='

View File

@ -4,9 +4,9 @@ package meta
import "strconv"
const _TokenName_name = "UnknownTokenNodeStartNodeEndMagicConstantTokenIncludeTokenIncludeOnceTokenExitTokenIfTokenLnumberTokenDnumberTokenStringTokenStringVarnameTokenVariableTokenNumStringTokenInlineHTMLTokenEncapsedAndWhitespaceTokenConstantEncapsedStringTokenEchoTokenDoTokenWhileTokenEndwhileTokenForInitSemicolonTokenForCondSemicolonTokenForTokenEndforTokenForeachTokenEndforeachTokenDeclareTokenEnddeclareTokenAsTokenSwitchTokenEndswitchTokenCaseTokenDefaultTokenBreakTokenContinueTokenGotoTokenFunctionTokenConstTokenReturnTokenTryTokenCatchTokenFinallyTokenThrowTokenUseTokenInsteadofTokenGlobalTokenVarTokenUnsetTokenIssetTokenEmptyTokenClassTokenTraitTokenInterfaceTokenExtendsTokenImplementsTokenDoubleArrowTokenListTokenArrayTokenCallableTokenStartHeredocTokenDollarOpenCurlyBracesTokenDollarCloseCurlyBracesTokenCurlyOpenTokenPaamayimNekudotayimTokenNamespaceTokenUseLeadingNsSeparatorTokenNsSeparatorTokenEllipsisTokenEvalTokenRequireTokenRequireOnceTokenLogicalOrTokenLogicalXorTokenLogicalAndTokenInstanceofTokenNewAnchorCloneTokenElseifTokenElseTokenEndifTokenPrintTokenYieldTokenStaticTokenAbstractTokenFinalTokenPrivateTokenProtectedTokenPublicTokenIncTokenDecTokenYieldFromTokenObjectOperatorTokenIntCastTokenDoubleCastTokenStringCastTokenArrayCastTokenObjectCastTokenBoolCastTokenUnsetCastTokenCoalesceTokenSpaceshipTokenPlusEqualTokenMinusEqualTokenMulEqualTokenPowEqualTokenDivEqualTokenConcatEqualTokenModEqualTokenAndEqualTokenOrEqualTokenXorEqualTokenSlEqualTokenSrEqualTokenBooleanOrTokenBooleanAndTokenPowTokenSlTokenSrTokenIsIdenticalTokenIsNotIdenticalTokenIsEqualTokenIsNotEqualTokenIsSmallerOrEqualTokenIsGreaterOrEqualTokenHaltCompilerTokenIdentifierTokenCaseSeparatorTokenDoubleQuoteTokenBackquoteTokenOpenCurlyBracesTokenCloseCurlyBracesTokenSemiColonTokenColonTokenOpenParenthesisTokenCloseParenthesisTokenOpenSquareBracketCloseSquareBracketQuestionMarkTokenAmpersandTokenMinusTokenPlusTokenExclamationMarkTokenTildeTokenAtTokenDollarTokenCommaTokenVerticalBarTokenEqualTokenCaretTokenAsteriskTokenSlashTokenPercentTokenLessTokenGreaterTokenDotToken"
const _TokenName_name = "UnknownTokenNodeStartNodeEndMagicConstantTokenIncludeTokenIncludeOnceTokenExitTokenIfTokenLnumberTokenDnumberTokenStringTokenStringVarnameTokenNumStringTokenInlineHTMLTokenEncapsedAndWhitespaceTokenConstantEncapsedStringTokenEchoTokenDoTokenWhileTokenEndwhileTokenForInitSemicolonTokenForCondSemicolonTokenForTokenEndforTokenForeachTokenEndforeachTokenDeclareTokenEnddeclareTokenAsTokenSwitchTokenEndswitchTokenCaseTokenDefaultTokenBreakTokenContinueTokenGotoTokenFunctionTokenConstTokenReturnTokenTryTokenCatchTokenFinallyTokenThrowTokenUseTokenInsteadofTokenGlobalTokenVarTokenUnsetTokenIssetTokenEmptyTokenClassTokenTraitTokenInterfaceTokenExtendsTokenImplementsTokenDoubleArrowTokenListTokenArrayTokenCallableTokenStartHeredocTokenCurlyOpenTokenPaamayimNekudotayimTokenNamespaceTokenUseLeadingNsSeparatorTokenNsSeparatorTokenEllipsisTokenEvalTokenRequireTokenRequireOnceTokenLogicalOrTokenLogicalXorTokenLogicalAndTokenInstanceofTokenNewAnchorCloneTokenElseifTokenElseTokenEndifTokenPrintTokenYieldTokenStaticTokenAbstractTokenFinalTokenPrivateTokenProtectedTokenPublicTokenIncTokenDecTokenYieldFromTokenObjectOperatorTokenIntCastTokenDoubleCastTokenStringCastTokenArrayCastTokenObjectCastTokenBoolCastTokenUnsetCastTokenCoalesceTokenSpaceshipTokenPlusEqualTokenMinusEqualTokenMulEqualTokenPowEqualTokenDivEqualTokenConcatEqualTokenModEqualTokenAndEqualTokenOrEqualTokenXorEqualTokenSlEqualTokenSrEqualTokenBooleanOrTokenBooleanAndTokenPowTokenSlTokenSrTokenIsIdenticalTokenIsNotIdenticalTokenIsEqualTokenIsNotEqualTokenIsSmallerOrEqualTokenIsGreaterOrEqualTokenHaltCompilerTokenIdentifierTokenCaseSeparatorTokenDoubleQuoteTokenBackquoteTokenOpenCurlyBracesTokenCloseCurlyBracesTokenSemiColonTokenColonTokenOpenParenthesisTokenCloseParenthesisTokenOpenSquareBracketCloseSquareBracketQuestionMarkTokenAmpersandTokenMinusTokenPlusTokenExclamationMarkTokenTildeTokenAtTokenCommaTokenVerticalBarTokenEqualTokenCaretTokenAsteriskTokenSlashTokenPercentTokenLessTokenGreaterTokenDotToken"
var _TokenName_index = [...]uint16{0, 12, 21, 28, 46, 58, 74, 83, 90, 102, 114, 125, 143, 156, 170, 185, 211, 238, 247, 254, 264, 277, 298, 319, 327, 338, 350, 365, 377, 392, 399, 410, 424, 433, 445, 455, 468, 477, 490, 500, 511, 519, 529, 541, 551, 559, 573, 584, 592, 602, 612, 622, 632, 642, 656, 668, 683, 699, 708, 718, 731, 748, 774, 801, 815, 839, 853, 879, 895, 908, 917, 929, 945, 959, 974, 989, 1004, 1013, 1023, 1034, 1043, 1053, 1063, 1073, 1084, 1097, 1107, 1119, 1133, 1144, 1152, 1160, 1174, 1193, 1205, 1220, 1235, 1249, 1264, 1277, 1291, 1304, 1318, 1332, 1347, 1360, 1373, 1386, 1402, 1415, 1428, 1440, 1453, 1465, 1477, 1491, 1506, 1514, 1521, 1528, 1544, 1563, 1575, 1590, 1611, 1632, 1649, 1664, 1682, 1698, 1712, 1732, 1753, 1767, 1777, 1797, 1818, 1835, 1853, 1870, 1884, 1894, 1903, 1923, 1933, 1940, 1951, 1961, 1977, 1987, 1997, 2010, 2020, 2032, 2041, 2053, 2061}
var _TokenName_index = [...]uint16{0, 12, 21, 28, 46, 58, 74, 83, 90, 102, 114, 125, 143, 157, 172, 198, 225, 234, 241, 251, 264, 285, 306, 314, 325, 337, 352, 364, 379, 386, 397, 411, 420, 432, 442, 455, 464, 477, 487, 498, 506, 516, 528, 538, 546, 560, 571, 579, 589, 599, 609, 619, 629, 643, 655, 670, 686, 695, 705, 718, 735, 749, 773, 787, 813, 829, 842, 851, 863, 879, 893, 908, 923, 938, 947, 957, 968, 977, 987, 997, 1007, 1018, 1031, 1041, 1053, 1067, 1078, 1086, 1094, 1108, 1127, 1139, 1154, 1169, 1183, 1198, 1211, 1225, 1238, 1252, 1266, 1281, 1294, 1307, 1320, 1336, 1349, 1362, 1374, 1387, 1399, 1411, 1425, 1440, 1448, 1455, 1462, 1478, 1497, 1509, 1524, 1545, 1566, 1583, 1598, 1616, 1632, 1646, 1666, 1687, 1701, 1711, 1731, 1752, 1769, 1787, 1804, 1818, 1828, 1837, 1857, 1867, 1874, 1884, 1900, 1910, 1920, 1933, 1943, 1955, 1964, 1976, 1984}
func (i TokenName) String() string {
if i < 0 || i >= TokenName(len(_TokenName_index)-1) {

File diff suppressed because it is too large Load Diff

View File

@ -1387,8 +1387,8 @@ catch_statement:
// save comments
$1.Meta.SetTokenName(meta.CatchToken).AppendTo(catch.GetMeta())
$2.Meta.SetTokenName(meta.OpenParenthesisToken).AppendTo(catch.GetMeta())
$4.Meta.SetTokenName(meta.VariableToken).AppendTo(variable.GetMeta())
yylex.(*Parser).appendMeta(variable, &meta.Data{"$", meta.TokenType, nil, meta.DollarToken}, meta.DollarToken)
$4.Meta.SetTokenName(meta.NodeStart).AppendTo(variable.GetMeta())
yylex.(*Parser).appendMeta(variable, &meta.Data{"$", meta.TokenType, nil, meta.NodeStart}, meta.NodeStart)
$5.Meta.SetTokenName(meta.CloseParenthesisToken).AppendTo(catch.GetMeta())
$6.Meta.SetTokenName(meta.OpenCurlyBracesToken).AppendTo(catch.GetMeta())
$8.Meta.SetTokenName(meta.CloseCurlyBracesToken).AppendTo(catch.GetMeta())
@ -1465,8 +1465,8 @@ additional_catch:
// save comments
$1.Meta.SetTokenName(meta.CatchToken).AppendTo($$.GetMeta())
$2.Meta.SetTokenName(meta.OpenParenthesisToken).AppendTo($$.GetMeta())
$4.Meta.SetTokenName(meta.VariableToken).AppendTo(variable.GetMeta())
yylex.(*Parser).appendMeta(variable, &meta.Data{"$", meta.TokenType, nil, meta.DollarToken}, meta.DollarToken)
$4.Meta.SetTokenName(meta.NodeStart).AppendTo(variable.GetMeta())
yylex.(*Parser).appendMeta(variable, &meta.Data{"$", meta.TokenType, nil, meta.NodeStart}, meta.NodeStart)
$5.Meta.SetTokenName(meta.CloseParenthesisToken).AppendTo($$.GetMeta())
$6.Meta.SetTokenName(meta.OpenCurlyBracesToken).AppendTo($$.GetMeta())
$8.Meta.SetTokenName(meta.CloseCurlyBracesToken).AppendTo($$.GetMeta())
@ -2256,8 +2256,8 @@ parameter:
if $3 != nil {
$3.Meta.SetTokenName(meta.EllipsisToken).AppendTo($$.GetMeta())
}
$4.Meta.SetTokenName(meta.VariableToken).AppendTo(variable.GetMeta())
yylex.(*Parser).appendMeta(variable, &meta.Data{"$", meta.TokenType, nil, meta.DollarToken}, meta.DollarToken)
$4.Meta.SetTokenName(meta.NodeStart).AppendTo(variable.GetMeta())
yylex.(*Parser).appendMeta(variable, &meta.Data{"$", meta.TokenType, nil, meta.NodeStart}, meta.NodeStart)
yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL)
}
@ -2287,8 +2287,8 @@ parameter:
if $3 != nil {
$3.Meta.SetTokenName(meta.EllipsisToken).AppendTo($$.GetMeta())
}
$4.Meta.SetTokenName(meta.VariableToken).AppendTo(variable.GetMeta())
yylex.(*Parser).appendMeta(variable, &meta.Data{"$", meta.TokenType, nil, meta.DollarToken}, meta.DollarToken)
$4.Meta.SetTokenName(meta.NodeStart).AppendTo(variable.GetMeta())
yylex.(*Parser).appendMeta(variable, &meta.Data{"$", meta.TokenType, nil, meta.NodeStart}, meta.NodeStart)
$5.Meta.SetTokenName(meta.EqualToken).AppendTo($$.GetMeta())
yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL)
@ -2474,8 +2474,8 @@ global_var:
$$.SetPosition(yylex.(*Parser).positionBuilder.NewTokenPosition($1))
// save comments
$1.Meta.SetTokenName(meta.VariableToken).AppendTo($$.GetMeta())
yylex.(*Parser).appendMeta($$, &meta.Data{"$", meta.TokenType, nil, meta.DollarToken}, meta.DollarToken)
$1.Meta.SetTokenName(meta.NodeStart).AppendTo($$.GetMeta())
yylex.(*Parser).appendMeta($$, &meta.Data{"$", meta.TokenType, nil, meta.NodeStart}, meta.NodeStart)
yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL)
}
@ -2487,9 +2487,9 @@ global_var:
$$.SetPosition(yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $2))
// save comments
$1.Meta.SetTokenName(meta.DollarToken).AppendTo($$.GetMeta())
yylex.(*Parser).appendMetaToken($$, $1, meta.DollarToken)
yylex.(*Parser).appendMeta($$, &meta.Data{"$", meta.TokenType, nil, meta.DollarToken}, meta.DollarToken)
$1.Meta.SetTokenName(meta.NodeStart).AppendTo($$.GetMeta())
yylex.(*Parser).appendMetaToken($$, $1, meta.NodeStart)
yylex.(*Parser).appendMeta($$, &meta.Data{"$", meta.TokenType, nil, meta.NodeStart}, meta.NodeStart)
yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL)
}
@ -2501,10 +2501,12 @@ global_var:
$$.SetPosition(yylex.(*Parser).positionBuilder.NewTokensPosition($1, $4))
// save comments
$1.Meta.SetTokenName(meta.DollarToken).AppendTo($$.GetMeta())
yylex.(*Parser).appendMetaToken($$, $1, meta.DollarToken)
$2.Meta.SetTokenName(meta.OpenCurlyBracesToken).AppendTo($$.GetMeta())
$4.Meta.SetTokenName(meta.CloseCurlyBracesToken).AppendTo($$.GetMeta())
$1.Meta.SetTokenName(meta.NodeStart).AppendTo($$.GetMeta())
yylex.(*Parser).appendMetaToken($$, $1, meta.NodeStart)
$2.Meta.SetTokenName(meta.NodeStart).AppendTo($$.GetMeta())
yylex.(*Parser).appendMetaToken($$, $2, meta.NodeStart)
$4.Meta.SetTokenName(meta.NodeEnd).AppendTo($$.GetMeta())
yylex.(*Parser).appendMetaToken($$, $4, meta.NodeEnd)
yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL)
}
@ -2526,8 +2528,8 @@ static_var_list:
// save comments
$2.Meta.SetTokenName(meta.NodeEnd).AppendTo(lastNode($1).GetMeta())
$3.Meta.SetTokenName(meta.VariableToken).AppendTo(variable.GetMeta())
yylex.(*Parser).appendMeta(variable, &meta.Data{"$", meta.TokenType, nil, meta.DollarToken}, meta.DollarToken)
$3.Meta.SetTokenName(meta.NodeStart).AppendTo(variable.GetMeta())
yylex.(*Parser).appendMeta(variable, &meta.Data{"$", meta.TokenType, nil, meta.NodeStart}, meta.NodeStart)
yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL)
}
@ -2545,8 +2547,8 @@ static_var_list:
// save comments
$2.Meta.SetTokenName(meta.NodeEnd).AppendTo(lastNode($1).GetMeta())
$3.Meta.SetTokenName(meta.VariableToken).AppendTo(variable.GetMeta())
yylex.(*Parser).appendMeta(variable, &meta.Data{"$", meta.TokenType, nil, meta.DollarToken}, meta.DollarToken)
$3.Meta.SetTokenName(meta.NodeStart).AppendTo(variable.GetMeta())
yylex.(*Parser).appendMeta(variable, &meta.Data{"$", meta.TokenType, nil, meta.NodeStart}, meta.NodeStart)
$4.Meta.SetTokenName(meta.EqualToken).AppendTo(staticVar.GetMeta())
yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL)
@ -2564,8 +2566,8 @@ static_var_list:
staticVar.SetPosition(yylex.(*Parser).positionBuilder.NewTokenPosition($1))
// save comments
$1.Meta.SetTokenName(meta.VariableToken).AppendTo(variable.GetMeta())
yylex.(*Parser).appendMeta(variable, &meta.Data{"$", meta.TokenType, nil, meta.DollarToken}, meta.DollarToken)
$1.Meta.SetTokenName(meta.NodeStart).AppendTo(variable.GetMeta())
yylex.(*Parser).appendMeta(variable, &meta.Data{"$", meta.TokenType, nil, meta.NodeStart}, meta.NodeStart)
yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL)
}
@ -2582,8 +2584,8 @@ static_var_list:
staticVar.SetPosition(yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $3))
// save comments
$1.Meta.SetTokenName(meta.VariableToken).AppendTo(variable.GetMeta())
yylex.(*Parser).appendMeta(variable, &meta.Data{"$", meta.TokenType, nil, meta.DollarToken}, meta.DollarToken)
$1.Meta.SetTokenName(meta.NodeStart).AppendTo(variable.GetMeta())
yylex.(*Parser).appendMeta(variable, &meta.Data{"$", meta.TokenType, nil, meta.NodeStart}, meta.NodeStart)
$2.Meta.SetTokenName(meta.EqualToken).AppendTo(staticVar.GetMeta())
yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL)
@ -3070,8 +3072,8 @@ class_variable_declaration:
// save comments
$2.Meta.SetTokenName(meta.NodeEnd).AppendTo(lastNode($1).GetMeta())
$3.Meta.SetTokenName(meta.VariableToken).AppendTo(variable.GetMeta())
yylex.(*Parser).appendMeta(variable, &meta.Data{"$", meta.TokenType, nil, meta.DollarToken}, meta.DollarToken)
$3.Meta.SetTokenName(meta.NodeStart).AppendTo(variable.GetMeta())
yylex.(*Parser).appendMeta(variable, &meta.Data{"$", meta.TokenType, nil, meta.NodeStart}, meta.NodeStart)
yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL)
}
@ -3089,8 +3091,8 @@ class_variable_declaration:
// save comments
$2.Meta.SetTokenName(meta.NodeEnd).AppendTo(lastNode($1).GetMeta())
$3.Meta.SetTokenName(meta.VariableToken).AppendTo(variable.GetMeta())
yylex.(*Parser).appendMeta(variable, &meta.Data{"$", meta.TokenType, nil, meta.DollarToken}, meta.DollarToken)
$3.Meta.SetTokenName(meta.NodeStart).AppendTo(variable.GetMeta())
yylex.(*Parser).appendMeta(variable, &meta.Data{"$", meta.TokenType, nil, meta.NodeStart}, meta.NodeStart)
$4.Meta.SetTokenName(meta.EqualToken).AppendTo(property.GetMeta())
yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL)
@ -3108,8 +3110,8 @@ class_variable_declaration:
property.SetPosition(yylex.(*Parser).positionBuilder.NewTokenPosition($1))
// save comments
$1.Meta.SetTokenName(meta.VariableToken).AppendTo(variable.GetMeta())
yylex.(*Parser).appendMeta(variable, &meta.Data{"$", meta.TokenType, nil, meta.DollarToken}, meta.DollarToken)
$1.Meta.SetTokenName(meta.NodeStart).AppendTo(variable.GetMeta())
yylex.(*Parser).appendMeta(variable, &meta.Data{"$", meta.TokenType, nil, meta.NodeStart}, meta.NodeStart)
yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL)
}
@ -3126,8 +3128,8 @@ class_variable_declaration:
property.SetPosition(yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $3))
// save comments
$1.Meta.SetTokenName(meta.VariableToken).AppendTo(variable.GetMeta())
yylex.(*Parser).appendMeta(variable, &meta.Data{"$", meta.TokenType, nil, meta.DollarToken}, meta.DollarToken)
$1.Meta.SetTokenName(meta.NodeStart).AppendTo(variable.GetMeta())
yylex.(*Parser).appendMeta(variable, &meta.Data{"$", meta.TokenType, nil, meta.NodeStart}, meta.NodeStart)
$2.Meta.SetTokenName(meta.EqualToken).AppendTo(property.GetMeta())
yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL)
@ -4460,8 +4462,8 @@ lexical_var_list:
// save comments
$2.Meta.SetTokenName(meta.NodeEnd).AppendTo(lastNode($1).GetMeta())
$3.Meta.SetTokenName(meta.VariableToken).AppendTo(variable.GetMeta())
yylex.(*Parser).appendMeta(variable, &meta.Data{"$", meta.TokenType, nil, meta.DollarToken}, meta.DollarToken)
$3.Meta.SetTokenName(meta.NodeStart).AppendTo(variable.GetMeta())
yylex.(*Parser).appendMeta(variable, &meta.Data{"$", meta.TokenType, nil, meta.NodeStart}, meta.NodeStart)
yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL)
}
@ -4480,8 +4482,8 @@ lexical_var_list:
// save comments
$2.Meta.SetTokenName(meta.NodeEnd).AppendTo(lastNode($1).GetMeta())
$3.Meta.SetTokenName(meta.AmpersandToken).AppendTo(reference.GetMeta())
$4.Meta.SetTokenName(meta.VariableToken).AppendTo(variable.GetMeta())
yylex.(*Parser).appendMeta(variable, &meta.Data{"$", meta.TokenType, nil, meta.DollarToken}, meta.DollarToken)
$4.Meta.SetTokenName(meta.NodeStart).AppendTo(variable.GetMeta())
yylex.(*Parser).appendMeta(variable, &meta.Data{"$", meta.TokenType, nil, meta.NodeStart}, meta.NodeStart)
yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL)
}
@ -4496,8 +4498,8 @@ lexical_var_list:
variable.SetPosition(yylex.(*Parser).positionBuilder.NewTokenPosition($1))
// save comments
$1.Meta.SetTokenName(meta.VariableToken).AppendTo(variable.GetMeta())
yylex.(*Parser).appendMeta(variable, &meta.Data{"$", meta.TokenType, nil, meta.DollarToken}, meta.DollarToken)
$1.Meta.SetTokenName(meta.NodeStart).AppendTo(variable.GetMeta())
yylex.(*Parser).appendMeta(variable, &meta.Data{"$", meta.TokenType, nil, meta.NodeStart}, meta.NodeStart)
yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL)
}
@ -4515,8 +4517,8 @@ lexical_var_list:
// save comments
$1.Meta.SetTokenName(meta.AmpersandToken).AppendTo(reference.GetMeta())
$2.Meta.SetTokenName(meta.VariableToken).AppendTo(variable.GetMeta())
yylex.(*Parser).appendMeta(variable, &meta.Data{"$", meta.TokenType, nil, meta.DollarToken}, meta.DollarToken)
$2.Meta.SetTokenName(meta.NodeStart).AppendTo(variable.GetMeta())
yylex.(*Parser).appendMeta(variable, &meta.Data{"$", meta.TokenType, nil, meta.NodeStart}, meta.NodeStart)
yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL)
}
@ -5619,7 +5621,7 @@ scalar:
// save comments
$1.Meta.SetTokenName(meta.IdentifierToken).AppendTo(name.GetMeta())
yylex.(*Parser).appendMeta($$, &meta.Data{"$", meta.TokenType, nil, meta.DollarToken}, meta.DollarToken)
yylex.(*Parser).appendMeta($$, &meta.Data{"$", meta.TokenType, nil, meta.NodeStart}, meta.NodeStart)
yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL)
}
@ -6186,8 +6188,8 @@ compound_variable:
$$.SetPosition(yylex.(*Parser).positionBuilder.NewTokenPosition($1))
// save comments
$1.Meta.SetTokenName(meta.VariableToken).AppendTo($$.GetMeta())
yylex.(*Parser).appendMeta($$, &meta.Data{"$", meta.TokenType, nil, meta.DollarToken}, meta.DollarToken)
$1.Meta.SetTokenName(meta.NodeStart).AppendTo($$.GetMeta())
yylex.(*Parser).appendMeta($$, &meta.Data{"$", meta.TokenType, nil, meta.NodeStart}, meta.NodeStart)
yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL)
}
@ -6199,12 +6201,12 @@ compound_variable:
$$.SetPosition(yylex.(*Parser).positionBuilder.NewTokensPosition($1, $4))
// save comments
$1.Meta.SetTokenName(meta.DollarToken).AppendTo($$.GetMeta())
yylex.(*Parser).appendMetaToken($$, $1, meta.DollarToken)
$2.Meta.SetTokenName(meta.OpenCurlyBracesToken).AppendTo($$.GetMeta())
yylex.(*Parser).appendMetaToken($$, $2, meta.OpenCurlyBracesToken)
$4.Meta.SetTokenName(meta.CloseCurlyBracesToken).AppendTo($$.GetMeta())
yylex.(*Parser).appendMetaToken($$, $4, meta.CloseCurlyBracesToken)
$1.Meta.SetTokenName(meta.NodeStart).AppendTo($$.GetMeta())
yylex.(*Parser).appendMetaToken($$, $1, meta.NodeStart)
$2.Meta.SetTokenName(meta.NodeStart).AppendTo($$.GetMeta())
yylex.(*Parser).appendMetaToken($$, $2, meta.NodeStart)
$4.Meta.SetTokenName(meta.NodeEnd).AppendTo($$.GetMeta())
yylex.(*Parser).appendMetaToken($$, $4, meta.NodeEnd)
yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL)
}
@ -6330,8 +6332,8 @@ simple_indirect_reference:
n.SetPosition(yylex.(*Parser).positionBuilder.NewTokenPosition($1))
// save comments
$1.Meta.SetTokenName(meta.DollarToken).AppendTo(n.GetMeta())
yylex.(*Parser).appendMetaToken(n, $1, meta.DollarToken)
$1.Meta.SetTokenName(meta.NodeStart).AppendTo(n.GetMeta())
yylex.(*Parser).appendMetaToken(n, $1, meta.NodeStart)
yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL)
}
@ -6348,8 +6350,8 @@ simple_indirect_reference:
n.SetPosition(yylex.(*Parser).positionBuilder.NewTokenPosition($2))
// save comments
$2.Meta.SetTokenName(meta.DollarToken).AppendTo(n.GetMeta())
yylex.(*Parser).appendMetaToken(n, $2, meta.DollarToken)
$2.Meta.SetTokenName(meta.NodeStart).AppendTo(n.GetMeta())
yylex.(*Parser).appendMetaToken(n, $2, meta.NodeStart)
yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL)
}
@ -6610,8 +6612,8 @@ encaps_var:
$$.SetPosition(yylex.(*Parser).positionBuilder.NewTokenPosition($1))
// save comments
$1.Meta.SetTokenName(meta.VariableToken).AppendTo($$.GetMeta())
yylex.(*Parser).appendMeta($$, &meta.Data{"$", meta.TokenType, nil, meta.DollarToken}, meta.DollarToken)
$1.Meta.SetTokenName(meta.NodeStart).AppendTo($$.GetMeta())
yylex.(*Parser).appendMeta($$, &meta.Data{"$", meta.TokenType, nil, meta.NodeStart}, meta.NodeStart)
yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL)
}
@ -6627,8 +6629,8 @@ encaps_var:
$$.SetPosition(yylex.(*Parser).positionBuilder.NewTokensPosition($1, $4))
// save comments
$1.Meta.SetTokenName(meta.VariableToken).AppendTo(variable.GetMeta())
yylex.(*Parser).appendMeta(variable, &meta.Data{"$", meta.TokenType, nil, meta.DollarToken}, meta.DollarToken)
$1.Meta.SetTokenName(meta.NodeStart).AppendTo(variable.GetMeta())
yylex.(*Parser).appendMeta(variable, &meta.Data{"$", meta.TokenType, nil, meta.NodeStart}, meta.NodeStart)
$2.Meta.SetTokenName(meta.OpenSquareBracket).AppendTo($$.GetMeta())
yylex.(*Parser).appendMetaToken($$, $2, meta.OpenSquareBracket)
$4.Meta.SetTokenName(meta.CloseSquareBracket).AppendTo($$.GetMeta())
@ -6650,8 +6652,8 @@ encaps_var:
$$.SetPosition(yylex.(*Parser).positionBuilder.NewTokensPosition($1, $3))
// save comments
$1.Meta.SetTokenName(meta.VariableToken).AppendTo(variable.GetMeta())
yylex.(*Parser).appendMeta(variable, &meta.Data{"$", meta.TokenType, nil, meta.DollarToken}, meta.DollarToken)
$1.Meta.SetTokenName(meta.NodeStart).AppendTo(variable.GetMeta())
yylex.(*Parser).appendMeta(variable, &meta.Data{"$", meta.TokenType, nil, meta.NodeStart}, meta.NodeStart)
$2.Meta.SetTokenName(meta.ObjectOperatorToken).AppendTo($$.GetMeta())
$3.Meta.SetTokenName(meta.IdentifierToken).AppendTo(fetch.GetMeta())
@ -6667,10 +6669,10 @@ encaps_var:
$$.SetPosition(yylex.(*Parser).positionBuilder.NewTokensPosition($1, $3))
// save comments
$1.Meta.SetTokenName(meta.DollarOpenCurlyBracesToken).AppendTo($$.GetMeta())
yylex.(*Parser).appendMetaToken($$, $1, meta.DollarOpenCurlyBracesToken)
$3.Meta.SetTokenName(meta.DollarCloseCurlyBracesToken).AppendTo($$.GetMeta())
yylex.(*Parser).appendMetaToken($$, $3, meta.DollarCloseCurlyBracesToken)
$1.Meta.SetTokenName(meta.NodeStart).AppendTo($$.GetMeta())
yylex.(*Parser).appendMetaToken($$, $1, meta.NodeStart)
$3.Meta.SetTokenName(meta.NodeEnd).AppendTo($$.GetMeta())
yylex.(*Parser).appendMetaToken($$, $3, meta.NodeEnd)
yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL)
}
@ -6686,11 +6688,11 @@ encaps_var:
$$.SetPosition(yylex.(*Parser).positionBuilder.NewTokensPosition($1, $3))
// save comments
$1.Meta.SetTokenName(meta.DollarOpenCurlyBracesToken).AppendTo($$.GetMeta())
yylex.(*Parser).appendMetaToken($$, $1, meta.DollarOpenCurlyBracesToken)
$1.Meta.SetTokenName(meta.NodeStart).AppendTo($$.GetMeta())
yylex.(*Parser).appendMetaToken($$, $1, meta.NodeStart)
$2.Meta.SetTokenName(meta.IdentifierToken).AppendTo(name.GetMeta())
$3.Meta.SetTokenName(meta.DollarCloseCurlyBracesToken).AppendTo($$.GetMeta())
yylex.(*Parser).appendMetaToken($$, $3, meta.DollarCloseCurlyBracesToken)
$3.Meta.SetTokenName(meta.NodeEnd).AppendTo($$.GetMeta())
yylex.(*Parser).appendMetaToken($$, $3, meta.NodeEnd)
yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL)
}
@ -6723,8 +6725,8 @@ encaps_var:
$$ = $2;
// save comments
$1.Meta.SetTokenName(meta.NodeStart).AppendTo($$.GetMeta())
yylex.(*Parser).appendMetaToken($$, $1, meta.NodeStart)
$1.Meta.SetTokenName(meta.NodeStart).PrependTo($$.GetMeta())
yylex.(*Parser).prependMetaToken($$, $1, meta.NodeStart)
$3.Meta.SetTokenName(meta.NodeEnd).AppendTo($$.GetMeta())
yylex.(*Parser).appendMetaToken($$, $3, meta.NodeEnd)
@ -6772,8 +6774,8 @@ encaps_var_offset:
$$.SetPosition(yylex.(*Parser).positionBuilder.NewTokenPosition($1))
// save comments
$1.Meta.SetTokenName(meta.VariableToken).AppendTo($$.GetMeta())
yylex.(*Parser).appendMeta($$, &meta.Data{"$", meta.TokenType, nil, meta.DollarToken}, meta.DollarToken)
$1.Meta.SetTokenName(meta.NodeStart).AppendTo($$.GetMeta())
yylex.(*Parser).appendMeta($$, &meta.Data{"$", meta.TokenType, nil, meta.NodeStart}, meta.NodeStart)
yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL)
}

View File

@ -1,5 +1,3 @@
// Code generated by goyacc -o php7/php7.go php7/php7.y. DO NOT EDIT.
//line php7/php7.y:2
package php7
@ -3694,8 +3692,8 @@ yydefault:
// save comments
yyDollar[2].token.Meta.SetTokenName(meta.CatchToken).AppendTo(catch.GetMeta())
yyDollar[3].token.Meta.SetTokenName(meta.OpenParenthesisToken).AppendTo(catch.GetMeta())
yyDollar[5].token.Meta.SetTokenName(meta.VariableToken).AppendTo(variable.GetMeta())
yylex.(*Parser).appendMeta(variable, &meta.Data{"$", meta.TokenType, nil, meta.DollarToken}, meta.DollarToken)
yyDollar[5].token.Meta.SetTokenName(meta.NodeStart).AppendTo(variable.GetMeta())
yylex.(*Parser).appendMeta(variable, &meta.Data{"$", meta.TokenType, nil, meta.NodeStart}, meta.NodeStart)
yyDollar[6].token.Meta.SetTokenName(meta.CloseParenthesisToken).AppendTo(catch.GetMeta())
yyDollar[7].token.Meta.SetTokenName(meta.OpenCurlyBracesToken).AppendTo(catch.GetMeta())
yyDollar[9].token.Meta.SetTokenName(meta.CloseCurlyBracesToken).AppendTo(catch.GetMeta())
@ -4508,8 +4506,8 @@ yydefault:
if yyDollar[3].token != nil {
yyDollar[3].token.Meta.SetTokenName(meta.EllipsisToken).AppendTo(yyVAL.node.GetMeta())
}
yyDollar[4].token.Meta.SetTokenName(meta.VariableToken).AppendTo(variable.GetMeta())
yylex.(*Parser).appendMeta(variable, &meta.Data{"$", meta.TokenType, nil, meta.DollarToken}, meta.DollarToken)
yyDollar[4].token.Meta.SetTokenName(meta.NodeStart).AppendTo(variable.GetMeta())
yylex.(*Parser).appendMeta(variable, &meta.Data{"$", meta.TokenType, nil, meta.NodeStart}, meta.NodeStart)
yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL)
}
@ -4541,8 +4539,8 @@ yydefault:
if yyDollar[3].token != nil {
yyDollar[3].token.Meta.SetTokenName(meta.EllipsisToken).AppendTo(yyVAL.node.GetMeta())
}
yyDollar[4].token.Meta.SetTokenName(meta.VariableToken).AppendTo(variable.GetMeta())
yylex.(*Parser).appendMeta(variable, &meta.Data{"$", meta.TokenType, nil, meta.DollarToken}, meta.DollarToken)
yyDollar[4].token.Meta.SetTokenName(meta.NodeStart).AppendTo(variable.GetMeta())
yylex.(*Parser).appendMeta(variable, &meta.Data{"$", meta.TokenType, nil, meta.NodeStart}, meta.NodeStart)
yyDollar[5].token.Meta.SetTokenName(meta.EqualToken).AppendTo(yyVAL.node.GetMeta())
yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL)
@ -4779,7 +4777,7 @@ yydefault:
// save comments
yyDollar[1].token.Meta.SetTokenName(meta.NodeStart).AppendTo(yyVAL.node.GetMeta())
yylex.(*Parser).appendMeta(variable, &meta.Data{"$", meta.TokenType, nil, meta.DollarToken}, meta.DollarToken)
yylex.(*Parser).appendMeta(variable, &meta.Data{"$", meta.TokenType, nil, meta.NodeStart}, meta.NodeStart)
yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL)
}
@ -4798,7 +4796,7 @@ yydefault:
// save comments
yyDollar[1].token.Meta.SetTokenName(meta.NodeStart).AppendTo(yyVAL.node.GetMeta())
yylex.(*Parser).appendMeta(variable, &meta.Data{"$", meta.TokenType, nil, meta.DollarToken}, meta.DollarToken)
yylex.(*Parser).appendMeta(variable, &meta.Data{"$", meta.TokenType, nil, meta.NodeStart}, meta.NodeStart)
yyDollar[2].token.Meta.SetTokenName(meta.EqualToken).AppendTo(yyVAL.node.GetMeta())
yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL)
@ -5313,8 +5311,8 @@ yydefault:
yyVAL.node.SetPosition(yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
// save comments
yyDollar[1].token.Meta.SetTokenName(meta.VariableToken).AppendTo(variable.GetMeta())
yylex.(*Parser).appendMeta(variable, &meta.Data{"$", meta.TokenType, nil, meta.DollarToken}, meta.DollarToken)
yyDollar[1].token.Meta.SetTokenName(meta.NodeStart).AppendTo(variable.GetMeta())
yylex.(*Parser).appendMeta(variable, &meta.Data{"$", meta.TokenType, nil, meta.NodeStart}, meta.NodeStart)
yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL)
}
@ -5332,8 +5330,8 @@ yydefault:
yyVAL.node.SetPosition(yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[3].node))
// save comments
yyDollar[1].token.Meta.SetTokenName(meta.VariableToken).AppendTo(variable.GetMeta())
yylex.(*Parser).appendMeta(variable, &meta.Data{"$", meta.TokenType, nil, meta.DollarToken}, meta.DollarToken)
yyDollar[1].token.Meta.SetTokenName(meta.NodeStart).AppendTo(variable.GetMeta())
yylex.(*Parser).appendMeta(variable, &meta.Data{"$", meta.TokenType, nil, meta.NodeStart}, meta.NodeStart)
yyDollar[2].token.Meta.SetTokenName(meta.EqualToken).AppendTo(yyVAL.node.GetMeta())
yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL)
@ -6678,8 +6676,8 @@ yydefault:
yyVAL.node.SetPosition(yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
// save comments
yyDollar[1].token.Meta.SetTokenName(meta.VariableToken).AppendTo(yyVAL.node.GetMeta())
yylex.(*Parser).appendMeta(yyVAL.node, &meta.Data{"$", meta.TokenType, nil, meta.DollarToken}, meta.DollarToken)
yyDollar[1].token.Meta.SetTokenName(meta.NodeStart).AppendTo(yyVAL.node.GetMeta())
yylex.(*Parser).appendMeta(yyVAL.node, &meta.Data{"$", meta.TokenType, nil, meta.NodeStart}, meta.NodeStart)
yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL)
}
@ -6698,8 +6696,8 @@ yydefault:
// save comments
yyDollar[1].token.Meta.SetTokenName(meta.AmpersandToken).AppendTo(yyVAL.node.GetMeta())
yyDollar[2].token.Meta.SetTokenName(meta.VariableToken).AppendTo(variable.GetMeta())
yylex.(*Parser).appendMeta(variable, &meta.Data{"$", meta.TokenType, nil, meta.DollarToken}, meta.DollarToken)
yyDollar[2].token.Meta.SetTokenName(meta.NodeStart).AppendTo(variable.GetMeta())
yylex.(*Parser).appendMeta(variable, &meta.Data{"$", meta.TokenType, nil, meta.NodeStart}, meta.NodeStart)
yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL)
}
@ -7215,8 +7213,8 @@ yydefault:
yyVAL.node = yyDollar[2].node
// save comments
yyDollar[1].token.Meta.SetTokenName(meta.NodeStart).AppendTo(yyVAL.node.GetMeta())
yylex.(*Parser).appendMetaToken(yyVAL.node, yyDollar[1].token, meta.NodeStart)
yylex.(*Parser).prependMetaToken(yyVAL.node, yyDollar[1].token, meta.NodeStart)
yyDollar[1].token.Meta.SetTokenName(meta.NodeStart).PrependTo(yyVAL.node.GetMeta())
yyDollar[3].token.Meta.SetTokenName(meta.NodeEnd).AppendTo(yyVAL.node.GetMeta())
yylex.(*Parser).appendMetaToken(yyVAL.node, yyDollar[3].token, meta.NodeEnd)
@ -7383,8 +7381,8 @@ yydefault:
yyVAL.node.SetPosition(yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
// save comments
yyDollar[1].token.Meta.SetTokenName(meta.VariableToken).AppendTo(yyVAL.node.GetMeta())
yylex.(*Parser).appendMeta(yyVAL.node, &meta.Data{"$", meta.TokenType, nil, meta.DollarToken}, meta.DollarToken)
yyDollar[1].token.Meta.SetTokenName(meta.NodeStart).AppendTo(yyVAL.node.GetMeta())
yylex.(*Parser).appendMeta(yyVAL.node, &meta.Data{"$", meta.TokenType, nil, meta.NodeStart}, meta.NodeStart)
yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL)
}
@ -7398,12 +7396,12 @@ yydefault:
yyVAL.node.SetPosition(yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[4].token))
// save comments
yyDollar[1].token.Meta.SetTokenName(meta.DollarToken).AppendTo(yyVAL.node.GetMeta())
yylex.(*Parser).appendMetaToken(yyVAL.node, yyDollar[1].token, meta.DollarToken)
yyDollar[2].token.Meta.SetTokenName(meta.OpenCurlyBracesToken).AppendTo(yyVAL.node.GetMeta())
yylex.(*Parser).appendMetaToken(yyVAL.node, yyDollar[2].token, meta.OpenCurlyBracesToken)
yyDollar[4].token.Meta.SetTokenName(meta.CloseCurlyBracesToken).AppendTo(yyVAL.node.GetMeta())
yylex.(*Parser).appendMetaToken(yyVAL.node, yyDollar[4].token, meta.CloseCurlyBracesToken)
yyDollar[1].token.Meta.SetTokenName(meta.NodeStart).AppendTo(yyVAL.node.GetMeta())
yylex.(*Parser).appendMetaToken(yyVAL.node, yyDollar[1].token, meta.NodeStart)
yyDollar[2].token.Meta.SetTokenName(meta.NodeStart).AppendTo(yyVAL.node.GetMeta())
yylex.(*Parser).appendMetaToken(yyVAL.node, yyDollar[2].token, meta.NodeStart)
yyDollar[4].token.Meta.SetTokenName(meta.NodeEnd).AppendTo(yyVAL.node.GetMeta())
yylex.(*Parser).appendMetaToken(yyVAL.node, yyDollar[4].token, meta.NodeEnd)
yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL)
}
@ -7417,8 +7415,8 @@ yydefault:
yyVAL.node.SetPosition(yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[2].node))
// save comments
yyDollar[1].token.Meta.SetTokenName(meta.DollarToken).AppendTo(yyVAL.node.GetMeta())
yylex.(*Parser).appendMetaToken(yyVAL.node, yyDollar[1].token, meta.DollarToken)
yyDollar[1].token.Meta.SetTokenName(meta.NodeStart).AppendTo(yyVAL.node.GetMeta())
yylex.(*Parser).appendMetaToken(yyVAL.node, yyDollar[1].token, meta.NodeStart)
yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL)
}
@ -7812,8 +7810,8 @@ yydefault:
yyVAL.node.SetPosition(yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
// save comments
yyDollar[1].token.Meta.SetTokenName(meta.VariableToken).AppendTo(yyVAL.node.GetMeta())
yylex.(*Parser).appendMeta(yyVAL.node, &meta.Data{"$", meta.TokenType, nil, meta.DollarToken}, meta.DollarToken)
yyDollar[1].token.Meta.SetTokenName(meta.NodeStart).AppendTo(yyVAL.node.GetMeta())
yylex.(*Parser).appendMeta(yyVAL.node, &meta.Data{"$", meta.TokenType, nil, meta.NodeStart}, meta.NodeStart)
yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL)
}
@ -7831,8 +7829,8 @@ yydefault:
yyVAL.node.SetPosition(yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[4].token))
// save comments
yyDollar[1].token.Meta.SetTokenName(meta.VariableToken).AppendTo(variable.GetMeta())
yylex.(*Parser).appendMeta(variable, &meta.Data{"$", meta.TokenType, nil, meta.DollarToken}, meta.DollarToken)
yyDollar[1].token.Meta.SetTokenName(meta.NodeStart).AppendTo(variable.GetMeta())
yylex.(*Parser).appendMeta(variable, &meta.Data{"$", meta.TokenType, nil, meta.NodeStart}, meta.NodeStart)
yyDollar[2].token.Meta.SetTokenName(meta.OpenSquareBracket).AppendTo(yyVAL.node.GetMeta())
yylex.(*Parser).appendMetaToken(yyVAL.node, yyDollar[2].token, meta.OpenCurlyBracesToken)
yyDollar[4].token.Meta.SetTokenName(meta.CloseSquareBracket).AppendTo(yyVAL.node.GetMeta())
@ -7856,8 +7854,8 @@ yydefault:
yyVAL.node.SetPosition(yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[3].token))
// save comments
yyDollar[1].token.Meta.SetTokenName(meta.VariableToken).AppendTo(variable.GetMeta())
yylex.(*Parser).appendMeta(variable, &meta.Data{"$", meta.TokenType, nil, meta.DollarToken}, meta.DollarToken)
yyDollar[1].token.Meta.SetTokenName(meta.NodeStart).AppendTo(variable.GetMeta())
yylex.(*Parser).appendMeta(variable, &meta.Data{"$", meta.TokenType, nil, meta.NodeStart}, meta.NodeStart)
yyDollar[2].token.Meta.SetTokenName(meta.ObjectOperatorToken).AppendTo(yyVAL.node.GetMeta())
yyDollar[3].token.Meta.SetTokenName(meta.IdentifierToken).AppendTo(fetch.GetMeta())
@ -7875,10 +7873,10 @@ yydefault:
yyVAL.node.SetPosition(yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[3].token))
// save comments
yyDollar[1].token.Meta.SetTokenName(meta.DollarOpenCurlyBracesToken).AppendTo(yyVAL.node.GetMeta())
yylex.(*Parser).appendMetaToken(yyVAL.node, yyDollar[1].token, meta.DollarOpenCurlyBracesToken)
yyDollar[3].token.Meta.SetTokenName(meta.DollarCloseCurlyBracesToken).AppendTo(yyVAL.node.GetMeta())
yylex.(*Parser).appendMetaToken(yyVAL.node, yyDollar[3].token, meta.DollarCloseCurlyBracesToken)
yyDollar[1].token.Meta.SetTokenName(meta.NodeStart).AppendTo(yyVAL.node.GetMeta())
yylex.(*Parser).appendMetaToken(yyVAL.node, yyDollar[1].token, meta.NodeStart)
yyDollar[3].token.Meta.SetTokenName(meta.NodeEnd).AppendTo(yyVAL.node.GetMeta())
yylex.(*Parser).appendMetaToken(yyVAL.node, yyDollar[3].token, meta.NodeEnd)
yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL)
}
@ -7896,11 +7894,11 @@ yydefault:
yyVAL.node.SetPosition(yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[3].token))
// save comments
yyDollar[1].token.Meta.SetTokenName(meta.DollarOpenCurlyBracesToken).AppendTo(yyVAL.node.GetMeta())
yylex.(*Parser).appendMetaToken(yyVAL.node, yyDollar[1].token, meta.DollarOpenCurlyBracesToken)
yyDollar[1].token.Meta.SetTokenName(meta.NodeStart).AppendTo(yyVAL.node.GetMeta())
yylex.(*Parser).appendMetaToken(yyVAL.node, yyDollar[1].token, meta.NodeStart)
yyDollar[2].token.Meta.SetTokenName(meta.IdentifierToken).AppendTo(name.GetMeta())
yyDollar[3].token.Meta.SetTokenName(meta.DollarCloseCurlyBracesToken).AppendTo(yyVAL.node.GetMeta())
yylex.(*Parser).appendMetaToken(yyVAL.node, yyDollar[3].token, meta.DollarCloseCurlyBracesToken)
yyDollar[3].token.Meta.SetTokenName(meta.NodeEnd).AppendTo(yyVAL.node.GetMeta())
yylex.(*Parser).appendMetaToken(yyVAL.node, yyDollar[3].token, meta.NodeEnd)
yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL)
}
@ -7937,8 +7935,8 @@ yydefault:
yyVAL.node = yyDollar[2].node
// save comments
yyDollar[1].token.Meta.SetTokenName(meta.NodeStart).AppendTo(yyVAL.node.GetMeta())
yylex.(*Parser).appendMetaToken(yyVAL.node, yyDollar[1].token, meta.NodeStart)
yyDollar[1].token.Meta.SetTokenName(meta.NodeStart).PrependTo(yyVAL.node.GetMeta())
yylex.(*Parser).prependMetaToken(yyVAL.node, yyDollar[1].token, meta.NodeStart)
yyDollar[3].token.Meta.SetTokenName(meta.NodeEnd).AppendTo(yyVAL.node.GetMeta())
yylex.(*Parser).appendMetaToken(yyVAL.node, yyDollar[3].token, meta.NodeEnd)
@ -8022,8 +8020,8 @@ yydefault:
yyVAL.node.SetPosition(yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
// save comments
yyDollar[1].token.Meta.SetTokenName(meta.VariableToken).AppendTo(yyVAL.node.GetMeta())
yylex.(*Parser).appendMeta(yyVAL.node, &meta.Data{"$", meta.TokenType, nil, meta.DollarToken}, meta.DollarToken)
yyDollar[1].token.Meta.SetTokenName(meta.NodeStart).AppendTo(yyVAL.node.GetMeta())
yylex.(*Parser).appendMeta(yyVAL.node, &meta.Data{"$", meta.TokenType, nil, meta.NodeStart}, meta.NodeStart)
yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL)
}

View File

@ -1344,8 +1344,8 @@ catch_list:
// save comments
$2.Meta.SetTokenName(meta.CatchToken).AppendTo(catch.GetMeta())
$3.Meta.SetTokenName(meta.OpenParenthesisToken).AppendTo(catch.GetMeta())
$5.Meta.SetTokenName(meta.VariableToken).AppendTo(variable.GetMeta())
yylex.(*Parser).appendMeta(variable, &meta.Data{"$", meta.TokenType, nil, meta.DollarToken}, meta.DollarToken)
$5.Meta.SetTokenName(meta.NodeStart).AppendTo(variable.GetMeta())
yylex.(*Parser).appendMeta(variable, &meta.Data{"$", meta.TokenType, nil, meta.NodeStart}, meta.NodeStart)
$6.Meta.SetTokenName(meta.CloseParenthesisToken).AppendTo(catch.GetMeta())
$7.Meta.SetTokenName(meta.OpenCurlyBracesToken).AppendTo(catch.GetMeta())
$9.Meta.SetTokenName(meta.CloseCurlyBracesToken).AppendTo(catch.GetMeta())
@ -2128,8 +2128,8 @@ parameter:
if $3 != nil {
$3.Meta.SetTokenName(meta.EllipsisToken).AppendTo($$.GetMeta())
}
$4.Meta.SetTokenName(meta.VariableToken).AppendTo(variable.GetMeta())
yylex.(*Parser).appendMeta(variable, &meta.Data{"$", meta.TokenType, nil, meta.DollarToken}, meta.DollarToken)
$4.Meta.SetTokenName(meta.NodeStart).AppendTo(variable.GetMeta())
yylex.(*Parser).appendMeta(variable, &meta.Data{"$", meta.TokenType, nil, meta.NodeStart}, meta.NodeStart)
yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL)
}
@ -2159,8 +2159,8 @@ parameter:
if $3 != nil {
$3.Meta.SetTokenName(meta.EllipsisToken).AppendTo($$.GetMeta())
}
$4.Meta.SetTokenName(meta.VariableToken).AppendTo(variable.GetMeta())
yylex.(*Parser).appendMeta(variable, &meta.Data{"$", meta.TokenType, nil, meta.DollarToken}, meta.DollarToken)
$4.Meta.SetTokenName(meta.NodeStart).AppendTo(variable.GetMeta())
yylex.(*Parser).appendMeta(variable, &meta.Data{"$", meta.TokenType, nil, meta.NodeStart}, meta.NodeStart)
$5.Meta.SetTokenName(meta.EqualToken).AppendTo($$.GetMeta())
yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL)
@ -2388,7 +2388,7 @@ static_var:
// save comments
$1.Meta.SetTokenName(meta.NodeStart).AppendTo($$.GetMeta())
yylex.(*Parser).appendMeta(variable, &meta.Data{"$", meta.TokenType, nil, meta.DollarToken}, meta.DollarToken)
yylex.(*Parser).appendMeta(variable, &meta.Data{"$", meta.TokenType, nil, meta.NodeStart}, meta.NodeStart)
yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL)
}
@ -2405,7 +2405,7 @@ static_var:
// save comments
$1.Meta.SetTokenName(meta.NodeStart).AppendTo($$.GetMeta())
yylex.(*Parser).appendMeta(variable, &meta.Data{"$", meta.TokenType, nil, meta.DollarToken}, meta.DollarToken)
yylex.(*Parser).appendMeta(variable, &meta.Data{"$", meta.TokenType, nil, meta.NodeStart}, meta.NodeStart)
$2.Meta.SetTokenName(meta.EqualToken).AppendTo($$.GetMeta())
yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL)
@ -2892,8 +2892,8 @@ property:
$$.SetPosition(yylex.(*Parser).positionBuilder.NewTokenPosition($1))
// save comments
$1.Meta.SetTokenName(meta.VariableToken).AppendTo(variable.GetMeta())
yylex.(*Parser).appendMeta(variable, &meta.Data{"$", meta.TokenType, nil, meta.DollarToken}, meta.DollarToken)
$1.Meta.SetTokenName(meta.NodeStart).AppendTo(variable.GetMeta())
yylex.(*Parser).appendMeta(variable, &meta.Data{"$", meta.TokenType, nil, meta.NodeStart}, meta.NodeStart)
yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL)
}
@ -2909,8 +2909,8 @@ property:
$$.SetPosition(yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $3))
// save comments
$1.Meta.SetTokenName(meta.VariableToken).AppendTo(variable.GetMeta())
yylex.(*Parser).appendMeta(variable, &meta.Data{"$", meta.TokenType, nil, meta.DollarToken}, meta.DollarToken)
$1.Meta.SetTokenName(meta.NodeStart).AppendTo(variable.GetMeta())
yylex.(*Parser).appendMeta(variable, &meta.Data{"$", meta.TokenType, nil, meta.NodeStart}, meta.NodeStart)
$2.Meta.SetTokenName(meta.EqualToken).AppendTo($$.GetMeta())
yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL)
@ -4104,8 +4104,8 @@ lexical_var:
$$.SetPosition(yylex.(*Parser).positionBuilder.NewTokenPosition($1))
// save comments
$1.Meta.SetTokenName(meta.VariableToken).AppendTo($$.GetMeta())
yylex.(*Parser).appendMeta($$, &meta.Data{"$", meta.TokenType, nil, meta.DollarToken}, meta.DollarToken)
$1.Meta.SetTokenName(meta.NodeStart).AppendTo($$.GetMeta())
yylex.(*Parser).appendMeta($$, &meta.Data{"$", meta.TokenType, nil, meta.NodeStart}, meta.NodeStart)
yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL)
}
@ -4122,8 +4122,8 @@ lexical_var:
// save comments
$1.Meta.SetTokenName(meta.AmpersandToken).AppendTo($$.GetMeta())
$2.Meta.SetTokenName(meta.VariableToken).AppendTo(variable.GetMeta())
yylex.(*Parser).appendMeta(variable, &meta.Data{"$", meta.TokenType, nil, meta.DollarToken}, meta.DollarToken)
$2.Meta.SetTokenName(meta.NodeStart).AppendTo(variable.GetMeta())
yylex.(*Parser).appendMeta(variable, &meta.Data{"$", meta.TokenType, nil, meta.NodeStart}, meta.NodeStart)
yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL)
}
@ -4590,8 +4590,8 @@ dereferencable:
$$ = $2;
// save comments
$1.Meta.SetTokenName(meta.NodeStart).AppendTo($$.GetMeta())
yylex.(*Parser).appendMetaToken($$, $1, meta.NodeStart)
yylex.(*Parser).prependMetaToken($$, $1, meta.NodeStart)
$1.Meta.SetTokenName(meta.NodeStart).PrependTo($$.GetMeta())
$3.Meta.SetTokenName(meta.NodeEnd).AppendTo($$.GetMeta())
yylex.(*Parser).appendMetaToken($$, $3, meta.NodeEnd)
@ -4742,8 +4742,8 @@ simple_variable:
$$.SetPosition(yylex.(*Parser).positionBuilder.NewTokenPosition($1))
// save comments
$1.Meta.SetTokenName(meta.VariableToken).AppendTo($$.GetMeta())
yylex.(*Parser).appendMeta($$, &meta.Data{"$", meta.TokenType, nil, meta.DollarToken}, meta.DollarToken)
$1.Meta.SetTokenName(meta.NodeStart).AppendTo($$.GetMeta())
yylex.(*Parser).appendMeta($$, &meta.Data{"$", meta.TokenType, nil, meta.NodeStart}, meta.NodeStart)
yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL)
}
@ -4755,12 +4755,12 @@ simple_variable:
$$.SetPosition(yylex.(*Parser).positionBuilder.NewTokensPosition($1, $4))
// save comments
$1.Meta.SetTokenName(meta.DollarToken).AppendTo($$.GetMeta())
yylex.(*Parser).appendMetaToken($$, $1, meta.DollarToken)
$2.Meta.SetTokenName(meta.OpenCurlyBracesToken).AppendTo($$.GetMeta())
yylex.(*Parser).appendMetaToken($$, $2, meta.OpenCurlyBracesToken)
$4.Meta.SetTokenName(meta.CloseCurlyBracesToken).AppendTo($$.GetMeta())
yylex.(*Parser).appendMetaToken($$, $4, meta.CloseCurlyBracesToken)
$1.Meta.SetTokenName(meta.NodeStart).AppendTo($$.GetMeta())
yylex.(*Parser).appendMetaToken($$, $1, meta.NodeStart)
$2.Meta.SetTokenName(meta.NodeStart).AppendTo($$.GetMeta())
yylex.(*Parser).appendMetaToken($$, $2, meta.NodeStart)
$4.Meta.SetTokenName(meta.NodeEnd).AppendTo($$.GetMeta())
yylex.(*Parser).appendMetaToken($$, $4, meta.NodeEnd)
yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL)
}
@ -4772,8 +4772,8 @@ simple_variable:
$$.SetPosition(yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $2))
// save comments
$1.Meta.SetTokenName(meta.DollarToken).AppendTo($$.GetMeta())
yylex.(*Parser).appendMetaToken($$, $1, meta.DollarToken)
$1.Meta.SetTokenName(meta.NodeStart).AppendTo($$.GetMeta())
yylex.(*Parser).appendMetaToken($$, $1, meta.NodeStart)
yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL)
}
@ -5137,8 +5137,8 @@ encaps_var:
$$.SetPosition(yylex.(*Parser).positionBuilder.NewTokenPosition($1))
// save comments
$1.Meta.SetTokenName(meta.VariableToken).AppendTo($$.GetMeta())
yylex.(*Parser).appendMeta($$, &meta.Data{"$", meta.TokenType, nil, meta.DollarToken}, meta.DollarToken)
$1.Meta.SetTokenName(meta.NodeStart).AppendTo($$.GetMeta())
yylex.(*Parser).appendMeta($$, &meta.Data{"$", meta.TokenType, nil, meta.NodeStart}, meta.NodeStart)
yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL)
}
@ -5154,8 +5154,8 @@ encaps_var:
$$.SetPosition(yylex.(*Parser).positionBuilder.NewTokensPosition($1, $4))
// save comments
$1.Meta.SetTokenName(meta.VariableToken).AppendTo(variable.GetMeta())
yylex.(*Parser).appendMeta(variable, &meta.Data{"$", meta.TokenType, nil, meta.DollarToken}, meta.DollarToken)
$1.Meta.SetTokenName(meta.NodeStart).AppendTo(variable.GetMeta())
yylex.(*Parser).appendMeta(variable, &meta.Data{"$", meta.TokenType, nil, meta.NodeStart}, meta.NodeStart)
$2.Meta.SetTokenName(meta.OpenSquareBracket).AppendTo($$.GetMeta())
yylex.(*Parser).appendMetaToken($$, $2, meta.OpenCurlyBracesToken)
$4.Meta.SetTokenName(meta.CloseSquareBracket).AppendTo($$.GetMeta())
@ -5177,8 +5177,8 @@ encaps_var:
$$.SetPosition(yylex.(*Parser).positionBuilder.NewTokensPosition($1, $3))
// save comments
$1.Meta.SetTokenName(meta.VariableToken).AppendTo(variable.GetMeta())
yylex.(*Parser).appendMeta(variable, &meta.Data{"$", meta.TokenType, nil, meta.DollarToken}, meta.DollarToken)
$1.Meta.SetTokenName(meta.NodeStart).AppendTo(variable.GetMeta())
yylex.(*Parser).appendMeta(variable, &meta.Data{"$", meta.TokenType, nil, meta.NodeStart}, meta.NodeStart)
$2.Meta.SetTokenName(meta.ObjectOperatorToken).AppendTo($$.GetMeta())
$3.Meta.SetTokenName(meta.IdentifierToken).AppendTo(fetch.GetMeta())
@ -5194,10 +5194,10 @@ encaps_var:
$$.SetPosition(yylex.(*Parser).positionBuilder.NewTokensPosition($1, $3))
// save comments
$1.Meta.SetTokenName(meta.DollarOpenCurlyBracesToken).AppendTo($$.GetMeta())
yylex.(*Parser).appendMetaToken($$, $1, meta.DollarOpenCurlyBracesToken)
$3.Meta.SetTokenName(meta.DollarCloseCurlyBracesToken).AppendTo($$.GetMeta())
yylex.(*Parser).appendMetaToken($$, $3, meta.DollarCloseCurlyBracesToken)
$1.Meta.SetTokenName(meta.NodeStart).AppendTo($$.GetMeta())
yylex.(*Parser).appendMetaToken($$, $1, meta.NodeStart)
$3.Meta.SetTokenName(meta.NodeEnd).AppendTo($$.GetMeta())
yylex.(*Parser).appendMetaToken($$, $3, meta.NodeEnd)
yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL)
}
@ -5213,11 +5213,11 @@ encaps_var:
$$.SetPosition(yylex.(*Parser).positionBuilder.NewTokensPosition($1, $3))
// save comments
$1.Meta.SetTokenName(meta.DollarOpenCurlyBracesToken).AppendTo($$.GetMeta())
yylex.(*Parser).appendMetaToken($$, $1, meta.DollarOpenCurlyBracesToken)
$1.Meta.SetTokenName(meta.NodeStart).AppendTo($$.GetMeta())
yylex.(*Parser).appendMetaToken($$, $1, meta.NodeStart)
$2.Meta.SetTokenName(meta.IdentifierToken).AppendTo(name.GetMeta())
$3.Meta.SetTokenName(meta.DollarCloseCurlyBracesToken).AppendTo($$.GetMeta())
yylex.(*Parser).appendMetaToken($$, $3, meta.DollarCloseCurlyBracesToken)
$3.Meta.SetTokenName(meta.NodeEnd).AppendTo($$.GetMeta())
yylex.(*Parser).appendMetaToken($$, $3, meta.NodeEnd)
yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL)
}
@ -5250,8 +5250,8 @@ encaps_var:
$$ = $2;
// save comments
$1.Meta.SetTokenName(meta.NodeStart).AppendTo($$.GetMeta())
yylex.(*Parser).appendMetaToken($$, $1, meta.NodeStart)
$1.Meta.SetTokenName(meta.NodeStart).PrependTo($$.GetMeta())
yylex.(*Parser).prependMetaToken($$, $1, meta.NodeStart)
$3.Meta.SetTokenName(meta.NodeEnd).AppendTo($$.GetMeta())
yylex.(*Parser).appendMetaToken($$, $3, meta.NodeEnd)
@ -5330,8 +5330,8 @@ encaps_var_offset:
$$.SetPosition(yylex.(*Parser).positionBuilder.NewTokenPosition($1))
// save comments
$1.Meta.SetTokenName(meta.VariableToken).AppendTo($$.GetMeta())
yylex.(*Parser).appendMeta($$, &meta.Data{"$", meta.TokenType, nil, meta.DollarToken}, meta.DollarToken)
$1.Meta.SetTokenName(meta.NodeStart).AppendTo($$.GetMeta())
yylex.(*Parser).appendMeta($$, &meta.Data{"$", meta.TokenType, nil, meta.NodeStart}, meta.NodeStart)
yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL)
}

View File

@ -654,14 +654,7 @@ func (p *Printer) printScalarHeredoc(n node.Node) {
io.WriteString(p.w, "\n")
for _, part := range nn.Parts {
switch part.(type) {
case *scalar.EncapsedStringPart:
p.Print(part)
default:
p.printMeta(part, meta.DollarOpenCurlyBracesToken)
p.Print(part)
p.printMeta(part, meta.DollarCloseCurlyBracesToken)
}
p.Print(part)
}
io.WriteString(p.w, "\n")
@ -1673,14 +1666,7 @@ func (p *Printer) printExprShellExec(n node.Node) {
p.printMeta(nn, meta.BackquoteToken)
io.WriteString(p.w, "`")
for _, part := range nn.Parts {
switch part.(type) {
case *scalar.EncapsedStringPart:
p.Print(part)
default:
p.printMeta(part, meta.DollarOpenCurlyBracesToken)
p.Print(part)
p.printMeta(part, meta.DollarCloseCurlyBracesToken)
}
p.Print(part)
}
io.WriteString(p.w, "`")
@ -1787,14 +1773,8 @@ func (p *Printer) printExprUnaryPlus(n node.Node) {
func (p *Printer) printExprVariable(n node.Node) {
nn := n.(*expr.Variable)
p.printMeta(nn, meta.NodeStart)
p.printMeta(nn, meta.VariableToken)
p.printMeta(nn, meta.DollarOpenCurlyBracesToken)
p.printMeta(nn, meta.DollarToken)
p.printMeta(nn, meta.OpenCurlyBracesToken)
p.Print(nn.VarName)
p.printMeta(nn, meta.DollarCloseCurlyBracesToken)
p.printMeta(nn, meta.CloseCurlyBracesToken)
p.printMeta(nn, meta.NodeEnd)
}

View File

@ -1318,6 +1318,7 @@ func TestParseAndPrintPhp5While(t *testing.T) {
func TestParseAndPrintPhp5Parentheses(t *testing.T) {
src := `<?php
global $ { $b } ;
$b = (($a));
$b = ( ($a) );
$b = ( ( $a ) );

File diff suppressed because it is too large Load Diff

View File

@ -109,8 +109,8 @@ func ExampleDumper() {
// | [*expr.Variable]
// | "Position": Pos{Line: 5-5 Pos: 79-82}
// | "Meta":
// | " " before "VariableToken"
// | "$" before "DollarToken"
// | " " before "NodeStart"
// | "$" before "NodeStart"
// | "VarName":
// | [*node.Identifier]
// | "Position": Pos{Line: 5-5 Pos: 79-82}
@ -143,10 +143,10 @@ func ExampleDumper() {
// | [*expr.Variable]
// | "Position": Pos{Line: 8-8 Pos: 124-127}
// | "Meta":
// | "\n\t\t\t\t\t" before "VariableToken"
// | "// some comment\n" before "VariableToken"
// | "\t\t\t\t\t" before "VariableToken"
// | "$" before "DollarToken"
// | "\n\t\t\t\t\t" before "NodeStart"
// | "// some comment\n" before "NodeStart"
// | "\t\t\t\t\t" before "NodeStart"
// | "$" before "NodeStart"
// | "VarName":
// | [*node.Identifier]
// | "Position": Pos{Line: 8-8 Pos: 124-127}

View File

@ -63,21 +63,26 @@ func (d *GoDumper) EnterNode(w walker.Walkable) bool {
if mm := n.GetMeta(); len(*mm) > 0 {
printIndent(d.Writer, d.depth)
fmt.Fprint(d.Writer, "Meta: []meta.Meta{\n")
fmt.Fprint(d.Writer, "Meta: meta.Collection{\n")
d.depth++
for _, m := range *mm {
printIndent(d.Writer, d.depth)
switch m.Type {
case meta.CommentType:
fmt.Fprint(d.Writer, "&meta.CommentType{\n")
case meta.WhiteSpaceType:
fmt.Fprint(d.Writer, "&meta.WhiteSpaceType{\n")
case meta.TokenType:
fmt.Fprint(d.Writer, "&meta.TokenType{\n")
}
fmt.Fprint(d.Writer, "&meta.Data{\n")
d.depth++
printIndent(d.Writer, d.depth)
switch m.Type {
case meta.CommentType:
fmt.Fprint(d.Writer, "Type: meta.CommentType,\n")
case meta.WhiteSpaceType:
fmt.Fprint(d.Writer, "Type: meta.WhiteSpaceType,\n")
case meta.TokenType:
fmt.Fprint(d.Writer, "Type: meta.TokenType,\n")
}
printIndent(d.Writer, d.depth)
if m.Position != nil {
fmt.Fprint(d.Writer, "Position: &position.Position{\n")
d.depth++
@ -99,7 +104,7 @@ func (d *GoDumper) EnterNode(w walker.Walkable) bool {
printIndent(d.Writer, d.depth)
fmt.Fprintf(d.Writer, "Value: %q,\n", m.String())
printIndent(d.Writer, d.depth)
fmt.Fprintf(d.Writer, "TokenName: %d,\n", m.TokenName)
fmt.Fprintf(d.Writer, "TokenName: meta.%s,\n", m.TokenName.String())
d.depth--
printIndent(d.Writer, d.depth)

View File

@ -50,8 +50,9 @@ func ExampleGoDumper() {
// StartPos: 10,
// EndPos: 143,
// },
// Meta: []meta.Meta{
// &meta.TokenType{
// Meta: meta.Collection{
// &meta.Data{
// Type: meta.TokenType,
// Position: &position.Position{
// StartLine: 1,
// EndLine: 1,
@ -59,9 +60,10 @@ func ExampleGoDumper() {
// EndPos: 5,
// },
// Value: "<?php",
// TokenName: 65,
// TokenName: meta.NamespaceToken,
// },
// &meta.WhiteSpaceType{
// &meta.Data{
// Type: meta.WhiteSpaceType,
// Position: &position.Position{
// StartLine: 1,
// EndLine: 3,
@ -69,9 +71,10 @@ func ExampleGoDumper() {
// EndPos: 9,
// },
// Value: "\n\n\t\t",
// TokenName: 65,
// TokenName: meta.NamespaceToken,
// },
// &meta.WhiteSpaceType{
// &meta.Data{
// Type: meta.WhiteSpaceType,
// Position: &position.Position{
// StartLine: 3,
// EndLine: 3,
@ -79,9 +82,10 @@ func ExampleGoDumper() {
// EndPos: 23,
// },
// Value: " ",
// TokenName: 130,
// TokenName: meta.OpenCurlyBracesToken,
// },
// &meta.WhiteSpaceType{
// &meta.Data{
// Type: meta.WhiteSpaceType,
// Position: &position.Position{
// StartLine: 10,
// EndLine: 11,
@ -89,7 +93,7 @@ func ExampleGoDumper() {
// EndPos: 142,
// },
// Value: "\n\t\t",
// TokenName: 131,
// TokenName: meta.CloseCurlyBracesToken,
// },
// },
// NamespaceName: &name.Name{
@ -107,8 +111,9 @@ func ExampleGoDumper() {
// StartPos: 20,
// EndPos: 22,
// },
// Meta: []meta.Meta{
// &meta.WhiteSpaceType{
// Meta: meta.Collection{
// &meta.Data{
// Type: meta.WhiteSpaceType,
// Position: &position.Position{
// StartLine: 3,
// EndLine: 3,
@ -116,7 +121,7 @@ func ExampleGoDumper() {
// EndPos: 19,
// },
// Value: " ",
// TokenName: 10,
// TokenName: meta.StringToken,
// },
// },
// Value: "Foo",
@ -131,8 +136,9 @@ func ExampleGoDumper() {
// StartPos: 29,
// EndPos: 139,
// },
// Meta: []meta.Meta{
// &meta.WhiteSpaceType{
// Meta: meta.Collection{
// &meta.Data{
// Type: meta.WhiteSpaceType,
// Position: &position.Position{
// StartLine: 3,
// EndLine: 4,
@ -140,9 +146,10 @@ func ExampleGoDumper() {
// EndPos: 28,
// },
// Value: "\n\t\t\t",
// TokenName: 51,
// TokenName: meta.ClassToken,
// },
// &meta.WhiteSpaceType{
// &meta.Data{
// Type: meta.WhiteSpaceType,
// Position: &position.Position{
// StartLine: 4,
// EndLine: 4,
@ -150,9 +157,10 @@ func ExampleGoDumper() {
// EndPos: 38,
// },
// Value: " ",
// TokenName: 130,
// TokenName: meta.OpenCurlyBracesToken,
// },
// &meta.WhiteSpaceType{
// &meta.Data{
// Type: meta.WhiteSpaceType,
// Position: &position.Position{
// StartLine: 9,
// EndLine: 10,
@ -160,7 +168,7 @@ func ExampleGoDumper() {
// EndPos: 138,
// },
// Value: "\n\t\t\t",
// TokenName: 131,
// TokenName: meta.CloseCurlyBracesToken,
// },
// },
// PhpDocComment: "",
@ -171,8 +179,9 @@ func ExampleGoDumper() {
// StartPos: 35,
// EndPos: 37,
// },
// Meta: []meta.Meta{
// &meta.WhiteSpaceType{
// Meta: meta.Collection{
// &meta.Data{
// Type: meta.WhiteSpaceType,
// Position: &position.Position{
// StartLine: 4,
// EndLine: 4,
@ -180,7 +189,7 @@ func ExampleGoDumper() {
// EndPos: 34,
// },
// Value: " ",
// TokenName: 126,
// TokenName: meta.IdentifierToken,
// },
// },
// Value: "Bar",
@ -193,8 +202,9 @@ func ExampleGoDumper() {
// StartPos: 45,
// EndPos: 134,
// },
// Meta: []meta.Meta{
// &meta.WhiteSpaceType{
// Meta: meta.Collection{
// &meta.Data{
// Type: meta.WhiteSpaceType,
// Position: &position.Position{
// StartLine: 5,
// EndLine: 5,
@ -202,7 +212,7 @@ func ExampleGoDumper() {
// EndPos: 51,
// },
// Value: " ",
// TokenName: 37,
// TokenName: meta.FunctionToken,
// },
// },
// ReturnsRef: false,
@ -214,8 +224,9 @@ func ExampleGoDumper() {
// StartPos: 61,
// EndPos: 72,
// },
// Meta: []meta.Meta{
// &meta.WhiteSpaceType{
// Meta: meta.Collection{
// &meta.Data{
// Type: meta.WhiteSpaceType,
// Position: &position.Position{
// StartLine: 5,
// EndLine: 5,
@ -223,7 +234,7 @@ func ExampleGoDumper() {
// EndPos: 60,
// },
// Value: " ",
// TokenName: 126,
// TokenName: meta.IdentifierToken,
// },
// },
// Value: "FunctionName",
@ -236,8 +247,9 @@ func ExampleGoDumper() {
// StartPos: 45,
// EndPos: 50,
// },
// Meta: []meta.Meta{
// &meta.WhiteSpaceType{
// Meta: meta.Collection{
// &meta.Data{
// Type: meta.WhiteSpaceType,
// Position: &position.Position{
// StartLine: 4,
// EndLine: 5,
@ -245,7 +257,7 @@ func ExampleGoDumper() {
// EndPos: 44,
// },
// Value: "\n\t\t\t\t",
// TokenName: 126,
// TokenName: meta.IdentifierToken,
// },
// },
// Value: "public",
@ -259,8 +271,9 @@ func ExampleGoDumper() {
// StartPos: 74,
// EndPos: 89,
// },
// Meta: []meta.Meta{
// &meta.WhiteSpaceType{
// Meta: meta.Collection{
// &meta.Data{
// Type: meta.WhiteSpaceType,
// Position: &position.Position{
// StartLine: 5,
// EndLine: 5,
@ -268,7 +281,7 @@ func ExampleGoDumper() {
// EndPos: 83,
// },
// Value: " ",
// TokenName: 148,
// TokenName: meta.EqualToken,
// },
// },
// ByRef: false,
@ -299,8 +312,9 @@ func ExampleGoDumper() {
// StartPos: 79,
// EndPos: 82,
// },
// Meta: []meta.Meta{
// &meta.WhiteSpaceType{
// Meta: meta.Collection{
// &meta.Data{
// Type: meta.WhiteSpaceType,
// Position: &position.Position{
// StartLine: 5,
// EndLine: 5,
@ -308,12 +322,13 @@ func ExampleGoDumper() {
// EndPos: 78,
// },
// Value: " ",
// TokenName: 12,
// TokenName: meta.NodeStart,
// },
// &meta.TokenType{
// &meta.Data{
// Type: meta.TokenType,
// Position: nil,
// Value: "$",
// TokenName: 145,
// TokenName: meta.NodeStart,
// },
// },
// VarName: &node.Identifier{
@ -348,8 +363,9 @@ func ExampleGoDumper() {
// StartPos: 86,
// EndPos: 89,
// },
// Meta: []meta.Meta{
// &meta.WhiteSpaceType{
// Meta: meta.Collection{
// &meta.Data{
// Type: meta.WhiteSpaceType,
// Position: &position.Position{
// StartLine: 5,
// EndLine: 5,
@ -357,7 +373,7 @@ func ExampleGoDumper() {
// EndPos: 85,
// },
// Value: " ",
// TokenName: 10,
// TokenName: meta.StringToken,
// },
// },
// Value: "null",
@ -374,8 +390,9 @@ func ExampleGoDumper() {
// StartPos: 96,
// EndPos: 134,
// },
// Meta: []meta.Meta{
// &meta.WhiteSpaceType{
// Meta: meta.Collection{
// &meta.Data{
// Type: meta.WhiteSpaceType,
// Position: &position.Position{
// StartLine: 5,
// EndLine: 6,
@ -383,9 +400,10 @@ func ExampleGoDumper() {
// EndPos: 95,
// },
// Value: "\n\t\t\t\t",
// TokenName: 130,
// TokenName: meta.OpenCurlyBracesToken,
// },
// &meta.WhiteSpaceType{
// &meta.Data{
// Type: meta.WhiteSpaceType,
// Position: &position.Position{
// StartLine: 8,
// EndLine: 9,
@ -393,7 +411,7 @@ func ExampleGoDumper() {
// EndPos: 133,
// },
// Value: "\n\t\t\t\t",
// TokenName: 131,
// TokenName: meta.CloseCurlyBracesToken,
// },
// },
// Stmts: []node.Node{
@ -404,8 +422,9 @@ func ExampleGoDumper() {
// StartPos: 124,
// EndPos: 128,
// },
// Meta: []meta.Meta{
// &meta.TokenType{
// Meta: meta.Collection{
// &meta.Data{
// Type: meta.TokenType,
// Position: &position.Position{
// StartLine: 8,
// EndLine: 8,
@ -413,7 +432,7 @@ func ExampleGoDumper() {
// EndPos: 128,
// },
// Value: ";",
// TokenName: 132,
// TokenName: meta.SemiColonToken,
// },
// },
// Expr: &expr.Variable{
@ -423,8 +442,9 @@ func ExampleGoDumper() {
// StartPos: 124,
// EndPos: 127,
// },
// Meta: []meta.Meta{
// &meta.WhiteSpaceType{
// Meta: meta.Collection{
// &meta.Data{
// Type: meta.WhiteSpaceType,
// Position: &position.Position{
// StartLine: 6,
// EndLine: 7,
@ -432,9 +452,10 @@ func ExampleGoDumper() {
// EndPos: 102,
// },
// Value: "\n\t\t\t\t\t",
// TokenName: 12,
// TokenName: meta.NodeStart,
// },
// &meta.CommentType{
// &meta.Data{
// Type: meta.CommentType,
// Position: &position.Position{
// StartLine: 7,
// EndLine: 7,
@ -442,9 +463,10 @@ func ExampleGoDumper() {
// EndPos: 118,
// },
// Value: "// some comment\n",
// TokenName: 12,
// TokenName: meta.NodeStart,
// },
// &meta.WhiteSpaceType{
// &meta.Data{
// Type: meta.WhiteSpaceType,
// Position: &position.Position{
// StartLine: 8,
// EndLine: 8,
@ -452,12 +474,13 @@ func ExampleGoDumper() {
// EndPos: 123,
// },
// Value: "\t\t\t\t\t",
// TokenName: 12,
// TokenName: meta.NodeStart,
// },
// &meta.TokenType{
// &meta.Data{
// Type: meta.TokenType,
// Position: nil,
// Value: "$",
// TokenName: 145,
// TokenName: meta.NodeStart,
// },
// },
// VarName: &node.Identifier{

View File

@ -37,5 +37,5 @@ func ExampleJsonDumper() {
nodes.Walk(dumper)
// Output:
// {"type":"*node.Root","position":{"startPos":10,"endPos":166,"startLine":3,"endLine":12},"Stmts":[{"type":"*stmt.Namespace","position":{"startPos":10,"endPos":166,"startLine":3,"endLine":12},"meta":[{"type":"*meta.TokenType","value":"<?php","tokenName":"NamespaceToken"},{"type":"*meta.WhiteSpaceType","value":"\n\n\t\t","tokenName":"NamespaceToken"},{"type":"*meta.WhiteSpaceType","value":" ","tokenName":"OpenCurlyBracesToken"},{"type":"*meta.WhiteSpaceType","value":"\n\t\t","tokenName":"CloseCurlyBracesToken"}],"NamespaceName":{"type":"*name.Name","position":{"startPos":20,"endPos":22,"startLine":3,"endLine":3},"Parts":[{"type":"*name.NamePart","position":{"startPos":20,"endPos":22,"startLine":3,"endLine":3},"meta":[{"type":"*meta.WhiteSpaceType","value":" ","tokenName":"StringToken"}],"Value":"Foo"}]},"Stmts":[{"type":"*stmt.Class","position":{"startPos":29,"endPos":162,"startLine":4,"endLine":11},"namespacedName":"Foo\\Bar","meta":[{"type":"*meta.WhiteSpaceType","value":"\n\t\t\t","tokenName":"ClassToken"},{"type":"*meta.WhiteSpaceType","value":" ","tokenName":"OpenCurlyBracesToken"},{"type":"*meta.WhiteSpaceType","value":"\n\t\t\t","tokenName":"CloseCurlyBracesToken"}],"PhpDocComment":"","ClassName":{"type":"*node.Identifier","position":{"startPos":35,"endPos":37,"startLine":4,"endLine":4},"meta":[{"type":"*meta.WhiteSpaceType","value":" ","tokenName":"IdentifierToken"}],"Value":"Bar"},"Stmts":[{"type":"*stmt.ClassMethod","position":{"startPos":45,"endPos":157,"startLine":5,"endLine":10},"meta":[{"type":"*meta.WhiteSpaceType","value":" ","tokenName":"FunctionToken"}],"PhpDocComment":"","ReturnsRef":false,"MethodName":{"type":"*node.Identifier","position":{"startPos":61,"endPos":72,"startLine":5,"endLine":5},"meta":[{"type":"*meta.WhiteSpaceType","value":" ","tokenName":"IdentifierToken"}],"Value":"FunctionName"},"Modifiers":[{"type":"*node.Identifier","position":{"startPos":45,"endPos":50,"startLine":5,"endLine":5},"meta":[{"type":"*meta.WhiteSpaceType","value":"\n\t\t\t\t","tokenName":"IdentifierToken"}],"Value":"public"}],"Params":[{"type":"*node.Parameter","position":{"startPos":74,"endPos":89,"startLine":5,"endLine":5},"meta":[{"type":"*meta.WhiteSpaceType","value":" ","tokenName":"EqualToken"}],"ByRef":false,"Variadic":false,"VariableType":{"type":"*name.Name","position":{"startPos":74,"endPos":77,"startLine":5,"endLine":5},"namespacedName":"Foo\\Type","Parts":[{"type":"*name.NamePart","position":{"startPos":74,"endPos":77,"startLine":5,"endLine":5},"Value":"Type"}]},"Variable":{"type":"*expr.Variable","position":{"startPos":79,"endPos":82,"startLine":5,"endLine":5},"meta":[{"type":"*meta.WhiteSpaceType","value":" ","tokenName":"VariableToken"},{"type":"*meta.TokenType","value":"$","tokenName":"DollarToken"}],"VarName":{"type":"*node.Identifier","position":{"startPos":79,"endPos":82,"startLine":5,"endLine":5},"Value":"var"}},"DefaultValue":{"type":"*expr.ConstFetch","position":{"startPos":86,"endPos":89,"startLine":5,"endLine":5},"Constant":{"type":"*name.Name","position":{"startPos":86,"endPos":89,"startLine":5,"endLine":5},"namespacedName":"null","Parts":[{"type":"*name.NamePart","position":{"startPos":86,"endPos":89,"startLine":5,"endLine":5},"meta":[{"type":"*meta.WhiteSpaceType","value":" ","tokenName":"StringToken"}],"Value":"null"}]}}}],"Stmt":{"type":"*stmt.StmtList","position":{"startPos":96,"endPos":157,"startLine":6,"endLine":10},"meta":[{"type":"*meta.WhiteSpaceType","value":"\n\t\t\t\t","tokenName":"OpenCurlyBracesToken"},{"type":"*meta.WhiteSpaceType","value":"\n\t\t\t\t","tokenName":"CloseCurlyBracesToken"}],"Stmts":[{"type":"*stmt.Expression","position":{"startPos":147,"endPos":151,"startLine":9,"endLine":9},"meta":[{"type":"*meta.TokenType","value":";","tokenName":"SemiColonToken"}],"Expr":{"type":"*expr.Variable","position":{"startPos":147,"endPos":150,"startLine":9,"endLine":9},"meta":[{"type":"*meta.WhiteSpaceType","value":"\n\t\t\t\t\t","tokenName":"VariableToken"},{"type":"*meta.CommentType","value":"// some comment\n","tokenName":"VariableToken"},{"type":"*meta.WhiteSpaceType","value":"\t\t\t\t\t","tokenName":"VariableToken"},{"type":"*meta.CommentType","value":"// second comment\n","tokenName":"VariableToken"},{"type":"*meta.WhiteSpaceType","value":"\t\t\t\t\t","tokenName":"VariableToken"},{"type":"*meta.TokenType","value":"$","tokenName":"DollarToken"}],"VarName":{"type":"*node.Identifier","position":{"startPos":147,"endPos":150,"startLine":9,"endLine":9},"Value":"var"}}}]}}]}]}]}
// {"type":"*node.Root","position":{"startPos":10,"endPos":166,"startLine":3,"endLine":12},"Stmts":[{"type":"*stmt.Namespace","position":{"startPos":10,"endPos":166,"startLine":3,"endLine":12},"meta":[{"type":"*meta.TokenType","value":"<?php","tokenName":"NamespaceToken"},{"type":"*meta.WhiteSpaceType","value":"\n\n\t\t","tokenName":"NamespaceToken"},{"type":"*meta.WhiteSpaceType","value":" ","tokenName":"OpenCurlyBracesToken"},{"type":"*meta.WhiteSpaceType","value":"\n\t\t","tokenName":"CloseCurlyBracesToken"}],"NamespaceName":{"type":"*name.Name","position":{"startPos":20,"endPos":22,"startLine":3,"endLine":3},"Parts":[{"type":"*name.NamePart","position":{"startPos":20,"endPos":22,"startLine":3,"endLine":3},"meta":[{"type":"*meta.WhiteSpaceType","value":" ","tokenName":"StringToken"}],"Value":"Foo"}]},"Stmts":[{"type":"*stmt.Class","position":{"startPos":29,"endPos":162,"startLine":4,"endLine":11},"namespacedName":"Foo\\Bar","meta":[{"type":"*meta.WhiteSpaceType","value":"\n\t\t\t","tokenName":"ClassToken"},{"type":"*meta.WhiteSpaceType","value":" ","tokenName":"OpenCurlyBracesToken"},{"type":"*meta.WhiteSpaceType","value":"\n\t\t\t","tokenName":"CloseCurlyBracesToken"}],"PhpDocComment":"","ClassName":{"type":"*node.Identifier","position":{"startPos":35,"endPos":37,"startLine":4,"endLine":4},"meta":[{"type":"*meta.WhiteSpaceType","value":" ","tokenName":"IdentifierToken"}],"Value":"Bar"},"Stmts":[{"type":"*stmt.ClassMethod","position":{"startPos":45,"endPos":157,"startLine":5,"endLine":10},"meta":[{"type":"*meta.WhiteSpaceType","value":" ","tokenName":"FunctionToken"}],"PhpDocComment":"","ReturnsRef":false,"MethodName":{"type":"*node.Identifier","position":{"startPos":61,"endPos":72,"startLine":5,"endLine":5},"meta":[{"type":"*meta.WhiteSpaceType","value":" ","tokenName":"IdentifierToken"}],"Value":"FunctionName"},"Modifiers":[{"type":"*node.Identifier","position":{"startPos":45,"endPos":50,"startLine":5,"endLine":5},"meta":[{"type":"*meta.WhiteSpaceType","value":"\n\t\t\t\t","tokenName":"IdentifierToken"}],"Value":"public"}],"Params":[{"type":"*node.Parameter","position":{"startPos":74,"endPos":89,"startLine":5,"endLine":5},"meta":[{"type":"*meta.WhiteSpaceType","value":" ","tokenName":"EqualToken"}],"ByRef":false,"Variadic":false,"VariableType":{"type":"*name.Name","position":{"startPos":74,"endPos":77,"startLine":5,"endLine":5},"namespacedName":"Foo\\Type","Parts":[{"type":"*name.NamePart","position":{"startPos":74,"endPos":77,"startLine":5,"endLine":5},"Value":"Type"}]},"Variable":{"type":"*expr.Variable","position":{"startPos":79,"endPos":82,"startLine":5,"endLine":5},"meta":[{"type":"*meta.WhiteSpaceType","value":" ","tokenName":"NodeStart"},{"type":"*meta.TokenType","value":"$","tokenName":"NodeStart"}],"VarName":{"type":"*node.Identifier","position":{"startPos":79,"endPos":82,"startLine":5,"endLine":5},"Value":"var"}},"DefaultValue":{"type":"*expr.ConstFetch","position":{"startPos":86,"endPos":89,"startLine":5,"endLine":5},"Constant":{"type":"*name.Name","position":{"startPos":86,"endPos":89,"startLine":5,"endLine":5},"namespacedName":"null","Parts":[{"type":"*name.NamePart","position":{"startPos":86,"endPos":89,"startLine":5,"endLine":5},"meta":[{"type":"*meta.WhiteSpaceType","value":" ","tokenName":"StringToken"}],"Value":"null"}]}}}],"Stmt":{"type":"*stmt.StmtList","position":{"startPos":96,"endPos":157,"startLine":6,"endLine":10},"meta":[{"type":"*meta.WhiteSpaceType","value":"\n\t\t\t\t","tokenName":"OpenCurlyBracesToken"},{"type":"*meta.WhiteSpaceType","value":"\n\t\t\t\t","tokenName":"CloseCurlyBracesToken"}],"Stmts":[{"type":"*stmt.Expression","position":{"startPos":147,"endPos":151,"startLine":9,"endLine":9},"meta":[{"type":"*meta.TokenType","value":";","tokenName":"SemiColonToken"}],"Expr":{"type":"*expr.Variable","position":{"startPos":147,"endPos":150,"startLine":9,"endLine":9},"meta":[{"type":"*meta.WhiteSpaceType","value":"\n\t\t\t\t\t","tokenName":"NodeStart"},{"type":"*meta.CommentType","value":"// some comment\n","tokenName":"NodeStart"},{"type":"*meta.WhiteSpaceType","value":"\t\t\t\t\t","tokenName":"NodeStart"},{"type":"*meta.CommentType","value":"// second comment\n","tokenName":"NodeStart"},{"type":"*meta.WhiteSpaceType","value":"\t\t\t\t\t","tokenName":"NodeStart"},{"type":"*meta.TokenType","value":"$","tokenName":"NodeStart"}],"VarName":{"type":"*node.Identifier","position":{"startPos":147,"endPos":150,"startLine":9,"endLine":9},"Value":"var"}}}]}}]}]}]}
}

View File

@ -264,12 +264,12 @@ func ExamplePrettyJsonDumper() {
// {
// "type": "*meta.WhiteSpaceType",
// "value": " ",
// "tokenName": "VariableToken"
// "tokenName": "NodeStart"
// },
// {
// "type": "*meta.TokenType",
// "value": "$",
// "tokenName": "DollarToken"
// "tokenName": "NodeStart"
// }
// ],
// "VarName": {
@ -371,32 +371,32 @@ func ExamplePrettyJsonDumper() {
// {
// "type": "*meta.WhiteSpaceType",
// "value": "\n\t\t\t\t\t",
// "tokenName": "VariableToken"
// "tokenName": "NodeStart"
// },
// {
// "type": "*meta.CommentType",
// "value": "// some comment\n",
// "tokenName": "VariableToken"
// "tokenName": "NodeStart"
// },
// {
// "type": "*meta.WhiteSpaceType",
// "value": "\t\t\t\t\t",
// "tokenName": "VariableToken"
// "tokenName": "NodeStart"
// },
// {
// "type": "*meta.CommentType",
// "value": "// second comment\n",
// "tokenName": "VariableToken"
// "tokenName": "NodeStart"
// },
// {
// "type": "*meta.WhiteSpaceType",
// "value": "\t\t\t\t\t",
// "tokenName": "VariableToken"
// "tokenName": "NodeStart"
// },
// {
// "type": "*meta.TokenType",
// "value": "$",
// "tokenName": "DollarToken"
// "tokenName": "NodeStart"
// }
// ],
// "VarName": {