diff --git a/Makefile b/Makefile index 568b883..460cda5 100644 --- a/Makefile +++ b/Makefile @@ -6,6 +6,7 @@ fmt: find . -type f -iregex '.*\.go' -exec gofmt -l -s -w '{}' + build: + go generate ./... go build run: diff --git a/meta/tokenName.go b/meta/tokenName.go new file mode 100644 index 0000000..f3ad33d --- /dev/null +++ b/meta/tokenName.go @@ -0,0 +1,163 @@ +package meta + +// TokenName is used to specify a comment position +type TokenName int + +//go:generate stringer -type=TokenName -output ./tokenName_string.go +const ( + UnknownToken TokenName = iota + NodeStart + NodeEnd + MagicConstantToken + IncludeToken + IncludeOnceToken + ExitToken + IfToken + LnumberToken + DnumberToken + StringToken + StringVarnameToken + VariableToken + NumStringToken + InlineHTMLToken + EncapsedAndWhitespaceToken + ConstantEncapsedStringToken + EchoToken + DoToken + WhileToken + EndwhileToken + ForInitSemicolonToken + ForCondSemicolonToken + ForToken + EndforToken + ForeachToken + EndforeachToken + DeclareToken + EnddeclareToken + AsToken + SwitchToken + SwitchSemicolonToken + EndswitchToken + CaseToken + DefaultToken + BreakToken + ContinueToken + GotoToken + FunctionToken + ConstToken + ReturnToken + TryToken + CatchToken + FinallyToken + ThrowToken + UseToken + InsteadofToken + GlobalToken + VarToken + UnsetToken + IssetToken + EmptyToken + ClassToken + TraitToken + InterfaceToken + ExtendsToken + ImplementsToken + DoubleArrowToken + ListToken + ArrayToken + CallableToken + StartHeredocToken + DollarOpenCurlyBracesToken + CurlyOpenToken + PaamayimNekudotayimToken + NamespaceToken + NsSeparatorToken + EllipsisToken + EvalToken + RequireToken + RequireOnceToken + LogicalOrToken + LogicalXorToken + LogicalAndToken + InstanceofToken + NewToken + CloneToken + ElseifToken + ElseToken + EndifToken + PrintToken + YieldToken + StaticToken + AbstractToken + FinalToken + PrivateToken + ProtectedToken + PublicToken + IncToken + DecToken + YieldFromToken + ObjectOperatorToken + IntCastToken + DoubleCastToken + StringCastToken + ArrayCastToken + ObjectCastToken + BoolCastToken + UnsetCastToken + CoalesceToken + SpaceshipToken + PlusEqualToken + MinusEqualToken + MulEqualToken + PowEqualToken + DivEqualToken + ConcatEqualToken + ModEqualToken + AndEqualToken + OrEqualToken + XorEqualToken + SlEqualToken + SrEqualToken + BooleanOrToken + BooleanAndToken + PowToken + SlToken + SrToken + IsIdenticalToken + IsNotIdenticalToken + IsEqualToken + IsNotEqualToken + IsSmallerOrEqualToken + IsGreaterOrEqualToken + HaltCompilerToken + IdentifierToken + CaseSeparatorToken // ';' or ':' + DoubleQuoteToken // '"' + BackquoteToken // '`' + OpenCurlyBracesToken // '{' + CloseCurlyBracesToken // '}' + SemiColonToken // ';' + ColonToken // ':' + OpenParenthesisToken // '(' + CloseParenthesisToken // ')' + OpenSquareBracket // '[' + CloseSquareBracket // ']' + QuestionMarkToken // '?' + AmpersandToken // '&' + MinusToken // '-' + PlusToken // '+' + ExclamationMarkToken // '!' + TildeToken // '~' + AtToken // '@' + DollarToken // '$' + CommaToken // ',' + VerticalBarToken // '|' + EqualToken // '=' + CaretToken // '^' + AsteriskToken // '*' + SlashToken // '/' + PercentToken // '%' + LessToken // '<' + GreaterToken // '>' + DotToken // '.' +) diff --git a/meta/tokenName_string.go b/meta/tokenName_string.go new file mode 100644 index 0000000..a906696 --- /dev/null +++ b/meta/tokenName_string.go @@ -0,0 +1,16 @@ +// Code generated by "stringer -type=TokenName -output ./tokenName_string.go"; DO NOT EDIT. + +package meta + +import "strconv" + +const _TokenName_name = "UnknownTokenNodeStartNodeEndMagicConstantTokenIncludeTokenIncludeOnceTokenExitTokenIfTokenLnumberTokenDnumberTokenStringTokenStringVarnameTokenVariableTokenNumStringTokenInlineHTMLTokenEncapsedAndWhitespaceTokenConstantEncapsedStringTokenEchoTokenDoTokenWhileTokenEndwhileTokenForInitSemicolonTokenForCondSemicolonTokenForTokenEndforTokenForeachTokenEndforeachTokenDeclareTokenEnddeclareTokenAsTokenSwitchTokenSwitchSemicolonTokenEndswitchTokenCaseTokenDefaultTokenBreakTokenContinueTokenGotoTokenFunctionTokenConstTokenReturnTokenTryTokenCatchTokenFinallyTokenThrowTokenUseTokenInsteadofTokenGlobalTokenVarTokenUnsetTokenIssetTokenEmptyTokenClassTokenTraitTokenInterfaceTokenExtendsTokenImplementsTokenDoubleArrowTokenListTokenArrayTokenCallableTokenStartHeredocTokenDollarOpenCurlyBracesTokenCurlyOpenTokenPaamayimNekudotayimTokenNamespaceTokenNsSeparatorTokenEllipsisTokenEvalTokenRequireTokenRequireOnceTokenLogicalOrTokenLogicalXorTokenLogicalAndTokenInstanceofTokenNewTokenCloneTokenElseifTokenElseTokenEndifTokenPrintTokenYieldTokenStaticTokenAbstractTokenFinalTokenPrivateTokenProtectedTokenPublicTokenIncTokenDecTokenYieldFromTokenObjectOperatorTokenIntCastTokenDoubleCastTokenStringCastTokenArrayCastTokenObjectCastTokenBoolCastTokenUnsetCastTokenCoalesceTokenSpaceshipTokenPlusEqualTokenMinusEqualTokenMulEqualTokenPowEqualTokenDivEqualTokenConcatEqualTokenModEqualTokenAndEqualTokenOrEqualTokenXorEqualTokenSlEqualTokenSrEqualTokenBooleanOrTokenBooleanAndTokenPowTokenSlTokenSrTokenIsIdenticalTokenIsNotIdenticalTokenIsEqualTokenIsNotEqualTokenIsSmallerOrEqualTokenIsGreaterOrEqualTokenHaltCompilerTokenIdentifierTokenCaseSeparatorTokenDoubleQuoteTokenBackquoteTokenOpenCurlyBracesTokenCloseCurlyBracesTokenSemiColonTokenColonTokenOpenParenthesisTokenCloseParenthesisTokenOpenSquareBracketCloseSquareBracketQuestionMarkTokenAmpersandTokenMinusTokenPlusTokenExclamationMarkTokenTildeTokenAtTokenDollarTokenCommaTokenVerticalBarTokenEqualTokenCaretTokenAsteriskTokenSlashTokenPercentTokenLessTokenGreaterTokenDotToken" + +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, 430, 444, 453, 465, 475, 488, 497, 510, 520, 531, 539, 549, 561, 571, 579, 593, 604, 612, 622, 632, 642, 652, 662, 676, 688, 703, 719, 728, 738, 751, 768, 794, 808, 832, 846, 862, 875, 884, 896, 912, 926, 941, 956, 971, 979, 989, 1000, 1009, 1019, 1029, 1039, 1050, 1063, 1073, 1085, 1099, 1110, 1118, 1126, 1140, 1159, 1171, 1186, 1201, 1215, 1230, 1243, 1257, 1270, 1284, 1298, 1313, 1326, 1339, 1352, 1368, 1381, 1394, 1406, 1419, 1431, 1443, 1457, 1472, 1480, 1487, 1494, 1510, 1529, 1541, 1556, 1577, 1598, 1615, 1630, 1648, 1664, 1678, 1698, 1719, 1733, 1743, 1763, 1784, 1801, 1819, 1836, 1850, 1860, 1869, 1889, 1899, 1906, 1917, 1927, 1943, 1953, 1963, 1976, 1986, 1998, 2007, 2019, 2027} + +func (i TokenName) String() string { + if i < 0 || i >= TokenName(len(_TokenName_index)-1) { + return "TokenName(" + strconv.FormatInt(int64(i), 10) + ")" + } + return _TokenName_name[_TokenName_index[i]:_TokenName_index[i+1]] +} diff --git a/meta/tokenName_test.go b/meta/tokenName_test.go new file mode 100644 index 0000000..ab3c706 --- /dev/null +++ b/meta/tokenName_test.go @@ -0,0 +1,29 @@ +package meta_test + +import ( + "testing" + + "github.com/z7zmey/php-parser/meta" +) + +func TestTokenNameString(t *testing.T) { + c := meta.NsSeparatorToken + + expected := "NsSeparatorToken" + actual := c.String() + + if expected != actual { + t.Errorf("\nexpected: %s\ngot: %s\n", expected, actual) + } +} + +func TestWrongTokenNameString(t *testing.T) { + c := meta.TokenName(-1) + + expected := "TokenName(-1)" + actual := c.String() + + if expected != actual { + t.Errorf("\nexpected: %s\ngot: %s\n", expected, actual) + } +} diff --git a/meta/tokenNames.go b/meta/tokenNames.go deleted file mode 100644 index 87ab28f..0000000 --- a/meta/tokenNames.go +++ /dev/null @@ -1,328 +0,0 @@ -package meta - -// TokenName is used to specify a comment position -type TokenName int - -const ( - UnknownToken TokenName = iota - IncludeToken - IncludeOnceToken - ExitToken - IfToken - LnumberToken - DnumberToken - StringToken - StringVarnameToken - VariableToken - NumStringToken - InlineHTMLToken - EncapsedAndWhitespaceToken - ConstantEncapsedStringToken - EchoToken - DoToken - WhileToken - EndwhileToken - ForInitSemicolonToken - ForCondSemicolonToken - ForToken - EndforToken - ForeachToken - EndforeachToken - DeclareToken - EnddeclareToken - AsToken - SwitchToken - EndswitchToken - CaseToken - DefaultToken - BreakToken - ContinueToken - GotoToken - FunctionToken - ConstToken - ReturnToken - TryToken - CatchToken - FinallyToken - ThrowToken - UseToken - InsteadofToken - GlobalToken - VarToken - UnsetToken - IssetToken - EmptyToken - ClassToken - TraitToken - InterfaceToken - ExtendsToken - ImplementsToken - DoubleArrowToken - ListToken - ArrayToken - CallableToken - ClassCToken - TraitCToken - MethodCToken - FuncCToken - LineToken - FileToken - StartHeredocToken - DollarOpenCurlyBracesToken - CurlyOpenToken - PaamayimNekudotayimToken - NamespaceToken - NsCToken - DirToken - NsSeparatorToken - EllipsisToken - EvalToken - RequireToken - RequireOnceToken - LogicalOrToken - LogicalXorToken - LogicalAndToken - InstanceofToken - NewToken - CloneToken - ElseifToken - ElseToken - EndifToken - PrintToken - YieldToken - StaticToken - AbstractToken - FinalToken - PrivateToken - ProtectedToken - PublicToken - IncToken - DecToken - YieldFromToken - ObjectOperatorToken - IntCastToken - DoubleCastToken - StringCastToken - ArrayCastToken - ObjectCastToken - BoolCastToken - UnsetCastToken - CoalesceToken - SpaceshipToken - PlusEqualToken - MinusEqualToken - MulEqualToken - PowEqualToken - DivEqualToken - ConcatEqualToken - ModEqualToken - AndEqualToken - OrEqualToken - XorEqualToken - SlEqualToken - SrEqualToken - BooleanOrToken - BooleanAndToken - PowToken - SlToken - SrToken - IsIdenticalToken - IsNotIdenticalToken - IsEqualToken - IsNotEqualToken - IsSmallerOrEqualToken - IsGreaterOrEqualToken - HaltCompilerToken - IdentifierToken - CaseSeparatorToken // ';' or ':' - DoubleQuoteToken // '"' - BackquoteToken // '`' - OpenCurlyBracesToken // '{' - CloseCurlyBracesToken // '}' - SemiColonToken // ';' - ColonToken // ':' - OpenParenthesisToken // '(' - CloseParenthesisToken // ')' - OpenSquareBracket // '[' - CloseSquareBracket // ']' - QuestionMarkToken // '?' - AmpersandToken // '&' - MinusToken // '-' - PlusToken // '+' - ExclamationMarkToken // '!' - TildeToken // '~' - AtToken // '@' - DollarToken // '$' - CommaToken // ',' - VerticalBarToken // '|' - EqualToken // '=' - CaretToken // '^' - AsteriskToken // '*' - SlashToken // '/' - PercentToken // '%' - LessToken // '<' - GreaterToken // '>' - DotToken // '.' -) - -var TokenNames = map[TokenName]string{ - UnknownToken: "UnknownToken", - IncludeToken: "IncludeToken", - IncludeOnceToken: "IncludeOnceToken", - ExitToken: "ExitToken", - IfToken: "IfToken", - LnumberToken: "LnumberToken", - DnumberToken: "DnumberToken", - StringToken: "StringToken", - StringVarnameToken: "StringVarnameToken", - VariableToken: "VariableToken", - NumStringToken: "NumStringToken", - InlineHTMLToken: "InlineHTMLToken", - EncapsedAndWhitespaceToken: "EncapsedAndWhitespaceToken", - ConstantEncapsedStringToken: "ConstantEncapsedStringToken", - EchoToken: "EchoToken", - DoToken: "DoToken", - WhileToken: "WhileToken", - EndwhileToken: "EndwhileToken", - ForInitSemicolonToken: "ForInitSemicolonToken", - ForCondSemicolonToken: "ForCondSemicolonToken", - ForToken: "ForToken", - EndforToken: "EndforToken", - ForeachToken: "ForeachToken", - EndforeachToken: "EndforeachToken", - DeclareToken: "DeclareToken", - EnddeclareToken: "EnddeclareToken", - AsToken: "AsToken", - SwitchToken: "SwitchToken", - EndswitchToken: "EndswitchToken", - CaseToken: "CaseToken", - DefaultToken: "DefaultToken", - BreakToken: "BreakToken", - ContinueToken: "ContinueToken", - GotoToken: "GotoToken", - FunctionToken: "FunctionToken", - ConstToken: "ConstToken", - ReturnToken: "ReturnToken", - TryToken: "TryToken", - CatchToken: "CatchToken", - FinallyToken: "FinallyToken", - ThrowToken: "ThrowToken", - UseToken: "UseToken", - InsteadofToken: "InsteadofToken", - GlobalToken: "GlobalToken", - VarToken: "VarToken", - UnsetToken: "UnsetToken", - IssetToken: "IssetToken", - EmptyToken: "EmptyToken", - ClassToken: "ClassToken", - TraitToken: "TraitToken", - InterfaceToken: "InterfaceToken", - ExtendsToken: "ExtendsToken", - ImplementsToken: "ImplementsToken", - DoubleArrowToken: "DoubleArrowToken", - ListToken: "ListToken", - ArrayToken: "ArrayToken", - CallableToken: "CallableToken", - ClassCToken: "ClassCToken", - TraitCToken: "TraitCToken", - MethodCToken: "MethodCToken", - FuncCToken: "FuncCToken", - LineToken: "LineToken", - FileToken: "FileToken", - StartHeredocToken: "StartHeredocToken", - DollarOpenCurlyBracesToken: "DollarOpenCurlyBracesToken", - CurlyOpenToken: "CurlyOpenToken", - PaamayimNekudotayimToken: "PaamayimNekudotayimToken", - NamespaceToken: "NamespaceToken", - NsCToken: "NsCToken", - DirToken: "DirToken", - NsSeparatorToken: "NsSeparatorToken", - EllipsisToken: "EllipsisToken", - EvalToken: "EvalToken", - RequireToken: "RequireToken", - RequireOnceToken: "RequireOnceToken", - LogicalOrToken: "LogicalOrToken", - LogicalXorToken: "LogicalXorToken", - LogicalAndToken: "LogicalAndToken", - InstanceofToken: "InstanceofToken", - NewToken: "NewToken", - CloneToken: "CloneToken", - ElseifToken: "ElseifToken", - ElseToken: "ElseToken", - EndifToken: "EndifToken", - PrintToken: "PrintToken", - YieldToken: "YieldToken", - StaticToken: "StaticToken", - AbstractToken: "AbstractToken", - FinalToken: "FinalToken", - PrivateToken: "PrivateToken", - ProtectedToken: "ProtectedToken", - PublicToken: "PublicToken", - IncToken: "IncToken", - DecToken: "DecToken", - YieldFromToken: "YieldFromToken", - ObjectOperatorToken: "ObjectOperatorToken", - IntCastToken: "IntCastToken", - DoubleCastToken: "DoubleCastToken", - StringCastToken: "StringCastToken", - ArrayCastToken: "ArrayCastToken", - ObjectCastToken: "ObjectCastToken", - BoolCastToken: "BoolCastToken", - UnsetCastToken: "UnsetCastToken", - CoalesceToken: "CoalesceToken", - SpaceshipToken: "SpaceshipToken", - PlusEqualToken: "PlusEqualToken", - MinusEqualToken: "MinusEqualToken", - MulEqualToken: "MulEqualToken", - PowEqualToken: "PowEqualToken", - DivEqualToken: "DivEqualToken", - ConcatEqualToken: "ConcatEqualToken", - ModEqualToken: "ModEqualToken", - AndEqualToken: "AndEqualToken", - OrEqualToken: "OrEqualToken", - XorEqualToken: "XorEqualToken", - SlEqualToken: "SlEqualToken", - SrEqualToken: "SrEqualToken", - BooleanOrToken: "BooleanOrToken", - BooleanAndToken: "BooleanAndToken", - PowToken: "PowToken", - SlToken: "SlToken", - SrToken: "SrToken", - IsIdenticalToken: "IsIdenticalToken", - IsNotIdenticalToken: "IsNotIdenticalToken", - IsEqualToken: "IsEqualToken", - IsNotEqualToken: "IsNotEqualToken", - IsSmallerOrEqualToken: "IsSmallerOrEqualToken", - IsGreaterOrEqualToken: "IsGreaterOrEqualToken", - HaltCompilerToken: "HaltCompilerToken", - IdentifierToken: "IdentifierToken", - CaseSeparatorToken: "CaseSeparatorToken", - DoubleQuoteToken: "DoubleQuoteToken", - BackquoteToken: "BackquoteToken", - OpenCurlyBracesToken: "OpenCurlyBracesToken", - CloseCurlyBracesToken: "CloseCurlyBracesToken", - SemiColonToken: "SemiColonToken", - ColonToken: "ColonToken", - OpenParenthesisToken: "OpenParenthesisToken", - CloseParenthesisToken: "CloseParenthesisToken", - OpenSquareBracket: "OpenSquareBracket", - CloseSquareBracket: "CloseSquareBracket", - QuestionMarkToken: "QuestionMarkToken", - AmpersandToken: "AmpersandToken", - MinusToken: "MinusToken", - PlusToken: "PlusToken", - ExclamationMarkToken: "ExclamationMarkToken", - TildeToken: "TildeToken", - AtToken: "AtToken", - DollarToken: "DollarToken", - CommaToken: "CommaToken", - VerticalBarToken: "VerticalBarToken", - EqualToken: "EqualToken", - CaretToken: "CaretToken", - AsteriskToken: "AsteriskToken", - SlashToken: "SlashToken", - PercentToken: "PercentToken", - LessToken: "LessToken", - GreaterToken: "GreaterToken", - DotToken: "DotToken", -} diff --git a/node/stmt/n_trait_use.go b/node/stmt/n_trait_use.go index 18316df..b8c454f 100644 --- a/node/stmt/n_trait_use.go +++ b/node/stmt/n_trait_use.go @@ -12,11 +12,11 @@ type TraitUse struct { Meta []meta.Meta Position *position.Position Traits []node.Node - TraitAdaptationList *TraitAdaptationList + TraitAdaptationList node.Node } // NewTraitUse node constructor -func NewTraitUse(Traits []node.Node, InnerAdaptationList *TraitAdaptationList) *TraitUse { +func NewTraitUse(Traits []node.Node, InnerAdaptationList node.Node) *TraitUse { return &TraitUse{ Traits: Traits, TraitAdaptationList: InnerAdaptationList, diff --git a/node/stmt/t_trait_use_test.go b/node/stmt/t_trait_use_test.go index 6fc5cf0..c3ea79b 100644 --- a/node/stmt/t_trait_use_test.go +++ b/node/stmt/t_trait_use_test.go @@ -70,6 +70,14 @@ func TestTraitUse(t *testing.T) { }, }, }, + TraitAdaptationList: &stmt.Nop{ + Position: &position.Position{ + StartLine: 1, + EndLine: 1, + StartPos: 23, + EndPos: 23, + }, + }, }, }, }, @@ -163,6 +171,14 @@ func TestTraitsUse(t *testing.T) { }, }, }, + TraitAdaptationList: &stmt.Nop{ + Position: &position.Position{ + StartLine: 1, + EndLine: 1, + StartPos: 28, + EndPos: 28, + }, + }, }, }, }, diff --git a/php5/php5.go b/php5/php5.go index 7b87967..5267eee 100644 --- a/php5/php5.go +++ b/php5/php5.go @@ -346,7 +346,7 @@ const yyEofCode = 1 const yyErrCode = 2 const yyInitialStackSize = 16 -//line php5/php5.y:6789 +//line php5/php5.y:6798 type simpleIndirectReference struct { all []*expr.Variable last *expr.Variable @@ -2331,10 +2331,14 @@ yydefault: yylex.(*Parser).rootNode.SetPosition(yylex.(*Parser).positionBuilder.NewNodeListPosition(yyDollar[1].list)) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) + + if yylex.(*Parser).currentToken.Value == "\xff" { + addMeta(yylex.(*Parser).rootNode, yylex.(*Parser).currentToken.Meta, meta.NodeEnd) + } } case 2: yyDollar = yyS[yypt-2 : yypt+1] - //line php5/php5.y:291 + //line php5/php5.y:295 { if yyDollar[2].node != nil { yyVAL.list = append(yyDollar[1].list, yyDollar[2].node) @@ -2344,7 +2348,7 @@ yydefault: } case 3: yyDollar = yyS[yypt-0 : yypt+1] - //line php5/php5.y:299 + //line php5/php5.y:303 { yyVAL.list = []node.Node{} @@ -2352,7 +2356,7 @@ yydefault: } case 4: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:308 + //line php5/php5.y:312 { namePart := name.NewNamePart(yyDollar[1].token.Value) yyVAL.list = []node.Node{namePart} @@ -2367,7 +2371,7 @@ yydefault: } case 5: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:321 + //line php5/php5.y:325 { namePart := name.NewNamePart(yyDollar[3].token.Value) yyVAL.list = append(yyDollar[1].list, namePart) @@ -2383,7 +2387,7 @@ yydefault: } case 6: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:338 + //line php5/php5.y:342 { // error yyVAL.node = nil @@ -2392,7 +2396,7 @@ yydefault: } case 7: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:345 + //line php5/php5.y:349 { yyVAL.node = yyDollar[1].node @@ -2400,7 +2404,7 @@ yydefault: } case 8: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:351 + //line php5/php5.y:355 { yyVAL.node = yyDollar[1].node @@ -2408,7 +2412,7 @@ yydefault: } case 9: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:357 + //line php5/php5.y:361 { yyVAL.node = yyDollar[1].node @@ -2416,7 +2420,7 @@ yydefault: } case 10: yyDollar = yyS[yypt-4 : yypt+1] - //line php5/php5.y:363 + //line php5/php5.y:367 { yyVAL.node = stmt.NewHaltCompiler() @@ -2433,7 +2437,7 @@ yydefault: } case 11: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:378 + //line php5/php5.y:382 { name := name.NewName(yyDollar[2].list) yyVAL.node = stmt.NewNamespace(name, nil) @@ -2450,7 +2454,7 @@ yydefault: } case 12: yyDollar = yyS[yypt-5 : yypt+1] - //line php5/php5.y:393 + //line php5/php5.y:397 { name := name.NewName(yyDollar[2].list) yyVAL.node = stmt.NewNamespace(name, yyDollar[4].list) @@ -2468,7 +2472,7 @@ yydefault: } case 13: yyDollar = yyS[yypt-4 : yypt+1] - //line php5/php5.y:409 + //line php5/php5.y:413 { yyVAL.node = stmt.NewNamespace(nil, yyDollar[3].list) @@ -2484,7 +2488,7 @@ yydefault: } case 14: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:423 + //line php5/php5.y:427 { yyVAL.node = stmt.NewUseList(nil, yyDollar[2].list) @@ -2499,7 +2503,7 @@ yydefault: } case 15: yyDollar = yyS[yypt-4 : yypt+1] - //line php5/php5.y:436 + //line php5/php5.y:440 { useType := node.NewIdentifier(yyDollar[2].token.Value) yyVAL.node = stmt.NewUseList(useType, yyDollar[3].list) @@ -2510,14 +2514,14 @@ yydefault: // save comments addMeta(yyVAL.node, yyDollar[1].token.Meta, meta.UseToken) - addMeta(useType, yyDollar[2].token.Meta, meta.UseToken) + addMeta(useType, yyDollar[2].token.Meta, meta.IdentifierToken) addMeta(yyVAL.node, yyDollar[4].token.Meta, meta.SemiColonToken) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } case 16: yyDollar = yyS[yypt-4 : yypt+1] - //line php5/php5.y:452 + //line php5/php5.y:456 { useType := node.NewIdentifier(yyDollar[2].token.Value) yyVAL.node = stmt.NewUseList(useType, yyDollar[3].list) @@ -2528,14 +2532,14 @@ yydefault: // save comments addMeta(yyVAL.node, yyDollar[1].token.Meta, meta.UseToken) - addMeta(useType, yyDollar[2].token.Meta, meta.UseToken) + addMeta(useType, yyDollar[2].token.Meta, meta.IdentifierToken) addMeta(yyVAL.node, yyDollar[4].token.Meta, meta.SemiColonToken) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } case 17: yyDollar = yyS[yypt-2 : yypt+1] - //line php5/php5.y:468 + //line php5/php5.y:472 { yyVAL.node = yyDollar[1].node @@ -2549,18 +2553,18 @@ yydefault: } case 18: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:483 + //line php5/php5.y:487 { yyVAL.list = append(yyDollar[1].list, yyDollar[3].node) // save comments - addMeta(lastNode(yyDollar[1].list), yyDollar[2].token.Meta, meta.CommaToken) + addMeta(lastNode(yyDollar[1].list), yyDollar[2].token.Meta, meta.NodeEnd) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } case 19: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:492 + //line php5/php5.y:496 { yyVAL.list = []node.Node{yyDollar[1].node} @@ -2568,7 +2572,7 @@ yydefault: } case 20: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:501 + //line php5/php5.y:505 { name := name.NewName(yyDollar[1].list) yyVAL.node = stmt.NewUse(nil, name, nil) @@ -2581,7 +2585,7 @@ yydefault: } case 21: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:512 + //line php5/php5.y:516 { name := name.NewName(yyDollar[1].list) alias := node.NewIdentifier(yyDollar[3].token.Value) @@ -2594,13 +2598,13 @@ yydefault: // save comments addMeta(yyVAL.node, yyDollar[2].token.Meta, meta.AsToken) - addMeta(alias, yyDollar[3].token.Meta, meta.StringToken) + addMeta(alias, yyDollar[3].token.Meta, meta.IdentifierToken) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } case 22: yyDollar = yyS[yypt-2 : yypt+1] - //line php5/php5.y:529 + //line php5/php5.y:533 { name := name.NewName(yyDollar[2].list) yyVAL.node = stmt.NewUse(nil, name, nil) @@ -2616,7 +2620,7 @@ yydefault: } case 23: yyDollar = yyS[yypt-4 : yypt+1] - //line php5/php5.y:543 + //line php5/php5.y:547 { name := name.NewName(yyDollar[2].list) alias := node.NewIdentifier(yyDollar[4].token.Value) @@ -2630,24 +2634,24 @@ yydefault: // save comments addMeta(yyVAL.node, yyDollar[1].token.Meta, meta.NsSeparatorToken) addMeta(yyVAL.node, yyDollar[3].token.Meta, meta.AsToken) - addMeta(yyVAL.node, yyDollar[4].token.Meta, meta.StringToken) + addMeta(alias, yyDollar[4].token.Meta, meta.IdentifierToken) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } case 24: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:564 + //line php5/php5.y:568 { yyVAL.list = append(yyDollar[1].list, yyDollar[3].node) // save comments - addMeta(lastNode(yyDollar[1].list), yyDollar[2].token.Meta, meta.CommaToken) + addMeta(lastNode(yyDollar[1].list), yyDollar[2].token.Meta, meta.NodeEnd) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } case 25: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:573 + //line php5/php5.y:577 { yyVAL.list = []node.Node{yyDollar[1].node} @@ -2655,7 +2659,7 @@ yydefault: } case 26: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:582 + //line php5/php5.y:586 { name := name.NewName(yyDollar[1].list) yyVAL.node = stmt.NewUse(nil, name, nil) @@ -2668,7 +2672,7 @@ yydefault: } case 27: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:593 + //line php5/php5.y:597 { name := name.NewName(yyDollar[1].list) alias := node.NewIdentifier(yyDollar[3].token.Value) @@ -2681,13 +2685,13 @@ yydefault: // save comments addMeta(yyVAL.node, yyDollar[2].token.Meta, meta.AsToken) - addMeta(alias, yyDollar[3].token.Meta, meta.StringToken) + addMeta(alias, yyDollar[3].token.Meta, meta.IdentifierToken) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } case 28: yyDollar = yyS[yypt-2 : yypt+1] - //line php5/php5.y:610 + //line php5/php5.y:614 { name := name.NewName(yyDollar[2].list) yyVAL.node = stmt.NewUse(nil, name, nil) @@ -2703,7 +2707,7 @@ yydefault: } case 29: yyDollar = yyS[yypt-4 : yypt+1] - //line php5/php5.y:624 + //line php5/php5.y:628 { name := name.NewName(yyDollar[2].list) alias := node.NewIdentifier(yyDollar[4].token.Value) @@ -2717,24 +2721,24 @@ yydefault: // save comments addMeta(yyVAL.node, yyDollar[1].token.Meta, meta.NsSeparatorToken) addMeta(yyVAL.node, yyDollar[3].token.Meta, meta.AsToken) - addMeta(yyVAL.node, yyDollar[4].token.Meta, meta.StringToken) + addMeta(alias, yyDollar[4].token.Meta, meta.IdentifierToken) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } case 30: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:645 + //line php5/php5.y:649 { yyVAL.list = append(yyDollar[1].list, yyDollar[3].node) // save comments - addMeta(lastNode(yyDollar[1].list), yyDollar[2].token.Meta, meta.CommaToken) + addMeta(lastNode(yyDollar[1].list), yyDollar[2].token.Meta, meta.NodeEnd) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } case 31: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:654 + //line php5/php5.y:658 { yyVAL.list = []node.Node{yyDollar[1].node} @@ -2742,7 +2746,7 @@ yydefault: } case 32: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:663 + //line php5/php5.y:667 { name := name.NewName(yyDollar[1].list) yyVAL.node = stmt.NewUse(nil, name, nil) @@ -2755,7 +2759,7 @@ yydefault: } case 33: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:674 + //line php5/php5.y:678 { name := name.NewName(yyDollar[1].list) alias := node.NewIdentifier(yyDollar[3].token.Value) @@ -2768,13 +2772,13 @@ yydefault: // save comments addMeta(yyVAL.node, yyDollar[2].token.Meta, meta.AsToken) - addMeta(alias, yyDollar[3].token.Meta, meta.StringToken) + addMeta(alias, yyDollar[3].token.Meta, meta.IdentifierToken) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } case 34: yyDollar = yyS[yypt-2 : yypt+1] - //line php5/php5.y:691 + //line php5/php5.y:695 { name := name.NewName(yyDollar[2].list) yyVAL.node = stmt.NewUse(nil, name, nil) @@ -2790,7 +2794,7 @@ yydefault: } case 35: yyDollar = yyS[yypt-4 : yypt+1] - //line php5/php5.y:705 + //line php5/php5.y:709 { name := name.NewName(yyDollar[2].list) alias := node.NewIdentifier(yyDollar[4].token.Value) @@ -2804,13 +2808,13 @@ yydefault: // save comments addMeta(yyVAL.node, yyDollar[1].token.Meta, meta.NsSeparatorToken) addMeta(yyVAL.node, yyDollar[3].token.Meta, meta.AsToken) - addMeta(yyVAL.node, yyDollar[4].token.Meta, meta.StringToken) + addMeta(alias, yyDollar[4].token.Meta, meta.IdentifierToken) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } case 36: yyDollar = yyS[yypt-5 : yypt+1] - //line php5/php5.y:726 + //line php5/php5.y:730 { name := node.NewIdentifier(yyDollar[3].token.Value) constant := stmt.NewConstant(name, yyDollar[5].node, "") @@ -2825,14 +2829,14 @@ yydefault: // save comments addMeta(lastNode(constList.Consts), yyDollar[2].token.Meta, meta.CommaToken) - addMeta(name, yyDollar[3].token.Meta, meta.StringToken) + addMeta(name, yyDollar[3].token.Meta, meta.IdentifierToken) addMeta(constant, yyDollar[4].token.Meta, meta.EqualToken) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } case 37: yyDollar = yyS[yypt-4 : yypt+1] - //line php5/php5.y:746 + //line php5/php5.y:750 { name := node.NewIdentifier(yyDollar[2].token.Value) constant := stmt.NewConstant(name, yyDollar[4].node, "") @@ -2846,14 +2850,14 @@ yydefault: // save comments addMeta(yyVAL.node, yyDollar[1].token.Meta, meta.ConstToken) - addMeta(name, yyDollar[2].token.Meta, meta.StringToken) + addMeta(name, yyDollar[2].token.Meta, meta.IdentifierToken) addMeta(constant, yyDollar[3].token.Meta, meta.EqualToken) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } case 38: yyDollar = yyS[yypt-2 : yypt+1] - //line php5/php5.y:768 + //line php5/php5.y:772 { if yyDollar[2].node != nil { yyVAL.list = append(yyDollar[1].list, yyDollar[2].node) @@ -2863,7 +2867,7 @@ yydefault: } case 39: yyDollar = yyS[yypt-0 : yypt+1] - //line php5/php5.y:776 + //line php5/php5.y:780 { yyVAL.list = []node.Node{} @@ -2871,7 +2875,7 @@ yydefault: } case 40: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:786 + //line php5/php5.y:790 { // error yyVAL.node = nil @@ -2880,7 +2884,7 @@ yydefault: } case 41: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:793 + //line php5/php5.y:797 { yyVAL.node = yyDollar[1].node @@ -2888,7 +2892,7 @@ yydefault: } case 42: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:799 + //line php5/php5.y:803 { yyVAL.node = yyDollar[1].node @@ -2896,7 +2900,7 @@ yydefault: } case 43: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:805 + //line php5/php5.y:809 { yyVAL.node = yyDollar[1].node @@ -2904,7 +2908,7 @@ yydefault: } case 44: yyDollar = yyS[yypt-4 : yypt+1] - //line php5/php5.y:811 + //line php5/php5.y:815 { yyVAL.node = stmt.NewHaltCompiler() @@ -2921,7 +2925,7 @@ yydefault: } case 45: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:830 + //line php5/php5.y:834 { yyVAL.node = yyDollar[1].node @@ -2929,7 +2933,7 @@ yydefault: } case 46: yyDollar = yyS[yypt-2 : yypt+1] - //line php5/php5.y:836 + //line php5/php5.y:840 { label := node.NewIdentifier(yyDollar[1].token.Value) yyVAL.node = stmt.NewLabel(label) @@ -2939,14 +2943,14 @@ yydefault: yyVAL.node.SetPosition(yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[2].token)) // save comments - addMeta(label, yyDollar[1].token.Meta, meta.StringToken) + addMeta(label, yyDollar[1].token.Meta, meta.IdentifierToken) addMeta(yyVAL.node, yyDollar[2].token.Meta, meta.ColonToken) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } case 47: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:854 + //line php5/php5.y:858 { yyVAL.node = stmt.NewStmtList(yyDollar[2].list) @@ -2961,7 +2965,7 @@ yydefault: } case 48: yyDollar = yyS[yypt-5 : yypt+1] - //line php5/php5.y:867 + //line php5/php5.y:871 { yyVAL.node = stmt.NewIf(yyDollar[2].node, yyDollar[3].node, yyDollar[4].list, yyDollar[5].node) @@ -2981,7 +2985,7 @@ yydefault: } case 49: yyDollar = yyS[yypt-8 : yypt+1] - //line php5/php5.y:885 + //line php5/php5.y:889 { stmts := stmt.NewStmtList(yyDollar[4].list) yyVAL.node = stmt.NewAltIf(yyDollar[2].node, stmts, yyDollar[5].list, yyDollar[6].node) @@ -3000,7 +3004,7 @@ yydefault: } case 50: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:902 + //line php5/php5.y:906 { switch n := yyDollar[3].node.(type) { case *stmt.While: @@ -3021,7 +3025,7 @@ yydefault: } case 51: yyDollar = yyS[yypt-5 : yypt+1] - //line php5/php5.y:921 + //line php5/php5.y:925 { yyVAL.node = stmt.NewDo(yyDollar[2].node, yyDollar[4].node) @@ -3037,7 +3041,7 @@ yydefault: } case 52: yyDollar = yyS[yypt-9 : yypt+1] - //line php5/php5.y:935 + //line php5/php5.y:939 { switch n := yyDollar[9].node.(type) { case *stmt.For: @@ -3066,7 +3070,7 @@ yydefault: } case 53: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:962 + //line php5/php5.y:966 { switch n := yyDollar[3].node.(type) { case *stmt.Switch: @@ -3089,7 +3093,7 @@ yydefault: } case 54: yyDollar = yyS[yypt-2 : yypt+1] - //line php5/php5.y:983 + //line php5/php5.y:987 { yyVAL.node = stmt.NewBreak(nil) @@ -3104,7 +3108,7 @@ yydefault: } case 55: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:996 + //line php5/php5.y:1000 { yyVAL.node = stmt.NewBreak(yyDollar[2].node) @@ -3119,7 +3123,7 @@ yydefault: } case 56: yyDollar = yyS[yypt-2 : yypt+1] - //line php5/php5.y:1009 + //line php5/php5.y:1013 { yyVAL.node = stmt.NewContinue(nil) @@ -3134,7 +3138,7 @@ yydefault: } case 57: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:1022 + //line php5/php5.y:1026 { yyVAL.node = stmt.NewContinue(yyDollar[2].node) @@ -3149,7 +3153,7 @@ yydefault: } case 58: yyDollar = yyS[yypt-2 : yypt+1] - //line php5/php5.y:1035 + //line php5/php5.y:1039 { yyVAL.node = stmt.NewReturn(nil) @@ -3164,7 +3168,7 @@ yydefault: } case 59: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:1048 + //line php5/php5.y:1052 { yyVAL.node = stmt.NewReturn(yyDollar[2].node) @@ -3179,7 +3183,7 @@ yydefault: } case 60: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:1061 + //line php5/php5.y:1065 { yyVAL.node = stmt.NewReturn(yyDollar[2].node) @@ -3194,7 +3198,7 @@ yydefault: } case 61: yyDollar = yyS[yypt-2 : yypt+1] - //line php5/php5.y:1074 + //line php5/php5.y:1078 { yyVAL.node = stmt.NewExpression(yyDollar[1].node) @@ -3208,7 +3212,7 @@ yydefault: } case 62: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:1086 + //line php5/php5.y:1090 { yyVAL.node = stmt.NewGlobal(yyDollar[2].list) @@ -3223,7 +3227,7 @@ yydefault: } case 63: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:1099 + //line php5/php5.y:1103 { yyVAL.node = stmt.NewStatic(yyDollar[2].list) @@ -3238,7 +3242,7 @@ yydefault: } case 64: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:1112 + //line php5/php5.y:1116 { yyVAL.node = stmt.NewEcho(yyDollar[2].list) @@ -3253,7 +3257,7 @@ yydefault: } case 65: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:1125 + //line php5/php5.y:1129 { yyVAL.node = stmt.NewInlineHtml(yyDollar[1].token.Value) @@ -3267,7 +3271,7 @@ yydefault: } case 66: yyDollar = yyS[yypt-2 : yypt+1] - //line php5/php5.y:1137 + //line php5/php5.y:1141 { yyVAL.node = stmt.NewExpression(yyDollar[1].node) @@ -3281,7 +3285,7 @@ yydefault: } case 67: yyDollar = yyS[yypt-5 : yypt+1] - //line php5/php5.y:1149 + //line php5/php5.y:1153 { yyVAL.node = stmt.NewUnset(yyDollar[3].list) @@ -3298,7 +3302,7 @@ yydefault: } case 68: yyDollar = yyS[yypt-8 : yypt+1] - //line php5/php5.y:1164 + //line php5/php5.y:1168 { if yyDollar[6].node == nil { switch n := yyDollar[8].node.(type) { @@ -3337,7 +3341,7 @@ yydefault: } case 69: yyDollar = yyS[yypt-8 : yypt+1] - //line php5/php5.y:1201 + //line php5/php5.y:1205 { if yyDollar[6].node == nil { switch n := yyDollar[8].node.(type) { @@ -3376,7 +3380,7 @@ yydefault: } case 70: yyDollar = yyS[yypt-5 : yypt+1] - //line php5/php5.y:1238 + //line php5/php5.y:1242 { yyVAL.node = stmt.NewDeclare(yyDollar[3].list, yyDollar[5].node) @@ -3392,7 +3396,7 @@ yydefault: } case 71: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:1252 + //line php5/php5.y:1256 { yyVAL.node = stmt.NewNop() @@ -3406,7 +3410,7 @@ yydefault: } case 72: yyDollar = yyS[yypt-6 : yypt+1] - //line php5/php5.y:1264 + //line php5/php5.y:1268 { yyVAL.node = stmt.NewTry(yyDollar[3].list, yyDollar[5].list, yyDollar[6].node) @@ -3426,7 +3430,7 @@ yydefault: } case 73: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:1282 + //line php5/php5.y:1286 { yyVAL.node = stmt.NewThrow(yyDollar[2].node) @@ -3441,7 +3445,7 @@ yydefault: } case 74: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:1295 + //line php5/php5.y:1299 { label := node.NewIdentifier(yyDollar[2].token.Value) yyVAL.node = stmt.NewGoto(label) @@ -3452,14 +3456,14 @@ yydefault: // save comments addMeta(yyVAL.node, yyDollar[1].token.Meta, meta.GotoToken) - addMeta(label, yyDollar[2].token.Meta, meta.StringToken) + addMeta(label, yyDollar[2].token.Meta, meta.IdentifierToken) addMeta(yyVAL.node, yyDollar[3].token.Meta, meta.SemiColonToken) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } case 75: yyDollar = yyS[yypt-0 : yypt+1] - //line php5/php5.y:1314 + //line php5/php5.y:1318 { yyVAL.list = []node.Node{} @@ -3467,7 +3471,7 @@ yydefault: } case 76: yyDollar = yyS[yypt-9 : yypt+1] - //line php5/php5.y:1320 + //line php5/php5.y:1324 { identifier := node.NewIdentifier(strings.TrimLeftFunc(yyDollar[4].token.Value, isDollar)) variable := expr.NewVariable(identifier) @@ -3482,7 +3486,7 @@ yydefault: // save comments addMeta(catch, yyDollar[1].token.Meta, meta.CatchToken) addMeta(catch, yyDollar[2].token.Meta, meta.OpenParenthesisToken) - addMeta(variable, yyDollar[4].token.Meta, meta.StringToken) + addMeta(variable, yyDollar[4].token.Meta, meta.VariableToken) addMeta(catch, yyDollar[5].token.Meta, meta.CloseParenthesisToken) addMeta(catch, yyDollar[6].token.Meta, meta.OpenCurlyBracesToken) addMeta(catch, yyDollar[8].token.Meta, meta.CloseCurlyBracesToken) @@ -3491,7 +3495,7 @@ yydefault: } case 77: yyDollar = yyS[yypt-0 : yypt+1] - //line php5/php5.y:1345 + //line php5/php5.y:1349 { yyVAL.node = nil @@ -3499,7 +3503,7 @@ yydefault: } case 78: yyDollar = yyS[yypt-4 : yypt+1] - //line php5/php5.y:1351 + //line php5/php5.y:1355 { yyVAL.node = stmt.NewFinally(yyDollar[3].list) @@ -3515,7 +3519,7 @@ yydefault: } case 79: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:1368 + //line php5/php5.y:1372 { yyVAL.list = yyDollar[1].list @@ -3523,7 +3527,7 @@ yydefault: } case 80: yyDollar = yyS[yypt-0 : yypt+1] - //line php5/php5.y:1374 + //line php5/php5.y:1378 { yyVAL.list = []node.Node{} @@ -3531,7 +3535,7 @@ yydefault: } case 81: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:1383 + //line php5/php5.y:1387 { yyVAL.list = []node.Node{yyDollar[1].node} @@ -3539,7 +3543,7 @@ yydefault: } case 82: yyDollar = yyS[yypt-2 : yypt+1] - //line php5/php5.y:1389 + //line php5/php5.y:1393 { yyVAL.list = append(yyDollar[1].list, yyDollar[2].node) @@ -3547,7 +3551,7 @@ yydefault: } case 83: yyDollar = yyS[yypt-8 : yypt+1] - //line php5/php5.y:1398 + //line php5/php5.y:1402 { identifier := node.NewIdentifier(strings.TrimLeftFunc(yyDollar[4].token.Value, isDollar)) variable := expr.NewVariable(identifier) @@ -3561,7 +3565,7 @@ yydefault: // save comments addMeta(yyVAL.node, yyDollar[1].token.Meta, meta.CatchToken) addMeta(yyVAL.node, yyDollar[2].token.Meta, meta.OpenParenthesisToken) - addMeta(variable, yyDollar[4].token.Meta, meta.StringToken) + addMeta(variable, yyDollar[4].token.Meta, meta.VariableToken) addMeta(yyVAL.node, yyDollar[5].token.Meta, meta.CloseParenthesisToken) addMeta(yyVAL.node, yyDollar[6].token.Meta, meta.OpenCurlyBracesToken) addMeta(yyVAL.node, yyDollar[8].token.Meta, meta.CloseCurlyBracesToken) @@ -3570,7 +3574,7 @@ yydefault: } case 84: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:1422 + //line php5/php5.y:1426 { yyVAL.list = []node.Node{yyDollar[1].node} @@ -3578,18 +3582,18 @@ yydefault: } case 85: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:1428 + //line php5/php5.y:1432 { yyVAL.list = append(yyDollar[1].list, yyDollar[3].node) // save comments - addMeta(lastNode(yyDollar[1].list), yyDollar[2].token.Meta, meta.CommaToken) + addMeta(lastNode(yyDollar[1].list), yyDollar[2].token.Meta, meta.NodeEnd) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } case 86: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:1440 + //line php5/php5.y:1444 { yyVAL.node = yyDollar[1].node @@ -3597,7 +3601,7 @@ yydefault: } case 87: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:1449 + //line php5/php5.y:1453 { yyVAL.node = yyDollar[1].node @@ -3605,7 +3609,7 @@ yydefault: } case 88: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:1458 + //line php5/php5.y:1462 { yyVAL.node = yyDollar[1].node @@ -3613,31 +3617,31 @@ yydefault: } case 89: yyDollar = yyS[yypt-0 : yypt+1] - //line php5/php5.y:1467 + //line php5/php5.y:1471 { yyVAL.token = nil } case 90: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:1471 + //line php5/php5.y:1475 { yyVAL.token = yyDollar[1].token } case 91: yyDollar = yyS[yypt-0 : yypt+1] - //line php5/php5.y:1478 + //line php5/php5.y:1482 { yyVAL.token = nil } case 92: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:1482 + //line php5/php5.y:1486 { yyVAL.token = yyDollar[1].token } case 93: yyDollar = yyS[yypt-9 : yypt+1] - //line php5/php5.y:1489 + //line php5/php5.y:1493 { name := node.NewIdentifier(yyDollar[3].token.Value) yyVAL.node = stmt.NewFunction(name, yyDollar[2].token != nil, yyDollar[5].list, nil, yyDollar[8].list, "") @@ -3651,7 +3655,7 @@ yydefault: if yyDollar[2].token != nil { addMeta(yyVAL.node, yyDollar[2].token.Meta, meta.AmpersandToken) } - addMeta(name, yyDollar[3].token.Meta, meta.StringToken) + addMeta(name, yyDollar[3].token.Meta, meta.IdentifierToken) addMeta(yyVAL.node, yyDollar[4].token.Meta, meta.OpenParenthesisToken) addMeta(yyVAL.node, yyDollar[6].token.Meta, meta.CloseParenthesisToken) addMeta(yyVAL.node, yyDollar[7].token.Meta, meta.OpenCurlyBracesToken) @@ -3661,7 +3665,7 @@ yydefault: } case 94: yyDollar = yyS[yypt-7 : yypt+1] - //line php5/php5.y:1514 + //line php5/php5.y:1518 { name := node.NewIdentifier(yyDollar[2].token.Value) switch n := yyDollar[1].node.(type) { @@ -3683,7 +3687,7 @@ yydefault: yyVAL.node.SetPosition(yylex.(*Parser).positionBuilder.NewNodeTokenPosition(yyDollar[1].node, yyDollar[7].token)) // save comments - addMeta(name, yyDollar[2].token.Meta, meta.StringToken) + addMeta(name, yyDollar[2].token.Meta, meta.IdentifierToken) addMeta(yyVAL.node, yyDollar[5].token.Meta, meta.OpenCurlyBracesToken) addMeta(yyVAL.node, yyDollar[7].token.Meta, meta.CloseCurlyBracesToken) @@ -3691,7 +3695,7 @@ yydefault: } case 95: yyDollar = yyS[yypt-6 : yypt+1] - //line php5/php5.y:1542 + //line php5/php5.y:1546 { name := node.NewIdentifier(yyDollar[2].token.Value) yyVAL.node = stmt.NewInterface(name, yyDollar[3].InterfaceExtends, yyDollar[5].list, "") @@ -3701,7 +3705,7 @@ yydefault: yyVAL.node.SetPosition(yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[6].token)) // save comments - addMeta(name, yyDollar[2].token.Meta, meta.StringToken) + addMeta(name, yyDollar[2].token.Meta, meta.IdentifierToken) addMeta(yyVAL.node, yyDollar[4].token.Meta, meta.OpenCurlyBracesToken) addMeta(yyVAL.node, yyDollar[6].token.Meta, meta.CloseCurlyBracesToken) @@ -3709,7 +3713,7 @@ yydefault: } case 96: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:1562 + //line php5/php5.y:1566 { yyVAL.node = stmt.NewClass(nil, nil, nil, nil, nil, nil, "") @@ -3723,7 +3727,7 @@ yydefault: } case 97: yyDollar = yyS[yypt-2 : yypt+1] - //line php5/php5.y:1574 + //line php5/php5.y:1578 { classModifier := node.NewIdentifier(yyDollar[1].token.Value) yyVAL.node = stmt.NewClass(nil, []node.Node{classModifier}, nil, nil, nil, nil, "") @@ -3733,14 +3737,14 @@ yydefault: yyVAL.node.SetPosition(yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[2].token)) // save comments - addMeta(classModifier, yyDollar[1].token.Meta, meta.AbstractToken) + addMeta(classModifier, yyDollar[1].token.Meta, meta.IdentifierToken) addMeta(yyVAL.node, yyDollar[2].token.Meta, meta.ClassToken) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } case 98: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:1589 + //line php5/php5.y:1593 { yyVAL.node = stmt.NewTrait(nil, nil, "") @@ -3754,7 +3758,7 @@ yydefault: } case 99: yyDollar = yyS[yypt-2 : yypt+1] - //line php5/php5.y:1601 + //line php5/php5.y:1605 { classModifier := node.NewIdentifier(yyDollar[1].token.Value) yyVAL.node = stmt.NewClass(nil, []node.Node{classModifier}, nil, nil, nil, nil, "") @@ -3764,14 +3768,14 @@ yydefault: yyVAL.node.SetPosition(yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[2].token)) // save comments - addMeta(classModifier, yyDollar[1].token.Meta, meta.FinalToken) + addMeta(classModifier, yyDollar[1].token.Meta, meta.IdentifierToken) addMeta(yyVAL.node, yyDollar[2].token.Meta, meta.ClassToken) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } case 100: yyDollar = yyS[yypt-0 : yypt+1] - //line php5/php5.y:1619 + //line php5/php5.y:1623 { yyVAL.ClassExtends = nil @@ -3779,7 +3783,7 @@ yydefault: } case 101: yyDollar = yyS[yypt-2 : yypt+1] - //line php5/php5.y:1625 + //line php5/php5.y:1629 { yyVAL.ClassExtends = stmt.NewClassExtends(yyDollar[2].node) @@ -3793,13 +3797,13 @@ yydefault: } case 102: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:1640 + //line php5/php5.y:1644 { yyVAL.token = yyDollar[1].token } case 103: yyDollar = yyS[yypt-0 : yypt+1] - //line php5/php5.y:1647 + //line php5/php5.y:1651 { yyVAL.InterfaceExtends = nil @@ -3807,7 +3811,7 @@ yydefault: } case 104: yyDollar = yyS[yypt-2 : yypt+1] - //line php5/php5.y:1653 + //line php5/php5.y:1657 { yyVAL.InterfaceExtends = stmt.NewInterfaceExtends(yyDollar[2].list) @@ -3821,7 +3825,7 @@ yydefault: } case 105: yyDollar = yyS[yypt-0 : yypt+1] - //line php5/php5.y:1668 + //line php5/php5.y:1672 { yyVAL.ClassImplements = nil @@ -3829,7 +3833,7 @@ yydefault: } case 106: yyDollar = yyS[yypt-2 : yypt+1] - //line php5/php5.y:1674 + //line php5/php5.y:1678 { yyVAL.ClassImplements = stmt.NewClassImplements(yyDollar[2].list) @@ -3843,7 +3847,7 @@ yydefault: } case 107: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:1689 + //line php5/php5.y:1693 { yyVAL.list = []node.Node{yyDollar[1].node} @@ -3851,18 +3855,18 @@ yydefault: } case 108: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:1695 + //line php5/php5.y:1699 { yyVAL.list = append(yyDollar[1].list, yyDollar[3].node) // save comments - addMeta(lastNode(yyDollar[1].list), yyDollar[2].token.Meta, meta.CommaToken) + addMeta(lastNode(yyDollar[1].list), yyDollar[2].token.Meta, meta.NodeEnd) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } case 109: yyDollar = yyS[yypt-0 : yypt+1] - //line php5/php5.y:1707 + //line php5/php5.y:1711 { yyVAL.node = nil @@ -3870,7 +3874,7 @@ yydefault: } case 110: yyDollar = yyS[yypt-2 : yypt+1] - //line php5/php5.y:1713 + //line php5/php5.y:1717 { yyVAL.node = yyDollar[2].node @@ -3881,7 +3885,7 @@ yydefault: } case 111: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:1725 + //line php5/php5.y:1729 { yyVAL.node = yyDollar[1].node @@ -3889,7 +3893,7 @@ yydefault: } case 112: yyDollar = yyS[yypt-2 : yypt+1] - //line php5/php5.y:1731 + //line php5/php5.y:1735 { yyVAL.node = expr.NewReference(yyDollar[2].node) @@ -3903,7 +3907,7 @@ yydefault: } case 113: yyDollar = yyS[yypt-4 : yypt+1] - //line php5/php5.y:1743 + //line php5/php5.y:1747 { yyVAL.node = expr.NewList(yyDollar[3].list) @@ -3919,7 +3923,7 @@ yydefault: } case 114: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:1760 + //line php5/php5.y:1764 { yyVAL.node = stmt.NewFor(nil, nil, nil, yyDollar[1].node) @@ -3930,7 +3934,7 @@ yydefault: } case 115: yyDollar = yyS[yypt-4 : yypt+1] - //line php5/php5.y:1769 + //line php5/php5.y:1773 { stmtList := stmt.NewStmtList(yyDollar[2].list) yyVAL.node = stmt.NewAltFor(nil, nil, nil, stmtList) @@ -3948,7 +3952,7 @@ yydefault: } case 116: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:1788 + //line php5/php5.y:1792 { yyVAL.node = stmt.NewForeach(nil, nil, nil, yyDollar[1].node) @@ -3959,7 +3963,7 @@ yydefault: } case 117: yyDollar = yyS[yypt-4 : yypt+1] - //line php5/php5.y:1797 + //line php5/php5.y:1801 { stmtList := stmt.NewStmtList(yyDollar[2].list) yyVAL.node = stmt.NewAltForeach(nil, nil, nil, stmtList) @@ -3977,7 +3981,7 @@ yydefault: } case 118: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:1817 + //line php5/php5.y:1821 { yyVAL.node = yyDollar[1].node @@ -3985,7 +3989,7 @@ yydefault: } case 119: yyDollar = yyS[yypt-4 : yypt+1] - //line php5/php5.y:1823 + //line php5/php5.y:1827 { yyVAL.node = stmt.NewStmtList(yyDollar[2].list) @@ -4001,7 +4005,7 @@ yydefault: } case 120: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:1841 + //line php5/php5.y:1845 { name := node.NewIdentifier(yyDollar[1].token.Value) constant := stmt.NewConstant(name, yyDollar[3].node, "") @@ -4012,14 +4016,14 @@ yydefault: constant.SetPosition(yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[3].node)) // save comments - addMeta(name, yyDollar[1].token.Meta, meta.StringToken) + addMeta(name, yyDollar[1].token.Meta, meta.IdentifierToken) addMeta(constant, yyDollar[2].token.Meta, meta.EqualToken) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } case 121: yyDollar = yyS[yypt-5 : yypt+1] - //line php5/php5.y:1857 + //line php5/php5.y:1861 { name := node.NewIdentifier(yyDollar[3].token.Value) constant := stmt.NewConstant(name, yyDollar[5].node, "") @@ -4031,14 +4035,14 @@ yydefault: // save comments addMeta(lastNode(yyDollar[1].list), yyDollar[2].token.Meta, meta.CommaToken) - addMeta(name, yyDollar[3].token.Meta, meta.StringToken) + addMeta(name, yyDollar[3].token.Meta, meta.IdentifierToken) addMeta(constant, yyDollar[4].token.Meta, meta.EqualToken) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } case 122: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:1878 + //line php5/php5.y:1882 { caseList := stmt.NewCaseList(yyDollar[2].list) yyVAL.node = stmt.NewSwitch(nil, caseList) @@ -4055,7 +4059,7 @@ yydefault: } case 123: yyDollar = yyS[yypt-4 : yypt+1] - //line php5/php5.y:1893 + //line php5/php5.y:1897 { caseList := stmt.NewCaseList(yyDollar[3].list) yyVAL.node = stmt.NewSwitch(nil, caseList) @@ -4073,7 +4077,7 @@ yydefault: } case 124: yyDollar = yyS[yypt-4 : yypt+1] - //line php5/php5.y:1909 + //line php5/php5.y:1913 { caseList := stmt.NewCaseList(yyDollar[2].list) yyVAL.node = stmt.NewAltSwitch(nil, caseList) @@ -4083,15 +4087,15 @@ yydefault: yyVAL.node.SetPosition(yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[4].token)) // save comments - addMeta(caseList, yyDollar[1].token.Meta, meta.ColonToken) - addMeta(caseList, yyDollar[3].token.Meta, meta.EndswitchToken) + addMeta(yyVAL.node, yyDollar[1].token.Meta, meta.ColonToken) + addMeta(yyVAL.node, yyDollar[3].token.Meta, meta.EndswitchToken) addMeta(yyVAL.node, yyDollar[4].token.Meta, meta.SemiColonToken) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } case 125: yyDollar = yyS[yypt-5 : yypt+1] - //line php5/php5.y:1925 + //line php5/php5.y:1929 { caseList := stmt.NewCaseList(yyDollar[3].list) @@ -4102,16 +4106,16 @@ yydefault: yyVAL.node.SetPosition(yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[5].token)) // save comments - addMeta(caseList, yyDollar[1].token.Meta, meta.ColonToken) - addMeta(caseList, yyDollar[2].token.Meta, meta.SemiColonToken) - addMeta(caseList, yyDollar[4].token.Meta, meta.EndswitchToken) + addMeta(yyVAL.node, yyDollar[1].token.Meta, meta.ColonToken) + addMeta(yyVAL.node, yyDollar[2].token.Meta, meta.SwitchSemicolonToken) + addMeta(yyVAL.node, yyDollar[4].token.Meta, meta.EndswitchToken) addMeta(yyVAL.node, yyDollar[5].token.Meta, meta.SemiColonToken) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } case 126: yyDollar = yyS[yypt-0 : yypt+1] - //line php5/php5.y:1947 + //line php5/php5.y:1951 { yyVAL.list = []node.Node{} @@ -4119,7 +4123,7 @@ yydefault: } case 127: yyDollar = yyS[yypt-5 : yypt+1] - //line php5/php5.y:1953 + //line php5/php5.y:1957 { _case := stmt.NewCase(yyDollar[3].node, yyDollar[5].list) yyVAL.list = append(yyDollar[1].list, _case) @@ -4135,7 +4139,7 @@ yydefault: } case 128: yyDollar = yyS[yypt-4 : yypt+1] - //line php5/php5.y:1967 + //line php5/php5.y:1971 { _default := stmt.NewDefault(yyDollar[4].list) yyVAL.list = append(yyDollar[1].list, _default) @@ -4151,19 +4155,19 @@ yydefault: } case 129: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:1985 + //line php5/php5.y:1989 { yyVAL.token = yyDollar[1].token } case 130: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:1989 + //line php5/php5.y:1993 { yyVAL.token = yyDollar[1].token } case 131: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:1997 + //line php5/php5.y:2001 { yyVAL.node = stmt.NewWhile(nil, yyDollar[1].node) @@ -4174,7 +4178,7 @@ yydefault: } case 132: yyDollar = yyS[yypt-4 : yypt+1] - //line php5/php5.y:2006 + //line php5/php5.y:2010 { stmtList := stmt.NewStmtList(yyDollar[2].list) yyVAL.node = stmt.NewAltWhile(nil, stmtList) @@ -4192,7 +4196,7 @@ yydefault: } case 133: yyDollar = yyS[yypt-0 : yypt+1] - //line php5/php5.y:2027 + //line php5/php5.y:2031 { yyVAL.list = nil @@ -4200,7 +4204,7 @@ yydefault: } case 134: yyDollar = yyS[yypt-4 : yypt+1] - //line php5/php5.y:2033 + //line php5/php5.y:2037 { _elseIf := stmt.NewElseIf(yyDollar[3].node, yyDollar[4].node) yyVAL.list = append(yyDollar[1].list, _elseIf) @@ -4215,7 +4219,7 @@ yydefault: } case 135: yyDollar = yyS[yypt-0 : yypt+1] - //line php5/php5.y:2050 + //line php5/php5.y:2054 { yyVAL.list = nil @@ -4223,7 +4227,7 @@ yydefault: } case 136: yyDollar = yyS[yypt-5 : yypt+1] - //line php5/php5.y:2056 + //line php5/php5.y:2060 { stmts := stmt.NewStmtList(yyDollar[5].list) _elseIf := stmt.NewAltElseIf(yyDollar[3].node, stmts) @@ -4241,7 +4245,7 @@ yydefault: } case 137: yyDollar = yyS[yypt-0 : yypt+1] - //line php5/php5.y:2076 + //line php5/php5.y:2080 { yyVAL.node = nil @@ -4249,7 +4253,7 @@ yydefault: } case 138: yyDollar = yyS[yypt-2 : yypt+1] - //line php5/php5.y:2082 + //line php5/php5.y:2086 { yyVAL.node = stmt.NewElse(yyDollar[2].node) @@ -4263,7 +4267,7 @@ yydefault: } case 139: yyDollar = yyS[yypt-0 : yypt+1] - //line php5/php5.y:2098 + //line php5/php5.y:2102 { yyVAL.node = nil @@ -4271,7 +4275,7 @@ yydefault: } case 140: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:2104 + //line php5/php5.y:2108 { stmts := stmt.NewStmtList(yyDollar[3].list) yyVAL.node = stmt.NewAltElse(stmts) @@ -4288,7 +4292,7 @@ yydefault: } case 141: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:2123 + //line php5/php5.y:2127 { yyVAL.list = yyDollar[1].list @@ -4296,7 +4300,7 @@ yydefault: } case 142: yyDollar = yyS[yypt-0 : yypt+1] - //line php5/php5.y:2129 + //line php5/php5.y:2133 { yyVAL.list = nil @@ -4304,7 +4308,7 @@ yydefault: } case 143: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:2138 + //line php5/php5.y:2142 { yyVAL.list = []node.Node{yyDollar[1].node} @@ -4312,18 +4316,18 @@ yydefault: } case 144: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:2144 + //line php5/php5.y:2148 { yyVAL.list = append(yyDollar[1].list, yyDollar[3].node) // save comments - addMeta(lastNode(yyDollar[1].list), yyDollar[2].token.Meta, meta.CommaToken) + addMeta(lastNode(yyDollar[1].list), yyDollar[2].token.Meta, meta.NodeEnd) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } case 145: yyDollar = yyS[yypt-4 : yypt+1] - //line php5/php5.y:2156 + //line php5/php5.y:2160 { identifier := node.NewIdentifier(strings.TrimLeftFunc(yyDollar[4].token.Value, isDollar)) variable := expr.NewVariable(identifier) @@ -4355,7 +4359,7 @@ yydefault: } case 146: yyDollar = yyS[yypt-6 : yypt+1] - //line php5/php5.y:2186 + //line php5/php5.y:2190 { identifier := node.NewIdentifier(strings.TrimLeftFunc(yyDollar[4].token.Value, isDollar)) variable := expr.NewVariable(identifier) @@ -4388,7 +4392,7 @@ yydefault: } case 147: yyDollar = yyS[yypt-0 : yypt+1] - //line php5/php5.y:2221 + //line php5/php5.y:2225 { yyVAL.node = nil @@ -4396,7 +4400,7 @@ yydefault: } case 148: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:2227 + //line php5/php5.y:2231 { yyVAL.node = node.NewIdentifier(yyDollar[1].token.Value) @@ -4404,13 +4408,13 @@ yydefault: yyVAL.node.SetPosition(yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token)) // save comments - addMeta(yyVAL.node, yyDollar[1].token.Meta, meta.ArrayToken) + addMeta(yyVAL.node, yyDollar[1].token.Meta, meta.IdentifierToken) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } case 149: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:2239 + //line php5/php5.y:2243 { yyVAL.node = node.NewIdentifier(yyDollar[1].token.Value) @@ -4418,13 +4422,13 @@ yydefault: yyVAL.node.SetPosition(yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token)) // save comments - addMeta(yyVAL.node, yyDollar[1].token.Meta, meta.CallableToken) + addMeta(yyVAL.node, yyDollar[1].token.Meta, meta.IdentifierToken) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } case 150: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:2251 + //line php5/php5.y:2255 { yyVAL.node = yyDollar[1].node @@ -4432,7 +4436,7 @@ yydefault: } case 151: yyDollar = yyS[yypt-2 : yypt+1] - //line php5/php5.y:2261 + //line php5/php5.y:2265 { yyVAL.node = node.NewArgumentList(nil) @@ -4447,7 +4451,7 @@ yydefault: } case 152: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:2274 + //line php5/php5.y:2278 { yyVAL.node = node.NewArgumentList(yyDollar[2].list) @@ -4462,7 +4466,7 @@ yydefault: } case 153: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:2287 + //line php5/php5.y:2291 { arg := node.NewArgument(yyDollar[2].node, false, false) yyVAL.node = node.NewArgumentList([]node.Node{arg}) @@ -4479,7 +4483,7 @@ yydefault: } case 154: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:2306 + //line php5/php5.y:2310 { yyVAL.list = []node.Node{yyDollar[1].node} @@ -4487,18 +4491,18 @@ yydefault: } case 155: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:2312 + //line php5/php5.y:2316 { yyVAL.list = append(yyDollar[1].list, yyDollar[3].node) // save comments - addMeta(lastNode(yyDollar[1].list), yyDollar[2].token.Meta, meta.CommaToken) + addMeta(lastNode(yyDollar[1].list), yyDollar[2].token.Meta, meta.NodeEnd) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } case 156: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:2324 + //line php5/php5.y:2328 { yyVAL.node = node.NewArgument(yyDollar[1].node, false, false) @@ -4509,7 +4513,7 @@ yydefault: } case 157: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:2333 + //line php5/php5.y:2337 { yyVAL.node = node.NewArgument(yyDollar[1].node, false, false) @@ -4520,7 +4524,7 @@ yydefault: } case 158: yyDollar = yyS[yypt-2 : yypt+1] - //line php5/php5.y:2342 + //line php5/php5.y:2346 { yyVAL.node = node.NewArgument(yyDollar[2].node, false, true) @@ -4534,7 +4538,7 @@ yydefault: } case 159: yyDollar = yyS[yypt-2 : yypt+1] - //line php5/php5.y:2354 + //line php5/php5.y:2358 { yyVAL.node = node.NewArgument(yyDollar[2].node, true, false) @@ -4548,18 +4552,18 @@ yydefault: } case 160: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:2369 + //line php5/php5.y:2373 { yyVAL.list = append(yyDollar[1].list, yyDollar[3].node) // save comments - addMeta(lastNode(yyDollar[1].list), yyDollar[2].token.Meta, meta.CommaToken) + addMeta(lastNode(yyDollar[1].list), yyDollar[2].token.Meta, meta.NodeEnd) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } case 161: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:2378 + //line php5/php5.y:2382 { yyVAL.list = []node.Node{yyDollar[1].node} @@ -4567,7 +4571,7 @@ yydefault: } case 162: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:2388 + //line php5/php5.y:2392 { name := node.NewIdentifier(strings.TrimLeftFunc(yyDollar[1].token.Value, isDollar)) yyVAL.node = expr.NewVariable(name) @@ -4583,7 +4587,7 @@ yydefault: } case 163: yyDollar = yyS[yypt-2 : yypt+1] - //line php5/php5.y:2402 + //line php5/php5.y:2406 { yyVAL.node = expr.NewVariable(yyDollar[2].node) @@ -4597,7 +4601,7 @@ yydefault: } case 164: yyDollar = yyS[yypt-4 : yypt+1] - //line php5/php5.y:2414 + //line php5/php5.y:2418 { yyVAL.node = expr.NewVariable(yyDollar[3].node) @@ -4613,7 +4617,7 @@ yydefault: } case 165: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:2432 + //line php5/php5.y:2436 { identifier := node.NewIdentifier(strings.TrimLeftFunc(yyDollar[3].token.Value, isDollar)) variable := expr.NewVariable(identifier) @@ -4633,7 +4637,7 @@ yydefault: } case 166: yyDollar = yyS[yypt-5 : yypt+1] - //line php5/php5.y:2450 + //line php5/php5.y:2454 { identifier := node.NewIdentifier(strings.TrimLeftFunc(yyDollar[3].token.Value, isDollar)) variable := expr.NewVariable(identifier) @@ -4654,7 +4658,7 @@ yydefault: } case 167: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:2469 + //line php5/php5.y:2473 { identifier := node.NewIdentifier(strings.TrimLeftFunc(yyDollar[1].token.Value, isDollar)) variable := expr.NewVariable(identifier) @@ -4673,7 +4677,7 @@ yydefault: } case 168: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:2486 + //line php5/php5.y:2490 { identifier := node.NewIdentifier(strings.TrimLeftFunc(yyDollar[1].token.Value, isDollar)) variable := expr.NewVariable(identifier) @@ -4693,7 +4697,7 @@ yydefault: } case 169: yyDollar = yyS[yypt-2 : yypt+1] - //line php5/php5.y:2508 + //line php5/php5.y:2512 { yyVAL.list = append(yyDollar[1].list, yyDollar[2].node) @@ -4701,7 +4705,7 @@ yydefault: } case 170: yyDollar = yyS[yypt-0 : yypt+1] - //line php5/php5.y:2514 + //line php5/php5.y:2518 { yyVAL.list = []node.Node{} @@ -4709,7 +4713,7 @@ yydefault: } case 171: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:2524 + //line php5/php5.y:2528 { yyVAL.node = stmt.NewPropertyList(yyDollar[1].list, yyDollar[2].list) @@ -4723,7 +4727,7 @@ yydefault: } case 172: yyDollar = yyS[yypt-2 : yypt+1] - //line php5/php5.y:2536 + //line php5/php5.y:2540 { yyVAL.node = yyDollar[1].node @@ -4737,7 +4741,7 @@ yydefault: } case 173: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:2548 + //line php5/php5.y:2552 { yyVAL.node = yyDollar[1].node @@ -4745,7 +4749,7 @@ yydefault: } case 174: yyDollar = yyS[yypt-8 : yypt+1] - //line php5/php5.y:2554 + //line php5/php5.y:2558 { name := node.NewIdentifier(yyDollar[4].token.Value) yyVAL.node = stmt.NewClassMethod(name, yyDollar[1].list, yyDollar[3].token != nil, yyDollar[6].list, nil, yyDollar[8].node, "") @@ -4771,16 +4775,9 @@ yydefault: } case 175: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:2581 + //line php5/php5.y:2585 { - var adaptationList *stmt.TraitAdaptationList - switch n := yyDollar[3].node.(type) { - case *stmt.TraitAdaptationList: - adaptationList = n - default: - adaptationList = nil - } - yyVAL.node = stmt.NewTraitUse(yyDollar[2].list, adaptationList) + yyVAL.node = stmt.NewTraitUse(yyDollar[2].list, yyDollar[3].node) // save position yyVAL.node.SetPosition(yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[3].node)) @@ -4792,7 +4789,7 @@ yydefault: } case 176: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:2603 + //line php5/php5.y:2600 { yyVAL.list = []node.Node{yyDollar[1].node} @@ -4800,18 +4797,18 @@ yydefault: } case 177: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:2609 + //line php5/php5.y:2606 { yyVAL.list = append(yyDollar[1].list, yyDollar[3].node) // save comments - addMeta(lastNode(yyDollar[1].list), yyDollar[2].token.Meta, meta.CommaToken) + addMeta(lastNode(yyDollar[1].list), yyDollar[2].token.Meta, meta.NodeEnd) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } case 178: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:2621 + //line php5/php5.y:2618 { yyVAL.node = stmt.NewNop() @@ -4824,7 +4821,7 @@ yydefault: } case 179: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:2633 + //line php5/php5.y:2630 { yyVAL.node = stmt.NewTraitAdaptationList(yyDollar[2].list) @@ -4838,7 +4835,7 @@ yydefault: } case 180: yyDollar = yyS[yypt-0 : yypt+1] - //line php5/php5.y:2648 + //line php5/php5.y:2645 { yyVAL.list = nil @@ -4846,7 +4843,7 @@ yydefault: } case 181: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:2654 + //line php5/php5.y:2651 { yyVAL.list = yyDollar[1].list @@ -4854,7 +4851,7 @@ yydefault: } case 182: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:2663 + //line php5/php5.y:2660 { yyVAL.list = []node.Node{yyDollar[1].node} @@ -4862,7 +4859,7 @@ yydefault: } case 183: yyDollar = yyS[yypt-2 : yypt+1] - //line php5/php5.y:2669 + //line php5/php5.y:2666 { yyVAL.list = append(yyDollar[1].list, yyDollar[2].node) @@ -4870,7 +4867,7 @@ yydefault: } case 184: yyDollar = yyS[yypt-2 : yypt+1] - //line php5/php5.y:2678 + //line php5/php5.y:2675 { yyVAL.node = yyDollar[1].node @@ -4881,7 +4878,7 @@ yydefault: } case 185: yyDollar = yyS[yypt-2 : yypt+1] - //line php5/php5.y:2687 + //line php5/php5.y:2684 { yyVAL.node = yyDollar[1].node @@ -4892,7 +4889,7 @@ yydefault: } case 186: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:2699 + //line php5/php5.y:2696 { yyVAL.node = stmt.NewTraitUsePrecedence(yyDollar[1].node, yyDollar[3].list) @@ -4906,7 +4903,7 @@ yydefault: } case 187: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:2714 + //line php5/php5.y:2711 { yyVAL.list = []node.Node{yyDollar[1].node} @@ -4914,18 +4911,18 @@ yydefault: } case 188: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:2720 + //line php5/php5.y:2717 { yyVAL.list = append(yyDollar[1].list, yyDollar[3].node) // save comments - addMeta(lastNode(yyDollar[1].list), yyDollar[2].token.Meta, meta.CommaToken) + addMeta(lastNode(yyDollar[1].list), yyDollar[2].token.Meta, meta.NodeEnd) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } case 189: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:2732 + //line php5/php5.y:2729 { name := node.NewIdentifier(yyDollar[1].token.Value) yyVAL.node = stmt.NewTraitMethodRef(nil, name) @@ -4941,7 +4938,7 @@ yydefault: } case 190: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:2746 + //line php5/php5.y:2743 { yyVAL.node = yyDollar[1].node @@ -4949,7 +4946,7 @@ yydefault: } case 191: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:2755 + //line php5/php5.y:2752 { target := node.NewIdentifier(yyDollar[3].token.Value) yyVAL.node = stmt.NewTraitMethodRef(yyDollar[1].node, target) @@ -4966,7 +4963,7 @@ yydefault: } case 192: yyDollar = yyS[yypt-4 : yypt+1] - //line php5/php5.y:2773 + //line php5/php5.y:2770 { alias := node.NewIdentifier(yyDollar[4].token.Value) yyVAL.node = stmt.NewTraitUseAlias(yyDollar[1].node, yyDollar[3].node, alias) @@ -4983,7 +4980,7 @@ yydefault: } case 193: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:2788 + //line php5/php5.y:2785 { yyVAL.node = stmt.NewTraitUseAlias(yyDollar[1].node, yyDollar[3].node, nil) @@ -4997,7 +4994,7 @@ yydefault: } case 194: yyDollar = yyS[yypt-0 : yypt+1] - //line php5/php5.y:2803 + //line php5/php5.y:2800 { yyVAL.node = nil @@ -5005,7 +5002,7 @@ yydefault: } case 195: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:2809 + //line php5/php5.y:2806 { yyVAL.node = yyDollar[1].node @@ -5013,7 +5010,7 @@ yydefault: } case 196: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:2818 + //line php5/php5.y:2815 { yyVAL.node = stmt.NewNop() @@ -5027,7 +5024,7 @@ yydefault: } case 197: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:2830 + //line php5/php5.y:2827 { yyVAL.node = stmt.NewStmtList(yyDollar[2].list) @@ -5042,7 +5039,7 @@ yydefault: } case 198: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:2846 + //line php5/php5.y:2843 { yyVAL.list = yyDollar[1].list @@ -5050,7 +5047,7 @@ yydefault: } case 199: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:2852 + //line php5/php5.y:2849 { modifier := node.NewIdentifier(yyDollar[1].token.Value) yyVAL.list = []node.Node{modifier} @@ -5059,13 +5056,13 @@ yydefault: modifier.SetPosition(yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token)) // save comments - addMeta(modifier, yyDollar[1].token.Meta, meta.VarToken) + addMeta(modifier, yyDollar[1].token.Meta, meta.IdentifierToken) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } case 200: yyDollar = yyS[yypt-0 : yypt+1] - //line php5/php5.y:2868 + //line php5/php5.y:2865 { yyVAL.list = nil @@ -5073,7 +5070,7 @@ yydefault: } case 201: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:2874 + //line php5/php5.y:2871 { yyVAL.list = yyDollar[1].list @@ -5081,7 +5078,7 @@ yydefault: } case 202: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:2883 + //line php5/php5.y:2880 { yyVAL.list = []node.Node{yyDollar[1].node} @@ -5089,7 +5086,7 @@ yydefault: } case 203: yyDollar = yyS[yypt-2 : yypt+1] - //line php5/php5.y:2889 + //line php5/php5.y:2886 { yyVAL.list = append(yyDollar[1].list, yyDollar[2].node) @@ -5097,7 +5094,7 @@ yydefault: } case 204: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:2898 + //line php5/php5.y:2895 { yyVAL.node = node.NewIdentifier(yyDollar[1].token.Value) @@ -5105,13 +5102,13 @@ yydefault: yyVAL.node.SetPosition(yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token)) // save comments - addMeta(yyVAL.node, yyDollar[1].token.Meta, meta.PublicToken) + addMeta(yyVAL.node, yyDollar[1].token.Meta, meta.IdentifierToken) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } case 205: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:2910 + //line php5/php5.y:2907 { yyVAL.node = node.NewIdentifier(yyDollar[1].token.Value) @@ -5119,13 +5116,13 @@ yydefault: yyVAL.node.SetPosition(yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token)) // save comments - addMeta(yyVAL.node, yyDollar[1].token.Meta, meta.ProtectedToken) + addMeta(yyVAL.node, yyDollar[1].token.Meta, meta.IdentifierToken) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } case 206: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:2922 + //line php5/php5.y:2919 { yyVAL.node = node.NewIdentifier(yyDollar[1].token.Value) @@ -5133,13 +5130,13 @@ yydefault: yyVAL.node.SetPosition(yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token)) // save comments - addMeta(yyVAL.node, yyDollar[1].token.Meta, meta.PrivateToken) + addMeta(yyVAL.node, yyDollar[1].token.Meta, meta.IdentifierToken) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } case 207: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:2934 + //line php5/php5.y:2931 { yyVAL.node = node.NewIdentifier(yyDollar[1].token.Value) @@ -5147,13 +5144,13 @@ yydefault: yyVAL.node.SetPosition(yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token)) // save comments - addMeta(yyVAL.node, yyDollar[1].token.Meta, meta.StaticToken) + addMeta(yyVAL.node, yyDollar[1].token.Meta, meta.IdentifierToken) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } case 208: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:2946 + //line php5/php5.y:2943 { yyVAL.node = node.NewIdentifier(yyDollar[1].token.Value) @@ -5161,13 +5158,13 @@ yydefault: yyVAL.node.SetPosition(yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token)) // save comments - addMeta(yyVAL.node, yyDollar[1].token.Meta, meta.AbstractToken) + addMeta(yyVAL.node, yyDollar[1].token.Meta, meta.IdentifierToken) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } case 209: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:2958 + //line php5/php5.y:2955 { yyVAL.node = node.NewIdentifier(yyDollar[1].token.Value) @@ -5175,13 +5172,13 @@ yydefault: yyVAL.node.SetPosition(yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token)) // save comments - addMeta(yyVAL.node, yyDollar[1].token.Meta, meta.FinalToken) + addMeta(yyVAL.node, yyDollar[1].token.Meta, meta.IdentifierToken) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } case 210: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:2973 + //line php5/php5.y:2970 { identifier := node.NewIdentifier(strings.TrimLeftFunc(yyDollar[3].token.Value, isDollar)) variable := expr.NewVariable(identifier) @@ -5201,7 +5198,7 @@ yydefault: } case 211: yyDollar = yyS[yypt-5 : yypt+1] - //line php5/php5.y:2991 + //line php5/php5.y:2988 { identifier := node.NewIdentifier(strings.TrimLeftFunc(yyDollar[3].token.Value, isDollar)) variable := expr.NewVariable(identifier) @@ -5222,7 +5219,7 @@ yydefault: } case 212: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:3010 + //line php5/php5.y:3007 { identifier := node.NewIdentifier(strings.TrimLeftFunc(yyDollar[1].token.Value, isDollar)) variable := expr.NewVariable(identifier) @@ -5241,7 +5238,7 @@ yydefault: } case 213: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:3027 + //line php5/php5.y:3024 { identifier := node.NewIdentifier(strings.TrimLeftFunc(yyDollar[1].token.Value, isDollar)) variable := expr.NewVariable(identifier) @@ -5261,7 +5258,7 @@ yydefault: } case 214: yyDollar = yyS[yypt-5 : yypt+1] - //line php5/php5.y:3048 + //line php5/php5.y:3045 { name := node.NewIdentifier(yyDollar[3].token.Value) constant := stmt.NewConstant(name, yyDollar[5].node, "") @@ -5283,7 +5280,7 @@ yydefault: } case 215: yyDollar = yyS[yypt-4 : yypt+1] - //line php5/php5.y:3068 + //line php5/php5.y:3065 { name := node.NewIdentifier(yyDollar[2].token.Value) constant := stmt.NewConstant(name, yyDollar[4].node, "") @@ -5303,18 +5300,18 @@ yydefault: } case 216: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:3089 + //line php5/php5.y:3086 { yyVAL.list = append(yyDollar[1].list, yyDollar[3].node) // save comments - addMeta(lastNode(yyDollar[1].list), yyDollar[2].token.Meta, meta.CommaToken) + addMeta(lastNode(yyDollar[1].list), yyDollar[2].token.Meta, meta.NodeEnd) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } case 217: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:3098 + //line php5/php5.y:3095 { yyVAL.list = []node.Node{yyDollar[1].node} @@ -5322,7 +5319,7 @@ yydefault: } case 218: yyDollar = yyS[yypt-0 : yypt+1] - //line php5/php5.y:3108 + //line php5/php5.y:3105 { yyVAL.list = nil @@ -5330,7 +5327,7 @@ yydefault: } case 219: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:3114 + //line php5/php5.y:3111 { yyVAL.list = yyDollar[1].list @@ -5338,18 +5335,18 @@ yydefault: } case 220: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:3123 + //line php5/php5.y:3120 { yyVAL.list = append(yyDollar[1].list, yyDollar[3].node) // save comments - addMeta(lastNode(yyDollar[1].list), yyDollar[2].token.Meta, meta.CommaToken) + addMeta(lastNode(yyDollar[1].list), yyDollar[2].token.Meta, meta.NodeEnd) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } case 221: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:3132 + //line php5/php5.y:3129 { yyVAL.list = []node.Node{yyDollar[1].node} @@ -5357,7 +5354,7 @@ yydefault: } case 222: yyDollar = yyS[yypt-2 : yypt+1] - //line php5/php5.y:3141 + //line php5/php5.y:3138 { yyVAL.list = append(yyDollar[1].list, yyDollar[2].list...) @@ -5365,7 +5362,7 @@ yydefault: } case 223: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:3147 + //line php5/php5.y:3144 { yyVAL.list = yyDollar[1].list @@ -5373,7 +5370,7 @@ yydefault: } case 224: yyDollar = yyS[yypt-4 : yypt+1] - //line php5/php5.y:3156 + //line php5/php5.y:3153 { fetch := expr.NewArrayDimFetch(nil, yyDollar[3].node) yyVAL.list = append(yyDollar[1].list, fetch) @@ -5389,7 +5386,7 @@ yydefault: } case 225: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:3170 + //line php5/php5.y:3167 { fetch := expr.NewArrayDimFetch(nil, yyDollar[2].node) yyVAL.list = []node.Node{fetch} @@ -5405,7 +5402,7 @@ yydefault: } case 226: yyDollar = yyS[yypt-2 : yypt+1] - //line php5/php5.y:3187 + //line php5/php5.y:3184 { yyVAL.list = append(yyDollar[1].list, yyDollar[2].list...) @@ -5413,7 +5410,7 @@ yydefault: } case 227: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:3193 + //line php5/php5.y:3190 { yyVAL.list = yyDollar[1].list @@ -5421,7 +5418,7 @@ yydefault: } case 228: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:3199 + //line php5/php5.y:3196 { yyVAL.list = yyDollar[1].list @@ -5429,7 +5426,7 @@ yydefault: } case 229: yyDollar = yyS[yypt-0 : yypt+1] - //line php5/php5.y:3208 + //line php5/php5.y:3205 { yyVAL.list = nil @@ -5437,7 +5434,7 @@ yydefault: } case 230: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:3214 + //line php5/php5.y:3211 { yyVAL.list = yyDollar[1].list @@ -5445,7 +5442,7 @@ yydefault: } case 231: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:3223 + //line php5/php5.y:3220 { if yyDollar[3].node != nil { @@ -5463,7 +5460,7 @@ yydefault: } case 232: yyDollar = yyS[yypt-6 : yypt+1] - //line php5/php5.y:3242 + //line php5/php5.y:3239 { list := expr.NewList(yyDollar[3].list) yyVAL.node = assign.NewAssign(list, yyDollar[6].node) @@ -5482,7 +5479,7 @@ yydefault: } case 233: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:3259 + //line php5/php5.y:3256 { yyVAL.node = assign.NewAssign(yyDollar[1].node, yyDollar[3].node) @@ -5496,7 +5493,7 @@ yydefault: } case 234: yyDollar = yyS[yypt-4 : yypt+1] - //line php5/php5.y:3271 + //line php5/php5.y:3268 { yyVAL.node = assign.NewReference(yyDollar[1].node, yyDollar[4].node) @@ -5511,7 +5508,7 @@ yydefault: } case 235: yyDollar = yyS[yypt-6 : yypt+1] - //line php5/php5.y:3284 + //line php5/php5.y:3281 { var _new *expr.New @@ -5539,7 +5536,7 @@ yydefault: } case 236: yyDollar = yyS[yypt-2 : yypt+1] - //line php5/php5.y:3310 + //line php5/php5.y:3307 { yyVAL.node = expr.NewClone(yyDollar[2].node) @@ -5553,7 +5550,7 @@ yydefault: } case 237: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:3322 + //line php5/php5.y:3319 { yyVAL.node = assign.NewPlus(yyDollar[1].node, yyDollar[3].node) @@ -5567,7 +5564,7 @@ yydefault: } case 238: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:3334 + //line php5/php5.y:3331 { yyVAL.node = assign.NewMinus(yyDollar[1].node, yyDollar[3].node) @@ -5581,7 +5578,7 @@ yydefault: } case 239: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:3346 + //line php5/php5.y:3343 { yyVAL.node = assign.NewMul(yyDollar[1].node, yyDollar[3].node) @@ -5595,7 +5592,7 @@ yydefault: } case 240: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:3358 + //line php5/php5.y:3355 { yyVAL.node = assign.NewPow(yyDollar[1].node, yyDollar[3].node) @@ -5609,7 +5606,7 @@ yydefault: } case 241: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:3370 + //line php5/php5.y:3367 { yyVAL.node = assign.NewDiv(yyDollar[1].node, yyDollar[3].node) @@ -5623,7 +5620,7 @@ yydefault: } case 242: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:3382 + //line php5/php5.y:3379 { yyVAL.node = assign.NewConcat(yyDollar[1].node, yyDollar[3].node) @@ -5637,7 +5634,7 @@ yydefault: } case 243: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:3394 + //line php5/php5.y:3391 { yyVAL.node = assign.NewMod(yyDollar[1].node, yyDollar[3].node) @@ -5651,7 +5648,7 @@ yydefault: } case 244: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:3406 + //line php5/php5.y:3403 { yyVAL.node = assign.NewBitwiseAnd(yyDollar[1].node, yyDollar[3].node) @@ -5665,7 +5662,7 @@ yydefault: } case 245: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:3418 + //line php5/php5.y:3415 { yyVAL.node = assign.NewBitwiseOr(yyDollar[1].node, yyDollar[3].node) @@ -5679,7 +5676,7 @@ yydefault: } case 246: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:3430 + //line php5/php5.y:3427 { yyVAL.node = assign.NewBitwiseXor(yyDollar[1].node, yyDollar[3].node) @@ -5693,7 +5690,7 @@ yydefault: } case 247: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:3442 + //line php5/php5.y:3439 { yyVAL.node = assign.NewShiftLeft(yyDollar[1].node, yyDollar[3].node) @@ -5707,7 +5704,7 @@ yydefault: } case 248: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:3454 + //line php5/php5.y:3451 { yyVAL.node = assign.NewShiftRight(yyDollar[1].node, yyDollar[3].node) @@ -5721,7 +5718,7 @@ yydefault: } case 249: yyDollar = yyS[yypt-2 : yypt+1] - //line php5/php5.y:3466 + //line php5/php5.y:3463 { yyVAL.node = expr.NewPostInc(yyDollar[1].node) @@ -5735,7 +5732,7 @@ yydefault: } case 250: yyDollar = yyS[yypt-2 : yypt+1] - //line php5/php5.y:3478 + //line php5/php5.y:3475 { yyVAL.node = expr.NewPreInc(yyDollar[2].node) @@ -5749,7 +5746,7 @@ yydefault: } case 251: yyDollar = yyS[yypt-2 : yypt+1] - //line php5/php5.y:3490 + //line php5/php5.y:3487 { yyVAL.node = expr.NewPostDec(yyDollar[1].node) @@ -5763,7 +5760,7 @@ yydefault: } case 252: yyDollar = yyS[yypt-2 : yypt+1] - //line php5/php5.y:3502 + //line php5/php5.y:3499 { yyVAL.node = expr.NewPreDec(yyDollar[2].node) @@ -5777,7 +5774,7 @@ yydefault: } case 253: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:3514 + //line php5/php5.y:3511 { yyVAL.node = binary.NewBooleanOr(yyDollar[1].node, yyDollar[3].node) @@ -5791,7 +5788,7 @@ yydefault: } case 254: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:3526 + //line php5/php5.y:3523 { yyVAL.node = binary.NewBooleanAnd(yyDollar[1].node, yyDollar[3].node) @@ -5805,7 +5802,7 @@ yydefault: } case 255: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:3538 + //line php5/php5.y:3535 { yyVAL.node = binary.NewLogicalOr(yyDollar[1].node, yyDollar[3].node) @@ -5819,7 +5816,7 @@ yydefault: } case 256: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:3550 + //line php5/php5.y:3547 { yyVAL.node = binary.NewLogicalAnd(yyDollar[1].node, yyDollar[3].node) @@ -5833,7 +5830,7 @@ yydefault: } case 257: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:3562 + //line php5/php5.y:3559 { yyVAL.node = binary.NewLogicalXor(yyDollar[1].node, yyDollar[3].node) @@ -5847,7 +5844,7 @@ yydefault: } case 258: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:3574 + //line php5/php5.y:3571 { yyVAL.node = binary.NewBitwiseOr(yyDollar[1].node, yyDollar[3].node) @@ -5861,7 +5858,7 @@ yydefault: } case 259: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:3586 + //line php5/php5.y:3583 { yyVAL.node = binary.NewBitwiseAnd(yyDollar[1].node, yyDollar[3].node) @@ -5875,7 +5872,7 @@ yydefault: } case 260: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:3598 + //line php5/php5.y:3595 { yyVAL.node = binary.NewBitwiseXor(yyDollar[1].node, yyDollar[3].node) @@ -5889,7 +5886,7 @@ yydefault: } case 261: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:3610 + //line php5/php5.y:3607 { yyVAL.node = binary.NewConcat(yyDollar[1].node, yyDollar[3].node) @@ -5903,7 +5900,7 @@ yydefault: } case 262: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:3622 + //line php5/php5.y:3619 { yyVAL.node = binary.NewPlus(yyDollar[1].node, yyDollar[3].node) @@ -5917,7 +5914,7 @@ yydefault: } case 263: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:3634 + //line php5/php5.y:3631 { yyVAL.node = binary.NewMinus(yyDollar[1].node, yyDollar[3].node) @@ -5931,7 +5928,7 @@ yydefault: } case 264: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:3646 + //line php5/php5.y:3643 { yyVAL.node = binary.NewMul(yyDollar[1].node, yyDollar[3].node) @@ -5945,7 +5942,7 @@ yydefault: } case 265: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:3658 + //line php5/php5.y:3655 { yyVAL.node = binary.NewPow(yyDollar[1].node, yyDollar[3].node) @@ -5959,7 +5956,7 @@ yydefault: } case 266: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:3670 + //line php5/php5.y:3667 { yyVAL.node = binary.NewDiv(yyDollar[1].node, yyDollar[3].node) @@ -5973,7 +5970,7 @@ yydefault: } case 267: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:3682 + //line php5/php5.y:3679 { yyVAL.node = binary.NewMod(yyDollar[1].node, yyDollar[3].node) @@ -5987,7 +5984,7 @@ yydefault: } case 268: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:3694 + //line php5/php5.y:3691 { yyVAL.node = binary.NewShiftLeft(yyDollar[1].node, yyDollar[3].node) @@ -6001,7 +5998,7 @@ yydefault: } case 269: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:3706 + //line php5/php5.y:3703 { yyVAL.node = binary.NewShiftRight(yyDollar[1].node, yyDollar[3].node) @@ -6015,7 +6012,7 @@ yydefault: } case 270: yyDollar = yyS[yypt-2 : yypt+1] - //line php5/php5.y:3718 + //line php5/php5.y:3715 { yyVAL.node = expr.NewUnaryPlus(yyDollar[2].node) @@ -6029,7 +6026,7 @@ yydefault: } case 271: yyDollar = yyS[yypt-2 : yypt+1] - //line php5/php5.y:3730 + //line php5/php5.y:3727 { yyVAL.node = expr.NewUnaryMinus(yyDollar[2].node) @@ -6043,7 +6040,7 @@ yydefault: } case 272: yyDollar = yyS[yypt-2 : yypt+1] - //line php5/php5.y:3742 + //line php5/php5.y:3739 { yyVAL.node = expr.NewBooleanNot(yyDollar[2].node) @@ -6057,7 +6054,7 @@ yydefault: } case 273: yyDollar = yyS[yypt-2 : yypt+1] - //line php5/php5.y:3754 + //line php5/php5.y:3751 { yyVAL.node = expr.NewBitwiseNot(yyDollar[2].node) @@ -6071,7 +6068,7 @@ yydefault: } case 274: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:3766 + //line php5/php5.y:3763 { yyVAL.node = binary.NewIdentical(yyDollar[1].node, yyDollar[3].node) @@ -6085,7 +6082,7 @@ yydefault: } case 275: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:3778 + //line php5/php5.y:3775 { yyVAL.node = binary.NewNotIdentical(yyDollar[1].node, yyDollar[3].node) @@ -6099,7 +6096,7 @@ yydefault: } case 276: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:3790 + //line php5/php5.y:3787 { yyVAL.node = binary.NewEqual(yyDollar[1].node, yyDollar[3].node) @@ -6113,7 +6110,7 @@ yydefault: } case 277: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:3802 + //line php5/php5.y:3799 { yyVAL.node = binary.NewNotEqual(yyDollar[1].node, yyDollar[3].node) @@ -6127,7 +6124,7 @@ yydefault: } case 278: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:3814 + //line php5/php5.y:3811 { yyVAL.node = binary.NewSmaller(yyDollar[1].node, yyDollar[3].node) @@ -6141,7 +6138,7 @@ yydefault: } case 279: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:3826 + //line php5/php5.y:3823 { yyVAL.node = binary.NewSmallerOrEqual(yyDollar[1].node, yyDollar[3].node) @@ -6155,7 +6152,7 @@ yydefault: } case 280: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:3838 + //line php5/php5.y:3835 { yyVAL.node = binary.NewGreater(yyDollar[1].node, yyDollar[3].node) @@ -6169,7 +6166,7 @@ yydefault: } case 281: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:3850 + //line php5/php5.y:3847 { yyVAL.node = binary.NewGreaterOrEqual(yyDollar[1].node, yyDollar[3].node) @@ -6183,7 +6180,7 @@ yydefault: } case 282: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:3862 + //line php5/php5.y:3859 { yyVAL.node = expr.NewInstanceOf(yyDollar[1].node, yyDollar[3].node) @@ -6197,7 +6194,7 @@ yydefault: } case 283: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:3874 + //line php5/php5.y:3871 { yyVAL.node = yyDollar[1].node @@ -6205,7 +6202,7 @@ yydefault: } case 284: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:3880 + //line php5/php5.y:3877 { yyVAL.node = yyDollar[1].node @@ -6213,7 +6210,7 @@ yydefault: } case 285: yyDollar = yyS[yypt-4 : yypt+1] - //line php5/php5.y:3886 + //line php5/php5.y:3883 { yyVAL.node = yyDollar[2].node @@ -6244,7 +6241,7 @@ yydefault: } case 286: yyDollar = yyS[yypt-5 : yypt+1] - //line php5/php5.y:3915 + //line php5/php5.y:3912 { yyVAL.node = expr.NewTernary(yyDollar[1].node, yyDollar[3].node, yyDollar[5].node) @@ -6259,7 +6256,7 @@ yydefault: } case 287: yyDollar = yyS[yypt-4 : yypt+1] - //line php5/php5.y:3928 + //line php5/php5.y:3925 { yyVAL.node = expr.NewTernary(yyDollar[1].node, nil, yyDollar[4].node) @@ -6274,7 +6271,7 @@ yydefault: } case 288: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:3941 + //line php5/php5.y:3938 { yyVAL.node = yyDollar[1].node @@ -6282,7 +6279,7 @@ yydefault: } case 289: yyDollar = yyS[yypt-2 : yypt+1] - //line php5/php5.y:3947 + //line php5/php5.y:3944 { yyVAL.node = cast.NewInt(yyDollar[2].node) @@ -6296,7 +6293,7 @@ yydefault: } case 290: yyDollar = yyS[yypt-2 : yypt+1] - //line php5/php5.y:3959 + //line php5/php5.y:3956 { yyVAL.node = cast.NewDouble(yyDollar[2].node) @@ -6310,7 +6307,7 @@ yydefault: } case 291: yyDollar = yyS[yypt-2 : yypt+1] - //line php5/php5.y:3971 + //line php5/php5.y:3968 { yyVAL.node = cast.NewString(yyDollar[2].node) @@ -6324,7 +6321,7 @@ yydefault: } case 292: yyDollar = yyS[yypt-2 : yypt+1] - //line php5/php5.y:3983 + //line php5/php5.y:3980 { yyVAL.node = cast.NewArray(yyDollar[2].node) @@ -6338,7 +6335,7 @@ yydefault: } case 293: yyDollar = yyS[yypt-2 : yypt+1] - //line php5/php5.y:3995 + //line php5/php5.y:3992 { yyVAL.node = cast.NewObject(yyDollar[2].node) @@ -6352,7 +6349,7 @@ yydefault: } case 294: yyDollar = yyS[yypt-2 : yypt+1] - //line php5/php5.y:4007 + //line php5/php5.y:4004 { yyVAL.node = cast.NewBool(yyDollar[2].node) @@ -6366,7 +6363,7 @@ yydefault: } case 295: yyDollar = yyS[yypt-2 : yypt+1] - //line php5/php5.y:4019 + //line php5/php5.y:4016 { yyVAL.node = cast.NewUnset(yyDollar[2].node) @@ -6380,7 +6377,7 @@ yydefault: } case 296: yyDollar = yyS[yypt-2 : yypt+1] - //line php5/php5.y:4031 + //line php5/php5.y:4028 { if strings.EqualFold(yyDollar[1].token.Value, "die") { yyVAL.node = expr.NewDie(nil) @@ -6410,7 +6407,7 @@ yydefault: } case 297: yyDollar = yyS[yypt-2 : yypt+1] - //line php5/php5.y:4059 + //line php5/php5.y:4056 { yyVAL.node = expr.NewErrorSuppress(yyDollar[2].node) @@ -6424,7 +6421,7 @@ yydefault: } case 298: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:4071 + //line php5/php5.y:4068 { yyVAL.node = yyDollar[1].node @@ -6432,7 +6429,7 @@ yydefault: } case 299: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:4077 + //line php5/php5.y:4074 { yyVAL.node = yyDollar[1].node @@ -6440,7 +6437,7 @@ yydefault: } case 300: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:4083 + //line php5/php5.y:4080 { yyVAL.node = yyDollar[1].node @@ -6448,7 +6445,7 @@ yydefault: } case 301: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:4089 + //line php5/php5.y:4086 { yyVAL.node = expr.NewShellExec(yyDollar[2].list) @@ -6463,7 +6460,7 @@ yydefault: } case 302: yyDollar = yyS[yypt-2 : yypt+1] - //line php5/php5.y:4102 + //line php5/php5.y:4099 { yyVAL.node = expr.NewPrint(yyDollar[2].node) @@ -6477,7 +6474,7 @@ yydefault: } case 303: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:4114 + //line php5/php5.y:4111 { yyVAL.node = expr.NewYield(nil, nil) @@ -6491,7 +6488,7 @@ yydefault: } case 304: yyDollar = yyS[yypt-9 : yypt+1] - //line php5/php5.y:4126 + //line php5/php5.y:4123 { yyVAL.node = expr.NewClosure(yyDollar[4].list, yyDollar[6].ClosureUse, nil, yyDollar[8].list, false, yyDollar[2].token != nil, "") @@ -6512,7 +6509,7 @@ yydefault: } case 305: yyDollar = yyS[yypt-10 : yypt+1] - //line php5/php5.y:4145 + //line php5/php5.y:4142 { yyVAL.node = expr.NewClosure(yyDollar[5].list, yyDollar[7].ClosureUse, nil, yyDollar[9].list, true, yyDollar[3].token != nil, "") @@ -6534,7 +6531,7 @@ yydefault: } case 306: yyDollar = yyS[yypt-2 : yypt+1] - //line php5/php5.y:4168 + //line php5/php5.y:4165 { yyVAL.node = expr.NewYield(nil, yyDollar[2].node) @@ -6548,7 +6545,7 @@ yydefault: } case 307: yyDollar = yyS[yypt-2 : yypt+1] - //line php5/php5.y:4180 + //line php5/php5.y:4177 { yyVAL.node = expr.NewYield(nil, yyDollar[2].node) @@ -6562,7 +6559,7 @@ yydefault: } case 308: yyDollar = yyS[yypt-4 : yypt+1] - //line php5/php5.y:4192 + //line php5/php5.y:4189 { yyVAL.node = expr.NewYield(yyDollar[2].node, yyDollar[4].node) @@ -6577,7 +6574,7 @@ yydefault: } case 309: yyDollar = yyS[yypt-4 : yypt+1] - //line php5/php5.y:4205 + //line php5/php5.y:4202 { yyVAL.node = expr.NewYield(yyDollar[2].node, yyDollar[4].node) @@ -6592,7 +6589,7 @@ yydefault: } case 310: yyDollar = yyS[yypt-4 : yypt+1] - //line php5/php5.y:4221 + //line php5/php5.y:4218 { yyVAL.node = expr.NewArrayDimFetch(yyDollar[1].node, yyDollar[3].node) @@ -6607,7 +6604,7 @@ yydefault: } case 311: yyDollar = yyS[yypt-4 : yypt+1] - //line php5/php5.y:4234 + //line php5/php5.y:4231 { yyVAL.node = expr.NewArrayDimFetch(yyDollar[1].node, yyDollar[3].node) @@ -6622,7 +6619,7 @@ yydefault: } case 312: yyDollar = yyS[yypt-4 : yypt+1] - //line php5/php5.y:4247 + //line php5/php5.y:4244 { str := scalar.NewString(yyDollar[1].token.Value) yyVAL.node = expr.NewArrayDimFetch(str, yyDollar[3].node) @@ -6639,7 +6636,7 @@ yydefault: } case 313: yyDollar = yyS[yypt-4 : yypt+1] - //line php5/php5.y:4262 + //line php5/php5.y:4259 { yyVAL.node = expr.NewArrayDimFetch(yyDollar[1].node, yyDollar[3].node) @@ -6654,7 +6651,7 @@ yydefault: } case 314: yyDollar = yyS[yypt-4 : yypt+1] - //line php5/php5.y:4278 + //line php5/php5.y:4275 { yyVAL.node = expr.NewArray(yyDollar[3].list) @@ -6670,7 +6667,7 @@ yydefault: } case 315: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:4292 + //line php5/php5.y:4289 { yyVAL.node = expr.NewShortArray(yyDollar[2].list) @@ -6685,13 +6682,13 @@ yydefault: } case 316: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:4308 + //line php5/php5.y:4305 { yyVAL.token = yyDollar[1].token } case 317: yyDollar = yyS[yypt-0 : yypt+1] - //line php5/php5.y:4315 + //line php5/php5.y:4312 { yyVAL.ClosureUse = nil @@ -6699,7 +6696,7 @@ yydefault: } case 318: yyDollar = yyS[yypt-4 : yypt+1] - //line php5/php5.y:4321 + //line php5/php5.y:4318 { yyVAL.ClosureUse = expr.NewClosureUse(yyDollar[3].list) @@ -6709,7 +6706,7 @@ yydefault: } case 319: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:4332 + //line php5/php5.y:4329 { identifier := node.NewIdentifier(strings.TrimLeftFunc(yyDollar[3].token.Value, isDollar)) variable := expr.NewVariable(identifier) @@ -6727,7 +6724,7 @@ yydefault: } case 320: yyDollar = yyS[yypt-4 : yypt+1] - //line php5/php5.y:4348 + //line php5/php5.y:4345 { identifier := node.NewIdentifier(strings.TrimLeftFunc(yyDollar[4].token.Value, isDollar)) variable := expr.NewVariable(identifier) @@ -6748,7 +6745,7 @@ yydefault: } case 321: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:4367 + //line php5/php5.y:4364 { identifier := node.NewIdentifier(strings.TrimLeftFunc(yyDollar[1].token.Value, isDollar)) variable := expr.NewVariable(identifier) @@ -6765,7 +6762,7 @@ yydefault: } case 322: yyDollar = yyS[yypt-2 : yypt+1] - //line php5/php5.y:4382 + //line php5/php5.y:4379 { identifier := node.NewIdentifier(strings.TrimLeftFunc(yyDollar[2].token.Value, isDollar)) variable := expr.NewVariable(identifier) @@ -6785,7 +6782,7 @@ yydefault: } case 323: yyDollar = yyS[yypt-2 : yypt+1] - //line php5/php5.y:4403 + //line php5/php5.y:4400 { name := name.NewName(yyDollar[1].list) yyVAL.node = expr.NewFunctionCall(name, yyDollar[2].node.(*node.ArgumentList)) @@ -6798,7 +6795,7 @@ yydefault: } case 324: yyDollar = yyS[yypt-4 : yypt+1] - //line php5/php5.y:4414 + //line php5/php5.y:4411 { funcName := name.NewRelative(yyDollar[3].list) yyVAL.node = expr.NewFunctionCall(funcName, yyDollar[4].node.(*node.ArgumentList)) @@ -6815,7 +6812,7 @@ yydefault: } case 325: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:4429 + //line php5/php5.y:4426 { funcName := name.NewFullyQualified(yyDollar[2].list) yyVAL.node = expr.NewFunctionCall(funcName, yyDollar[3].node.(*node.ArgumentList)) @@ -6831,7 +6828,7 @@ yydefault: } case 326: yyDollar = yyS[yypt-4 : yypt+1] - //line php5/php5.y:4443 + //line php5/php5.y:4440 { yyVAL.node = expr.NewStaticCall(yyDollar[1].node, yyDollar[3].node, yyDollar[4].node.(*node.ArgumentList)) @@ -6845,7 +6842,7 @@ yydefault: } case 327: yyDollar = yyS[yypt-4 : yypt+1] - //line php5/php5.y:4455 + //line php5/php5.y:4452 { yyVAL.node = expr.NewStaticCall(yyDollar[1].node, yyDollar[3].node, yyDollar[4].node.(*node.ArgumentList)) @@ -6859,7 +6856,7 @@ yydefault: } case 328: yyDollar = yyS[yypt-4 : yypt+1] - //line php5/php5.y:4467 + //line php5/php5.y:4464 { yyVAL.node = expr.NewStaticCall(yyDollar[1].node, yyDollar[3].node, yyDollar[4].node.(*node.ArgumentList)) @@ -6873,7 +6870,7 @@ yydefault: } case 329: yyDollar = yyS[yypt-4 : yypt+1] - //line php5/php5.y:4479 + //line php5/php5.y:4476 { yyVAL.node = expr.NewStaticCall(yyDollar[1].node, yyDollar[3].node, yyDollar[4].node.(*node.ArgumentList)) @@ -6887,7 +6884,7 @@ yydefault: } case 330: yyDollar = yyS[yypt-2 : yypt+1] - //line php5/php5.y:4491 + //line php5/php5.y:4488 { yyVAL.node = expr.NewFunctionCall(yyDollar[1].node, yyDollar[2].node.(*node.ArgumentList)) @@ -6898,7 +6895,7 @@ yydefault: } case 331: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:4503 + //line php5/php5.y:4500 { yyVAL.node = node.NewIdentifier(yyDollar[1].token.Value) @@ -6906,13 +6903,13 @@ yydefault: yyVAL.node.SetPosition(yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token)) // save comments - addMeta(yyVAL.node, yyDollar[1].token.Meta, meta.StaticToken) + addMeta(yyVAL.node, yyDollar[1].token.Meta, meta.IdentifierToken) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } case 332: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:4515 + //line php5/php5.y:4512 { yyVAL.node = name.NewName(yyDollar[1].list) @@ -6923,7 +6920,7 @@ yydefault: } case 333: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:4524 + //line php5/php5.y:4521 { yyVAL.node = name.NewRelative(yyDollar[3].list) @@ -6938,7 +6935,7 @@ yydefault: } case 334: yyDollar = yyS[yypt-2 : yypt+1] - //line php5/php5.y:4537 + //line php5/php5.y:4534 { yyVAL.node = name.NewFullyQualified(yyDollar[2].list) @@ -6952,7 +6949,7 @@ yydefault: } case 335: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:4552 + //line php5/php5.y:4549 { yyVAL.node = name.NewName(yyDollar[1].list) @@ -6963,7 +6960,7 @@ yydefault: } case 336: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:4561 + //line php5/php5.y:4558 { yyVAL.node = name.NewRelative(yyDollar[3].list) @@ -6978,7 +6975,7 @@ yydefault: } case 337: yyDollar = yyS[yypt-2 : yypt+1] - //line php5/php5.y:4574 + //line php5/php5.y:4571 { yyVAL.node = name.NewFullyQualified(yyDollar[2].list) @@ -6992,7 +6989,7 @@ yydefault: } case 338: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:4589 + //line php5/php5.y:4586 { yyVAL.node = yyDollar[1].node @@ -7000,7 +6997,7 @@ yydefault: } case 339: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:4595 + //line php5/php5.y:4592 { yyVAL.node = yyDollar[1].node @@ -7008,7 +7005,7 @@ yydefault: } case 340: yyDollar = yyS[yypt-4 : yypt+1] - //line php5/php5.y:4604 + //line php5/php5.y:4601 { yyVAL.node = yyDollar[1].node @@ -7047,7 +7044,7 @@ yydefault: } case 341: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:4641 + //line php5/php5.y:4638 { yyVAL.node = yyDollar[1].node @@ -7055,7 +7052,7 @@ yydefault: } case 342: yyDollar = yyS[yypt-2 : yypt+1] - //line php5/php5.y:4651 + //line php5/php5.y:4648 { yyVAL.list = append(yyDollar[1].list, yyDollar[2].list...) @@ -7063,7 +7060,7 @@ yydefault: } case 343: yyDollar = yyS[yypt-0 : yypt+1] - //line php5/php5.y:4657 + //line php5/php5.y:4654 { yyVAL.list = []node.Node{} @@ -7071,7 +7068,7 @@ yydefault: } case 344: yyDollar = yyS[yypt-2 : yypt+1] - //line php5/php5.y:4667 + //line php5/php5.y:4664 { yyVAL.list = yyDollar[2].list @@ -7082,7 +7079,7 @@ yydefault: } case 345: yyDollar = yyS[yypt-0 : yypt+1] - //line php5/php5.y:4679 + //line php5/php5.y:4676 { yyVAL.node = nil @@ -7090,7 +7087,7 @@ yydefault: } case 346: yyDollar = yyS[yypt-2 : yypt+1] - //line php5/php5.y:4685 + //line php5/php5.y:4682 { yyVAL.node = expr.NewExit(nil) @@ -7105,7 +7102,7 @@ yydefault: } case 347: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:4698 + //line php5/php5.y:4695 { yyVAL.node = expr.NewExit(yyDollar[1].node) @@ -7116,7 +7113,7 @@ yydefault: } case 348: yyDollar = yyS[yypt-0 : yypt+1] - //line php5/php5.y:4710 + //line php5/php5.y:4707 { yyVAL.list = []node.Node{} @@ -7124,7 +7121,7 @@ yydefault: } case 349: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:4716 + //line php5/php5.y:4713 { yyVAL.list = []node.Node{scalar.NewEncapsedStringPart(yyDollar[1].token.Value)} @@ -7132,7 +7129,7 @@ yydefault: } case 350: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:4722 + //line php5/php5.y:4719 { yyVAL.list = yyDollar[1].list @@ -7140,7 +7137,7 @@ yydefault: } case 351: yyDollar = yyS[yypt-0 : yypt+1] - //line php5/php5.y:4731 + //line php5/php5.y:4728 { yyVAL.node = nil @@ -7148,7 +7145,7 @@ yydefault: } case 352: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:4737 + //line php5/php5.y:4734 { yyVAL.node = yyDollar[1].node @@ -7156,7 +7153,7 @@ yydefault: } case 353: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:4746 + //line php5/php5.y:4743 { yyVAL.node = scalar.NewLnumber(yyDollar[1].token.Value) @@ -7170,7 +7167,7 @@ yydefault: } case 354: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:4758 + //line php5/php5.y:4755 { yyVAL.node = scalar.NewDnumber(yyDollar[1].token.Value) @@ -7184,7 +7181,7 @@ yydefault: } case 355: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:4770 + //line php5/php5.y:4767 { yyVAL.node = scalar.NewString(yyDollar[1].token.Value) @@ -7198,7 +7195,7 @@ yydefault: } case 356: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:4782 + //line php5/php5.y:4779 { yyVAL.node = scalar.NewMagicConstant(yyDollar[1].token.Value) @@ -7206,13 +7203,13 @@ yydefault: yyVAL.node.SetPosition(yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token)) // save comments - addMeta(yyVAL.node, yyDollar[1].token.Meta, meta.LineToken) + addMeta(yyVAL.node, yyDollar[1].token.Meta, meta.MagicConstantToken) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } case 357: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:4794 + //line php5/php5.y:4791 { yyVAL.node = scalar.NewMagicConstant(yyDollar[1].token.Value) @@ -7220,13 +7217,13 @@ yydefault: yyVAL.node.SetPosition(yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token)) // save comments - addMeta(yyVAL.node, yyDollar[1].token.Meta, meta.FileToken) + addMeta(yyVAL.node, yyDollar[1].token.Meta, meta.MagicConstantToken) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } case 358: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:4806 + //line php5/php5.y:4803 { yyVAL.node = scalar.NewMagicConstant(yyDollar[1].token.Value) @@ -7234,13 +7231,13 @@ yydefault: yyVAL.node.SetPosition(yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token)) // save comments - addMeta(yyVAL.node, yyDollar[1].token.Meta, meta.DirToken) + addMeta(yyVAL.node, yyDollar[1].token.Meta, meta.MagicConstantToken) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } case 359: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:4818 + //line php5/php5.y:4815 { yyVAL.node = scalar.NewMagicConstant(yyDollar[1].token.Value) @@ -7248,13 +7245,13 @@ yydefault: yyVAL.node.SetPosition(yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token)) // save comments - addMeta(yyVAL.node, yyDollar[1].token.Meta, meta.TraitCToken) + addMeta(yyVAL.node, yyDollar[1].token.Meta, meta.MagicConstantToken) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } case 360: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:4830 + //line php5/php5.y:4827 { yyVAL.node = scalar.NewMagicConstant(yyDollar[1].token.Value) @@ -7262,13 +7259,13 @@ yydefault: yyVAL.node.SetPosition(yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token)) // save comments - addMeta(yyVAL.node, yyDollar[1].token.Meta, meta.MethodCToken) + addMeta(yyVAL.node, yyDollar[1].token.Meta, meta.MagicConstantToken) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } case 361: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:4842 + //line php5/php5.y:4839 { yyVAL.node = scalar.NewMagicConstant(yyDollar[1].token.Value) @@ -7276,13 +7273,13 @@ yydefault: yyVAL.node.SetPosition(yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token)) // save comments - addMeta(yyVAL.node, yyDollar[1].token.Meta, meta.FuncCToken) + addMeta(yyVAL.node, yyDollar[1].token.Meta, meta.MagicConstantToken) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } case 362: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:4854 + //line php5/php5.y:4851 { yyVAL.node = scalar.NewMagicConstant(yyDollar[1].token.Value) @@ -7290,13 +7287,13 @@ yydefault: yyVAL.node.SetPosition(yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token)) // save comments - addMeta(yyVAL.node, yyDollar[1].token.Meta, meta.NsCToken) + addMeta(yyVAL.node, yyDollar[1].token.Meta, meta.MagicConstantToken) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } case 363: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:4866 + //line php5/php5.y:4863 { encapsed := scalar.NewEncapsedStringPart(yyDollar[2].token.Value) yyVAL.node = scalar.NewHeredoc(yyDollar[1].token.Value, []node.Node{encapsed}) @@ -7312,7 +7309,7 @@ yydefault: } case 364: yyDollar = yyS[yypt-2 : yypt+1] - //line php5/php5.y:4880 + //line php5/php5.y:4877 { yyVAL.node = scalar.NewHeredoc(yyDollar[1].token.Value, nil) @@ -7326,7 +7323,7 @@ yydefault: } case 365: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:4895 + //line php5/php5.y:4892 { target := node.NewIdentifier(yyDollar[3].token.Value) yyVAL.node = expr.NewClassConstFetch(yyDollar[1].node, target) @@ -7343,7 +7340,7 @@ yydefault: } case 366: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:4913 + //line php5/php5.y:4910 { yyVAL.node = yyDollar[1].node @@ -7351,7 +7348,7 @@ yydefault: } case 367: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:4922 + //line php5/php5.y:4919 { yyVAL.node = yyDollar[1].node @@ -7359,7 +7356,7 @@ yydefault: } case 368: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:4928 + //line php5/php5.y:4925 { yyVAL.node = yyDollar[1].node @@ -7367,7 +7364,7 @@ yydefault: } case 369: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:4934 + //line php5/php5.y:4931 { name := name.NewName(yyDollar[1].list) yyVAL.node = expr.NewConstFetch(name) @@ -7380,7 +7377,7 @@ yydefault: } case 370: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:4945 + //line php5/php5.y:4942 { name := name.NewRelative(yyDollar[3].list) yyVAL.node = expr.NewConstFetch(name) @@ -7390,14 +7387,14 @@ yydefault: yyVAL.node.SetPosition(yylex.(*Parser).positionBuilder.NewTokenNodeListPosition(yyDollar[1].token, yyDollar[3].list)) // save comments - addMeta(yyVAL.node, yyDollar[1].token.Meta, meta.NamespaceToken) - addMeta(yyVAL.node, yyDollar[2].token.Meta, meta.NsSeparatorToken) + addMeta(name, yyDollar[1].token.Meta, meta.NamespaceToken) + addMeta(name, yyDollar[2].token.Meta, meta.NsSeparatorToken) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } case 371: yyDollar = yyS[yypt-2 : yypt+1] - //line php5/php5.y:4960 + //line php5/php5.y:4957 { name := name.NewFullyQualified(yyDollar[2].list) yyVAL.node = expr.NewConstFetch(name) @@ -7407,13 +7404,13 @@ yydefault: yyVAL.node.SetPosition(yylex.(*Parser).positionBuilder.NewTokenNodeListPosition(yyDollar[1].token, yyDollar[2].list)) // save comments - addMeta(yyVAL.node, yyDollar[1].token.Meta, meta.NsSeparatorToken) + addMeta(name, yyDollar[1].token.Meta, meta.NsSeparatorToken) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } case 372: yyDollar = yyS[yypt-4 : yypt+1] - //line php5/php5.y:4974 + //line php5/php5.y:4971 { yyVAL.node = expr.NewArray(yyDollar[3].list) @@ -7429,7 +7426,7 @@ yydefault: } case 373: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:4988 + //line php5/php5.y:4985 { yyVAL.node = expr.NewShortArray(yyDollar[2].list) @@ -7444,7 +7441,7 @@ yydefault: } case 374: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:5001 + //line php5/php5.y:4998 { yyVAL.node = yyDollar[1].node @@ -7452,7 +7449,7 @@ yydefault: } case 375: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:5007 + //line php5/php5.y:5004 { yyVAL.node = scalar.NewMagicConstant(yyDollar[1].token.Value) @@ -7460,13 +7457,13 @@ yydefault: yyVAL.node.SetPosition(yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token)) // save comments - addMeta(yyVAL.node, yyDollar[1].token.Meta, meta.ClassCToken) + addMeta(yyVAL.node, yyDollar[1].token.Meta, meta.MagicConstantToken) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } case 376: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:5019 + //line php5/php5.y:5016 { yyVAL.node = yyDollar[1].node @@ -7474,7 +7471,7 @@ yydefault: } case 377: yyDollar = yyS[yypt-4 : yypt+1] - //line php5/php5.y:5028 + //line php5/php5.y:5025 { yyVAL.node = expr.NewArrayDimFetch(yyDollar[1].node, yyDollar[3].node) @@ -7489,7 +7486,7 @@ yydefault: } case 378: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:5041 + //line php5/php5.y:5038 { yyVAL.node = binary.NewPlus(yyDollar[1].node, yyDollar[3].node) @@ -7503,7 +7500,7 @@ yydefault: } case 379: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:5053 + //line php5/php5.y:5050 { yyVAL.node = binary.NewMinus(yyDollar[1].node, yyDollar[3].node) @@ -7517,7 +7514,7 @@ yydefault: } case 380: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:5065 + //line php5/php5.y:5062 { yyVAL.node = binary.NewMul(yyDollar[1].node, yyDollar[3].node) @@ -7531,7 +7528,7 @@ yydefault: } case 381: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:5077 + //line php5/php5.y:5074 { yyVAL.node = binary.NewPow(yyDollar[1].node, yyDollar[3].node) @@ -7545,7 +7542,7 @@ yydefault: } case 382: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:5089 + //line php5/php5.y:5086 { yyVAL.node = binary.NewDiv(yyDollar[1].node, yyDollar[3].node) @@ -7559,7 +7556,7 @@ yydefault: } case 383: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:5101 + //line php5/php5.y:5098 { yyVAL.node = binary.NewMod(yyDollar[1].node, yyDollar[3].node) @@ -7573,7 +7570,7 @@ yydefault: } case 384: yyDollar = yyS[yypt-2 : yypt+1] - //line php5/php5.y:5113 + //line php5/php5.y:5110 { yyVAL.node = expr.NewBooleanNot(yyDollar[2].node) @@ -7587,7 +7584,7 @@ yydefault: } case 385: yyDollar = yyS[yypt-2 : yypt+1] - //line php5/php5.y:5125 + //line php5/php5.y:5122 { yyVAL.node = expr.NewBitwiseNot(yyDollar[2].node) @@ -7601,7 +7598,7 @@ yydefault: } case 386: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:5137 + //line php5/php5.y:5134 { yyVAL.node = binary.NewBitwiseOr(yyDollar[1].node, yyDollar[3].node) @@ -7615,7 +7612,7 @@ yydefault: } case 387: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:5149 + //line php5/php5.y:5146 { yyVAL.node = binary.NewBitwiseAnd(yyDollar[1].node, yyDollar[3].node) @@ -7629,7 +7626,7 @@ yydefault: } case 388: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:5161 + //line php5/php5.y:5158 { yyVAL.node = binary.NewBitwiseXor(yyDollar[1].node, yyDollar[3].node) @@ -7643,7 +7640,7 @@ yydefault: } case 389: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:5173 + //line php5/php5.y:5170 { yyVAL.node = binary.NewShiftLeft(yyDollar[1].node, yyDollar[3].node) @@ -7657,7 +7654,7 @@ yydefault: } case 390: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:5185 + //line php5/php5.y:5182 { yyVAL.node = binary.NewShiftRight(yyDollar[1].node, yyDollar[3].node) @@ -7671,7 +7668,7 @@ yydefault: } case 391: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:5197 + //line php5/php5.y:5194 { yyVAL.node = binary.NewConcat(yyDollar[1].node, yyDollar[3].node) @@ -7685,7 +7682,7 @@ yydefault: } case 392: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:5209 + //line php5/php5.y:5206 { yyVAL.node = binary.NewLogicalXor(yyDollar[1].node, yyDollar[3].node) @@ -7699,7 +7696,7 @@ yydefault: } case 393: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:5221 + //line php5/php5.y:5218 { yyVAL.node = binary.NewLogicalAnd(yyDollar[1].node, yyDollar[3].node) @@ -7713,7 +7710,7 @@ yydefault: } case 394: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:5233 + //line php5/php5.y:5230 { yyVAL.node = binary.NewLogicalOr(yyDollar[1].node, yyDollar[3].node) @@ -7727,7 +7724,7 @@ yydefault: } case 395: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:5245 + //line php5/php5.y:5242 { yyVAL.node = binary.NewBooleanAnd(yyDollar[1].node, yyDollar[3].node) @@ -7741,7 +7738,7 @@ yydefault: } case 396: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:5257 + //line php5/php5.y:5254 { yyVAL.node = binary.NewBooleanOr(yyDollar[1].node, yyDollar[3].node) @@ -7755,7 +7752,7 @@ yydefault: } case 397: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:5269 + //line php5/php5.y:5266 { yyVAL.node = binary.NewIdentical(yyDollar[1].node, yyDollar[3].node) @@ -7769,7 +7766,7 @@ yydefault: } case 398: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:5281 + //line php5/php5.y:5278 { yyVAL.node = binary.NewNotIdentical(yyDollar[1].node, yyDollar[3].node) @@ -7783,7 +7780,7 @@ yydefault: } case 399: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:5293 + //line php5/php5.y:5290 { yyVAL.node = binary.NewEqual(yyDollar[1].node, yyDollar[3].node) @@ -7797,7 +7794,7 @@ yydefault: } case 400: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:5305 + //line php5/php5.y:5302 { yyVAL.node = binary.NewNotEqual(yyDollar[1].node, yyDollar[3].node) @@ -7811,7 +7808,7 @@ yydefault: } case 401: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:5317 + //line php5/php5.y:5314 { yyVAL.node = binary.NewSmaller(yyDollar[1].node, yyDollar[3].node) @@ -7825,7 +7822,7 @@ yydefault: } case 402: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:5329 + //line php5/php5.y:5326 { yyVAL.node = binary.NewGreater(yyDollar[1].node, yyDollar[3].node) @@ -7839,7 +7836,7 @@ yydefault: } case 403: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:5341 + //line php5/php5.y:5338 { yyVAL.node = binary.NewSmallerOrEqual(yyDollar[1].node, yyDollar[3].node) @@ -7853,7 +7850,7 @@ yydefault: } case 404: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:5353 + //line php5/php5.y:5350 { yyVAL.node = binary.NewGreaterOrEqual(yyDollar[1].node, yyDollar[3].node) @@ -7867,7 +7864,7 @@ yydefault: } case 405: yyDollar = yyS[yypt-4 : yypt+1] - //line php5/php5.y:5365 + //line php5/php5.y:5362 { yyVAL.node = expr.NewTernary(yyDollar[1].node, nil, yyDollar[4].node) @@ -7882,7 +7879,7 @@ yydefault: } case 406: yyDollar = yyS[yypt-5 : yypt+1] - //line php5/php5.y:5378 + //line php5/php5.y:5375 { yyVAL.node = expr.NewTernary(yyDollar[1].node, yyDollar[3].node, yyDollar[5].node) @@ -7897,7 +7894,7 @@ yydefault: } case 407: yyDollar = yyS[yypt-2 : yypt+1] - //line php5/php5.y:5391 + //line php5/php5.y:5388 { yyVAL.node = expr.NewUnaryPlus(yyDollar[2].node) @@ -7911,7 +7908,7 @@ yydefault: } case 408: yyDollar = yyS[yypt-2 : yypt+1] - //line php5/php5.y:5403 + //line php5/php5.y:5400 { yyVAL.node = expr.NewUnaryMinus(yyDollar[2].node) @@ -7925,7 +7922,7 @@ yydefault: } case 409: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:5415 + //line php5/php5.y:5412 { yyVAL.node = yyDollar[2].node @@ -7937,7 +7934,7 @@ yydefault: } case 410: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:5428 + //line php5/php5.y:5425 { yyVAL.node = yyDollar[1].node @@ -7945,7 +7942,7 @@ yydefault: } case 411: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:5434 + //line php5/php5.y:5431 { name := name.NewName(yyDollar[1].list) yyVAL.node = expr.NewConstFetch(name) @@ -7958,7 +7955,7 @@ yydefault: } case 412: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:5445 + //line php5/php5.y:5442 { name := name.NewRelative(yyDollar[3].list) yyVAL.node = expr.NewConstFetch(name) @@ -7966,14 +7963,14 @@ yydefault: yyVAL.node.SetPosition(yylex.(*Parser).positionBuilder.NewNodePosition(name)) // save comments - addMeta(yyVAL.node, yyDollar[1].token.Meta, meta.NamespaceToken) - addMeta(yyVAL.node, yyDollar[2].token.Meta, meta.NsSeparatorToken) + addMeta(name, yyDollar[1].token.Meta, meta.NamespaceToken) + addMeta(name, yyDollar[2].token.Meta, meta.NsSeparatorToken) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } case 413: yyDollar = yyS[yypt-2 : yypt+1] - //line php5/php5.y:5458 + //line php5/php5.y:5455 { name := name.NewFullyQualified(yyDollar[2].list) yyVAL.node = expr.NewConstFetch(name) @@ -7983,13 +7980,13 @@ yydefault: yyVAL.node.SetPosition(yylex.(*Parser).positionBuilder.NewNodePosition(name)) // save comments - addMeta(yyVAL.node, yyDollar[1].token.Meta, meta.NsSeparatorToken) + addMeta(name, yyDollar[1].token.Meta, meta.NsSeparatorToken) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } case 414: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:5475 + //line php5/php5.y:5472 { name := node.NewIdentifier(yyDollar[1].token.Value) yyVAL.node = expr.NewVariable(name) @@ -7999,13 +7996,13 @@ yydefault: yyVAL.node.SetPosition(yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token)) // save comments - addMeta(name, yyDollar[1].token.Meta, meta.StringVarnameToken) + addMeta(name, yyDollar[1].token.Meta, meta.IdentifierToken) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } case 415: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:5489 + //line php5/php5.y:5486 { yyVAL.node = yyDollar[1].node @@ -8013,7 +8010,7 @@ yydefault: } case 416: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:5495 + //line php5/php5.y:5492 { yyVAL.node = yyDollar[1].node @@ -8021,7 +8018,7 @@ yydefault: } case 417: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:5501 + //line php5/php5.y:5498 { yyVAL.node = yyDollar[1].node @@ -8029,7 +8026,7 @@ yydefault: } case 418: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:5507 + //line php5/php5.y:5504 { yyVAL.node = scalar.NewEncapsed(yyDollar[2].list) @@ -8043,7 +8040,7 @@ yydefault: } case 419: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:5519 + //line php5/php5.y:5516 { yyVAL.node = scalar.NewHeredoc(yyDollar[1].token.Value, yyDollar[2].list) @@ -8057,7 +8054,7 @@ yydefault: } case 420: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:5531 + //line php5/php5.y:5528 { yyVAL.node = scalar.NewMagicConstant(yyDollar[1].token.Value) @@ -8065,13 +8062,13 @@ yydefault: yyVAL.node.SetPosition(yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token)) // save comments - addMeta(yyVAL.node, yyDollar[1].token.Meta, meta.ClassCToken) + addMeta(yyVAL.node, yyDollar[1].token.Meta, meta.MagicConstantToken) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } case 421: yyDollar = yyS[yypt-0 : yypt+1] - //line php5/php5.y:5546 + //line php5/php5.y:5543 { yyVAL.list = nil @@ -8079,7 +8076,7 @@ yydefault: } case 422: yyDollar = yyS[yypt-2 : yypt+1] - //line php5/php5.y:5552 + //line php5/php5.y:5549 { yyVAL.list = yyDollar[1].list @@ -8092,19 +8089,19 @@ yydefault: } case 423: yyDollar = yyS[yypt-0 : yypt+1] - //line php5/php5.y:5566 + //line php5/php5.y:5563 { yyVAL.token = nil } case 424: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:5570 + //line php5/php5.y:5567 { yyVAL.token = yyDollar[1].token } case 425: yyDollar = yyS[yypt-5 : yypt+1] - //line php5/php5.y:5577 + //line php5/php5.y:5574 { arrayItem := expr.NewArrayItem(yyDollar[3].node, yyDollar[5].node) yyVAL.list = append(yyDollar[1].list, arrayItem) @@ -8120,7 +8117,7 @@ yydefault: } case 426: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:5591 + //line php5/php5.y:5588 { arrayItem := expr.NewArrayItem(nil, yyDollar[3].node) yyVAL.list = append(yyDollar[1].list, arrayItem) @@ -8135,7 +8132,7 @@ yydefault: } case 427: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:5604 + //line php5/php5.y:5601 { arrayItem := expr.NewArrayItem(yyDollar[1].node, yyDollar[3].node) yyVAL.list = []node.Node{arrayItem} @@ -8150,7 +8147,7 @@ yydefault: } case 428: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:5617 + //line php5/php5.y:5614 { arrayItem := expr.NewArrayItem(nil, yyDollar[1].node) yyVAL.list = []node.Node{arrayItem} @@ -8162,7 +8159,7 @@ yydefault: } case 429: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:5630 + //line php5/php5.y:5627 { yyVAL.node = yyDollar[1].node @@ -8170,7 +8167,7 @@ yydefault: } case 430: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:5636 + //line php5/php5.y:5633 { yyVAL.node = yyDollar[1].node @@ -8178,23 +8175,31 @@ yydefault: } case 431: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:5645 + //line php5/php5.y:5642 { yyVAL.node = yyDollar[2].node + // save comments + addMeta(yyVAL.node, yyDollar[1].token.Meta, meta.OpenParenthesisToken) + addMeta(yyVAL.node, yyDollar[3].token.Meta, meta.CloseParenthesisToken) + yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } case 432: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:5651 + //line php5/php5.y:5652 { yyVAL.node = yyDollar[2].node + // save comments + addMeta(yyVAL.node, yyDollar[1].token.Meta, meta.OpenParenthesisToken) + addMeta(yyVAL.node, yyDollar[3].token.Meta, meta.CloseParenthesisToken) + yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } case 433: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:5661 + //line php5/php5.y:5666 { yyVAL.node = yyDollar[1].node @@ -8202,7 +8207,7 @@ yydefault: } case 434: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:5671 + //line php5/php5.y:5676 { yyVAL.node = yyDollar[1].node @@ -8210,7 +8215,7 @@ yydefault: } case 435: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:5680 + //line php5/php5.y:5685 { yyVAL.node = yyDollar[1].node @@ -8218,7 +8223,7 @@ yydefault: } case 436: yyDollar = yyS[yypt-5 : yypt+1] - //line php5/php5.y:5689 + //line php5/php5.y:5694 { yyVAL.node = yyDollar[1].node @@ -8272,7 +8277,7 @@ yydefault: } case 437: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:5741 + //line php5/php5.y:5746 { yyVAL.node = yyDollar[1].node @@ -8280,7 +8285,7 @@ yydefault: } case 438: yyDollar = yyS[yypt-2 : yypt+1] - //line php5/php5.y:5750 + //line php5/php5.y:5755 { yyVAL.list = append(yyDollar[1].list, yyDollar[2].list...) @@ -8288,7 +8293,7 @@ yydefault: } case 439: yyDollar = yyS[yypt-0 : yypt+1] - //line php5/php5.y:5756 + //line php5/php5.y:5761 { yyVAL.list = []node.Node{} @@ -8296,7 +8301,7 @@ yydefault: } case 440: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:5766 + //line php5/php5.y:5771 { if yyDollar[3].list != nil { yyDollar[3].list[0].(*expr.MethodCall).Method = yyDollar[2].list[len(yyDollar[2].list)-1].(*expr.PropertyFetch).Property @@ -8312,7 +8317,7 @@ yydefault: } case 441: yyDollar = yyS[yypt-4 : yypt+1] - //line php5/php5.y:5783 + //line php5/php5.y:5788 { fetch := expr.NewArrayDimFetch(nil, yyDollar[3].node) yyVAL.list = append(yyDollar[1].list, fetch) @@ -8328,7 +8333,7 @@ yydefault: } case 442: yyDollar = yyS[yypt-4 : yypt+1] - //line php5/php5.y:5797 + //line php5/php5.y:5802 { fetch := expr.NewArrayDimFetch(nil, yyDollar[3].node) yyVAL.list = []node.Node{yyDollar[1].node, fetch} @@ -8344,7 +8349,7 @@ yydefault: } case 443: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:5814 + //line php5/php5.y:5819 { yyVAL.node = expr.NewMethodCall(nil, nil, yyDollar[1].node.(*node.ArgumentList)) @@ -8355,7 +8360,7 @@ yydefault: } case 444: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:5826 + //line php5/php5.y:5831 { yyVAL.list = []node.Node{yyDollar[1].node} @@ -8363,7 +8368,7 @@ yydefault: } case 445: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:5832 + //line php5/php5.y:5837 { yyVAL.list = yyDollar[1].list @@ -8371,7 +8376,7 @@ yydefault: } case 446: yyDollar = yyS[yypt-0 : yypt+1] - //line php5/php5.y:5838 + //line php5/php5.y:5843 { yyVAL.list = nil @@ -8379,7 +8384,7 @@ yydefault: } case 447: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:5847 + //line php5/php5.y:5852 { yyVAL.node = yyDollar[1].node @@ -8387,7 +8392,7 @@ yydefault: } case 448: yyDollar = yyS[yypt-2 : yypt+1] - //line php5/php5.y:5853 + //line php5/php5.y:5858 { yyDollar[1].simpleIndirectReference.last.SetVarName(yyDollar[2].node) @@ -8401,7 +8406,7 @@ yydefault: } case 449: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:5868 + //line php5/php5.y:5873 { yyVAL.node = expr.NewStaticPropertyFetch(yyDollar[1].node, yyDollar[3].node) @@ -8415,7 +8420,7 @@ yydefault: } case 450: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:5880 + //line php5/php5.y:5885 { yyVAL.node = expr.NewStaticPropertyFetch(yyDollar[1].node, yyDollar[3].node) @@ -8429,7 +8434,7 @@ yydefault: } case 451: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:5895 + //line php5/php5.y:5900 { yyVAL.node = yyDollar[1].node @@ -8437,7 +8442,7 @@ yydefault: } case 452: yyDollar = yyS[yypt-4 : yypt+1] - //line php5/php5.y:5904 + //line php5/php5.y:5909 { yyVAL.node = expr.NewArrayDimFetch(yyDollar[1].node, yyDollar[3].node) @@ -8452,7 +8457,7 @@ yydefault: } case 453: yyDollar = yyS[yypt-4 : yypt+1] - //line php5/php5.y:5917 + //line php5/php5.y:5922 { yyVAL.node = expr.NewArrayDimFetch(yyDollar[1].node, yyDollar[3].node) @@ -8467,7 +8472,7 @@ yydefault: } case 454: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:5933 + //line php5/php5.y:5938 { yyVAL.node = yyDollar[1].node @@ -8475,7 +8480,7 @@ yydefault: } case 455: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:5939 + //line php5/php5.y:5944 { yyVAL.node = yyDollar[1].node @@ -8483,7 +8488,7 @@ yydefault: } case 456: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:5945 + //line php5/php5.y:5950 { yyVAL.node = yyDollar[1].node @@ -8491,7 +8496,7 @@ yydefault: } case 457: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:5955 + //line php5/php5.y:5960 { yyVAL.node = yyDollar[1].node @@ -8499,7 +8504,7 @@ yydefault: } case 458: yyDollar = yyS[yypt-2 : yypt+1] - //line php5/php5.y:5961 + //line php5/php5.y:5966 { yyDollar[1].simpleIndirectReference.last.SetVarName(yyDollar[2].node) @@ -8513,7 +8518,7 @@ yydefault: } case 459: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:5973 + //line php5/php5.y:5978 { yyVAL.node = yyDollar[1].node @@ -8521,7 +8526,7 @@ yydefault: } case 460: yyDollar = yyS[yypt-4 : yypt+1] - //line php5/php5.y:5982 + //line php5/php5.y:5987 { yyVAL.node = expr.NewArrayDimFetch(yyDollar[1].node, yyDollar[3].node) @@ -8536,7 +8541,7 @@ yydefault: } case 461: yyDollar = yyS[yypt-4 : yypt+1] - //line php5/php5.y:5995 + //line php5/php5.y:6000 { yyVAL.node = expr.NewArrayDimFetch(yyDollar[1].node, yyDollar[3].node) @@ -8551,7 +8556,7 @@ yydefault: } case 462: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:6008 + //line php5/php5.y:6013 { yyVAL.node = yyDollar[1].node @@ -8559,7 +8564,7 @@ yydefault: } case 463: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:6018 + //line php5/php5.y:6023 { name := node.NewIdentifier(strings.TrimLeftFunc(yyDollar[1].token.Value, isDollar)) yyVAL.node = expr.NewVariable(name) @@ -8575,7 +8580,7 @@ yydefault: } case 464: yyDollar = yyS[yypt-4 : yypt+1] - //line php5/php5.y:6032 + //line php5/php5.y:6037 { yyVAL.node = expr.NewVariable(yyDollar[3].node) @@ -8591,7 +8596,7 @@ yydefault: } case 465: yyDollar = yyS[yypt-0 : yypt+1] - //line php5/php5.y:6049 + //line php5/php5.y:6054 { yyVAL.node = nil @@ -8599,7 +8604,7 @@ yydefault: } case 466: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:6055 + //line php5/php5.y:6060 { yyVAL.node = yyDollar[1].node @@ -8607,7 +8612,7 @@ yydefault: } case 467: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:6065 + //line php5/php5.y:6070 { yyVAL.list = yyDollar[1].list @@ -8615,7 +8620,7 @@ yydefault: } case 468: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:6071 + //line php5/php5.y:6076 { fetch := expr.NewPropertyFetch(nil, yyDollar[1].node) yyVAL.list = []node.Node{fetch} @@ -8627,7 +8632,7 @@ yydefault: } case 469: yyDollar = yyS[yypt-4 : yypt+1] - //line php5/php5.y:6084 + //line php5/php5.y:6089 { fetch := expr.NewArrayDimFetch(nil, yyDollar[3].node) yyVAL.list = append(yyDollar[1].list, fetch) @@ -8643,7 +8648,7 @@ yydefault: } case 470: yyDollar = yyS[yypt-4 : yypt+1] - //line php5/php5.y:6098 + //line php5/php5.y:6103 { fetch := expr.NewArrayDimFetch(nil, yyDollar[3].node) yyVAL.list = append(yyDollar[1].list, fetch) @@ -8659,7 +8664,7 @@ yydefault: } case 471: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:6112 + //line php5/php5.y:6117 { fetch := expr.NewPropertyFetch(nil, yyDollar[1].node) yyVAL.list = []node.Node{fetch} @@ -8671,7 +8676,7 @@ yydefault: } case 472: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:6125 + //line php5/php5.y:6130 { yyVAL.node = node.NewIdentifier(yyDollar[1].token.Value) @@ -8679,13 +8684,13 @@ yydefault: yyVAL.node.SetPosition(yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token)) // save comments - addMeta(yyVAL.node, yyDollar[1].token.Meta, meta.StringToken) + addMeta(yyVAL.node, yyDollar[1].token.Meta, meta.IdentifierToken) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } case 473: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:6137 + //line php5/php5.y:6142 { yyVAL.node = yyDollar[2].node @@ -8700,7 +8705,7 @@ yydefault: } case 474: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:6153 + //line php5/php5.y:6158 { n := expr.NewVariable(nil) yyVAL.simpleIndirectReference = simpleIndirectReference{[]*expr.Variable{n}, n} @@ -8715,7 +8720,7 @@ yydefault: } case 475: yyDollar = yyS[yypt-2 : yypt+1] - //line php5/php5.y:6166 + //line php5/php5.y:6171 { n := expr.NewVariable(nil) @@ -8734,7 +8739,7 @@ yydefault: } case 476: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:6186 + //line php5/php5.y:6191 { if len(yyDollar[1].list) == 0 { yyDollar[1].list = []node.Node{expr.NewArrayItem(nil, nil)} @@ -8743,13 +8748,13 @@ yydefault: yyVAL.list = append(yyDollar[1].list, yyDollar[3].node) // save comments - addMeta(lastNode(yyDollar[1].list), yyDollar[2].token.Meta, meta.CommaToken) + addMeta(lastNode(yyDollar[1].list), yyDollar[2].token.Meta, meta.NodeEnd) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } case 477: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:6199 + //line php5/php5.y:6204 { if yyDollar[1].node.(*expr.ArrayItem).Key == nil && yyDollar[1].node.(*expr.ArrayItem).Val == nil { yyVAL.list = []node.Node{} @@ -8761,7 +8766,7 @@ yydefault: } case 478: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:6213 + //line php5/php5.y:6218 { yyVAL.node = expr.NewArrayItem(nil, yyDollar[1].node) @@ -8772,7 +8777,7 @@ yydefault: } case 479: yyDollar = yyS[yypt-4 : yypt+1] - //line php5/php5.y:6222 + //line php5/php5.y:6227 { item := expr.NewList(yyDollar[3].list) yyVAL.node = expr.NewArrayItem(nil, item) @@ -8790,7 +8795,7 @@ yydefault: } case 480: yyDollar = yyS[yypt-0 : yypt+1] - //line php5/php5.y:6238 + //line php5/php5.y:6243 { yyVAL.node = expr.NewArrayItem(nil, nil) @@ -8798,7 +8803,7 @@ yydefault: } case 481: yyDollar = yyS[yypt-0 : yypt+1] - //line php5/php5.y:6248 + //line php5/php5.y:6253 { yyVAL.list = []node.Node{} @@ -8806,7 +8811,7 @@ yydefault: } case 482: yyDollar = yyS[yypt-2 : yypt+1] - //line php5/php5.y:6254 + //line php5/php5.y:6259 { yyVAL.list = yyDollar[1].list @@ -8823,7 +8828,7 @@ yydefault: } case 483: yyDollar = yyS[yypt-5 : yypt+1] - //line php5/php5.y:6272 + //line php5/php5.y:6277 { arrayItem := expr.NewArrayItem(yyDollar[3].node, yyDollar[5].node) yyVAL.list = append(yyDollar[1].list, arrayItem) @@ -8839,7 +8844,7 @@ yydefault: } case 484: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:6286 + //line php5/php5.y:6291 { arrayItem := expr.NewArrayItem(nil, yyDollar[3].node) yyVAL.list = append(yyDollar[1].list, arrayItem) @@ -8854,7 +8859,7 @@ yydefault: } case 485: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:6299 + //line php5/php5.y:6304 { arrayItem := expr.NewArrayItem(yyDollar[1].node, yyDollar[3].node) yyVAL.list = []node.Node{arrayItem} @@ -8869,7 +8874,7 @@ yydefault: } case 486: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:6312 + //line php5/php5.y:6317 { arrayItem := expr.NewArrayItem(nil, yyDollar[1].node) yyVAL.list = []node.Node{arrayItem} @@ -8881,7 +8886,7 @@ yydefault: } case 487: yyDollar = yyS[yypt-6 : yypt+1] - //line php5/php5.y:6322 + //line php5/php5.y:6327 { reference := expr.NewReference(yyDollar[6].node) arrayItem := expr.NewArrayItem(yyDollar[3].node, reference) @@ -8900,7 +8905,7 @@ yydefault: } case 488: yyDollar = yyS[yypt-4 : yypt+1] - //line php5/php5.y:6339 + //line php5/php5.y:6344 { reference := expr.NewReference(yyDollar[4].node) arrayItem := expr.NewArrayItem(nil, reference) @@ -8918,7 +8923,7 @@ yydefault: } case 489: yyDollar = yyS[yypt-4 : yypt+1] - //line php5/php5.y:6355 + //line php5/php5.y:6360 { reference := expr.NewReference(yyDollar[4].node) arrayItem := expr.NewArrayItem(yyDollar[1].node, reference) @@ -8936,7 +8941,7 @@ yydefault: } case 490: yyDollar = yyS[yypt-2 : yypt+1] - //line php5/php5.y:6371 + //line php5/php5.y:6376 { reference := expr.NewReference(yyDollar[2].node) arrayItem := expr.NewArrayItem(nil, reference) @@ -8953,7 +8958,7 @@ yydefault: } case 491: yyDollar = yyS[yypt-2 : yypt+1] - //line php5/php5.y:6389 + //line php5/php5.y:6394 { yyVAL.list = append(yyDollar[1].list, yyDollar[2].node) @@ -8961,7 +8966,7 @@ yydefault: } case 492: yyDollar = yyS[yypt-2 : yypt+1] - //line php5/php5.y:6395 + //line php5/php5.y:6400 { encapsed := scalar.NewEncapsedStringPart(yyDollar[2].token.Value) yyVAL.list = append(yyDollar[1].list, encapsed) @@ -8976,7 +8981,7 @@ yydefault: } case 493: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:6408 + //line php5/php5.y:6413 { yyVAL.list = []node.Node{yyDollar[1].node} @@ -8984,7 +8989,7 @@ yydefault: } case 494: yyDollar = yyS[yypt-2 : yypt+1] - //line php5/php5.y:6414 + //line php5/php5.y:6419 { encapsed := scalar.NewEncapsedStringPart(yyDollar[1].token.Value) yyVAL.list = []node.Node{encapsed, yyDollar[2].node} @@ -8999,7 +9004,7 @@ yydefault: } case 495: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:6430 + //line php5/php5.y:6435 { name := node.NewIdentifier(strings.TrimLeftFunc(yyDollar[1].token.Value, isDollar)) yyVAL.node = expr.NewVariable(name) @@ -9015,7 +9020,7 @@ yydefault: } case 496: yyDollar = yyS[yypt-4 : yypt+1] - //line php5/php5.y:6444 + //line php5/php5.y:6449 { identifier := node.NewIdentifier(strings.TrimLeftFunc(yyDollar[1].token.Value, isDollar)) variable := expr.NewVariable(identifier) @@ -9035,7 +9040,7 @@ yydefault: } case 497: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:6462 + //line php5/php5.y:6467 { identifier := node.NewIdentifier(strings.TrimLeftFunc(yyDollar[1].token.Value, isDollar)) variable := expr.NewVariable(identifier) @@ -9051,13 +9056,13 @@ yydefault: // save comments addMeta(variable, yyDollar[1].token.Meta, meta.VariableToken) addMeta(yyVAL.node, yyDollar[2].token.Meta, meta.ObjectOperatorToken) - addMeta(fetch, yyDollar[3].token.Meta, meta.StringToken) + addMeta(fetch, yyDollar[3].token.Meta, meta.IdentifierToken) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } case 498: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:6482 + //line php5/php5.y:6487 { yyVAL.node = expr.NewVariable(yyDollar[2].node) @@ -9072,7 +9077,7 @@ yydefault: } case 499: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:6495 + //line php5/php5.y:6500 { name := node.NewIdentifier(yyDollar[2].token.Value) yyVAL.node = expr.NewVariable(name) @@ -9083,14 +9088,14 @@ yydefault: // save comments addMeta(yyVAL.node, yyDollar[1].token.Meta, meta.DollarOpenCurlyBracesToken) - addMeta(name, yyDollar[2].token.Meta, meta.StringVarnameToken) + addMeta(name, yyDollar[2].token.Meta, meta.IdentifierToken) addMeta(yyVAL.node, yyDollar[3].token.Meta, meta.CloseCurlyBracesToken) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } case 500: yyDollar = yyS[yypt-6 : yypt+1] - //line php5/php5.y:6511 + //line php5/php5.y:6516 { identifier := node.NewIdentifier(yyDollar[2].token.Value) variable := expr.NewVariable(identifier) @@ -9112,7 +9117,7 @@ yydefault: } case 501: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:6531 + //line php5/php5.y:6536 { yyVAL.node = yyDollar[2].node @@ -9120,7 +9125,7 @@ yydefault: } case 502: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:6540 + //line php5/php5.y:6545 { yyVAL.node = scalar.NewString(yyDollar[1].token.Value) @@ -9134,7 +9139,7 @@ yydefault: } case 503: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:6552 + //line php5/php5.y:6557 { // TODO: add option to handle 64 bit integer if _, err := strconv.Atoi(yyDollar[1].token.Value); err == nil { @@ -9153,7 +9158,7 @@ yydefault: } case 504: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:6569 + //line php5/php5.y:6574 { identifier := node.NewIdentifier(strings.TrimLeftFunc(yyDollar[1].token.Value, isDollar)) yyVAL.node = expr.NewVariable(identifier) @@ -9169,7 +9174,7 @@ yydefault: } case 505: yyDollar = yyS[yypt-4 : yypt+1] - //line php5/php5.y:6586 + //line php5/php5.y:6591 { yyVAL.node = expr.NewIsset(yyDollar[3].list) @@ -9185,7 +9190,7 @@ yydefault: } case 506: yyDollar = yyS[yypt-4 : yypt+1] - //line php5/php5.y:6600 + //line php5/php5.y:6605 { yyVAL.node = expr.NewEmpty(yyDollar[3].node) @@ -9201,7 +9206,7 @@ yydefault: } case 507: yyDollar = yyS[yypt-4 : yypt+1] - //line php5/php5.y:6614 + //line php5/php5.y:6619 { yyVAL.node = expr.NewEmpty(yyDollar[3].node) @@ -9217,7 +9222,7 @@ yydefault: } case 508: yyDollar = yyS[yypt-2 : yypt+1] - //line php5/php5.y:6628 + //line php5/php5.y:6633 { yyVAL.node = expr.NewInclude(yyDollar[2].node) @@ -9231,7 +9236,7 @@ yydefault: } case 509: yyDollar = yyS[yypt-2 : yypt+1] - //line php5/php5.y:6640 + //line php5/php5.y:6645 { yyVAL.node = expr.NewIncludeOnce(yyDollar[2].node) @@ -9245,7 +9250,7 @@ yydefault: } case 510: yyDollar = yyS[yypt-4 : yypt+1] - //line php5/php5.y:6652 + //line php5/php5.y:6657 { yyVAL.node = expr.NewEval(yyDollar[3].node) @@ -9261,7 +9266,7 @@ yydefault: } case 511: yyDollar = yyS[yypt-2 : yypt+1] - //line php5/php5.y:6666 + //line php5/php5.y:6671 { yyVAL.node = expr.NewRequire(yyDollar[2].node) @@ -9275,7 +9280,7 @@ yydefault: } case 512: yyDollar = yyS[yypt-2 : yypt+1] - //line php5/php5.y:6678 + //line php5/php5.y:6683 { yyVAL.node = expr.NewRequireOnce(yyDollar[2].node) @@ -9289,7 +9294,7 @@ yydefault: } case 513: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:6693 + //line php5/php5.y:6698 { yyVAL.list = []node.Node{yyDollar[1].node} @@ -9297,18 +9302,18 @@ yydefault: } case 514: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:6699 + //line php5/php5.y:6704 { yyVAL.list = append(yyDollar[1].list, yyDollar[3].node) // save comments - addMeta(lastNode(yyDollar[1].list), yyDollar[2].token.Meta, meta.CommaToken) + addMeta(lastNode(yyDollar[1].list), yyDollar[2].token.Meta, meta.NodeEnd) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } case 515: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:6711 + //line php5/php5.y:6716 { yyVAL.node = yyDollar[1].node @@ -9316,7 +9321,7 @@ yydefault: } case 516: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:6717 + //line php5/php5.y:6722 { yyVAL.node = yyDollar[1].node @@ -9324,7 +9329,7 @@ yydefault: } case 517: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:6726 + //line php5/php5.y:6731 { target := node.NewIdentifier(yyDollar[3].token.Value) yyVAL.node = expr.NewClassConstFetch(yyDollar[1].node, target) @@ -9335,12 +9340,13 @@ yydefault: // save comments addMeta(yyVAL.node, yyDollar[2].token.Meta, meta.PaamayimNekudotayimToken) + addMeta(target, yyDollar[3].token.Meta, meta.IdentifierToken) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } case 518: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:6740 + //line php5/php5.y:6746 { target := node.NewIdentifier(yyDollar[3].token.Value) yyVAL.node = expr.NewClassConstFetch(yyDollar[1].node, target) @@ -9351,12 +9357,13 @@ yydefault: // save comments addMeta(yyVAL.node, yyDollar[2].token.Meta, meta.PaamayimNekudotayimToken) + addMeta(target, yyDollar[3].token.Meta, meta.IdentifierToken) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } case 519: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:6757 + //line php5/php5.y:6764 { target := node.NewIdentifier(yyDollar[3].token.Value) yyVAL.node = expr.NewClassConstFetch(yyDollar[1].node, target) @@ -9367,12 +9374,13 @@ yydefault: // save comments addMeta(yyVAL.node, yyDollar[2].token.Meta, meta.PaamayimNekudotayimToken) + addMeta(target, yyDollar[3].token.Meta, meta.IdentifierToken) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } case 520: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:6774 + //line php5/php5.y:6782 { target := node.NewIdentifier(yyDollar[3].token.Value) yyVAL.node = expr.NewClassConstFetch(yyDollar[1].node, target) @@ -9383,6 +9391,7 @@ yydefault: // save comments addMeta(yyVAL.node, yyDollar[2].token.Meta, meta.PaamayimNekudotayimToken) + addMeta(target, yyDollar[3].token.Meta, meta.IdentifierToken) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } diff --git a/php5/php5.y b/php5/php5.y index fa5bc7e..d5c7c38 100644 --- a/php5/php5.y +++ b/php5/php5.y @@ -283,6 +283,10 @@ start: yylex.(*Parser).rootNode.SetPosition(yylex.(*Parser).positionBuilder.NewNodeListPosition($1)) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) + + if yylex.(*Parser).currentToken.Value == "\xff" { + addMeta(yylex.(*Parser).rootNode, yylex.(*Parser).currentToken.Meta, meta.NodeEnd) + } } ; @@ -443,7 +447,7 @@ top_statement: // save comments addMeta($$, $1.Meta, meta.UseToken) - addMeta(useType, $2.Meta, meta.UseToken) + addMeta(useType, $2.Meta, meta.IdentifierToken) addMeta($$, $4.Meta, meta.SemiColonToken) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) @@ -459,7 +463,7 @@ top_statement: // save comments addMeta($$, $1.Meta, meta.UseToken) - addMeta(useType, $2.Meta, meta.UseToken) + addMeta(useType, $2.Meta, meta.IdentifierToken) addMeta($$, $4.Meta, meta.SemiColonToken) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) @@ -484,7 +488,7 @@ use_declarations: $$ = append($1, $3) // save comments - addMeta(lastNode($1), $2.Meta, meta.CommaToken) + addMeta(lastNode($1), $2.Meta, meta.NodeEnd) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } @@ -521,7 +525,7 @@ use_declaration: // save comments addMeta($$, $2.Meta, meta.AsToken) - addMeta(alias, $3.Meta, meta.StringToken) + addMeta(alias, $3.Meta, meta.IdentifierToken) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } @@ -553,7 +557,7 @@ use_declaration: // save comments addMeta($$, $1.Meta, meta.NsSeparatorToken) addMeta($$, $3.Meta, meta.AsToken) - addMeta($$, $4.Meta, meta.StringToken) + addMeta(alias, $4.Meta, meta.IdentifierToken) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } @@ -565,7 +569,7 @@ use_function_declarations: $$ = append($1, $3) // save comments - addMeta(lastNode($1), $2.Meta, meta.CommaToken) + addMeta(lastNode($1), $2.Meta, meta.NodeEnd) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } @@ -602,7 +606,7 @@ use_function_declaration: // save comments addMeta($$, $2.Meta, meta.AsToken) - addMeta(alias, $3.Meta, meta.StringToken) + addMeta(alias, $3.Meta, meta.IdentifierToken) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } @@ -634,7 +638,7 @@ use_function_declaration: // save comments addMeta($$, $1.Meta, meta.NsSeparatorToken) addMeta($$, $3.Meta, meta.AsToken) - addMeta($$, $4.Meta, meta.StringToken) + addMeta(alias, $4.Meta, meta.IdentifierToken) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } @@ -646,7 +650,7 @@ use_const_declarations: $$ = append($1, $3) // save comments - addMeta(lastNode($1), $2.Meta, meta.CommaToken) + addMeta(lastNode($1), $2.Meta, meta.NodeEnd) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } @@ -683,7 +687,7 @@ use_const_declaration: // save comments addMeta($$, $2.Meta, meta.AsToken) - addMeta(alias, $3.Meta, meta.StringToken) + addMeta(alias, $3.Meta, meta.IdentifierToken) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } @@ -715,7 +719,7 @@ use_const_declaration: // save comments addMeta($$, $1.Meta, meta.NsSeparatorToken) addMeta($$, $3.Meta, meta.AsToken) - addMeta($$, $4.Meta, meta.StringToken) + addMeta(alias, $4.Meta, meta.IdentifierToken) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } @@ -737,7 +741,7 @@ constant_declaration: // save comments addMeta(lastNode(constList.Consts), $2.Meta, meta.CommaToken) - addMeta(name, $3.Meta, meta.StringToken) + addMeta(name, $3.Meta, meta.IdentifierToken) addMeta(constant, $4.Meta, meta.EqualToken) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) @@ -756,7 +760,7 @@ constant_declaration: // save comments addMeta($$, $1.Meta, meta.ConstToken) - addMeta(name, $2.Meta, meta.StringToken) + addMeta(name, $2.Meta, meta.IdentifierToken) addMeta(constant, $3.Meta, meta.EqualToken) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) @@ -842,7 +846,7 @@ statement: $$.SetPosition(yylex.(*Parser).positionBuilder.NewTokensPosition($1, $2)) // save comments - addMeta(label, $1.Meta, meta.StringToken) + addMeta(label, $1.Meta, meta.IdentifierToken) addMeta($$, $2.Meta, meta.ColonToken) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) @@ -1302,7 +1306,7 @@ unticked_statement: // save comments addMeta($$, $1.Meta, meta.GotoToken) - addMeta(label, $2.Meta, meta.StringToken) + addMeta(label, $2.Meta, meta.IdentifierToken) addMeta($$, $3.Meta, meta.SemiColonToken) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) @@ -1331,7 +1335,7 @@ catch_statement: // save comments addMeta(catch, $1.Meta, meta.CatchToken) addMeta(catch, $2.Meta, meta.OpenParenthesisToken) - addMeta(variable, $4.Meta, meta.StringToken) + addMeta(variable, $4.Meta, meta.VariableToken) addMeta(catch, $5.Meta, meta.CloseParenthesisToken) addMeta(catch, $6.Meta, meta.OpenCurlyBracesToken) addMeta(catch, $8.Meta, meta.CloseCurlyBracesToken) @@ -1408,7 +1412,7 @@ additional_catch: // save comments addMeta($$, $1.Meta, meta.CatchToken) addMeta($$, $2.Meta, meta.OpenParenthesisToken) - addMeta(variable, $4.Meta, meta.StringToken) + addMeta(variable, $4.Meta, meta.VariableToken) addMeta($$, $5.Meta, meta.CloseParenthesisToken) addMeta($$, $6.Meta, meta.OpenCurlyBracesToken) addMeta($$, $8.Meta, meta.CloseCurlyBracesToken) @@ -1429,7 +1433,7 @@ unset_variables: $$ = append($1, $3) // save comments - addMeta(lastNode($1), $2.Meta, meta.CommaToken) + addMeta(lastNode($1), $2.Meta, meta.NodeEnd) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } @@ -1499,7 +1503,7 @@ unticked_function_declaration_statement: if $2 != nil { addMeta($$, $2.Meta, meta.AmpersandToken) } - addMeta(name, $3.Meta, meta.StringToken) + addMeta(name, $3.Meta, meta.IdentifierToken) addMeta($$, $4.Meta, meta.OpenParenthesisToken) addMeta($$, $6.Meta, meta.CloseParenthesisToken) addMeta($$, $7.Meta, meta.OpenCurlyBracesToken) @@ -1532,7 +1536,7 @@ unticked_class_declaration_statement: $$.SetPosition(yylex.(*Parser).positionBuilder.NewNodeTokenPosition($1, $7)) // save comments - addMeta(name, $2.Meta, meta.StringToken) + addMeta(name, $2.Meta, meta.IdentifierToken) addMeta($$, $5.Meta, meta.OpenCurlyBracesToken) addMeta($$, $7.Meta, meta.CloseCurlyBracesToken) @@ -1548,7 +1552,7 @@ unticked_class_declaration_statement: $$.SetPosition(yylex.(*Parser).positionBuilder.NewTokensPosition($1, $6)) // save comments - addMeta(name, $2.Meta, meta.StringToken) + addMeta(name, $2.Meta, meta.IdentifierToken) addMeta($$, $4.Meta, meta.OpenCurlyBracesToken) addMeta($$, $6.Meta, meta.CloseCurlyBracesToken) @@ -1580,7 +1584,7 @@ class_entry_type: $$.SetPosition(yylex.(*Parser).positionBuilder.NewTokensPosition($1, $2)) // save comments - addMeta(classModifier, $1.Meta, meta.AbstractToken) + addMeta(classModifier, $1.Meta, meta.IdentifierToken) addMeta($$, $2.Meta, meta.ClassToken) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) @@ -1607,7 +1611,7 @@ class_entry_type: $$.SetPosition(yylex.(*Parser).positionBuilder.NewTokensPosition($1, $2)) // save comments - addMeta(classModifier, $1.Meta, meta.FinalToken) + addMeta(classModifier, $1.Meta, meta.IdentifierToken) addMeta($$, $2.Meta, meta.ClassToken) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) @@ -1696,7 +1700,7 @@ interface_list: $$ = append($1, $3) // save comments - addMeta(lastNode($1), $2.Meta, meta.CommaToken) + addMeta(lastNode($1), $2.Meta, meta.NodeEnd) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } @@ -1848,7 +1852,7 @@ declare_list: constant.SetPosition(yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $3)) // save comments - addMeta(name, $1.Meta, meta.StringToken) + addMeta(name, $1.Meta, meta.IdentifierToken) addMeta(constant, $2.Meta, meta.EqualToken) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) @@ -1865,7 +1869,7 @@ declare_list: // save comments addMeta(lastNode($1), $2.Meta, meta.CommaToken) - addMeta(name, $3.Meta, meta.StringToken) + addMeta(name, $3.Meta, meta.IdentifierToken) addMeta(constant, $4.Meta, meta.EqualToken) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) @@ -1915,8 +1919,8 @@ switch_case_list: $$.SetPosition(yylex.(*Parser).positionBuilder.NewTokensPosition($1, $4)) // save comments - addMeta(caseList, $1.Meta, meta.ColonToken) - addMeta(caseList, $3.Meta, meta.EndswitchToken) + addMeta($$, $1.Meta, meta.ColonToken) + addMeta($$, $3.Meta, meta.EndswitchToken) addMeta($$, $4.Meta, meta.SemiColonToken) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) @@ -1932,9 +1936,9 @@ switch_case_list: $$.SetPosition(yylex.(*Parser).positionBuilder.NewTokensPosition($1, $5)) // save comments - addMeta(caseList, $1.Meta, meta.ColonToken) - addMeta(caseList, $2.Meta, meta.SemiColonToken) - addMeta(caseList, $4.Meta, meta.EndswitchToken) + addMeta($$, $1.Meta, meta.ColonToken) + addMeta($$, $2.Meta, meta.SwitchSemicolonToken) + addMeta($$, $4.Meta, meta.EndswitchToken) addMeta($$, $5.Meta, meta.SemiColonToken) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) @@ -2145,7 +2149,7 @@ non_empty_parameter_list: $$ = append($1, $3) // save comments - addMeta(lastNode($1), $2.Meta, meta.CommaToken) + addMeta(lastNode($1), $2.Meta, meta.NodeEnd) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } @@ -2231,7 +2235,7 @@ optional_class_type: $$.SetPosition(yylex.(*Parser).positionBuilder.NewTokenPosition($1)) // save comments - addMeta($$, $1.Meta, meta.ArrayToken) + addMeta($$, $1.Meta, meta.IdentifierToken) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } @@ -2243,7 +2247,7 @@ optional_class_type: $$.SetPosition(yylex.(*Parser).positionBuilder.NewTokenPosition($1)) // save comments - addMeta($$, $1.Meta, meta.CallableToken) + addMeta($$, $1.Meta, meta.IdentifierToken) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } @@ -2313,7 +2317,7 @@ non_empty_function_call_parameter_list: $$ = append($1, $3) // save comments - addMeta(lastNode($1), $2.Meta, meta.CommaToken) + addMeta(lastNode($1), $2.Meta, meta.NodeEnd) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } @@ -2370,7 +2374,7 @@ global_var_list: $$ = append($1, $3) // save comments - addMeta(lastNode($1), $2.Meta, meta.CommaToken) + addMeta(lastNode($1), $2.Meta, meta.NodeEnd) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } @@ -2579,14 +2583,7 @@ class_statement: trait_use_statement: T_USE trait_list trait_adaptations { - var adaptationList *stmt.TraitAdaptationList - switch n := $3.(type) { - case *stmt.TraitAdaptationList: - adaptationList = n - default: - adaptationList = nil - } - $$ = stmt.NewTraitUse($2, adaptationList) + $$ = stmt.NewTraitUse($2, $3) // save position $$.SetPosition(yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $3)) @@ -2610,7 +2607,7 @@ trait_list: $$ = append($1, $3) // save comments - addMeta(lastNode($1), $2.Meta, meta.CommaToken) + addMeta(lastNode($1), $2.Meta, meta.NodeEnd) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } @@ -2721,7 +2718,7 @@ trait_reference_list: $$ = append($1, $3) // save comments - addMeta(lastNode($1), $2.Meta, meta.CommaToken) + addMeta(lastNode($1), $2.Meta, meta.NodeEnd) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } @@ -2857,7 +2854,7 @@ variable_modifiers: modifier.SetPosition(yylex.(*Parser).positionBuilder.NewTokenPosition($1)) // save comments - addMeta(modifier, $1.Meta, meta.VarToken) + addMeta(modifier, $1.Meta, meta.IdentifierToken) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } @@ -2902,7 +2899,7 @@ member_modifier: $$.SetPosition(yylex.(*Parser).positionBuilder.NewTokenPosition($1)) // save comments - addMeta($$, $1.Meta, meta.PublicToken) + addMeta($$, $1.Meta, meta.IdentifierToken) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } @@ -2914,7 +2911,7 @@ member_modifier: $$.SetPosition(yylex.(*Parser).positionBuilder.NewTokenPosition($1)) // save comments - addMeta($$, $1.Meta, meta.ProtectedToken) + addMeta($$, $1.Meta, meta.IdentifierToken) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } @@ -2926,7 +2923,7 @@ member_modifier: $$.SetPosition(yylex.(*Parser).positionBuilder.NewTokenPosition($1)) // save comments - addMeta($$, $1.Meta, meta.PrivateToken) + addMeta($$, $1.Meta, meta.IdentifierToken) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } @@ -2938,7 +2935,7 @@ member_modifier: $$.SetPosition(yylex.(*Parser).positionBuilder.NewTokenPosition($1)) // save comments - addMeta($$, $1.Meta, meta.StaticToken) + addMeta($$, $1.Meta, meta.IdentifierToken) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } @@ -2950,7 +2947,7 @@ member_modifier: $$.SetPosition(yylex.(*Parser).positionBuilder.NewTokenPosition($1)) // save comments - addMeta($$, $1.Meta, meta.AbstractToken) + addMeta($$, $1.Meta, meta.IdentifierToken) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } @@ -2962,7 +2959,7 @@ member_modifier: $$.SetPosition(yylex.(*Parser).positionBuilder.NewTokenPosition($1)) // save comments - addMeta($$, $1.Meta, meta.FinalToken) + addMeta($$, $1.Meta, meta.IdentifierToken) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } @@ -3090,7 +3087,7 @@ echo_expr_list: $$ = append($1, $3) // save comments - addMeta(lastNode($1), $2.Meta, meta.CommaToken) + addMeta(lastNode($1), $2.Meta, meta.NodeEnd) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } @@ -3124,7 +3121,7 @@ non_empty_for_expr: $$ = append($1, $3) // save comments - addMeta(lastNode($1), $2.Meta, meta.CommaToken) + addMeta(lastNode($1), $2.Meta, meta.NodeEnd) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } @@ -4507,7 +4504,7 @@ class_name: $$.SetPosition(yylex.(*Parser).positionBuilder.NewTokenPosition($1)) // save comments - addMeta($$, $1.Meta, meta.StaticToken) + addMeta($$, $1.Meta, meta.IdentifierToken) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } @@ -4786,7 +4783,7 @@ common_scalar: $$.SetPosition(yylex.(*Parser).positionBuilder.NewTokenPosition($1)) // save comments - addMeta($$, $1.Meta, meta.LineToken) + addMeta($$, $1.Meta, meta.MagicConstantToken) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } @@ -4798,7 +4795,7 @@ common_scalar: $$.SetPosition(yylex.(*Parser).positionBuilder.NewTokenPosition($1)) // save comments - addMeta($$, $1.Meta, meta.FileToken) + addMeta($$, $1.Meta, meta.MagicConstantToken) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } @@ -4810,7 +4807,7 @@ common_scalar: $$.SetPosition(yylex.(*Parser).positionBuilder.NewTokenPosition($1)) // save comments - addMeta($$, $1.Meta, meta.DirToken) + addMeta($$, $1.Meta, meta.MagicConstantToken) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } @@ -4822,7 +4819,7 @@ common_scalar: $$.SetPosition(yylex.(*Parser).positionBuilder.NewTokenPosition($1)) // save comments - addMeta($$, $1.Meta, meta.TraitCToken) + addMeta($$, $1.Meta, meta.MagicConstantToken) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } @@ -4834,7 +4831,7 @@ common_scalar: $$.SetPosition(yylex.(*Parser).positionBuilder.NewTokenPosition($1)) // save comments - addMeta($$, $1.Meta, meta.MethodCToken) + addMeta($$, $1.Meta, meta.MagicConstantToken) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } @@ -4846,7 +4843,7 @@ common_scalar: $$.SetPosition(yylex.(*Parser).positionBuilder.NewTokenPosition($1)) // save comments - addMeta($$, $1.Meta, meta.FuncCToken) + addMeta($$, $1.Meta, meta.MagicConstantToken) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } @@ -4858,7 +4855,7 @@ common_scalar: $$.SetPosition(yylex.(*Parser).positionBuilder.NewTokenPosition($1)) // save comments - addMeta($$, $1.Meta, meta.NsCToken) + addMeta($$, $1.Meta, meta.MagicConstantToken) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } @@ -4951,8 +4948,8 @@ static_scalar_value: $$.SetPosition(yylex.(*Parser).positionBuilder.NewTokenNodeListPosition($1, $3)) // save comments - addMeta($$, $1.Meta, meta.NamespaceToken) - addMeta($$, $2.Meta, meta.NsSeparatorToken) + addMeta(name, $1.Meta, meta.NamespaceToken) + addMeta(name, $2.Meta, meta.NsSeparatorToken) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } @@ -4966,7 +4963,7 @@ static_scalar_value: $$.SetPosition(yylex.(*Parser).positionBuilder.NewTokenNodeListPosition($1, $2)) // save comments - addMeta($$, $1.Meta, meta.NsSeparatorToken) + addMeta(name, $1.Meta, meta.NsSeparatorToken) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } @@ -5011,7 +5008,7 @@ static_scalar_value: $$.SetPosition(yylex.(*Parser).positionBuilder.NewTokenPosition($1)) // save comments - addMeta($$, $1.Meta, meta.ClassCToken) + addMeta($$, $1.Meta, meta.MagicConstantToken) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } @@ -5449,8 +5446,8 @@ general_constant: $$.SetPosition(yylex.(*Parser).positionBuilder.NewNodePosition(name)) // save comments - addMeta($$, $1.Meta, meta.NamespaceToken) - addMeta($$, $2.Meta, meta.NsSeparatorToken) + addMeta(name, $1.Meta, meta.NamespaceToken) + addMeta(name, $2.Meta, meta.NsSeparatorToken) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } @@ -5464,7 +5461,7 @@ general_constant: $$.SetPosition(yylex.(*Parser).positionBuilder.NewNodePosition(name)) // save comments - addMeta($$, $1.Meta, meta.NsSeparatorToken) + addMeta(name, $1.Meta, meta.NsSeparatorToken) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } @@ -5481,7 +5478,7 @@ scalar: $$.SetPosition(yylex.(*Parser).positionBuilder.NewTokenPosition($1)) // save comments - addMeta(name, $1.Meta, meta.StringVarnameToken) + addMeta(name, $1.Meta, meta.IdentifierToken) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } @@ -5535,7 +5532,7 @@ scalar: $$.SetPosition(yylex.(*Parser).positionBuilder.NewTokenPosition($1)) // save comments - addMeta($$, $1.Meta, meta.ClassCToken) + addMeta($$, $1.Meta, meta.MagicConstantToken) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } @@ -5643,13 +5640,21 @@ expr: parenthesis_expr: '(' expr ')' { - $$ = $2 + $$ = $2 + + // save comments + addMeta($$, $1.Meta, meta.OpenParenthesisToken) + addMeta($$, $3.Meta, meta.CloseParenthesisToken) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } | '(' yield_expr ')' { - $$ = $2 + $$ = $2 + + // save comments + addMeta($$, $1.Meta, meta.OpenParenthesisToken) + addMeta($$, $3.Meta, meta.CloseParenthesisToken) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } @@ -6129,7 +6134,7 @@ variable_name: $$.SetPosition(yylex.(*Parser).positionBuilder.NewTokenPosition($1)) // save comments - addMeta($$, $1.Meta, meta.StringToken) + addMeta($$, $1.Meta, meta.IdentifierToken) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } @@ -6191,7 +6196,7 @@ assignment_list: $$ = append($1, $3) // save comments - addMeta(lastNode($1), $2.Meta, meta.CommaToken) + addMeta(lastNode($1), $2.Meta, meta.NodeEnd) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } @@ -6474,7 +6479,7 @@ encaps_var: // save comments addMeta(variable, $1.Meta, meta.VariableToken) addMeta($$, $2.Meta, meta.ObjectOperatorToken) - addMeta(fetch, $3.Meta, meta.StringToken) + addMeta(fetch, $3.Meta, meta.IdentifierToken) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } @@ -6502,7 +6507,7 @@ encaps_var: // save comments addMeta($$, $1.Meta, meta.DollarOpenCurlyBracesToken) - addMeta(name, $2.Meta, meta.StringVarnameToken) + addMeta(name, $2.Meta, meta.IdentifierToken) addMeta($$, $3.Meta, meta.CloseCurlyBracesToken) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) @@ -6700,7 +6705,7 @@ isset_variables: $$ = append($1, $3) // save comments - addMeta(lastNode($1), $2.Meta, meta.CommaToken) + addMeta(lastNode($1), $2.Meta, meta.NodeEnd) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } @@ -6733,6 +6738,7 @@ class_constant: // save comments addMeta($$, $2.Meta, meta.PaamayimNekudotayimToken) + addMeta(target, $3.Meta, meta.IdentifierToken) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } @@ -6747,6 +6753,7 @@ class_constant: // save comments addMeta($$, $2.Meta, meta.PaamayimNekudotayimToken) + addMeta(target, $3.Meta, meta.IdentifierToken) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } @@ -6764,6 +6771,7 @@ static_class_name_scalar: // save comments addMeta($$, $2.Meta, meta.PaamayimNekudotayimToken) + addMeta(target, $3.Meta, meta.IdentifierToken) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } @@ -6781,6 +6789,7 @@ class_name_scalar: // save comments addMeta($$, $2.Meta, meta.PaamayimNekudotayimToken) + addMeta(target, $3.Meta, meta.IdentifierToken) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } diff --git a/php5/php5_test.go b/php5/php5_test.go index 4a6d106..6e47f41 100644 --- a/php5/php5_test.go +++ b/php5/php5_test.go @@ -470,8 +470,8 @@ func TestPhp5(t *testing.T) { StartPos: 10, EndPos: 11, }, - IsReference: false, Variadic: false, + IsReference: false, Expr: &expr.Variable{ Position: &position.Position{ StartLine: 2, @@ -497,8 +497,8 @@ func TestPhp5(t *testing.T) { StartPos: 14, EndPos: 18, }, - IsReference: false, Variadic: true, + IsReference: false, Expr: &expr.Variable{ Position: &position.Position{ StartLine: 2, @@ -567,8 +567,8 @@ func TestPhp5(t *testing.T) { StartPos: 29, EndPos: 30, }, - Variadic: false, IsReference: false, + Variadic: false, Expr: &expr.Variable{ Position: &position.Position{ StartLine: 3, @@ -700,8 +700,8 @@ func TestPhp5(t *testing.T) { StartPos: 57, EndPos: 61, }, - Variadic: true, IsReference: false, + Variadic: true, Expr: &expr.Variable{ Position: &position.Position{ StartLine: 4, @@ -887,8 +887,8 @@ func TestPhp5(t *testing.T) { StartPos: 100, EndPos: 101, }, - IsReference: false, Variadic: false, + IsReference: false, Expr: &expr.Variable{ Position: &position.Position{ StartLine: 6, @@ -914,8 +914,8 @@ func TestPhp5(t *testing.T) { StartPos: 104, EndPos: 108, }, - Variadic: true, IsReference: false, + Variadic: true, Expr: &expr.Variable{ Position: &position.Position{ StartLine: 6, @@ -1044,8 +1044,8 @@ func TestPhp5(t *testing.T) { StartPos: 137, EndPos: 180, }, - ReturnsRef: false, PhpDocComment: "", + ReturnsRef: false, FunctionName: &node.Identifier{ Position: &position.Position{ StartLine: 9, @@ -1383,8 +1383,8 @@ func TestPhp5(t *testing.T) { StartPos: 259, EndPos: 271, }, - ByRef: false, Variadic: false, + ByRef: false, VariableType: &name.Name{ Position: &position.Position{ StartLine: 11, @@ -1513,9 +1513,9 @@ func TestPhp5(t *testing.T) { StartPos: 294, EndPos: 340, }, + ReturnsRef: false, Static: true, PhpDocComment: "", - ReturnsRef: false, Params: []node.Node{ &node.Parameter{ Position: &position.Position{ @@ -4624,8 +4624,8 @@ func TestPhp5(t *testing.T) { StartPos: 2104, EndPos: 2120, }, - PhpDocComment: "", ReturnsRef: false, + PhpDocComment: "", FunctionName: &node.Identifier{ Position: &position.Position{ StartLine: 90, @@ -6441,6 +6441,14 @@ func TestPhp5(t *testing.T) { }, }, }, + TraitAdaptationList: &stmt.Nop{ + Position: &position.Position{ + StartLine: 142, + EndLine: 142, + StartPos: 3077, + EndPos: 3077, + }, + }, }, }, }, @@ -8626,9 +8634,9 @@ func TestPhp5(t *testing.T) { StartPos: 3963, EndPos: 3995, }, - ReturnsRef: false, Static: false, PhpDocComment: "", + ReturnsRef: false, Params: []node.Node{ &node.Parameter{ Position: &position.Position{ diff --git a/php7/php7.go b/php7/php7.go index 5109b8c..0c348de 100644 --- a/php7/php7.go +++ b/php7/php7.go @@ -18,9 +18,11 @@ import ( "github.com/z7zmey/php-parser/node/scalar" "github.com/z7zmey/php-parser/node/stmt" "github.com/z7zmey/php-parser/scanner" + + "github.com/davecgh/go-spew/spew" ) -//line php7/php7.y:22 +//line php7/php7.y:24 type yySymType struct { yys int node node.Node @@ -346,7 +348,7 @@ const yyEofCode = 1 const yyErrCode = 2 const yyInitialStackSize = 16 -//line php7/php7.y:5345 +//line php7/php7.y:5343 //line yacctab:1 var yyExca = [...]int{ @@ -2114,7 +2116,7 @@ yydefault: case 1: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:300 + //line php7/php7.y:302 { yylex.(*Parser).rootNode = node.NewRoot(yyDollar[1].list) @@ -2122,466 +2124,470 @@ yydefault: yylex.(*Parser).rootNode.SetPosition(yylex.(*Parser).positionBuilder.NewNodeListPosition(yyDollar[1].list)) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) + + if yylex.(*Parser).currentToken.Value == "\xff" { + addMeta(yylex.(*Parser).rootNode, yylex.(*Parser).currentToken.Meta, meta.NodeEnd) + } } case 2: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:311 + //line php7/php7.y:317 { yyVAL.token = yyDollar[1].token } case 3: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:311 + //line php7/php7.y:317 { yyVAL.token = yyDollar[1].token } case 4: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:311 + //line php7/php7.y:317 { yyVAL.token = yyDollar[1].token } case 5: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:311 + //line php7/php7.y:317 { yyVAL.token = yyDollar[1].token } case 6: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:311 + //line php7/php7.y:317 { yyVAL.token = yyDollar[1].token } case 7: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:311 + //line php7/php7.y:317 { yyVAL.token = yyDollar[1].token } case 8: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:311 + //line php7/php7.y:317 { yyVAL.token = yyDollar[1].token } case 9: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:311 + //line php7/php7.y:317 { yyVAL.token = yyDollar[1].token } case 10: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:312 + //line php7/php7.y:318 { yyVAL.token = yyDollar[1].token } case 11: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:312 + //line php7/php7.y:318 { yyVAL.token = yyDollar[1].token } case 12: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:312 + //line php7/php7.y:318 { yyVAL.token = yyDollar[1].token } case 13: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:312 + //line php7/php7.y:318 { yyVAL.token = yyDollar[1].token } case 14: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:312 + //line php7/php7.y:318 { yyVAL.token = yyDollar[1].token } case 15: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:312 + //line php7/php7.y:318 { yyVAL.token = yyDollar[1].token } case 16: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:312 + //line php7/php7.y:318 { yyVAL.token = yyDollar[1].token } case 17: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:312 + //line php7/php7.y:318 { yyVAL.token = yyDollar[1].token } case 18: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:312 + //line php7/php7.y:318 { yyVAL.token = yyDollar[1].token } case 19: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:312 + //line php7/php7.y:318 { yyVAL.token = yyDollar[1].token } case 20: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:312 + //line php7/php7.y:318 { yyVAL.token = yyDollar[1].token } case 21: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:312 + //line php7/php7.y:318 { yyVAL.token = yyDollar[1].token } case 22: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:313 + //line php7/php7.y:319 { yyVAL.token = yyDollar[1].token } case 23: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:313 + //line php7/php7.y:319 { yyVAL.token = yyDollar[1].token } case 24: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:313 + //line php7/php7.y:319 { yyVAL.token = yyDollar[1].token } case 25: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:313 + //line php7/php7.y:319 { yyVAL.token = yyDollar[1].token } case 26: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:313 + //line php7/php7.y:319 { yyVAL.token = yyDollar[1].token } case 27: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:313 + //line php7/php7.y:319 { yyVAL.token = yyDollar[1].token } case 28: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:313 + //line php7/php7.y:319 { yyVAL.token = yyDollar[1].token } case 29: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:313 + //line php7/php7.y:319 { yyVAL.token = yyDollar[1].token } case 30: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:313 + //line php7/php7.y:319 { yyVAL.token = yyDollar[1].token } case 31: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:313 + //line php7/php7.y:319 { yyVAL.token = yyDollar[1].token } case 32: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:314 + //line php7/php7.y:320 { yyVAL.token = yyDollar[1].token } case 33: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:314 + //line php7/php7.y:320 { yyVAL.token = yyDollar[1].token } case 34: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:314 + //line php7/php7.y:320 { yyVAL.token = yyDollar[1].token } case 35: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:314 + //line php7/php7.y:320 { yyVAL.token = yyDollar[1].token } case 36: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:314 + //line php7/php7.y:320 { yyVAL.token = yyDollar[1].token } case 37: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:314 + //line php7/php7.y:320 { yyVAL.token = yyDollar[1].token } case 38: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:314 + //line php7/php7.y:320 { yyVAL.token = yyDollar[1].token } case 39: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:314 + //line php7/php7.y:320 { yyVAL.token = yyDollar[1].token } case 40: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:314 + //line php7/php7.y:320 { yyVAL.token = yyDollar[1].token } case 41: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:314 + //line php7/php7.y:320 { yyVAL.token = yyDollar[1].token } case 42: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:315 + //line php7/php7.y:321 { yyVAL.token = yyDollar[1].token } case 43: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:315 + //line php7/php7.y:321 { yyVAL.token = yyDollar[1].token } case 44: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:315 + //line php7/php7.y:321 { yyVAL.token = yyDollar[1].token } case 45: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:315 + //line php7/php7.y:321 { yyVAL.token = yyDollar[1].token } case 46: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:315 + //line php7/php7.y:321 { yyVAL.token = yyDollar[1].token } case 47: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:315 + //line php7/php7.y:321 { yyVAL.token = yyDollar[1].token } case 48: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:315 + //line php7/php7.y:321 { yyVAL.token = yyDollar[1].token } case 49: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:315 + //line php7/php7.y:321 { yyVAL.token = yyDollar[1].token } case 50: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:315 + //line php7/php7.y:321 { yyVAL.token = yyDollar[1].token } case 51: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:315 + //line php7/php7.y:321 { yyVAL.token = yyDollar[1].token } case 52: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:315 + //line php7/php7.y:321 { yyVAL.token = yyDollar[1].token } case 53: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:316 + //line php7/php7.y:322 { yyVAL.token = yyDollar[1].token } case 54: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:316 + //line php7/php7.y:322 { yyVAL.token = yyDollar[1].token } case 55: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:316 + //line php7/php7.y:322 { yyVAL.token = yyDollar[1].token } case 56: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:316 + //line php7/php7.y:322 { yyVAL.token = yyDollar[1].token } case 57: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:316 + //line php7/php7.y:322 { yyVAL.token = yyDollar[1].token } case 58: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:316 + //line php7/php7.y:322 { yyVAL.token = yyDollar[1].token } case 59: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:316 + //line php7/php7.y:322 { yyVAL.token = yyDollar[1].token } case 60: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:316 + //line php7/php7.y:322 { yyVAL.token = yyDollar[1].token } case 61: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:317 + //line php7/php7.y:323 { yyVAL.token = yyDollar[1].token } case 62: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:317 + //line php7/php7.y:323 { yyVAL.token = yyDollar[1].token } case 63: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:317 + //line php7/php7.y:323 { yyVAL.token = yyDollar[1].token } case 64: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:317 + //line php7/php7.y:323 { yyVAL.token = yyDollar[1].token } case 65: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:317 + //line php7/php7.y:323 { yyVAL.token = yyDollar[1].token } case 66: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:317 + //line php7/php7.y:323 { yyVAL.token = yyDollar[1].token } case 67: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:317 + //line php7/php7.y:323 { yyVAL.token = yyDollar[1].token } case 68: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:317 + //line php7/php7.y:323 { yyVAL.token = yyDollar[1].token } case 69: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:322 + //line php7/php7.y:328 { yyVAL.token = yyDollar[1].token } case 70: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:325 + //line php7/php7.y:331 { yyVAL.token = yyDollar[1].token } case 71: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:325 + //line php7/php7.y:331 { yyVAL.token = yyDollar[1].token } case 72: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:325 + //line php7/php7.y:331 { yyVAL.token = yyDollar[1].token } case 73: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:325 + //line php7/php7.y:331 { yyVAL.token = yyDollar[1].token } case 74: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:325 + //line php7/php7.y:331 { yyVAL.token = yyDollar[1].token } case 75: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:325 + //line php7/php7.y:331 { yyVAL.token = yyDollar[1].token } case 76: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:330 + //line php7/php7.y:336 { yyVAL.token = yyDollar[1].token } case 77: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:334 + //line php7/php7.y:340 { yyVAL.token = yyDollar[1].token } case 78: yyDollar = yyS[yypt-2 : yypt+1] - //line php7/php7.y:341 + //line php7/php7.y:347 { if yyDollar[2].node != nil { yyVAL.list = append(yyDollar[1].list, yyDollar[2].node) @@ -2591,7 +2597,7 @@ yydefault: } case 79: yyDollar = yyS[yypt-0 : yypt+1] - //line php7/php7.y:349 + //line php7/php7.y:355 { yyVAL.list = []node.Node{} @@ -2599,7 +2605,7 @@ yydefault: } case 80: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:358 + //line php7/php7.y:364 { namePart := name.NewNamePart(yyDollar[1].token.Value) yyVAL.list = []node.Node{namePart} @@ -2614,7 +2620,7 @@ yydefault: } case 81: yyDollar = yyS[yypt-3 : yypt+1] - //line php7/php7.y:371 + //line php7/php7.y:377 { namePart := name.NewNamePart(yyDollar[3].token.Value) yyVAL.list = append(yyDollar[1].list, namePart) @@ -2630,7 +2636,7 @@ yydefault: } case 82: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:388 + //line php7/php7.y:394 { yyVAL.node = name.NewName(yyDollar[1].list) @@ -2641,7 +2647,7 @@ yydefault: } case 83: yyDollar = yyS[yypt-3 : yypt+1] - //line php7/php7.y:397 + //line php7/php7.y:403 { yyVAL.node = name.NewRelative(yyDollar[3].list) @@ -2656,7 +2662,7 @@ yydefault: } case 84: yyDollar = yyS[yypt-2 : yypt+1] - //line php7/php7.y:410 + //line php7/php7.y:416 { yyVAL.node = name.NewFullyQualified(yyDollar[2].list) @@ -2670,7 +2676,7 @@ yydefault: } case 85: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:425 + //line php7/php7.y:431 { // error yyVAL.node = nil @@ -2679,7 +2685,7 @@ yydefault: } case 86: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:432 + //line php7/php7.y:438 { yyVAL.node = yyDollar[1].node @@ -2687,7 +2693,7 @@ yydefault: } case 87: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:438 + //line php7/php7.y:444 { yyVAL.node = yyDollar[1].node @@ -2695,7 +2701,7 @@ yydefault: } case 88: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:444 + //line php7/php7.y:450 { yyVAL.node = yyDollar[1].node @@ -2703,7 +2709,7 @@ yydefault: } case 89: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:450 + //line php7/php7.y:456 { yyVAL.node = yyDollar[1].node @@ -2711,7 +2717,7 @@ yydefault: } case 90: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:456 + //line php7/php7.y:462 { yyVAL.node = yyDollar[1].node @@ -2719,7 +2725,7 @@ yydefault: } case 91: yyDollar = yyS[yypt-4 : yypt+1] - //line php7/php7.y:462 + //line php7/php7.y:468 { yyVAL.node = stmt.NewHaltCompiler() @@ -2736,7 +2742,7 @@ yydefault: } case 92: yyDollar = yyS[yypt-3 : yypt+1] - //line php7/php7.y:477 + //line php7/php7.y:483 { name := name.NewName(yyDollar[2].list) yyVAL.node = stmt.NewNamespace(name, nil) @@ -2753,7 +2759,7 @@ yydefault: } case 93: yyDollar = yyS[yypt-5 : yypt+1] - //line php7/php7.y:492 + //line php7/php7.y:498 { name := name.NewName(yyDollar[2].list) yyVAL.node = stmt.NewNamespace(name, yyDollar[4].list) @@ -2771,7 +2777,7 @@ yydefault: } case 94: yyDollar = yyS[yypt-4 : yypt+1] - //line php7/php7.y:508 + //line php7/php7.y:514 { yyVAL.node = stmt.NewNamespace(nil, yyDollar[3].list) @@ -2787,7 +2793,7 @@ yydefault: } case 95: yyDollar = yyS[yypt-3 : yypt+1] - //line php7/php7.y:522 + //line php7/php7.y:528 { yyVAL.node = yyDollar[2].node @@ -2802,7 +2808,7 @@ yydefault: } case 96: yyDollar = yyS[yypt-4 : yypt+1] - //line php7/php7.y:535 + //line php7/php7.y:541 { yyVAL.node = yyDollar[3].node.(*stmt.GroupUse).SetUseType(yyDollar[2].node) @@ -2817,7 +2823,7 @@ yydefault: } case 97: yyDollar = yyS[yypt-3 : yypt+1] - //line php7/php7.y:548 + //line php7/php7.y:554 { yyVAL.node = stmt.NewUseList(nil, yyDollar[2].list) @@ -2832,7 +2838,7 @@ yydefault: } case 98: yyDollar = yyS[yypt-4 : yypt+1] - //line php7/php7.y:561 + //line php7/php7.y:567 { yyVAL.node = stmt.NewUseList(yyDollar[2].node, yyDollar[3].list) @@ -2847,7 +2853,7 @@ yydefault: } case 99: yyDollar = yyS[yypt-3 : yypt+1] - //line php7/php7.y:574 + //line php7/php7.y:580 { yyVAL.node = stmt.NewConstList(yyDollar[2].list) @@ -2862,7 +2868,7 @@ yydefault: } case 100: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:590 + //line php7/php7.y:596 { yyVAL.node = node.NewIdentifier(yyDollar[1].token.Value) @@ -2870,13 +2876,13 @@ yydefault: yyVAL.node.SetPosition(yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token)) // save comments - addMeta(yyVAL.node, yyDollar[1].token.Meta, meta.FunctionToken) + addMeta(yyVAL.node, yyDollar[1].token.Meta, meta.IdentifierToken) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } case 101: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:602 + //line php7/php7.y:608 { yyVAL.node = node.NewIdentifier(yyDollar[1].token.Value) @@ -2884,13 +2890,13 @@ yydefault: yyVAL.node.SetPosition(yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token)) // save comments - addMeta(yyVAL.node, yyDollar[1].token.Meta, meta.ConstToken) + addMeta(yyVAL.node, yyDollar[1].token.Meta, meta.IdentifierToken) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } case 102: yyDollar = yyS[yypt-6 : yypt+1] - //line php7/php7.y:617 + //line php7/php7.y:623 { name := name.NewName(yyDollar[1].list) yyVAL.node = stmt.NewGroupUse(nil, name, yyDollar[4].list) @@ -2911,7 +2917,7 @@ yydefault: } case 103: yyDollar = yyS[yypt-7 : yypt+1] - //line php7/php7.y:636 + //line php7/php7.y:642 { name := name.NewName(yyDollar[2].list) yyVAL.node = stmt.NewGroupUse(nil, name, yyDollar[5].list) @@ -2933,7 +2939,7 @@ yydefault: } case 104: yyDollar = yyS[yypt-6 : yypt+1] - //line php7/php7.y:659 + //line php7/php7.y:665 { name := name.NewName(yyDollar[1].list) yyVAL.node = stmt.NewGroupUse(nil, name, yyDollar[4].list) @@ -2954,7 +2960,7 @@ yydefault: } case 105: yyDollar = yyS[yypt-7 : yypt+1] - //line php7/php7.y:678 + //line php7/php7.y:684 { name := name.NewName(yyDollar[2].list) yyVAL.node = stmt.NewGroupUse(nil, name, yyDollar[5].list) @@ -2976,30 +2982,30 @@ yydefault: } case 106: yyDollar = yyS[yypt-0 : yypt+1] - //line php7/php7.y:701 + //line php7/php7.y:707 { yyVAL.token = nil } case 107: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:705 + //line php7/php7.y:711 { yyVAL.token = yyDollar[1].token } case 108: yyDollar = yyS[yypt-3 : yypt+1] - //line php7/php7.y:712 + //line php7/php7.y:718 { yyVAL.list = append(yyDollar[1].list, yyDollar[3].node) // save comments - addMeta(lastNode(yyDollar[1].list), yyDollar[2].token.Meta, meta.CommaToken) + addMeta(lastNode(yyDollar[1].list), yyDollar[2].token.Meta, meta.NodeEnd) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } case 109: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:721 + //line php7/php7.y:727 { yyVAL.list = []node.Node{yyDollar[1].node} @@ -3007,18 +3013,18 @@ yydefault: } case 110: yyDollar = yyS[yypt-3 : yypt+1] - //line php7/php7.y:730 + //line php7/php7.y:736 { yyVAL.list = append(yyDollar[1].list, yyDollar[3].node) // save comments - addMeta(lastNode(yyDollar[1].list), yyDollar[2].token.Meta, meta.CommaToken) + addMeta(lastNode(yyDollar[1].list), yyDollar[2].token.Meta, meta.NodeEnd) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } case 111: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:739 + //line php7/php7.y:745 { yyVAL.list = []node.Node{yyDollar[1].node} @@ -3026,18 +3032,18 @@ yydefault: } case 112: yyDollar = yyS[yypt-3 : yypt+1] - //line php7/php7.y:748 + //line php7/php7.y:754 { yyVAL.list = append(yyDollar[1].list, yyDollar[3].node) // save comments - addMeta(lastNode(yyDollar[1].list), yyDollar[2].token.Meta, meta.CommaToken) + addMeta(lastNode(yyDollar[1].list), yyDollar[2].token.Meta, meta.NodeEnd) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } case 113: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:757 + //line php7/php7.y:763 { yyVAL.list = []node.Node{yyDollar[1].node} @@ -3045,7 +3051,7 @@ yydefault: } case 114: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:766 + //line php7/php7.y:772 { yyVAL.node = yyDollar[1].node @@ -3053,7 +3059,7 @@ yydefault: } case 115: yyDollar = yyS[yypt-2 : yypt+1] - //line php7/php7.y:772 + //line php7/php7.y:778 { yyVAL.node = yyDollar[2].node.(*stmt.Use).SetUseType(yyDollar[1].node) @@ -3061,7 +3067,7 @@ yydefault: } case 116: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:781 + //line php7/php7.y:787 { name := name.NewName(yyDollar[1].list) yyVAL.node = stmt.NewUse(nil, name, nil) @@ -3074,7 +3080,7 @@ yydefault: } case 117: yyDollar = yyS[yypt-3 : yypt+1] - //line php7/php7.y:792 + //line php7/php7.y:798 { name := name.NewName(yyDollar[1].list) alias := node.NewIdentifier(yyDollar[3].token.Value) @@ -3087,13 +3093,13 @@ yydefault: // save comments addMeta(yyVAL.node, yyDollar[2].token.Meta, meta.AsToken) - addMeta(alias, yyDollar[3].token.Meta, meta.StringToken) + addMeta(alias, yyDollar[3].token.Meta, meta.IdentifierToken) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } case 118: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:812 + //line php7/php7.y:818 { yyVAL.node = yyDollar[1].node @@ -3101,7 +3107,7 @@ yydefault: } case 119: yyDollar = yyS[yypt-2 : yypt+1] - //line php7/php7.y:818 + //line php7/php7.y:824 { yyVAL.node = yyDollar[2].node @@ -3112,18 +3118,18 @@ yydefault: } case 120: yyDollar = yyS[yypt-3 : yypt+1] - //line php7/php7.y:830 + //line php7/php7.y:836 { yyVAL.list = append(yyDollar[1].list, yyDollar[3].node) // save comments - addMeta(lastNode(yyDollar[1].list), yyDollar[2].token.Meta, meta.CommaToken) + addMeta(lastNode(yyDollar[1].list), yyDollar[2].token.Meta, meta.NodeEnd) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } case 121: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:839 + //line php7/php7.y:845 { yyVAL.list = []node.Node{yyDollar[1].node} @@ -3131,7 +3137,7 @@ yydefault: } case 122: yyDollar = yyS[yypt-2 : yypt+1] - //line php7/php7.y:848 + //line php7/php7.y:854 { if yyDollar[2].node != nil { yyVAL.list = append(yyDollar[1].list, yyDollar[2].node) @@ -3141,7 +3147,7 @@ yydefault: } case 123: yyDollar = yyS[yypt-0 : yypt+1] - //line php7/php7.y:856 + //line php7/php7.y:862 { yyVAL.list = []node.Node{} @@ -3149,7 +3155,7 @@ yydefault: } case 124: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:865 + //line php7/php7.y:871 { // error yyVAL.node = nil @@ -3158,7 +3164,7 @@ yydefault: } case 125: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:872 + //line php7/php7.y:878 { yyVAL.node = yyDollar[1].node @@ -3166,7 +3172,7 @@ yydefault: } case 126: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:878 + //line php7/php7.y:884 { yyVAL.node = yyDollar[1].node @@ -3174,7 +3180,7 @@ yydefault: } case 127: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:884 + //line php7/php7.y:890 { yyVAL.node = yyDollar[1].node @@ -3182,7 +3188,7 @@ yydefault: } case 128: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:890 + //line php7/php7.y:896 { yyVAL.node = yyDollar[1].node @@ -3190,7 +3196,7 @@ yydefault: } case 129: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:896 + //line php7/php7.y:902 { yyVAL.node = yyDollar[1].node @@ -3198,7 +3204,7 @@ yydefault: } case 130: yyDollar = yyS[yypt-4 : yypt+1] - //line php7/php7.y:902 + //line php7/php7.y:908 { yyVAL.node = stmt.NewHaltCompiler() @@ -3215,7 +3221,7 @@ yydefault: } case 131: yyDollar = yyS[yypt-3 : yypt+1] - //line php7/php7.y:919 + //line php7/php7.y:925 { yyVAL.node = stmt.NewStmtList(yyDollar[2].list) @@ -3230,7 +3236,7 @@ yydefault: } case 132: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:932 + //line php7/php7.y:938 { yyVAL.node = yyDollar[1].node @@ -3238,7 +3244,7 @@ yydefault: } case 133: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:938 + //line php7/php7.y:944 { yyVAL.node = yyDollar[1].node @@ -3246,7 +3252,7 @@ yydefault: } case 134: yyDollar = yyS[yypt-5 : yypt+1] - //line php7/php7.y:944 + //line php7/php7.y:950 { switch n := yyDollar[5].node.(type) { case *stmt.While: @@ -3269,7 +3275,7 @@ yydefault: } case 135: yyDollar = yyS[yypt-7 : yypt+1] - //line php7/php7.y:965 + //line php7/php7.y:971 { yyVAL.node = stmt.NewDo(yyDollar[2].node, yyDollar[5].node) @@ -3287,7 +3293,7 @@ yydefault: } case 136: yyDollar = yyS[yypt-9 : yypt+1] - //line php7/php7.y:981 + //line php7/php7.y:987 { switch n := yyDollar[9].node.(type) { case *stmt.For: @@ -3316,7 +3322,7 @@ yydefault: } case 137: yyDollar = yyS[yypt-5 : yypt+1] - //line php7/php7.y:1008 + //line php7/php7.y:1014 { switch n := yyDollar[5].node.(type) { case *stmt.Switch: @@ -3341,7 +3347,7 @@ yydefault: } case 138: yyDollar = yyS[yypt-3 : yypt+1] - //line php7/php7.y:1031 + //line php7/php7.y:1037 { yyVAL.node = stmt.NewBreak(yyDollar[2].node) @@ -3356,7 +3362,7 @@ yydefault: } case 139: yyDollar = yyS[yypt-3 : yypt+1] - //line php7/php7.y:1044 + //line php7/php7.y:1050 { yyVAL.node = stmt.NewContinue(yyDollar[2].node) @@ -3371,7 +3377,7 @@ yydefault: } case 140: yyDollar = yyS[yypt-3 : yypt+1] - //line php7/php7.y:1057 + //line php7/php7.y:1063 { yyVAL.node = stmt.NewReturn(yyDollar[2].node) @@ -3386,7 +3392,7 @@ yydefault: } case 141: yyDollar = yyS[yypt-3 : yypt+1] - //line php7/php7.y:1070 + //line php7/php7.y:1076 { yyVAL.node = stmt.NewGlobal(yyDollar[2].list) @@ -3401,7 +3407,7 @@ yydefault: } case 142: yyDollar = yyS[yypt-3 : yypt+1] - //line php7/php7.y:1083 + //line php7/php7.y:1089 { yyVAL.node = stmt.NewStatic(yyDollar[2].list) @@ -3416,7 +3422,7 @@ yydefault: } case 143: yyDollar = yyS[yypt-3 : yypt+1] - //line php7/php7.y:1096 + //line php7/php7.y:1102 { yyVAL.node = stmt.NewEcho(yyDollar[2].list) @@ -3431,7 +3437,7 @@ yydefault: } case 144: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:1109 + //line php7/php7.y:1115 { yyVAL.node = stmt.NewInlineHtml(yyDollar[1].token.Value) @@ -3445,7 +3451,7 @@ yydefault: } case 145: yyDollar = yyS[yypt-2 : yypt+1] - //line php7/php7.y:1121 + //line php7/php7.y:1127 { yyVAL.node = stmt.NewExpression(yyDollar[1].node) @@ -3459,7 +3465,7 @@ yydefault: } case 146: yyDollar = yyS[yypt-6 : yypt+1] - //line php7/php7.y:1133 + //line php7/php7.y:1139 { yyVAL.node = stmt.NewUnset(yyDollar[3].list) @@ -3479,7 +3485,7 @@ yydefault: } case 147: yyDollar = yyS[yypt-7 : yypt+1] - //line php7/php7.y:1151 + //line php7/php7.y:1157 { switch n := yyDollar[7].node.(type) { case *stmt.Foreach: @@ -3505,7 +3511,7 @@ yydefault: } case 148: yyDollar = yyS[yypt-9 : yypt+1] - //line php7/php7.y:1175 + //line php7/php7.y:1181 { switch n := yyDollar[9].node.(type) { case *stmt.Foreach: @@ -3534,7 +3540,7 @@ yydefault: } case 149: yyDollar = yyS[yypt-5 : yypt+1] - //line php7/php7.y:1202 + //line php7/php7.y:1208 { yyVAL.node = stmt.NewDeclare(yyDollar[3].list, yyDollar[5].node) @@ -3550,7 +3556,7 @@ yydefault: } case 150: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:1216 + //line php7/php7.y:1222 { yyVAL.node = stmt.NewNop() @@ -3564,7 +3570,7 @@ yydefault: } case 151: yyDollar = yyS[yypt-6 : yypt+1] - //line php7/php7.y:1228 + //line php7/php7.y:1234 { if yyDollar[6].node == nil { yyVAL.node = stmt.NewTry(yyDollar[3].list, yyDollar[5].list, yyDollar[6].node) @@ -3583,7 +3589,7 @@ yydefault: } case 152: yyDollar = yyS[yypt-3 : yypt+1] - //line php7/php7.y:1245 + //line php7/php7.y:1251 { yyVAL.node = stmt.NewThrow(yyDollar[2].node) @@ -3598,7 +3604,7 @@ yydefault: } case 153: yyDollar = yyS[yypt-3 : yypt+1] - //line php7/php7.y:1258 + //line php7/php7.y:1264 { label := node.NewIdentifier(yyDollar[2].token.Value) yyVAL.node = stmt.NewGoto(label) @@ -3609,14 +3615,14 @@ yydefault: // save comments addMeta(yyVAL.node, yyDollar[1].token.Meta, meta.GotoToken) - addMeta(label, yyDollar[2].token.Meta, meta.StringToken) + addMeta(label, yyDollar[2].token.Meta, meta.IdentifierToken) addMeta(yyVAL.node, yyDollar[3].token.Meta, meta.SemiColonToken) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } case 154: yyDollar = yyS[yypt-2 : yypt+1] - //line php7/php7.y:1274 + //line php7/php7.y:1280 { label := node.NewIdentifier(yyDollar[1].token.Value) yyVAL.node = stmt.NewLabel(label) @@ -3626,14 +3632,14 @@ yydefault: yyVAL.node.SetPosition(yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[2].token)) // save comments - addMeta(label, yyDollar[1].token.Meta, meta.StringToken) + addMeta(label, yyDollar[1].token.Meta, meta.IdentifierToken) addMeta(yyVAL.node, yyDollar[2].token.Meta, meta.ColonToken) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } case 155: yyDollar = yyS[yypt-0 : yypt+1] - //line php7/php7.y:1291 + //line php7/php7.y:1297 { yyVAL.list = []node.Node{} @@ -3641,7 +3647,7 @@ yydefault: } case 156: yyDollar = yyS[yypt-9 : yypt+1] - //line php7/php7.y:1297 + //line php7/php7.y:1303 { identifier := node.NewIdentifier(strings.TrimLeftFunc(yyDollar[5].token.Value, isDollar)) variable := expr.NewVariable(identifier) @@ -3656,7 +3662,7 @@ yydefault: // save comments addMeta(catch, yyDollar[2].token.Meta, meta.CatchToken) addMeta(catch, yyDollar[3].token.Meta, meta.OpenParenthesisToken) - addMeta(variable, yyDollar[5].token.Meta, meta.StringToken) + addMeta(variable, yyDollar[5].token.Meta, meta.VariableToken) addMeta(catch, yyDollar[6].token.Meta, meta.CloseParenthesisToken) addMeta(catch, yyDollar[7].token.Meta, meta.OpenCurlyBracesToken) addMeta(catch, yyDollar[9].token.Meta, meta.CloseCurlyBracesToken) @@ -3665,7 +3671,7 @@ yydefault: } case 157: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:1321 + //line php7/php7.y:1327 { yyVAL.list = []node.Node{yyDollar[1].node} @@ -3673,18 +3679,18 @@ yydefault: } case 158: yyDollar = yyS[yypt-3 : yypt+1] - //line php7/php7.y:1327 + //line php7/php7.y:1333 { yyVAL.list = append(yyDollar[1].list, yyDollar[3].node) // save comments - addMeta(lastNode(yyDollar[1].list), yyDollar[2].token.Meta, meta.VerticalBarToken) + addMeta(lastNode(yyDollar[1].list), yyDollar[2].token.Meta, meta.NodeEnd) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } case 159: yyDollar = yyS[yypt-0 : yypt+1] - //line php7/php7.y:1339 + //line php7/php7.y:1345 { yyVAL.node = nil @@ -3692,7 +3698,7 @@ yydefault: } case 160: yyDollar = yyS[yypt-4 : yypt+1] - //line php7/php7.y:1345 + //line php7/php7.y:1351 { yyVAL.node = stmt.NewFinally(yyDollar[3].list) @@ -3708,7 +3714,7 @@ yydefault: } case 161: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:1362 + //line php7/php7.y:1368 { yyVAL.list = []node.Node{yyDollar[1].node} @@ -3716,18 +3722,18 @@ yydefault: } case 162: yyDollar = yyS[yypt-3 : yypt+1] - //line php7/php7.y:1368 + //line php7/php7.y:1374 { yyVAL.list = append(yyDollar[1].list, yyDollar[3].node) // save comments - addMeta(lastNode(yyDollar[1].list), yyDollar[2].token.Meta, meta.CommaToken) + addMeta(lastNode(yyDollar[1].list), yyDollar[2].token.Meta, meta.NodeEnd) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } case 163: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:1380 + //line php7/php7.y:1386 { yyVAL.node = yyDollar[1].node @@ -3735,7 +3741,7 @@ yydefault: } case 164: yyDollar = yyS[yypt-11 : yypt+1] - //line php7/php7.y:1389 + //line php7/php7.y:1395 { name := node.NewIdentifier(yyDollar[3].token.Value) yyVAL.node = stmt.NewFunction(name, yyDollar[2].token != nil, yyDollar[6].list, yyDollar[8].node, yyDollar[10].list, yyDollar[4].str) @@ -3749,7 +3755,7 @@ yydefault: if yyDollar[2].token != nil { addMeta(yyVAL.node, yyDollar[2].token.Meta, meta.AmpersandToken) } - addMeta(name, yyDollar[3].token.Meta, meta.StringToken) + addMeta(name, yyDollar[3].token.Meta, meta.IdentifierToken) addMeta(yyVAL.node, yyDollar[5].token.Meta, meta.OpenParenthesisToken) addMeta(yyVAL.node, yyDollar[7].token.Meta, meta.CloseParenthesisToken) addMeta(yyVAL.node, yyDollar[9].token.Meta, meta.OpenCurlyBracesToken) @@ -3759,31 +3765,31 @@ yydefault: } case 165: yyDollar = yyS[yypt-0 : yypt+1] - //line php7/php7.y:1415 + //line php7/php7.y:1421 { yyVAL.token = nil } case 166: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:1419 + //line php7/php7.y:1425 { yyVAL.token = yyDollar[1].token } case 167: yyDollar = yyS[yypt-0 : yypt+1] - //line php7/php7.y:1426 + //line php7/php7.y:1432 { yyVAL.token = nil } case 168: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:1430 + //line php7/php7.y:1436 { yyVAL.token = yyDollar[1].token } case 169: yyDollar = yyS[yypt-9 : yypt+1] - //line php7/php7.y:1437 + //line php7/php7.y:1443 { name := node.NewIdentifier(yyDollar[3].token.Value) yyVAL.node = stmt.NewClass(name, yyDollar[1].list, nil, yyDollar[4].ClassExtends, yyDollar[5].ClassImplements, yyDollar[8].list, yyDollar[6].str) @@ -3794,7 +3800,7 @@ yydefault: // save comments addMeta(yyVAL.node, yyDollar[2].token.Meta, meta.ClassToken) - addMeta(name, yyDollar[3].token.Meta, meta.StringToken) + addMeta(name, yyDollar[3].token.Meta, meta.IdentifierToken) addMeta(yyVAL.node, yyDollar[7].token.Meta, meta.OpenCurlyBracesToken) addMeta(yyVAL.node, yyDollar[9].token.Meta, meta.CloseCurlyBracesToken) @@ -3802,7 +3808,7 @@ yydefault: } case 170: yyDollar = yyS[yypt-8 : yypt+1] - //line php7/php7.y:1454 + //line php7/php7.y:1460 { name := node.NewIdentifier(yyDollar[2].token.Value) yyVAL.node = stmt.NewClass(name, nil, nil, yyDollar[3].ClassExtends, yyDollar[4].ClassImplements, yyDollar[7].list, yyDollar[5].str) @@ -3813,7 +3819,7 @@ yydefault: // save comments addMeta(yyVAL.node, yyDollar[1].token.Meta, meta.ClassToken) - addMeta(name, yyDollar[2].token.Meta, meta.StringToken) + addMeta(name, yyDollar[2].token.Meta, meta.IdentifierToken) addMeta(yyVAL.node, yyDollar[6].token.Meta, meta.OpenCurlyBracesToken) addMeta(yyVAL.node, yyDollar[8].token.Meta, meta.CloseCurlyBracesToken) @@ -3821,7 +3827,7 @@ yydefault: } case 171: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:1474 + //line php7/php7.y:1480 { yyVAL.list = []node.Node{yyDollar[1].node} @@ -3829,7 +3835,7 @@ yydefault: } case 172: yyDollar = yyS[yypt-2 : yypt+1] - //line php7/php7.y:1480 + //line php7/php7.y:1486 { yyVAL.list = append(yyDollar[1].list, yyDollar[2].node) @@ -3837,7 +3843,7 @@ yydefault: } case 173: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:1489 + //line php7/php7.y:1495 { yyVAL.node = node.NewIdentifier(yyDollar[1].token.Value) @@ -3845,13 +3851,13 @@ yydefault: yyVAL.node.SetPosition(yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token)) // save comments - addMeta(yyVAL.node, yyDollar[1].token.Meta, meta.AbstractToken) + addMeta(yyVAL.node, yyDollar[1].token.Meta, meta.IdentifierToken) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } case 174: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:1501 + //line php7/php7.y:1507 { yyVAL.node = node.NewIdentifier(yyDollar[1].token.Value) @@ -3859,13 +3865,13 @@ yydefault: yyVAL.node.SetPosition(yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token)) // save comments - addMeta(yyVAL.node, yyDollar[1].token.Meta, meta.FinalToken) + addMeta(yyVAL.node, yyDollar[1].token.Meta, meta.IdentifierToken) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } case 175: yyDollar = yyS[yypt-6 : yypt+1] - //line php7/php7.y:1516 + //line php7/php7.y:1522 { name := node.NewIdentifier(yyDollar[2].token.Value) yyVAL.node = stmt.NewTrait(name, yyDollar[5].list, yyDollar[3].str) @@ -3876,7 +3882,7 @@ yydefault: // save comments addMeta(yyVAL.node, yyDollar[1].token.Meta, meta.TraitToken) - addMeta(name, yyDollar[2].token.Meta, meta.StringToken) + addMeta(name, yyDollar[2].token.Meta, meta.IdentifierToken) addMeta(yyVAL.node, yyDollar[4].token.Meta, meta.OpenCurlyBracesToken) addMeta(yyVAL.node, yyDollar[6].token.Meta, meta.CloseCurlyBracesToken) @@ -3884,7 +3890,7 @@ yydefault: } case 176: yyDollar = yyS[yypt-7 : yypt+1] - //line php7/php7.y:1536 + //line php7/php7.y:1542 { name := node.NewIdentifier(yyDollar[2].token.Value) yyVAL.node = stmt.NewInterface(name, yyDollar[3].InterfaceExtends, yyDollar[6].list, yyDollar[4].str) @@ -3895,7 +3901,7 @@ yydefault: // save comments addMeta(yyVAL.node, yyDollar[1].token.Meta, meta.InterfaceToken) - addMeta(name, yyDollar[2].token.Meta, meta.StringToken) + addMeta(name, yyDollar[2].token.Meta, meta.IdentifierToken) addMeta(yyVAL.node, yyDollar[5].token.Meta, meta.OpenCurlyBracesToken) addMeta(yyVAL.node, yyDollar[7].token.Meta, meta.CloseCurlyBracesToken) @@ -3903,7 +3909,7 @@ yydefault: } case 177: yyDollar = yyS[yypt-0 : yypt+1] - //line php7/php7.y:1556 + //line php7/php7.y:1562 { yyVAL.ClassExtends = nil @@ -3911,7 +3917,7 @@ yydefault: } case 178: yyDollar = yyS[yypt-2 : yypt+1] - //line php7/php7.y:1562 + //line php7/php7.y:1568 { yyVAL.ClassExtends = stmt.NewClassExtends(yyDollar[2].node) @@ -3925,7 +3931,7 @@ yydefault: } case 179: yyDollar = yyS[yypt-0 : yypt+1] - //line php7/php7.y:1577 + //line php7/php7.y:1583 { yyVAL.InterfaceExtends = nil @@ -3933,7 +3939,7 @@ yydefault: } case 180: yyDollar = yyS[yypt-2 : yypt+1] - //line php7/php7.y:1583 + //line php7/php7.y:1589 { yyVAL.InterfaceExtends = stmt.NewInterfaceExtends(yyDollar[2].list) @@ -3947,7 +3953,7 @@ yydefault: } case 181: yyDollar = yyS[yypt-0 : yypt+1] - //line php7/php7.y:1598 + //line php7/php7.y:1604 { yyVAL.ClassImplements = nil @@ -3955,7 +3961,7 @@ yydefault: } case 182: yyDollar = yyS[yypt-2 : yypt+1] - //line php7/php7.y:1604 + //line php7/php7.y:1610 { yyVAL.ClassImplements = stmt.NewClassImplements(yyDollar[2].list) @@ -3969,7 +3975,7 @@ yydefault: } case 183: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:1619 + //line php7/php7.y:1625 { yyVAL.node = yyDollar[1].node @@ -3977,7 +3983,7 @@ yydefault: } case 184: yyDollar = yyS[yypt-2 : yypt+1] - //line php7/php7.y:1625 + //line php7/php7.y:1631 { yyVAL.node = expr.NewReference(yyDollar[2].node) @@ -3991,7 +3997,7 @@ yydefault: } case 185: yyDollar = yyS[yypt-4 : yypt+1] - //line php7/php7.y:1637 + //line php7/php7.y:1643 { yyVAL.node = expr.NewList(yyDollar[3].list) @@ -4007,7 +4013,7 @@ yydefault: } case 186: yyDollar = yyS[yypt-3 : yypt+1] - //line php7/php7.y:1651 + //line php7/php7.y:1657 { yyVAL.node = expr.NewShortList(yyDollar[2].list) @@ -4022,7 +4028,7 @@ yydefault: } case 187: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:1667 + //line php7/php7.y:1673 { yyVAL.node = stmt.NewFor(nil, nil, nil, yyDollar[1].node) @@ -4033,7 +4039,7 @@ yydefault: } case 188: yyDollar = yyS[yypt-4 : yypt+1] - //line php7/php7.y:1676 + //line php7/php7.y:1682 { stmtList := stmt.NewStmtList(yyDollar[2].list) yyVAL.node = stmt.NewAltFor(nil, nil, nil, stmtList) @@ -4051,7 +4057,7 @@ yydefault: } case 189: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:1695 + //line php7/php7.y:1701 { yyVAL.node = stmt.NewForeach(nil, nil, nil, yyDollar[1].node) @@ -4062,7 +4068,7 @@ yydefault: } case 190: yyDollar = yyS[yypt-4 : yypt+1] - //line php7/php7.y:1704 + //line php7/php7.y:1710 { stmtList := stmt.NewStmtList(yyDollar[2].list) yyVAL.node = stmt.NewAltForeach(nil, nil, nil, stmtList) @@ -4080,7 +4086,7 @@ yydefault: } case 191: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:1723 + //line php7/php7.y:1729 { yyVAL.node = yyDollar[1].node @@ -4088,7 +4094,7 @@ yydefault: } case 192: yyDollar = yyS[yypt-4 : yypt+1] - //line php7/php7.y:1729 + //line php7/php7.y:1735 { yyVAL.node = stmt.NewStmtList(yyDollar[2].list) @@ -4104,7 +4110,7 @@ yydefault: } case 193: yyDollar = yyS[yypt-3 : yypt+1] - //line php7/php7.y:1746 + //line php7/php7.y:1752 { caseList := stmt.NewCaseList(yyDollar[2].list) yyVAL.node = stmt.NewSwitch(nil, caseList) @@ -4121,7 +4127,7 @@ yydefault: } case 194: yyDollar = yyS[yypt-4 : yypt+1] - //line php7/php7.y:1761 + //line php7/php7.y:1767 { caseList := stmt.NewCaseList(yyDollar[3].list) yyVAL.node = stmt.NewSwitch(nil, caseList) @@ -4139,7 +4145,7 @@ yydefault: } case 195: yyDollar = yyS[yypt-4 : yypt+1] - //line php7/php7.y:1777 + //line php7/php7.y:1783 { caseList := stmt.NewCaseList(yyDollar[2].list) yyVAL.node = stmt.NewAltSwitch(nil, caseList) @@ -4149,15 +4155,15 @@ yydefault: yyVAL.node.SetPosition(yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[4].token)) // save comments - addMeta(caseList, yyDollar[1].token.Meta, meta.ColonToken) - addMeta(caseList, yyDollar[3].token.Meta, meta.EndswitchToken) + addMeta(yyVAL.node, yyDollar[1].token.Meta, meta.ColonToken) + addMeta(yyVAL.node, yyDollar[3].token.Meta, meta.EndswitchToken) addMeta(yyVAL.node, yyDollar[4].token.Meta, meta.SemiColonToken) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } case 196: yyDollar = yyS[yypt-5 : yypt+1] - //line php7/php7.y:1793 + //line php7/php7.y:1799 { caseList := stmt.NewCaseList(yyDollar[3].list) @@ -4168,16 +4174,16 @@ yydefault: yyVAL.node.SetPosition(yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[5].token)) // save comments - addMeta(caseList, yyDollar[1].token.Meta, meta.ColonToken) - addMeta(caseList, yyDollar[2].token.Meta, meta.SemiColonToken) - addMeta(caseList, yyDollar[4].token.Meta, meta.EndswitchToken) + addMeta(yyVAL.node, yyDollar[1].token.Meta, meta.ColonToken) + addMeta(yyVAL.node, yyDollar[2].token.Meta, meta.SwitchSemicolonToken) + addMeta(yyVAL.node, yyDollar[4].token.Meta, meta.EndswitchToken) addMeta(yyVAL.node, yyDollar[5].token.Meta, meta.SemiColonToken) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } case 197: yyDollar = yyS[yypt-0 : yypt+1] - //line php7/php7.y:1814 + //line php7/php7.y:1820 { yyVAL.list = []node.Node{} @@ -4185,7 +4191,7 @@ yydefault: } case 198: yyDollar = yyS[yypt-5 : yypt+1] - //line php7/php7.y:1820 + //line php7/php7.y:1826 { _case := stmt.NewCase(yyDollar[3].node, yyDollar[5].list) yyVAL.list = append(yyDollar[1].list, _case) @@ -4201,7 +4207,7 @@ yydefault: } case 199: yyDollar = yyS[yypt-4 : yypt+1] - //line php7/php7.y:1834 + //line php7/php7.y:1840 { _default := stmt.NewDefault(yyDollar[4].list) yyVAL.list = append(yyDollar[1].list, _default) @@ -4217,19 +4223,19 @@ yydefault: } case 200: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:1851 + //line php7/php7.y:1857 { yyVAL.token = yyDollar[1].token } case 201: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:1855 + //line php7/php7.y:1861 { yyVAL.token = yyDollar[1].token } case 202: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:1862 + //line php7/php7.y:1868 { yyVAL.node = stmt.NewWhile(nil, yyDollar[1].node) @@ -4240,7 +4246,7 @@ yydefault: } case 203: yyDollar = yyS[yypt-4 : yypt+1] - //line php7/php7.y:1871 + //line php7/php7.y:1877 { stmtList := stmt.NewStmtList(yyDollar[2].list) yyVAL.node = stmt.NewAltWhile(nil, stmtList) @@ -4258,7 +4264,7 @@ yydefault: } case 204: yyDollar = yyS[yypt-5 : yypt+1] - //line php7/php7.y:1890 + //line php7/php7.y:1896 { yyVAL.node = stmt.NewIf(yyDollar[3].node, yyDollar[5].node, nil, nil) @@ -4274,7 +4280,7 @@ yydefault: } case 205: yyDollar = yyS[yypt-6 : yypt+1] - //line php7/php7.y:1904 + //line php7/php7.y:1910 { _elseIf := stmt.NewElseIf(yyDollar[4].node, yyDollar[6].node) yyVAL.node = yyDollar[1].node.(*stmt.If).AddElseIf(_elseIf) @@ -4292,7 +4298,7 @@ yydefault: } case 206: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:1923 + //line php7/php7.y:1929 { yyVAL.node = yyDollar[1].node @@ -4300,7 +4306,7 @@ yydefault: } case 207: yyDollar = yyS[yypt-3 : yypt+1] - //line php7/php7.y:1929 + //line php7/php7.y:1935 { _else := stmt.NewElse(yyDollar[3].node) yyVAL.node = yyDollar[1].node.(*stmt.If).SetElse(_else) @@ -4310,13 +4316,13 @@ yydefault: yyVAL.node.SetPosition(yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node)) // save comments - addMeta(yyVAL.node, yyDollar[2].token.Meta, meta.ElseToken) + addMeta(_else, yyDollar[2].token.Meta, meta.ElseToken) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } case 208: yyDollar = yyS[yypt-6 : yypt+1] - //line php7/php7.y:1946 + //line php7/php7.y:1952 { stmts := stmt.NewStmtList(yyDollar[6].list) yyVAL.node = stmt.NewAltIf(yyDollar[3].node, stmts, nil, nil) @@ -4335,7 +4341,7 @@ yydefault: } case 209: yyDollar = yyS[yypt-7 : yypt+1] - //line php7/php7.y:1963 + //line php7/php7.y:1969 { stmts := stmt.NewStmtList(yyDollar[7].list) _elseIf := stmt.NewAltElseIf(yyDollar[4].node, stmts) @@ -4355,7 +4361,7 @@ yydefault: } case 210: yyDollar = yyS[yypt-3 : yypt+1] - //line php7/php7.y:1984 + //line php7/php7.y:1990 { yyVAL.node = yyDollar[1].node @@ -4370,7 +4376,7 @@ yydefault: } case 211: yyDollar = yyS[yypt-6 : yypt+1] - //line php7/php7.y:1997 + //line php7/php7.y:2003 { stmts := stmt.NewStmtList(yyDollar[4].list) _else := stmt.NewAltElse(stmts) @@ -4391,7 +4397,7 @@ yydefault: } case 212: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:2019 + //line php7/php7.y:2025 { yyVAL.list = yyDollar[1].list @@ -4399,7 +4405,7 @@ yydefault: } case 213: yyDollar = yyS[yypt-0 : yypt+1] - //line php7/php7.y:2025 + //line php7/php7.y:2031 { yyVAL.list = nil @@ -4407,7 +4413,7 @@ yydefault: } case 214: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:2034 + //line php7/php7.y:2040 { yyVAL.list = []node.Node{yyDollar[1].node} @@ -4415,18 +4421,18 @@ yydefault: } case 215: yyDollar = yyS[yypt-3 : yypt+1] - //line php7/php7.y:2040 + //line php7/php7.y:2046 { yyVAL.list = append(yyDollar[1].list, yyDollar[3].node) // save comments - addMeta(lastNode(yyDollar[1].list), yyDollar[2].token.Meta, meta.CommaToken) + addMeta(lastNode(yyDollar[1].list), yyDollar[2].token.Meta, meta.NodeEnd) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } case 216: yyDollar = yyS[yypt-4 : yypt+1] - //line php7/php7.y:2052 + //line php7/php7.y:2058 { identifier := node.NewIdentifier(strings.TrimLeftFunc(yyDollar[4].token.Value, isDollar)) variable := expr.NewVariable(identifier) @@ -4458,7 +4464,7 @@ yydefault: } case 217: yyDollar = yyS[yypt-6 : yypt+1] - //line php7/php7.y:2082 + //line php7/php7.y:2088 { identifier := node.NewIdentifier(strings.TrimLeftFunc(yyDollar[4].token.Value, isDollar)) variable := expr.NewVariable(identifier) @@ -4491,7 +4497,7 @@ yydefault: } case 218: yyDollar = yyS[yypt-0 : yypt+1] - //line php7/php7.y:2116 + //line php7/php7.y:2122 { yyVAL.node = nil @@ -4499,7 +4505,7 @@ yydefault: } case 219: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:2122 + //line php7/php7.y:2128 { yyVAL.node = yyDollar[1].node @@ -4507,7 +4513,7 @@ yydefault: } case 220: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:2131 + //line php7/php7.y:2137 { yyVAL.node = yyDollar[1].node @@ -4515,7 +4521,7 @@ yydefault: } case 221: yyDollar = yyS[yypt-2 : yypt+1] - //line php7/php7.y:2137 + //line php7/php7.y:2143 { yyVAL.node = node.NewNullable(yyDollar[2].node) @@ -4529,7 +4535,7 @@ yydefault: } case 222: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:2152 + //line php7/php7.y:2158 { yyVAL.node = node.NewIdentifier(yyDollar[1].token.Value) @@ -4537,13 +4543,13 @@ yydefault: yyVAL.node.SetPosition(yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token)) // save comments - addMeta(yyVAL.node, yyDollar[1].token.Meta, meta.ArrayToken) + addMeta(yyVAL.node, yyDollar[1].token.Meta, meta.IdentifierToken) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } case 223: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:2164 + //line php7/php7.y:2170 { yyVAL.node = node.NewIdentifier(yyDollar[1].token.Value) @@ -4551,13 +4557,13 @@ yydefault: yyVAL.node.SetPosition(yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token)) // save comments - addMeta(yyVAL.node, yyDollar[1].token.Meta, meta.CallableToken) + addMeta(yyVAL.node, yyDollar[1].token.Meta, meta.IdentifierToken) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } case 224: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:2176 + //line php7/php7.y:2182 { yyVAL.node = yyDollar[1].node @@ -4565,7 +4571,7 @@ yydefault: } case 225: yyDollar = yyS[yypt-0 : yypt+1] - //line php7/php7.y:2185 + //line php7/php7.y:2191 { yyVAL.node = nil @@ -4573,7 +4579,7 @@ yydefault: } case 226: yyDollar = yyS[yypt-2 : yypt+1] - //line php7/php7.y:2191 + //line php7/php7.y:2197 { yyVAL.node = yyDollar[2].node @@ -4584,7 +4590,7 @@ yydefault: } case 227: yyDollar = yyS[yypt-2 : yypt+1] - //line php7/php7.y:2203 + //line php7/php7.y:2209 { yyVAL.node = node.NewArgumentList(nil) @@ -4599,7 +4605,7 @@ yydefault: } case 228: yyDollar = yyS[yypt-4 : yypt+1] - //line php7/php7.y:2216 + //line php7/php7.y:2222 { yyVAL.node = node.NewArgumentList(yyDollar[2].list) @@ -4617,7 +4623,7 @@ yydefault: } case 229: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:2235 + //line php7/php7.y:2241 { yyVAL.list = []node.Node{yyDollar[1].node} @@ -4625,18 +4631,18 @@ yydefault: } case 230: yyDollar = yyS[yypt-3 : yypt+1] - //line php7/php7.y:2241 + //line php7/php7.y:2247 { yyVAL.list = append(yyDollar[1].list, yyDollar[3].node) // save comments - addMeta(lastNode(yyDollar[1].list), yyDollar[2].token.Meta, meta.CommaToken) + addMeta(lastNode(yyDollar[1].list), yyDollar[2].token.Meta, meta.NodeEnd) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } case 231: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:2253 + //line php7/php7.y:2259 { yyVAL.node = node.NewArgument(yyDollar[1].node, false, false) @@ -4647,7 +4653,7 @@ yydefault: } case 232: yyDollar = yyS[yypt-2 : yypt+1] - //line php7/php7.y:2262 + //line php7/php7.y:2268 { yyVAL.node = node.NewArgument(yyDollar[2].node, true, false) @@ -4661,18 +4667,18 @@ yydefault: } case 233: yyDollar = yyS[yypt-3 : yypt+1] - //line php7/php7.y:2277 + //line php7/php7.y:2283 { yyVAL.list = append(yyDollar[1].list, yyDollar[3].node) // save comments - addMeta(lastNode(yyDollar[1].list), yyDollar[2].token.Meta, meta.CommaToken) + addMeta(lastNode(yyDollar[1].list), yyDollar[2].token.Meta, meta.NodeEnd) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } case 234: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:2286 + //line php7/php7.y:2292 { yyVAL.list = []node.Node{yyDollar[1].node} @@ -4680,7 +4686,7 @@ yydefault: } case 235: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:2295 + //line php7/php7.y:2301 { yyVAL.node = yyDollar[1].node @@ -4688,18 +4694,18 @@ yydefault: } case 236: yyDollar = yyS[yypt-3 : yypt+1] - //line php7/php7.y:2304 + //line php7/php7.y:2310 { yyVAL.list = append(yyDollar[1].list, yyDollar[3].node) // save comments - addMeta(lastNode(yyDollar[1].list), yyDollar[2].token.Meta, meta.CommaToken) + addMeta(lastNode(yyDollar[1].list), yyDollar[2].token.Meta, meta.NodeEnd) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } case 237: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:2313 + //line php7/php7.y:2319 { yyVAL.list = []node.Node{yyDollar[1].node} @@ -4707,7 +4713,7 @@ yydefault: } case 238: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:2322 + //line php7/php7.y:2328 { identifier := node.NewIdentifier(strings.TrimLeftFunc(yyDollar[1].token.Value, isDollar)) variable := expr.NewVariable(identifier) @@ -4725,7 +4731,7 @@ yydefault: } case 239: yyDollar = yyS[yypt-3 : yypt+1] - //line php7/php7.y:2338 + //line php7/php7.y:2344 { identifier := node.NewIdentifier(strings.TrimLeftFunc(yyDollar[1].token.Value, isDollar)) variable := expr.NewVariable(identifier) @@ -4744,7 +4750,7 @@ yydefault: } case 240: yyDollar = yyS[yypt-2 : yypt+1] - //line php7/php7.y:2358 + //line php7/php7.y:2364 { yyVAL.list = append(yyDollar[1].list, yyDollar[2].node) @@ -4752,7 +4758,7 @@ yydefault: } case 241: yyDollar = yyS[yypt-0 : yypt+1] - //line php7/php7.y:2364 + //line php7/php7.y:2370 { yyVAL.list = []node.Node{} @@ -4760,7 +4766,7 @@ yydefault: } case 242: yyDollar = yyS[yypt-3 : yypt+1] - //line php7/php7.y:2373 + //line php7/php7.y:2379 { yyVAL.node = stmt.NewPropertyList(yyDollar[1].list, yyDollar[2].list) @@ -4774,7 +4780,7 @@ yydefault: } case 243: yyDollar = yyS[yypt-4 : yypt+1] - //line php7/php7.y:2385 + //line php7/php7.y:2391 { yyVAL.node = stmt.NewClassConstList(yyDollar[1].list, yyDollar[3].list) @@ -4789,18 +4795,9 @@ yydefault: } case 244: yyDollar = yyS[yypt-3 : yypt+1] - //line php7/php7.y:2398 + //line php7/php7.y:2404 { - var adaptationList *stmt.TraitAdaptationList - - switch n := yyDollar[3].node.(type) { - case *stmt.TraitAdaptationList: - adaptationList = n - default: - adaptationList = nil - } - - yyVAL.node = stmt.NewTraitUse(yyDollar[2].list, adaptationList) + yyVAL.node = stmt.NewTraitUse(yyDollar[2].list, yyDollar[3].node) // save position yyVAL.node.SetPosition(yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[3].node)) @@ -4812,7 +4809,7 @@ yydefault: } case 245: yyDollar = yyS[yypt-10 : yypt+1] - //line php7/php7.y:2419 + //line php7/php7.y:2416 { name := node.NewIdentifier(yyDollar[4].token.Value) yyVAL.node = stmt.NewClassMethod(name, yyDollar[1].list, yyDollar[3].token != nil, yyDollar[7].list, yyDollar[9].node, yyDollar[10].node, yyDollar[5].str) @@ -4838,7 +4835,7 @@ yydefault: } case 246: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:2446 + //line php7/php7.y:2443 { yyVAL.list = []node.Node{yyDollar[1].node} @@ -4846,18 +4843,18 @@ yydefault: } case 247: yyDollar = yyS[yypt-3 : yypt+1] - //line php7/php7.y:2452 + //line php7/php7.y:2449 { yyVAL.list = append(yyDollar[1].list, yyDollar[3].node) // save comments - addMeta(lastNode(yyDollar[1].list), yyDollar[2].token.Meta, meta.CommaToken) + addMeta(lastNode(yyDollar[1].list), yyDollar[2].token.Meta, meta.NodeEnd) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } case 248: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:2464 + //line php7/php7.y:2461 { yyVAL.node = stmt.NewNop() @@ -4870,7 +4867,7 @@ yydefault: } case 249: yyDollar = yyS[yypt-2 : yypt+1] - //line php7/php7.y:2476 + //line php7/php7.y:2473 { yyVAL.node = stmt.NewTraitAdaptationList(nil) @@ -4884,7 +4881,7 @@ yydefault: } case 250: yyDollar = yyS[yypt-3 : yypt+1] - //line php7/php7.y:2488 + //line php7/php7.y:2485 { yyVAL.node = stmt.NewTraitAdaptationList(yyDollar[2].list) @@ -4898,7 +4895,7 @@ yydefault: } case 251: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:2503 + //line php7/php7.y:2500 { yyVAL.list = []node.Node{yyDollar[1].node} @@ -4906,7 +4903,7 @@ yydefault: } case 252: yyDollar = yyS[yypt-2 : yypt+1] - //line php7/php7.y:2509 + //line php7/php7.y:2506 { yyVAL.list = append(yyDollar[1].list, yyDollar[2].node) @@ -4914,7 +4911,7 @@ yydefault: } case 253: yyDollar = yyS[yypt-2 : yypt+1] - //line php7/php7.y:2518 + //line php7/php7.y:2515 { yyVAL.node = yyDollar[1].node @@ -4925,7 +4922,7 @@ yydefault: } case 254: yyDollar = yyS[yypt-2 : yypt+1] - //line php7/php7.y:2527 + //line php7/php7.y:2524 { yyVAL.node = yyDollar[1].node @@ -4936,7 +4933,7 @@ yydefault: } case 255: yyDollar = yyS[yypt-3 : yypt+1] - //line php7/php7.y:2539 + //line php7/php7.y:2536 { yyVAL.node = stmt.NewTraitUsePrecedence(yyDollar[1].node, yyDollar[3].list) @@ -4950,7 +4947,7 @@ yydefault: } case 256: yyDollar = yyS[yypt-3 : yypt+1] - //line php7/php7.y:2554 + //line php7/php7.y:2551 { alias := node.NewIdentifier(yyDollar[3].token.Value) yyVAL.node = stmt.NewTraitUseAlias(yyDollar[1].node, nil, alias) @@ -4961,13 +4958,13 @@ yydefault: // save comments addMeta(yyVAL.node, yyDollar[2].token.Meta, meta.AsToken) - addMeta(alias, yyDollar[3].token.Meta, meta.StringToken) + addMeta(alias, yyDollar[3].token.Meta, meta.IdentifierToken) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } case 257: yyDollar = yyS[yypt-3 : yypt+1] - //line php7/php7.y:2569 + //line php7/php7.y:2566 { alias := node.NewIdentifier(yyDollar[3].token.Value) yyVAL.node = stmt.NewTraitUseAlias(yyDollar[1].node, nil, alias) @@ -4978,13 +4975,13 @@ yydefault: // save comments addMeta(yyVAL.node, yyDollar[2].token.Meta, meta.AsToken) - addMeta(alias, yyDollar[3].token.Meta, meta.StringToken) + addMeta(alias, yyDollar[3].token.Meta, meta.IdentifierToken) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } case 258: yyDollar = yyS[yypt-4 : yypt+1] - //line php7/php7.y:2584 + //line php7/php7.y:2581 { alias := node.NewIdentifier(yyDollar[4].token.Value) yyVAL.node = stmt.NewTraitUseAlias(yyDollar[1].node, yyDollar[3].node, alias) @@ -5001,7 +4998,7 @@ yydefault: } case 259: yyDollar = yyS[yypt-3 : yypt+1] - //line php7/php7.y:2599 + //line php7/php7.y:2596 { yyVAL.node = stmt.NewTraitUseAlias(yyDollar[1].node, yyDollar[3].node, nil) @@ -5015,7 +5012,7 @@ yydefault: } case 260: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:2614 + //line php7/php7.y:2611 { name := node.NewIdentifier(yyDollar[1].token.Value) yyVAL.node = stmt.NewTraitMethodRef(nil, name) @@ -5031,7 +5028,7 @@ yydefault: } case 261: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:2628 + //line php7/php7.y:2625 { yyVAL.node = yyDollar[1].node @@ -5039,7 +5036,7 @@ yydefault: } case 262: yyDollar = yyS[yypt-3 : yypt+1] - //line php7/php7.y:2637 + //line php7/php7.y:2634 { target := node.NewIdentifier(yyDollar[3].token.Value) yyVAL.node = stmt.NewTraitMethodRef(yyDollar[1].node, target) @@ -5056,7 +5053,7 @@ yydefault: } case 263: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:2655 + //line php7/php7.y:2652 { yyVAL.node = stmt.NewNop() @@ -5070,7 +5067,7 @@ yydefault: } case 264: yyDollar = yyS[yypt-3 : yypt+1] - //line php7/php7.y:2667 + //line php7/php7.y:2664 { yyVAL.node = stmt.NewStmtList(yyDollar[2].list) @@ -5085,7 +5082,7 @@ yydefault: } case 265: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:2683 + //line php7/php7.y:2680 { yyVAL.list = yyDollar[1].list @@ -5093,7 +5090,7 @@ yydefault: } case 266: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:2689 + //line php7/php7.y:2686 { modifier := node.NewIdentifier(yyDollar[1].token.Value) yyVAL.list = []node.Node{modifier} @@ -5102,13 +5099,13 @@ yydefault: modifier.SetPosition(yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token)) // save comments - addMeta(modifier, yyDollar[1].token.Meta, meta.VarToken) + addMeta(modifier, yyDollar[1].token.Meta, meta.IdentifierToken) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } case 267: yyDollar = yyS[yypt-0 : yypt+1] - //line php7/php7.y:2705 + //line php7/php7.y:2702 { yyVAL.list = nil @@ -5116,7 +5113,7 @@ yydefault: } case 268: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:2711 + //line php7/php7.y:2708 { yyVAL.list = yyDollar[1].list @@ -5124,7 +5121,7 @@ yydefault: } case 269: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:2720 + //line php7/php7.y:2717 { yyVAL.list = []node.Node{yyDollar[1].node} @@ -5132,7 +5129,7 @@ yydefault: } case 270: yyDollar = yyS[yypt-2 : yypt+1] - //line php7/php7.y:2726 + //line php7/php7.y:2723 { yyVAL.list = append(yyDollar[1].list, yyDollar[2].node) @@ -5140,7 +5137,7 @@ yydefault: } case 271: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:2735 + //line php7/php7.y:2732 { yyVAL.node = node.NewIdentifier(yyDollar[1].token.Value) @@ -5148,13 +5145,13 @@ yydefault: yyVAL.node.SetPosition(yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token)) // save comments - addMeta(yyVAL.node, yyDollar[1].token.Meta, meta.PublicToken) + addMeta(yyVAL.node, yyDollar[1].token.Meta, meta.IdentifierToken) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } case 272: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:2747 + //line php7/php7.y:2744 { yyVAL.node = node.NewIdentifier(yyDollar[1].token.Value) @@ -5162,13 +5159,13 @@ yydefault: yyVAL.node.SetPosition(yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token)) // save comments - addMeta(yyVAL.node, yyDollar[1].token.Meta, meta.ProtectedToken) + addMeta(yyVAL.node, yyDollar[1].token.Meta, meta.IdentifierToken) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } case 273: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:2759 + //line php7/php7.y:2756 { yyVAL.node = node.NewIdentifier(yyDollar[1].token.Value) @@ -5176,13 +5173,13 @@ yydefault: yyVAL.node.SetPosition(yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token)) // save comments - addMeta(yyVAL.node, yyDollar[1].token.Meta, meta.PrivateToken) + addMeta(yyVAL.node, yyDollar[1].token.Meta, meta.IdentifierToken) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } case 274: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:2771 + //line php7/php7.y:2768 { yyVAL.node = node.NewIdentifier(yyDollar[1].token.Value) @@ -5190,13 +5187,13 @@ yydefault: yyVAL.node.SetPosition(yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token)) // save comments - addMeta(yyVAL.node, yyDollar[1].token.Meta, meta.StaticToken) + addMeta(yyVAL.node, yyDollar[1].token.Meta, meta.IdentifierToken) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } case 275: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:2783 + //line php7/php7.y:2780 { yyVAL.node = node.NewIdentifier(yyDollar[1].token.Value) @@ -5204,13 +5201,13 @@ yydefault: yyVAL.node.SetPosition(yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token)) // save comments - addMeta(yyVAL.node, yyDollar[1].token.Meta, meta.AbstractToken) + addMeta(yyVAL.node, yyDollar[1].token.Meta, meta.IdentifierToken) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } case 276: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:2795 + //line php7/php7.y:2792 { yyVAL.node = node.NewIdentifier(yyDollar[1].token.Value) @@ -5218,24 +5215,24 @@ yydefault: yyVAL.node.SetPosition(yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token)) // save comments - addMeta(yyVAL.node, yyDollar[1].token.Meta, meta.FinalToken) + addMeta(yyVAL.node, yyDollar[1].token.Meta, meta.IdentifierToken) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } case 277: yyDollar = yyS[yypt-3 : yypt+1] - //line php7/php7.y:2810 + //line php7/php7.y:2807 { yyVAL.list = append(yyDollar[1].list, yyDollar[3].node) // save comments - addMeta(lastNode(yyDollar[1].list), yyDollar[2].token.Meta, meta.CommaToken) + addMeta(lastNode(yyDollar[1].list), yyDollar[2].token.Meta, meta.NodeEnd) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } case 278: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:2819 + //line php7/php7.y:2816 { yyVAL.list = []node.Node{yyDollar[1].node} @@ -5243,7 +5240,7 @@ yydefault: } case 279: yyDollar = yyS[yypt-2 : yypt+1] - //line php7/php7.y:2828 + //line php7/php7.y:2825 { identifier := node.NewIdentifier(strings.TrimLeftFunc(yyDollar[1].token.Value, isDollar)) variable := expr.NewVariable(identifier) @@ -5261,7 +5258,7 @@ yydefault: } case 280: yyDollar = yyS[yypt-4 : yypt+1] - //line php7/php7.y:2844 + //line php7/php7.y:2841 { identifier := node.NewIdentifier(strings.TrimLeftFunc(yyDollar[1].token.Value, isDollar)) variable := expr.NewVariable(identifier) @@ -5280,18 +5277,18 @@ yydefault: } case 281: yyDollar = yyS[yypt-3 : yypt+1] - //line php7/php7.y:2864 + //line php7/php7.y:2861 { yyVAL.list = append(yyDollar[1].list, yyDollar[3].node) // save comments - addMeta(lastNode(yyDollar[1].list), yyDollar[2].token.Meta, meta.CommaToken) + addMeta(lastNode(yyDollar[1].list), yyDollar[2].token.Meta, meta.NodeEnd) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } case 282: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:2873 + //line php7/php7.y:2870 { yyVAL.list = []node.Node{yyDollar[1].node} @@ -5299,7 +5296,7 @@ yydefault: } case 283: yyDollar = yyS[yypt-4 : yypt+1] - //line php7/php7.y:2882 + //line php7/php7.y:2879 { name := node.NewIdentifier(yyDollar[1].token.Value) yyVAL.node = stmt.NewConstant(name, yyDollar[3].node, yyDollar[4].str) @@ -5316,7 +5313,7 @@ yydefault: } case 284: yyDollar = yyS[yypt-4 : yypt+1] - //line php7/php7.y:2900 + //line php7/php7.y:2897 { name := node.NewIdentifier(yyDollar[1].token.Value) yyVAL.node = stmt.NewConstant(name, yyDollar[3].node, yyDollar[4].str) @@ -5326,25 +5323,25 @@ yydefault: yyVAL.node.SetPosition(yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[3].node)) // save comments - addMeta(name, yyDollar[1].token.Meta, meta.StringToken) + addMeta(name, yyDollar[1].token.Meta, meta.IdentifierToken) addMeta(yyVAL.node, yyDollar[2].token.Meta, meta.EqualToken) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } case 285: yyDollar = yyS[yypt-3 : yypt+1] - //line php7/php7.y:2918 + //line php7/php7.y:2915 { yyVAL.list = append(yyDollar[1].list, yyDollar[3].node) // save comments - addMeta(lastNode(yyDollar[1].list), yyDollar[2].token.Meta, meta.CommaToken) + addMeta(lastNode(yyDollar[1].list), yyDollar[2].token.Meta, meta.NodeEnd) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } case 286: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:2927 + //line php7/php7.y:2924 { yyVAL.list = []node.Node{yyDollar[1].node} @@ -5352,7 +5349,7 @@ yydefault: } case 287: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:2936 + //line php7/php7.y:2933 { yyVAL.node = yyDollar[1].node @@ -5360,7 +5357,7 @@ yydefault: } case 288: yyDollar = yyS[yypt-0 : yypt+1] - //line php7/php7.y:2945 + //line php7/php7.y:2942 { yyVAL.list = nil @@ -5368,7 +5365,7 @@ yydefault: } case 289: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:2951 + //line php7/php7.y:2948 { yyVAL.list = yyDollar[1].list @@ -5376,18 +5373,18 @@ yydefault: } case 290: yyDollar = yyS[yypt-3 : yypt+1] - //line php7/php7.y:2960 + //line php7/php7.y:2957 { yyVAL.list = append(yyDollar[1].list, yyDollar[3].node) // save comments - addMeta(lastNode(yyDollar[1].list), yyDollar[2].token.Meta, meta.CommaToken) + addMeta(lastNode(yyDollar[1].list), yyDollar[2].token.Meta, meta.NodeEnd) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } case 291: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:2969 + //line php7/php7.y:2966 { yyVAL.list = []node.Node{yyDollar[1].node} @@ -5395,7 +5392,7 @@ yydefault: } case 292: yyDollar = yyS[yypt-8 : yypt+1] - //line php7/php7.y:2978 + //line php7/php7.y:2975 { if yyDollar[2].node != nil { yyVAL.node = stmt.NewClass(nil, nil, yyDollar[2].node.(*node.ArgumentList), yyDollar[3].ClassExtends, yyDollar[4].ClassImplements, yyDollar[7].list, yyDollar[5].str) @@ -5415,7 +5412,7 @@ yydefault: } case 293: yyDollar = yyS[yypt-3 : yypt+1] - //line php7/php7.y:2999 + //line php7/php7.y:2996 { if yyDollar[3].node != nil { yyVAL.node = expr.NewNew(yyDollar[2].node, yyDollar[3].node.(*node.ArgumentList)) @@ -5432,7 +5429,7 @@ yydefault: } case 294: yyDollar = yyS[yypt-2 : yypt+1] - //line php7/php7.y:3014 + //line php7/php7.y:3011 { yyVAL.node = expr.NewNew(yyDollar[2].node, nil) @@ -5446,7 +5443,7 @@ yydefault: } case 295: yyDollar = yyS[yypt-6 : yypt+1] - //line php7/php7.y:3029 + //line php7/php7.y:3026 { list := expr.NewList(yyDollar[3].list) yyVAL.node = assign.NewAssign(list, yyDollar[6].node) @@ -5465,7 +5462,7 @@ yydefault: } case 296: yyDollar = yyS[yypt-5 : yypt+1] - //line php7/php7.y:3046 + //line php7/php7.y:3043 { shortList := expr.NewShortList(yyDollar[2].list) yyVAL.node = assign.NewAssign(shortList, yyDollar[5].node) @@ -5483,7 +5480,7 @@ yydefault: } case 297: yyDollar = yyS[yypt-3 : yypt+1] - //line php7/php7.y:3062 + //line php7/php7.y:3059 { yyVAL.node = assign.NewAssign(yyDollar[1].node, yyDollar[3].node) @@ -5497,7 +5494,7 @@ yydefault: } case 298: yyDollar = yyS[yypt-4 : yypt+1] - //line php7/php7.y:3074 + //line php7/php7.y:3071 { yyVAL.node = assign.NewReference(yyDollar[1].node, yyDollar[4].node) @@ -5512,7 +5509,7 @@ yydefault: } case 299: yyDollar = yyS[yypt-2 : yypt+1] - //line php7/php7.y:3087 + //line php7/php7.y:3084 { yyVAL.node = expr.NewClone(yyDollar[2].node) @@ -5526,7 +5523,7 @@ yydefault: } case 300: yyDollar = yyS[yypt-3 : yypt+1] - //line php7/php7.y:3099 + //line php7/php7.y:3096 { yyVAL.node = assign.NewPlus(yyDollar[1].node, yyDollar[3].node) @@ -5540,7 +5537,7 @@ yydefault: } case 301: yyDollar = yyS[yypt-3 : yypt+1] - //line php7/php7.y:3111 + //line php7/php7.y:3108 { yyVAL.node = assign.NewMinus(yyDollar[1].node, yyDollar[3].node) @@ -5554,7 +5551,7 @@ yydefault: } case 302: yyDollar = yyS[yypt-3 : yypt+1] - //line php7/php7.y:3123 + //line php7/php7.y:3120 { yyVAL.node = assign.NewMul(yyDollar[1].node, yyDollar[3].node) @@ -5568,7 +5565,7 @@ yydefault: } case 303: yyDollar = yyS[yypt-3 : yypt+1] - //line php7/php7.y:3135 + //line php7/php7.y:3132 { yyVAL.node = assign.NewPow(yyDollar[1].node, yyDollar[3].node) @@ -5582,7 +5579,7 @@ yydefault: } case 304: yyDollar = yyS[yypt-3 : yypt+1] - //line php7/php7.y:3147 + //line php7/php7.y:3144 { yyVAL.node = assign.NewDiv(yyDollar[1].node, yyDollar[3].node) @@ -5596,7 +5593,7 @@ yydefault: } case 305: yyDollar = yyS[yypt-3 : yypt+1] - //line php7/php7.y:3159 + //line php7/php7.y:3156 { yyVAL.node = assign.NewConcat(yyDollar[1].node, yyDollar[3].node) @@ -5610,7 +5607,7 @@ yydefault: } case 306: yyDollar = yyS[yypt-3 : yypt+1] - //line php7/php7.y:3171 + //line php7/php7.y:3168 { yyVAL.node = assign.NewMod(yyDollar[1].node, yyDollar[3].node) @@ -5624,7 +5621,7 @@ yydefault: } case 307: yyDollar = yyS[yypt-3 : yypt+1] - //line php7/php7.y:3183 + //line php7/php7.y:3180 { yyVAL.node = assign.NewBitwiseAnd(yyDollar[1].node, yyDollar[3].node) @@ -5638,7 +5635,7 @@ yydefault: } case 308: yyDollar = yyS[yypt-3 : yypt+1] - //line php7/php7.y:3195 + //line php7/php7.y:3192 { yyVAL.node = assign.NewBitwiseOr(yyDollar[1].node, yyDollar[3].node) @@ -5652,7 +5649,7 @@ yydefault: } case 309: yyDollar = yyS[yypt-3 : yypt+1] - //line php7/php7.y:3207 + //line php7/php7.y:3204 { yyVAL.node = assign.NewBitwiseXor(yyDollar[1].node, yyDollar[3].node) @@ -5666,7 +5663,7 @@ yydefault: } case 310: yyDollar = yyS[yypt-3 : yypt+1] - //line php7/php7.y:3219 + //line php7/php7.y:3216 { yyVAL.node = assign.NewShiftLeft(yyDollar[1].node, yyDollar[3].node) @@ -5680,7 +5677,7 @@ yydefault: } case 311: yyDollar = yyS[yypt-3 : yypt+1] - //line php7/php7.y:3231 + //line php7/php7.y:3228 { yyVAL.node = assign.NewShiftRight(yyDollar[1].node, yyDollar[3].node) @@ -5694,7 +5691,7 @@ yydefault: } case 312: yyDollar = yyS[yypt-2 : yypt+1] - //line php7/php7.y:3243 + //line php7/php7.y:3240 { yyVAL.node = expr.NewPostInc(yyDollar[1].node) @@ -5708,7 +5705,7 @@ yydefault: } case 313: yyDollar = yyS[yypt-2 : yypt+1] - //line php7/php7.y:3255 + //line php7/php7.y:3252 { yyVAL.node = expr.NewPreInc(yyDollar[2].node) @@ -5722,7 +5719,7 @@ yydefault: } case 314: yyDollar = yyS[yypt-2 : yypt+1] - //line php7/php7.y:3267 + //line php7/php7.y:3264 { yyVAL.node = expr.NewPostDec(yyDollar[1].node) @@ -5736,7 +5733,7 @@ yydefault: } case 315: yyDollar = yyS[yypt-2 : yypt+1] - //line php7/php7.y:3279 + //line php7/php7.y:3276 { yyVAL.node = expr.NewPreDec(yyDollar[2].node) @@ -5750,7 +5747,7 @@ yydefault: } case 316: yyDollar = yyS[yypt-3 : yypt+1] - //line php7/php7.y:3291 + //line php7/php7.y:3288 { yyVAL.node = binary.NewBooleanOr(yyDollar[1].node, yyDollar[3].node) @@ -5764,7 +5761,7 @@ yydefault: } case 317: yyDollar = yyS[yypt-3 : yypt+1] - //line php7/php7.y:3303 + //line php7/php7.y:3300 { yyVAL.node = binary.NewBooleanAnd(yyDollar[1].node, yyDollar[3].node) @@ -5778,7 +5775,7 @@ yydefault: } case 318: yyDollar = yyS[yypt-3 : yypt+1] - //line php7/php7.y:3315 + //line php7/php7.y:3312 { yyVAL.node = binary.NewLogicalOr(yyDollar[1].node, yyDollar[3].node) @@ -5792,7 +5789,7 @@ yydefault: } case 319: yyDollar = yyS[yypt-3 : yypt+1] - //line php7/php7.y:3327 + //line php7/php7.y:3324 { yyVAL.node = binary.NewLogicalAnd(yyDollar[1].node, yyDollar[3].node) @@ -5806,7 +5803,7 @@ yydefault: } case 320: yyDollar = yyS[yypt-3 : yypt+1] - //line php7/php7.y:3339 + //line php7/php7.y:3336 { yyVAL.node = binary.NewLogicalXor(yyDollar[1].node, yyDollar[3].node) @@ -5820,7 +5817,7 @@ yydefault: } case 321: yyDollar = yyS[yypt-3 : yypt+1] - //line php7/php7.y:3351 + //line php7/php7.y:3348 { yyVAL.node = binary.NewBitwiseOr(yyDollar[1].node, yyDollar[3].node) @@ -5834,7 +5831,7 @@ yydefault: } case 322: yyDollar = yyS[yypt-3 : yypt+1] - //line php7/php7.y:3363 + //line php7/php7.y:3360 { yyVAL.node = binary.NewBitwiseAnd(yyDollar[1].node, yyDollar[3].node) @@ -5848,7 +5845,7 @@ yydefault: } case 323: yyDollar = yyS[yypt-3 : yypt+1] - //line php7/php7.y:3375 + //line php7/php7.y:3372 { yyVAL.node = binary.NewBitwiseXor(yyDollar[1].node, yyDollar[3].node) @@ -5862,7 +5859,7 @@ yydefault: } case 324: yyDollar = yyS[yypt-3 : yypt+1] - //line php7/php7.y:3387 + //line php7/php7.y:3384 { yyVAL.node = binary.NewConcat(yyDollar[1].node, yyDollar[3].node) @@ -5876,7 +5873,7 @@ yydefault: } case 325: yyDollar = yyS[yypt-3 : yypt+1] - //line php7/php7.y:3399 + //line php7/php7.y:3396 { yyVAL.node = binary.NewPlus(yyDollar[1].node, yyDollar[3].node) @@ -5890,7 +5887,7 @@ yydefault: } case 326: yyDollar = yyS[yypt-3 : yypt+1] - //line php7/php7.y:3411 + //line php7/php7.y:3408 { yyVAL.node = binary.NewMinus(yyDollar[1].node, yyDollar[3].node) @@ -5904,7 +5901,7 @@ yydefault: } case 327: yyDollar = yyS[yypt-3 : yypt+1] - //line php7/php7.y:3423 + //line php7/php7.y:3420 { yyVAL.node = binary.NewMul(yyDollar[1].node, yyDollar[3].node) @@ -5918,7 +5915,7 @@ yydefault: } case 328: yyDollar = yyS[yypt-3 : yypt+1] - //line php7/php7.y:3435 + //line php7/php7.y:3432 { yyVAL.node = binary.NewPow(yyDollar[1].node, yyDollar[3].node) @@ -5932,7 +5929,7 @@ yydefault: } case 329: yyDollar = yyS[yypt-3 : yypt+1] - //line php7/php7.y:3447 + //line php7/php7.y:3444 { yyVAL.node = binary.NewDiv(yyDollar[1].node, yyDollar[3].node) @@ -5946,7 +5943,7 @@ yydefault: } case 330: yyDollar = yyS[yypt-3 : yypt+1] - //line php7/php7.y:3459 + //line php7/php7.y:3456 { yyVAL.node = binary.NewMod(yyDollar[1].node, yyDollar[3].node) @@ -5960,7 +5957,7 @@ yydefault: } case 331: yyDollar = yyS[yypt-3 : yypt+1] - //line php7/php7.y:3471 + //line php7/php7.y:3468 { yyVAL.node = binary.NewShiftLeft(yyDollar[1].node, yyDollar[3].node) @@ -5974,7 +5971,7 @@ yydefault: } case 332: yyDollar = yyS[yypt-3 : yypt+1] - //line php7/php7.y:3483 + //line php7/php7.y:3480 { yyVAL.node = binary.NewShiftRight(yyDollar[1].node, yyDollar[3].node) @@ -5988,7 +5985,7 @@ yydefault: } case 333: yyDollar = yyS[yypt-2 : yypt+1] - //line php7/php7.y:3495 + //line php7/php7.y:3492 { yyVAL.node = expr.NewUnaryPlus(yyDollar[2].node) @@ -6002,7 +5999,7 @@ yydefault: } case 334: yyDollar = yyS[yypt-2 : yypt+1] - //line php7/php7.y:3507 + //line php7/php7.y:3504 { yyVAL.node = expr.NewUnaryMinus(yyDollar[2].node) @@ -6016,7 +6013,7 @@ yydefault: } case 335: yyDollar = yyS[yypt-2 : yypt+1] - //line php7/php7.y:3519 + //line php7/php7.y:3516 { yyVAL.node = expr.NewBooleanNot(yyDollar[2].node) @@ -6030,7 +6027,7 @@ yydefault: } case 336: yyDollar = yyS[yypt-2 : yypt+1] - //line php7/php7.y:3531 + //line php7/php7.y:3528 { yyVAL.node = expr.NewBitwiseNot(yyDollar[2].node) @@ -6044,7 +6041,7 @@ yydefault: } case 337: yyDollar = yyS[yypt-3 : yypt+1] - //line php7/php7.y:3543 + //line php7/php7.y:3540 { yyVAL.node = binary.NewIdentical(yyDollar[1].node, yyDollar[3].node) @@ -6058,7 +6055,7 @@ yydefault: } case 338: yyDollar = yyS[yypt-3 : yypt+1] - //line php7/php7.y:3555 + //line php7/php7.y:3552 { yyVAL.node = binary.NewNotIdentical(yyDollar[1].node, yyDollar[3].node) @@ -6072,7 +6069,7 @@ yydefault: } case 339: yyDollar = yyS[yypt-3 : yypt+1] - //line php7/php7.y:3567 + //line php7/php7.y:3564 { yyVAL.node = binary.NewEqual(yyDollar[1].node, yyDollar[3].node) @@ -6086,7 +6083,7 @@ yydefault: } case 340: yyDollar = yyS[yypt-3 : yypt+1] - //line php7/php7.y:3579 + //line php7/php7.y:3576 { yyVAL.node = binary.NewNotEqual(yyDollar[1].node, yyDollar[3].node) @@ -6100,7 +6097,7 @@ yydefault: } case 341: yyDollar = yyS[yypt-3 : yypt+1] - //line php7/php7.y:3591 + //line php7/php7.y:3588 { yyVAL.node = binary.NewSmaller(yyDollar[1].node, yyDollar[3].node) @@ -6114,7 +6111,7 @@ yydefault: } case 342: yyDollar = yyS[yypt-3 : yypt+1] - //line php7/php7.y:3603 + //line php7/php7.y:3600 { yyVAL.node = binary.NewSmallerOrEqual(yyDollar[1].node, yyDollar[3].node) @@ -6128,7 +6125,7 @@ yydefault: } case 343: yyDollar = yyS[yypt-3 : yypt+1] - //line php7/php7.y:3615 + //line php7/php7.y:3612 { yyVAL.node = binary.NewGreater(yyDollar[1].node, yyDollar[3].node) @@ -6142,7 +6139,7 @@ yydefault: } case 344: yyDollar = yyS[yypt-3 : yypt+1] - //line php7/php7.y:3627 + //line php7/php7.y:3624 { yyVAL.node = binary.NewGreaterOrEqual(yyDollar[1].node, yyDollar[3].node) @@ -6156,7 +6153,7 @@ yydefault: } case 345: yyDollar = yyS[yypt-3 : yypt+1] - //line php7/php7.y:3639 + //line php7/php7.y:3636 { yyVAL.node = binary.NewSpaceship(yyDollar[1].node, yyDollar[3].node) @@ -6170,7 +6167,7 @@ yydefault: } case 346: yyDollar = yyS[yypt-3 : yypt+1] - //line php7/php7.y:3651 + //line php7/php7.y:3648 { yyVAL.node = expr.NewInstanceOf(yyDollar[1].node, yyDollar[3].node) @@ -6184,7 +6181,7 @@ yydefault: } case 347: yyDollar = yyS[yypt-3 : yypt+1] - //line php7/php7.y:3663 + //line php7/php7.y:3660 { yyVAL.node = yyDollar[2].node @@ -6196,7 +6193,7 @@ yydefault: } case 348: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:3673 + //line php7/php7.y:3670 { yyVAL.node = yyDollar[1].node @@ -6204,7 +6201,7 @@ yydefault: } case 349: yyDollar = yyS[yypt-5 : yypt+1] - //line php7/php7.y:3679 + //line php7/php7.y:3676 { yyVAL.node = expr.NewTernary(yyDollar[1].node, yyDollar[3].node, yyDollar[5].node) @@ -6219,7 +6216,7 @@ yydefault: } case 350: yyDollar = yyS[yypt-4 : yypt+1] - //line php7/php7.y:3692 + //line php7/php7.y:3689 { yyVAL.node = expr.NewTernary(yyDollar[1].node, nil, yyDollar[4].node) @@ -6234,7 +6231,7 @@ yydefault: } case 351: yyDollar = yyS[yypt-3 : yypt+1] - //line php7/php7.y:3705 + //line php7/php7.y:3702 { yyVAL.node = binary.NewCoalesce(yyDollar[1].node, yyDollar[3].node) @@ -6248,7 +6245,7 @@ yydefault: } case 352: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:3717 + //line php7/php7.y:3714 { yyVAL.node = yyDollar[1].node @@ -6256,7 +6253,7 @@ yydefault: } case 353: yyDollar = yyS[yypt-2 : yypt+1] - //line php7/php7.y:3723 + //line php7/php7.y:3720 { yyVAL.node = cast.NewInt(yyDollar[2].node) @@ -6270,7 +6267,7 @@ yydefault: } case 354: yyDollar = yyS[yypt-2 : yypt+1] - //line php7/php7.y:3735 + //line php7/php7.y:3732 { yyVAL.node = cast.NewDouble(yyDollar[2].node) @@ -6284,7 +6281,7 @@ yydefault: } case 355: yyDollar = yyS[yypt-2 : yypt+1] - //line php7/php7.y:3747 + //line php7/php7.y:3744 { yyVAL.node = cast.NewString(yyDollar[2].node) @@ -6298,7 +6295,7 @@ yydefault: } case 356: yyDollar = yyS[yypt-2 : yypt+1] - //line php7/php7.y:3759 + //line php7/php7.y:3756 { yyVAL.node = cast.NewArray(yyDollar[2].node) @@ -6312,7 +6309,7 @@ yydefault: } case 357: yyDollar = yyS[yypt-2 : yypt+1] - //line php7/php7.y:3771 + //line php7/php7.y:3768 { yyVAL.node = cast.NewObject(yyDollar[2].node) @@ -6326,7 +6323,7 @@ yydefault: } case 358: yyDollar = yyS[yypt-2 : yypt+1] - //line php7/php7.y:3783 + //line php7/php7.y:3780 { yyVAL.node = cast.NewBool(yyDollar[2].node) @@ -6340,7 +6337,7 @@ yydefault: } case 359: yyDollar = yyS[yypt-2 : yypt+1] - //line php7/php7.y:3795 + //line php7/php7.y:3792 { yyVAL.node = cast.NewUnset(yyDollar[2].node) @@ -6354,7 +6351,7 @@ yydefault: } case 360: yyDollar = yyS[yypt-2 : yypt+1] - //line php7/php7.y:3807 + //line php7/php7.y:3804 { if strings.EqualFold(yyDollar[1].token.Value, "die") { yyVAL.node = expr.NewDie(nil) @@ -6382,7 +6379,7 @@ yydefault: } case 361: yyDollar = yyS[yypt-2 : yypt+1] - //line php7/php7.y:3833 + //line php7/php7.y:3830 { yyVAL.node = expr.NewErrorSuppress(yyDollar[2].node) @@ -6396,7 +6393,7 @@ yydefault: } case 362: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:3845 + //line php7/php7.y:3842 { yyVAL.node = yyDollar[1].node @@ -6404,7 +6401,7 @@ yydefault: } case 363: yyDollar = yyS[yypt-3 : yypt+1] - //line php7/php7.y:3851 + //line php7/php7.y:3848 { yyVAL.node = expr.NewShellExec(yyDollar[2].list) @@ -6419,7 +6416,7 @@ yydefault: } case 364: yyDollar = yyS[yypt-2 : yypt+1] - //line php7/php7.y:3864 + //line php7/php7.y:3861 { yyVAL.node = expr.NewPrint(yyDollar[2].node) @@ -6433,7 +6430,7 @@ yydefault: } case 365: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:3876 + //line php7/php7.y:3873 { yyVAL.node = expr.NewYield(nil, nil) @@ -6447,7 +6444,7 @@ yydefault: } case 366: yyDollar = yyS[yypt-2 : yypt+1] - //line php7/php7.y:3888 + //line php7/php7.y:3885 { yyVAL.node = expr.NewYield(nil, yyDollar[2].node) @@ -6461,7 +6458,7 @@ yydefault: } case 367: yyDollar = yyS[yypt-4 : yypt+1] - //line php7/php7.y:3900 + //line php7/php7.y:3897 { yyVAL.node = expr.NewYield(yyDollar[2].node, yyDollar[4].node) @@ -6476,7 +6473,7 @@ yydefault: } case 368: yyDollar = yyS[yypt-2 : yypt+1] - //line php7/php7.y:3913 + //line php7/php7.y:3910 { yyVAL.node = expr.NewYieldFrom(yyDollar[2].node) @@ -6490,7 +6487,7 @@ yydefault: } case 369: yyDollar = yyS[yypt-11 : yypt+1] - //line php7/php7.y:3925 + //line php7/php7.y:3922 { yyVAL.node = expr.NewClosure(yyDollar[5].list, yyDollar[7].ClosureUse, yyDollar[8].node, yyDollar[10].list, false, yyDollar[2].token != nil, yyDollar[3].str) @@ -6511,7 +6508,7 @@ yydefault: } case 370: yyDollar = yyS[yypt-12 : yypt+1] - //line php7/php7.y:3944 + //line php7/php7.y:3941 { yyVAL.node = expr.NewClosure(yyDollar[6].list, yyDollar[8].ClosureUse, yyDollar[9].node, yyDollar[11].list, true, yyDollar[3].token != nil, yyDollar[4].str) @@ -6533,7 +6530,7 @@ yydefault: } case 371: yyDollar = yyS[yypt-0 : yypt+1] - //line php7/php7.y:3967 + //line php7/php7.y:3964 { yyVAL.str = yylex.(*Parser).PhpDocComment yylex.(*Parser).PhpDocComment = "" @@ -6542,19 +6539,19 @@ yydefault: } case 372: yyDollar = yyS[yypt-0 : yypt+1] - //line php7/php7.y:3977 + //line php7/php7.y:3974 { yyVAL.token = nil } case 373: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:3981 + //line php7/php7.y:3978 { yyVAL.token = yyDollar[1].token } case 374: yyDollar = yyS[yypt-0 : yypt+1] - //line php7/php7.y:3988 + //line php7/php7.y:3985 { yyVAL.ClosureUse = nil @@ -6562,7 +6559,7 @@ yydefault: } case 375: yyDollar = yyS[yypt-4 : yypt+1] - //line php7/php7.y:3994 + //line php7/php7.y:3991 { yyVAL.ClosureUse = expr.NewClosureUse(yyDollar[3].list) @@ -6578,18 +6575,18 @@ yydefault: } case 376: yyDollar = yyS[yypt-3 : yypt+1] - //line php7/php7.y:4011 + //line php7/php7.y:4008 { yyVAL.list = append(yyDollar[1].list, yyDollar[3].node) // save comments - addMeta(lastNode(yyDollar[1].list), yyDollar[2].token.Meta, meta.CommaToken) + addMeta(lastNode(yyDollar[1].list), yyDollar[2].token.Meta, meta.NodeEnd) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } case 377: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:4020 + //line php7/php7.y:4017 { yyVAL.list = []node.Node{yyDollar[1].node} @@ -6597,7 +6594,7 @@ yydefault: } case 378: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:4029 + //line php7/php7.y:4026 { identifier := node.NewIdentifier(strings.TrimLeftFunc(yyDollar[1].token.Value, isDollar)) yyVAL.node = expr.NewVariable(identifier) @@ -6613,7 +6610,7 @@ yydefault: } case 379: yyDollar = yyS[yypt-2 : yypt+1] - //line php7/php7.y:4043 + //line php7/php7.y:4040 { identifier := node.NewIdentifier(strings.TrimLeftFunc(yyDollar[2].token.Value, isDollar)) variable := expr.NewVariable(identifier) @@ -6632,7 +6629,7 @@ yydefault: } case 380: yyDollar = yyS[yypt-2 : yypt+1] - //line php7/php7.y:4063 + //line php7/php7.y:4060 { yyVAL.node = expr.NewFunctionCall(yyDollar[1].node, yyDollar[2].node.(*node.ArgumentList)) @@ -6643,7 +6640,7 @@ yydefault: } case 381: yyDollar = yyS[yypt-4 : yypt+1] - //line php7/php7.y:4072 + //line php7/php7.y:4069 { yyVAL.node = expr.NewStaticCall(yyDollar[1].node, yyDollar[3].node, yyDollar[4].node.(*node.ArgumentList)) @@ -6657,7 +6654,7 @@ yydefault: } case 382: yyDollar = yyS[yypt-4 : yypt+1] - //line php7/php7.y:4084 + //line php7/php7.y:4081 { yyVAL.node = expr.NewStaticCall(yyDollar[1].node, yyDollar[3].node, yyDollar[4].node.(*node.ArgumentList)) @@ -6671,7 +6668,7 @@ yydefault: } case 383: yyDollar = yyS[yypt-2 : yypt+1] - //line php7/php7.y:4096 + //line php7/php7.y:4093 { yyVAL.node = expr.NewFunctionCall(yyDollar[1].node, yyDollar[2].node.(*node.ArgumentList)) @@ -6682,7 +6679,7 @@ yydefault: } case 384: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:4108 + //line php7/php7.y:4105 { yyVAL.node = node.NewIdentifier(yyDollar[1].token.Value) @@ -6690,13 +6687,13 @@ yydefault: yyVAL.node.SetPosition(yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token)) // save comments - addMeta(yyVAL.node, yyDollar[1].token.Meta, meta.StaticToken) + addMeta(yyVAL.node, yyDollar[1].token.Meta, meta.IdentifierToken) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } case 385: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:4120 + //line php7/php7.y:4117 { yyVAL.node = yyDollar[1].node @@ -6704,7 +6701,7 @@ yydefault: } case 386: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:4129 + //line php7/php7.y:4126 { yyVAL.node = yyDollar[1].node @@ -6712,7 +6709,7 @@ yydefault: } case 387: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:4135 + //line php7/php7.y:4132 { yyVAL.node = yyDollar[1].node @@ -6720,7 +6717,7 @@ yydefault: } case 388: yyDollar = yyS[yypt-0 : yypt+1] - //line php7/php7.y:4144 + //line php7/php7.y:4141 { yyVAL.node = nil @@ -6728,7 +6725,7 @@ yydefault: } case 389: yyDollar = yyS[yypt-3 : yypt+1] - //line php7/php7.y:4150 + //line php7/php7.y:4147 { yyVAL.node = expr.NewExit(yyDollar[2].node) @@ -6736,14 +6733,14 @@ yydefault: yyVAL.node.SetPosition(yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[3].token)) // save comments - addMeta(yyVAL.node, yyDollar[1].token.Meta, meta.OpenParenthesisToken) - addMeta(yyVAL.node, yyDollar[3].token.Meta, meta.CloseParenthesisToken) + addMeta(yyDollar[2].node, yyDollar[1].token.Meta, meta.OpenParenthesisToken) + addMeta(yyDollar[2].node, yyDollar[3].token.Meta, meta.CloseParenthesisToken) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } case 390: yyDollar = yyS[yypt-0 : yypt+1] - //line php7/php7.y:4166 + //line php7/php7.y:4163 { yyVAL.list = []node.Node{} @@ -6751,7 +6748,7 @@ yydefault: } case 391: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:4172 + //line php7/php7.y:4169 { yyVAL.list = []node.Node{scalar.NewEncapsedStringPart(yyDollar[1].token.Value)} @@ -6759,7 +6756,7 @@ yydefault: } case 392: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:4178 + //line php7/php7.y:4175 { yyVAL.list = yyDollar[1].list @@ -6767,7 +6764,7 @@ yydefault: } case 393: yyDollar = yyS[yypt-0 : yypt+1] - //line php7/php7.y:4187 + //line php7/php7.y:4184 { yyVAL.node = nil @@ -6775,7 +6772,7 @@ yydefault: } case 394: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:4193 + //line php7/php7.y:4190 { yyVAL.node = yyDollar[1].node @@ -6783,7 +6780,7 @@ yydefault: } case 395: yyDollar = yyS[yypt-4 : yypt+1] - //line php7/php7.y:4202 + //line php7/php7.y:4199 { yyVAL.node = expr.NewArray(yyDollar[3].list) @@ -6799,7 +6796,7 @@ yydefault: } case 396: yyDollar = yyS[yypt-3 : yypt+1] - //line php7/php7.y:4216 + //line php7/php7.y:4213 { yyVAL.node = expr.NewShortArray(yyDollar[2].list) @@ -6814,7 +6811,7 @@ yydefault: } case 397: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:4229 + //line php7/php7.y:4226 { yyVAL.node = scalar.NewString(yyDollar[1].token.Value) @@ -6828,7 +6825,7 @@ yydefault: } case 398: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:4244 + //line php7/php7.y:4241 { yyVAL.node = scalar.NewLnumber(yyDollar[1].token.Value) @@ -6842,7 +6839,7 @@ yydefault: } case 399: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:4256 + //line php7/php7.y:4253 { yyVAL.node = scalar.NewDnumber(yyDollar[1].token.Value) @@ -6856,7 +6853,7 @@ yydefault: } case 400: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:4268 + //line php7/php7.y:4265 { yyVAL.node = scalar.NewMagicConstant(yyDollar[1].token.Value) @@ -6864,13 +6861,13 @@ yydefault: yyVAL.node.SetPosition(yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token)) // save comments - addMeta(yyVAL.node, yyDollar[1].token.Meta, meta.LineToken) + addMeta(yyVAL.node, yyDollar[1].token.Meta, meta.MagicConstantToken) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } case 401: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:4280 + //line php7/php7.y:4277 { yyVAL.node = scalar.NewMagicConstant(yyDollar[1].token.Value) @@ -6878,13 +6875,13 @@ yydefault: yyVAL.node.SetPosition(yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token)) // save comments - addMeta(yyVAL.node, yyDollar[1].token.Meta, meta.FileToken) + addMeta(yyVAL.node, yyDollar[1].token.Meta, meta.MagicConstantToken) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } case 402: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:4292 + //line php7/php7.y:4289 { yyVAL.node = scalar.NewMagicConstant(yyDollar[1].token.Value) @@ -6892,13 +6889,13 @@ yydefault: yyVAL.node.SetPosition(yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token)) // save comments - addMeta(yyVAL.node, yyDollar[1].token.Meta, meta.DirToken) + addMeta(yyVAL.node, yyDollar[1].token.Meta, meta.MagicConstantToken) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } case 403: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:4304 + //line php7/php7.y:4301 { yyVAL.node = scalar.NewMagicConstant(yyDollar[1].token.Value) @@ -6906,13 +6903,13 @@ yydefault: yyVAL.node.SetPosition(yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token)) // save comments - addMeta(yyVAL.node, yyDollar[1].token.Meta, meta.TraitCToken) + addMeta(yyVAL.node, yyDollar[1].token.Meta, meta.MagicConstantToken) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } case 404: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:4316 + //line php7/php7.y:4313 { yyVAL.node = scalar.NewMagicConstant(yyDollar[1].token.Value) @@ -6920,13 +6917,13 @@ yydefault: yyVAL.node.SetPosition(yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token)) // save comments - addMeta(yyVAL.node, yyDollar[1].token.Meta, meta.MethodCToken) + addMeta(yyVAL.node, yyDollar[1].token.Meta, meta.MagicConstantToken) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } case 405: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:4328 + //line php7/php7.y:4325 { yyVAL.node = scalar.NewMagicConstant(yyDollar[1].token.Value) @@ -6934,13 +6931,13 @@ yydefault: yyVAL.node.SetPosition(yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token)) // save comments - addMeta(yyVAL.node, yyDollar[1].token.Meta, meta.FuncCToken) + addMeta(yyVAL.node, yyDollar[1].token.Meta, meta.MagicConstantToken) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } case 406: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:4340 + //line php7/php7.y:4337 { yyVAL.node = scalar.NewMagicConstant(yyDollar[1].token.Value) @@ -6948,13 +6945,13 @@ yydefault: yyVAL.node.SetPosition(yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token)) // save comments - addMeta(yyVAL.node, yyDollar[1].token.Meta, meta.NsCToken) + addMeta(yyVAL.node, yyDollar[1].token.Meta, meta.MagicConstantToken) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } case 407: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:4352 + //line php7/php7.y:4349 { yyVAL.node = scalar.NewMagicConstant(yyDollar[1].token.Value) @@ -6962,13 +6959,13 @@ yydefault: yyVAL.node.SetPosition(yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token)) // save comments - addMeta(yyVAL.node, yyDollar[1].token.Meta, meta.ClassCToken) + addMeta(yyVAL.node, yyDollar[1].token.Meta, meta.MagicConstantToken) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } case 408: yyDollar = yyS[yypt-3 : yypt+1] - //line php7/php7.y:4364 + //line php7/php7.y:4361 { encapsed := scalar.NewEncapsedStringPart(yyDollar[2].token.Value) yyVAL.node = scalar.NewHeredoc(yyDollar[1].token.Value, []node.Node{encapsed}) @@ -6984,7 +6981,7 @@ yydefault: } case 409: yyDollar = yyS[yypt-2 : yypt+1] - //line php7/php7.y:4378 + //line php7/php7.y:4375 { yyVAL.node = scalar.NewHeredoc(yyDollar[1].token.Value, nil) @@ -6998,7 +6995,7 @@ yydefault: } case 410: yyDollar = yyS[yypt-3 : yypt+1] - //line php7/php7.y:4390 + //line php7/php7.y:4387 { yyVAL.node = scalar.NewEncapsed(yyDollar[2].list) @@ -7012,7 +7009,7 @@ yydefault: } case 411: yyDollar = yyS[yypt-3 : yypt+1] - //line php7/php7.y:4402 + //line php7/php7.y:4399 { yyVAL.node = scalar.NewHeredoc(yyDollar[1].token.Value, yyDollar[2].list) @@ -7026,7 +7023,7 @@ yydefault: } case 412: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:4414 + //line php7/php7.y:4411 { yyVAL.node = yyDollar[1].node @@ -7034,7 +7031,7 @@ yydefault: } case 413: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:4420 + //line php7/php7.y:4417 { yyVAL.node = yyDollar[1].node @@ -7042,7 +7039,7 @@ yydefault: } case 414: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:4429 + //line php7/php7.y:4426 { yyVAL.node = expr.NewConstFetch(yyDollar[1].node) @@ -7053,7 +7050,7 @@ yydefault: } case 415: yyDollar = yyS[yypt-3 : yypt+1] - //line php7/php7.y:4438 + //line php7/php7.y:4435 { target := node.NewIdentifier(yyDollar[3].token.Value) yyVAL.node = expr.NewClassConstFetch(yyDollar[1].node, target) @@ -7070,7 +7067,7 @@ yydefault: } case 416: yyDollar = yyS[yypt-3 : yypt+1] - //line php7/php7.y:4453 + //line php7/php7.y:4450 { target := node.NewIdentifier(yyDollar[3].token.Value) yyVAL.node = expr.NewClassConstFetch(yyDollar[1].node, target) @@ -7087,7 +7084,7 @@ yydefault: } case 417: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:4471 + //line php7/php7.y:4468 { yyVAL.node = yyDollar[1].node @@ -7095,7 +7092,7 @@ yydefault: } case 418: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:4477 + //line php7/php7.y:4474 { yyVAL.node = yyDollar[1].node @@ -7103,7 +7100,7 @@ yydefault: } case 419: yyDollar = yyS[yypt-0 : yypt+1] - //line php7/php7.y:4486 + //line php7/php7.y:4483 { yyVAL.node = nil @@ -7111,7 +7108,7 @@ yydefault: } case 420: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:4492 + //line php7/php7.y:4489 { yyVAL.node = yyDollar[1].node @@ -7119,7 +7116,7 @@ yydefault: } case 421: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:4501 + //line php7/php7.y:4498 { yyVAL.node = yyDollar[1].node @@ -7127,7 +7124,7 @@ yydefault: } case 422: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:4510 + //line php7/php7.y:4507 { yyVAL.node = yyDollar[1].node @@ -7135,7 +7132,7 @@ yydefault: } case 423: yyDollar = yyS[yypt-3 : yypt+1] - //line php7/php7.y:4516 + //line php7/php7.y:4513 { yyVAL.node = yyDollar[2].node @@ -7147,7 +7144,7 @@ yydefault: } case 424: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:4526 + //line php7/php7.y:4523 { yyVAL.node = yyDollar[1].node @@ -7155,7 +7152,7 @@ yydefault: } case 425: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:4535 + //line php7/php7.y:4532 { yyVAL.node = yyDollar[1].node @@ -7163,7 +7160,7 @@ yydefault: } case 426: yyDollar = yyS[yypt-3 : yypt+1] - //line php7/php7.y:4541 + //line php7/php7.y:4538 { yyVAL.node = yyDollar[2].node @@ -7175,7 +7172,7 @@ yydefault: } case 427: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:4551 + //line php7/php7.y:4548 { yyVAL.node = yyDollar[1].node @@ -7183,7 +7180,7 @@ yydefault: } case 428: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:4560 + //line php7/php7.y:4557 { yyVAL.node = yyDollar[1].node @@ -7191,7 +7188,7 @@ yydefault: } case 429: yyDollar = yyS[yypt-4 : yypt+1] - //line php7/php7.y:4566 + //line php7/php7.y:4563 { yyVAL.node = expr.NewArrayDimFetch(yyDollar[1].node, yyDollar[3].node) @@ -7206,7 +7203,7 @@ yydefault: } case 430: yyDollar = yyS[yypt-4 : yypt+1] - //line php7/php7.y:4579 + //line php7/php7.y:4576 { yyVAL.node = expr.NewArrayDimFetch(yyDollar[1].node, yyDollar[3].node) @@ -7221,7 +7218,7 @@ yydefault: } case 431: yyDollar = yyS[yypt-4 : yypt+1] - //line php7/php7.y:4592 + //line php7/php7.y:4589 { yyVAL.node = expr.NewArrayDimFetch(yyDollar[1].node, yyDollar[3].node) @@ -7236,7 +7233,7 @@ yydefault: } case 432: yyDollar = yyS[yypt-4 : yypt+1] - //line php7/php7.y:4605 + //line php7/php7.y:4602 { yyVAL.node = expr.NewMethodCall(yyDollar[1].node, yyDollar[3].node, yyDollar[4].node.(*node.ArgumentList)) @@ -7250,7 +7247,7 @@ yydefault: } case 433: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:4617 + //line php7/php7.y:4614 { yyVAL.node = yyDollar[1].node @@ -7258,7 +7255,7 @@ yydefault: } case 434: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:4626 + //line php7/php7.y:4623 { yyVAL.node = yyDollar[1].node @@ -7266,7 +7263,7 @@ yydefault: } case 435: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:4632 + //line php7/php7.y:4629 { yyVAL.node = yyDollar[1].node @@ -7274,7 +7271,7 @@ yydefault: } case 436: yyDollar = yyS[yypt-3 : yypt+1] - //line php7/php7.y:4638 + //line php7/php7.y:4635 { yyVAL.node = expr.NewPropertyFetch(yyDollar[1].node, yyDollar[3].node) @@ -7288,7 +7285,7 @@ yydefault: } case 437: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:4653 + //line php7/php7.y:4650 { name := node.NewIdentifier(strings.TrimLeftFunc(yyDollar[1].token.Value, isDollar)) yyVAL.node = expr.NewVariable(name) @@ -7304,7 +7301,7 @@ yydefault: } case 438: yyDollar = yyS[yypt-4 : yypt+1] - //line php7/php7.y:4667 + //line php7/php7.y:4664 { yyVAL.node = expr.NewVariable(yyDollar[3].node) @@ -7320,7 +7317,7 @@ yydefault: } case 439: yyDollar = yyS[yypt-2 : yypt+1] - //line php7/php7.y:4681 + //line php7/php7.y:4678 { yyVAL.node = expr.NewVariable(yyDollar[2].node) @@ -7334,7 +7331,7 @@ yydefault: } case 440: yyDollar = yyS[yypt-3 : yypt+1] - //line php7/php7.y:4696 + //line php7/php7.y:4693 { yyVAL.node = expr.NewStaticPropertyFetch(yyDollar[1].node, yyDollar[3].node) @@ -7348,7 +7345,7 @@ yydefault: } case 441: yyDollar = yyS[yypt-3 : yypt+1] - //line php7/php7.y:4708 + //line php7/php7.y:4705 { yyVAL.node = expr.NewStaticPropertyFetch(yyDollar[1].node, yyDollar[3].node) @@ -7362,7 +7359,7 @@ yydefault: } case 442: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:4723 + //line php7/php7.y:4720 { yyVAL.node = yyDollar[1].node @@ -7370,7 +7367,7 @@ yydefault: } case 443: yyDollar = yyS[yypt-4 : yypt+1] - //line php7/php7.y:4729 + //line php7/php7.y:4726 { yyVAL.node = expr.NewArrayDimFetch(yyDollar[1].node, yyDollar[3].node) @@ -7385,7 +7382,7 @@ yydefault: } case 444: yyDollar = yyS[yypt-4 : yypt+1] - //line php7/php7.y:4742 + //line php7/php7.y:4739 { yyVAL.node = expr.NewArrayDimFetch(yyDollar[1].node, yyDollar[3].node) @@ -7400,7 +7397,7 @@ yydefault: } case 445: yyDollar = yyS[yypt-3 : yypt+1] - //line php7/php7.y:4755 + //line php7/php7.y:4752 { yyVAL.node = expr.NewPropertyFetch(yyDollar[1].node, yyDollar[3].node) @@ -7414,7 +7411,7 @@ yydefault: } case 446: yyDollar = yyS[yypt-3 : yypt+1] - //line php7/php7.y:4767 + //line php7/php7.y:4764 { yyVAL.node = expr.NewStaticPropertyFetch(yyDollar[1].node, yyDollar[3].node) @@ -7428,7 +7425,7 @@ yydefault: } case 447: yyDollar = yyS[yypt-3 : yypt+1] - //line php7/php7.y:4779 + //line php7/php7.y:4776 { yyVAL.node = expr.NewStaticPropertyFetch(yyDollar[1].node, yyDollar[3].node) @@ -7442,7 +7439,7 @@ yydefault: } case 448: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:4794 + //line php7/php7.y:4791 { yyVAL.node = node.NewIdentifier(yyDollar[1].token.Value) @@ -7456,7 +7453,7 @@ yydefault: } case 449: yyDollar = yyS[yypt-3 : yypt+1] - //line php7/php7.y:4806 + //line php7/php7.y:4803 { yyVAL.node = yyDollar[2].node @@ -7468,7 +7465,7 @@ yydefault: } case 450: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:4816 + //line php7/php7.y:4813 { yyVAL.node = yyDollar[1].node @@ -7476,7 +7473,7 @@ yydefault: } case 451: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:4825 + //line php7/php7.y:4822 { yyVAL.node = node.NewIdentifier(yyDollar[1].token.Value) @@ -7484,13 +7481,14 @@ yydefault: yyVAL.node.SetPosition(yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token)) // save comments - addMeta(yyVAL.node, yyDollar[1].token.Meta, meta.StringToken) + spew.Dump(yyDollar[1].token.Meta) + addMeta(yyVAL.node, yyDollar[1].token.Meta, meta.IdentifierToken) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } case 452: yyDollar = yyS[yypt-3 : yypt+1] - //line php7/php7.y:4837 + //line php7/php7.y:4835 { yyVAL.node = yyDollar[2].node @@ -7502,7 +7500,7 @@ yydefault: } case 453: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:4847 + //line php7/php7.y:4845 { yyVAL.node = yyDollar[1].node @@ -7510,7 +7508,7 @@ yydefault: } case 454: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:4856 + //line php7/php7.y:4854 { yyVAL.list = yyDollar[1].list @@ -7518,7 +7516,7 @@ yydefault: } case 455: yyDollar = yyS[yypt-0 : yypt+1] - //line php7/php7.y:4865 + //line php7/php7.y:4863 { yyVAL.node = expr.NewArrayItem(nil, nil) @@ -7526,7 +7524,7 @@ yydefault: } case 456: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:4871 + //line php7/php7.y:4869 { yyVAL.node = yyDollar[1].node @@ -7534,7 +7532,7 @@ yydefault: } case 457: yyDollar = yyS[yypt-3 : yypt+1] - //line php7/php7.y:4880 + //line php7/php7.y:4878 { if len(yyDollar[1].list) == 0 { yyDollar[1].list = []node.Node{expr.NewArrayItem(nil, nil)} @@ -7543,13 +7541,13 @@ yydefault: yyVAL.list = append(yyDollar[1].list, yyDollar[3].node) // save comments - addMeta(lastNode(yyDollar[1].list), yyDollar[2].token.Meta, meta.CommaToken) + addMeta(lastNode(yyDollar[1].list), yyDollar[2].token.Meta, meta.NodeEnd) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } case 458: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:4893 + //line php7/php7.y:4891 { if yyDollar[1].node.(*expr.ArrayItem).Key == nil && yyDollar[1].node.(*expr.ArrayItem).Val == nil { yyVAL.list = []node.Node{} @@ -7561,7 +7559,7 @@ yydefault: } case 459: yyDollar = yyS[yypt-3 : yypt+1] - //line php7/php7.y:4906 + //line php7/php7.y:4904 { yyVAL.node = expr.NewArrayItem(yyDollar[1].node, yyDollar[3].node) @@ -7575,7 +7573,7 @@ yydefault: } case 460: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:4918 + //line php7/php7.y:4916 { yyVAL.node = expr.NewArrayItem(nil, yyDollar[1].node) @@ -7586,7 +7584,7 @@ yydefault: } case 461: yyDollar = yyS[yypt-4 : yypt+1] - //line php7/php7.y:4927 + //line php7/php7.y:4925 { reference := expr.NewReference(yyDollar[4].node) yyVAL.node = expr.NewArrayItem(yyDollar[1].node, reference) @@ -7603,7 +7601,7 @@ yydefault: } case 462: yyDollar = yyS[yypt-2 : yypt+1] - //line php7/php7.y:4942 + //line php7/php7.y:4940 { reference := expr.NewReference(yyDollar[2].node) yyVAL.node = expr.NewArrayItem(nil, reference) @@ -7619,7 +7617,7 @@ yydefault: } case 463: yyDollar = yyS[yypt-6 : yypt+1] - //line php7/php7.y:4956 + //line php7/php7.y:4954 { // TODO: Cannot use list() as standalone expression list := expr.NewList(yyDollar[5].list) @@ -7639,7 +7637,7 @@ yydefault: } case 464: yyDollar = yyS[yypt-4 : yypt+1] - //line php7/php7.y:4974 + //line php7/php7.y:4972 { // TODO: Cannot use list() as standalone expression list := expr.NewList(yyDollar[3].list) @@ -7658,7 +7656,7 @@ yydefault: } case 465: yyDollar = yyS[yypt-2 : yypt+1] - //line php7/php7.y:4994 + //line php7/php7.y:4992 { yyVAL.list = append(yyDollar[1].list, yyDollar[2].node) @@ -7666,7 +7664,7 @@ yydefault: } case 466: yyDollar = yyS[yypt-2 : yypt+1] - //line php7/php7.y:5000 + //line php7/php7.y:4998 { encapsed := scalar.NewEncapsedStringPart(yyDollar[2].token.Value) yyVAL.list = append(yyDollar[1].list, encapsed) @@ -7681,7 +7679,7 @@ yydefault: } case 467: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:5013 + //line php7/php7.y:5011 { yyVAL.list = []node.Node{yyDollar[1].node} @@ -7689,7 +7687,7 @@ yydefault: } case 468: yyDollar = yyS[yypt-2 : yypt+1] - //line php7/php7.y:5019 + //line php7/php7.y:5017 { encapsed := scalar.NewEncapsedStringPart(yyDollar[1].token.Value) yyVAL.list = []node.Node{encapsed, yyDollar[2].node} @@ -7704,7 +7702,7 @@ yydefault: } case 469: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:5035 + //line php7/php7.y:5033 { name := node.NewIdentifier(strings.TrimLeftFunc(yyDollar[1].token.Value, isDollar)) yyVAL.node = expr.NewVariable(name) @@ -7720,7 +7718,7 @@ yydefault: } case 470: yyDollar = yyS[yypt-4 : yypt+1] - //line php7/php7.y:5049 + //line php7/php7.y:5047 { identifier := node.NewIdentifier(strings.TrimLeftFunc(yyDollar[1].token.Value, isDollar)) variable := expr.NewVariable(identifier) @@ -7740,7 +7738,7 @@ yydefault: } case 471: yyDollar = yyS[yypt-3 : yypt+1] - //line php7/php7.y:5067 + //line php7/php7.y:5065 { identifier := node.NewIdentifier(strings.TrimLeftFunc(yyDollar[1].token.Value, isDollar)) variable := expr.NewVariable(identifier) @@ -7756,13 +7754,13 @@ yydefault: // save comments addMeta(variable, yyDollar[1].token.Meta, meta.VariableToken) addMeta(yyVAL.node, yyDollar[2].token.Meta, meta.ObjectOperatorToken) - addMeta(fetch, yyDollar[3].token.Meta, meta.StringToken) + addMeta(fetch, yyDollar[3].token.Meta, meta.IdentifierToken) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } case 472: yyDollar = yyS[yypt-3 : yypt+1] - //line php7/php7.y:5087 + //line php7/php7.y:5085 { yyVAL.node = expr.NewVariable(yyDollar[2].node) @@ -7777,7 +7775,7 @@ yydefault: } case 473: yyDollar = yyS[yypt-3 : yypt+1] - //line php7/php7.y:5100 + //line php7/php7.y:5098 { name := node.NewIdentifier(yyDollar[2].token.Value) yyVAL.node = expr.NewVariable(name) @@ -7788,14 +7786,14 @@ yydefault: // save comments addMeta(yyVAL.node, yyDollar[1].token.Meta, meta.DollarOpenCurlyBracesToken) - addMeta(name, yyDollar[2].token.Meta, meta.StringVarnameToken) + addMeta(name, yyDollar[2].token.Meta, meta.IdentifierToken) addMeta(yyVAL.node, yyDollar[3].token.Meta, meta.CloseCurlyBracesToken) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } case 474: yyDollar = yyS[yypt-6 : yypt+1] - //line php7/php7.y:5116 + //line php7/php7.y:5114 { identifier := node.NewIdentifier(yyDollar[2].token.Value) variable := expr.NewVariable(identifier) @@ -7817,7 +7815,7 @@ yydefault: } case 475: yyDollar = yyS[yypt-3 : yypt+1] - //line php7/php7.y:5136 + //line php7/php7.y:5134 { yyVAL.node = yyDollar[2].node @@ -7825,7 +7823,7 @@ yydefault: } case 476: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:5145 + //line php7/php7.y:5143 { yyVAL.node = scalar.NewString(yyDollar[1].token.Value) @@ -7839,7 +7837,7 @@ yydefault: } case 477: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:5157 + //line php7/php7.y:5155 { // TODO: add option to handle 64 bit integer if _, err := strconv.Atoi(yyDollar[1].token.Value); err == nil { @@ -7858,7 +7856,7 @@ yydefault: } case 478: yyDollar = yyS[yypt-2 : yypt+1] - //line php7/php7.y:5174 + //line php7/php7.y:5172 { var lnumber *scalar.Lnumber // TODO: add option to handle 64 bit integer @@ -7891,7 +7889,7 @@ yydefault: } case 479: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:5205 + //line php7/php7.y:5203 { identifier := node.NewIdentifier(strings.TrimLeftFunc(yyDollar[1].token.Value, isDollar)) yyVAL.node = expr.NewVariable(identifier) @@ -7907,7 +7905,7 @@ yydefault: } case 480: yyDollar = yyS[yypt-5 : yypt+1] - //line php7/php7.y:5222 + //line php7/php7.y:5220 { yyVAL.node = expr.NewIsset(yyDollar[3].list) @@ -7926,7 +7924,7 @@ yydefault: } case 481: yyDollar = yyS[yypt-4 : yypt+1] - //line php7/php7.y:5239 + //line php7/php7.y:5237 { yyVAL.node = expr.NewEmpty(yyDollar[3].node) @@ -7942,7 +7940,7 @@ yydefault: } case 482: yyDollar = yyS[yypt-2 : yypt+1] - //line php7/php7.y:5253 + //line php7/php7.y:5251 { yyVAL.node = expr.NewInclude(yyDollar[2].node) @@ -7956,7 +7954,7 @@ yydefault: } case 483: yyDollar = yyS[yypt-2 : yypt+1] - //line php7/php7.y:5265 + //line php7/php7.y:5263 { yyVAL.node = expr.NewIncludeOnce(yyDollar[2].node) @@ -7970,7 +7968,7 @@ yydefault: } case 484: yyDollar = yyS[yypt-4 : yypt+1] - //line php7/php7.y:5277 + //line php7/php7.y:5275 { yyVAL.node = expr.NewEval(yyDollar[3].node) @@ -7986,7 +7984,7 @@ yydefault: } case 485: yyDollar = yyS[yypt-2 : yypt+1] - //line php7/php7.y:5291 + //line php7/php7.y:5289 { yyVAL.node = expr.NewRequire(yyDollar[2].node) @@ -8000,7 +7998,7 @@ yydefault: } case 486: yyDollar = yyS[yypt-2 : yypt+1] - //line php7/php7.y:5303 + //line php7/php7.y:5301 { yyVAL.node = expr.NewRequireOnce(yyDollar[2].node) @@ -8014,7 +8012,7 @@ yydefault: } case 487: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:5318 + //line php7/php7.y:5316 { yyVAL.list = []node.Node{yyDollar[1].node} @@ -8022,18 +8020,18 @@ yydefault: } case 488: yyDollar = yyS[yypt-3 : yypt+1] - //line php7/php7.y:5324 + //line php7/php7.y:5322 { yyVAL.list = append(yyDollar[1].list, yyDollar[3].node) // save comments - addMeta(lastNode(yyDollar[1].list), yyDollar[2].token.Meta, meta.CommaToken) + addMeta(lastNode(yyDollar[1].list), yyDollar[2].token.Meta, meta.NodeEnd) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } case 489: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:5336 + //line php7/php7.y:5334 { yyVAL.node = yyDollar[1].node diff --git a/php7/php7.y b/php7/php7.y index bc6c4bd..8b90edc 100644 --- a/php7/php7.y +++ b/php7/php7.y @@ -15,6 +15,8 @@ import ( "github.com/z7zmey/php-parser/node/expr/assign" "github.com/z7zmey/php-parser/node/expr/binary" "github.com/z7zmey/php-parser/node/expr/cast" + + "github.com/davecgh/go-spew/spew" ) %} @@ -304,6 +306,10 @@ start: yylex.(*Parser).rootNode.SetPosition(yylex.(*Parser).positionBuilder.NewNodeListPosition($1)) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) + + if yylex.(*Parser).currentToken.Value == "\xff" { + addMeta(yylex.(*Parser).rootNode, yylex.(*Parser).currentToken.Meta, meta.NodeEnd) + } } ; @@ -594,7 +600,7 @@ use_type: $$.SetPosition(yylex.(*Parser).positionBuilder.NewTokenPosition($1)) // save comments - addMeta($$, $1.Meta, meta.FunctionToken) + addMeta($$, $1.Meta, meta.IdentifierToken) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } @@ -606,7 +612,7 @@ use_type: $$.SetPosition(yylex.(*Parser).positionBuilder.NewTokenPosition($1)) // save comments - addMeta($$, $1.Meta, meta.ConstToken) + addMeta($$, $1.Meta, meta.IdentifierToken) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } @@ -713,7 +719,7 @@ inline_use_declarations: $$ = append($1, $3) // save comments - addMeta(lastNode($1), $2.Meta, meta.CommaToken) + addMeta(lastNode($1), $2.Meta, meta.NodeEnd) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } @@ -731,7 +737,7 @@ unprefixed_use_declarations: $$ = append($1, $3) // save comments - addMeta(lastNode($1), $2.Meta, meta.CommaToken) + addMeta(lastNode($1), $2.Meta, meta.NodeEnd) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } @@ -749,7 +755,7 @@ use_declarations: $$ = append($1, $3) // save comments - addMeta(lastNode($1), $2.Meta, meta.CommaToken) + addMeta(lastNode($1), $2.Meta, meta.NodeEnd) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } @@ -801,7 +807,7 @@ unprefixed_use_declaration: // save comments addMeta($$, $2.Meta, meta.AsToken) - addMeta(alias, $3.Meta, meta.StringToken) + addMeta(alias, $3.Meta, meta.IdentifierToken) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } @@ -831,7 +837,7 @@ const_list: $$ = append($1, $3) // save comments - addMeta(lastNode($1), $2.Meta, meta.CommaToken) + addMeta(lastNode($1), $2.Meta, meta.NodeEnd) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } @@ -1265,7 +1271,7 @@ statement: // save comments addMeta($$, $1.Meta, meta.GotoToken) - addMeta(label, $2.Meta, meta.StringToken) + addMeta(label, $2.Meta, meta.IdentifierToken) addMeta($$, $3.Meta, meta.SemiColonToken) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) @@ -1280,7 +1286,7 @@ statement: $$.SetPosition(yylex.(*Parser).positionBuilder.NewTokensPosition($1, $2)) // save comments - addMeta(label, $1.Meta, meta.StringToken) + addMeta(label, $1.Meta, meta.IdentifierToken) addMeta($$, $2.Meta, meta.ColonToken) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) @@ -1308,7 +1314,7 @@ catch_list: // save comments addMeta(catch, $2.Meta, meta.CatchToken) addMeta(catch, $3.Meta, meta.OpenParenthesisToken) - addMeta(variable, $5.Meta, meta.StringToken) + addMeta(variable, $5.Meta, meta.VariableToken) addMeta(catch, $6.Meta, meta.CloseParenthesisToken) addMeta(catch, $7.Meta, meta.OpenCurlyBracesToken) addMeta(catch, $9.Meta, meta.CloseCurlyBracesToken) @@ -1328,7 +1334,7 @@ catch_name_list: $$ = append($1, $3) // save comments - addMeta(lastNode($1), $2.Meta, meta.VerticalBarToken) + addMeta(lastNode($1), $2.Meta, meta.NodeEnd) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } @@ -1369,7 +1375,7 @@ unset_variables: $$ = append($1, $3) // save comments - addMeta(lastNode($1), $2.Meta, meta.CommaToken) + addMeta(lastNode($1), $2.Meta, meta.NodeEnd) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } @@ -1400,7 +1406,7 @@ function_declaration_statement: if $2 != nil { addMeta($$, $2.Meta, meta.AmpersandToken) } - addMeta(name, $3.Meta, meta.StringToken) + addMeta(name, $3.Meta, meta.IdentifierToken) addMeta($$, $5.Meta, meta.OpenParenthesisToken) addMeta($$, $7.Meta, meta.CloseParenthesisToken) addMeta($$, $9.Meta, meta.OpenCurlyBracesToken) @@ -1444,7 +1450,7 @@ class_declaration_statement: // save comments addMeta($$, $2.Meta, meta.ClassToken) - addMeta(name, $3.Meta, meta.StringToken) + addMeta(name, $3.Meta, meta.IdentifierToken) addMeta($$, $7.Meta, meta.OpenCurlyBracesToken) addMeta($$, $9.Meta, meta.CloseCurlyBracesToken) @@ -1461,7 +1467,7 @@ class_declaration_statement: // save comments addMeta($$, $1.Meta, meta.ClassToken) - addMeta(name, $2.Meta, meta.StringToken) + addMeta(name, $2.Meta, meta.IdentifierToken) addMeta($$, $6.Meta, meta.OpenCurlyBracesToken) addMeta($$, $8.Meta, meta.CloseCurlyBracesToken) @@ -1493,7 +1499,7 @@ class_modifier: $$.SetPosition(yylex.(*Parser).positionBuilder.NewTokenPosition($1)) // save comments - addMeta($$, $1.Meta, meta.AbstractToken) + addMeta($$, $1.Meta, meta.IdentifierToken) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } @@ -1505,7 +1511,7 @@ class_modifier: $$.SetPosition(yylex.(*Parser).positionBuilder.NewTokenPosition($1)) // save comments - addMeta($$, $1.Meta, meta.FinalToken) + addMeta($$, $1.Meta, meta.IdentifierToken) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } @@ -1523,7 +1529,7 @@ trait_declaration_statement: // save comments addMeta($$, $1.Meta, meta.TraitToken) - addMeta(name, $2.Meta, meta.StringToken) + addMeta(name, $2.Meta, meta.IdentifierToken) addMeta($$, $4.Meta, meta.OpenCurlyBracesToken) addMeta($$, $6.Meta, meta.CloseCurlyBracesToken) @@ -1543,7 +1549,7 @@ interface_declaration_statement: // save comments addMeta($$, $1.Meta, meta.InterfaceToken) - addMeta(name, $2.Meta, meta.StringToken) + addMeta(name, $2.Meta, meta.IdentifierToken) addMeta($$, $5.Meta, meta.OpenCurlyBracesToken) addMeta($$, $7.Meta, meta.CloseCurlyBracesToken) @@ -1783,8 +1789,8 @@ switch_case_list: $$.SetPosition(yylex.(*Parser).positionBuilder.NewTokensPosition($1, $4)) // save comments - addMeta(caseList, $1.Meta, meta.ColonToken) - addMeta(caseList, $3.Meta, meta.EndswitchToken) + addMeta($$, $1.Meta, meta.ColonToken) + addMeta($$, $3.Meta, meta.EndswitchToken) addMeta($$, $4.Meta, meta.SemiColonToken) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) @@ -1800,9 +1806,9 @@ switch_case_list: $$.SetPosition(yylex.(*Parser).positionBuilder.NewTokensPosition($1, $5)) // save comments - addMeta(caseList, $1.Meta, meta.ColonToken) - addMeta(caseList, $2.Meta, meta.SemiColonToken) - addMeta(caseList, $4.Meta, meta.EndswitchToken) + addMeta($$, $1.Meta, meta.ColonToken) + addMeta($$, $2.Meta, meta.SwitchSemicolonToken) + addMeta($$, $4.Meta, meta.EndswitchToken) addMeta($$, $5.Meta, meta.SemiColonToken) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) @@ -1935,7 +1941,7 @@ if_stmt: $$.SetPosition(yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3)) // save comments - addMeta($$, $2.Meta, meta.ElseToken) + addMeta(_else, $2.Meta, meta.ElseToken) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } @@ -2041,7 +2047,7 @@ non_empty_parameter_list: $$ = append($1, $3) // save comments - addMeta(lastNode($1), $2.Meta, meta.CommaToken) + addMeta(lastNode($1), $2.Meta, meta.NodeEnd) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } @@ -2156,7 +2162,7 @@ type: $$.SetPosition(yylex.(*Parser).positionBuilder.NewTokenPosition($1)) // save comments - addMeta($$, $1.Meta, meta.ArrayToken) + addMeta($$, $1.Meta, meta.IdentifierToken) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } @@ -2168,7 +2174,7 @@ type: $$.SetPosition(yylex.(*Parser).positionBuilder.NewTokenPosition($1)) // save comments - addMeta($$, $1.Meta, meta.CallableToken) + addMeta($$, $1.Meta, meta.IdentifierToken) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } @@ -2242,7 +2248,7 @@ non_empty_argument_list: $$ = append($1, $3) // save comments - addMeta(lastNode($1), $2.Meta, meta.CommaToken) + addMeta(lastNode($1), $2.Meta, meta.NodeEnd) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } @@ -2278,7 +2284,7 @@ global_var_list: $$ = append($1, $3) // save comments - addMeta(lastNode($1), $2.Meta, meta.CommaToken) + addMeta(lastNode($1), $2.Meta, meta.NodeEnd) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } @@ -2305,7 +2311,7 @@ static_var_list: $$ = append($1, $3) // save comments - addMeta(lastNode($1), $2.Meta, meta.CommaToken) + addMeta(lastNode($1), $2.Meta, meta.NodeEnd) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } @@ -2396,16 +2402,7 @@ class_statement: } | T_USE name_list trait_adaptations { - var adaptationList *stmt.TraitAdaptationList - - switch n := $3.(type) { - case *stmt.TraitAdaptationList: - adaptationList = n - default: - adaptationList = nil - } - - $$ = stmt.NewTraitUse($2, adaptationList) + $$ = stmt.NewTraitUse($2, $3) // save position $$.SetPosition(yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $3)) @@ -2453,7 +2450,7 @@ name_list: $$ = append($1, $3) // save comments - addMeta(lastNode($1), $2.Meta, meta.CommaToken) + addMeta(lastNode($1), $2.Meta, meta.NodeEnd) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } @@ -2561,7 +2558,7 @@ trait_alias: // save comments addMeta($$, $2.Meta, meta.AsToken) - addMeta(alias, $3.Meta, meta.StringToken) + addMeta(alias, $3.Meta, meta.IdentifierToken) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } @@ -2576,7 +2573,7 @@ trait_alias: // save comments addMeta($$, $2.Meta, meta.AsToken) - addMeta(alias, $3.Meta, meta.StringToken) + addMeta(alias, $3.Meta, meta.IdentifierToken) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } @@ -2694,7 +2691,7 @@ variable_modifiers: modifier.SetPosition(yylex.(*Parser).positionBuilder.NewTokenPosition($1)) // save comments - addMeta(modifier, $1.Meta, meta.VarToken) + addMeta(modifier, $1.Meta, meta.IdentifierToken) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } @@ -2739,7 +2736,7 @@ member_modifier: $$.SetPosition(yylex.(*Parser).positionBuilder.NewTokenPosition($1)) // save comments - addMeta($$, $1.Meta, meta.PublicToken) + addMeta($$, $1.Meta, meta.IdentifierToken) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } @@ -2751,7 +2748,7 @@ member_modifier: $$.SetPosition(yylex.(*Parser).positionBuilder.NewTokenPosition($1)) // save comments - addMeta($$, $1.Meta, meta.ProtectedToken) + addMeta($$, $1.Meta, meta.IdentifierToken) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } @@ -2763,7 +2760,7 @@ member_modifier: $$.SetPosition(yylex.(*Parser).positionBuilder.NewTokenPosition($1)) // save comments - addMeta($$, $1.Meta, meta.PrivateToken) + addMeta($$, $1.Meta, meta.IdentifierToken) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } @@ -2775,7 +2772,7 @@ member_modifier: $$.SetPosition(yylex.(*Parser).positionBuilder.NewTokenPosition($1)) // save comments - addMeta($$, $1.Meta, meta.StaticToken) + addMeta($$, $1.Meta, meta.IdentifierToken) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } @@ -2787,7 +2784,7 @@ member_modifier: $$.SetPosition(yylex.(*Parser).positionBuilder.NewTokenPosition($1)) // save comments - addMeta($$, $1.Meta, meta.AbstractToken) + addMeta($$, $1.Meta, meta.IdentifierToken) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } @@ -2799,7 +2796,7 @@ member_modifier: $$.SetPosition(yylex.(*Parser).positionBuilder.NewTokenPosition($1)) // save comments - addMeta($$, $1.Meta, meta.FinalToken) + addMeta($$, $1.Meta, meta.IdentifierToken) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } @@ -2811,7 +2808,7 @@ property_list: $$ = append($1, $3) // save comments - addMeta(lastNode($1), $2.Meta, meta.CommaToken) + addMeta(lastNode($1), $2.Meta, meta.NodeEnd) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } @@ -2865,7 +2862,7 @@ class_const_list: $$ = append($1, $3) // save comments - addMeta(lastNode($1), $2.Meta, meta.CommaToken) + addMeta(lastNode($1), $2.Meta, meta.NodeEnd) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } @@ -2906,7 +2903,7 @@ const_decl: $$.SetPosition(yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $3)) // save comments - addMeta(name, $1.Meta, meta.StringToken) + addMeta(name, $1.Meta, meta.IdentifierToken) addMeta($$, $2.Meta, meta.EqualToken) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) @@ -2919,7 +2916,7 @@ echo_expr_list: $$ = append($1, $3) // save comments - addMeta(lastNode($1), $2.Meta, meta.CommaToken) + addMeta(lastNode($1), $2.Meta, meta.NodeEnd) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } @@ -2961,7 +2958,7 @@ non_empty_for_exprs: $$ = append($1, $3) // save comments - addMeta(lastNode($1), $2.Meta, meta.CommaToken) + addMeta(lastNode($1), $2.Meta, meta.NodeEnd) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } @@ -4012,7 +4009,7 @@ lexical_var_list: $$ = append($1, $3) // save comments - addMeta(lastNode($1), $2.Meta, meta.CommaToken) + addMeta(lastNode($1), $2.Meta, meta.NodeEnd) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } @@ -4112,7 +4109,7 @@ class_name: $$.SetPosition(yylex.(*Parser).positionBuilder.NewTokenPosition($1)) // save comments - addMeta($$, $1.Meta, meta.StaticToken) + addMeta($$, $1.Meta, meta.IdentifierToken) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } @@ -4154,8 +4151,8 @@ exit_expr: $$.SetPosition(yylex.(*Parser).positionBuilder.NewTokensPosition($1, $3)) // save comments - addMeta($$, $1.Meta, meta.OpenParenthesisToken) - addMeta($$, $3.Meta, meta.CloseParenthesisToken) + addMeta($2, $1.Meta, meta.OpenParenthesisToken) + addMeta($2, $3.Meta, meta.CloseParenthesisToken) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } @@ -4272,7 +4269,7 @@ scalar: $$.SetPosition(yylex.(*Parser).positionBuilder.NewTokenPosition($1)) // save comments - addMeta($$, $1.Meta, meta.LineToken) + addMeta($$, $1.Meta, meta.MagicConstantToken) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } @@ -4284,7 +4281,7 @@ scalar: $$.SetPosition(yylex.(*Parser).positionBuilder.NewTokenPosition($1)) // save comments - addMeta($$, $1.Meta, meta.FileToken) + addMeta($$, $1.Meta, meta.MagicConstantToken) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } @@ -4296,7 +4293,7 @@ scalar: $$.SetPosition(yylex.(*Parser).positionBuilder.NewTokenPosition($1)) // save comments - addMeta($$, $1.Meta, meta.DirToken) + addMeta($$, $1.Meta, meta.MagicConstantToken) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } @@ -4308,7 +4305,7 @@ scalar: $$.SetPosition(yylex.(*Parser).positionBuilder.NewTokenPosition($1)) // save comments - addMeta($$, $1.Meta, meta.TraitCToken) + addMeta($$, $1.Meta, meta.MagicConstantToken) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } @@ -4320,7 +4317,7 @@ scalar: $$.SetPosition(yylex.(*Parser).positionBuilder.NewTokenPosition($1)) // save comments - addMeta($$, $1.Meta, meta.MethodCToken) + addMeta($$, $1.Meta, meta.MagicConstantToken) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } @@ -4332,7 +4329,7 @@ scalar: $$.SetPosition(yylex.(*Parser).positionBuilder.NewTokenPosition($1)) // save comments - addMeta($$, $1.Meta, meta.FuncCToken) + addMeta($$, $1.Meta, meta.MagicConstantToken) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } @@ -4344,7 +4341,7 @@ scalar: $$.SetPosition(yylex.(*Parser).positionBuilder.NewTokenPosition($1)) // save comments - addMeta($$, $1.Meta, meta.NsCToken) + addMeta($$, $1.Meta, meta.MagicConstantToken) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } @@ -4356,7 +4353,7 @@ scalar: $$.SetPosition(yylex.(*Parser).positionBuilder.NewTokenPosition($1)) // save comments - addMeta($$, $1.Meta, meta.ClassCToken) + addMeta($$, $1.Meta, meta.MagicConstantToken) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } @@ -4829,7 +4826,8 @@ property_name: $$.SetPosition(yylex.(*Parser).positionBuilder.NewTokenPosition($1)) // save comments - addMeta($$, $1.Meta, meta.StringToken) + spew.Dump($1.Meta) + addMeta($$, $1.Meta, meta.IdentifierToken) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } @@ -4885,7 +4883,7 @@ non_empty_array_pair_list: $$ = append($1, $3) // save comments - addMeta(lastNode($1), $2.Meta, meta.CommaToken) + addMeta(lastNode($1), $2.Meta, meta.NodeEnd) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } @@ -5079,7 +5077,7 @@ encaps_var: // save comments addMeta(variable, $1.Meta, meta.VariableToken) addMeta($$, $2.Meta, meta.ObjectOperatorToken) - addMeta(fetch, $3.Meta, meta.StringToken) + addMeta(fetch, $3.Meta, meta.IdentifierToken) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } @@ -5107,7 +5105,7 @@ encaps_var: // save comments addMeta($$, $1.Meta, meta.DollarOpenCurlyBracesToken) - addMeta(name, $2.Meta, meta.StringVarnameToken) + addMeta(name, $2.Meta, meta.IdentifierToken) addMeta($$, $3.Meta, meta.CloseCurlyBracesToken) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) @@ -5325,7 +5323,7 @@ isset_variables: $$ = append($1, $3) // save comments - addMeta(lastNode($1), $2.Meta, meta.CommaToken) + addMeta(lastNode($1), $2.Meta, meta.NodeEnd) yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL) } diff --git a/php7/php7_test.go b/php7/php7_test.go index 9dc3546..74645fb 100644 --- a/php7/php7_test.go +++ b/php7/php7_test.go @@ -464,8 +464,8 @@ func TestPhp7(t *testing.T) { StartPos: 14, EndPos: 18, }, - IsReference: false, Variadic: true, + IsReference: false, Expr: &expr.Variable{ Position: &position.Position{ StartLine: 2, @@ -561,8 +561,8 @@ func TestPhp7(t *testing.T) { StartPos: 33, EndPos: 37, }, - Variadic: true, IsReference: false, + Variadic: true, Expr: &expr.Variable{ Position: &position.Position{ StartLine: 3, @@ -640,8 +640,8 @@ func TestPhp7(t *testing.T) { StartPos: 53, EndPos: 54, }, - IsReference: false, Variadic: false, + IsReference: false, Expr: &expr.Variable{ Position: &position.Position{ StartLine: 4, @@ -667,8 +667,8 @@ func TestPhp7(t *testing.T) { StartPos: 57, EndPos: 61, }, - Variadic: true, IsReference: false, + Variadic: true, Expr: &expr.Variable{ Position: &position.Position{ StartLine: 4, @@ -775,8 +775,8 @@ func TestPhp7(t *testing.T) { StartPos: 80, EndPos: 84, }, - Variadic: true, IsReference: false, + Variadic: true, Expr: &expr.Variable{ Position: &position.Position{ StartLine: 5, @@ -881,8 +881,8 @@ func TestPhp7(t *testing.T) { StartPos: 104, EndPos: 108, }, - Variadic: true, IsReference: false, + Variadic: true, Expr: &expr.Variable{ Position: &position.Position{ StartLine: 6, @@ -1862,8 +1862,8 @@ func TestPhp7(t *testing.T) { StartPos: 446, EndPos: 457, }, - ByRef: true, Variadic: true, + ByRef: true, VariableType: &name.Name{ Position: &position.Position{ StartLine: 20, @@ -2011,8 +2011,8 @@ func TestPhp7(t *testing.T) { StartPos: 498, EndPos: 509, }, - Variadic: true, ByRef: true, + Variadic: true, VariableType: &name.Name{ Position: &position.Position{ StartLine: 21, @@ -3743,8 +3743,8 @@ func TestPhp7(t *testing.T) { StartPos: 1549, EndPos: 1580, }, - PhpDocComment: "", ReturnsRef: true, + PhpDocComment: "", MethodName: &node.Identifier{ Position: &position.Position{ StartLine: 73, @@ -3811,8 +3811,8 @@ func TestPhp7(t *testing.T) { StartPos: 1597, EndPos: 1634, }, - ReturnsRef: true, PhpDocComment: "", + ReturnsRef: true, MethodName: &node.Identifier{ Position: &position.Position{ StartLine: 74, @@ -6749,6 +6749,14 @@ func TestPhp7(t *testing.T) { }, }, }, + TraitAdaptationList: &stmt.Nop{ + Position: &position.Position{ + StartLine: 147, + EndLine: 147, + StartPos: 3164, + EndPos: 3164, + }, + }, }, }, }, @@ -9277,9 +9285,9 @@ func TestPhp7(t *testing.T) { StartPos: 4157, EndPos: 4189, }, - PhpDocComment: "", ReturnsRef: false, Static: false, + PhpDocComment: "", Params: []node.Node{ &node.Parameter{ Position: &position.Position{ @@ -14978,8 +14986,8 @@ func TestPhp7(t *testing.T) { StartPos: 5933, EndPos: 5975, }, - PhpDocComment: "", ReturnsRef: false, + PhpDocComment: "", FunctionName: &node.Identifier{ Position: &position.Position{ StartLine: 329, @@ -15033,8 +15041,8 @@ func TestPhp7(t *testing.T) { StartPos: 5955, EndPos: 5963, }, - Variadic: true, ByRef: false, + Variadic: true, Variable: &expr.Variable{ Position: &position.Position{ StartLine: 329, @@ -15108,8 +15116,8 @@ func TestPhp7(t *testing.T) { StartPos: 5979, EndPos: 6016, }, - ReturnsRef: false, PhpDocComment: "", + ReturnsRef: false, FunctionName: &node.Identifier{ Position: &position.Position{ StartLine: 330, diff --git a/printer/pretty_printer.go b/printer/pretty_printer.go new file mode 100644 index 0000000..9fd17e6 --- /dev/null +++ b/printer/pretty_printer.go @@ -0,0 +1,2182 @@ +package printer + +import ( + "io" + "strings" + + "github.com/z7zmey/php-parser/node/stmt" + + "github.com/z7zmey/php-parser/node" + "github.com/z7zmey/php-parser/node/expr" + "github.com/z7zmey/php-parser/node/expr/assign" + "github.com/z7zmey/php-parser/node/expr/binary" + "github.com/z7zmey/php-parser/node/expr/cast" + "github.com/z7zmey/php-parser/node/name" + "github.com/z7zmey/php-parser/node/scalar" +) + +type PrettyPrinter struct { + w io.Writer + indentStr string + indentDepth int +} + +// NewPrettyPrinter - Constructor for PrettyPrinter +func NewPrettyPrinter(w io.Writer, indentStr string) *PrettyPrinter { + return &PrettyPrinter{ + w: w, + indentStr: indentStr, + indentDepth: 0, + } +} + +func (p *PrettyPrinter) Print(n node.Node) { + p.printNode(n) +} + +func (p *PrettyPrinter) joinPrint(glue string, nn []node.Node) { + for k, n := range nn { + if k > 0 { + io.WriteString(p.w, glue) + } + + p.Print(n) + } +} + +func (p *PrettyPrinter) printNodes(nn []node.Node) { + p.indentDepth++ + l := len(nn) - 1 + for k, n := range nn { + p.printIndent() + p.Print(n) + if k < l { + io.WriteString(p.w, "\n") + } + } + p.indentDepth-- +} + +func (p *PrettyPrinter) printIndent() { + for i := 0; i < p.indentDepth; i++ { + io.WriteString(p.w, p.indentStr) + } +} + +func (p *PrettyPrinter) printNode(n node.Node) { + switch n.(type) { + + // node + + case *node.Root: + p.printNodeRoot(n) + case *node.Identifier: + p.printNodeIdentifier(n) + case *node.Parameter: + p.printNodeParameter(n) + case *node.Nullable: + p.printNodeNullable(n) + case *node.Argument: + p.printNodeArgument(n) + + // name + + case *name.NamePart: + p.printNameNamePart(n) + case *name.Name: + p.printNameName(n) + case *name.FullyQualified: + p.printNameFullyQualified(n) + case *name.Relative: + p.printNameRelative(n) + + // scalar + + case *scalar.Lnumber: + p.printScalarLNumber(n) + case *scalar.Dnumber: + p.printScalarDNumber(n) + case *scalar.String: + p.printScalarString(n) + case *scalar.EncapsedStringPart: + p.printScalarEncapsedStringPart(n) + case *scalar.Encapsed: + p.printScalarEncapsed(n) + case *scalar.Heredoc: + p.printScalarHeredoc(n) + case *scalar.MagicConstant: + p.printScalarMagicConstant(n) + + // assign + + case *assign.Assign: + p.printAssign(n) + case *assign.Reference: + p.printReference(n) + case *assign.BitwiseAnd: + p.printAssignBitwiseAnd(n) + case *assign.BitwiseOr: + p.printAssignBitwiseOr(n) + case *assign.BitwiseXor: + p.printAssignBitwiseXor(n) + case *assign.Concat: + p.printAssignConcat(n) + case *assign.Div: + p.printAssignDiv(n) + case *assign.Minus: + p.printAssignMinus(n) + case *assign.Mod: + p.printAssignMod(n) + case *assign.Mul: + p.printAssignMul(n) + case *assign.Plus: + p.printAssignPlus(n) + case *assign.Pow: + p.printAssignPow(n) + case *assign.ShiftLeft: + p.printAssignShiftLeft(n) + case *assign.ShiftRight: + p.printAssignShiftRight(n) + + // binary + + case *binary.BitwiseAnd: + p.printBinaryBitwiseAnd(n) + case *binary.BitwiseOr: + p.printBinaryBitwiseOr(n) + case *binary.BitwiseXor: + p.printBinaryBitwiseXor(n) + case *binary.BooleanAnd: + p.printBinaryBooleanAnd(n) + case *binary.BooleanOr: + p.printBinaryBooleanOr(n) + case *binary.Coalesce: + p.printBinaryCoalesce(n) + case *binary.Concat: + p.printBinaryConcat(n) + case *binary.Div: + p.printBinaryDiv(n) + case *binary.Equal: + p.printBinaryEqual(n) + case *binary.GreaterOrEqual: + p.printBinaryGreaterOrEqual(n) + case *binary.Greater: + p.printBinaryGreater(n) + case *binary.Identical: + p.printBinaryIdentical(n) + case *binary.LogicalAnd: + p.printBinaryLogicalAnd(n) + case *binary.LogicalOr: + p.printBinaryLogicalOr(n) + case *binary.LogicalXor: + p.printBinaryLogicalXor(n) + case *binary.Minus: + p.printBinaryMinus(n) + case *binary.Mod: + p.printBinaryMod(n) + case *binary.Mul: + p.printBinaryMul(n) + case *binary.NotEqual: + p.printBinaryNotEqual(n) + case *binary.NotIdentical: + p.printBinaryNotIdentical(n) + case *binary.Plus: + p.printBinaryPlus(n) + case *binary.Pow: + p.printBinaryPow(n) + case *binary.ShiftLeft: + p.printBinaryShiftLeft(n) + case *binary.ShiftRight: + p.printBinaryShiftRight(n) + case *binary.SmallerOrEqual: + p.printBinarySmallerOrEqual(n) + case *binary.Smaller: + p.printBinarySmaller(n) + case *binary.Spaceship: + p.printBinarySpaceship(n) + + // cast + + case *cast.Array: + p.printArray(n) + case *cast.Bool: + p.printBool(n) + case *cast.Double: + p.printDouble(n) + case *cast.Int: + p.printInt(n) + case *cast.Object: + p.printObject(n) + case *cast.String: + p.printString(n) + case *cast.Unset: + p.printUnset(n) + + // expr + + case *expr.ArrayDimFetch: + p.printExprArrayDimFetch(n) + case *expr.ArrayItem: + p.printExprArrayItem(n) + case *expr.Array: + p.printExprArray(n) + case *expr.BitwiseNot: + p.printExprBitwiseNot(n) + case *expr.BooleanNot: + p.printExprBooleanNot(n) + case *expr.ClassConstFetch: + p.printExprClassConstFetch(n) + case *expr.Clone: + p.printExprClone(n) + case *expr.ClosureUse: + p.printExprClosureUse(n) + case *expr.Closure: + p.printExprClosure(n) + case *expr.ConstFetch: + p.printExprConstFetch(n) + case *expr.Die: + p.printExprDie(n) + case *expr.Empty: + p.printExprEmpty(n) + case *expr.ErrorSuppress: + p.printExprErrorSuppress(n) + case *expr.Eval: + p.printExprEval(n) + case *expr.Exit: + p.printExprExit(n) + case *expr.FunctionCall: + p.printExprFunctionCall(n) + case *expr.Include: + p.printExprInclude(n) + case *expr.IncludeOnce: + p.printExprIncludeOnce(n) + case *expr.InstanceOf: + p.printExprInstanceOf(n) + case *expr.Isset: + p.printExprIsset(n) + case *expr.List: + p.printExprList(n) + case *expr.MethodCall: + p.printExprMethodCall(n) + case *expr.New: + p.printExprNew(n) + case *expr.PostDec: + p.printExprPostDec(n) + case *expr.PostInc: + p.printExprPostInc(n) + case *expr.PreDec: + p.printExprPreDec(n) + case *expr.PreInc: + p.printExprPreInc(n) + case *expr.Print: + p.printExprPrint(n) + case *expr.PropertyFetch: + p.printExprPropertyFetch(n) + case *expr.Reference: + p.printExprReference(n) + case *expr.Require: + p.printExprRequire(n) + case *expr.RequireOnce: + p.printExprRequireOnce(n) + case *expr.ShellExec: + p.printExprShellExec(n) + case *expr.ShortArray: + p.printExprShortArray(n) + case *expr.ShortList: + p.printExprShortList(n) + case *expr.StaticCall: + p.printExprStaticCall(n) + case *expr.StaticPropertyFetch: + p.printExprStaticPropertyFetch(n) + case *expr.Ternary: + p.printExprTernary(n) + case *expr.UnaryMinus: + p.printExprUnaryMinus(n) + case *expr.UnaryPlus: + p.printExprUnaryPlus(n) + case *expr.Variable: + p.printExprVariable(n) + case *expr.YieldFrom: + p.printExprYieldFrom(n) + case *expr.Yield: + p.printExprYield(n) + + // stmt + + case *stmt.AltElseIf: + p.printStmtAltElseIf(n) + case *stmt.AltElse: + p.printStmtAltElse(n) + case *stmt.AltFor: + p.printStmtAltFor(n) + case *stmt.AltForeach: + p.printStmtAltForeach(n) + case *stmt.AltIf: + p.printStmtAltIf(n) + case *stmt.AltSwitch: + p.printStmtAltSwitch(n) + case *stmt.AltWhile: + p.printStmtAltWhile(n) + case *stmt.Break: + p.printStmtBreak(n) + case *stmt.Case: + p.printStmtCase(n) + case *stmt.Catch: + p.printStmtCatch(n) + case *stmt.ClassMethod: + p.printStmtClassMethod(n) + case *stmt.Class: + p.printStmtClass(n) + case *stmt.ClassConstList: + p.printStmtClassConstList(n) + case *stmt.Constant: + p.printStmtConstant(n) + case *stmt.Continue: + p.printStmtContinue(n) + case *stmt.Declare: + p.printStmtDeclare(n) + case *stmt.Default: + p.printStmtDefault(n) + case *stmt.Do: + p.printStmtDo(n) + case *stmt.Echo: + p.printStmtEcho(n) + case *stmt.ElseIf: + p.printStmtElseif(n) + case *stmt.Else: + p.printStmtElse(n) + case *stmt.Expression: + p.printStmtExpression(n) + case *stmt.Finally: + p.printStmtFinally(n) + case *stmt.For: + p.printStmtFor(n) + case *stmt.Foreach: + p.printStmtForeach(n) + case *stmt.Function: + p.printStmtFunction(n) + case *stmt.Global: + p.printStmtGlobal(n) + case *stmt.Goto: + p.printStmtGoto(n) + case *stmt.GroupUse: + p.printStmtGroupUse(n) + case *stmt.HaltCompiler: + p.printStmtHaltCompiler(n) + case *stmt.If: + p.printStmtIf(n) + case *stmt.InlineHtml: + p.printStmtInlineHTML(n) + case *stmt.Interface: + p.printStmtInterface(n) + case *stmt.Label: + p.printStmtLabel(n) + case *stmt.Namespace: + p.printStmtNamespace(n) + case *stmt.Nop: + p.printStmtNop(n) + case *stmt.PropertyList: + p.printStmtPropertyList(n) + case *stmt.Property: + p.printStmtProperty(n) + case *stmt.Return: + p.printStmtReturn(n) + case *stmt.StaticVar: + p.printStmtStaticVar(n) + case *stmt.Static: + p.printStmtStatic(n) + case *stmt.StmtList: + p.printStmtStmtList(n) + case *stmt.Switch: + p.printStmtSwitch(n) + case *stmt.Throw: + p.printStmtThrow(n) + case *stmt.TraitMethodRef: + p.printStmtTraitMethodRef(n) + case *stmt.TraitUseAlias: + p.printStmtTraitUseAlias(n) + case *stmt.TraitUsePrecedence: + p.printStmtTraitUsePrecedence(n) + case *stmt.TraitUse: + p.printStmtTraitUse(n) + case *stmt.Trait: + p.printStmtTrait(n) + case *stmt.Try: + p.printStmtTry(n) + case *stmt.Unset: + p.printStmtUnset(n) + case *stmt.UseList: + p.printStmtUseList(n) + case *stmt.Use: + p.printStmtUse(n) + case *stmt.While: + p.printStmtWhile(n) + } +} + +// node + +func (p *PrettyPrinter) printNodeRoot(n node.Node) { + v := n.(*node.Root) + + if len(v.Stmts) > 0 { + firstStmt := v.Stmts[0] + v.Stmts = v.Stmts[1:] + + switch fs := firstStmt.(type) { + case *stmt.InlineHtml: + io.WriteString(p.w, fs.Value) + io.WriteString(p.w, " 0 { + io.WriteString(p.w, "\\") + } + + p.Print(part) + } +} + +func (p *PrettyPrinter) printNameFullyQualified(n node.Node) { + nn := n.(*name.FullyQualified) + + for _, part := range nn.Parts { + io.WriteString(p.w, "\\") + p.Print(part) + } +} + +func (p *PrettyPrinter) printNameRelative(n node.Node) { + nn := n.(*name.Relative) + + io.WriteString(p.w, "namespace") + for _, part := range nn.Parts { + io.WriteString(p.w, "\\") + p.Print(part) + } +} + +// scalar + +func (p *PrettyPrinter) printScalarLNumber(n node.Node) { + v := n.(*scalar.Lnumber).Value + io.WriteString(p.w, v) +} + +func (p *PrettyPrinter) printScalarDNumber(n node.Node) { + v := n.(*scalar.Dnumber).Value + io.WriteString(p.w, v) +} + +func (p *PrettyPrinter) printScalarString(n node.Node) { + v := n.(*scalar.String).Value + + io.WriteString(p.w, v) +} + +func (p *PrettyPrinter) printScalarEncapsedStringPart(n node.Node) { + v := n.(*scalar.EncapsedStringPart).Value + io.WriteString(p.w, v) +} + +func (p *PrettyPrinter) printScalarEncapsed(n node.Node) { + io.WriteString(p.w, "\"") + + for _, nn := range n.(*scalar.Encapsed).Parts { + p.Print(nn) + } + + io.WriteString(p.w, "\"") +} + +func (p *PrettyPrinter) printScalarHeredoc(n node.Node) { + nn := n.(*scalar.Heredoc) + + io.WriteString(p.w, "<<<") + io.WriteString(p.w, nn.Label) + io.WriteString(p.w, "\n") + + for _, nn := range nn.Parts { + p.Print(nn) + } + + io.WriteString(p.w, strings.Trim(nn.Label, "\"'")) +} + +func (p *PrettyPrinter) printScalarMagicConstant(n node.Node) { + v := n.(*scalar.MagicConstant).Value + io.WriteString(p.w, v) +} + +// Assign + +func (p *PrettyPrinter) printAssign(n node.Node) { + nn := n.(*assign.Assign) + p.Print(nn.Variable) + io.WriteString(p.w, " = ") + p.Print(nn.Expression) +} + +func (p *PrettyPrinter) printReference(n node.Node) { + nn := n.(*assign.Reference) + p.Print(nn.Variable) + io.WriteString(p.w, " =& ") + p.Print(nn.Expression) +} + +func (p *PrettyPrinter) printAssignBitwiseAnd(n node.Node) { + nn := n.(*assign.BitwiseAnd) + p.Print(nn.Variable) + io.WriteString(p.w, " &= ") + p.Print(nn.Expression) +} + +func (p *PrettyPrinter) printAssignBitwiseOr(n node.Node) { + nn := n.(*assign.BitwiseOr) + p.Print(nn.Variable) + io.WriteString(p.w, " |= ") + p.Print(nn.Expression) +} + +func (p *PrettyPrinter) printAssignBitwiseXor(n node.Node) { + nn := n.(*assign.BitwiseXor) + p.Print(nn.Variable) + io.WriteString(p.w, " ^= ") + p.Print(nn.Expression) +} + +func (p *PrettyPrinter) printAssignConcat(n node.Node) { + nn := n.(*assign.Concat) + p.Print(nn.Variable) + io.WriteString(p.w, " .= ") + p.Print(nn.Expression) +} + +func (p *PrettyPrinter) printAssignDiv(n node.Node) { + nn := n.(*assign.Div) + p.Print(nn.Variable) + io.WriteString(p.w, " /= ") + p.Print(nn.Expression) +} + +func (p *PrettyPrinter) printAssignMinus(n node.Node) { + nn := n.(*assign.Minus) + p.Print(nn.Variable) + io.WriteString(p.w, " -= ") + p.Print(nn.Expression) +} + +func (p *PrettyPrinter) printAssignMod(n node.Node) { + nn := n.(*assign.Mod) + p.Print(nn.Variable) + io.WriteString(p.w, " %= ") + p.Print(nn.Expression) +} + +func (p *PrettyPrinter) printAssignMul(n node.Node) { + nn := n.(*assign.Mul) + p.Print(nn.Variable) + io.WriteString(p.w, " *= ") + p.Print(nn.Expression) +} + +func (p *PrettyPrinter) printAssignPlus(n node.Node) { + nn := n.(*assign.Plus) + p.Print(nn.Variable) + io.WriteString(p.w, " += ") + p.Print(nn.Expression) +} + +func (p *PrettyPrinter) printAssignPow(n node.Node) { + nn := n.(*assign.Pow) + p.Print(nn.Variable) + io.WriteString(p.w, " **= ") + p.Print(nn.Expression) +} + +func (p *PrettyPrinter) printAssignShiftLeft(n node.Node) { + nn := n.(*assign.ShiftLeft) + p.Print(nn.Variable) + io.WriteString(p.w, " <<= ") + p.Print(nn.Expression) +} + +func (p *PrettyPrinter) printAssignShiftRight(n node.Node) { + nn := n.(*assign.ShiftRight) + p.Print(nn.Variable) + io.WriteString(p.w, " >>= ") + p.Print(nn.Expression) +} + +// binary + +func (p *PrettyPrinter) printBinaryBitwiseAnd(n node.Node) { + nn := n.(*binary.BitwiseAnd) + + p.Print(nn.Left) + io.WriteString(p.w, " & ") + p.Print(nn.Right) +} + +func (p *PrettyPrinter) printBinaryBitwiseOr(n node.Node) { + nn := n.(*binary.BitwiseOr) + + p.Print(nn.Left) + io.WriteString(p.w, " | ") + p.Print(nn.Right) +} + +func (p *PrettyPrinter) printBinaryBitwiseXor(n node.Node) { + nn := n.(*binary.BitwiseXor) + + p.Print(nn.Left) + io.WriteString(p.w, " ^ ") + p.Print(nn.Right) +} + +func (p *PrettyPrinter) printBinaryBooleanAnd(n node.Node) { + nn := n.(*binary.BooleanAnd) + + p.Print(nn.Left) + io.WriteString(p.w, " && ") + p.Print(nn.Right) +} + +func (p *PrettyPrinter) printBinaryBooleanOr(n node.Node) { + nn := n.(*binary.BooleanOr) + + p.Print(nn.Left) + io.WriteString(p.w, " || ") + p.Print(nn.Right) +} + +func (p *PrettyPrinter) printBinaryCoalesce(n node.Node) { + nn := n.(*binary.Coalesce) + + p.Print(nn.Left) + io.WriteString(p.w, " ?? ") + p.Print(nn.Right) +} + +func (p *PrettyPrinter) printBinaryConcat(n node.Node) { + nn := n.(*binary.Concat) + + p.Print(nn.Left) + io.WriteString(p.w, " . ") + p.Print(nn.Right) +} + +func (p *PrettyPrinter) printBinaryDiv(n node.Node) { + nn := n.(*binary.Div) + + p.Print(nn.Left) + io.WriteString(p.w, " / ") + p.Print(nn.Right) +} + +func (p *PrettyPrinter) printBinaryEqual(n node.Node) { + nn := n.(*binary.Equal) + + p.Print(nn.Left) + io.WriteString(p.w, " == ") + p.Print(nn.Right) +} + +func (p *PrettyPrinter) printBinaryGreaterOrEqual(n node.Node) { + nn := n.(*binary.GreaterOrEqual) + + p.Print(nn.Left) + io.WriteString(p.w, " >= ") + p.Print(nn.Right) +} + +func (p *PrettyPrinter) printBinaryGreater(n node.Node) { + nn := n.(*binary.Greater) + + p.Print(nn.Left) + io.WriteString(p.w, " > ") + p.Print(nn.Right) +} + +func (p *PrettyPrinter) printBinaryIdentical(n node.Node) { + nn := n.(*binary.Identical) + + p.Print(nn.Left) + io.WriteString(p.w, " === ") + p.Print(nn.Right) +} + +func (p *PrettyPrinter) printBinaryLogicalAnd(n node.Node) { + nn := n.(*binary.LogicalAnd) + + p.Print(nn.Left) + io.WriteString(p.w, " and ") + p.Print(nn.Right) +} + +func (p *PrettyPrinter) printBinaryLogicalOr(n node.Node) { + nn := n.(*binary.LogicalOr) + + p.Print(nn.Left) + io.WriteString(p.w, " or ") + p.Print(nn.Right) +} + +func (p *PrettyPrinter) printBinaryLogicalXor(n node.Node) { + nn := n.(*binary.LogicalXor) + + p.Print(nn.Left) + io.WriteString(p.w, " xor ") + p.Print(nn.Right) +} + +func (p *PrettyPrinter) printBinaryMinus(n node.Node) { + nn := n.(*binary.Minus) + + p.Print(nn.Left) + io.WriteString(p.w, " - ") + p.Print(nn.Right) +} + +func (p *PrettyPrinter) printBinaryMod(n node.Node) { + nn := n.(*binary.Mod) + + p.Print(nn.Left) + io.WriteString(p.w, " % ") + p.Print(nn.Right) +} + +func (p *PrettyPrinter) printBinaryMul(n node.Node) { + nn := n.(*binary.Mul) + + p.Print(nn.Left) + io.WriteString(p.w, " * ") + p.Print(nn.Right) +} + +func (p *PrettyPrinter) printBinaryNotEqual(n node.Node) { + nn := n.(*binary.NotEqual) + + p.Print(nn.Left) + io.WriteString(p.w, " != ") + p.Print(nn.Right) +} + +func (p *PrettyPrinter) printBinaryNotIdentical(n node.Node) { + nn := n.(*binary.NotIdentical) + + p.Print(nn.Left) + io.WriteString(p.w, " !== ") + p.Print(nn.Right) +} + +func (p *PrettyPrinter) printBinaryPlus(n node.Node) { + nn := n.(*binary.Plus) + + p.Print(nn.Left) + io.WriteString(p.w, " + ") + p.Print(nn.Right) +} + +func (p *PrettyPrinter) printBinaryPow(n node.Node) { + nn := n.(*binary.Pow) + + p.Print(nn.Left) + io.WriteString(p.w, " ** ") + p.Print(nn.Right) +} + +func (p *PrettyPrinter) printBinaryShiftLeft(n node.Node) { + nn := n.(*binary.ShiftLeft) + + p.Print(nn.Left) + io.WriteString(p.w, " << ") + p.Print(nn.Right) +} + +func (p *PrettyPrinter) printBinaryShiftRight(n node.Node) { + nn := n.(*binary.ShiftRight) + + p.Print(nn.Left) + io.WriteString(p.w, " >> ") + p.Print(nn.Right) +} + +func (p *PrettyPrinter) printBinarySmallerOrEqual(n node.Node) { + nn := n.(*binary.SmallerOrEqual) + + p.Print(nn.Left) + io.WriteString(p.w, " <= ") + p.Print(nn.Right) +} + +func (p *PrettyPrinter) printBinarySmaller(n node.Node) { + nn := n.(*binary.Smaller) + + p.Print(nn.Left) + io.WriteString(p.w, " < ") + p.Print(nn.Right) +} + +func (p *PrettyPrinter) printBinarySpaceship(n node.Node) { + nn := n.(*binary.Spaceship) + + p.Print(nn.Left) + io.WriteString(p.w, " <=> ") + p.Print(nn.Right) +} + +// cast + +func (p *PrettyPrinter) printArray(n node.Node) { + nn := n.(*cast.Array) + + io.WriteString(p.w, "(array)") + p.Print(nn.Expr) +} + +func (p *PrettyPrinter) printBool(n node.Node) { + nn := n.(*cast.Bool) + + io.WriteString(p.w, "(bool)") + p.Print(nn.Expr) +} + +func (p *PrettyPrinter) printDouble(n node.Node) { + nn := n.(*cast.Double) + + io.WriteString(p.w, "(float)") + p.Print(nn.Expr) +} + +func (p *PrettyPrinter) printInt(n node.Node) { + nn := n.(*cast.Int) + + io.WriteString(p.w, "(int)") + p.Print(nn.Expr) +} + +func (p *PrettyPrinter) printObject(n node.Node) { + nn := n.(*cast.Object) + + io.WriteString(p.w, "(object)") + p.Print(nn.Expr) +} + +func (p *PrettyPrinter) printString(n node.Node) { + nn := n.(*cast.String) + + io.WriteString(p.w, "(string)") + p.Print(nn.Expr) +} + +func (p *PrettyPrinter) printUnset(n node.Node) { + nn := n.(*cast.Unset) + + io.WriteString(p.w, "(unset)") + p.Print(nn.Expr) +} + +// expr + +func (p *PrettyPrinter) printExprArrayDimFetch(n node.Node) { + nn := n.(*expr.ArrayDimFetch) + p.Print(nn.Variable) + io.WriteString(p.w, "[") + p.Print(nn.Dim) + io.WriteString(p.w, "]") +} + +func (p *PrettyPrinter) printExprArrayItem(n node.Node) { + nn := n.(*expr.ArrayItem) + + if nn.Key != nil { + p.Print(nn.Key) + io.WriteString(p.w, " => ") + } + + p.Print(nn.Val) +} + +func (p *PrettyPrinter) printExprArray(n node.Node) { + nn := n.(*expr.Array) + + io.WriteString(p.w, "array(") + p.joinPrint(", ", nn.Items) + io.WriteString(p.w, ")") +} + +func (p *PrettyPrinter) printExprBitwiseNot(n node.Node) { + nn := n.(*expr.BitwiseNot) + io.WriteString(p.w, "~") + p.Print(nn.Expr) +} + +func (p *PrettyPrinter) printExprBooleanNot(n node.Node) { + nn := n.(*expr.BooleanNot) + io.WriteString(p.w, "!") + p.Print(nn.Expr) +} + +func (p *PrettyPrinter) printExprClassConstFetch(n node.Node) { + nn := n.(*expr.ClassConstFetch) + + p.Print(nn.Class) + io.WriteString(p.w, "::") + io.WriteString(p.w, nn.ConstantName.(*node.Identifier).Value) +} + +func (p *PrettyPrinter) printExprClone(n node.Node) { + nn := n.(*expr.Clone) + + io.WriteString(p.w, "clone ") + p.Print(nn.Expr) +} + +func (p *PrettyPrinter) printExprClosureUse(n node.Node) { + nn := n.(*expr.ClosureUse) + + io.WriteString(p.w, "use (") + p.joinPrint(", ", nn.Uses) + io.WriteString(p.w, ")") +} + +func (p *PrettyPrinter) printExprClosure(n node.Node) { + nn := n.(*expr.Closure) + + if nn.Static { + io.WriteString(p.w, "static ") + } + + io.WriteString(p.w, "function ") + + if nn.ReturnsRef { + io.WriteString(p.w, "&") + } + + io.WriteString(p.w, "(") + p.joinPrint(", ", nn.Params) + io.WriteString(p.w, ")") + + if nn.ClosureUse != nil { + io.WriteString(p.w, " ") + p.Print(nn.ClosureUse) + } + + if nn.ReturnType != nil { + io.WriteString(p.w, ": ") + p.Print(nn.ReturnType) + } + + io.WriteString(p.w, " {\n") + p.printNodes(nn.Stmts) + io.WriteString(p.w, "\n") + p.printIndent() + io.WriteString(p.w, "}") +} + +func (p *PrettyPrinter) printExprConstFetch(n node.Node) { + nn := n.(*expr.ConstFetch) + + p.Print(nn.Constant) +} + +func (p *PrettyPrinter) printExprDie(n node.Node) { + nn := n.(*expr.Die) + + io.WriteString(p.w, "die(") + p.Print(nn.Expr) + io.WriteString(p.w, ")") +} + +func (p *PrettyPrinter) printExprEmpty(n node.Node) { + nn := n.(*expr.Empty) + + io.WriteString(p.w, "empty(") + p.Print(nn.Expr) + io.WriteString(p.w, ")") +} + +func (p *PrettyPrinter) printExprErrorSuppress(n node.Node) { + nn := n.(*expr.ErrorSuppress) + + io.WriteString(p.w, "@") + p.Print(nn.Expr) +} + +func (p *PrettyPrinter) printExprEval(n node.Node) { + nn := n.(*expr.Eval) + + io.WriteString(p.w, "eval(") + p.Print(nn.Expr) + io.WriteString(p.w, ")") +} + +func (p *PrettyPrinter) printExprExit(n node.Node) { + nn := n.(*expr.Exit) + + io.WriteString(p.w, "exit(") + p.Print(nn.Expr) + io.WriteString(p.w, ")") +} + +func (p *PrettyPrinter) printExprFunctionCall(n node.Node) { + nn := n.(*expr.FunctionCall) + + p.Print(nn.Function) + io.WriteString(p.w, "(") + p.joinPrint(", ", nn.ArgumentList.Arguments) + io.WriteString(p.w, ")") +} + +func (p *PrettyPrinter) printExprInclude(n node.Node) { + nn := n.(*expr.Include) + + io.WriteString(p.w, "include ") + p.Print(nn.Expr) +} + +func (p *PrettyPrinter) printExprIncludeOnce(n node.Node) { + nn := n.(*expr.IncludeOnce) + + io.WriteString(p.w, "include_once ") + p.Print(nn.Expr) +} + +func (p *PrettyPrinter) printExprInstanceOf(n node.Node) { + nn := n.(*expr.InstanceOf) + + p.Print(nn.Expr) + io.WriteString(p.w, " instanceof ") + p.Print(nn.Class) +} + +func (p *PrettyPrinter) printExprIsset(n node.Node) { + nn := n.(*expr.Isset) + + io.WriteString(p.w, "isset(") + p.joinPrint(", ", nn.Variables) + io.WriteString(p.w, ")") +} + +func (p *PrettyPrinter) printExprList(n node.Node) { + nn := n.(*expr.List) + + io.WriteString(p.w, "list(") + p.joinPrint(", ", nn.Items) + io.WriteString(p.w, ")") +} + +func (p *PrettyPrinter) printExprMethodCall(n node.Node) { + nn := n.(*expr.MethodCall) + + p.Print(nn.Variable) + io.WriteString(p.w, "->") + p.Print(nn.Method) + io.WriteString(p.w, "(") + p.joinPrint(", ", nn.ArgumentList.Arguments) + io.WriteString(p.w, ")") +} + +func (p *PrettyPrinter) printExprNew(n node.Node) { + nn := n.(*expr.New) + + io.WriteString(p.w, "new ") + p.Print(nn.Class) + + if nn.ArgumentList != nil { + io.WriteString(p.w, "(") + p.joinPrint(", ", nn.ArgumentList.Arguments) + io.WriteString(p.w, ")") + } +} + +func (p *PrettyPrinter) printExprPostDec(n node.Node) { + nn := n.(*expr.PostDec) + + p.Print(nn.Variable) + io.WriteString(p.w, "--") +} + +func (p *PrettyPrinter) printExprPostInc(n node.Node) { + nn := n.(*expr.PostInc) + + p.Print(nn.Variable) + io.WriteString(p.w, "++") +} + +func (p *PrettyPrinter) printExprPreDec(n node.Node) { + nn := n.(*expr.PreDec) + + io.WriteString(p.w, "--") + p.Print(nn.Variable) +} + +func (p *PrettyPrinter) printExprPreInc(n node.Node) { + nn := n.(*expr.PreInc) + + io.WriteString(p.w, "++") + p.Print(nn.Variable) +} + +func (p *PrettyPrinter) printExprPrint(n node.Node) { + nn := n.(*expr.Print) + + io.WriteString(p.w, "print(") + p.Print(nn.Expr) + io.WriteString(p.w, ")") +} + +func (p *PrettyPrinter) printExprPropertyFetch(n node.Node) { + nn := n.(*expr.PropertyFetch) + + p.Print(nn.Variable) + io.WriteString(p.w, "->") + p.Print(nn.Property) +} + +func (p *PrettyPrinter) printExprReference(n node.Node) { + nn := n.(*expr.Reference) + + io.WriteString(p.w, "&") + p.Print(nn.Variable) +} + +func (p *PrettyPrinter) printExprRequire(n node.Node) { + nn := n.(*expr.Require) + + io.WriteString(p.w, "require ") + p.Print(nn.Expr) +} + +func (p *PrettyPrinter) printExprRequireOnce(n node.Node) { + nn := n.(*expr.RequireOnce) + + io.WriteString(p.w, "require_once ") + p.Print(nn.Expr) +} + +func (p *PrettyPrinter) printExprShellExec(n node.Node) { + nn := n.(*expr.ShellExec) + + io.WriteString(p.w, "`") + for _, part := range nn.Parts { + p.Print(part) + } + io.WriteString(p.w, "`") +} + +func (p *PrettyPrinter) printExprShortArray(n node.Node) { + nn := n.(*expr.ShortArray) + + io.WriteString(p.w, "[") + p.joinPrint(", ", nn.Items) + io.WriteString(p.w, "]") +} + +func (p *PrettyPrinter) printExprShortList(n node.Node) { + nn := n.(*expr.ShortList) + + io.WriteString(p.w, "[") + p.joinPrint(", ", nn.Items) + io.WriteString(p.w, "]") +} + +func (p *PrettyPrinter) printExprStaticCall(n node.Node) { + nn := n.(*expr.StaticCall) + + p.Print(nn.Class) + io.WriteString(p.w, "::") + p.Print(nn.Call) + io.WriteString(p.w, "(") + p.joinPrint(", ", nn.ArgumentList.Arguments) + io.WriteString(p.w, ")") +} + +func (p *PrettyPrinter) printExprStaticPropertyFetch(n node.Node) { + nn := n.(*expr.StaticPropertyFetch) + + p.Print(nn.Class) + io.WriteString(p.w, "::") + p.Print(nn.Property) +} + +func (p *PrettyPrinter) printExprTernary(n node.Node) { + nn := n.(*expr.Ternary) + + p.Print(nn.Condition) + io.WriteString(p.w, " ?") + + if nn.IfTrue != nil { + io.WriteString(p.w, " ") + p.Print(nn.IfTrue) + io.WriteString(p.w, " ") + } + + io.WriteString(p.w, ": ") + p.Print(nn.IfFalse) +} + +func (p *PrettyPrinter) printExprUnaryMinus(n node.Node) { + nn := n.(*expr.UnaryMinus) + + io.WriteString(p.w, "-") + p.Print(nn.Expr) +} + +func (p *PrettyPrinter) printExprUnaryPlus(n node.Node) { + nn := n.(*expr.UnaryPlus) + + io.WriteString(p.w, "+") + p.Print(nn.Expr) +} + +func (p *PrettyPrinter) printExprVariable(n node.Node) { + io.WriteString(p.w, "$") + p.Print(n.(*expr.Variable).VarName) +} + +func (p *PrettyPrinter) printExprYieldFrom(n node.Node) { + nn := n.(*expr.YieldFrom) + + io.WriteString(p.w, "yield from ") + p.Print(nn.Expr) +} + +func (p *PrettyPrinter) printExprYield(n node.Node) { + nn := n.(*expr.Yield) + + io.WriteString(p.w, "yield ") + + if nn.Key != nil { + p.Print(nn.Key) + io.WriteString(p.w, " => ") + } + + p.Print(nn.Value) +} + +// smtm + +func (p *PrettyPrinter) printStmtAltElseIf(n node.Node) { + nn := n.(*stmt.AltElseIf) + + io.WriteString(p.w, "elseif (") + p.Print(nn.Cond) + io.WriteString(p.w, ") :") + + if s := nn.Stmt.(*stmt.StmtList).Stmts; len(s) > 0 { + io.WriteString(p.w, "\n") + p.printNodes(s) + } +} + +func (p *PrettyPrinter) printStmtAltElse(n node.Node) { + nn := n.(*stmt.AltElse) + + io.WriteString(p.w, "else :") + + if s := nn.Stmt.(*stmt.StmtList).Stmts; len(s) > 0 { + io.WriteString(p.w, "\n") + p.printNodes(s) + } +} + +func (p *PrettyPrinter) printStmtAltFor(n node.Node) { + nn := n.(*stmt.AltFor) + + io.WriteString(p.w, "for (") + p.joinPrint(", ", nn.Init) + io.WriteString(p.w, "; ") + p.joinPrint(", ", nn.Cond) + io.WriteString(p.w, "; ") + p.joinPrint(", ", nn.Loop) + io.WriteString(p.w, ") :\n") + + s := nn.Stmt.(*stmt.StmtList) + p.printNodes(s.Stmts) + io.WriteString(p.w, "\n") + p.printIndent() + + io.WriteString(p.w, "endfor;") +} + +func (p *PrettyPrinter) printStmtAltForeach(n node.Node) { + nn := n.(*stmt.AltForeach) + + io.WriteString(p.w, "foreach (") + p.Print(nn.Expr) + io.WriteString(p.w, " as ") + + if nn.Key != nil { + p.Print(nn.Key) + io.WriteString(p.w, " => ") + } + + p.Print(nn.Variable) + + io.WriteString(p.w, ") :\n") + + s := nn.Stmt.(*stmt.StmtList) + p.printNodes(s.Stmts) + + io.WriteString(p.w, "\n") + p.printIndent() + io.WriteString(p.w, "endforeach;") +} + +func (p *PrettyPrinter) printStmtAltIf(n node.Node) { + nn := n.(*stmt.AltIf) + + io.WriteString(p.w, "if (") + p.Print(nn.Cond) + io.WriteString(p.w, ") :\n") + + s := nn.Stmt.(*stmt.StmtList) + p.printNodes(s.Stmts) + + for _, elseif := range nn.ElseIf { + io.WriteString(p.w, "\n") + p.printIndent() + p.Print(elseif) + } + + if nn.Else != nil { + io.WriteString(p.w, "\n") + p.printIndent() + p.Print(nn.Else) + } + + io.WriteString(p.w, "\n") + p.printIndent() + io.WriteString(p.w, "endif;") +} + +func (p *PrettyPrinter) printStmtAltSwitch(n node.Node) { + nn := n.(*stmt.AltSwitch) + + io.WriteString(p.w, "switch (") + p.Print(nn.Cond) + io.WriteString(p.w, ") :\n") + + s := nn.CaseList.Cases + p.printNodes(s) + + io.WriteString(p.w, "\n") + p.printIndent() + io.WriteString(p.w, "endswitch;") +} + +func (p *PrettyPrinter) printStmtAltWhile(n node.Node) { + nn := n.(*stmt.AltWhile) + + io.WriteString(p.w, "while (") + p.Print(nn.Cond) + io.WriteString(p.w, ") :\n") + + s := nn.Stmt.(*stmt.StmtList) + p.printNodes(s.Stmts) + + io.WriteString(p.w, "\n") + p.printIndent() + io.WriteString(p.w, "endwhile;") +} + +func (p *PrettyPrinter) printStmtBreak(n node.Node) { + nn := n.(*stmt.Break) + + io.WriteString(p.w, "break") + if nn.Expr != nil { + io.WriteString(p.w, " ") + p.Print(nn.Expr) + } + + io.WriteString(p.w, ";") +} + +func (p *PrettyPrinter) printStmtCase(n node.Node) { + nn := n.(*stmt.Case) + + io.WriteString(p.w, "case ") + p.Print(nn.Cond) + io.WriteString(p.w, ":") + + if len(nn.Stmts) > 0 { + io.WriteString(p.w, "\n") + p.printNodes(nn.Stmts) + } +} + +func (p *PrettyPrinter) printStmtCatch(n node.Node) { + nn := n.(*stmt.Catch) + + io.WriteString(p.w, "catch (") + p.joinPrint(" | ", nn.Types) + io.WriteString(p.w, " ") + p.Print(nn.Variable) + io.WriteString(p.w, ") {\n") + p.printNodes(nn.Stmts) + io.WriteString(p.w, "\n") + p.printIndent() + io.WriteString(p.w, "}") +} + +func (p *PrettyPrinter) printStmtClassMethod(n node.Node) { + nn := n.(*stmt.ClassMethod) + + if nn.Modifiers != nil { + p.joinPrint(" ", nn.Modifiers) + io.WriteString(p.w, " ") + } + io.WriteString(p.w, "function ") + + if nn.ReturnsRef { + io.WriteString(p.w, "&") + } + + p.Print(nn.MethodName) + io.WriteString(p.w, "(") + p.joinPrint(", ", nn.Params) + io.WriteString(p.w, ")") + + if nn.ReturnType != nil { + io.WriteString(p.w, ": ") + p.Print(nn.ReturnType) + } + + switch s := nn.Stmt.(type) { + case *stmt.StmtList: + io.WriteString(p.w, "\n") + p.printIndent() + io.WriteString(p.w, "{\n") + p.printNodes(s.Stmts) + io.WriteString(p.w, "\n") + p.printIndent() + io.WriteString(p.w, "}") + default: + p.Print(s) + } +} + +func (p *PrettyPrinter) printStmtClass(n node.Node) { + nn := n.(*stmt.Class) + + if nn.Modifiers != nil { + p.joinPrint(" ", nn.Modifiers) + io.WriteString(p.w, " ") + } + io.WriteString(p.w, "class") + + if nn.ClassName != nil { + io.WriteString(p.w, " ") + p.Print(nn.ClassName) + } + + if nn.ArgumentList != nil { + io.WriteString(p.w, "(") + p.joinPrint(", ", nn.ArgumentList.Arguments) + io.WriteString(p.w, ")") + } + + if nn.Extends != nil { + io.WriteString(p.w, " extends ") + p.Print(nn.Extends.ClassName) + } + + if nn.Implements != nil { + io.WriteString(p.w, " implements ") + p.joinPrint(", ", nn.Implements.InterfaceNames) + } + + io.WriteString(p.w, "\n") + p.printIndent() + io.WriteString(p.w, "{\n") + p.printNodes(nn.Stmts) + io.WriteString(p.w, "\n") + p.printIndent() + io.WriteString(p.w, "}") +} + +func (p *PrettyPrinter) printStmtClassConstList(n node.Node) { + nn := n.(*stmt.ClassConstList) + + if nn.Modifiers != nil { + p.joinPrint(" ", nn.Modifiers) + io.WriteString(p.w, " ") + } + io.WriteString(p.w, "const ") + + p.joinPrint(", ", nn.Consts) + + io.WriteString(p.w, ";") +} + +func (p *PrettyPrinter) printStmtConstant(n node.Node) { + nn := n.(*stmt.Constant) + + p.Print(nn.ConstantName) + io.WriteString(p.w, " = ") + p.Print(nn.Expr) +} + +func (p *PrettyPrinter) printStmtContinue(n node.Node) { + nn := n.(*stmt.Continue) + + io.WriteString(p.w, "continue") + if nn.Expr != nil { + io.WriteString(p.w, " ") + p.Print(nn.Expr) + } + + io.WriteString(p.w, ";") +} + +func (p *PrettyPrinter) printStmtDeclare(n node.Node) { + nn := n.(*stmt.Declare) + + io.WriteString(p.w, "declare(") + p.joinPrint(", ", nn.Consts) + io.WriteString(p.w, ")") + + switch s := nn.Stmt.(type) { + case *stmt.Nop: + p.Print(s) + break + case *stmt.StmtList: + io.WriteString(p.w, " ") + p.Print(s) + default: + io.WriteString(p.w, "\n") + p.indentDepth++ + p.printIndent() + p.Print(s) + p.indentDepth-- + } +} + +func (p *PrettyPrinter) printStmtDefault(n node.Node) { + nn := n.(*stmt.Default) + io.WriteString(p.w, "default:") + + if len(nn.Stmts) > 0 { + io.WriteString(p.w, "\n") + p.printNodes(nn.Stmts) + } +} + +func (p *PrettyPrinter) printStmtDo(n node.Node) { + nn := n.(*stmt.Do) + io.WriteString(p.w, "do") + + switch s := nn.Stmt.(type) { + case *stmt.StmtList: + io.WriteString(p.w, " ") + p.Print(s) + io.WriteString(p.w, " ") + default: + io.WriteString(p.w, "\n") + p.indentDepth++ + p.printIndent() + p.Print(s) + p.indentDepth-- + io.WriteString(p.w, "\n") + p.printIndent() + } + + io.WriteString(p.w, "while (") + p.Print(nn.Cond) + io.WriteString(p.w, ");") +} + +func (p *PrettyPrinter) printStmtEcho(n node.Node) { + nn := n.(*stmt.Echo) + io.WriteString(p.w, "echo ") + p.joinPrint(", ", nn.Exprs) + io.WriteString(p.w, ";") +} + +func (p *PrettyPrinter) printStmtElseif(n node.Node) { + nn := n.(*stmt.ElseIf) + + io.WriteString(p.w, "elseif (") + p.Print(nn.Cond) + io.WriteString(p.w, ")") + + switch s := nn.Stmt.(type) { + case *stmt.Nop: + p.Print(s) + break + case *stmt.StmtList: + io.WriteString(p.w, " ") + p.Print(s) + default: + io.WriteString(p.w, "\n") + p.indentDepth++ + p.printIndent() + p.Print(s) + p.indentDepth-- + } +} + +func (p *PrettyPrinter) printStmtElse(n node.Node) { + nn := n.(*stmt.Else) + + io.WriteString(p.w, "else") + + switch s := nn.Stmt.(type) { + case *stmt.Nop: + p.Print(s) + break + case *stmt.StmtList: + io.WriteString(p.w, " ") + p.Print(s) + default: + io.WriteString(p.w, "\n") + p.indentDepth++ + p.printIndent() + p.Print(s) + p.indentDepth-- + } +} + +func (p *PrettyPrinter) printStmtExpression(n node.Node) { + nn := n.(*stmt.Expression) + + p.Print(nn.Expr) + + io.WriteString(p.w, ";") +} + +func (p *PrettyPrinter) printStmtFinally(n node.Node) { + nn := n.(*stmt.Finally) + + io.WriteString(p.w, "finally {\n") + p.printNodes(nn.Stmts) + io.WriteString(p.w, "\n") + p.printIndent() + io.WriteString(p.w, "}") +} + +func (p *PrettyPrinter) printStmtFor(n node.Node) { + nn := n.(*stmt.For) + + io.WriteString(p.w, "for (") + p.joinPrint(", ", nn.Init) + io.WriteString(p.w, "; ") + p.joinPrint(", ", nn.Cond) + io.WriteString(p.w, "; ") + p.joinPrint(", ", nn.Loop) + io.WriteString(p.w, ")") + + switch s := nn.Stmt.(type) { + case *stmt.Nop: + p.Print(s) + break + case *stmt.StmtList: + io.WriteString(p.w, " ") + p.Print(s) + default: + io.WriteString(p.w, "\n") + p.indentDepth++ + p.printIndent() + p.Print(s) + p.indentDepth-- + } +} + +func (p *PrettyPrinter) printStmtForeach(n node.Node) { + nn := n.(*stmt.Foreach) + + io.WriteString(p.w, "foreach (") + p.Print(nn.Expr) + io.WriteString(p.w, " as ") + + if nn.Key != nil { + p.Print(nn.Key) + io.WriteString(p.w, " => ") + } + + p.Print(nn.Variable) + io.WriteString(p.w, ")") + + switch s := nn.Stmt.(type) { + case *stmt.Nop: + p.Print(s) + break + case *stmt.StmtList: + io.WriteString(p.w, " ") + p.Print(s) + default: + io.WriteString(p.w, "\n") + p.indentDepth++ + p.printIndent() + p.Print(s) + p.indentDepth-- + } +} + +func (p *PrettyPrinter) printStmtFunction(n node.Node) { + nn := n.(*stmt.Function) + + io.WriteString(p.w, "function ") + + if nn.ReturnsRef { + io.WriteString(p.w, "&") + } + + p.Print(nn.FunctionName) + + io.WriteString(p.w, "(") + p.joinPrint(", ", nn.Params) + io.WriteString(p.w, ")") + + if nn.ReturnType != nil { + io.WriteString(p.w, ": ") + p.Print(nn.ReturnType) + } + + io.WriteString(p.w, " {\n") + p.printNodes(nn.Stmts) + io.WriteString(p.w, "\n") + p.printIndent() + io.WriteString(p.w, "}") +} + +func (p *PrettyPrinter) printStmtGlobal(n node.Node) { + nn := n.(*stmt.Global) + + io.WriteString(p.w, "global ") + p.joinPrint(", ", nn.Vars) + io.WriteString(p.w, ";") +} + +func (p *PrettyPrinter) printStmtGoto(n node.Node) { + nn := n.(*stmt.Goto) + + io.WriteString(p.w, "goto ") + p.Print(nn.Label) + io.WriteString(p.w, ";") +} + +func (p *PrettyPrinter) printStmtGroupUse(n node.Node) { + nn := n.(*stmt.GroupUse) + + io.WriteString(p.w, "use ") + + if nn.UseType != nil { + p.Print(nn.UseType) + io.WriteString(p.w, " ") + } + + p.Print(nn.Prefix) + io.WriteString(p.w, "\\{") + p.joinPrint(", ", nn.UseList) + io.WriteString(p.w, "};") +} + +func (p *PrettyPrinter) printStmtHaltCompiler(n node.Node) { + io.WriteString(p.w, "__halt_compiler();") +} + +func (p *PrettyPrinter) printStmtIf(n node.Node) { + nn := n.(*stmt.If) + + io.WriteString(p.w, "if (") + p.Print(nn.Cond) + io.WriteString(p.w, ")") + + switch s := nn.Stmt.(type) { + case *stmt.Nop: + p.Print(s) + break + case *stmt.StmtList: + io.WriteString(p.w, " ") + p.Print(s) + default: + io.WriteString(p.w, "\n") + p.indentDepth++ + p.printIndent() + p.Print(s) + p.indentDepth-- + } + + if nn.ElseIf != nil { + io.WriteString(p.w, "\n") + p.indentDepth-- + p.printNodes(nn.ElseIf) + p.indentDepth++ + } + + if nn.Else != nil { + io.WriteString(p.w, "\n") + p.printIndent() + p.Print(nn.Else) + } +} + +func (p *PrettyPrinter) printStmtInlineHTML(n node.Node) { + nn := n.(*stmt.InlineHtml) + + io.WriteString(p.w, "?>") + io.WriteString(p.w, nn.Value) + io.WriteString(p.w, "HTML"}, + &stmt.Expression{ + Expr: &scalar.Heredoc{ + Label: "\"LBL\"", + Parts: []node.Node{ + &scalar.EncapsedStringPart{Value: "hello world\n"}, + }, + }, + }, + }, + }) + + expected := `