remove meta.NamespaceToken

This commit is contained in:
z7zmey 2018-10-25 13:32:18 +03:00
parent 16de29a2a3
commit 379032b8c5
13 changed files with 55 additions and 63 deletions

View File

@ -64,7 +64,6 @@ const (
StartHeredocToken
CurlyOpenToken
PaamayimNekudotayimToken
NamespaceToken
UseLeadingNsSeparatorToken
NsSeparatorToken
EllipsisToken

View File

@ -4,9 +4,9 @@ package meta
import "strconv"
const _TokenName_name = "NodeStartNodeEndMagicConstantTokenIncludeTokenIncludeOnceTokenExitTokenIfTokenLnumberTokenDnumberTokenStringVarnameTokenNumStringTokenInlineHTMLTokenEncapsedAndWhitespaceTokenEchoTokenDoTokenWhileTokenEndwhileTokenForInitSemicolonTokenForCondSemicolonTokenForTokenEndforTokenForeachTokenEndforeachTokenDeclareTokenEnddeclareTokenAsTokenSwitchTokenEndswitchTokenCaseTokenDefaultTokenBreakTokenContinueTokenGotoTokenFunctionTokenConstTokenReturnTokenTryTokenCatchTokenFinallyTokenThrowTokenUseTokenInsteadofTokenGlobalTokenVarTokenUnsetTokenIssetTokenEmptyTokenClassTokenTraitTokenInterfaceTokenExtendsTokenImplementsTokenDoubleArrowTokenListTokenArrayTokenCallableTokenStartHeredocTokenCurlyOpenTokenPaamayimNekudotayimTokenNamespaceTokenUseLeadingNsSeparatorTokenNsSeparatorTokenEllipsisTokenEvalTokenRequireTokenRequireOnceTokenLogicalOrTokenLogicalXorTokenLogicalAndTokenInstanceofTokenNewAnchorCloneTokenElseifTokenElseTokenEndifTokenPrintTokenYieldTokenStaticTokenAbstractTokenFinalTokenPrivateTokenProtectedTokenPublicTokenIncTokenDecTokenYieldFromTokenObjectOperatorTokenIntCastTokenDoubleCastTokenStringCastTokenArrayCastTokenObjectCastTokenBoolCastTokenUnsetCastTokenCoalesceTokenSpaceshipTokenPlusEqualTokenMinusEqualTokenMulEqualTokenPowEqualTokenDivEqualTokenConcatEqualTokenModEqualTokenAndEqualTokenOrEqualTokenXorEqualTokenSlEqualTokenSrEqualTokenBooleanOrTokenBooleanAndTokenPowTokenSlTokenSrTokenIsIdenticalTokenIsNotIdenticalTokenIsEqualTokenIsNotEqualTokenIsSmallerOrEqualTokenIsGreaterOrEqualTokenHaltCompilerTokenCaseSeparatorTokenDoubleQuoteTokenBackquoteTokenOpenCurlyBracesTokenCloseCurlyBracesTokenSemiColonTokenColonTokenOpenParenthesisTokenCloseParenthesisTokenOpenSquareBracketCloseSquareBracketQuestionMarkTokenAmpersandTokenMinusTokenPlusTokenExclamationMarkTokenTildeTokenAtTokenCommaTokenVerticalBarTokenEqualTokenCaretTokenAsteriskTokenSlashTokenPercentTokenLessTokenGreaterTokenDotToken"
const _TokenName_name = "NodeStartNodeEndMagicConstantTokenIncludeTokenIncludeOnceTokenExitTokenIfTokenLnumberTokenDnumberTokenStringVarnameTokenNumStringTokenInlineHTMLTokenEncapsedAndWhitespaceTokenEchoTokenDoTokenWhileTokenEndwhileTokenForInitSemicolonTokenForCondSemicolonTokenForTokenEndforTokenForeachTokenEndforeachTokenDeclareTokenEnddeclareTokenAsTokenSwitchTokenEndswitchTokenCaseTokenDefaultTokenBreakTokenContinueTokenGotoTokenFunctionTokenConstTokenReturnTokenTryTokenCatchTokenFinallyTokenThrowTokenUseTokenInsteadofTokenGlobalTokenVarTokenUnsetTokenIssetTokenEmptyTokenClassTokenTraitTokenInterfaceTokenExtendsTokenImplementsTokenDoubleArrowTokenListTokenArrayTokenCallableTokenStartHeredocTokenCurlyOpenTokenPaamayimNekudotayimTokenUseLeadingNsSeparatorTokenNsSeparatorTokenEllipsisTokenEvalTokenRequireTokenRequireOnceTokenLogicalOrTokenLogicalXorTokenLogicalAndTokenInstanceofTokenNewAnchorCloneTokenElseifTokenElseTokenEndifTokenPrintTokenYieldTokenStaticTokenAbstractTokenFinalTokenPrivateTokenProtectedTokenPublicTokenIncTokenDecTokenYieldFromTokenObjectOperatorTokenIntCastTokenDoubleCastTokenStringCastTokenArrayCastTokenObjectCastTokenBoolCastTokenUnsetCastTokenCoalesceTokenSpaceshipTokenPlusEqualTokenMinusEqualTokenMulEqualTokenPowEqualTokenDivEqualTokenConcatEqualTokenModEqualTokenAndEqualTokenOrEqualTokenXorEqualTokenSlEqualTokenSrEqualTokenBooleanOrTokenBooleanAndTokenPowTokenSlTokenSrTokenIsIdenticalTokenIsNotIdenticalTokenIsEqualTokenIsNotEqualTokenIsSmallerOrEqualTokenIsGreaterOrEqualTokenHaltCompilerTokenCaseSeparatorTokenDoubleQuoteTokenBackquoteTokenOpenCurlyBracesTokenCloseCurlyBracesTokenSemiColonTokenColonTokenOpenParenthesisTokenCloseParenthesisTokenOpenSquareBracketCloseSquareBracketQuestionMarkTokenAmpersandTokenMinusTokenPlusTokenExclamationMarkTokenTildeTokenAtTokenCommaTokenVerticalBarTokenEqualTokenCaretTokenAsteriskTokenSlashTokenPercentTokenLessTokenGreaterTokenDotToken"
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, 737, 763, 779, 792, 801, 813, 829, 843, 858, 873, 888, 897, 907, 918, 927, 937, 947, 957, 968, 981, 991, 1003, 1017, 1028, 1036, 1044, 1058, 1077, 1089, 1104, 1119, 1133, 1148, 1161, 1175, 1188, 1202, 1216, 1231, 1244, 1257, 1270, 1286, 1299, 1312, 1324, 1337, 1349, 1361, 1375, 1390, 1398, 1405, 1412, 1428, 1447, 1459, 1474, 1495, 1516, 1533, 1551, 1567, 1581, 1601, 1622, 1636, 1646, 1666, 1687, 1704, 1722, 1739, 1753, 1763, 1772, 1792, 1802, 1809, 1819, 1835, 1845, 1855, 1868, 1878, 1890, 1899, 1911, 1919}
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}
func (i TokenName) String() string {
if i < 0 || i >= TokenName(len(_TokenName_index)-1) {

View File

@ -2452,7 +2452,7 @@ yydefault:
yyVAL.node.SetPosition(yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[3].token))
// save comments
yyDollar[1].token.Meta.SetTokenName(meta.NamespaceToken).AppendTo(yyVAL.node.GetMeta())
yyDollar[1].token.Meta.SetTokenName(meta.NodeStart).AppendTo(yyVAL.node.GetMeta())
yyDollar[3].token.Meta.SetTokenName(meta.SemiColonToken).AppendTo(yyVAL.node.GetMeta())
yylex.(*Parser).appendMetaToken(yyVAL.node, yyDollar[3].token, meta.SemiColonToken)
@ -2470,7 +2470,7 @@ yydefault:
yyVAL.node.SetPosition(yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[5].token))
// save comments
yyDollar[1].token.Meta.SetTokenName(meta.NamespaceToken).AppendTo(yyVAL.node.GetMeta())
yyDollar[1].token.Meta.SetTokenName(meta.NodeStart).AppendTo(yyVAL.node.GetMeta())
yyDollar[3].token.Meta.SetTokenName(meta.OpenCurlyBracesToken).AppendTo(yyVAL.node.GetMeta())
yyDollar[5].token.Meta.SetTokenName(meta.CloseCurlyBracesToken).AppendTo(yyVAL.node.GetMeta())
@ -2486,7 +2486,7 @@ yydefault:
yyVAL.node.SetPosition(yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[4].token))
// save comments
yyDollar[1].token.Meta.SetTokenName(meta.NamespaceToken).AppendTo(yyVAL.node.GetMeta())
yyDollar[1].token.Meta.SetTokenName(meta.NodeStart).AppendTo(yyVAL.node.GetMeta())
yyDollar[2].token.Meta.SetTokenName(meta.OpenCurlyBracesToken).AppendTo(yyVAL.node.GetMeta())
yyDollar[4].token.Meta.SetTokenName(meta.CloseCurlyBracesToken).AppendTo(yyVAL.node.GetMeta())
@ -6936,7 +6936,7 @@ yydefault:
yyVAL.node.SetPosition(yylex.(*Parser).positionBuilder.NewNodesPosition(funcName, yyDollar[4].node))
// save comments
yyDollar[1].token.Meta.SetTokenName(meta.NamespaceToken).AppendTo(funcName.GetMeta())
yyDollar[1].token.Meta.SetTokenName(meta.NodeStart).AppendTo(funcName.GetMeta())
yyDollar[2].token.Meta.SetTokenName(meta.NsSeparatorToken).AppendTo(funcName.GetMeta())
yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL)
@ -6953,7 +6953,7 @@ yydefault:
yyVAL.node.SetPosition(yylex.(*Parser).positionBuilder.NewNodesPosition(funcName, yyDollar[3].node))
// save comments
yyDollar[1].token.Meta.SetTokenName(meta.NsSeparatorToken).AppendTo(funcName.GetMeta())
yyDollar[1].token.Meta.SetTokenName(meta.NodeStart).AppendTo(funcName.GetMeta())
yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL)
}
@ -7059,7 +7059,7 @@ yydefault:
yyVAL.node.SetPosition(yylex.(*Parser).positionBuilder.NewTokenNodeListPosition(yyDollar[1].token, yyDollar[3].list))
// save comments
yyDollar[1].token.Meta.SetTokenName(meta.NamespaceToken).AppendTo(yyVAL.node.GetMeta())
yyDollar[1].token.Meta.SetTokenName(meta.NodeStart).AppendTo(yyVAL.node.GetMeta())
yyDollar[2].token.Meta.SetTokenName(meta.NsSeparatorToken).AppendTo(yyVAL.node.GetMeta())
yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL)
@ -7074,7 +7074,7 @@ yydefault:
yyVAL.node.SetPosition(yylex.(*Parser).positionBuilder.NewTokenNodeListPosition(yyDollar[1].token, yyDollar[2].list))
// save comments
yyDollar[1].token.Meta.SetTokenName(meta.NsSeparatorToken).AppendTo(yyVAL.node.GetMeta())
yyDollar[1].token.Meta.SetTokenName(meta.NodeStart).AppendTo(yyVAL.node.GetMeta())
yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL)
}
@ -7099,7 +7099,7 @@ yydefault:
yyVAL.node.SetPosition(yylex.(*Parser).positionBuilder.NewTokenNodeListPosition(yyDollar[1].token, yyDollar[3].list))
// save comments
yyDollar[1].token.Meta.SetTokenName(meta.NamespaceToken).AppendTo(yyVAL.node.GetMeta())
yyDollar[1].token.Meta.SetTokenName(meta.NodeStart).AppendTo(yyVAL.node.GetMeta())
yyDollar[2].token.Meta.SetTokenName(meta.NsSeparatorToken).AppendTo(yyVAL.node.GetMeta())
yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL)
@ -7114,7 +7114,7 @@ yydefault:
yyVAL.node.SetPosition(yylex.(*Parser).positionBuilder.NewTokenNodeListPosition(yyDollar[1].token, yyDollar[2].list))
// save comments
yyDollar[1].token.Meta.SetTokenName(meta.NsSeparatorToken).AppendTo(yyVAL.node.GetMeta())
yyDollar[1].token.Meta.SetTokenName(meta.NodeStart).AppendTo(yyVAL.node.GetMeta())
yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL)
}
@ -7528,7 +7528,7 @@ yydefault:
yyVAL.node.SetPosition(yylex.(*Parser).positionBuilder.NewTokenNodeListPosition(yyDollar[1].token, yyDollar[3].list))
// save comments
yyDollar[1].token.Meta.SetTokenName(meta.NamespaceToken).AppendTo(name.GetMeta())
yyDollar[1].token.Meta.SetTokenName(meta.NodeStart).AppendTo(name.GetMeta())
yyDollar[2].token.Meta.SetTokenName(meta.NsSeparatorToken).AppendTo(name.GetMeta())
yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL)
@ -7545,7 +7545,7 @@ yydefault:
yyVAL.node.SetPosition(yylex.(*Parser).positionBuilder.NewTokenNodeListPosition(yyDollar[1].token, yyDollar[2].list))
// save comments
yyDollar[1].token.Meta.SetTokenName(meta.NsSeparatorToken).AppendTo(name.GetMeta())
yyDollar[1].token.Meta.SetTokenName(meta.NodeStart).AppendTo(name.GetMeta())
yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL)
}
@ -8107,7 +8107,7 @@ yydefault:
yyVAL.node.SetPosition(yylex.(*Parser).positionBuilder.NewNodePosition(name))
// save comments
yyDollar[1].token.Meta.SetTokenName(meta.NamespaceToken).AppendTo(name.GetMeta())
yyDollar[1].token.Meta.SetTokenName(meta.NodeStart).AppendTo(name.GetMeta())
yyDollar[2].token.Meta.SetTokenName(meta.NsSeparatorToken).AppendTo(name.GetMeta())
yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL)
@ -8124,7 +8124,7 @@ yydefault:
yyVAL.node.SetPosition(yylex.(*Parser).positionBuilder.NewNodePosition(name))
// save comments
yyDollar[1].token.Meta.SetTokenName(meta.NsSeparatorToken).AppendTo(name.GetMeta())
yyDollar[1].token.Meta.SetTokenName(meta.NodeStart).AppendTo(name.GetMeta())
yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL)
}

