remove meta.GlobalToken
This commit is contained in:
parent
2866018474
commit
9c6a756545
@ -26,7 +26,6 @@ const (
|
|||||||
TryToken
|
TryToken
|
||||||
ThrowToken
|
ThrowToken
|
||||||
InsteadofToken
|
InsteadofToken
|
||||||
GlobalToken
|
|
||||||
VarToken
|
VarToken
|
||||||
UnsetToken
|
UnsetToken
|
||||||
ClassToken
|
ClassToken
|
||||||
|
@ -4,9 +4,9 @@ package meta
|
|||||||
|
|
||||||
import "strconv"
|
import "strconv"
|
||||||
|
|
||||||
const _TokenName_name = "NodeStartNodeEndStringVarnameTokenNumStringTokenInlineHTMLTokenWhileTokenEndwhileTokenForInitSemicolonTokenForCondSemicolonTokenEndforTokenEndforeachTokenEnddeclareTokenAsTokenEndswitchTokenGotoTokenFunctionTokenConstTokenReturnTokenTryTokenThrowTokenInsteadofTokenGlobalTokenVarTokenUnsetTokenClassTokenTraitTokenInterfaceTokenExtendsTokenImplementsTokenDoubleArrowTokenCallableTokenCurlyOpenTokenPaamayimNekudotayimTokenUseLeadingNsSeparatorTokenNsSeparatorTokenEllipsisTokenLogicalOrTokenLogicalXorTokenLogicalAndTokenInstanceofTokenEndifTokenAbstractTokenFinalTokenPrivateTokenProtectedTokenPublicTokenIncTokenDecTokenObjectOperatorTokenCoalesceTokenSpaceshipTokenPlusEqualTokenMinusEqualTokenMulEqualTokenPowEqualTokenDivEqualTokenConcatEqualTokenModEqualTokenAndEqualTokenOrEqualTokenXorEqualTokenSlEqualTokenSrEqualTokenBooleanOrTokenBooleanAndTokenPowTokenSlTokenSrTokenIsIdenticalTokenIsNotIdenticalTokenIsEqualTokenIsNotEqualTokenIsSmallerOrEqualTokenIsGreaterOrEqualTokenHaltCompilerTokenCaseSeparatorTokenOpenCurlyBracesTokenCloseCurlyBracesTokenSemiColonTokenColonTokenOpenParenthesisTokenCloseParenthesisTokenOpenSquareBracketCloseSquareBracketQuestionMarkTokenAmpersandTokenMinusTokenPlusTokenCommaTokenVerticalBarTokenEqualTokenCaretTokenAsteriskTokenSlashTokenPercentTokenLessTokenGreaterTokenDotToken"
|
const _TokenName_name = "NodeStartNodeEndStringVarnameTokenNumStringTokenInlineHTMLTokenWhileTokenEndwhileTokenForInitSemicolonTokenForCondSemicolonTokenEndforTokenEndforeachTokenEnddeclareTokenAsTokenEndswitchTokenGotoTokenFunctionTokenConstTokenReturnTokenTryTokenThrowTokenInsteadofTokenVarTokenUnsetTokenClassTokenTraitTokenInterfaceTokenExtendsTokenImplementsTokenDoubleArrowTokenCallableTokenCurlyOpenTokenPaamayimNekudotayimTokenUseLeadingNsSeparatorTokenNsSeparatorTokenEllipsisTokenLogicalOrTokenLogicalXorTokenLogicalAndTokenInstanceofTokenEndifTokenAbstractTokenFinalTokenPrivateTokenProtectedTokenPublicTokenIncTokenDecTokenObjectOperatorTokenCoalesceTokenSpaceshipTokenPlusEqualTokenMinusEqualTokenMulEqualTokenPowEqualTokenDivEqualTokenConcatEqualTokenModEqualTokenAndEqualTokenOrEqualTokenXorEqualTokenSlEqualTokenSrEqualTokenBooleanOrTokenBooleanAndTokenPowTokenSlTokenSrTokenIsIdenticalTokenIsNotIdenticalTokenIsEqualTokenIsNotEqualTokenIsSmallerOrEqualTokenIsGreaterOrEqualTokenHaltCompilerTokenCaseSeparatorTokenOpenCurlyBracesTokenCloseCurlyBracesTokenSemiColonTokenColonTokenOpenParenthesisTokenCloseParenthesisTokenOpenSquareBracketCloseSquareBracketQuestionMarkTokenAmpersandTokenMinusTokenPlusTokenCommaTokenVerticalBarTokenEqualTokenCaretTokenAsteriskTokenSlashTokenPercentTokenLessTokenGreaterTokenDotToken"
|
||||||
|
|
||||||
var _TokenName_index = [...]uint16{0, 9, 16, 34, 48, 63, 73, 86, 107, 128, 139, 154, 169, 176, 190, 199, 212, 222, 233, 241, 251, 265, 276, 284, 294, 304, 314, 328, 340, 355, 371, 384, 398, 422, 448, 464, 477, 491, 506, 521, 536, 546, 559, 569, 581, 595, 606, 614, 622, 641, 654, 668, 682, 697, 710, 723, 736, 752, 765, 778, 790, 803, 815, 827, 841, 856, 864, 871, 878, 894, 913, 925, 940, 961, 982, 999, 1017, 1037, 1058, 1072, 1082, 1102, 1123, 1140, 1158, 1175, 1189, 1199, 1208, 1218, 1234, 1244, 1254, 1267, 1277, 1289, 1298, 1310, 1318}
|
var _TokenName_index = [...]uint16{0, 9, 16, 34, 48, 63, 73, 86, 107, 128, 139, 154, 169, 176, 190, 199, 212, 222, 233, 241, 251, 265, 273, 283, 293, 303, 317, 329, 344, 360, 373, 387, 411, 437, 453, 466, 480, 495, 510, 525, 535, 548, 558, 570, 584, 595, 603, 611, 630, 643, 657, 671, 686, 699, 712, 725, 741, 754, 767, 779, 792, 804, 816, 830, 845, 853, 860, 867, 883, 902, 914, 929, 950, 971, 988, 1006, 1026, 1047, 1061, 1071, 1091, 1112, 1129, 1147, 1164, 1178, 1188, 1197, 1207, 1223, 1233, 1243, 1256, 1266, 1278, 1287, 1299, 1307}
|
||||||
|
|
||||||
func (i TokenName) String() string {
|
func (i TokenName) String() string {
|
||||||
if i < 0 || i >= TokenName(len(_TokenName_index)-1) {
|
if i < 0 || i >= TokenName(len(_TokenName_index)-1) {
|
||||||
|
@ -3258,7 +3258,7 @@ yydefault:
|
|||||||
yyVAL.node.SetPosition(yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[3].token))
|
yyVAL.node.SetPosition(yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[3].token))
|
||||||
|
|
||||||
// save comments
|
// save comments
|
||||||
yyDollar[1].token.Meta.SetTokenName(meta.GlobalToken).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())
|
yyDollar[3].token.Meta.SetTokenName(meta.SemiColonToken).AppendTo(yyVAL.node.GetMeta())
|
||||||
yylex.(*Parser).appendMetaToken(yyVAL.node, yyDollar[3].token, meta.SemiColonToken)
|
yylex.(*Parser).appendMetaToken(yyVAL.node, yyDollar[3].token, meta.SemiColonToken)
|
||||||
|
|
||||||
|
@ -1130,7 +1130,7 @@ unticked_statement:
|
|||||||
$$.SetPosition(yylex.(*Parser).positionBuilder.NewTokensPosition($1, $3))
|
$$.SetPosition(yylex.(*Parser).positionBuilder.NewTokensPosition($1, $3))
|
||||||
|
|
||||||
// save comments
|
// save comments
|
||||||
$1.Meta.SetTokenName(meta.GlobalToken).AppendTo($$.GetMeta())
|
$1.Meta.SetTokenName(meta.NodeStart).AppendTo($$.GetMeta())
|
||||||
$3.Meta.SetTokenName(meta.SemiColonToken).AppendTo($$.GetMeta())
|
$3.Meta.SetTokenName(meta.SemiColonToken).AppendTo($$.GetMeta())
|
||||||
yylex.(*Parser).appendMetaToken($$, $3, meta.SemiColonToken)
|
yylex.(*Parser).appendMetaToken($$, $3, meta.SemiColonToken)
|
||||||
|
|
||||||
|
@ -3421,7 +3421,7 @@ yydefault:
|
|||||||
yyVAL.node.SetPosition(yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[3].token))
|
yyVAL.node.SetPosition(yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[3].token))
|
||||||
|
|
||||||
// save comments
|
// save comments
|
||||||
yyDollar[1].token.Meta.SetTokenName(meta.GlobalToken).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())
|
yyDollar[3].token.Meta.SetTokenName(meta.SemiColonToken).AppendTo(yyVAL.node.GetMeta())
|
||||||
yylex.(*Parser).appendMetaToken(yyVAL.node, yyDollar[3].token, meta.SemiColonToken)
|
yylex.(*Parser).appendMetaToken(yyVAL.node, yyDollar[3].token, meta.SemiColonToken)
|
||||||
|
|
||||||
|
@ -1099,7 +1099,7 @@ statement:
|
|||||||
$$.SetPosition(yylex.(*Parser).positionBuilder.NewTokensPosition($1, $3))
|
$$.SetPosition(yylex.(*Parser).positionBuilder.NewTokensPosition($1, $3))
|
||||||
|
|
||||||
// save comments
|
// save comments
|
||||||
$1.Meta.SetTokenName(meta.GlobalToken).AppendTo($$.GetMeta())
|
$1.Meta.SetTokenName(meta.NodeStart).AppendTo($$.GetMeta())
|
||||||
$3.Meta.SetTokenName(meta.SemiColonToken).AppendTo($$.GetMeta())
|
$3.Meta.SetTokenName(meta.SemiColonToken).AppendTo($$.GetMeta())
|
||||||
yylex.(*Parser).appendMetaToken($$, $3, meta.SemiColonToken)
|
yylex.(*Parser).appendMetaToken($$, $3, meta.SemiColonToken)
|
||||||
|
|
||||||
|
@ -2263,7 +2263,6 @@ func (p *Printer) printStmtGlobal(n node.Node) {
|
|||||||
nn := n.(*stmt.Global)
|
nn := n.(*stmt.Global)
|
||||||
p.printMeta(nn, meta.NodeStart)
|
p.printMeta(nn, meta.NodeStart)
|
||||||
|
|
||||||
p.printMeta(nn, meta.GlobalToken)
|
|
||||||
io.WriteString(p.w, "global")
|
io.WriteString(p.w, "global")
|
||||||
p.joinPrint(",", nn.Vars)
|
p.joinPrint(",", nn.Vars)
|
||||||
p.printMeta(nn, meta.SemiColonToken)
|
p.printMeta(nn, meta.SemiColonToken)
|
||||||
|
@ -7029,7 +7029,7 @@ func TestPrinterPrintStmtGlobal(t *testing.T) {
|
|||||||
&meta.Data{
|
&meta.Data{
|
||||||
Type: meta.WhiteSpaceType,
|
Type: meta.WhiteSpaceType,
|
||||||
Value: " ",
|
Value: " ",
|
||||||
TokenName: meta.GlobalToken,
|
TokenName: meta.NodeStart,
|
||||||
},
|
},
|
||||||
&meta.Data{
|
&meta.Data{
|
||||||
Type: meta.WhiteSpaceType,
|
Type: meta.WhiteSpaceType,
|
||||||
|
Loading…
Reference in New Issue
Block a user