View File

@ -391,7 +391,7 @@ top_statement:
$$.SetPosition(yylex.(*Parser).positionBuilder.NewTokensPosition($1, $3))
// save comments
$1.Meta.SetTokenName(meta.NamespaceToken).AppendTo($$.GetMeta())
$1.Meta.SetTokenName(meta.NodeStart).AppendTo($$.GetMeta())
$3.Meta.SetTokenName(meta.SemiColonToken).AppendTo($$.GetMeta())
yylex.(*Parser).appendMetaToken($$, $3, meta.SemiColonToken)
@ -407,7 +407,7 @@ top_statement:
$$.SetPosition(yylex.(*Parser).positionBuilder.NewTokensPosition($1, $5))
// save comments
$1.Meta.SetTokenName(meta.NamespaceToken).AppendTo($$.GetMeta())
$1.Meta.SetTokenName(meta.NodeStart).AppendTo($$.GetMeta())
$3.Meta.SetTokenName(meta.OpenCurlyBracesToken).AppendTo($$.GetMeta())
$5.Meta.SetTokenName(meta.CloseCurlyBracesToken).AppendTo($$.GetMeta())
@ -421,7 +421,7 @@ top_statement:
$$.SetPosition(yylex.(*Parser).positionBuilder.NewTokensPosition($1, $4))
// save comments
$1.Meta.SetTokenName(meta.NamespaceToken).AppendTo($$.GetMeta())
$1.Meta.SetTokenName(meta.NodeStart).AppendTo($$.GetMeta())
$2.Meta.SetTokenName(meta.OpenCurlyBracesToken).AppendTo($$.GetMeta())
$4.Meta.SetTokenName(meta.CloseCurlyBracesToken).AppendTo($$.GetMeta())
@ -4546,7 +4546,7 @@ function_call:
$$.SetPosition(yylex.(*Parser).positionBuilder.NewNodesPosition(funcName, $4))
// save comments
$1.Meta.SetTokenName(meta.NamespaceToken).AppendTo(funcName.GetMeta())
$1.Meta.SetTokenName(meta.NodeStart).AppendTo(funcName.GetMeta())
$2.Meta.SetTokenName(meta.NsSeparatorToken).AppendTo(funcName.GetMeta())
yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL)
@ -4561,7 +4561,7 @@ function_call:
$$.SetPosition(yylex.(*Parser).positionBuilder.NewNodesPosition(funcName, $3))
// save comments
$1.Meta.SetTokenName(meta.NsSeparatorToken).AppendTo(funcName.GetMeta())
$1.Meta.SetTokenName(meta.NodeStart).AppendTo(funcName.GetMeta())
yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL)
}
@ -4654,7 +4654,7 @@ class_name:
$$.SetPosition(yylex.(*Parser).positionBuilder.NewTokenNodeListPosition($1, $3))
// save comments
$1.Meta.SetTokenName(meta.NamespaceToken).AppendTo($$.GetMeta())
$1.Meta.SetTokenName(meta.NodeStart).AppendTo($$.GetMeta())
$2.Meta.SetTokenName(meta.NsSeparatorToken).AppendTo($$.GetMeta())
yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL)
@ -4667,7 +4667,7 @@ class_name:
$$.SetPosition(yylex.(*Parser).positionBuilder.NewTokenNodeListPosition($1, $2))
// save comments
$1.Meta.SetTokenName(meta.NsSeparatorToken).AppendTo($$.GetMeta())
$1.Meta.SetTokenName(meta.NodeStart).AppendTo($$.GetMeta())
yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL)
}
@ -4691,7 +4691,7 @@ fully_qualified_class_name:
$$.SetPosition(yylex.(*Parser).positionBuilder.NewTokenNodeListPosition($1, $3))
// save comments
$1.Meta.SetTokenName(meta.NamespaceToken).AppendTo($$.GetMeta())
$1.Meta.SetTokenName(meta.NodeStart).AppendTo($$.GetMeta())
$2.Meta.SetTokenName(meta.NsSeparatorToken).AppendTo($$.GetMeta())
yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL)
@ -4704,7 +4704,7 @@ fully_qualified_class_name:
$$.SetPosition(yylex.(*Parser).positionBuilder.NewTokenNodeListPosition($1, $2))
// save comments
$1.Meta.SetTokenName(meta.NsSeparatorToken).AppendTo($$.GetMeta())
$1.Meta.SetTokenName(meta.NodeStart).AppendTo($$.GetMeta())
yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL)
}
@ -5087,7 +5087,7 @@ static_scalar_value:
$$.SetPosition(yylex.(*Parser).positionBuilder.NewTokenNodeListPosition($1, $3))
// save comments
$1.Meta.SetTokenName(meta.NamespaceToken).AppendTo(name.GetMeta())
$1.Meta.SetTokenName(meta.NodeStart).AppendTo(name.GetMeta())
$2.Meta.SetTokenName(meta.NsSeparatorToken).AppendTo(name.GetMeta())
yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL)
@ -5102,7 +5102,7 @@ static_scalar_value:
$$.SetPosition(yylex.(*Parser).positionBuilder.NewTokenNodeListPosition($1, $2))
// save comments
$1.Meta.SetTokenName(meta.NsSeparatorToken).AppendTo(name.GetMeta())
$1.Meta.SetTokenName(meta.NodeStart).AppendTo(name.GetMeta())
yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL)
}
@ -5588,7 +5588,7 @@ general_constant:
$$.SetPosition(yylex.(*Parser).positionBuilder.NewNodePosition(name))
// save comments
$1.Meta.SetTokenName(meta.NamespaceToken).AppendTo(name.GetMeta())
$1.Meta.SetTokenName(meta.NodeStart).AppendTo(name.GetMeta())
$2.Meta.SetTokenName(meta.NsSeparatorToken).AppendTo(name.GetMeta())
yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL)
@ -5603,7 +5603,7 @@ general_constant:
$$.SetPosition(yylex.(*Parser).positionBuilder.NewNodePosition(name))
// save comments
$1.Meta.SetTokenName(meta.NsSeparatorToken).AppendTo(name.GetMeta())
$1.Meta.SetTokenName(meta.NodeStart).AppendTo(name.GetMeta())
yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL)
}

View File

@ -2655,7 +2655,7 @@ yydefault:
yyVAL.node.SetPosition(yylex.(*Parser).positionBuilder.NewTokenNodeListPosition(yyDollar[1].token, yyDollar[3].list))
// save comments
yyDollar[1].token.Meta.SetTokenName(meta.NamespaceToken).AppendTo(yyVAL.node.GetMeta())
yyDollar[1].token.Meta.SetTokenName(meta.NodeStart).AppendTo(yyVAL.node.GetMeta())
yyDollar[2].token.Meta.SetTokenName(meta.NsSeparatorToken).AppendTo(yyVAL.node.GetMeta())
yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL)
@ -2670,7 +2670,7 @@ yydefault:
yyVAL.node.SetPosition(yylex.(*Parser).positionBuilder.NewTokenNodeListPosition(yyDollar[1].token, yyDollar[2].list))
// save comments
yyDollar[1].token.Meta.SetTokenName(meta.NsSeparatorToken).AppendTo(yyVAL.node.GetMeta())
yyDollar[1].token.Meta.SetTokenName(meta.NodeStart).AppendTo(yyVAL.node.GetMeta())
yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL)
}
@ -2755,7 +2755,7 @@ yydefault:
yyVAL.node.SetPosition(yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[3].token))
// save comments
yyDollar[1].token.Meta.SetTokenName(meta.NamespaceToken).AppendTo(yyVAL.node.GetMeta())
yyDollar[1].token.Meta.SetTokenName(meta.NodeStart).AppendTo(yyVAL.node.GetMeta())
yyDollar[3].token.Meta.SetTokenName(meta.SemiColonToken).AppendTo(yyVAL.node.GetMeta())
yylex.(*Parser).appendMetaToken(yyVAL.node, yyDollar[3].token, meta.SemiColonToken)
@ -2773,7 +2773,7 @@ yydefault:
yyVAL.node.SetPosition(yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[5].token))
// save comments
yyDollar[1].token.Meta.SetTokenName(meta.NamespaceToken).AppendTo(yyVAL.node.GetMeta())
yyDollar[1].token.Meta.SetTokenName(meta.NodeStart).AppendTo(yyVAL.node.GetMeta())
yyDollar[3].token.Meta.SetTokenName(meta.OpenCurlyBracesToken).AppendTo(yyVAL.node.GetMeta())
yyDollar[5].token.Meta.SetTokenName(meta.CloseCurlyBracesToken).AppendTo(yyVAL.node.GetMeta())
@ -2789,7 +2789,7 @@ yydefault:
yyVAL.node.SetPosition(yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[4].token))
// save comments
yyDollar[1].token.Meta.SetTokenName(meta.NamespaceToken).AppendTo(yyVAL.node.GetMeta())
yyDollar[1].token.Meta.SetTokenName(meta.NodeStart).AppendTo(yyVAL.node.GetMeta())
yyDollar[2].token.Meta.SetTokenName(meta.OpenCurlyBracesToken).AppendTo(yyVAL.node.GetMeta())
yyDollar[4].token.Meta.SetTokenName(meta.CloseCurlyBracesToken).AppendTo(yyVAL.node.GetMeta())

View File

@ -405,7 +405,7 @@ name:
$$.SetPosition(yylex.(*Parser).positionBuilder.NewTokenNodeListPosition($1, $3))
// save comments
$1.Meta.SetTokenName(meta.NamespaceToken).AppendTo($$.GetMeta())
$1.Meta.SetTokenName(meta.NodeStart).AppendTo($$.GetMeta())
$2.Meta.SetTokenName(meta.NsSeparatorToken).AppendTo($$.GetMeta())
yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL)
@ -418,7 +418,7 @@ name:
$$.SetPosition(yylex.(*Parser).positionBuilder.NewTokenNodeListPosition($1, $2))
// save comments
$1.Meta.SetTokenName(meta.NsSeparatorToken).AppendTo($$.GetMeta())
$1.Meta.SetTokenName(meta.NodeStart).AppendTo($$.GetMeta())
yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL)
}
@ -490,7 +490,7 @@ top_statement:
$$.SetPosition(yylex.(*Parser).positionBuilder.NewTokensPosition($1, $3))
// save comments
$1.Meta.SetTokenName(meta.NamespaceToken).AppendTo($$.GetMeta())
$1.Meta.SetTokenName(meta.NodeStart).AppendTo($$.GetMeta())
$3.Meta.SetTokenName(meta.SemiColonToken).AppendTo($$.GetMeta())
yylex.(*Parser).appendMetaToken($$, $3, meta.SemiColonToken)
@ -506,7 +506,7 @@ top_statement:
$$.SetPosition(yylex.(*Parser).positionBuilder.NewTokensPosition($1, $5))
// save comments
$1.Meta.SetTokenName(meta.NamespaceToken).AppendTo($$.GetMeta())
$1.Meta.SetTokenName(meta.NodeStart).AppendTo($$.GetMeta())
$3.Meta.SetTokenName(meta.OpenCurlyBracesToken).AppendTo($$.GetMeta())
$5.Meta.SetTokenName(meta.CloseCurlyBracesToken).AppendTo($$.GetMeta())
@ -520,7 +520,7 @@ top_statement:
$$.SetPosition(yylex.(*Parser).positionBuilder.NewTokensPosition($1, $4))
// save comments
$1.Meta.SetTokenName(meta.NamespaceToken).AppendTo($$.GetMeta())
$1.Meta.SetTokenName(meta.NodeStart).AppendTo($$.GetMeta())
$2.Meta.SetTokenName(meta.OpenCurlyBracesToken).AppendTo($$.GetMeta())
$4.Meta.SetTokenName(meta.CloseCurlyBracesToken).AppendTo($$.GetMeta())

View File

@ -522,8 +522,6 @@ func (p *Printer) printNameFullyQualified(n node.Node) {
nn := n.(*name.FullyQualified)
p.printMeta(nn, meta.NodeStart)
p.printMeta(nn, meta.NsSeparatorToken)
for _, part := range nn.Parts {
io.WriteString(p.w, "\\")
p.Print(part)
@ -535,13 +533,10 @@ func (p *Printer) printNameFullyQualified(n node.Node) {
func (p *Printer) printNameRelative(n node.Node) {
nn := n.(*name.Relative)
p.printMeta(nn, meta.NodeStart)
p.printMeta(nn, meta.NamespaceToken)
io.WriteString(p.w, "namespace")
for k, part := range nn.Parts {
if k == 0 {
p.printMeta(nn, meta.NsSeparatorToken)
}
p.printMeta(nn, meta.NsSeparatorToken)
for _, part := range nn.Parts {
io.WriteString(p.w, "\\")
p.Print(part)
}
@ -2515,8 +2510,6 @@ func (p *Printer) printStmtLabel(n node.Node) {
func (p *Printer) printStmtNamespace(n node.Node) {
nn := n.(*stmt.Namespace)
p.printMeta(nn, meta.NodeStart)
p.printMeta(n, meta.NamespaceToken)
io.WriteString(p.w, "namespace")
if nn.NamespaceName != nil {

View File

@ -113,7 +113,7 @@ func TestParseAndPrintParameter(t *testing.T) {
function & foo (
? int $a , & $b = null
, \ Foo ...$c
) : namespace \ Bar {
) : namespace \ Bar \ baz \ quuz{
;
}`

View File

@ -162,7 +162,7 @@ func TestPrinterPrintParameter(t *testing.T) {
&meta.Data{
Type: meta.WhiteSpaceType,
Value: " ",
TokenName: meta.NsSeparatorToken,
TokenName: meta.NodeStart,
},
},
Parts: []node.Node{
@ -240,7 +240,7 @@ func TestPrinterPrintNullable(t *testing.T) {
&meta.Data{
Type: meta.WhiteSpaceType,
Value: " ",
TokenName: meta.NsSeparatorToken,
TokenName: meta.NodeStart,
},
},
Parts: []node.Node{
@ -464,7 +464,7 @@ func TestPrinterPrintNameFullyQualified(t *testing.T) {
&meta.Data{
Type: meta.WhiteSpaceType,
Value: " ",
TokenName: meta.NsSeparatorToken,
TokenName: meta.NodeStart,
},
},
Parts: []node.Node{
@ -494,7 +494,7 @@ func TestPrinterPrintNameRelative(t *testing.T) {
&meta.Data{
Type: meta.WhiteSpaceType,
Value: " ",
TokenName: meta.NamespaceToken,
TokenName: meta.NodeStart,
},
&meta.Data{
Type: meta.WhiteSpaceType,
@ -7524,7 +7524,7 @@ func TestPrinterPrintNamespace(t *testing.T) {
&meta.Data{
Type: meta.WhiteSpaceType,
Value: " ",
TokenName: meta.NamespaceToken,
TokenName: meta.NodeStart,
},
&meta.Data{
Type: meta.WhiteSpaceType,
@ -7557,7 +7557,7 @@ func TestPrinterPrintNamespaceWithStmts(t *testing.T) {
&meta.Data{
Type: meta.WhiteSpaceType,
Value: " ",
TokenName: meta.NamespaceToken,
TokenName: meta.NodeStart,
},
&meta.Data{
Type: meta.WhiteSpaceType,

View File

@ -43,8 +43,8 @@ func ExampleDumper() {
// | [*stmt.Namespace]
// | "Position": Pos{Line: 3-11 Pos: 10-143}
// | "Meta":
// | "<?php" before "NamespaceToken"
// | "\n\n\t\t" before "NamespaceToken"
// | "<?php" before "NodeStart"
// | "\n\n\t\t" before "NodeStart"
// | " " before "OpenCurlyBracesToken"
// | "\n\t\t" before "CloseCurlyBracesToken"
// | "NamespaceName":

View File

@ -60,7 +60,7 @@ func ExampleGoDumper() {
// EndPos: 5,
// },
// Value: "<?php",
// TokenName: meta.NamespaceToken,
// TokenName: meta.NodeStart,
// },
// &meta.Data{
// Type: meta.WhiteSpaceType,
@ -71,7 +71,7 @@ func ExampleGoDumper() {
// EndPos: 9,
// },
// Value: "\n\n\t\t",
// TokenName: meta.NamespaceToken,
// TokenName: meta.NodeStart,
// },
// &meta.Data{
// Type: meta.WhiteSpaceType,

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":"NodeStart"}],"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":"NodeStart"}],"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":"NodeStart"}],"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":"NodeStart"}],"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":"NodeStart"}],"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"}}}]}}]}]}]}
// {"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":"NodeStart"},{"type":"*meta.WhiteSpaceType","value":"\n\n\t\t","tokenName":"NodeStart"},{"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":"NodeStart"}],"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":"NodeStart"}],"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":"NodeStart"}],"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":"NodeStart"}],"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":"NodeStart"}],"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

@ -67,12 +67,12 @@ func ExamplePrettyJsonDumper() {
// {
// "type": "*meta.TokenType",
// "value": "<?php",
// "tokenName": "NamespaceToken"
// "tokenName": "NodeStart"
// },
// {
// "type": "*meta.WhiteSpaceType",
// "value": "\n\n\t\t",
// "tokenName": "NamespaceToken"
// "tokenName": "NodeStart"
// },
// {
// "type": "*meta.WhiteSpaceType",