diff --git a/README.md b/README.md
index acc6b16..1e2fd02 100644
--- a/README.md
+++ b/README.md
@@ -122,21 +122,27 @@ nodes := &stmt.StmtList{
&name.NamePart{Value: "Bar"},
},
},
- Extends: &name.Name{
- Parts: []node.Node{
- &name.NamePart{Value: "Baz"},
- },
- },
+ Extends: &stmt.ClassExtends{
+ ClassName: &name.Name{
+ Parts: []node.Node{
+ &name.NamePart{
+ Value: "Baz"
+ },
+ },
+ },
+ },
Stmts: []node.Node{
&stmt.ClassMethod{
Modifiers: []node.Node{
&node.Identifier{Value: "public"},
},
MethodName: &node.Identifier{Value: "greet"},
- Stmts: []node.Node{
- &stmt.Echo{
- Exprs: []node.Node{
- &scalar.String{Value: "'Hello world'"},
+ Stmt: &stmt.StmtList{
+ Stmts: []node.Node{
+ &stmt.Echo{
+ Exprs: []node.Node{
+ &scalar.String{Value: "'Hello world'"},
+ },
},
},
},
diff --git a/comment/comment.go b/comment/comment.go
index f65f067..943bd60 100644
--- a/comment/comment.go
+++ b/comment/comment.go
@@ -1,16 +1,40 @@
package comment
-import "github.com/z7zmey/php-parser/node"
+import (
+ "github.com/z7zmey/php-parser/position"
+)
-// Comment represents comment lines in the code
-type Comment interface {
- String() string
+// Comment aggrigates information about comment /**
+type Comment struct {
+ value string
+ position *position.Position
+ tokenName TokenName
}
-// Comments a collection of comment groups assigned to nodes
-type Comments map[node.Node][]Comment
-
-// AddComments add comment group to the collection
-func (c Comments) AddComments(node node.Node, comments []Comment) {
- c[node] = append(c[node], comments...)
+// NewComment - Comment constructor
+func NewComment(value string, pos *position.Position) *Comment {
+ return &Comment{
+ value,
+ pos,
+ UnknownToken,
+ }
+}
+
+// SetTokenName sets token name
+func (c *Comment) SetTokenName(tokenName TokenName) {
+ c.tokenName = tokenName
+}
+
+// TokenName returns token name
+func (c *Comment) TokenName() TokenName {
+ return c.tokenName
+}
+
+func (c *Comment) String() string {
+ return c.value
+}
+
+// Position returns comment position
+func (c *Comment) Position() *position.Position {
+ return c.position
}
diff --git a/comment/comment_test.go b/comment/comment_test.go
index a89b0e1..72e1981 100644
--- a/comment/comment_test.go
+++ b/comment/comment_test.go
@@ -3,25 +3,31 @@ package comment_test
import (
"testing"
+ "github.com/z7zmey/php-parser/position"
+
"github.com/z7zmey/php-parser/comment"
- "github.com/z7zmey/php-parser/node"
)
-func TestComments(t *testing.T) {
- n := node.NewIdentifier("test")
+func TestCommentGetPosition(t *testing.T) {
+ expected := position.NewPosition(0, 0, 0, 0)
- commentGroup := []comment.Comment{
- comment.NewDocComment("/** hello world */"),
- comment.NewPlainComment("// hello world"),
- }
+ comment := comment.NewComment("/** hello world */", expected)
- comments := comment.Comments{}
- comments.AddComments(n, commentGroup)
+ actual := comment.Position()
- if comments[n][0].String() != "/** hello world */" {
- t.Errorf("expected and actual are not equal\n")
- }
- if comments[n][1].String() != "// hello world" {
+ if expected != actual {
+ t.Errorf("expected and actual are not equal\n")
+ }
+}
+
+func TestCommentPrint(t *testing.T) {
+ expected := "/** hello world */"
+
+ comment := comment.NewComment(expected, nil)
+
+ actual := comment.String()
+
+ if expected != actual {
t.Errorf("expected and actual are not equal\n")
}
}
diff --git a/comment/doc_comment.go b/comment/doc_comment.go
deleted file mode 100644
index c0b9a93..0000000
--- a/comment/doc_comment.go
+++ /dev/null
@@ -1,17 +0,0 @@
-package comment
-
-// DocComment represents comments that start /**
-type DocComment struct {
- value string
-}
-
-// NewDocComment - DocComment constructor
-func NewDocComment(value string) *DocComment {
- return &DocComment{
- value,
- }
-}
-
-func (c *DocComment) String() string {
- return c.value
-}
diff --git a/comment/plain_comment.go b/comment/plain_comment.go
deleted file mode 100644
index 89371a8..0000000
--- a/comment/plain_comment.go
+++ /dev/null
@@ -1,17 +0,0 @@
-package comment
-
-// PlainComment represents comments that dont start /**
-type PlainComment struct {
- value string
-}
-
-// NewPlainComment - PlainComment constructor
-func NewPlainComment(value string) *PlainComment {
- return &PlainComment{
- value,
- }
-}
-
-func (c *PlainComment) String() string {
- return c.value
-}
diff --git a/comment/tokenNames.go b/comment/tokenNames.go
new file mode 100644
index 0000000..f02c45b
--- /dev/null
+++ b/comment/tokenNames.go
@@ -0,0 +1,328 @@
+package comment
+
+// 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/errors/error.go b/errors/error.go
index 06ac931..f0f05e0 100644
--- a/errors/error.go
+++ b/errors/error.go
@@ -4,25 +4,20 @@ import (
"fmt"
"github.com/z7zmey/php-parser/position"
- "github.com/z7zmey/php-parser/token"
+ "github.com/z7zmey/php-parser/scanner"
)
// Error parsing error
type Error struct {
Msg string
- Pos position.Position
+ Pos *position.Position
}
// NewError creates and returns new Error
-func NewError(msg string, t token.Token) *Error {
+func NewError(msg string, t *scanner.Token) *Error {
return &Error{
Msg: msg,
- Pos: position.Position{
- StartLine: t.StartLine,
- EndLine: t.EndLine,
- StartPos: t.StartPos,
- EndPos: t.EndPos,
- },
+ Pos: t.Position(),
}
}
diff --git a/errors/error_test.go b/errors/error_test.go
index 2892658..37e62d4 100644
--- a/errors/error_test.go
+++ b/errors/error_test.go
@@ -7,7 +7,7 @@ import (
"github.com/z7zmey/php-parser/position"
"github.com/z7zmey/php-parser/errors"
- "github.com/z7zmey/php-parser/token"
+ "github.com/z7zmey/php-parser/scanner"
"github.com/kylelemons/godebug/pretty"
)
@@ -26,37 +26,22 @@ func assertEqual(t *testing.T, expected interface{}, actual interface{}) {
}
func TestConstructor(t *testing.T) {
- token := token.Token{
- Value: "test",
- StartLine: 1,
- EndLine: 2,
- StartPos: 3,
- EndPos: 4,
- }
+ pos := position.NewPosition(1, 2, 3, 4)
+ token := scanner.NewToken(`test`, pos)
actual := errors.NewError("message", token)
expected := &errors.Error{
Msg: "message",
- Pos: position.Position{
- StartLine: 1,
- EndLine: 2,
- StartPos: 3,
- EndPos: 4,
- },
+ Pos: pos,
}
assertEqual(t, expected, actual)
}
func TestPrint(t *testing.T) {
- token := token.Token{
- Value: "test",
- StartLine: 1,
- EndLine: 2,
- StartPos: 3,
- EndPos: 4,
- }
+ pos := position.NewPosition(1, 2, 3, 4)
+ token := scanner.NewToken(`test`, pos)
Error := errors.NewError("message", token)
diff --git a/node/expr/assign/t_assign_op_test.go b/node/expr/assign/t_assign_op_test.go
index a901fae..207e891 100644
--- a/node/expr/assign/t_assign_op_test.go
+++ b/node/expr/assign/t_assign_op_test.go
@@ -32,7 +32,7 @@ func assertEqual(t *testing.T, expected interface{}, actual interface{}) {
func TestReference(t *testing.T) {
src := ` $a =& $b;`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Expression{
Expr: &assign.Reference{
@@ -57,7 +57,7 @@ func TestReference(t *testing.T) {
func TestReferenceNew(t *testing.T) {
src := ` $a =& new Foo;`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Expression{
Expr: &assign.Reference{
@@ -88,7 +88,7 @@ func TestReferenceNew(t *testing.T) {
func TestReferenceArgs(t *testing.T) {
src := ` $a =& new Foo($b);`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Expression{
Expr: &assign.Reference{
@@ -99,11 +99,13 @@ func TestReferenceArgs(t *testing.T) {
&name.NamePart{Value: "Foo"},
},
},
- Arguments: []node.Node{
- &node.Argument{
- Variadic: false,
- IsReference: false,
- Expr: &expr.Variable{VarName: &node.Identifier{Value: "b"}},
+ ArgumentList: &node.ArgumentList{
+ Arguments: []node.Node{
+ &node.Argument{
+ Variadic: false,
+ IsReference: false,
+ Expr: &expr.Variable{VarName: &node.Identifier{Value: "b"}},
+ },
},
},
},
@@ -126,7 +128,7 @@ func TestReferenceArgs(t *testing.T) {
func TestAssign(t *testing.T) {
src := ` $a = $b;`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Expression{
Expr: &assign.Assign{
@@ -151,7 +153,7 @@ func TestAssign(t *testing.T) {
func TestBitwiseAnd(t *testing.T) {
src := ` $a &= $b;`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Expression{
Expr: &assign.BitwiseAnd{
@@ -176,7 +178,7 @@ func TestBitwiseAnd(t *testing.T) {
func TestBitwiseOr(t *testing.T) {
src := ` $a |= $b;`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Expression{
Expr: &assign.BitwiseOr{
@@ -201,7 +203,7 @@ func TestBitwiseOr(t *testing.T) {
func TestBitwiseXor(t *testing.T) {
src := ` $a ^= $b;`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Expression{
Expr: &assign.BitwiseXor{
@@ -226,7 +228,7 @@ func TestBitwiseXor(t *testing.T) {
func TestConcat(t *testing.T) {
src := ` $a .= $b;`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Expression{
Expr: &assign.Concat{
@@ -251,7 +253,7 @@ func TestConcat(t *testing.T) {
func TestDiv(t *testing.T) {
src := ` $a /= $b;`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Expression{
Expr: &assign.Div{
@@ -276,7 +278,7 @@ func TestDiv(t *testing.T) {
func TestMinus(t *testing.T) {
src := ` $a -= $b;`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Expression{
Expr: &assign.Minus{
@@ -301,7 +303,7 @@ func TestMinus(t *testing.T) {
func TestMod(t *testing.T) {
src := ` $a %= $b;`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Expression{
Expr: &assign.Mod{
@@ -326,7 +328,7 @@ func TestMod(t *testing.T) {
func TestMul(t *testing.T) {
src := ` $a *= $b;`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Expression{
Expr: &assign.Mul{
@@ -351,7 +353,7 @@ func TestMul(t *testing.T) {
func TestPlus(t *testing.T) {
src := ` $a += $b;`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Expression{
Expr: &assign.Plus{
@@ -376,7 +378,7 @@ func TestPlus(t *testing.T) {
func TestPow(t *testing.T) {
src := ` $a **= $b;`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Expression{
Expr: &assign.Pow{
@@ -401,7 +403,7 @@ func TestPow(t *testing.T) {
func TestShiftLeft(t *testing.T) {
src := ` $a <<= $b;`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Expression{
Expr: &assign.ShiftLeft{
@@ -426,7 +428,7 @@ func TestShiftLeft(t *testing.T) {
func TestShiftRight(t *testing.T) {
src := ` $a >>= $b;`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Expression{
Expr: &assign.ShiftRight{
diff --git a/node/expr/binary/t_binary_op_test.go b/node/expr/binary/t_binary_op_test.go
index 414af88..3f316d0 100644
--- a/node/expr/binary/t_binary_op_test.go
+++ b/node/expr/binary/t_binary_op_test.go
@@ -30,7 +30,7 @@ func assertEqual(t *testing.T, expected interface{}, actual interface{}) {
func TestBitwiseAnd(t *testing.T) {
src := ` $a & $b;`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Expression{
Expr: &binary.BitwiseAnd{
@@ -55,7 +55,7 @@ func TestBitwiseAnd(t *testing.T) {
func TestBitwiseOr(t *testing.T) {
src := ` $a | $b;`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Expression{
Expr: &binary.BitwiseOr{
@@ -80,7 +80,7 @@ func TestBitwiseOr(t *testing.T) {
func TestBitwiseXor(t *testing.T) {
src := ` $a ^ $b;`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Expression{
Expr: &binary.BitwiseXor{
@@ -105,7 +105,7 @@ func TestBitwiseXor(t *testing.T) {
func TestBooleanAnd(t *testing.T) {
src := ` $a && $b;`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Expression{
Expr: &binary.BooleanAnd{
@@ -130,7 +130,7 @@ func TestBooleanAnd(t *testing.T) {
func TestBooleanOr(t *testing.T) {
src := ` $a || $b;`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Expression{
Expr: &binary.BooleanOr{
@@ -155,7 +155,7 @@ func TestBooleanOr(t *testing.T) {
func TestCoalesce(t *testing.T) {
src := ` $a ?? $b;`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Expression{
Expr: &binary.Coalesce{
@@ -175,7 +175,7 @@ func TestCoalesce(t *testing.T) {
func TestConcat(t *testing.T) {
src := ` $a . $b;`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Expression{
Expr: &binary.Concat{
@@ -200,7 +200,7 @@ func TestConcat(t *testing.T) {
func TestDiv(t *testing.T) {
src := ` $a / $b;`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Expression{
Expr: &binary.Div{
@@ -225,7 +225,7 @@ func TestDiv(t *testing.T) {
func TestEqual(t *testing.T) {
src := ` $a == $b;`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Expression{
Expr: &binary.Equal{
@@ -250,7 +250,7 @@ func TestEqual(t *testing.T) {
func TestGreaterOrEqual(t *testing.T) {
src := ` $a >= $b;`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Expression{
Expr: &binary.GreaterOrEqual{
@@ -275,7 +275,7 @@ func TestGreaterOrEqual(t *testing.T) {
func TestGreater(t *testing.T) {
src := ` $a > $b;`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Expression{
Expr: &binary.Greater{
@@ -300,7 +300,7 @@ func TestGreater(t *testing.T) {
func TestIdentical(t *testing.T) {
src := ` $a === $b;`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Expression{
Expr: &binary.Identical{
@@ -325,7 +325,7 @@ func TestIdentical(t *testing.T) {
func TestLogicalAnd(t *testing.T) {
src := ` $a and $b;`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Expression{
Expr: &binary.LogicalAnd{
@@ -350,7 +350,7 @@ func TestLogicalAnd(t *testing.T) {
func TestLogicalOr(t *testing.T) {
src := ` $a or $b;`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Expression{
Expr: &binary.LogicalOr{
@@ -375,7 +375,7 @@ func TestLogicalOr(t *testing.T) {
func TestLogicalXor(t *testing.T) {
src := ` $a xor $b;`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Expression{
Expr: &binary.LogicalXor{
@@ -400,7 +400,7 @@ func TestLogicalXor(t *testing.T) {
func TestMinus(t *testing.T) {
src := ` $a - $b;`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Expression{
Expr: &binary.Minus{
@@ -425,7 +425,7 @@ func TestMinus(t *testing.T) {
func TestMod(t *testing.T) {
src := ` $a % $b;`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Expression{
Expr: &binary.Mod{
@@ -450,7 +450,7 @@ func TestMod(t *testing.T) {
func TestMul(t *testing.T) {
src := ` $a * $b;`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Expression{
Expr: &binary.Mul{
@@ -475,7 +475,7 @@ func TestMul(t *testing.T) {
func TestNotEqual(t *testing.T) {
src := ` $a != $b;`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Expression{
Expr: &binary.NotEqual{
@@ -500,7 +500,7 @@ func TestNotEqual(t *testing.T) {
func TestNotIdentical(t *testing.T) {
src := ` $a !== $b;`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Expression{
Expr: &binary.NotIdentical{
@@ -525,7 +525,7 @@ func TestNotIdentical(t *testing.T) {
func TestPlus(t *testing.T) {
src := ` $a + $b;`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Expression{
Expr: &binary.Plus{
@@ -550,7 +550,7 @@ func TestPlus(t *testing.T) {
func TestPow(t *testing.T) {
src := ` $a ** $b;`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Expression{
Expr: &binary.Pow{
@@ -575,7 +575,7 @@ func TestPow(t *testing.T) {
func TestShiftLeft(t *testing.T) {
src := ` $a << $b;`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Expression{
Expr: &binary.ShiftLeft{
@@ -600,7 +600,7 @@ func TestShiftLeft(t *testing.T) {
func TestShiftRight(t *testing.T) {
src := ` $a >> $b;`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Expression{
Expr: &binary.ShiftRight{
@@ -625,7 +625,7 @@ func TestShiftRight(t *testing.T) {
func TestSmallerOrEqual(t *testing.T) {
src := ` $a <= $b;`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Expression{
Expr: &binary.SmallerOrEqual{
@@ -650,7 +650,7 @@ func TestSmallerOrEqual(t *testing.T) {
func TestSmaller(t *testing.T) {
src := ` $a < $b;`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Expression{
Expr: &binary.Smaller{
@@ -675,7 +675,7 @@ func TestSmaller(t *testing.T) {
func TestSpaceship(t *testing.T) {
src := ` $a <=> $b;`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Expression{
Expr: &binary.Spaceship{
diff --git a/node/expr/cast/t_cast_test.go b/node/expr/cast/t_cast_test.go
index c8a0246..4058f6c 100644
--- a/node/expr/cast/t_cast_test.go
+++ b/node/expr/cast/t_cast_test.go
@@ -30,7 +30,7 @@ func assertEqual(t *testing.T, expected interface{}, actual interface{}) {
func TestArray(t *testing.T) {
src := ` (array)$a;`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Expression{
Expr: &cast.Array{
@@ -54,7 +54,7 @@ func TestArray(t *testing.T) {
func TestBool(t *testing.T) {
src := ` (boolean)$a;`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Expression{
Expr: &cast.Bool{
@@ -78,7 +78,7 @@ func TestBool(t *testing.T) {
func TestBoolShort(t *testing.T) {
src := ` (bool)$a;`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Expression{
Expr: &cast.Bool{
@@ -102,7 +102,7 @@ func TestBoolShort(t *testing.T) {
func TestDouble(t *testing.T) {
src := ` (double)$a;`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Expression{
Expr: &cast.Double{
@@ -126,7 +126,7 @@ func TestDouble(t *testing.T) {
func TestCastFloat(t *testing.T) {
src := ` (float)$a;`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Expression{
Expr: &cast.Double{
@@ -150,7 +150,7 @@ func TestCastFloat(t *testing.T) {
func TestInt(t *testing.T) {
src := ` (integer)$a;`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Expression{
Expr: &cast.Int{
@@ -174,7 +174,7 @@ func TestInt(t *testing.T) {
func TestIntShort(t *testing.T) {
src := ` (int)$a;`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Expression{
Expr: &cast.Int{
@@ -198,7 +198,7 @@ func TestIntShort(t *testing.T) {
func TestObject(t *testing.T) {
src := ` (object)$a;`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Expression{
Expr: &cast.Object{
@@ -222,7 +222,7 @@ func TestObject(t *testing.T) {
func TestString(t *testing.T) {
src := ` (string)$a;`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Expression{
Expr: &cast.String{
@@ -246,7 +246,7 @@ func TestString(t *testing.T) {
func TestUnset(t *testing.T) {
src := ` (unset)$a;`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Expression{
Expr: &cast.Unset{
diff --git a/node/expr/n_array_item.go b/node/expr/n_array_item.go
index 0c05df1..b651358 100644
--- a/node/expr/n_array_item.go
+++ b/node/expr/n_array_item.go
@@ -7,15 +7,13 @@ import (
// ArrayItem node
type ArrayItem struct {
- ByRef bool
- Key node.Node
- Val node.Node
+ Key node.Node
+ Val node.Node
}
// NewArrayItem node constructor
-func NewArrayItem(Key node.Node, Val node.Node, ByRef bool) *ArrayItem {
+func NewArrayItem(Key node.Node, Val node.Node) *ArrayItem {
return &ArrayItem{
- ByRef,
Key,
Val,
}
@@ -23,9 +21,7 @@ func NewArrayItem(Key node.Node, Val node.Node, ByRef bool) *ArrayItem {
// Attributes returns node attributes as map
func (n *ArrayItem) Attributes() map[string]interface{} {
- return map[string]interface{}{
- "ByRef": n.ByRef,
- }
+ return nil
}
// Walk traverses nodes
diff --git a/node/expr/n_closure.go b/node/expr/n_closure.go
index 8725c6e..26d9949 100644
--- a/node/expr/n_closure.go
+++ b/node/expr/n_closure.go
@@ -11,19 +11,19 @@ type Closure struct {
Static bool
PhpDocComment string
Params []node.Node
- Uses []node.Node
+ ClosureUse *ClosureUse
ReturnType node.Node
Stmts []node.Node
}
// NewClosure node constructor
-func NewClosure(Params []node.Node, Uses []node.Node, ReturnType node.Node, Stmts []node.Node, Static bool, ReturnsRef bool, PhpDocComment string) *Closure {
+func NewClosure(Params []node.Node, ClosureUse *ClosureUse, ReturnType node.Node, Stmts []node.Node, Static bool, ReturnsRef bool, PhpDocComment string) *Closure {
return &Closure{
ReturnsRef,
Static,
PhpDocComment,
Params,
- Uses,
+ ClosureUse,
ReturnType,
Stmts,
}
@@ -54,13 +54,9 @@ func (n *Closure) Walk(v walker.Visitor) {
}
}
- if n.Uses != nil {
- vv := v.GetChildrenVisitor("Uses")
- for _, nn := range n.Uses {
- if nn != nil {
- nn.Walk(vv)
- }
- }
+ if n.ClosureUse != nil {
+ vv := v.GetChildrenVisitor("ClosureUse")
+ n.ClosureUse.Walk(vv)
}
if n.ReturnType != nil {
diff --git a/node/expr/n_closure_use.go b/node/expr/n_closure_use.go
index 72d5e13..6225208 100644
--- a/node/expr/n_closure_use.go
+++ b/node/expr/n_closure_use.go
@@ -7,23 +7,19 @@ import (
// ClosureUse node
type ClosureUse struct {
- ByRef bool
- Variable node.Node
+ Uses []node.Node
}
// NewClosureUse node constructor
-func NewClosureUse(Variable node.Node, ByRef bool) *ClosureUse {
+func NewClosureUse(Uses []node.Node) *ClosureUse {
return &ClosureUse{
- ByRef,
- Variable,
+ Uses,
}
}
// Attributes returns node attributes as map
func (n *ClosureUse) Attributes() map[string]interface{} {
- return map[string]interface{}{
- "ByRef": n.ByRef,
- }
+ return nil
}
// Walk traverses nodes
@@ -33,9 +29,13 @@ func (n *ClosureUse) Walk(v walker.Visitor) {
return
}
- if n.Variable != nil {
- vv := v.GetChildrenVisitor("Variable")
- n.Variable.Walk(vv)
+ if n.Uses != nil {
+ vv := v.GetChildrenVisitor("Uses")
+ for _, nn := range n.Uses {
+ if nn != nil {
+ nn.Walk(vv)
+ }
+ }
}
v.LeaveNode(n)
diff --git a/node/expr/n_function_call.go b/node/expr/n_function_call.go
index 22f2d07..2d17fdc 100644
--- a/node/expr/n_function_call.go
+++ b/node/expr/n_function_call.go
@@ -7,15 +7,15 @@ import (
// FunctionCall node
type FunctionCall struct {
- Function node.Node
- Arguments []node.Node
+ Function node.Node
+ ArgumentList *node.ArgumentList
}
// NewFunctionCall node constructor
-func NewFunctionCall(Function node.Node, Arguments []node.Node) *FunctionCall {
+func NewFunctionCall(Function node.Node, ArgumentList *node.ArgumentList) *FunctionCall {
return &FunctionCall{
Function,
- Arguments,
+ ArgumentList,
}
}
@@ -36,13 +36,9 @@ func (n *FunctionCall) Walk(v walker.Visitor) {
n.Function.Walk(vv)
}
- if n.Arguments != nil {
- vv := v.GetChildrenVisitor("Arguments")
- for _, nn := range n.Arguments {
- if nn != nil {
- nn.Walk(vv)
- }
- }
+ if n.ArgumentList != nil {
+ vv := v.GetChildrenVisitor("ArgumentList")
+ n.ArgumentList.Walk(vv)
}
v.LeaveNode(n)
diff --git a/node/expr/n_method_call.go b/node/expr/n_method_call.go
index 8746418..1bcc4fb 100644
--- a/node/expr/n_method_call.go
+++ b/node/expr/n_method_call.go
@@ -7,17 +7,17 @@ import (
// MethodCall node
type MethodCall struct {
- Variable node.Node
- Method node.Node
- Arguments []node.Node
+ Variable node.Node
+ Method node.Node
+ ArgumentList *node.ArgumentList
}
// NewMethodCall node constructor
-func NewMethodCall(Variable node.Node, Method node.Node, Arguments []node.Node) *MethodCall {
+func NewMethodCall(Variable node.Node, Method node.Node, ArgumentList *node.ArgumentList) *MethodCall {
return &MethodCall{
Variable,
Method,
- Arguments,
+ ArgumentList,
}
}
@@ -43,13 +43,9 @@ func (n *MethodCall) Walk(v walker.Visitor) {
n.Method.Walk(vv)
}
- if n.Arguments != nil {
- vv := v.GetChildrenVisitor("Arguments")
- for _, nn := range n.Arguments {
- if nn != nil {
- nn.Walk(vv)
- }
- }
+ if n.ArgumentList != nil {
+ vv := v.GetChildrenVisitor("ArgumentList")
+ n.ArgumentList.Walk(vv)
}
v.LeaveNode(n)
diff --git a/node/expr/n_new.go b/node/expr/n_new.go
index d773daf..c68b102 100644
--- a/node/expr/n_new.go
+++ b/node/expr/n_new.go
@@ -7,15 +7,15 @@ import (
// New node
type New struct {
- Class node.Node
- Arguments []node.Node
+ Class node.Node
+ ArgumentList *node.ArgumentList
}
// NewNew node constructor
-func NewNew(Class node.Node, Arguments []node.Node) *New {
+func NewNew(Class node.Node, ArgumentList *node.ArgumentList) *New {
return &New{
Class,
- Arguments,
+ ArgumentList,
}
}
@@ -36,13 +36,9 @@ func (n *New) Walk(v walker.Visitor) {
n.Class.Walk(vv)
}
- if n.Arguments != nil {
- vv := v.GetChildrenVisitor("Arguments")
- for _, nn := range n.Arguments {
- if nn != nil {
- nn.Walk(vv)
- }
- }
+ if n.ArgumentList != nil {
+ vv := v.GetChildrenVisitor("ArgumentList")
+ n.ArgumentList.Walk(vv)
}
v.LeaveNode(n)
diff --git a/node/expr/n_reference.go b/node/expr/n_reference.go
new file mode 100644
index 0000000..9b864fc
--- /dev/null
+++ b/node/expr/n_reference.go
@@ -0,0 +1,38 @@
+package expr
+
+import (
+ "github.com/z7zmey/php-parser/node"
+ "github.com/z7zmey/php-parser/walker"
+)
+
+// Reference node
+type Reference struct {
+ Variable node.Node
+}
+
+// NewReference node constructor
+func NewReference(Variable node.Node) *Reference {
+ return &Reference{
+ Variable,
+ }
+}
+
+// Attributes returns node attributes as map
+func (n *Reference) Attributes() map[string]interface{} {
+ return nil
+}
+
+// Walk traverses nodes
+// Walk is invoked recursively until v.EnterNode returns true
+func (n *Reference) Walk(v walker.Visitor) {
+ if v.EnterNode(n) == false {
+ return
+ }
+
+ if n.Variable != nil {
+ vv := v.GetChildrenVisitor("Variable")
+ n.Variable.Walk(vv)
+ }
+
+ v.LeaveNode(n)
+}
diff --git a/node/expr/n_static_call.go b/node/expr/n_static_call.go
index a9cded4..0324a6c 100644
--- a/node/expr/n_static_call.go
+++ b/node/expr/n_static_call.go
@@ -7,17 +7,17 @@ import (
// StaticCall node
type StaticCall struct {
- Class node.Node
- Call node.Node
- Arguments []node.Node
+ Class node.Node
+ Call node.Node
+ ArgumentList *node.ArgumentList
}
// NewStaticCall node constructor
-func NewStaticCall(Class node.Node, Call node.Node, Arguments []node.Node) *StaticCall {
+func NewStaticCall(Class node.Node, Call node.Node, ArgumentList *node.ArgumentList) *StaticCall {
return &StaticCall{
Class,
Call,
- Arguments,
+ ArgumentList,
}
}
@@ -43,13 +43,9 @@ func (n *StaticCall) Walk(v walker.Visitor) {
n.Call.Walk(vv)
}
- if n.Arguments != nil {
- vv := v.GetChildrenVisitor("Arguments")
- for _, nn := range n.Arguments {
- if nn != nil {
- nn.Walk(vv)
- }
- }
+ if n.ArgumentList != nil {
+ vv := v.GetChildrenVisitor("ArgumentList")
+ n.ArgumentList.Walk(vv)
}
v.LeaveNode(n)
diff --git a/node/expr/t_array_dim_fetch_test.go b/node/expr/t_array_dim_fetch_test.go
index caab5e6..a7a08d4 100644
--- a/node/expr/t_array_dim_fetch_test.go
+++ b/node/expr/t_array_dim_fetch_test.go
@@ -31,7 +31,7 @@ func assertEqual(t *testing.T, expected interface{}, actual interface{}) {
func TestArrayDimFetch(t *testing.T) {
src := ` $a[1];`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Expression{
Expr: &expr.ArrayDimFetch{
@@ -56,7 +56,7 @@ func TestArrayDimFetch(t *testing.T) {
func TestArrayDimFetchNested(t *testing.T) {
src := ` $a[1][2];`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Expression{
Expr: &expr.ArrayDimFetch{
diff --git a/node/expr/t_array_test.go b/node/expr/t_array_test.go
index caa083a..99d997a 100644
--- a/node/expr/t_array_test.go
+++ b/node/expr/t_array_test.go
@@ -17,7 +17,7 @@ import (
func TestArray(t *testing.T) {
src := ` array();`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Expression{
Expr: &expr.Array{
@@ -41,14 +41,13 @@ func TestArray(t *testing.T) {
func TestArrayItem(t *testing.T) {
src := ` array(1);`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Expression{
Expr: &expr.Array{
Items: []node.Node{
&expr.ArrayItem{
- ByRef: false,
- Val: &scalar.Lnumber{Value: "1"},
+ Val: &scalar.Lnumber{Value: "1"},
},
},
},
@@ -70,19 +69,17 @@ func TestArrayItem(t *testing.T) {
func TestArrayItems(t *testing.T) {
src := ` array(1=>1, &$b,);`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Expression{
Expr: &expr.Array{
Items: []node.Node{
&expr.ArrayItem{
- ByRef: false,
- Key: &scalar.Lnumber{Value: "1"},
- Val: &scalar.Lnumber{Value: "1"},
+ Key: &scalar.Lnumber{Value: "1"},
+ Val: &scalar.Lnumber{Value: "1"},
},
&expr.ArrayItem{
- ByRef: true,
- Val: &expr.Variable{VarName: &node.Identifier{Value: "b"}},
+ Val: &expr.Reference{Variable: &expr.Variable{VarName: &node.Identifier{Value: "b"}}},
},
},
},
diff --git a/node/expr/t_bitwise_not_test.go b/node/expr/t_bitwise_not_test.go
index 2cf5f72..a4c6456 100644
--- a/node/expr/t_bitwise_not_test.go
+++ b/node/expr/t_bitwise_not_test.go
@@ -15,7 +15,7 @@ import (
func TestBitwiseNot(t *testing.T) {
src := ` ~$a;`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Expression{
Expr: &expr.BitwiseNot{
diff --git a/node/expr/t_boolean_not_test.go b/node/expr/t_boolean_not_test.go
index 24f59d5..f602fe3 100644
--- a/node/expr/t_boolean_not_test.go
+++ b/node/expr/t_boolean_not_test.go
@@ -15,7 +15,7 @@ import (
func TestBooleanNot(t *testing.T) {
src := ` !$a;`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Expression{
Expr: &expr.BooleanNot{
diff --git a/node/expr/t_class_const_fetch_test.go b/node/expr/t_class_const_fetch_test.go
index cca3753..b03fcbd 100644
--- a/node/expr/t_class_const_fetch_test.go
+++ b/node/expr/t_class_const_fetch_test.go
@@ -17,7 +17,7 @@ import (
func TestClassConstFetch(t *testing.T) {
src := ` Foo::Bar;`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Expression{
Expr: &expr.ClassConstFetch{
@@ -46,7 +46,7 @@ func TestClassConstFetch(t *testing.T) {
func TestStaticClassConstFetch(t *testing.T) {
src := ` static::bar;`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Expression{
Expr: &expr.ClassConstFetch{
diff --git a/node/expr/t_clone_test.go b/node/expr/t_clone_test.go
index 8a5c1ed..097293e 100644
--- a/node/expr/t_clone_test.go
+++ b/node/expr/t_clone_test.go
@@ -15,7 +15,7 @@ import (
func TestCloneBrackets(t *testing.T) {
src := ` clone($a);`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Expression{
Expr: &expr.Clone{
@@ -39,7 +39,7 @@ func TestCloneBrackets(t *testing.T) {
func TestClone(t *testing.T) {
src := ` clone $a;`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Expression{
Expr: &expr.Clone{
diff --git a/node/expr/t_closure_test.go b/node/expr/t_closure_test.go
index 7aa923c..b5752f2 100644
--- a/node/expr/t_closure_test.go
+++ b/node/expr/t_closure_test.go
@@ -17,14 +17,13 @@ import (
func TestClosure(t *testing.T) {
src := ` function(){};`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Expression{
Expr: &expr.Closure{
ReturnsRef: false,
Static: false,
PhpDocComment: "",
- Uses: []node.Node{},
Stmts: []node.Node{},
},
},
@@ -45,7 +44,7 @@ func TestClosure(t *testing.T) {
func TestClosureUse(t *testing.T) {
src := ` function($a, $b) use ($c, &$d) {};`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Expression{
Expr: &expr.Closure{
@@ -64,14 +63,10 @@ func TestClosureUse(t *testing.T) {
Variable: &expr.Variable{VarName: &node.Identifier{Value: "b"}},
},
},
- Uses: []node.Node{
- &expr.ClosureUse{
- ByRef: false,
- Variable: &expr.Variable{VarName: &node.Identifier{Value: "c"}},
- },
- &expr.ClosureUse{
- ByRef: true,
- Variable: &expr.Variable{VarName: &node.Identifier{Value: "d"}},
+ ClosureUse: &expr.ClosureUse{
+ Uses: []node.Node{
+ &expr.Variable{VarName: &node.Identifier{Value: "c"}},
+ &expr.Reference{Variable: &expr.Variable{VarName: &node.Identifier{Value: "d"}}},
},
},
Stmts: []node.Node{},
@@ -94,7 +89,7 @@ func TestClosureUse(t *testing.T) {
func TestClosureUse2(t *testing.T) {
src := ` function($a, $b) use (&$c, $d) {};`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Expression{
Expr: &expr.Closure{
@@ -113,14 +108,10 @@ func TestClosureUse2(t *testing.T) {
Variable: &expr.Variable{VarName: &node.Identifier{Value: "b"}},
},
},
- Uses: []node.Node{
- &expr.ClosureUse{
- ByRef: true,
- Variable: &expr.Variable{VarName: &node.Identifier{Value: "c"}},
- },
- &expr.ClosureUse{
- ByRef: false,
- Variable: &expr.Variable{VarName: &node.Identifier{Value: "d"}},
+ ClosureUse: &expr.ClosureUse{
+ Uses: []node.Node{
+ &expr.Reference{Variable: &expr.Variable{VarName: &node.Identifier{Value: "c"}}},
+ &expr.Variable{VarName: &node.Identifier{Value: "d"}},
},
},
Stmts: []node.Node{},
@@ -143,14 +134,13 @@ func TestClosureUse2(t *testing.T) {
func TestClosureReturnType(t *testing.T) {
src := ` function(): void {};`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Expression{
Expr: &expr.Closure{
ReturnsRef: false,
Static: false,
PhpDocComment: "",
- Uses: []node.Node{},
ReturnType: &name.Name{
Parts: []node.Node{&name.NamePart{Value: "void"}},
},
diff --git a/node/expr/t_const_fetch_test.go b/node/expr/t_const_fetch_test.go
index 4300a99..0028ada 100644
--- a/node/expr/t_const_fetch_test.go
+++ b/node/expr/t_const_fetch_test.go
@@ -17,7 +17,7 @@ import (
func TestConstFetch(t *testing.T) {
src := ` foo;`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Expression{
Expr: &expr.ConstFetch{
@@ -41,7 +41,7 @@ func TestConstFetch(t *testing.T) {
func TestConstFetchRelative(t *testing.T) {
src := ` namespace\foo;`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Expression{
Expr: &expr.ConstFetch{
@@ -65,7 +65,7 @@ func TestConstFetchRelative(t *testing.T) {
func TestConstFetchFullyQualified(t *testing.T) {
src := ` \foo;`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Expression{
Expr: &expr.ConstFetch{
diff --git a/node/expr/t_empty_test.go b/node/expr/t_empty_test.go
index bcd5f28..79795b3 100644
--- a/node/expr/t_empty_test.go
+++ b/node/expr/t_empty_test.go
@@ -15,7 +15,7 @@ import (
func TestEmpty(t *testing.T) {
src := ` empty($a);`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Expression{
Expr: &expr.Empty{
diff --git a/node/expr/t_error_supress_test.go b/node/expr/t_error_supress_test.go
index 4565eaf..bcc073f 100644
--- a/node/expr/t_error_supress_test.go
+++ b/node/expr/t_error_supress_test.go
@@ -15,7 +15,7 @@ import (
func TestErrorSuppress(t *testing.T) {
src := ` @$a;`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Expression{
Expr: &expr.ErrorSuppress{
diff --git a/node/expr/t_eval_test.go b/node/expr/t_eval_test.go
index 4d08099..d1fbea8 100644
--- a/node/expr/t_eval_test.go
+++ b/node/expr/t_eval_test.go
@@ -15,7 +15,7 @@ import (
func TestEval(t *testing.T) {
src := ` eval($a);`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Expression{
Expr: &expr.Eval{
diff --git a/node/expr/t_exit_test.go b/node/expr/t_exit_test.go
index ac3b3bb..3558bf8 100644
--- a/node/expr/t_exit_test.go
+++ b/node/expr/t_exit_test.go
@@ -15,7 +15,7 @@ import (
func TestExit(t *testing.T) {
src := ` exit;`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Expression{
Expr: &expr.Exit{},
@@ -37,7 +37,7 @@ func TestExit(t *testing.T) {
func TestExitExpr(t *testing.T) {
src := ` exit($a);`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Expression{
Expr: &expr.Exit{
@@ -61,7 +61,7 @@ func TestExitExpr(t *testing.T) {
func TestDie(t *testing.T) {
src := ` die;`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Expression{
Expr: &expr.Die{},
@@ -83,7 +83,7 @@ func TestDie(t *testing.T) {
func TestDieExpr(t *testing.T) {
src := ` die($a);`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Expression{
Expr: &expr.Die{
diff --git a/node/expr/t_function_call_test.go b/node/expr/t_function_call_test.go
index 03d4c33..2ea19e6 100644
--- a/node/expr/t_function_call_test.go
+++ b/node/expr/t_function_call_test.go
@@ -20,7 +20,7 @@ import (
func TestFunctionCall(t *testing.T) {
src := ` foo();`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Expression{
Expr: &expr.FunctionCall{
@@ -29,7 +29,7 @@ func TestFunctionCall(t *testing.T) {
&name.NamePart{Value: "foo"},
},
},
- Arguments: []node.Node{},
+ ArgumentList: &node.ArgumentList{},
},
},
},
@@ -49,7 +49,7 @@ func TestFunctionCall(t *testing.T) {
func TestFunctionCallRelative(t *testing.T) {
src := ` namespace\foo();`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Expression{
Expr: &expr.FunctionCall{
@@ -58,7 +58,7 @@ func TestFunctionCallRelative(t *testing.T) {
&name.NamePart{Value: "foo"},
},
},
- Arguments: []node.Node{},
+ ArgumentList: &node.ArgumentList{},
},
},
},
@@ -78,7 +78,7 @@ func TestFunctionCallRelative(t *testing.T) {
func TestFunctionFullyQualified(t *testing.T) {
src := ` \foo([]);`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Expression{
Expr: &expr.FunctionCall{
@@ -87,12 +87,14 @@ func TestFunctionFullyQualified(t *testing.T) {
&name.NamePart{Value: "foo"},
},
},
- Arguments: []node.Node{
- &node.Argument{
- Variadic: false,
- IsReference: false,
- Expr: &expr.ShortArray{
- Items: []node.Node{},
+ ArgumentList: &node.ArgumentList{
+ Arguments: []node.Node{
+ &node.Argument{
+ Variadic: false,
+ IsReference: false,
+ Expr: &expr.ShortArray{
+ Items: []node.Node{},
+ },
},
},
},
@@ -115,17 +117,19 @@ func TestFunctionFullyQualified(t *testing.T) {
func TestFunctionCallVar(t *testing.T) {
src := ` $foo(yield $a);`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Expression{
Expr: &expr.FunctionCall{
Function: &expr.Variable{VarName: &node.Identifier{Value: "foo"}},
- Arguments: []node.Node{
- &node.Argument{
- Variadic: false,
- IsReference: false,
- Expr: &expr.Yield{
- Value: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
+ ArgumentList: &node.ArgumentList{
+ Arguments: []node.Node{
+ &node.Argument{
+ Variadic: false,
+ IsReference: false,
+ Expr: &expr.Yield{
+ Value: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
+ },
},
},
},
@@ -148,7 +152,7 @@ func TestFunctionCallVar(t *testing.T) {
func TestFunctionCallExprArg(t *testing.T) {
src := ` ceil($foo/3);`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Expression{
Expr: &expr.FunctionCall{
@@ -157,13 +161,15 @@ func TestFunctionCallExprArg(t *testing.T) {
&name.NamePart{Value: "ceil"},
},
},
- Arguments: []node.Node{
- &node.Argument{
- Variadic: false,
- IsReference: false,
- Expr: &binary.Div{
- Left: &expr.Variable{VarName: &node.Identifier{Value: "foo"}},
- Right: &scalar.Lnumber{Value: "3"},
+ ArgumentList: &node.ArgumentList{
+ Arguments: []node.Node{
+ &node.Argument{
+ Variadic: false,
+ IsReference: false,
+ Expr: &binary.Div{
+ Left: &expr.Variable{VarName: &node.Identifier{Value: "foo"}},
+ Right: &scalar.Lnumber{Value: "3"},
+ },
},
},
},
diff --git a/node/expr/t_inc_dec_test.go b/node/expr/t_inc_dec_test.go
index 29d1cb7..429fceb 100644
--- a/node/expr/t_inc_dec_test.go
+++ b/node/expr/t_inc_dec_test.go
@@ -15,7 +15,7 @@ import (
func TestPostDec(t *testing.T) {
src := ` $a--;`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Expression{
Expr: &expr.PostDec{
@@ -39,7 +39,7 @@ func TestPostDec(t *testing.T) {
func TestPostInc(t *testing.T) {
src := ` $a++;`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Expression{
Expr: &expr.PostInc{
@@ -63,7 +63,7 @@ func TestPostInc(t *testing.T) {
func TestPreDec(t *testing.T) {
src := ` --$a;`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Expression{
Expr: &expr.PreDec{
@@ -87,7 +87,7 @@ func TestPreDec(t *testing.T) {
func TestPreInc(t *testing.T) {
src := ` ++$a;`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Expression{
Expr: &expr.PreInc{
diff --git a/node/expr/t_include_test.go b/node/expr/t_include_test.go
index 0f7580c..663df93 100644
--- a/node/expr/t_include_test.go
+++ b/node/expr/t_include_test.go
@@ -15,7 +15,7 @@ import (
func TestInclude(t *testing.T) {
src := ` include $a;`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Expression{
Expr: &expr.Include{
@@ -39,7 +39,7 @@ func TestInclude(t *testing.T) {
func TestIncludeOnce(t *testing.T) {
src := ` include_once $a;`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Expression{
Expr: &expr.IncludeOnce{
@@ -63,7 +63,7 @@ func TestIncludeOnce(t *testing.T) {
func TestRequire(t *testing.T) {
src := ` require $a;`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Expression{
Expr: &expr.Require{
@@ -87,7 +87,7 @@ func TestRequire(t *testing.T) {
func TestRequireOnce(t *testing.T) {
src := ` require_once $a;`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Expression{
Expr: &expr.RequireOnce{
diff --git a/node/expr/t_instance_of_test.go b/node/expr/t_instance_of_test.go
index 59c96cb..6459837 100644
--- a/node/expr/t_instance_of_test.go
+++ b/node/expr/t_instance_of_test.go
@@ -17,7 +17,7 @@ import (
func TestInstanceOf(t *testing.T) {
src := ` $a instanceof Foo;`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Expression{
Expr: &expr.InstanceOf{
@@ -46,7 +46,7 @@ func TestInstanceOf(t *testing.T) {
func TestInstanceOfRelative(t *testing.T) {
src := ` $a instanceof namespace\Foo;`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Expression{
Expr: &expr.InstanceOf{
@@ -75,7 +75,7 @@ func TestInstanceOfRelative(t *testing.T) {
func TestInstanceOfFullyQualified(t *testing.T) {
src := ` $a instanceof \Foo;`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Expression{
Expr: &expr.InstanceOf{
diff --git a/node/expr/t_isset_test.go b/node/expr/t_isset_test.go
index 06c39de..c69a618 100644
--- a/node/expr/t_isset_test.go
+++ b/node/expr/t_isset_test.go
@@ -15,7 +15,7 @@ import (
func TestIsset(t *testing.T) {
src := ` isset($a);`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Expression{
Expr: &expr.Isset{
@@ -41,7 +41,7 @@ func TestIsset(t *testing.T) {
func TestIssetVariables(t *testing.T) {
src := ` isset($a, $b);`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Expression{
Expr: &expr.Isset{
diff --git a/node/expr/t_list_test.go b/node/expr/t_list_test.go
index 4131583..ecdabbd 100644
--- a/node/expr/t_list_test.go
+++ b/node/expr/t_list_test.go
@@ -17,7 +17,7 @@ import (
func TestEmptyList(t *testing.T) {
src := ` list() = $b;`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Expression{
Expr: &assign.Assign{
@@ -44,15 +44,14 @@ func TestEmptyList(t *testing.T) {
func TestList(t *testing.T) {
src := ` list($a) = $b;`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Expression{
Expr: &assign.Assign{
Variable: &expr.List{
Items: []node.Node{
&expr.ArrayItem{
- ByRef: false,
- Val: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
+ Val: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
},
},
},
@@ -76,14 +75,13 @@ func TestList(t *testing.T) {
func TestListArrayIndex(t *testing.T) {
src := ` list($a[]) = $b;`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Expression{
Expr: &assign.Assign{
Variable: &expr.List{
Items: []node.Node{
&expr.ArrayItem{
- ByRef: false,
Val: &expr.ArrayDimFetch{
Variable: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
},
@@ -110,19 +108,17 @@ func TestListArrayIndex(t *testing.T) {
func TestListList(t *testing.T) {
src := ` list(list($a)) = $b;`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Expression{
Expr: &assign.Assign{
Variable: &expr.List{
Items: []node.Node{
&expr.ArrayItem{
- ByRef: false,
Val: &expr.List{
Items: []node.Node{
&expr.ArrayItem{
- ByRef: false,
- Val: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
+ Val: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
},
},
},
diff --git a/node/expr/t_method_call_test.go b/node/expr/t_method_call_test.go
index bcd5376..7611e9f 100644
--- a/node/expr/t_method_call_test.go
+++ b/node/expr/t_method_call_test.go
@@ -15,13 +15,13 @@ import (
func TestMethodCall(t *testing.T) {
src := ` $a->foo();`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Expression{
Expr: &expr.MethodCall{
- Variable: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
- Method: &node.Identifier{Value: "foo"},
- Arguments: []node.Node{},
+ Variable: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
+ Method: &node.Identifier{Value: "foo"},
+ ArgumentList: &node.ArgumentList{},
},
},
},
diff --git a/node/expr/t_new_test.go b/node/expr/t_new_test.go
index 656abdf..cba3c88 100644
--- a/node/expr/t_new_test.go
+++ b/node/expr/t_new_test.go
@@ -17,7 +17,7 @@ import (
func TestNew(t *testing.T) {
src := ` new Foo;`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Expression{
Expr: &expr.New{
@@ -45,7 +45,7 @@ func TestNew(t *testing.T) {
func TestNewRelative(t *testing.T) {
src := ` new namespace\Foo();`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Expression{
Expr: &expr.New{
@@ -54,7 +54,7 @@ func TestNewRelative(t *testing.T) {
&name.NamePart{Value: "Foo"},
},
},
- Arguments: []node.Node{},
+ ArgumentList: &node.ArgumentList{},
},
},
},
@@ -74,7 +74,7 @@ func TestNewRelative(t *testing.T) {
func TestNewFullyQualified(t *testing.T) {
src := ` new \Foo();`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Expression{
Expr: &expr.New{
@@ -83,7 +83,7 @@ func TestNewFullyQualified(t *testing.T) {
&name.NamePart{Value: "Foo"},
},
},
- Arguments: []node.Node{},
+ ArgumentList: &node.ArgumentList{},
},
},
},
@@ -103,15 +103,17 @@ func TestNewFullyQualified(t *testing.T) {
func TestNewAnonymous(t *testing.T) {
src := ` new class ($a, ...$b) {};`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Expression{
Expr: &expr.New{
Class: &stmt.Class{
PhpDocComment: "",
- Args: []node.Node{
- &node.Argument{Variadic: false, Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}}},
- &node.Argument{Variadic: true, Expr: &expr.Variable{VarName: &node.Identifier{Value: "b"}}},
+ ArgumentList: &node.ArgumentList{
+ Arguments: []node.Node{
+ &node.Argument{Variadic: false, Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}}},
+ &node.Argument{Variadic: true, Expr: &expr.Variable{VarName: &node.Identifier{Value: "b"}}},
+ },
},
Stmts: []node.Node{},
},
diff --git a/node/expr/t_print_test.go b/node/expr/t_print_test.go
index f1bfcc1..42a9870 100644
--- a/node/expr/t_print_test.go
+++ b/node/expr/t_print_test.go
@@ -15,7 +15,7 @@ import (
func TestPrint(t *testing.T) {
src := ` print($a);`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Expression{
Expr: &expr.Print{
diff --git a/node/expr/t_property_fetch_test.go b/node/expr/t_property_fetch_test.go
index 9948ed0..1f778da 100644
--- a/node/expr/t_property_fetch_test.go
+++ b/node/expr/t_property_fetch_test.go
@@ -15,7 +15,7 @@ import (
func TestPropertyFetch(t *testing.T) {
src := ` $a->foo;`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Expression{
Expr: &expr.PropertyFetch{
diff --git a/node/expr/t_reference_test.go b/node/expr/t_reference_test.go
new file mode 100644
index 0000000..9f83687
--- /dev/null
+++ b/node/expr/t_reference_test.go
@@ -0,0 +1,41 @@
+package expr_test
+
+import (
+ "bytes"
+ "testing"
+
+ "github.com/z7zmey/php-parser/node/expr"
+
+ "github.com/z7zmey/php-parser/node"
+ "github.com/z7zmey/php-parser/node/stmt"
+ "github.com/z7zmey/php-parser/php5"
+ "github.com/z7zmey/php-parser/php7"
+)
+
+func TestForeachWithRef(t *testing.T) {
+ t.Helper()
+ src := ` foreach ($a as $k => &$v) {}`
+
+ expected := &node.Root{
+ Stmts: []node.Node{
+ &stmt.Foreach{
+ Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
+ Key: &expr.Variable{VarName: &node.Identifier{Value: "k"}},
+ Variable: &expr.Reference{Variable: &expr.Variable{VarName: &node.Identifier{Value: "v"}}},
+ Stmt: &stmt.StmtList{
+ Stmts: []node.Node{},
+ },
+ },
+ },
+ }
+
+ php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
+ php7parser.Parse()
+ actual := php7parser.GetRootNode()
+ assertEqual(t, expected, actual)
+
+ php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
+ php5parser.Parse()
+ actual = php5parser.GetRootNode()
+ assertEqual(t, expected, actual)
+}
diff --git a/node/expr/t_shell_exec_test.go b/node/expr/t_shell_exec_test.go
index 824c453..19f4ee9 100644
--- a/node/expr/t_shell_exec_test.go
+++ b/node/expr/t_shell_exec_test.go
@@ -17,7 +17,7 @@ import (
func TestShellExec(t *testing.T) {
src := " `cmd $a`;"
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Expression{
Expr: &expr.ShellExec{
diff --git a/node/expr/t_short_array_test.go b/node/expr/t_short_array_test.go
index 7ea7e02..adecd20 100644
--- a/node/expr/t_short_array_test.go
+++ b/node/expr/t_short_array_test.go
@@ -17,7 +17,7 @@ import (
func TestShortArray(t *testing.T) {
src := ` [];`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Expression{
Expr: &expr.ShortArray{
@@ -41,14 +41,13 @@ func TestShortArray(t *testing.T) {
func TestShortArrayItem(t *testing.T) {
src := ` [1];`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Expression{
Expr: &expr.ShortArray{
Items: []node.Node{
&expr.ArrayItem{
- ByRef: false,
- Val: &scalar.Lnumber{Value: "1"},
+ Val: &scalar.Lnumber{Value: "1"},
},
},
},
@@ -70,19 +69,17 @@ func TestShortArrayItem(t *testing.T) {
func TestShortArrayItems(t *testing.T) {
src := ` [1=>1, &$b,];`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Expression{
Expr: &expr.ShortArray{
Items: []node.Node{
&expr.ArrayItem{
- ByRef: false,
- Key: &scalar.Lnumber{Value: "1"},
- Val: &scalar.Lnumber{Value: "1"},
+ Key: &scalar.Lnumber{Value: "1"},
+ Val: &scalar.Lnumber{Value: "1"},
},
&expr.ArrayItem{
- ByRef: true,
- Val: &expr.Variable{VarName: &node.Identifier{Value: "b"}},
+ Val: &expr.Reference{Variable: &expr.Variable{VarName: &node.Identifier{Value: "b"}}},
},
},
},
diff --git a/node/expr/t_short_list_test.go b/node/expr/t_short_list_test.go
index 98a6a8a..9492ef9 100644
--- a/node/expr/t_short_list_test.go
+++ b/node/expr/t_short_list_test.go
@@ -16,15 +16,14 @@ import (
func TestShortList(t *testing.T) {
src := ` [$a] = $b;`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Expression{
Expr: &assign.Assign{
Variable: &expr.ShortList{
Items: []node.Node{
&expr.ArrayItem{
- ByRef: false,
- Val: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
+ Val: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
},
},
},
@@ -43,14 +42,13 @@ func TestShortList(t *testing.T) {
func TestShortListArrayIndex(t *testing.T) {
src := ` [$a[]] = $b;`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Expression{
Expr: &assign.Assign{
Variable: &expr.ShortList{
Items: []node.Node{
&expr.ArrayItem{
- ByRef: false,
Val: &expr.ArrayDimFetch{
Variable: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
},
@@ -72,19 +70,17 @@ func TestShortListArrayIndex(t *testing.T) {
func TestShortListList(t *testing.T) {
src := ` [list($a)] = $b;`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Expression{
Expr: &assign.Assign{
Variable: &expr.ShortList{
Items: []node.Node{
&expr.ArrayItem{
- ByRef: false,
Val: &expr.List{
Items: []node.Node{
&expr.ArrayItem{
- ByRef: false,
- Val: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
+ Val: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
},
},
},
diff --git a/node/expr/t_static_call_test.go b/node/expr/t_static_call_test.go
index 4b03128..19b8294 100644
--- a/node/expr/t_static_call_test.go
+++ b/node/expr/t_static_call_test.go
@@ -17,7 +17,7 @@ import (
func TestStaticCall(t *testing.T) {
src := ` Foo::bar();`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Expression{
Expr: &expr.StaticCall{
@@ -26,8 +26,8 @@ func TestStaticCall(t *testing.T) {
&name.NamePart{Value: "Foo"},
},
},
- Call: &node.Identifier{Value: "bar"},
- Arguments: []node.Node{},
+ Call: &node.Identifier{Value: "bar"},
+ ArgumentList: &node.ArgumentList{},
},
},
},
@@ -47,7 +47,7 @@ func TestStaticCall(t *testing.T) {
func TestStaticCallRelative(t *testing.T) {
src := ` namespace\Foo::bar();`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Expression{
Expr: &expr.StaticCall{
@@ -56,8 +56,8 @@ func TestStaticCallRelative(t *testing.T) {
&name.NamePart{Value: "Foo"},
},
},
- Call: &node.Identifier{Value: "bar"},
- Arguments: []node.Node{},
+ Call: &node.Identifier{Value: "bar"},
+ ArgumentList: &node.ArgumentList{},
},
},
},
@@ -77,7 +77,7 @@ func TestStaticCallRelative(t *testing.T) {
func TestStaticCallFullyQualified(t *testing.T) {
src := ` \Foo::bar();`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Expression{
Expr: &expr.StaticCall{
@@ -86,8 +86,8 @@ func TestStaticCallFullyQualified(t *testing.T) {
&name.NamePart{Value: "Foo"},
},
},
- Call: &node.Identifier{Value: "bar"},
- Arguments: []node.Node{},
+ Call: &node.Identifier{Value: "bar"},
+ ArgumentList: &node.ArgumentList{},
},
},
},
@@ -107,7 +107,7 @@ func TestStaticCallFullyQualified(t *testing.T) {
func TestStaticCallVar(t *testing.T) {
src := ` Foo::$bar();`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Expression{
Expr: &expr.StaticCall{
@@ -116,8 +116,8 @@ func TestStaticCallVar(t *testing.T) {
&name.NamePart{Value: "Foo"},
},
},
- Call: &expr.Variable{VarName: &node.Identifier{Value: "bar"}},
- Arguments: []node.Node{},
+ Call: &expr.Variable{VarName: &node.Identifier{Value: "bar"}},
+ ArgumentList: &node.ArgumentList{},
},
},
},
@@ -137,13 +137,13 @@ func TestStaticCallVar(t *testing.T) {
func TestStaticCallVarVar(t *testing.T) {
src := ` $foo::$bar();`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Expression{
Expr: &expr.StaticCall{
- Class: &expr.Variable{VarName: &node.Identifier{Value: "foo"}},
- Call: &expr.Variable{VarName: &node.Identifier{Value: "bar"}},
- Arguments: []node.Node{},
+ Class: &expr.Variable{VarName: &node.Identifier{Value: "foo"}},
+ Call: &expr.Variable{VarName: &node.Identifier{Value: "bar"}},
+ ArgumentList: &node.ArgumentList{},
},
},
},
diff --git a/node/expr/t_static_property_fetch_test.go b/node/expr/t_static_property_fetch_test.go
index 521a09c..34b1861 100644
--- a/node/expr/t_static_property_fetch_test.go
+++ b/node/expr/t_static_property_fetch_test.go
@@ -16,7 +16,7 @@ import (
func TestStaticPropertyFetch(t *testing.T) {
src := ` Foo::$bar;`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Expression{
Expr: &expr.StaticPropertyFetch{
@@ -45,7 +45,7 @@ func TestStaticPropertyFetch(t *testing.T) {
func TestStaticPropertyFetchRelative(t *testing.T) {
src := ` namespace\Foo::$bar;`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Expression{
Expr: &expr.StaticPropertyFetch{
@@ -74,7 +74,7 @@ func TestStaticPropertyFetchRelative(t *testing.T) {
func TestStaticPropertyFetchFullyQualified(t *testing.T) {
src := ` \Foo::$bar;`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Expression{
Expr: &expr.StaticPropertyFetch{
diff --git a/node/expr/t_ternary_test.go b/node/expr/t_ternary_test.go
index ca6462e..a0dcb74 100644
--- a/node/expr/t_ternary_test.go
+++ b/node/expr/t_ternary_test.go
@@ -15,7 +15,7 @@ import (
func TestTernary(t *testing.T) {
src := ` $a ? $b : $c;`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Expression{
Expr: &expr.Ternary{
@@ -41,7 +41,7 @@ func TestTernary(t *testing.T) {
func TestTernarySimple(t *testing.T) {
src := ` $a ? : $c;`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Expression{
Expr: &expr.Ternary{
@@ -66,7 +66,7 @@ func TestTernarySimple(t *testing.T) {
func TestTernaryNestedTrue(t *testing.T) {
src := ` $a ? $b ? $c : $d : $e;`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Expression{
Expr: &expr.Ternary{
@@ -96,7 +96,7 @@ func TestTernaryNestedTrue(t *testing.T) {
func TestTernaryNestedCond(t *testing.T) {
src := ` $a ? $b : $c ? $d : $e;`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Expression{
Expr: &expr.Ternary{
diff --git a/node/expr/t_unary_test.go b/node/expr/t_unary_test.go
index bac3f10..19b12ce 100644
--- a/node/expr/t_unary_test.go
+++ b/node/expr/t_unary_test.go
@@ -15,7 +15,7 @@ import (
func TestUnaryMinus(t *testing.T) {
src := ` -$a;`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Expression{
Expr: &expr.UnaryMinus{
@@ -39,7 +39,7 @@ func TestUnaryMinus(t *testing.T) {
func TestUnaryPlus(t *testing.T) {
src := ` +$a;`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Expression{
Expr: &expr.UnaryPlus{
diff --git a/node/expr/t_variable_test.go b/node/expr/t_variable_test.go
index 8f5a10c..6183770 100644
--- a/node/expr/t_variable_test.go
+++ b/node/expr/t_variable_test.go
@@ -15,7 +15,7 @@ import (
func TestVariable(t *testing.T) {
src := ` $a;`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Expression{
Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
@@ -37,7 +37,7 @@ func TestVariable(t *testing.T) {
func TestVariableVariable(t *testing.T) {
src := ` $$a;`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Expression{
Expr: &expr.Variable{VarName: &expr.Variable{VarName: &node.Identifier{Value: "a"}}},
diff --git a/node/expr/t_visitor_test.go b/node/expr/t_visitor_test.go
index 89a9261..90d6741 100644
--- a/node/expr/t_visitor_test.go
+++ b/node/expr/t_visitor_test.go
@@ -32,20 +32,18 @@ var nodesToTest = []struct {
},
{
&expr.ArrayItem{
- ByRef: false,
- Key: &scalar.String{Value: "key"},
- Val: &scalar.Lnumber{Value: "1"},
+ Key: &scalar.String{Value: "key"},
+ Val: &scalar.Lnumber{Value: "1"},
},
[]string{"Key", "Val"},
- map[string]interface{}{"ByRef": false},
+ map[string]interface{}{},
},
{
&expr.Array{
Items: []node.Node{
&expr.ArrayItem{
- ByRef: false,
- Key: &scalar.String{Value: "key"},
- Val: &scalar.Lnumber{Value: "1"},
+ Key: &scalar.String{Value: "key"},
+ Val: &scalar.Lnumber{Value: "1"},
},
},
},
@@ -83,11 +81,12 @@ var nodesToTest = []struct {
},
{
&expr.ClosureUse{
- ByRef: false,
- Variable: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
+ Uses: []node.Node{
+ &expr.Variable{VarName: &node.Identifier{Value: "a"}},
+ },
},
- []string{"Variable"},
- map[string]interface{}{"ByRef": false},
+ []string{"Uses"},
+ map[string]interface{}{},
},
{
&expr.Closure{
@@ -95,11 +94,11 @@ var nodesToTest = []struct {
Static: false,
PhpDocComment: "",
Params: []node.Node{&node.Parameter{}},
- Uses: []node.Node{&expr.ClosureUse{}},
+ ClosureUse: &expr.ClosureUse{},
ReturnType: &name.Name{},
Stmts: []node.Node{&stmt.Nop{}},
},
- []string{"Params", "Uses", "ReturnType", "Stmts"},
+ []string{"Params", "ClosureUse", "ReturnType", "Stmts"},
map[string]interface{}{"ReturnsRef": true, "Static": false, "PhpDocComment": ""},
},
{
@@ -146,10 +145,10 @@ var nodesToTest = []struct {
},
{
&expr.FunctionCall{
- Function: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
- Arguments: []node.Node{&node.Argument{}},
+ Function: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
+ ArgumentList: &node.ArgumentList{},
},
- []string{"Function", "Arguments"},
+ []string{"Function", "ArgumentList"},
map[string]interface{}{},
},
{
@@ -194,19 +193,19 @@ var nodesToTest = []struct {
},
{
&expr.MethodCall{
- Variable: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
- Method: &node.Identifier{Value: "foo"},
- Arguments: []node.Node{&node.Argument{}},
+ Variable: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
+ Method: &node.Identifier{Value: "foo"},
+ ArgumentList: &node.ArgumentList{},
},
- []string{"Variable", "Method", "Arguments"},
+ []string{"Variable", "Method", "ArgumentList"},
map[string]interface{}{},
},
{
&expr.New{
- Class: &name.Name{},
- Arguments: []node.Node{&node.Argument{}},
+ Class: &name.Name{},
+ ArgumentList: &node.ArgumentList{},
},
- []string{"Class", "Arguments"},
+ []string{"Class", "ArgumentList"},
map[string]interface{}{},
},
{
@@ -252,6 +251,13 @@ var nodesToTest = []struct {
[]string{"Variable", "Property"},
map[string]interface{}{},
},
+ {
+ &expr.Reference{
+ Variable: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
+ },
+ []string{"Variable"},
+ map[string]interface{}{},
+ },
{
&expr.RequireOnce{
Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
@@ -295,11 +301,11 @@ var nodesToTest = []struct {
},
{
&expr.StaticCall{
- Class: &name.Name{},
- Call: &node.Identifier{Value: "foo"},
- Arguments: []node.Node{&node.Argument{}},
+ Class: &name.Name{},
+ Call: &node.Identifier{Value: "foo"},
+ ArgumentList: &node.ArgumentList{},
},
- []string{"Class", "Call", "Arguments"},
+ []string{"Class", "Call", "ArgumentList"},
map[string]interface{}{},
},
{
diff --git a/node/expr/t_yield_test.go b/node/expr/t_yield_test.go
index 2515839..b158adf 100644
--- a/node/expr/t_yield_test.go
+++ b/node/expr/t_yield_test.go
@@ -16,7 +16,7 @@ import (
func TestYield(t *testing.T) {
src := ` yield;`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Expression{
Expr: &expr.Yield{},
@@ -38,7 +38,7 @@ func TestYield(t *testing.T) {
func TestYieldVal(t *testing.T) {
src := ` yield $a;`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Expression{
Expr: &expr.Yield{
@@ -62,7 +62,7 @@ func TestYieldVal(t *testing.T) {
func TestYieldKeyVal(t *testing.T) {
src := ` yield $a => $b;`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Expression{
Expr: &expr.Yield{
@@ -87,7 +87,7 @@ func TestYieldKeyVal(t *testing.T) {
func TestYieldExpr(t *testing.T) {
src := ` yield 1;`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Expression{
Expr: &expr.Yield{
@@ -111,7 +111,7 @@ func TestYieldExpr(t *testing.T) {
func TestYieldKeyExpr(t *testing.T) {
src := ` yield $a => 1;`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Expression{
Expr: &expr.Yield{
@@ -136,7 +136,7 @@ func TestYieldKeyExpr(t *testing.T) {
func TestYieldFrom(t *testing.T) {
src := ` yield from $a;`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Expression{
Expr: &expr.YieldFrom{
diff --git a/node/n_argument_list.go b/node/n_argument_list.go
new file mode 100644
index 0000000..843030f
--- /dev/null
+++ b/node/n_argument_list.go
@@ -0,0 +1,41 @@
+package node
+
+import (
+ "github.com/z7zmey/php-parser/walker"
+)
+
+// ArgumentList node
+type ArgumentList struct {
+ Arguments []Node
+}
+
+// NewArgumentList node constructor
+func NewArgumentList(Arguments []Node) *ArgumentList {
+ return &ArgumentList{
+ Arguments,
+ }
+}
+
+// Attributes returns node attributes as map
+func (n *ArgumentList) Attributes() map[string]interface{} {
+ return nil
+}
+
+// Walk traverses nodes
+// Walk is invoked recursively until v.EnterNode returns true
+func (n *ArgumentList) Walk(v walker.Visitor) {
+ if v.EnterNode(n) == false {
+ return
+ }
+
+ if n.Arguments != nil {
+ vv := v.GetChildrenVisitor("Arguments")
+ for _, nn := range n.Arguments {
+ if nn != nil {
+ nn.Walk(vv)
+ }
+ }
+ }
+
+ v.LeaveNode(n)
+}
diff --git a/node/n_root.go b/node/n_root.go
new file mode 100644
index 0000000..67db6dc
--- /dev/null
+++ b/node/n_root.go
@@ -0,0 +1,41 @@
+package node
+
+import (
+ "github.com/z7zmey/php-parser/walker"
+)
+
+// Root node
+type Root struct {
+ Stmts []Node
+}
+
+// NewRoot node constructor
+func NewRoot(Stmts []Node) *Root {
+ return &Root{
+ Stmts,
+ }
+}
+
+// Attributes returns node attributes as map
+func (n *Root) Attributes() map[string]interface{} {
+ return nil
+}
+
+// Walk traverses nodes
+// Walk is invoked recursively until v.EnterNode returns true
+func (n *Root) Walk(v walker.Visitor) {
+ if v.EnterNode(n) == false {
+ return
+ }
+
+ if n.Stmts != nil {
+ vv := v.GetChildrenVisitor("Stmts")
+ for _, nn := range n.Stmts {
+ if nn != nil {
+ nn.Walk(vv)
+ }
+ }
+ }
+
+ v.LeaveNode(n)
+}
diff --git a/node/name/t_name_test.go b/node/name/t_name_test.go
index 7cd1396..8c272fe 100644
--- a/node/name/t_name_test.go
+++ b/node/name/t_name_test.go
@@ -31,14 +31,14 @@ func assertEqual(t *testing.T, expected interface{}, actual interface{}) {
func TestName(t *testing.T) {
src := ` foo();`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Expression{
Expr: &expr.FunctionCall{
Function: &name.Name{
Parts: []node.Node{&name.NamePart{Value: "foo"}},
},
- Arguments: []node.Node{},
+ ArgumentList: &node.ArgumentList{},
},
},
},
@@ -58,14 +58,14 @@ func TestName(t *testing.T) {
func TestFullyQualified(t *testing.T) {
src := ` \foo();`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Expression{
Expr: &expr.FunctionCall{
Function: &name.FullyQualified{
Parts: []node.Node{&name.NamePart{Value: "foo"}},
},
- Arguments: []node.Node{},
+ ArgumentList: &node.ArgumentList{},
},
},
},
@@ -85,14 +85,14 @@ func TestFullyQualified(t *testing.T) {
func TestRelative(t *testing.T) {
src := ` namespace\foo();`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Expression{
Expr: &expr.FunctionCall{
Function: &name.Relative{
Parts: []node.Node{&name.NamePart{Value: "foo"}},
},
- Arguments: []node.Node{},
+ ArgumentList: &node.ArgumentList{},
},
},
},
diff --git a/node/scalar/t_encapsed_test.go b/node/scalar/t_encapsed_test.go
index 2e13d96..1a29fe6 100644
--- a/node/scalar/t_encapsed_test.go
+++ b/node/scalar/t_encapsed_test.go
@@ -16,7 +16,7 @@ import (
func TestSimpleVar(t *testing.T) {
src := ` "test $var";`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Expression{
Expr: &scalar.Encapsed{
@@ -43,7 +43,7 @@ func TestSimpleVar(t *testing.T) {
func TestSimpleVarOneChar(t *testing.T) {
src := ` "test $a";`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Expression{
Expr: &scalar.Encapsed{
@@ -70,7 +70,7 @@ func TestSimpleVarOneChar(t *testing.T) {
func TestSimpleVarEndsEcapsed(t *testing.T) {
src := ` "test $var\"";`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Expression{
Expr: &scalar.Encapsed{
@@ -98,7 +98,7 @@ func TestSimpleVarEndsEcapsed(t *testing.T) {
func TestStringVarCurveOpen(t *testing.T) {
src := ` "=$a{$b}";`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Expression{
Expr: &scalar.Encapsed{
@@ -126,7 +126,7 @@ func TestStringVarCurveOpen(t *testing.T) {
func TestSimpleVarPropertyFetch(t *testing.T) {
src := ` "test $foo->bar()";`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Expression{
Expr: &scalar.Encapsed{
@@ -157,7 +157,7 @@ func TestSimpleVarPropertyFetch(t *testing.T) {
func TestDollarOpenCurlyBraces(t *testing.T) {
src := ` "test ${foo}";`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Expression{
Expr: &scalar.Encapsed{
@@ -184,7 +184,7 @@ func TestDollarOpenCurlyBraces(t *testing.T) {
func TestDollarOpenCurlyBracesDimNumber(t *testing.T) {
src := ` "test ${foo[0]}";`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Expression{
Expr: &scalar.Encapsed{
@@ -214,16 +214,16 @@ func TestDollarOpenCurlyBracesDimNumber(t *testing.T) {
func TestCurlyOpenMethodCall(t *testing.T) {
src := ` "test {$foo->bar()}";`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Expression{
Expr: &scalar.Encapsed{
Parts: []node.Node{
&scalar.EncapsedStringPart{Value: "test "},
&expr.MethodCall{
- Variable: &expr.Variable{VarName: &node.Identifier{Value: "foo"}},
- Method: &node.Identifier{Value: "bar"},
- Arguments: []node.Node{},
+ Variable: &expr.Variable{VarName: &node.Identifier{Value: "foo"}},
+ Method: &node.Identifier{Value: "bar"},
+ ArgumentList: &node.ArgumentList{},
},
},
},
diff --git a/node/scalar/t_heredoc_test.go b/node/scalar/t_heredoc_test.go
index 754195f..10ffb61 100644
--- a/node/scalar/t_heredoc_test.go
+++ b/node/scalar/t_heredoc_test.go
@@ -19,7 +19,7 @@ test $var
LBL;
`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Expression{
Expr: &scalar.Heredoc{
@@ -51,7 +51,7 @@ test $var
LBL;
`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Expression{
Expr: &scalar.Heredoc{
@@ -83,7 +83,7 @@ test $var
LBL;
`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Expression{
Expr: &scalar.Heredoc{
@@ -112,7 +112,7 @@ func TestEmptyHeredoc(t *testing.T) {
CAD;
`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Expression{
Expr: &scalar.Heredoc{
@@ -139,7 +139,7 @@ func TestHeredocScalarString(t *testing.T) {
CAD;
`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Expression{
Expr: &scalar.Heredoc{
diff --git a/node/scalar/t_magic_constant_test.go b/node/scalar/t_magic_constant_test.go
index 9b8d2f1..0fbdfdb 100644
--- a/node/scalar/t_magic_constant_test.go
+++ b/node/scalar/t_magic_constant_test.go
@@ -15,7 +15,7 @@ func TestMagicConstant(t *testing.T) {
// TODO: test all magic constants
src := ` __DIR__;`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Expression{
Expr: &scalar.MagicConstant{Value: "__DIR__"},
diff --git a/node/scalar/t_numbers_test.go b/node/scalar/t_numbers_test.go
index fa04eb5..ad42e0e 100644
--- a/node/scalar/t_numbers_test.go
+++ b/node/scalar/t_numbers_test.go
@@ -29,7 +29,7 @@ func assertEqual(t *testing.T, expected interface{}, actual interface{}) {
func TestLNumber(t *testing.T) {
src := ` 1234567890123456789;`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Expression{
Expr: &scalar.Lnumber{Value: "1234567890123456789"},
@@ -51,7 +51,7 @@ func TestLNumber(t *testing.T) {
func TestDNumber(t *testing.T) {
src := ` 12345678901234567890;`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Expression{
Expr: &scalar.Dnumber{Value: "12345678901234567890"},
@@ -73,7 +73,7 @@ func TestDNumber(t *testing.T) {
func TestFloat(t *testing.T) {
src := ` 0.;`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Expression{
Expr: &scalar.Dnumber{Value: "0."},
@@ -95,7 +95,7 @@ func TestFloat(t *testing.T) {
func TestBinaryLNumber(t *testing.T) {
src := ` 0b0111111111111111111111111111111111111111111111111111111111111111;`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Expression{
Expr: &scalar.Lnumber{Value: "0b0111111111111111111111111111111111111111111111111111111111111111"},
@@ -117,7 +117,7 @@ func TestBinaryLNumber(t *testing.T) {
func TestBinaryDNumber(t *testing.T) {
src := ` 0b1111111111111111111111111111111111111111111111111111111111111111;`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Expression{
Expr: &scalar.Dnumber{Value: "0b1111111111111111111111111111111111111111111111111111111111111111"},
@@ -139,7 +139,7 @@ func TestBinaryDNumber(t *testing.T) {
func TestHLNumber(t *testing.T) {
src := ` 0x007111111111111111;`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Expression{
Expr: &scalar.Lnumber{Value: "0x007111111111111111"},
@@ -161,7 +161,7 @@ func TestHLNumber(t *testing.T) {
func TestHDNumber(t *testing.T) {
src := ` 0x8111111111111111;`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Expression{
Expr: &scalar.Dnumber{Value: "0x8111111111111111"},
diff --git a/node/scalar/t_string_test.go b/node/scalar/t_string_test.go
index fc344fd..11c1423 100644
--- a/node/scalar/t_string_test.go
+++ b/node/scalar/t_string_test.go
@@ -14,7 +14,7 @@ import (
func TestDoubleQuotedScalarString(t *testing.T) {
src := ` "test";`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Expression{
Expr: &scalar.String{Value: "\"test\""},
@@ -35,7 +35,7 @@ func TestDoubleQuotedScalarString(t *testing.T) {
func TestDoubleQuotedScalarStringWithEscapedVar(t *testing.T) {
src := ` "\$test";`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Expression{
Expr: &scalar.String{Value: "\"\\$test\""},
@@ -59,7 +59,7 @@ func TestMultilineDoubleQuotedScalarString(t *testing.T) {
test
";`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Expression{
Expr: &scalar.String{Value: "\"\n\ttest\n\t\""},
@@ -81,7 +81,7 @@ func TestMultilineDoubleQuotedScalarString(t *testing.T) {
func TestSingleQuotedScalarString(t *testing.T) {
src := ` '$test';`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Expression{
Expr: &scalar.String{Value: "'$test'"},
@@ -105,7 +105,7 @@ func TestMultilineSingleQuotedScalarString(t *testing.T) {
$test
';`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Expression{
Expr: &scalar.String{Value: "'\n\t$test\n\t'"},
diff --git a/node/stmt/n_alt_foreach.go b/node/stmt/n_alt_foreach.go
index 950445a..deaa4c4 100644
--- a/node/stmt/n_alt_foreach.go
+++ b/node/stmt/n_alt_foreach.go
@@ -7,7 +7,6 @@ import (
// AltForeach node
type AltForeach struct {
- ByRef bool
Expr node.Node
Key node.Node
Variable node.Node
@@ -15,9 +14,8 @@ type AltForeach struct {
}
// NewAltForeach node constructor
-func NewAltForeach(Expr node.Node, Key node.Node, Variable node.Node, Stmt node.Node, ByRef bool) *AltForeach {
+func NewAltForeach(Expr node.Node, Key node.Node, Variable node.Node, Stmt node.Node) *AltForeach {
return &AltForeach{
- ByRef,
Expr,
Key,
Variable,
@@ -27,9 +25,7 @@ func NewAltForeach(Expr node.Node, Key node.Node, Variable node.Node, Stmt node.
// Attributes returns node attributes as map
func (n *AltForeach) Attributes() map[string]interface{} {
- return map[string]interface{}{
- "ByRef": n.ByRef,
- }
+ return nil
}
// Walk traverses nodes
diff --git a/node/stmt/n_alt_switch.go b/node/stmt/n_alt_switch.go
index 4c7587f..ef28404 100644
--- a/node/stmt/n_alt_switch.go
+++ b/node/stmt/n_alt_switch.go
@@ -7,15 +7,15 @@ import (
// AltSwitch node
type AltSwitch struct {
- Cond node.Node
- Cases []node.Node
+ Cond node.Node
+ CaseList *CaseList
}
// NewAltSwitch node constructor
-func NewAltSwitch(Cond node.Node, Cases []node.Node) *AltSwitch {
+func NewAltSwitch(Cond node.Node, CaseList *CaseList) *AltSwitch {
return &AltSwitch{
Cond,
- Cases,
+ CaseList,
}
}
@@ -36,13 +36,9 @@ func (n *AltSwitch) Walk(v walker.Visitor) {
n.Cond.Walk(vv)
}
- if n.Cases != nil {
- vv := v.GetChildrenVisitor("Cases")
- for _, nn := range n.Cases {
- if nn != nil {
- nn.Walk(vv)
- }
- }
+ if n.CaseList != nil {
+ vv := v.GetChildrenVisitor("CaseList")
+ n.CaseList.Walk(vv)
}
v.LeaveNode(n)
diff --git a/node/stmt/n_case_list.go b/node/stmt/n_case_list.go
new file mode 100644
index 0000000..ac43d6a
--- /dev/null
+++ b/node/stmt/n_case_list.go
@@ -0,0 +1,42 @@
+package stmt
+
+import (
+ "github.com/z7zmey/php-parser/node"
+ "github.com/z7zmey/php-parser/walker"
+)
+
+// CaseList node
+type CaseList struct {
+ Cases []node.Node
+}
+
+// NewCaseList node constructor
+func NewCaseList(Cases []node.Node) *CaseList {
+ return &CaseList{
+ Cases,
+ }
+}
+
+// Attributes returns node attributes as map
+func (n *CaseList) Attributes() map[string]interface{} {
+ return nil
+}
+
+// Walk traverses nodes
+// Walk is invoked recursively until v.EnterNode returns true
+func (n *CaseList) Walk(v walker.Visitor) {
+ if v.EnterNode(n) == false {
+ return
+ }
+
+ if n.Cases != nil {
+ vv := v.GetChildrenVisitor("Cases")
+ for _, nn := range n.Cases {
+ if nn != nil {
+ nn.Walk(vv)
+ }
+ }
+ }
+
+ v.LeaveNode(n)
+}
diff --git a/node/stmt/n_class.go b/node/stmt/n_class.go
index 6301874..305490d 100644
--- a/node/stmt/n_class.go
+++ b/node/stmt/n_class.go
@@ -10,19 +10,19 @@ type Class struct {
PhpDocComment string
ClassName node.Node
Modifiers []node.Node
- Args []node.Node
- Extends node.Node
- Implements []node.Node
+ ArgumentList *node.ArgumentList
+ Extends *ClassExtends
+ Implements *ClassImplements
Stmts []node.Node
}
// NewClass node constructor
-func NewClass(ClassName node.Node, Modifiers []node.Node, Args []node.Node, Extends node.Node, Implements []node.Node, Stmts []node.Node, PhpDocComment string) *Class {
+func NewClass(ClassName node.Node, Modifiers []node.Node, ArgumentList *node.ArgumentList, Extends *ClassExtends, Implements *ClassImplements, Stmts []node.Node, PhpDocComment string) *Class {
return &Class{
PhpDocComment,
ClassName,
Modifiers,
- Args,
+ ArgumentList,
Extends,
Implements,
Stmts,
@@ -57,13 +57,9 @@ func (n *Class) Walk(v walker.Visitor) {
}
}
- if n.Args != nil {
- vv := v.GetChildrenVisitor("Args")
- for _, nn := range n.Args {
- if nn != nil {
- nn.Walk(vv)
- }
- }
+ if n.ArgumentList != nil {
+ vv := v.GetChildrenVisitor("ArgumentList")
+ n.ArgumentList.Walk(vv)
}
if n.Extends != nil {
@@ -73,11 +69,7 @@ func (n *Class) Walk(v walker.Visitor) {
if n.Implements != nil {
vv := v.GetChildrenVisitor("Implements")
- for _, nn := range n.Implements {
- if nn != nil {
- nn.Walk(vv)
- }
- }
+ n.Implements.Walk(vv)
}
if n.Stmts != nil {
diff --git a/node/stmt/n_class_extends.go b/node/stmt/n_class_extends.go
new file mode 100644
index 0000000..2d7efcc
--- /dev/null
+++ b/node/stmt/n_class_extends.go
@@ -0,0 +1,38 @@
+package stmt
+
+import (
+ "github.com/z7zmey/php-parser/node"
+ "github.com/z7zmey/php-parser/walker"
+)
+
+// ClassExtends node
+type ClassExtends struct {
+ ClassName node.Node
+}
+
+// NewClassExtends node constructor
+func NewClassExtends(className node.Node) *ClassExtends {
+ return &ClassExtends{
+ className,
+ }
+}
+
+// Attributes returns node attributes as map
+func (n *ClassExtends) Attributes() map[string]interface{} {
+ return nil
+}
+
+// Walk traverses nodes
+// Walk is invoked recursively until v.EnterNode returns true
+func (n *ClassExtends) Walk(v walker.Visitor) {
+ if v.EnterNode(n) == false {
+ return
+ }
+
+ if n.ClassName != nil {
+ vv := v.GetChildrenVisitor("ClassName")
+ n.ClassName.Walk(vv)
+ }
+
+ v.LeaveNode(n)
+}
diff --git a/node/stmt/n_class_implements.go b/node/stmt/n_class_implements.go
new file mode 100644
index 0000000..00a37a1
--- /dev/null
+++ b/node/stmt/n_class_implements.go
@@ -0,0 +1,42 @@
+package stmt
+
+import (
+ "github.com/z7zmey/php-parser/node"
+ "github.com/z7zmey/php-parser/walker"
+)
+
+// ClassImplements node
+type ClassImplements struct {
+ InterfaceNames []node.Node
+}
+
+// NewClassImplements node constructor
+func NewClassImplements(interfaceNames []node.Node) *ClassImplements {
+ return &ClassImplements{
+ interfaceNames,
+ }
+}
+
+// Attributes returns node attributes as map
+func (n *ClassImplements) Attributes() map[string]interface{} {
+ return nil
+}
+
+// Walk traverses nodes
+// Walk is invoked recursively until v.EnterNode returns true
+func (n *ClassImplements) Walk(v walker.Visitor) {
+ if v.EnterNode(n) == false {
+ return
+ }
+
+ if n.InterfaceNames != nil {
+ vv := v.GetChildrenVisitor("InterfaceNames")
+ for _, nn := range n.InterfaceNames {
+ if nn != nil {
+ nn.Walk(vv)
+ }
+ }
+ }
+
+ v.LeaveNode(n)
+}
diff --git a/node/stmt/n_class_method.go b/node/stmt/n_class_method.go
index 2ae7dde..ec7d9ee 100644
--- a/node/stmt/n_class_method.go
+++ b/node/stmt/n_class_method.go
@@ -13,11 +13,11 @@ type ClassMethod struct {
Modifiers []node.Node
Params []node.Node
ReturnType node.Node
- Stmts []node.Node
+ Stmt node.Node
}
// NewClassMethod node constructor
-func NewClassMethod(MethodName node.Node, Modifiers []node.Node, ReturnsRef bool, Params []node.Node, ReturnType node.Node, Stmts []node.Node, PhpDocComment string) *ClassMethod {
+func NewClassMethod(MethodName node.Node, Modifiers []node.Node, ReturnsRef bool, Params []node.Node, ReturnType node.Node, Stmt node.Node, PhpDocComment string) *ClassMethod {
return &ClassMethod{
ReturnsRef,
PhpDocComment,
@@ -25,7 +25,7 @@ func NewClassMethod(MethodName node.Node, Modifiers []node.Node, ReturnsRef bool
Modifiers,
Params,
ReturnType,
- Stmts,
+ Stmt,
}
}
@@ -72,13 +72,9 @@ func (n *ClassMethod) Walk(v walker.Visitor) {
n.ReturnType.Walk(vv)
}
- if n.Stmts != nil {
- vv := v.GetChildrenVisitor("Stmts")
- for _, nn := range n.Stmts {
- if nn != nil {
- nn.Walk(vv)
- }
- }
+ if n.Stmt != nil {
+ vv := v.GetChildrenVisitor("Stmt")
+ n.Stmt.Walk(vv)
}
v.LeaveNode(n)
diff --git a/node/stmt/n_foreach.go b/node/stmt/n_foreach.go
index 2ae2c48..b82d2f5 100644
--- a/node/stmt/n_foreach.go
+++ b/node/stmt/n_foreach.go
@@ -7,7 +7,6 @@ import (
// Foreach node
type Foreach struct {
- ByRef bool
Expr node.Node
Key node.Node
Variable node.Node
@@ -15,9 +14,8 @@ type Foreach struct {
}
// NewForeach node constructor
-func NewForeach(Expr node.Node, Key node.Node, Variable node.Node, Stmt node.Node, ByRef bool) *Foreach {
+func NewForeach(Expr node.Node, Key node.Node, Variable node.Node, Stmt node.Node) *Foreach {
return &Foreach{
- ByRef,
Expr,
Key,
Variable,
@@ -27,9 +25,7 @@ func NewForeach(Expr node.Node, Key node.Node, Variable node.Node, Stmt node.Nod
// Attributes returns node attributes as map
func (n *Foreach) Attributes() map[string]interface{} {
- return map[string]interface{}{
- "ByRef": n.ByRef,
- }
+ return nil
}
// Walk traverses nodes
diff --git a/node/stmt/n_interface.go b/node/stmt/n_interface.go
index bd1296d..46524c6 100644
--- a/node/stmt/n_interface.go
+++ b/node/stmt/n_interface.go
@@ -9,12 +9,12 @@ import (
type Interface struct {
PhpDocComment string
InterfaceName node.Node
- Extends []node.Node
+ Extends *InterfaceExtends
Stmts []node.Node
}
// NewInterface node constructor
-func NewInterface(InterfaceName node.Node, Extends []node.Node, Stmts []node.Node, PhpDocComment string) *Interface {
+func NewInterface(InterfaceName node.Node, Extends *InterfaceExtends, Stmts []node.Node, PhpDocComment string) *Interface {
return &Interface{
PhpDocComment,
InterfaceName,
@@ -44,11 +44,7 @@ func (n *Interface) Walk(v walker.Visitor) {
if n.Extends != nil {
vv := v.GetChildrenVisitor("Extends")
- for _, nn := range n.Extends {
- if nn != nil {
- nn.Walk(vv)
- }
- }
+ n.Extends.Walk(vv)
}
if n.Stmts != nil {
diff --git a/node/stmt/n_interface_extends.go b/node/stmt/n_interface_extends.go
new file mode 100644
index 0000000..2b1c61a
--- /dev/null
+++ b/node/stmt/n_interface_extends.go
@@ -0,0 +1,42 @@
+package stmt
+
+import (
+ "github.com/z7zmey/php-parser/node"
+ "github.com/z7zmey/php-parser/walker"
+)
+
+// InterfaceExtends node
+type InterfaceExtends struct {
+ InterfaceNames []node.Node
+}
+
+// NewInterfaceExtends node constructor
+func NewInterfaceExtends(InterfaceNames []node.Node) *InterfaceExtends {
+ return &InterfaceExtends{
+ InterfaceNames,
+ }
+}
+
+// Attributes returns node attributes as map
+func (n *InterfaceExtends) Attributes() map[string]interface{} {
+ return nil
+}
+
+// Walk traverses nodes
+// Walk is invoked recursively until v.EnterNode returns true
+func (n *InterfaceExtends) Walk(v walker.Visitor) {
+ if v.EnterNode(n) == false {
+ return
+ }
+
+ if n.InterfaceNames != nil {
+ vv := v.GetChildrenVisitor("InterfaceNames")
+ for _, nn := range n.InterfaceNames {
+ if nn != nil {
+ nn.Walk(vv)
+ }
+ }
+ }
+
+ v.LeaveNode(n)
+}
diff --git a/node/stmt/n_switch.go b/node/stmt/n_switch.go
index 2882257..f99963e 100644
--- a/node/stmt/n_switch.go
+++ b/node/stmt/n_switch.go
@@ -7,15 +7,15 @@ import (
// Switch node
type Switch struct {
- Cond node.Node
- Cases []node.Node
+ Cond node.Node
+ CaseList *CaseList
}
// NewSwitch node constructor
-func NewSwitch(Cond node.Node, Cases []node.Node) *Switch {
+func NewSwitch(Cond node.Node, CaseList *CaseList) *Switch {
return &Switch{
Cond,
- Cases,
+ CaseList,
}
}
@@ -36,13 +36,9 @@ func (n *Switch) Walk(v walker.Visitor) {
n.Cond.Walk(vv)
}
- if n.Cases != nil {
- vv := v.GetChildrenVisitor("Cases")
- for _, nn := range n.Cases {
- if nn != nil {
- nn.Walk(vv)
- }
- }
+ if n.CaseList != nil {
+ vv := v.GetChildrenVisitor("CaseList")
+ n.CaseList.Walk(vv)
}
v.LeaveNode(n)
diff --git a/node/stmt/n_trait_adaptation_list.go b/node/stmt/n_trait_adaptation_list.go
new file mode 100644
index 0000000..d2a4b73
--- /dev/null
+++ b/node/stmt/n_trait_adaptation_list.go
@@ -0,0 +1,42 @@
+package stmt
+
+import (
+ "github.com/z7zmey/php-parser/node"
+ "github.com/z7zmey/php-parser/walker"
+)
+
+// TraitAdaptationList node
+type TraitAdaptationList struct {
+ Adaptations []node.Node
+}
+
+// NewTraitAdaptationList node constructor
+func NewTraitAdaptationList(Adaptations []node.Node) *TraitAdaptationList {
+ return &TraitAdaptationList{
+ Adaptations,
+ }
+}
+
+// Attributes returns node attributes as map
+func (n *TraitAdaptationList) Attributes() map[string]interface{} {
+ return nil
+}
+
+// Walk traverses nodes
+// Walk is invoked recursively until v.EnterNode returns true
+func (n *TraitAdaptationList) Walk(v walker.Visitor) {
+ if v.EnterNode(n) == false {
+ return
+ }
+
+ if n.Adaptations != nil {
+ vv := v.GetChildrenVisitor("Adaptations")
+ for _, nn := range n.Adaptations {
+ if nn != nil {
+ nn.Walk(vv)
+ }
+ }
+ }
+
+ v.LeaveNode(n)
+}
diff --git a/node/stmt/n_trait_use.go b/node/stmt/n_trait_use.go
index b5b0b87..d39dbec 100644
--- a/node/stmt/n_trait_use.go
+++ b/node/stmt/n_trait_use.go
@@ -7,15 +7,15 @@ import (
// TraitUse node
type TraitUse struct {
- Traits []node.Node
- Adaptations []node.Node
+ Traits []node.Node
+ TraitAdaptationList *TraitAdaptationList
}
// NewTraitUse node constructor
-func NewTraitUse(Traits []node.Node, Adaptations []node.Node) *TraitUse {
+func NewTraitUse(Traits []node.Node, InnerAdaptationList *TraitAdaptationList) *TraitUse {
return &TraitUse{
Traits,
- Adaptations,
+ InnerAdaptationList,
}
}
@@ -40,13 +40,9 @@ func (n *TraitUse) Walk(v walker.Visitor) {
}
}
- if n.Adaptations != nil {
- vv := v.GetChildrenVisitor("Adaptations")
- for _, nn := range n.Adaptations {
- if nn != nil {
- nn.Walk(vv)
- }
- }
+ if n.TraitAdaptationList != nil {
+ vv := v.GetChildrenVisitor("TraitAdaptationList")
+ n.TraitAdaptationList.Walk(vv)
}
v.LeaveNode(n)
diff --git a/node/stmt/t_alt_if_test.go b/node/stmt/t_alt_if_test.go
index 702820f..7f4bc2f 100644
--- a/node/stmt/t_alt_if_test.go
+++ b/node/stmt/t_alt_if_test.go
@@ -33,7 +33,7 @@ func TestAltIf(t *testing.T) {
endif;
`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.AltIf{
Cond: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
@@ -60,7 +60,7 @@ func TestAltElseIf(t *testing.T) {
endif;
`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.AltIf{
Cond: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
@@ -93,7 +93,7 @@ func TestAltElse(t *testing.T) {
endif;
`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.AltIf{
Cond: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
@@ -125,7 +125,7 @@ func TestAltElseElseIf(t *testing.T) {
endif;
`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.AltIf{
Cond: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
diff --git a/node/stmt/t_class_const_list_test.go b/node/stmt/t_class_const_list_test.go
index 7b09a84..c06caaa 100644
--- a/node/stmt/t_class_const_list_test.go
+++ b/node/stmt/t_class_const_list_test.go
@@ -15,7 +15,7 @@ import (
func TestClassConstList(t *testing.T) {
src := ` class foo{ public const FOO = 1, BAR = 2; }`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Class{
ClassName: &node.Identifier{Value: "foo"},
@@ -51,7 +51,7 @@ func TestClassConstList(t *testing.T) {
func TestClassConstListWithoutModifiers(t *testing.T) {
src := ` class foo{ const FOO = 1, BAR = 2; }`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Class{
ClassName: &node.Identifier{Value: "foo"},
diff --git a/node/stmt/t_class_method_test.go b/node/stmt/t_class_method_test.go
index d842575..e0766d7 100644
--- a/node/stmt/t_class_method_test.go
+++ b/node/stmt/t_class_method_test.go
@@ -2,9 +2,10 @@ package stmt_test
import (
"bytes"
- "github.com/z7zmey/php-parser/node/name"
"testing"
+ "github.com/z7zmey/php-parser/node/name"
+
"github.com/z7zmey/php-parser/node"
"github.com/z7zmey/php-parser/node/stmt"
"github.com/z7zmey/php-parser/php5"
@@ -14,7 +15,7 @@ import (
func TestSimpleClassMethod(t *testing.T) {
src := ` class foo{ function bar() {} }`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Class{
ClassName: &node.Identifier{Value: "foo"},
@@ -22,7 +23,9 @@ func TestSimpleClassMethod(t *testing.T) {
&stmt.ClassMethod{
PhpDocComment: "",
MethodName: &node.Identifier{Value: "bar"},
- Stmts: []node.Node{},
+ Stmt: &stmt.StmtList{
+ Stmts: []node.Node{},
+ },
},
},
},
@@ -43,7 +46,7 @@ func TestSimpleClassMethod(t *testing.T) {
func TestPrivateProtectedClassMethod(t *testing.T) {
src := ` class foo{ final private function bar() {} protected function baz() {} }`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Class{
ClassName: &node.Identifier{Value: "foo"},
@@ -56,7 +59,9 @@ func TestPrivateProtectedClassMethod(t *testing.T) {
&node.Identifier{Value: "final"},
&node.Identifier{Value: "private"},
},
- Stmts: []node.Node{},
+ Stmt: &stmt.StmtList{
+ Stmts: []node.Node{},
+ },
},
&stmt.ClassMethod{
PhpDocComment: "",
@@ -65,7 +70,9 @@ func TestPrivateProtectedClassMethod(t *testing.T) {
Modifiers: []node.Node{
&node.Identifier{Value: "protected"},
},
- Stmts: []node.Node{},
+ Stmt: &stmt.StmtList{
+ Stmts: []node.Node{},
+ },
},
},
},
@@ -86,7 +93,7 @@ func TestPrivateProtectedClassMethod(t *testing.T) {
func TestPhp5ClassMethod(t *testing.T) {
src := ` class foo{ public static function &bar() {} }`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Class{
ClassName: &node.Identifier{Value: "foo"},
@@ -99,7 +106,9 @@ func TestPhp5ClassMethod(t *testing.T) {
&node.Identifier{Value: "public"},
&node.Identifier{Value: "static"},
},
- Stmts: []node.Node{},
+ Stmt: &stmt.StmtList{
+ Stmts: []node.Node{},
+ },
},
},
},
@@ -115,7 +124,7 @@ func TestPhp5ClassMethod(t *testing.T) {
func TestPhp7ClassMethod(t *testing.T) {
src := ` class foo{ public static function &bar(): void {} }`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Class{
ClassName: &node.Identifier{Value: "foo"},
@@ -133,7 +142,9 @@ func TestPhp7ClassMethod(t *testing.T) {
&name.NamePart{Value: "void"},
},
},
- Stmts: []node.Node{},
+ Stmt: &stmt.StmtList{
+ Stmts: []node.Node{},
+ },
},
},
},
@@ -149,7 +160,7 @@ func TestPhp7ClassMethod(t *testing.T) {
func TestAbstractClassMethod(t *testing.T) {
src := ` abstract class Foo{ abstract public function bar(); }`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Class{
Modifiers: []node.Node{&node.Identifier{Value: "abstract"}},
@@ -163,6 +174,7 @@ func TestAbstractClassMethod(t *testing.T) {
&node.Identifier{Value: "abstract"},
&node.Identifier{Value: "public"},
},
+ Stmt: &stmt.Nop{},
},
},
},
@@ -183,7 +195,7 @@ func TestAbstractClassMethod(t *testing.T) {
func TestPhp7AbstractClassMethod(t *testing.T) {
src := ` abstract class Foo{ public function bar(): void; }`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Class{
Modifiers: []node.Node{&node.Identifier{Value: "abstract"}},
@@ -201,6 +213,7 @@ func TestPhp7AbstractClassMethod(t *testing.T) {
&name.NamePart{Value: "void"},
},
},
+ Stmt: &stmt.Nop{},
},
},
},
diff --git a/node/stmt/t_class_test.go b/node/stmt/t_class_test.go
index c3c6d31..5b32326 100644
--- a/node/stmt/t_class_test.go
+++ b/node/stmt/t_class_test.go
@@ -2,9 +2,10 @@ package stmt_test
import (
"bytes"
+ "testing"
+
"github.com/z7zmey/php-parser/node/expr"
"github.com/z7zmey/php-parser/node/name"
- "testing"
"github.com/z7zmey/php-parser/node"
"github.com/z7zmey/php-parser/node/stmt"
@@ -15,7 +16,7 @@ import (
func TestSimpleClass(t *testing.T) {
src := ` class foo{ }`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Class{
ClassName: &node.Identifier{Value: "foo"},
@@ -38,7 +39,7 @@ func TestSimpleClass(t *testing.T) {
func TestAbstractClass(t *testing.T) {
src := ` abstract class foo{ }`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Class{
ClassName: &node.Identifier{Value: "foo"},
@@ -64,16 +65,18 @@ func TestAbstractClass(t *testing.T) {
func TestClassExtends(t *testing.T) {
src := ` final class foo extends bar { }`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Class{
ClassName: &node.Identifier{Value: "foo"},
Modifiers: []node.Node{
&node.Identifier{Value: "final"},
},
- Extends: &name.Name{
- Parts: []node.Node{
- &name.NamePart{Value: "bar"},
+ Extends: &stmt.ClassExtends{
+ ClassName: &name.Name{
+ Parts: []node.Node{
+ &name.NamePart{Value: "bar"},
+ },
},
},
Stmts: []node.Node{},
@@ -95,17 +98,19 @@ func TestClassExtends(t *testing.T) {
func TestClassImplement(t *testing.T) {
src := ` final class foo implements bar { }`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Class{
ClassName: &node.Identifier{Value: "foo"},
Modifiers: []node.Node{
&node.Identifier{Value: "final"},
},
- Implements: []node.Node{
- &name.Name{
- Parts: []node.Node{
- &name.NamePart{Value: "bar"},
+ Implements: &stmt.ClassImplements{
+ InterfaceNames: []node.Node{
+ &name.Name{
+ Parts: []node.Node{
+ &name.NamePart{Value: "bar"},
+ },
},
},
},
@@ -128,22 +133,24 @@ func TestClassImplement(t *testing.T) {
func TestClassImplements(t *testing.T) {
src := ` final class foo implements bar, baz { }`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Class{
ClassName: &node.Identifier{Value: "foo"},
Modifiers: []node.Node{
&node.Identifier{Value: "final"},
},
- Implements: []node.Node{
- &name.Name{
- Parts: []node.Node{
- &name.NamePart{Value: "bar"},
+ Implements: &stmt.ClassImplements{
+ InterfaceNames: []node.Node{
+ &name.Name{
+ Parts: []node.Node{
+ &name.NamePart{Value: "bar"},
+ },
},
- },
- &name.Name{
- Parts: []node.Node{
- &name.NamePart{Value: "baz"},
+ &name.Name{
+ Parts: []node.Node{
+ &name.NamePart{Value: "baz"},
+ },
},
},
},
@@ -166,26 +173,30 @@ func TestClassImplements(t *testing.T) {
func TestAnonimousClass(t *testing.T) {
src := ` new class() extends foo implements bar, baz { };`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Expression{
Expr: &expr.New{
Class: &stmt.Class{
- Args: []node.Node{},
- Extends: &name.Name{
- Parts: []node.Node{
- &name.NamePart{Value: "foo"},
- },
- },
- Implements: []node.Node{
- &name.Name{
+ ArgumentList: &node.ArgumentList{},
+ Extends: &stmt.ClassExtends{
+ ClassName: &name.Name{
Parts: []node.Node{
- &name.NamePart{Value: "bar"},
+ &name.NamePart{Value: "foo"},
},
},
- &name.Name{
- Parts: []node.Node{
- &name.NamePart{Value: "baz"},
+ },
+ Implements: &stmt.ClassImplements{
+ InterfaceNames: []node.Node{
+ &name.Name{
+ Parts: []node.Node{
+ &name.NamePart{Value: "bar"},
+ },
+ },
+ &name.Name{
+ Parts: []node.Node{
+ &name.NamePart{Value: "baz"},
+ },
},
},
},
diff --git a/node/stmt/t_const_list_test.go b/node/stmt/t_const_list_test.go
index 0de3f14..04d4c79 100644
--- a/node/stmt/t_const_list_test.go
+++ b/node/stmt/t_const_list_test.go
@@ -15,7 +15,7 @@ import (
func TestConstList(t *testing.T) {
src := ` const FOO = 1, BAR = 2;`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.ConstList{
Consts: []node.Node{
diff --git a/node/stmt/t_continue_test.go b/node/stmt/t_continue_test.go
index 66b8c5f..6f3950c 100644
--- a/node/stmt/t_continue_test.go
+++ b/node/stmt/t_continue_test.go
@@ -15,7 +15,7 @@ import (
func TestContinueEmpty(t *testing.T) {
src := ` while (1) { continue; }`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.While{
Cond: &scalar.Lnumber{Value: "1"},
@@ -42,7 +42,7 @@ func TestContinueEmpty(t *testing.T) {
func TestContinueLight(t *testing.T) {
src := ` while (1) { continue 2; }`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.While{
Cond: &scalar.Lnumber{Value: "1"},
@@ -71,7 +71,7 @@ func TestContinueLight(t *testing.T) {
func TestContinue(t *testing.T) {
src := ` while (1) { continue(3); }`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.While{
Cond: &scalar.Lnumber{Value: "1"},
diff --git a/node/stmt/t_declare_test.go b/node/stmt/t_declare_test.go
index fbbf002..051b9e0 100644
--- a/node/stmt/t_declare_test.go
+++ b/node/stmt/t_declare_test.go
@@ -15,7 +15,7 @@ import (
func TestDeclare(t *testing.T) {
src := ` declare(ticks=1);`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Declare{
Consts: []node.Node{
@@ -44,7 +44,7 @@ func TestDeclare(t *testing.T) {
func TestDeclareStmts(t *testing.T) {
src := ` declare(ticks=1, strict_types=1) {}`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Declare{
Consts: []node.Node{
@@ -80,7 +80,7 @@ func TestDeclareStmts(t *testing.T) {
func TestAltDeclare(t *testing.T) {
src := ` declare(ticks=1): enddeclare;`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Declare{
Consts: []node.Node{
diff --git a/node/stmt/t_do_test.go b/node/stmt/t_do_test.go
index d508c18..2020fa7 100644
--- a/node/stmt/t_do_test.go
+++ b/node/stmt/t_do_test.go
@@ -15,7 +15,7 @@ import (
func TestDo(t *testing.T) {
src := ` do {} while(1);`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Do{
Stmt: &stmt.StmtList{
diff --git a/node/stmt/t_echo_test.go b/node/stmt/t_echo_test.go
index f2e6ebc..bb92fb1 100644
--- a/node/stmt/t_echo_test.go
+++ b/node/stmt/t_echo_test.go
@@ -17,7 +17,7 @@ import (
func TestSimpleEcho(t *testing.T) {
src := ` echo $a, 1;`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Echo{
Exprs: []node.Node{
@@ -44,7 +44,7 @@ func TestSimpleEcho(t *testing.T) {
func TestEcho(t *testing.T) {
src := ` echo($a);`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Echo{
Exprs: []node.Node{
diff --git a/node/stmt/t_expression_test.go b/node/stmt/t_expression_test.go
index 7c485ef..de82b78 100644
--- a/node/stmt/t_expression_test.go
+++ b/node/stmt/t_expression_test.go
@@ -15,7 +15,7 @@ import (
func TestExpression(t *testing.T) {
src := ` 1;`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Expression{
Expr: &scalar.Lnumber{Value: "1"},
diff --git a/node/stmt/t_for_test.go b/node/stmt/t_for_test.go
index 83be83e..b149a01 100644
--- a/node/stmt/t_for_test.go
+++ b/node/stmt/t_for_test.go
@@ -20,7 +20,7 @@ import (
func TestFor(t *testing.T) {
src := ` for($i = 0; $i < 10; $i++, $i++) {}`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.For{
Init: []node.Node{
@@ -62,7 +62,7 @@ func TestFor(t *testing.T) {
func TestAltFor(t *testing.T) {
src := ` for(; $i < 10; $i++) : endfor;`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.AltFor{
Cond: []node.Node{
diff --git a/node/stmt/t_foreach_test.go b/node/stmt/t_foreach_test.go
index 8f7f7cc..80479dd 100644
--- a/node/stmt/t_foreach_test.go
+++ b/node/stmt/t_foreach_test.go
@@ -15,7 +15,7 @@ import (
func TestForeach(t *testing.T) {
src := ` foreach ($a as $v) {}`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Foreach{
Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
@@ -39,7 +39,7 @@ func TestForeach(t *testing.T) {
func TestForeachExpr(t *testing.T) {
src := ` foreach ([] as $v) {}`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Foreach{
Expr: &expr.ShortArray{Items: []node.Node{}},
@@ -63,7 +63,7 @@ func TestForeachExpr(t *testing.T) {
func TestAltForeach(t *testing.T) {
src := ` foreach ($a as $v) : endforeach;`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.AltForeach{
Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
@@ -87,7 +87,7 @@ func TestAltForeach(t *testing.T) {
func TestForeachWithKey(t *testing.T) {
src := ` foreach ($a as $k => $v) {}`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Foreach{
Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
@@ -112,7 +112,7 @@ func TestForeachWithKey(t *testing.T) {
func TestForeachExprWithKey(t *testing.T) {
src := ` foreach ([] as $k => $v) {}`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Foreach{
Expr: &expr.ShortArray{Items: []node.Node{}},
@@ -137,13 +137,12 @@ func TestForeachExprWithKey(t *testing.T) {
func TestForeachWithRef(t *testing.T) {
src := ` foreach ($a as $k => &$v) {}`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Foreach{
- ByRef: true,
Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
Key: &expr.Variable{VarName: &node.Identifier{Value: "k"}},
- Variable: &expr.Variable{VarName: &node.Identifier{Value: "v"}},
+ Variable: &expr.Reference{Variable: &expr.Variable{VarName: &node.Identifier{Value: "v"}}},
Stmt: &stmt.StmtList{Stmts: []node.Node{}},
},
},
@@ -163,17 +162,15 @@ func TestForeachWithRef(t *testing.T) {
func TestForeachWithList(t *testing.T) {
src := ` foreach ($a as $k => list($v)) {}`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Foreach{
- ByRef: false,
- Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
- Key: &expr.Variable{VarName: &node.Identifier{Value: "k"}},
+ Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
+ Key: &expr.Variable{VarName: &node.Identifier{Value: "k"}},
Variable: &expr.List{
Items: []node.Node{
&expr.ArrayItem{
- ByRef: false,
- Val: &expr.Variable{VarName: &node.Identifier{Value: "v"}},
+ Val: &expr.Variable{VarName: &node.Identifier{Value: "v"}},
},
},
},
diff --git a/node/stmt/t_function_test.go b/node/stmt/t_function_test.go
index 92cf463..fb32180 100644
--- a/node/stmt/t_function_test.go
+++ b/node/stmt/t_function_test.go
@@ -17,7 +17,7 @@ import (
func TestSimpleFunction(t *testing.T) {
src := ` function foo() {}`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Function{
ReturnsRef: false,
@@ -42,7 +42,7 @@ func TestSimpleFunction(t *testing.T) {
func TestFunctionReturn(t *testing.T) {
src := ` function foo() {return;}`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Function{
ReturnsRef: false,
@@ -69,7 +69,7 @@ func TestFunctionReturn(t *testing.T) {
func TestFunctionReturnVar(t *testing.T) {
src := ` function foo(array $a, callable $b) {return $a;}`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Function{
ReturnsRef: false,
@@ -112,7 +112,7 @@ func TestFunctionReturnVar(t *testing.T) {
func TestRefFunction(t *testing.T) {
src := ` function &foo() {return 1;}`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Function{
ReturnsRef: true,
@@ -141,7 +141,7 @@ func TestRefFunction(t *testing.T) {
func TestReturnTypeFunction(t *testing.T) {
src := ` function &foo(): void {}`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Function{
ReturnsRef: true,
diff --git a/node/stmt/t_global_test.go b/node/stmt/t_global_test.go
index 7d72898..a173395 100644
--- a/node/stmt/t_global_test.go
+++ b/node/stmt/t_global_test.go
@@ -15,7 +15,7 @@ import (
func TestGlobal(t *testing.T) {
src := ` global $a;`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Global{
Vars: []node.Node{
@@ -39,7 +39,7 @@ func TestGlobal(t *testing.T) {
func TestGlobalVars(t *testing.T) {
src := ` global $a, $b, $$c, ${foo()};`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Global{
Vars: []node.Node{
@@ -53,7 +53,7 @@ func TestGlobalVars(t *testing.T) {
&name.NamePart{Value: "foo"},
},
},
- Arguments: []node.Node{},
+ ArgumentList: &node.ArgumentList{},
},
},
},
diff --git a/node/stmt/t_goto_label_test.go b/node/stmt/t_goto_label_test.go
index 51977b1..fc8308f 100644
--- a/node/stmt/t_goto_label_test.go
+++ b/node/stmt/t_goto_label_test.go
@@ -13,7 +13,7 @@ import (
func TestGotoLabel(t *testing.T) {
src := ` a: goto a;`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Label{
LabelName: &node.Identifier{Value: "a"},
diff --git a/node/stmt/t_halt_compiler_test.go b/node/stmt/t_halt_compiler_test.go
index 420e4ba..74935e7 100644
--- a/node/stmt/t_halt_compiler_test.go
+++ b/node/stmt/t_halt_compiler_test.go
@@ -13,7 +13,7 @@ import (
func TestHaltCompiler(t *testing.T) {
src := ` __halt_compiler();`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.HaltCompiler{},
},
diff --git a/node/stmt/t_if_test.go b/node/stmt/t_if_test.go
index 8270077..66217ca 100644
--- a/node/stmt/t_if_test.go
+++ b/node/stmt/t_if_test.go
@@ -15,7 +15,7 @@ import (
func TestIf(t *testing.T) {
src := ` if ($a) {}`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.If{
Cond: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
@@ -39,7 +39,7 @@ func TestElseIf(t *testing.T) {
src := ` if ($a) {} elseif ($b) {}
`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.If{
Cond: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
@@ -68,7 +68,7 @@ func TestElseIf(t *testing.T) {
func TestElse(t *testing.T) {
src := ` if ($a) {} else {}`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.If{
Cond: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
@@ -94,7 +94,7 @@ func TestElse(t *testing.T) {
func TestElseElseIf(t *testing.T) {
src := ` if ($a) {} elseif ($b) {} elseif ($c) {} else {}`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.If{
Cond: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
@@ -130,7 +130,7 @@ func TestElseElseIf(t *testing.T) {
func TestElseIfElseIfElse(t *testing.T) {
src := ` if ($a) {} elseif ($b) {} else if ($c) {} else {}`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.If{
Cond: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
diff --git a/node/stmt/t_inline_html_test.go b/node/stmt/t_inline_html_test.go
index f7650ce..13be3e8 100644
--- a/node/stmt/t_inline_html_test.go
+++ b/node/stmt/t_inline_html_test.go
@@ -13,7 +13,7 @@ import (
func TestInlineHtml(t *testing.T) {
src := ` ?>
`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Nop{},
&stmt.InlineHtml{Value: ""},
diff --git a/node/stmt/t_interface_test.go b/node/stmt/t_interface_test.go
index 78f1e8e..85a64d8 100644
--- a/node/stmt/t_interface_test.go
+++ b/node/stmt/t_interface_test.go
@@ -14,7 +14,7 @@ import (
func TestInterface(t *testing.T) {
src := ` interface Foo {}`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Interface{
PhpDocComment: "",
@@ -38,15 +38,17 @@ func TestInterface(t *testing.T) {
func TestInterfaceExtend(t *testing.T) {
src := ` interface Foo extends Bar {}`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Interface{
PhpDocComment: "",
InterfaceName: &node.Identifier{Value: "Foo"},
- Extends: []node.Node{
- &name.Name{
- Parts: []node.Node{
- &name.NamePart{Value: "Bar"},
+ Extends: &stmt.InterfaceExtends{
+ InterfaceNames: []node.Node{
+ &name.Name{
+ Parts: []node.Node{
+ &name.NamePart{Value: "Bar"},
+ },
},
},
},
@@ -69,20 +71,22 @@ func TestInterfaceExtend(t *testing.T) {
func TestInterfaceExtends(t *testing.T) {
src := ` interface Foo extends Bar, Baz {}`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Interface{
PhpDocComment: "",
InterfaceName: &node.Identifier{Value: "Foo"},
- Extends: []node.Node{
- &name.Name{
- Parts: []node.Node{
- &name.NamePart{Value: "Bar"},
+ Extends: &stmt.InterfaceExtends{
+ InterfaceNames: []node.Node{
+ &name.Name{
+ Parts: []node.Node{
+ &name.NamePart{Value: "Bar"},
+ },
},
- },
- &name.Name{
- Parts: []node.Node{
- &name.NamePart{Value: "Baz"},
+ &name.Name{
+ Parts: []node.Node{
+ &name.NamePart{Value: "Baz"},
+ },
},
},
},
diff --git a/node/stmt/t_namespace_test.go b/node/stmt/t_namespace_test.go
index 2c4cf33..985593d 100644
--- a/node/stmt/t_namespace_test.go
+++ b/node/stmt/t_namespace_test.go
@@ -14,7 +14,7 @@ import (
func TestNamespace(t *testing.T) {
src := ` namespace Foo;`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Namespace{
NamespaceName: &name.Name{
@@ -40,7 +40,7 @@ func TestNamespace(t *testing.T) {
func TestNamespaceStmts(t *testing.T) {
src := ` namespace Foo {}`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Namespace{
NamespaceName: &name.Name{
@@ -67,7 +67,7 @@ func TestNamespaceStmts(t *testing.T) {
func TestAnonymousNamespace(t *testing.T) {
src := ` namespace {}`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Namespace{
Stmts: []node.Node{},
diff --git a/node/stmt/t_property_list_test.go b/node/stmt/t_property_list_test.go
index 5d25f61..39acc29 100644
--- a/node/stmt/t_property_list_test.go
+++ b/node/stmt/t_property_list_test.go
@@ -15,7 +15,7 @@ import (
func TestProperty(t *testing.T) {
src := ` class foo {var $a;}`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Class{
ClassName: &node.Identifier{Value: "foo"},
@@ -50,7 +50,7 @@ func TestProperty(t *testing.T) {
func TestProperties(t *testing.T) {
src := ` class foo {public static $a, $b = 1;}`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Class{
ClassName: &node.Identifier{Value: "foo"},
@@ -91,7 +91,7 @@ func TestProperties(t *testing.T) {
func TestProperties2(t *testing.T) {
src := ` class foo {public static $a = 1, $b;}`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Class{
ClassName: &node.Identifier{Value: "foo"},
diff --git a/node/stmt/t_static_var_test.go b/node/stmt/t_static_var_test.go
index 668b6cd..41a7ba2 100644
--- a/node/stmt/t_static_var_test.go
+++ b/node/stmt/t_static_var_test.go
@@ -15,7 +15,7 @@ import (
func TestStaticVar(t *testing.T) {
src := ` static $a;`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Static{
Vars: []node.Node{
@@ -41,7 +41,7 @@ func TestStaticVar(t *testing.T) {
func TestStaticVars(t *testing.T) {
src := ` static $a, $b = 1;`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Static{
Vars: []node.Node{
@@ -71,7 +71,7 @@ func TestStaticVars(t *testing.T) {
func TestStaticVars2(t *testing.T) {
src := ` static $a = 1, $b;`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Static{
Vars: []node.Node{
diff --git a/node/stmt/t_switch_case_default_test.go b/node/stmt/t_switch_case_default_test.go
index d227694..f78a650 100644
--- a/node/stmt/t_switch_case_default_test.go
+++ b/node/stmt/t_switch_case_default_test.go
@@ -21,21 +21,23 @@ func TestAltSwitch(t *testing.T) {
endswitch;
`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.AltSwitch{
Cond: &scalar.Lnumber{Value: "1"},
- Cases: []node.Node{
- &stmt.Case{
- Cond: &scalar.Lnumber{Value: "1"},
- Stmts: []node.Node{},
- },
- &stmt.Default{
- Stmts: []node.Node{},
- },
- &stmt.Case{
- Cond: &scalar.Lnumber{Value: "2"},
- Stmts: []node.Node{},
+ CaseList: &stmt.CaseList{
+ Cases: []node.Node{
+ &stmt.Case{
+ Cond: &scalar.Lnumber{Value: "1"},
+ Stmts: []node.Node{},
+ },
+ &stmt.Default{
+ Stmts: []node.Node{},
+ },
+ &stmt.Case{
+ Cond: &scalar.Lnumber{Value: "2"},
+ Stmts: []node.Node{},
+ },
},
},
},
@@ -61,18 +63,20 @@ func TestAltSwitchSemicolon(t *testing.T) {
endswitch;
`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.AltSwitch{
Cond: &scalar.Lnumber{Value: "1"},
- Cases: []node.Node{
- &stmt.Case{
- Cond: &scalar.Lnumber{Value: "1"},
- Stmts: []node.Node{},
- },
- &stmt.Case{
- Cond: &scalar.Lnumber{Value: "2"},
- Stmts: []node.Node{},
+ CaseList: &stmt.CaseList{
+ Cases: []node.Node{
+ &stmt.Case{
+ Cond: &scalar.Lnumber{Value: "1"},
+ Stmts: []node.Node{},
+ },
+ &stmt.Case{
+ Cond: &scalar.Lnumber{Value: "2"},
+ Stmts: []node.Node{},
+ },
},
},
},
@@ -98,21 +102,23 @@ func TestSwitch(t *testing.T) {
}
`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Switch{
Cond: &scalar.Lnumber{Value: "1"},
- Cases: []node.Node{
- &stmt.Case{
- Cond: &scalar.Lnumber{Value: "1"},
- Stmts: []node.Node{
- &stmt.Break{},
+ CaseList: &stmt.CaseList{
+ Cases: []node.Node{
+ &stmt.Case{
+ Cond: &scalar.Lnumber{Value: "1"},
+ Stmts: []node.Node{
+ &stmt.Break{},
+ },
},
- },
- &stmt.Case{
- Cond: &scalar.Lnumber{Value: "2"},
- Stmts: []node.Node{
- &stmt.Break{},
+ &stmt.Case{
+ Cond: &scalar.Lnumber{Value: "2"},
+ Stmts: []node.Node{
+ &stmt.Break{},
+ },
},
},
},
@@ -139,21 +145,23 @@ func TestSwitchSemicolon(t *testing.T) {
}
`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Switch{
Cond: &scalar.Lnumber{Value: "1"},
- Cases: []node.Node{
- &stmt.Case{
- Cond: &scalar.Lnumber{Value: "1"},
- Stmts: []node.Node{
- &stmt.Break{},
+ CaseList: &stmt.CaseList{
+ Cases: []node.Node{
+ &stmt.Case{
+ Cond: &scalar.Lnumber{Value: "1"},
+ Stmts: []node.Node{
+ &stmt.Break{},
+ },
},
- },
- &stmt.Case{
- Cond: &scalar.Lnumber{Value: "2"},
- Stmts: []node.Node{
- &stmt.Break{},
+ &stmt.Case{
+ Cond: &scalar.Lnumber{Value: "2"},
+ Stmts: []node.Node{
+ &stmt.Break{},
+ },
},
},
},
diff --git a/node/stmt/t_throw_test.go b/node/stmt/t_throw_test.go
index cfc7be8..ecc48fd 100644
--- a/node/stmt/t_throw_test.go
+++ b/node/stmt/t_throw_test.go
@@ -14,7 +14,7 @@ import (
func TestThrow(t *testing.T) {
src := ` throw $e;`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Throw{
Expr: &expr.Variable{VarName: &node.Identifier{Value: "e"}},
diff --git a/node/stmt/t_trait_test.go b/node/stmt/t_trait_test.go
index b774dac..5fb6571 100644
--- a/node/stmt/t_trait_test.go
+++ b/node/stmt/t_trait_test.go
@@ -13,7 +13,7 @@ import (
func TestTrait(t *testing.T) {
src := ` trait Foo {}`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Trait{
PhpDocComment: "",
diff --git a/node/stmt/t_trait_use_test.go b/node/stmt/t_trait_use_test.go
index e6b3b10..65e947e 100644
--- a/node/stmt/t_trait_use_test.go
+++ b/node/stmt/t_trait_use_test.go
@@ -2,9 +2,10 @@ package stmt_test
import (
"bytes"
- "github.com/z7zmey/php-parser/node/name"
"testing"
+ "github.com/z7zmey/php-parser/node/name"
+
"github.com/z7zmey/php-parser/node"
"github.com/z7zmey/php-parser/node/stmt"
"github.com/z7zmey/php-parser/php5"
@@ -14,7 +15,7 @@ import (
func TestTraitUse(t *testing.T) {
src := ` class Foo { use Bar; }`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Class{
PhpDocComment: "",
@@ -48,7 +49,7 @@ func TestTraitUse(t *testing.T) {
func TestTraitsUse(t *testing.T) {
src := ` class Foo { use Bar, Baz; }`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Class{
PhpDocComment: "",
@@ -87,7 +88,7 @@ func TestTraitsUse(t *testing.T) {
func TestTraitsUseEmptyAdaptations(t *testing.T) {
src := ` class Foo { use Bar, Baz {} }`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Class{
PhpDocComment: "",
@@ -106,6 +107,7 @@ func TestTraitsUseEmptyAdaptations(t *testing.T) {
},
},
},
+ TraitAdaptationList: &stmt.TraitAdaptationList{},
},
},
},
@@ -126,7 +128,7 @@ func TestTraitsUseEmptyAdaptations(t *testing.T) {
func TestTraitsUseModifier(t *testing.T) {
src := ` class Foo { use Bar, Baz { one as public; } }`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Class{
PhpDocComment: "",
@@ -145,12 +147,14 @@ func TestTraitsUseModifier(t *testing.T) {
},
},
},
- Adaptations: []node.Node{
- &stmt.TraitUseAlias{
- Ref: &stmt.TraitMethodRef{
- Method: &node.Identifier{Value: "one"},
+ TraitAdaptationList: &stmt.TraitAdaptationList{
+ Adaptations: []node.Node{
+ &stmt.TraitUseAlias{
+ Ref: &stmt.TraitMethodRef{
+ Method: &node.Identifier{Value: "one"},
+ },
+ Modifier: &node.Identifier{Value: "public"},
},
- Modifier: &node.Identifier{Value: "public"},
},
},
},
@@ -173,7 +177,7 @@ func TestTraitsUseModifier(t *testing.T) {
func TestTraitsUseAliasModifier(t *testing.T) {
src := ` class Foo { use Bar, Baz { one as public two; } }`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Class{
PhpDocComment: "",
@@ -192,13 +196,15 @@ func TestTraitsUseAliasModifier(t *testing.T) {
},
},
},
- Adaptations: []node.Node{
- &stmt.TraitUseAlias{
- Ref: &stmt.TraitMethodRef{
- Method: &node.Identifier{Value: "one"},
+ TraitAdaptationList: &stmt.TraitAdaptationList{
+ Adaptations: []node.Node{
+ &stmt.TraitUseAlias{
+ Ref: &stmt.TraitMethodRef{
+ Method: &node.Identifier{Value: "one"},
+ },
+ Modifier: &node.Identifier{Value: "public"},
+ Alias: &node.Identifier{Value: "two"},
},
- Modifier: &node.Identifier{Value: "public"},
- Alias: &node.Identifier{Value: "two"},
},
},
},
@@ -221,7 +227,7 @@ func TestTraitsUseAliasModifier(t *testing.T) {
func TestTraitsUseAdaptions(t *testing.T) {
src := ` class Foo { use Bar, Baz { Bar::one insteadof Baz, Quux; Baz::one as two; } }`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Class{
PhpDocComment: "",
@@ -240,39 +246,41 @@ func TestTraitsUseAdaptions(t *testing.T) {
},
},
},
- Adaptations: []node.Node{
- &stmt.TraitUsePrecedence{
- Ref: &stmt.TraitMethodRef{
- Trait: &name.Name{
- Parts: []node.Node{
- &name.NamePart{Value: "Bar"},
+ TraitAdaptationList: &stmt.TraitAdaptationList{
+ Adaptations: []node.Node{
+ &stmt.TraitUsePrecedence{
+ Ref: &stmt.TraitMethodRef{
+ Trait: &name.Name{
+ Parts: []node.Node{
+ &name.NamePart{Value: "Bar"},
+ },
},
+ Method: &node.Identifier{Value: "one"},
},
- Method: &node.Identifier{Value: "one"},
- },
- Insteadof: []node.Node{
- &name.Name{
- Parts: []node.Node{
- &name.NamePart{Value: "Baz"},
+ Insteadof: []node.Node{
+ &name.Name{
+ Parts: []node.Node{
+ &name.NamePart{Value: "Baz"},
+ },
},
- },
- &name.Name{
- Parts: []node.Node{
- &name.NamePart{Value: "Quux"},
+ &name.Name{
+ Parts: []node.Node{
+ &name.NamePart{Value: "Quux"},
+ },
},
},
},
- },
- &stmt.TraitUseAlias{
- Ref: &stmt.TraitMethodRef{
- Trait: &name.Name{
- Parts: []node.Node{
- &name.NamePart{Value: "Baz"},
+ &stmt.TraitUseAlias{
+ Ref: &stmt.TraitMethodRef{
+ Trait: &name.Name{
+ Parts: []node.Node{
+ &name.NamePart{Value: "Baz"},
+ },
},
+ Method: &node.Identifier{Value: "one"},
},
- Method: &node.Identifier{Value: "one"},
+ Alias: &node.Identifier{Value: "two"},
},
- Alias: &node.Identifier{Value: "two"},
},
},
},
diff --git a/node/stmt/t_try_catch_finnaly_test.go b/node/stmt/t_try_catch_finnaly_test.go
index 4fbcda4..2c19cfa 100644
--- a/node/stmt/t_try_catch_finnaly_test.go
+++ b/node/stmt/t_try_catch_finnaly_test.go
@@ -17,7 +17,7 @@ func TestTry(t *testing.T) {
try {}
`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Try{
Stmts: []node.Node{},
@@ -42,7 +42,7 @@ func TestTryCatch(t *testing.T) {
try {} catch (Exception $e) {}
`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Try{
Stmts: []node.Node{},
@@ -81,7 +81,7 @@ func TestPhp7TryCatch(t *testing.T) {
try {} catch (Exception|RuntimeException $e) {}
`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Try{
Stmts: []node.Node{},
@@ -120,7 +120,7 @@ func TestTryCatchCatch(t *testing.T) {
try {} catch (Exception $e) {} catch (RuntimeException $e) {}
`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Try{
Stmts: []node.Node{},
@@ -172,7 +172,7 @@ func TestTryCatchFinally(t *testing.T) {
try {} catch (Exception $e) {} finally {}
`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Try{
Stmts: []node.Node{},
@@ -212,7 +212,7 @@ func TestTryCatchFinally(t *testing.T) {
func TestTryCatchCatchCatch(t *testing.T) {
src := ` try {} catch (Exception $e) {} catch (\RuntimeException $e) {} catch (namespace\AdditionException $e) {}`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Try{
Stmts: []node.Node{},
diff --git a/node/stmt/t_unset_test.go b/node/stmt/t_unset_test.go
index 8b6f32a..01d1b15 100644
--- a/node/stmt/t_unset_test.go
+++ b/node/stmt/t_unset_test.go
@@ -14,7 +14,7 @@ import (
func TestUnset(t *testing.T) {
src := ` unset($a);`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Unset{
Vars: []node.Node{
@@ -38,7 +38,7 @@ func TestUnset(t *testing.T) {
func TestUnsetVars(t *testing.T) {
src := ` unset($a, $b);`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Unset{
Vars: []node.Node{
@@ -63,7 +63,7 @@ func TestUnsetVars(t *testing.T) {
func TestUnsetTrailingComma(t *testing.T) {
src := ` unset($a, $b,);`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Unset{
Vars: []node.Node{
diff --git a/node/stmt/t_use_test.go b/node/stmt/t_use_test.go
index 86d4a45..5236b36 100644
--- a/node/stmt/t_use_test.go
+++ b/node/stmt/t_use_test.go
@@ -14,7 +14,7 @@ import (
func TestSimpleUse(t *testing.T) {
src := ` use Foo;`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.UseList{
Uses: []node.Node{
@@ -44,7 +44,7 @@ func TestSimpleUse(t *testing.T) {
func TestUseFullyQualified(t *testing.T) {
src := ` use \Foo;`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.UseList{
Uses: []node.Node{
@@ -74,7 +74,7 @@ func TestUseFullyQualified(t *testing.T) {
func TestUseFullyQualifiedAlias(t *testing.T) {
src := ` use \Foo as Bar;`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.UseList{
Uses: []node.Node{
@@ -105,7 +105,7 @@ func TestUseFullyQualifiedAlias(t *testing.T) {
func TestUseList(t *testing.T) {
src := ` use Foo, Bar;`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.UseList{
Uses: []node.Node{
@@ -142,7 +142,7 @@ func TestUseList(t *testing.T) {
func TestUseListAlias(t *testing.T) {
src := ` use Foo, Bar as Baz;`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.UseList{
Uses: []node.Node{
@@ -180,7 +180,7 @@ func TestUseListAlias(t *testing.T) {
func TestUseListFunctionType(t *testing.T) {
src := ` use function Foo, \Bar;`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.UseList{
UseType: &node.Identifier{Value: "function"},
@@ -218,7 +218,7 @@ func TestUseListFunctionType(t *testing.T) {
func TestUseListFunctionTypeAliases(t *testing.T) {
src := ` use function Foo as foo, \Bar as bar;`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.UseList{
UseType: &node.Identifier{Value: "function"},
@@ -258,7 +258,7 @@ func TestUseListFunctionTypeAliases(t *testing.T) {
func TestUseListConstType(t *testing.T) {
src := ` use const Foo, \Bar;`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.UseList{
UseType: &node.Identifier{Value: "const"},
@@ -296,7 +296,7 @@ func TestUseListConstType(t *testing.T) {
func TestUseListConstTypeAliases(t *testing.T) {
src := ` use const Foo as foo, \Bar as bar;`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.UseList{
UseType: &node.Identifier{Value: "const"},
@@ -336,7 +336,7 @@ func TestUseListConstTypeAliases(t *testing.T) {
func TestGroupUse(t *testing.T) {
src := ` use Foo\{Bar, Baz};`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.GroupUse{
Prefix: &name.Name{
@@ -373,7 +373,7 @@ func TestGroupUse(t *testing.T) {
func TestGroupUseAlias(t *testing.T) {
src := ` use Foo\{Bar, Baz as quux};`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.GroupUse{
Prefix: &name.Name{
@@ -411,7 +411,7 @@ func TestGroupUseAlias(t *testing.T) {
func TestFunctionGroupUse(t *testing.T) {
src := ` use function Foo\{Bar, Baz};`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.GroupUse{
UseType: &node.Identifier{Value: "function"},
@@ -449,7 +449,7 @@ func TestFunctionGroupUse(t *testing.T) {
func TestConstGroupUse(t *testing.T) {
src := ` use const Foo\{Bar, Baz};`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.GroupUse{
UseType: &node.Identifier{Value: "const"},
@@ -487,7 +487,7 @@ func TestConstGroupUse(t *testing.T) {
func TestMixedGroupUse(t *testing.T) {
src := ` use Foo\{const Bar, function Baz};`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.GroupUse{
Prefix: &name.Name{
diff --git a/node/stmt/t_visitor_test.go b/node/stmt/t_visitor_test.go
index 85b185a..7527dab 100644
--- a/node/stmt/t_visitor_test.go
+++ b/node/stmt/t_visitor_test.go
@@ -4,6 +4,8 @@ import (
"reflect"
"testing"
+ "github.com/z7zmey/php-parser/node/name"
+
"github.com/z7zmey/php-parser/node/expr"
"github.com/z7zmey/php-parser/node/stmt"
@@ -82,9 +84,9 @@ var nodesToTest = []struct {
Modifiers: []node.Node{&stmt.Expression{}},
Params: []node.Node{&stmt.Expression{}},
ReturnType: &node.Identifier{},
- Stmts: []node.Node{&stmt.Expression{}},
+ Stmt: &stmt.StmtList{},
},
- []string{"MethodName", "Modifiers", "Params", "ReturnType", "Stmts"},
+ []string{"MethodName", "Modifiers", "Params", "ReturnType", "Stmt"},
map[string]interface{}{"ReturnsRef": true, "PhpDocComment": "/** */"},
},
{
@@ -92,12 +94,12 @@ var nodesToTest = []struct {
PhpDocComment: "/** */",
ClassName: &node.Identifier{},
Modifiers: []node.Node{&stmt.Expression{}},
- Args: []node.Node{&stmt.Expression{}},
- Extends: &node.Identifier{},
- Implements: []node.Node{&stmt.Expression{}},
+ ArgumentList: &node.ArgumentList{},
+ Extends: &stmt.ClassExtends{},
+ Implements: &stmt.ClassImplements{},
Stmts: []node.Node{&stmt.Expression{}},
},
- []string{"ClassName", "Modifiers", "Args", "Extends", "Implements", "Stmts"},
+ []string{"ClassName", "Modifiers", "ArgumentList", "Extends", "Implements", "Stmts"},
map[string]interface{}{"PhpDocComment": "/** */"},
},
{
@@ -222,25 +224,23 @@ var nodesToTest = []struct {
},
{
&stmt.Foreach{
- ByRef: true,
Expr: &stmt.Expression{},
Key: &expr.Variable{},
Variable: &expr.Variable{},
Stmt: &stmt.StmtList{},
},
[]string{"Expr", "Key", "Variable", "Stmt"},
- map[string]interface{}{"ByRef": true},
+ map[string]interface{}{},
},
{
&stmt.AltForeach{
- ByRef: true,
Expr: &stmt.Expression{},
Key: &expr.Variable{},
Variable: &expr.Variable{},
Stmt: &stmt.StmtList{},
},
[]string{"Expr", "Key", "Variable", "Stmt"},
- map[string]interface{}{"ByRef": true},
+ map[string]interface{}{},
},
{
&stmt.Function{
@@ -293,7 +293,7 @@ var nodesToTest = []struct {
&stmt.Interface{
PhpDocComment: "/** */",
InterfaceName: &node.Identifier{},
- Extends: []node.Node{&stmt.Expression{}},
+ Extends: &stmt.InterfaceExtends{},
Stmts: []node.Node{&stmt.Expression{}},
},
[]string{"InterfaceName", "Extends", "Stmts"},
@@ -360,18 +360,18 @@ var nodesToTest = []struct {
},
{
&stmt.Switch{
- Cond: &expr.Variable{},
- Cases: []node.Node{&stmt.Expression{}},
+ Cond: &expr.Variable{},
+ CaseList: &stmt.CaseList{},
},
- []string{"Cond", "Cases"},
+ []string{"Cond", "CaseList"},
map[string]interface{}{},
},
{
&stmt.AltSwitch{
- Cond: &expr.Variable{},
- Cases: []node.Node{&stmt.Expression{}},
+ Cond: &expr.Variable{},
+ CaseList: &stmt.CaseList{Cases: []node.Node{}},
},
- []string{"Cond", "Cases"},
+ []string{"Cond", "CaseList"},
map[string]interface{}{},
},
{
@@ -408,10 +408,10 @@ var nodesToTest = []struct {
},
{
&stmt.TraitUse{
- Traits: []node.Node{&stmt.Expression{}},
- Adaptations: []node.Node{&stmt.Expression{}},
+ Traits: []node.Node{&stmt.Expression{}},
+ TraitAdaptationList: &stmt.TraitAdaptationList{},
},
- []string{"Traits", "Adaptations"},
+ []string{"Traits", "TraitAdaptationList"},
map[string]interface{}{},
},
{
@@ -479,6 +479,45 @@ var nodesToTest = []struct {
[]string{"Stmts"},
map[string]interface{}{},
},
+ {
+ &stmt.CaseList{
+ Cases: []node.Node{&stmt.Expression{}},
+ },
+ []string{"Cases"},
+ map[string]interface{}{},
+ },
+ {
+ &stmt.TraitAdaptationList{
+ Adaptations: []node.Node{&stmt.TraitUsePrecedence{}},
+ },
+ []string{"Adaptations"},
+ map[string]interface{}{},
+ },
+ {
+ &stmt.ClassExtends{
+ ClassName: &name.Name{},
+ },
+ []string{"ClassName"},
+ map[string]interface{}{},
+ },
+ {
+ &stmt.ClassImplements{
+ InterfaceNames: []node.Node{
+ &name.Name{},
+ },
+ },
+ []string{"InterfaceNames"},
+ map[string]interface{}{},
+ },
+ {
+ &stmt.InterfaceExtends{
+ InterfaceNames: []node.Node{
+ &name.Name{},
+ },
+ },
+ []string{"InterfaceNames"},
+ map[string]interface{}{},
+ },
}
type visitorMock struct {
diff --git a/node/stmt/t_while_break_test.go b/node/stmt/t_while_break_test.go
index 61fe5f2..8edd27f 100644
--- a/node/stmt/t_while_break_test.go
+++ b/node/stmt/t_while_break_test.go
@@ -15,7 +15,7 @@ import (
func TestBreakEmpty(t *testing.T) {
src := ` while (1) { break; }`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.While{
Cond: &scalar.Lnumber{Value: "1"},
@@ -42,7 +42,7 @@ func TestBreakEmpty(t *testing.T) {
func TestBreakLight(t *testing.T) {
src := ` while (1) { break 2; }`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.While{
Cond: &scalar.Lnumber{Value: "1"},
@@ -71,7 +71,7 @@ func TestBreakLight(t *testing.T) {
func TestBreak(t *testing.T) {
src := ` while (1) : break(3); endwhile;`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.AltWhile{
Cond: &scalar.Lnumber{Value: "1"},
diff --git a/node/t_node_test.go b/node/t_node_test.go
index b7dc2c0..f7c351c 100644
--- a/node/t_node_test.go
+++ b/node/t_node_test.go
@@ -32,7 +32,7 @@ func assertEqual(t *testing.T, expected interface{}, actual interface{}) {
func TestIdentifier(t *testing.T) {
src := ` $foo;`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Expression{
Expr: &expr.Variable{
@@ -65,23 +65,27 @@ func TestPhp7ArgumentNode(t *testing.T) {
new class ($a, ...$b) {};
`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Expression{
Expr: &expr.FunctionCall{
Function: &name.Name{Parts: []node.Node{&name.NamePart{Value: "foo"}}},
- Arguments: []node.Node{
- &node.Argument{Variadic: false, Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}}},
- &node.Argument{Variadic: true, Expr: &expr.Variable{VarName: &node.Identifier{Value: "b"}}},
+ ArgumentList: &node.ArgumentList{
+ Arguments: []node.Node{
+ &node.Argument{Variadic: false, Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}}},
+ &node.Argument{Variadic: true, Expr: &expr.Variable{VarName: &node.Identifier{Value: "b"}}},
+ },
},
},
},
&stmt.Expression{
Expr: &expr.FunctionCall{
Function: &expr.Variable{VarName: &node.Identifier{Value: "foo"}},
- Arguments: []node.Node{
- &node.Argument{Variadic: false, Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}}},
- &node.Argument{Variadic: true, Expr: &expr.Variable{VarName: &node.Identifier{Value: "b"}}},
+ ArgumentList: &node.ArgumentList{
+ Arguments: []node.Node{
+ &node.Argument{Variadic: false, Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}}},
+ &node.Argument{Variadic: true, Expr: &expr.Variable{VarName: &node.Identifier{Value: "b"}}},
+ },
},
},
},
@@ -89,9 +93,11 @@ func TestPhp7ArgumentNode(t *testing.T) {
Expr: &expr.MethodCall{
Variable: &expr.Variable{VarName: &node.Identifier{Value: "foo"}},
Method: &node.Identifier{Value: "bar"},
- Arguments: []node.Node{
- &node.Argument{Variadic: false, Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}}},
- &node.Argument{Variadic: true, Expr: &expr.Variable{VarName: &node.Identifier{Value: "b"}}},
+ ArgumentList: &node.ArgumentList{
+ Arguments: []node.Node{
+ &node.Argument{Variadic: false, Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}}},
+ &node.Argument{Variadic: true, Expr: &expr.Variable{VarName: &node.Identifier{Value: "b"}}},
+ },
},
},
},
@@ -99,9 +105,11 @@ func TestPhp7ArgumentNode(t *testing.T) {
Expr: &expr.StaticCall{
Class: &name.Name{Parts: []node.Node{&name.NamePart{Value: "foo"}}},
Call: &node.Identifier{Value: "bar"},
- Arguments: []node.Node{
- &node.Argument{Variadic: false, Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}}},
- &node.Argument{Variadic: true, Expr: &expr.Variable{VarName: &node.Identifier{Value: "b"}}},
+ ArgumentList: &node.ArgumentList{
+ Arguments: []node.Node{
+ &node.Argument{Variadic: false, Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}}},
+ &node.Argument{Variadic: true, Expr: &expr.Variable{VarName: &node.Identifier{Value: "b"}}},
+ },
},
},
},
@@ -109,18 +117,22 @@ func TestPhp7ArgumentNode(t *testing.T) {
Expr: &expr.StaticCall{
Class: &expr.Variable{VarName: &node.Identifier{Value: "foo"}},
Call: &node.Identifier{Value: "bar"},
- Arguments: []node.Node{
- &node.Argument{Variadic: false, Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}}},
- &node.Argument{Variadic: true, Expr: &expr.Variable{VarName: &node.Identifier{Value: "b"}}},
+ ArgumentList: &node.ArgumentList{
+ Arguments: []node.Node{
+ &node.Argument{Variadic: false, Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}}},
+ &node.Argument{Variadic: true, Expr: &expr.Variable{VarName: &node.Identifier{Value: "b"}}},
+ },
},
},
},
&stmt.Expression{
Expr: &expr.New{
Class: &name.Name{Parts: []node.Node{&name.NamePart{Value: "foo"}}},
- Arguments: []node.Node{
- &node.Argument{Variadic: false, Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}}},
- &node.Argument{Variadic: true, Expr: &expr.Variable{VarName: &node.Identifier{Value: "b"}}},
+ ArgumentList: &node.ArgumentList{
+ Arguments: []node.Node{
+ &node.Argument{Variadic: false, Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}}},
+ &node.Argument{Variadic: true, Expr: &expr.Variable{VarName: &node.Identifier{Value: "b"}}},
+ },
},
},
},
@@ -128,9 +140,11 @@ func TestPhp7ArgumentNode(t *testing.T) {
Expr: &expr.New{
Class: &stmt.Class{
PhpDocComment: "/** anonymous class */",
- Args: []node.Node{
- &node.Argument{Variadic: false, Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}}},
- &node.Argument{Variadic: true, Expr: &expr.Variable{VarName: &node.Identifier{Value: "b"}}},
+ ArgumentList: &node.ArgumentList{
+ Arguments: []node.Node{
+ &node.Argument{Variadic: false, Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}}},
+ &node.Argument{Variadic: true, Expr: &expr.Variable{VarName: &node.Identifier{Value: "b"}}},
+ },
},
Stmts: []node.Node{},
},
@@ -155,23 +169,27 @@ func TestPhp5ArgumentNode(t *testing.T) {
new foo($a, ...$b);
`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Expression{
Expr: &expr.FunctionCall{
Function: &name.Name{Parts: []node.Node{&name.NamePart{Value: "foo"}}},
- Arguments: []node.Node{
- &node.Argument{Variadic: false, Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}}},
- &node.Argument{Variadic: true, Expr: &expr.Variable{VarName: &node.Identifier{Value: "b"}}},
+ ArgumentList: &node.ArgumentList{
+ Arguments: []node.Node{
+ &node.Argument{Variadic: false, Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}}},
+ &node.Argument{Variadic: true, Expr: &expr.Variable{VarName: &node.Identifier{Value: "b"}}},
+ },
},
},
},
&stmt.Expression{
Expr: &expr.FunctionCall{
Function: &expr.Variable{VarName: &node.Identifier{Value: "foo"}},
- Arguments: []node.Node{
- &node.Argument{Variadic: false, Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}}},
- &node.Argument{Variadic: true, Expr: &expr.Variable{VarName: &node.Identifier{Value: "b"}}},
+ ArgumentList: &node.ArgumentList{
+ Arguments: []node.Node{
+ &node.Argument{Variadic: false, Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}}},
+ &node.Argument{Variadic: true, Expr: &expr.Variable{VarName: &node.Identifier{Value: "b"}}},
+ },
},
},
},
@@ -179,9 +197,11 @@ func TestPhp5ArgumentNode(t *testing.T) {
Expr: &expr.MethodCall{
Variable: &expr.Variable{VarName: &node.Identifier{Value: "foo"}},
Method: &node.Identifier{Value: "bar"},
- Arguments: []node.Node{
- &node.Argument{Variadic: false, Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}}},
- &node.Argument{Variadic: true, Expr: &expr.Variable{VarName: &node.Identifier{Value: "b"}}},
+ ArgumentList: &node.ArgumentList{
+ Arguments: []node.Node{
+ &node.Argument{Variadic: false, Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}}},
+ &node.Argument{Variadic: true, Expr: &expr.Variable{VarName: &node.Identifier{Value: "b"}}},
+ },
},
},
},
@@ -189,9 +209,11 @@ func TestPhp5ArgumentNode(t *testing.T) {
Expr: &expr.StaticCall{
Class: &name.Name{Parts: []node.Node{&name.NamePart{Value: "foo"}}},
Call: &node.Identifier{Value: "bar"},
- Arguments: []node.Node{
- &node.Argument{Variadic: false, Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}}},
- &node.Argument{Variadic: true, Expr: &expr.Variable{VarName: &node.Identifier{Value: "b"}}},
+ ArgumentList: &node.ArgumentList{
+ Arguments: []node.Node{
+ &node.Argument{Variadic: false, Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}}},
+ &node.Argument{Variadic: true, Expr: &expr.Variable{VarName: &node.Identifier{Value: "b"}}},
+ },
},
},
},
@@ -199,18 +221,22 @@ func TestPhp5ArgumentNode(t *testing.T) {
Expr: &expr.StaticCall{
Class: &expr.Variable{VarName: &node.Identifier{Value: "foo"}},
Call: &node.Identifier{Value: "bar"},
- Arguments: []node.Node{
- &node.Argument{Variadic: false, Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}}},
- &node.Argument{Variadic: true, Expr: &expr.Variable{VarName: &node.Identifier{Value: "b"}}},
+ ArgumentList: &node.ArgumentList{
+ Arguments: []node.Node{
+ &node.Argument{Variadic: false, Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}}},
+ &node.Argument{Variadic: true, Expr: &expr.Variable{VarName: &node.Identifier{Value: "b"}}},
+ },
},
},
},
&stmt.Expression{
Expr: &expr.New{
Class: &name.Name{Parts: []node.Node{&name.NamePart{Value: "foo"}}},
- Arguments: []node.Node{
- &node.Argument{Variadic: false, Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}}},
- &node.Argument{Variadic: true, Expr: &expr.Variable{VarName: &node.Identifier{Value: "b"}}},
+ ArgumentList: &node.ArgumentList{
+ Arguments: []node.Node{
+ &node.Argument{Variadic: false, Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}}},
+ &node.Argument{Variadic: true, Expr: &expr.Variable{VarName: &node.Identifier{Value: "b"}}},
+ },
},
},
},
@@ -247,7 +273,7 @@ func TestPhp7ParameterNode(t *testing.T) {
},
}
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Function{
ReturnsRef: false,
@@ -263,14 +289,15 @@ func TestPhp7ParameterNode(t *testing.T) {
MethodName: &node.Identifier{Value: "foo"},
Modifiers: []node.Node{&node.Identifier{Value: "public"}},
Params: expectedParams,
- Stmts: []node.Node{},
+ Stmt: &stmt.StmtList{
+ Stmts: []node.Node{},
+ },
},
},
},
&stmt.Expression{
Expr: &expr.Closure{
Params: expectedParams,
- Uses: []node.Node{},
Stmts: []node.Node{},
},
},
@@ -278,7 +305,6 @@ func TestPhp7ParameterNode(t *testing.T) {
Expr: &expr.Closure{
Static: true,
Params: expectedParams,
- Uses: []node.Node{},
Stmts: []node.Node{},
},
},
@@ -315,7 +341,7 @@ func TestPhp5ParameterNode(t *testing.T) {
},
}
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Function{
ReturnsRef: false,
@@ -331,14 +357,15 @@ func TestPhp5ParameterNode(t *testing.T) {
MethodName: &node.Identifier{Value: "foo"},
Modifiers: []node.Node{&node.Identifier{Value: "public"}},
Params: expectedParams,
- Stmts: []node.Node{},
+ Stmt: &stmt.StmtList{
+ Stmts: []node.Node{},
+ },
},
},
},
&stmt.Expression{
Expr: &expr.Closure{
Params: expectedParams,
- Uses: []node.Node{},
Stmts: []node.Node{},
},
},
@@ -346,7 +373,6 @@ func TestPhp5ParameterNode(t *testing.T) {
Expr: &expr.Closure{
Static: true,
Params: expectedParams,
- Uses: []node.Node{},
Stmts: []node.Node{},
},
},
@@ -362,7 +388,7 @@ func TestPhp5ParameterNode(t *testing.T) {
func TestCommentEndFile(t *testing.T) {
src := ` //comment at the end)`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{},
}
diff --git a/node/t_visitor_test.go b/node/t_visitor_test.go
index 1fc3545..15def8d 100644
--- a/node/t_visitor_test.go
+++ b/node/t_visitor_test.go
@@ -4,6 +4,8 @@ import (
"reflect"
"testing"
+ "github.com/z7zmey/php-parser/node/stmt"
+
"github.com/z7zmey/php-parser/node/scalar"
"github.com/z7zmey/php-parser/walker"
@@ -44,6 +46,22 @@ var nodesToTest = []struct {
[]string{"VariableType", "Variable", "DefaultValue"},
map[string]interface{}{"ByRef": false, "Variadic": true},
},
+ {
+ &node.ArgumentList{
+ Arguments: []node.Node{
+ &node.Argument{},
+ },
+ },
+ []string{"Arguments"},
+ map[string]interface{}{},
+ },
+ {
+ &node.Root{
+ Stmts: []node.Node{&stmt.Expression{}},
+ },
+ []string{"Stmts"},
+ map[string]interface{}{},
+ },
}
type visitorMock struct {
diff --git a/parser/comments.go b/parser/comments.go
new file mode 100644
index 0000000..070d04a
--- /dev/null
+++ b/parser/comments.go
@@ -0,0 +1,30 @@
+package parser
+
+import (
+ "github.com/z7zmey/php-parser/comment"
+ "github.com/z7zmey/php-parser/node"
+ "github.com/z7zmey/php-parser/scanner"
+)
+
+// Comments a collection of comment groups assigned to nodes
+type Comments map[node.Node][]*comment.Comment
+
+// AddComments add comment group to the collection
+func (c Comments) AddComments(node node.Node, comments []*comment.Comment) {
+ c[node] = append(c[node], comments...)
+}
+
+func (c Comments) AddFromToken(node node.Node, token *scanner.Token, tokenName comment.TokenName) {
+ comments := token.Comments()
+
+ for _, cmt := range comments {
+ cmt.SetTokenName(tokenName)
+ }
+
+ c.AddComments(node, comments)
+}
+
+func (c Comments) AddFromChildNode(n node.Node, ch node.Node) {
+ c.AddComments(n, c[ch])
+ delete(c, ch)
+}
diff --git a/parser/comments_test.go b/parser/comments_test.go
new file mode 100644
index 0000000..bdec9ef
--- /dev/null
+++ b/parser/comments_test.go
@@ -0,0 +1,28 @@
+package parser_test
+
+import (
+ "testing"
+
+ "github.com/z7zmey/php-parser/comment"
+ "github.com/z7zmey/php-parser/node"
+ "github.com/z7zmey/php-parser/parser"
+)
+
+func TestComments(t *testing.T) {
+ n := node.NewIdentifier("test")
+
+ commentGroup := []*comment.Comment{
+ comment.NewComment("/** hello world */", nil),
+ comment.NewComment("// hello world", nil),
+ }
+
+ comments := parser.Comments{}
+ comments.AddComments(n, commentGroup)
+
+ if comments[n][0].String() != "/** hello world */" {
+ t.Errorf("expected and actual are not equal\n")
+ }
+ if comments[n][1].String() != "// hello world" {
+ t.Errorf("expected and actual are not equal\n")
+ }
+}
diff --git a/parser/parser.go b/parser/parser.go
index e9b4e93..24dc804 100644
--- a/parser/parser.go
+++ b/parser/parser.go
@@ -1,10 +1,8 @@
package parser
import (
- "github.com/z7zmey/php-parser/comment"
"github.com/z7zmey/php-parser/errors"
"github.com/z7zmey/php-parser/node"
- "github.com/z7zmey/php-parser/position"
)
// Parser interface
@@ -13,6 +11,6 @@ type Parser interface {
GetPath() string
GetRootNode() node.Node
GetErrors() []*errors.Error
- GetComments() comment.Comments
- GetPositions() position.Positions
+ GetComments() Comments
+ GetPositions() Positions
}
diff --git a/parser/position_builder.go b/parser/position_builder.go
new file mode 100644
index 0000000..9b196b9
--- /dev/null
+++ b/parser/position_builder.go
@@ -0,0 +1,204 @@
+package parser
+
+import (
+ "github.com/z7zmey/php-parser/node"
+ "github.com/z7zmey/php-parser/position"
+ "github.com/z7zmey/php-parser/scanner"
+)
+
+// PositionBuilder provide functions to constuct positions
+type PositionBuilder struct {
+ Positions *Positions
+}
+
+type startPos struct {
+ startLine int
+ startPos int
+}
+
+type endPos struct {
+ endLine int
+ endPos int
+}
+
+func (b *PositionBuilder) getListStartPos(l []node.Node) startPos {
+ if l == nil {
+ return startPos{-1, -1}
+ }
+
+ if len(l) == 0 {
+ return startPos{-1, -1}
+ }
+
+ return b.getNodeStartPos(l[0])
+}
+
+func (b *PositionBuilder) getNodeStartPos(n node.Node) startPos {
+ sl := -1
+ sp := -1
+
+ if n == nil {
+ return startPos{-1, -1}
+ }
+
+ p := (*b.Positions)[n]
+ if p != nil {
+ sl = p.StartLine
+ sp = p.StartPos
+ }
+
+ return startPos{sl, sp}
+}
+
+func (b *PositionBuilder) getListEndPos(l []node.Node) endPos {
+ if l == nil {
+ return endPos{-1, -1}
+ }
+
+ if len(l) == 0 {
+ return endPos{-1, -1}
+ }
+
+ return b.getNodeEndPos(l[len(l)-1])
+}
+
+func (b *PositionBuilder) getNodeEndPos(n node.Node) endPos {
+ el := -1
+ ep := -1
+
+ if n == nil {
+ return endPos{-1, -1}
+ }
+
+ p := (*b.Positions)[n]
+ if p != nil {
+ el = p.EndLine
+ ep = p.EndPos
+ }
+
+ return endPos{el, ep}
+}
+
+// NewNodeListPosition returns new Position
+func (b *PositionBuilder) NewNodeListPosition(list []node.Node) *position.Position {
+ return position.NewPosition(
+ b.getListStartPos(list).startLine,
+ b.getListEndPos(list).endLine,
+ b.getListStartPos(list).startPos,
+ b.getListEndPos(list).endPos,
+ )
+}
+
+// NewNodePosition returns new Position
+func (b *PositionBuilder) NewNodePosition(n node.Node) *position.Position {
+ return position.NewPosition(
+ b.getNodeStartPos(n).startLine,
+ b.getNodeEndPos(n).endLine,
+ b.getNodeStartPos(n).startPos,
+ b.getNodeEndPos(n).endPos,
+ )
+}
+
+// NewTokenPosition returns new Position
+func (b *PositionBuilder) NewTokenPosition(t *scanner.Token) *position.Position {
+ return t.Position()
+}
+
+// NewTokensPosition returns new Position
+func (b *PositionBuilder) NewTokensPosition(startToken *scanner.Token, endToken *scanner.Token) *position.Position {
+ return position.NewPosition(
+ startToken.Position().StartLine,
+ endToken.Position().EndLine,
+ startToken.Position().StartPos,
+ endToken.Position().EndPos,
+ )
+}
+
+// NewTokenNodePosition returns new Position
+func (b *PositionBuilder) NewTokenNodePosition(t *scanner.Token, n node.Node) *position.Position {
+ return position.NewPosition(
+ t.Position().StartLine,
+ b.getNodeEndPos(n).endLine,
+ t.Position().StartPos,
+ b.getNodeEndPos(n).endPos,
+ )
+}
+
+// NewNodeTokenPosition returns new Position
+func (b *PositionBuilder) NewNodeTokenPosition(n node.Node, t *scanner.Token) *position.Position {
+ return position.NewPosition(
+ b.getNodeStartPos(n).startLine,
+ t.Position().EndLine,
+ b.getNodeStartPos(n).startPos,
+ t.Position().EndPos,
+ )
+}
+
+// NewNodesPosition returns new Position
+func (b *PositionBuilder) NewNodesPosition(startNode node.Node, endNode node.Node) *position.Position {
+ return position.NewPosition(
+ b.getNodeStartPos(startNode).startLine,
+ b.getNodeEndPos(endNode).endLine,
+ b.getNodeStartPos(startNode).startPos,
+ b.getNodeEndPos(endNode).endPos,
+ )
+}
+
+// NewNodeListTokenPosition returns new Position
+func (b *PositionBuilder) NewNodeListTokenPosition(list []node.Node, t *scanner.Token) *position.Position {
+ return position.NewPosition(
+ b.getListStartPos(list).startLine,
+ t.Position().EndLine,
+ b.getListStartPos(list).startPos,
+ t.Position().EndPos,
+ )
+}
+
+// NewTokenNodeListPosition returns new Position
+func (b *PositionBuilder) NewTokenNodeListPosition(t *scanner.Token, list []node.Node) *position.Position {
+ return position.NewPosition(
+ t.Position().StartLine,
+ b.getListEndPos(list).endLine,
+ t.Position().StartPos,
+ b.getListEndPos(list).endPos,
+ )
+}
+
+// NewNodeNodeListPosition returns new Position
+func (b *PositionBuilder) NewNodeNodeListPosition(n node.Node, list []node.Node) *position.Position {
+ return position.NewPosition(
+ b.getNodeStartPos(n).startLine,
+ b.getListEndPos(list).endLine,
+ b.getNodeStartPos(n).startPos,
+ b.getListEndPos(list).endPos,
+ )
+}
+
+// NewNodeListNodePosition returns new Position
+func (b *PositionBuilder) NewNodeListNodePosition(list []node.Node, n node.Node) *position.Position {
+ return position.NewPosition(
+ b.getListStartPos(list).startLine,
+ b.getNodeEndPos(n).endLine,
+ b.getListStartPos(list).startPos,
+ b.getNodeEndPos(n).endPos,
+ )
+}
+
+// NewOptionalListTokensPosition returns new Position
+func (b *PositionBuilder) NewOptionalListTokensPosition(list []node.Node, t *scanner.Token, endToken *scanner.Token) *position.Position {
+ if list == nil {
+ return position.NewPosition(
+ t.Position().StartLine,
+ endToken.Position().EndLine,
+ t.Position().StartPos,
+ endToken.Position().EndPos,
+ )
+ }
+
+ return position.NewPosition(
+ b.getListStartPos(list).startLine,
+ endToken.Position().EndLine,
+ b.getListStartPos(list).startPos,
+ endToken.Position().EndPos,
+ )
+}
diff --git a/parser/position_builder_test.go b/parser/position_builder_test.go
new file mode 100644
index 0000000..4b11c3a
--- /dev/null
+++ b/parser/position_builder_test.go
@@ -0,0 +1,428 @@
+package parser_test
+
+import (
+ "testing"
+
+ "github.com/z7zmey/php-parser/node"
+ "github.com/z7zmey/php-parser/parser"
+ "github.com/z7zmey/php-parser/position"
+
+ "github.com/z7zmey/php-parser/scanner"
+)
+
+func TestNewTokenPosition(t *testing.T) {
+ builder := parser.PositionBuilder{}
+
+ tpos := position.NewPosition(1, 1, 0, 3)
+ tkn := scanner.NewToken(`foo`, tpos)
+
+ pos := builder.NewTokenPosition(tkn)
+
+ if pos.String() != `Pos{Line: 1-1 Pos: 0-3}` {
+ t.Errorf("token value is not equal\n")
+ }
+}
+
+func TestNewTokensPosition(t *testing.T) {
+ builder := parser.PositionBuilder{}
+
+ tpos1 := position.NewPosition(1, 1, 0, 3)
+ token1 := scanner.NewToken(`foo`, tpos1)
+ tpos2 := position.NewPosition(2, 2, 4, 6)
+ token2 := scanner.NewToken(`foo`, tpos2)
+
+ pos := builder.NewTokensPosition(token1, token2)
+
+ if pos.String() != `Pos{Line: 1-2 Pos: 0-6}` {
+ t.Errorf("token value is not equal\n")
+ }
+}
+
+func TestNewNodePosition(t *testing.T) {
+ n := node.NewIdentifier("test node")
+
+ p := &parser.Positions{}
+ p.AddPosition(n, &position.Position{
+ StartLine: 1,
+ EndLine: 1,
+ StartPos: 0,
+ EndPos: 3,
+ })
+
+ builder := parser.PositionBuilder{
+ Positions: p,
+ }
+
+ pos := builder.NewNodePosition(n)
+
+ if pos.String() != `Pos{Line: 1-1 Pos: 0-3}` {
+ t.Errorf("token value is not equal\n")
+ }
+}
+
+func TestNewTokenNodePosition(t *testing.T) {
+ tpos := position.NewPosition(1, 1, 0, 3)
+ tkn := scanner.NewToken(`foo`, tpos)
+ n := node.NewIdentifier("test node")
+
+ p := &parser.Positions{}
+ p.AddPosition(n, &position.Position{
+ StartLine: 2,
+ EndLine: 2,
+ StartPos: 4,
+ EndPos: 12,
+ })
+
+ builder := parser.PositionBuilder{
+ Positions: p,
+ }
+
+ pos := builder.NewTokenNodePosition(tkn, n)
+
+ if pos.String() != `Pos{Line: 1-2 Pos: 0-12}` {
+ t.Errorf("token value is not equal\n")
+ }
+}
+
+func TestNewNodeTokenPosition(t *testing.T) {
+ n := node.NewIdentifier("test node")
+ tpos := position.NewPosition(2, 2, 10, 12)
+ tkn := scanner.NewToken(`foo`, tpos)
+
+ p := &parser.Positions{}
+ p.AddPosition(n, &position.Position{
+ StartLine: 1,
+ EndLine: 1,
+ StartPos: 0,
+ EndPos: 9,
+ })
+
+ builder := parser.PositionBuilder{
+ Positions: p,
+ }
+
+ pos := builder.NewNodeTokenPosition(n, tkn)
+
+ if pos.String() != `Pos{Line: 1-2 Pos: 0-12}` {
+ t.Errorf("token value is not equal\n")
+ }
+}
+
+func TestNewNodeListPosition(t *testing.T) {
+ n1 := node.NewIdentifier("test node")
+ n2 := node.NewIdentifier("test node")
+
+ builder := parser.PositionBuilder{
+ Positions: &parser.Positions{
+ n1: &position.Position{
+ StartLine: 1,
+ EndLine: 1,
+ StartPos: 0,
+ EndPos: 9,
+ },
+ n2: &position.Position{
+ StartLine: 2,
+ EndLine: 2,
+ StartPos: 10,
+ EndPos: 19,
+ },
+ },
+ }
+
+ pos := builder.NewNodeListPosition([]node.Node{n1, n2})
+
+ if pos.String() != `Pos{Line: 1-2 Pos: 0-19}` {
+ t.Errorf("token value is not equal\n")
+ }
+}
+
+func TestNewNodesPosition(t *testing.T) {
+ n1 := node.NewIdentifier("test node")
+ n2 := node.NewIdentifier("test node")
+
+ builder := parser.PositionBuilder{
+ Positions: &parser.Positions{
+ n1: &position.Position{
+ StartLine: 1,
+ EndLine: 1,
+ StartPos: 0,
+ EndPos: 9,
+ },
+ n2: &position.Position{
+ StartLine: 2,
+ EndLine: 2,
+ StartPos: 10,
+ EndPos: 19,
+ },
+ },
+ }
+
+ pos := builder.NewNodesPosition(n1, n2)
+
+ if pos.String() != `Pos{Line: 1-2 Pos: 0-19}` {
+ t.Errorf("token value is not equal\n")
+ }
+}
+
+func TestNewNodeListTokenPosition(t *testing.T) {
+ n1 := node.NewIdentifier("test node")
+ n2 := node.NewIdentifier("test node")
+ tpos := position.NewPosition(3, 3, 20, 22)
+ tkn := scanner.NewToken(`foo`, tpos)
+
+ builder := parser.PositionBuilder{
+ Positions: &parser.Positions{
+ n1: &position.Position{
+ StartLine: 1,
+ EndLine: 1,
+ StartPos: 0,
+ EndPos: 9,
+ },
+ n2: &position.Position{
+ StartLine: 2,
+ EndLine: 2,
+ StartPos: 10,
+ EndPos: 19,
+ },
+ },
+ }
+
+ pos := builder.NewNodeListTokenPosition([]node.Node{n1, n2}, tkn)
+
+ if pos.String() != `Pos{Line: 1-3 Pos: 0-22}` {
+ t.Errorf("token value is not equal\n")
+ }
+}
+
+func TestNewTokenNodeListPosition(t *testing.T) {
+ tpos := position.NewPosition(1, 1, 0, 2)
+ tkn := scanner.NewToken(`foo`, tpos)
+ n1 := node.NewIdentifier("test node")
+ n2 := node.NewIdentifier("test node")
+
+ builder := parser.PositionBuilder{
+ Positions: &parser.Positions{
+ n1: &position.Position{
+ StartLine: 2,
+ EndLine: 2,
+ StartPos: 3,
+ EndPos: 10,
+ },
+ n2: &position.Position{
+ StartLine: 3,
+ EndLine: 3,
+ StartPos: 11,
+ EndPos: 20,
+ },
+ },
+ }
+
+ pos := builder.NewTokenNodeListPosition(tkn, []node.Node{n1, n2})
+
+ if pos.String() != `Pos{Line: 1-3 Pos: 0-20}` {
+ t.Errorf("token value is not equal\n")
+ }
+}
+
+func TestNewNodeNodeListPosition(t *testing.T) {
+ n1 := node.NewIdentifier("test node")
+ n2 := node.NewIdentifier("test node")
+ n3 := node.NewIdentifier("test node")
+
+ builder := parser.PositionBuilder{
+ Positions: &parser.Positions{
+ n1: &position.Position{
+ StartLine: 1,
+ EndLine: 1,
+ StartPos: 0,
+ EndPos: 8,
+ },
+ n2: &position.Position{
+ StartLine: 2,
+ EndLine: 2,
+ StartPos: 9,
+ EndPos: 17,
+ },
+ n3: &position.Position{
+ StartLine: 3,
+ EndLine: 3,
+ StartPos: 18,
+ EndPos: 26,
+ },
+ },
+ }
+
+ pos := builder.NewNodeNodeListPosition(n1, []node.Node{n2, n3})
+
+ if pos.String() != `Pos{Line: 1-3 Pos: 0-26}` {
+ t.Errorf("token value is not equal\n")
+ }
+}
+
+func TestNewNodeListNodePosition(t *testing.T) {
+ n1 := node.NewIdentifier("test node")
+ n2 := node.NewIdentifier("test node")
+ n3 := node.NewIdentifier("test node")
+
+ builder := parser.PositionBuilder{
+ Positions: &parser.Positions{
+ n1: &position.Position{
+ StartLine: 1,
+ EndLine: 1,
+ StartPos: 0,
+ EndPos: 8,
+ },
+ n2: &position.Position{
+ StartLine: 2,
+ EndLine: 2,
+ StartPos: 9,
+ EndPos: 17,
+ },
+ n3: &position.Position{
+ StartLine: 3,
+ EndLine: 3,
+ StartPos: 18,
+ EndPos: 26,
+ },
+ },
+ }
+
+ pos := builder.NewNodeListNodePosition([]node.Node{n1, n2}, n3)
+
+ if pos.String() != `Pos{Line: 1-3 Pos: 0-26}` {
+ t.Errorf("token value is not equal\n")
+ }
+}
+
+func TestNewOptionalListTokensPosition(t *testing.T) {
+ builder := parser.PositionBuilder{}
+
+ tpos1 := position.NewPosition(1, 1, 0, 3)
+ token1 := scanner.NewToken(`foo`, tpos1)
+ tpos2 := position.NewPosition(2, 2, 4, 6)
+ token2 := scanner.NewToken(`foo`, tpos2)
+
+ pos := builder.NewOptionalListTokensPosition(nil, token1, token2)
+
+ if pos.String() != `Pos{Line: 1-2 Pos: 0-6}` {
+ t.Errorf("token value is not equal\n")
+ }
+}
+
+func TestNewOptionalListTokensPosition2(t *testing.T) {
+ n1 := node.NewIdentifier("test node")
+ n2 := node.NewIdentifier("test node")
+ n3 := node.NewIdentifier("test node")
+
+ builder := parser.PositionBuilder{
+ Positions: &parser.Positions{
+ n1: &position.Position{
+ StartLine: 1,
+ EndLine: 1,
+ StartPos: 0,
+ EndPos: 8,
+ },
+ n2: &position.Position{
+ StartLine: 2,
+ EndLine: 2,
+ StartPos: 9,
+ EndPos: 17,
+ },
+ n3: &position.Position{
+ StartLine: 3,
+ EndLine: 3,
+ StartPos: 18,
+ EndPos: 26,
+ },
+ },
+ }
+
+ tpos1 := position.NewPosition(4, 4, 27, 29)
+ token1 := scanner.NewToken(`foo`, tpos1)
+ tpos2 := position.NewPosition(5, 5, 30, 32)
+ token2 := scanner.NewToken(`foo`, tpos2)
+
+ pos := builder.NewOptionalListTokensPosition([]node.Node{n2, n3}, token1, token2)
+
+ if pos.String() != `Pos{Line: 2-5 Pos: 9-32}` {
+ t.Errorf("token value is not equal\n")
+ }
+}
+
+func TestNilNodePos(t *testing.T) {
+ builder := parser.PositionBuilder{}
+
+ pos := builder.NewNodesPosition(nil, nil)
+
+ if pos.String() != `Pos{Line: -1--1 Pos: -1--1}` {
+ t.Errorf("token value is not equal\n")
+ }
+}
+
+func TestNilNodeListPos(t *testing.T) {
+ n1 := node.NewIdentifier("test node")
+
+ builder := parser.PositionBuilder{
+ Positions: &parser.Positions{
+ n1: &position.Position{
+ StartLine: 1,
+ EndLine: 1,
+ StartPos: 0,
+ EndPos: 8,
+ },
+ },
+ }
+
+ pos := builder.NewNodeNodeListPosition(n1, nil)
+
+ if pos.String() != `Pos{Line: 1--1 Pos: 0--1}` {
+ t.Errorf("token value is not equal\n")
+ }
+}
+
+func TestNilNodeListTokenPos(t *testing.T) {
+ tpos := position.NewPosition(1, 1, 0, 3)
+ token1 := scanner.NewToken(`foo`, tpos)
+
+ builder := parser.PositionBuilder{}
+
+ pos := builder.NewNodeListTokenPosition(nil, token1)
+
+ if pos.String() != `Pos{Line: -1-1 Pos: -1-3}` {
+ t.Errorf("token value is not equal\n")
+ }
+}
+
+func TestEmptyNodeListPos(t *testing.T) {
+ n1 := node.NewIdentifier("test node")
+
+ builder := parser.PositionBuilder{
+ Positions: &parser.Positions{
+ n1: &position.Position{
+ StartLine: 1,
+ EndLine: 1,
+ StartPos: 0,
+ EndPos: 8,
+ },
+ },
+ }
+
+ pos := builder.NewNodeNodeListPosition(n1, []node.Node{})
+
+ if pos.String() != `Pos{Line: 1--1 Pos: 0--1}` {
+ t.Errorf("token value is not equal\n")
+ }
+}
+
+func TestEmptyNodeListTokenPos(t *testing.T) {
+ tpos := position.NewPosition(1, 1, 0, 3)
+ token1 := scanner.NewToken(`foo`, tpos)
+
+ builder := parser.PositionBuilder{}
+
+ pos := builder.NewNodeListTokenPosition([]node.Node{}, token1)
+
+ if pos.String() != `Pos{Line: -1-1 Pos: -1-3}` {
+ t.Errorf("token value is not equal\n")
+ }
+}
diff --git a/parser/positions.go b/parser/positions.go
new file mode 100644
index 0000000..6c2c0a9
--- /dev/null
+++ b/parser/positions.go
@@ -0,0 +1,14 @@
+package parser
+
+import (
+ "github.com/z7zmey/php-parser/node"
+ "github.com/z7zmey/php-parser/position"
+)
+
+// Positions a collection of positions attached to nodes
+type Positions map[node.Node]*position.Position
+
+// AddPosition attaches a position to a node
+func (p Positions) AddPosition(node node.Node, position *position.Position) {
+ p[node] = position
+}
diff --git a/parser/positions_test.go b/parser/positions_test.go
new file mode 100644
index 0000000..d836c5c
--- /dev/null
+++ b/parser/positions_test.go
@@ -0,0 +1,25 @@
+package parser_test
+
+import (
+ "testing"
+
+ "github.com/z7zmey/php-parser/position"
+
+ "github.com/z7zmey/php-parser/node"
+ "github.com/z7zmey/php-parser/parser"
+)
+
+func TestPositions(t *testing.T) {
+ n := node.NewIdentifier("test")
+
+ expected := position.NewPosition(0, 0, 0, 0)
+
+ positions := parser.Positions{}
+ positions.AddPosition(n, expected)
+
+ actual := positions[n]
+
+ if actual != expected {
+ t.Errorf("expected and actual are not equal\n")
+ }
+}
diff --git a/php5/parser.go b/php5/parser.go
index b2175c9..559a913 100644
--- a/php5/parser.go
+++ b/php5/parser.go
@@ -6,12 +6,11 @@ import (
"github.com/z7zmey/php-parser/comment"
"github.com/z7zmey/php-parser/errors"
"github.com/z7zmey/php-parser/node"
- "github.com/z7zmey/php-parser/position"
+ "github.com/z7zmey/php-parser/parser"
"github.com/z7zmey/php-parser/scanner"
- "github.com/z7zmey/php-parser/token"
)
-func (lval *yySymType) Token(t token.Token) {
+func (lval *yySymType) Token(t *scanner.Token) {
lval.token = t
}
@@ -19,12 +18,12 @@ func (lval *yySymType) Token(t token.Token) {
type Parser struct {
*scanner.Lexer
path string
- lastToken *token.Token
- positionBuilder *position.Builder
+ currentToken *scanner.Token
+ positionBuilder *parser.PositionBuilder
errors []*errors.Error
rootNode node.Node
- comments comment.Comments
- positions position.Positions
+ comments parser.Comments
+ positions parser.Positions
}
// NewParser creates and returns new Parser
@@ -46,12 +45,12 @@ func NewParser(src io.Reader, path string) *Parser {
// Lex proxy to lexer Lex
func (l *Parser) Lex(lval *yySymType) int {
t := l.Lexer.Lex(lval)
- l.lastToken = &lval.token
+ l.currentToken = lval.token
return t
}
func (l *Parser) Error(msg string) {
- l.errors = append(l.errors, errors.NewError(msg, *l.lastToken))
+ l.errors = append(l.errors, errors.NewError(msg, l.currentToken))
}
// Parse the php7 Parser entrypoint
@@ -59,9 +58,9 @@ func (l *Parser) Parse() int {
// init
l.errors = nil
l.rootNode = nil
- l.comments = comment.Comments{}
- l.positions = position.Positions{}
- l.positionBuilder = &position.Builder{
+ l.comments = parser.Comments{}
+ l.positions = parser.Positions{}
+ l.positionBuilder = &parser.PositionBuilder{
Positions: &l.positions,
}
@@ -70,7 +69,7 @@ func (l *Parser) Parse() int {
return yyParse(l)
}
-func (l *Parser) listGetFirstNodeComments(list []node.Node) []comment.Comment {
+func (l *Parser) listGetFirstNodeComments(list []node.Node) []*comment.Comment {
if len(list) == 0 {
return nil
}
@@ -96,11 +95,21 @@ func (l *Parser) GetErrors() []*errors.Error {
}
// GetComments returns comments list
-func (l *Parser) GetComments() comment.Comments {
+func (l *Parser) GetComments() parser.Comments {
return l.comments
}
// GetPositions returns positions list
-func (l *Parser) GetPositions() position.Positions {
+func (l *Parser) GetPositions() parser.Positions {
return l.positions
}
+
+// helpers
+
+func lastNode(nn []node.Node) node.Node {
+ return nn[len(nn)-1]
+}
+
+func firstNode(nn []node.Node) node.Node {
+ return nn[0]
+}
diff --git a/php5/php5.go b/php5/php5.go
index 2e14e0c..19cc3ca 100644
--- a/php5/php5.go
+++ b/php5/php5.go
@@ -8,6 +8,7 @@ import (
"strconv"
"strings"
+ "github.com/z7zmey/php-parser/comment"
"github.com/z7zmey/php-parser/node"
"github.com/z7zmey/php-parser/node/expr"
"github.com/z7zmey/php-parser/node/expr/assign"
@@ -16,20 +17,21 @@ import (
"github.com/z7zmey/php-parser/node/name"
"github.com/z7zmey/php-parser/node/scalar"
"github.com/z7zmey/php-parser/node/stmt"
- "github.com/z7zmey/php-parser/token"
+ "github.com/z7zmey/php-parser/scanner"
)
-//line php5/php5.y:21
+//line php5/php5.y:22
type yySymType struct {
yys int
node node.Node
- token token.Token
- boolWithToken boolWithToken
+ token *scanner.Token
list []node.Node
- foreachVariable foreachVariable
- nodesWithEndToken *nodesWithEndToken
simpleIndirectReference simpleIndirectReference
- altSyntaxNode altSyntaxNode
+
+ ClassExtends *stmt.ClassExtends
+ ClassImplements *stmt.ClassImplements
+ InterfaceExtends *stmt.InterfaceExtends
+ ClosureUse *expr.ClosureUse
}
const T_INCLUDE = 57346
@@ -148,26 +150,26 @@ const T_NOELSE = 57458
const T_PLUS_EQUAL = 57459
const T_MINUS_EQUAL = 57460
const T_MUL_EQUAL = 57461
-const T_DIV_EQUAL = 57462
-const T_CONCAT_EQUAL = 57463
-const T_MOD_EQUAL = 57464
-const T_AND_EQUAL = 57465
-const T_OR_EQUAL = 57466
-const T_XOR_EQUAL = 57467
-const T_SL_EQUAL = 57468
-const T_SR_EQUAL = 57469
-const T_POW_EQUAL = 57470
+const T_POW_EQUAL = 57462
+const T_DIV_EQUAL = 57463
+const T_CONCAT_EQUAL = 57464
+const T_MOD_EQUAL = 57465
+const T_AND_EQUAL = 57466
+const T_OR_EQUAL = 57467
+const T_XOR_EQUAL = 57468
+const T_SL_EQUAL = 57469
+const T_SR_EQUAL = 57470
const T_BOOLEAN_OR = 57471
const T_BOOLEAN_AND = 57472
-const T_IS_EQUAL = 57473
-const T_IS_NOT_EQUAL = 57474
-const T_IS_IDENTICAL = 57475
-const T_IS_NOT_IDENTICAL = 57476
-const T_IS_SMALLER_OR_EQUAL = 57477
-const T_IS_GREATER_OR_EQUAL = 57478
-const T_SL = 57479
-const T_SR = 57480
-const T_POW = 57481
+const T_POW = 57473
+const T_SL = 57474
+const T_SR = 57475
+const T_IS_IDENTICAL = 57476
+const T_IS_NOT_IDENTICAL = 57477
+const T_IS_EQUAL = 57478
+const T_IS_NOT_EQUAL = 57479
+const T_IS_SMALLER_OR_EQUAL = 57480
+const T_IS_GREATER_OR_EQUAL = 57481
var yyToknames = [...]string{
"$end",
@@ -286,6 +288,29 @@ var yyToknames = [...]string{
"T_COALESCE",
"T_SPACESHIP",
"T_NOELSE",
+ "T_PLUS_EQUAL",
+ "T_MINUS_EQUAL",
+ "T_MUL_EQUAL",
+ "T_POW_EQUAL",
+ "T_DIV_EQUAL",
+ "T_CONCAT_EQUAL",
+ "T_MOD_EQUAL",
+ "T_AND_EQUAL",
+ "T_OR_EQUAL",
+ "T_XOR_EQUAL",
+ "T_SL_EQUAL",
+ "T_SR_EQUAL",
+ "T_BOOLEAN_OR",
+ "T_BOOLEAN_AND",
+ "T_POW",
+ "T_SL",
+ "T_SR",
+ "T_IS_IDENTICAL",
+ "T_IS_NOT_IDENTICAL",
+ "T_IS_EQUAL",
+ "T_IS_NOT_EQUAL",
+ "T_IS_SMALLER_OR_EQUAL",
+ "T_IS_GREATER_OR_EQUAL",
"'\"'",
"'`'",
"'{'",
@@ -305,38 +330,15 @@ var yyToknames = [...]string{
"'@'",
"'$'",
"','",
- "'='",
- "T_PLUS_EQUAL",
- "T_MINUS_EQUAL",
- "T_MUL_EQUAL",
- "T_DIV_EQUAL",
- "T_CONCAT_EQUAL",
- "T_MOD_EQUAL",
- "T_AND_EQUAL",
- "T_OR_EQUAL",
- "T_XOR_EQUAL",
- "T_SL_EQUAL",
- "T_SR_EQUAL",
- "T_POW_EQUAL",
- "T_BOOLEAN_OR",
- "T_BOOLEAN_AND",
"'|'",
+ "'='",
"'^'",
- "T_IS_EQUAL",
- "T_IS_NOT_EQUAL",
- "T_IS_IDENTICAL",
- "T_IS_NOT_IDENTICAL",
- "'<'",
- "T_IS_SMALLER_OR_EQUAL",
- "'>'",
- "T_IS_GREATER_OR_EQUAL",
- "T_SL",
- "T_SR",
- "'.'",
"'*'",
"'/'",
"'%'",
- "T_POW",
+ "'<'",
+ "'>'",
+ "'.'",
}
var yyStatenames = [...]string{}
@@ -344,33 +346,13 @@ const yyEofCode = 1
const yyErrCode = 2
const yyInitialStackSize = 16
-//line php5/php5.y:3825
-
-type foreachVariable struct {
- node node.Node
- byRef bool
-}
-
-type nodesWithEndToken struct {
- nodes []node.Node
- endToken token.Token
-}
-
-type boolWithToken struct {
- value bool
- token *token.Token
-}
+//line php5/php5.y:5483
type simpleIndirectReference struct {
all []*expr.Variable
last *expr.Variable
}
-type altSyntaxNode struct {
- node node.Node
- isAlt bool
-}
-
//line yacctab:1
var yyExca = [...]int{
-1, 1,
@@ -388,21 +370,21 @@ var yyExca = [...]int{
-2, 411,
-1, 114,
78, 451,
- 123, 447,
+ 146, 447,
-2, 457,
-1, 154,
104, 435,
105, 435,
-2, 433,
-1, 204,
- 121, 306,
- 124, 306,
+ 144, 306,
+ 147, 306,
-2, 430,
-1, 205,
104, 435,
105, 435,
- 121, 307,
- 124, 307,
+ 144, 307,
+ 147, 307,
-2, 433,
-1, 271,
78, 451,
@@ -411,96 +393,96 @@ var yyExca = [...]int{
78, 334,
-2, 413,
-1, 302,
- 123, 448,
+ 146, 448,
-2, 458,
-1, 311,
78, 333,
-2, 412,
-1, 378,
- 153, 0,
- 154, 0,
- 155, 0,
- 156, 0,
+ 134, 0,
+ 135, 0,
+ 136, 0,
+ 137, 0,
-2, 274,
-1, 379,
- 153, 0,
- 154, 0,
- 155, 0,
- 156, 0,
+ 134, 0,
+ 135, 0,
+ 136, 0,
+ 137, 0,
-2, 275,
-1, 380,
- 153, 0,
- 154, 0,
- 155, 0,
- 156, 0,
+ 134, 0,
+ 135, 0,
+ 136, 0,
+ 137, 0,
-2, 276,
-1, 381,
- 153, 0,
- 154, 0,
- 155, 0,
- 156, 0,
+ 134, 0,
+ 135, 0,
+ 136, 0,
+ 137, 0,
-2, 277,
-1, 382,
- 157, 0,
- 158, 0,
- 159, 0,
- 160, 0,
+ 138, 0,
+ 139, 0,
+ 165, 0,
+ 166, 0,
-2, 278,
-1, 383,
- 157, 0,
- 158, 0,
- 159, 0,
- 160, 0,
+ 138, 0,
+ 139, 0,
+ 165, 0,
+ 166, 0,
-2, 279,
-1, 384,
- 157, 0,
- 158, 0,
- 159, 0,
- 160, 0,
+ 138, 0,
+ 139, 0,
+ 165, 0,
+ 166, 0,
-2, 280,
-1, 385,
- 157, 0,
- 158, 0,
- 159, 0,
- 160, 0,
+ 138, 0,
+ 139, 0,
+ 165, 0,
+ 166, 0,
-2, 281,
-1, 392,
104, 435,
105, 435,
-2, 433,
-1, 400,
- 124, 142,
+ 147, 142,
-2, 147,
-1, 462,
104, 435,
105, 435,
- 124, 514,
- 135, 514,
+ 147, 515,
+ 158, 515,
-2, 433,
-1, 463,
- 124, 515,
- 135, 515,
+ 147, 516,
+ 158, 516,
-2, 430,
-1, 464,
104, 435,
105, 435,
-2, 433,
-1, 486,
- 124, 156,
- 135, 156,
+ 147, 156,
+ 158, 156,
-2, 430,
-1, 487,
104, 435,
105, 435,
- 124, 157,
- 135, 157,
+ 147, 157,
+ 158, 157,
-2, 433,
-1, 493,
- 123, 472,
- -2, 516,
- -1, 499,
- 123, 472,
+ 146, 472,
-2, 517,
+ -1, 499,
+ 146, 472,
+ -2, 518,
-1, 521,
78, 332,
-2, 369,
@@ -510,355 +492,374 @@ var yyExca = [...]int{
95, 135,
-2, 0,
-1, 551,
- 124, 142,
+ 147, 142,
-2, 147,
-1, 564,
- 124, 142,
+ 147, 142,
-2, 147,
-1, 581,
- 121, 308,
- 124, 308,
+ 144, 308,
+ 147, 308,
-2, 430,
-1, 582,
104, 435,
105, 435,
- 121, 309,
- 124, 309,
+ 144, 309,
+ 147, 309,
-2, 433,
- -1, 681,
+ -1, 682,
78, 334,
-2, 371,
- -1, 779,
- 153, 0,
- 154, 0,
- 155, 0,
- 156, 0,
- -2, 397,
-1, 780,
- 153, 0,
- 154, 0,
- 155, 0,
- 156, 0,
- -2, 398,
+ 134, 0,
+ 135, 0,
+ 136, 0,
+ 137, 0,
+ -2, 397,
-1, 781,
- 153, 0,
- 154, 0,
- 155, 0,
- 156, 0,
- -2, 399,
+ 134, 0,
+ 135, 0,
+ 136, 0,
+ 137, 0,
+ -2, 398,
-1, 782,
- 153, 0,
- 154, 0,
- 155, 0,
- 156, 0,
- -2, 400,
+ 134, 0,
+ 135, 0,
+ 136, 0,
+ 137, 0,
+ -2, 399,
-1, 783,
- 157, 0,
- 158, 0,
- 159, 0,
- 160, 0,
- -2, 401,
+ 134, 0,
+ 135, 0,
+ 136, 0,
+ 137, 0,
+ -2, 400,
-1, 784,
- 157, 0,
- 158, 0,
- 159, 0,
- 160, 0,
- -2, 402,
+ 138, 0,
+ 139, 0,
+ 165, 0,
+ 166, 0,
+ -2, 401,
-1, 785,
- 157, 0,
- 158, 0,
- 159, 0,
- 160, 0,
- -2, 403,
+ 138, 0,
+ 139, 0,
+ 165, 0,
+ 166, 0,
+ -2, 402,
-1, 786,
- 157, 0,
- 158, 0,
- 159, 0,
- 160, 0,
+ 138, 0,
+ 139, 0,
+ 165, 0,
+ 166, 0,
+ -2, 403,
+ -1, 787,
+ 138, 0,
+ 139, 0,
+ 165, 0,
+ 166, 0,
-2, 404,
- -1, 789,
+ -1, 790,
78, 333,
-2, 370,
- -1, 839,
+ -1, 840,
37, 201,
-2, 198,
- -1, 879,
+ -1, 880,
31, 128,
32, 128,
33, 128,
- 120, 128,
+ 143, 128,
-2, 0,
- -1, 914,
+ -1, 915,
95, 140,
-2, 0,
- -1, 916,
+ -1, 917,
31, 127,
32, 127,
33, 127,
- 120, 127,
+ 143, 127,
-2, 0,
- -1, 943,
+ -1, 944,
93, 136,
94, 136,
95, 136,
-2, 0,
- -1, 971,
+ -1, 972,
29, 189,
-2, 4,
- -1, 980,
- 124, 142,
+ -1, 981,
+ 147, 142,
-2, 147,
- -1, 997,
- 121, 193,
+ -1, 998,
+ 144, 193,
-2, 195,
}
const yyPrivate = 57344
-const yyLast = 8512
+const yyLast = 8982
var yyAct = [...]int{
- 102, 571, 843, 565, 1006, 965, 714, 807, 420, 826,
- 123, 131, 606, 200, 340, 918, 734, 567, 452, 815,
- 474, 683, 296, 594, 461, 592, 421, 61, 579, 142,
- 319, 315, 39, 98, 264, 390, 158, 517, 130, 2,
- 444, 115, 289, 192, 653, 118, 138, 140, 447, 544,
- 145, 485, 179, 653, 978, 1002, 228, 228, 162, 477,
- 941, 331, 940, 43, 7, 493, 959, 121, 330, 937,
- 934, 6, 931, 26, 821, 932, 939, 450, 499, 121,
- 121, 267, 44, 656, 658, 659, 657, 953, 432, 933,
- 921, 897, 853, 737, 192, 657, 709, 562, 954, 632,
- 251, 586, 618, 586, 298, 898, 735, 494, 153, 516,
- 633, 653, 585, 619, 270, 655, 654, 137, 358, 325,
- 179, 560, 272, 586, 793, 204, 311, 556, 510, 316,
- 320, 728, 561, 323, 114, 258, 329, 241, 557, 5,
- 506, 305, 511, 675, 677, 676, 678, 663, 664, 665,
- 656, 658, 659, 657, 507, 543, 339, 141, 653, 359,
- 121, 228, 655, 654, 310, 475, 355, 39, 178, 180,
- 181, 179, 121, 360, 451, 159, 357, 350, 312, 162,
- 356, 201, 1018, 976, 929, 907, 451, 451, 906, 120,
- 192, 351, 313, 267, 133, 228, 665, 656, 658, 659,
- 657, 120, 120, 904, 117, 861, 855, 653, 134, 791,
- 661, 655, 654, 241, 745, 271, 653, 104, 595, 639,
- 655, 654, 301, 228, 352, 631, 270, 386, 300, 177,
- 176, 425, 630, 624, 272, 673, 674, 671, 672, 675,
- 677, 676, 678, 663, 664, 665, 656, 658, 659, 657,
- 302, 623, 663, 664, 665, 656, 658, 659, 657, 597,
- 232, 232, 228, 175, 178, 180, 181, 179, 596, 595,
- 456, 473, 749, 231, 231, 333, 440, 336, 393, 748,
- 604, 294, 120, 611, 293, 273, 740, 453, 295, 610,
- 287, 281, 254, 228, 303, 253, 399, 160, 265, 977,
- 930, 1001, 950, 915, 885, 449, 882, 870, 825, 446,
- 814, 727, 693, 634, 131, 396, 625, 621, 509, 430,
- 428, 490, 513, 307, 241, 1013, 521, 271, 980, 297,
- 892, 472, 139, 297, 504, 999, 824, 593, 818, 682,
- 39, 449, 913, 434, 439, 492, 449, 587, 491, 502,
- 498, 564, 505, 497, 809, 808, 876, 463, 465, 521,
- 551, 126, 400, 121, 537, 232, 541, 288, 278, 275,
- 467, 484, 7, 274, 344, 250, 471, 345, 231, 6,
- 486, 222, 479, 480, 196, 195, 194, 144, 548, 495,
- 122, 135, 436, 437, 989, 546, 552, 273, 448, 232,
- 1010, 572, 1009, 572, 577, 572, 580, 458, 228, 400,
- 265, 984, 231, 983, 126, 923, 121, 912, 437, 436,
- 436, 126, 437, 121, 880, 588, 39, 232, 703, 704,
- 229, 703, 704, 230, 448, 811, 805, 804, 798, 448,
- 231, 295, 584, 712, 699, 547, 545, 5, 490, 233,
- 542, 501, 539, 398, 348, 540, 615, 156, 981, 126,
- 905, 121, 605, 423, 1019, 975, 232, 609, 449, 449,
- 874, 917, 492, 498, 891, 491, 497, 890, 309, 231,
- 308, 126, 888, 229, 732, 120, 230, 578, 581, 228,
- 229, 306, 197, 230, 435, 830, 449, 232, 616, 449,
- 614, 449, 233, 446, 295, 617, 224, 225, 316, 233,
- 231, 987, 320, 257, 637, 638, 810, 521, 730, 702,
- 641, 642, 802, 803, 681, 680, 521, 455, 229, 126,
- 353, 230, 39, 521, 521, 521, 521, 521, 120, 645,
- 695, 696, 648, 531, 259, 120, 650, 233, 635, 438,
- 126, 647, 572, 125, 652, 710, 424, 700, 228, 228,
- 228, 448, 448, 521, 7, 572, 718, 125, 726, 39,
- 39, 6, 91, 126, 971, 731, 531, 572, 580, 569,
- 570, 126, 729, 120, 612, 267, 687, 228, 228, 448,
- 124, 459, 448, 713, 448, 705, 739, 707, 573, 295,
- 723, 574, 454, 427, 295, 733, 282, 286, 260, 261,
- 469, 504, 232, 738, 426, 304, 742, 741, 270, 736,
- 126, 299, 321, 126, 816, 231, 272, 864, 228, 595,
- 228, 518, 686, 515, 62, 512, 744, 449, 508, 5,
- 457, 446, 573, 573, 754, 574, 574, 128, 129, 468,
- 322, 54, 263, 317, 521, 521, 521, 521, 521, 521,
+ 102, 571, 844, 565, 1007, 966, 715, 61, 420, 827,
+ 123, 131, 919, 200, 340, 594, 567, 607, 452, 816,
+ 461, 808, 474, 735, 592, 684, 138, 140, 421, 142,
+ 145, 390, 39, 98, 444, 579, 264, 517, 118, 319,
+ 158, 315, 331, 330, 447, 7, 6, 544, 485, 130,
+ 2, 43, 26, 979, 960, 938, 228, 228, 162, 477,
+ 935, 942, 289, 941, 44, 670, 658, 664, 665, 672,
+ 673, 674, 675, 678, 679, 932, 822, 940, 658, 1003,
+ 251, 267, 738, 654, 258, 710, 662, 656, 655, 562,
+ 153, 658, 664, 665, 661, 654, 663, 657, 659, 660,
+ 676, 677, 666, 516, 298, 358, 325, 204, 654, 657,
+ 659, 660, 656, 655, 270, 736, 241, 137, 933, 794,
+ 954, 898, 657, 659, 660, 192, 311, 666, 729, 316,
+ 320, 955, 934, 323, 922, 899, 329, 854, 633, 5,
+ 543, 510, 126, 619, 121, 586, 121, 192, 586, 634,
+ 121, 658, 664, 665, 620, 511, 339, 141, 678, 679,
+ 585, 228, 159, 560, 114, 475, 179, 39, 654, 977,
+ 556, 586, 656, 655, 561, 310, 357, 115, 930, 162,
+ 432, 557, 657, 659, 660, 676, 677, 666, 179, 182,
+ 183, 718, 241, 267, 506, 228, 201, 178, 180, 181,
+ 908, 493, 296, 121, 359, 450, 595, 121, 507, 177,
+ 176, 229, 352, 355, 230, 907, 905, 104, 360, 178,
+ 180, 181, 862, 228, 175, 856, 270, 356, 117, 386,
+ 233, 425, 350, 658, 664, 665, 672, 673, 674, 675,
+ 678, 679, 312, 494, 792, 271, 351, 126, 746, 121,
+ 654, 1019, 640, 662, 656, 655, 313, 133, 272, 658,
+ 393, 661, 228, 663, 657, 659, 660, 676, 677, 666,
+ 456, 134, 301, 231, 231, 333, 654, 336, 300, 750,
+ 302, 612, 632, 717, 232, 232, 499, 611, 121, 120,
+ 631, 120, 126, 228, 121, 303, 423, 741, 265, 604,
+ 625, 624, 446, 241, 605, 1002, 595, 160, 978, 273,
+ 126, 597, 121, 596, 131, 396, 229, 931, 509, 230,
+ 473, 305, 513, 749, 294, 293, 521, 287, 440, 281,
+ 254, 253, 951, 451, 916, 233, 886, 451, 492, 463,
+ 39, 436, 437, 498, 491, 883, 541, 871, 120, 497,
+ 484, 472, 120, 7, 6, 658, 826, 271, 815, 521,
+ 502, 229, 486, 505, 230, 295, 728, 437, 436, 436,
+ 272, 437, 654, 584, 694, 635, 656, 655, 231, 229,
+ 233, 626, 230, 430, 399, 428, 657, 659, 660, 232,
+ 307, 666, 548, 546, 120, 914, 552, 593, 233, 1014,
+ 981, 572, 893, 572, 577, 572, 580, 139, 228, 297,
+ 265, 825, 231, 819, 126, 126, 121, 121, 451, 439,
+ 683, 273, 877, 232, 587, 588, 39, 564, 448, 297,
+ 810, 809, 192, 120, 551, 434, 400, 458, 537, 120,
+ 231, 449, 353, 344, 288, 278, 345, 5, 275, 274,
+ 250, 232, 539, 295, 222, 540, 616, 120, 196, 195,
+ 194, 144, 467, 122, 448, 492, 498, 453, 471, 448,
+ 581, 491, 497, 179, 479, 480, 1011, 449, 1010, 231,
+ 135, 495, 449, 229, 268, 1000, 230, 269, 990, 228,
+ 232, 985, 617, 615, 177, 176, 446, 984, 618, 704,
+ 705, 490, 233, 233, 178, 180, 181, 924, 316, 175,
+ 231, 913, 320, 309, 504, 308, 881, 521, 126, 812,
+ 400, 232, 704, 705, 682, 806, 521, 805, 799, 713,
+ 700, 547, 39, 521, 521, 521, 521, 521, 545, 542,
+ 501, 398, 348, 531, 91, 7, 6, 156, 636, 646,
+ 982, 649, 572, 906, 653, 711, 606, 701, 228, 228,
+ 228, 120, 120, 521, 1020, 572, 719, 976, 727, 39,
+ 39, 918, 892, 891, 889, 732, 531, 572, 580, 733,
+ 578, 306, 730, 197, 435, 267, 192, 228, 228, 714,
+ 125, 448, 448, 706, 179, 708, 740, 224, 225, 875,
+ 724, 831, 803, 804, 449, 449, 295, 518, 743, 731,
+ 811, 681, 734, 455, 613, 739, 742, 126, 270, 448,
+ 126, 737, 448, 424, 448, 231, 126, 179, 490, 228,
+ 745, 228, 449, 703, 446, 449, 232, 449, 259, 5,
+ 651, 755, 257, 438, 696, 697, 125, 610, 988, 688,
+ 124, 459, 648, 128, 129, 521, 521, 521, 521, 521,
521, 521, 521, 521, 521, 521, 521, 521, 521, 521,
521, 521, 521, 521, 521, 521, 521, 521, 521, 521,
- 521, 789, 743, 521, 576, 758, 295, 756, 295, 757,
- 285, 295, 132, 232, 404, 132, 259, 720, 239, 750,
- 402, 438, 463, 295, 790, 792, 231, 226, 234, 259,
- 521, 208, 126, 207, 121, 985, 486, 228, 259, 271,
- 827, 823, 259, 799, 795, 45, 1007, 438, 725, 572,
- 448, 831, 986, 163, 531, 1017, 572, 850, 819, 338,
- 812, 703, 704, 531, 559, 991, 828, 813, 957, 832,
- 531, 531, 531, 531, 531, 851, 955, 856, 45, 453,
- 260, 261, 232, 232, 232, 742, 796, 609, 706, 703,
- 704, 858, 469, 260, 261, 231, 231, 231, 925, 896,
- 531, 268, 260, 261, 269, 470, 260, 261, 521, 273,
- 893, 232, 232, 259, 521, 521, 550, 1003, 284, 998,
- 233, 960, 265, 935, 231, 231, 847, 848, 849, 846,
- 845, 844, 901, 599, 878, 601, 600, 228, 126, 228,
- 877, 760, 521, 883, 881, 572, 889, 884, 759, 854,
- 875, 722, 232, 800, 232, 651, 120, 859, 860, 820,
- 649, 646, 900, 572, 903, 231, 602, 231, 514, 481,
- 39, 395, 324, 203, 202, 841, 285, 260, 261, 887,
- 199, 842, 136, 1, 840, 944, 335, 228, 899, 829,
- 521, 531, 531, 531, 531, 531, 531, 531, 531, 531,
+ 521, 521, 790, 759, 521, 463, 573, 126, 757, 574,
+ 758, 515, 321, 295, 638, 639, 454, 721, 132, 486,
+ 642, 643, 260, 261, 800, 295, 231, 842, 793, 791,
+ 427, 521, 972, 843, 426, 304, 841, 232, 228, 848,
+ 849, 850, 847, 846, 845, 299, 126, 687, 126, 469,
+ 572, 817, 832, 865, 531, 282, 286, 572, 851, 820,
+ 512, 508, 259, 531, 295, 259, 829, 438, 814, 271,
+ 531, 531, 531, 531, 531, 322, 852, 833, 743, 317,
+ 448, 595, 272, 857, 859, 457, 468, 848, 849, 850,
+ 847, 846, 845, 449, 744, 231, 231, 231, 569, 570,
+ 531, 573, 263, 576, 574, 285, 232, 232, 232, 521,
+ 192, 504, 751, 295, 295, 521, 521, 573, 132, 404,
+ 574, 402, 265, 208, 231, 231, 260, 261, 295, 260,
+ 261, 876, 895, 273, 207, 232, 232, 986, 228, 828,
+ 228, 878, 824, 521, 884, 882, 572, 890, 885, 879,
+ 1008, 179, 182, 183, 801, 726, 45, 987, 189, 191,
+ 821, 559, 259, 901, 572, 904, 231, 438, 231, 338,
+ 1018, 39, 177, 176, 62, 54, 259, 232, 992, 232,
+ 888, 284, 178, 180, 181, 188, 190, 175, 228, 900,
+ 519, 521, 531, 531, 531, 531, 531, 531, 531, 531,
531, 531, 531, 531, 531, 531, 531, 531, 531, 531,
- 531, 531, 531, 531, 531, 531, 531, 531, 519, 259,
- 531, 922, 938, 259, 283, 908, 449, 1008, 256, 39,
- 446, 343, 521, 936, 747, 847, 848, 849, 846, 845,
- 844, 232, 753, 863, 445, 879, 909, 531, 608, 589,
- 590, 519, 521, 591, 231, 521, 873, 894, 521, 684,
- 572, 962, 572, 970, 39, 255, 39, 839, 994, 964,
- 963, 902, 483, 192, 39, 403, 39, 39, 895, 838,
- 521, 835, 575, 260, 261, 572, 970, 260, 261, 956,
- 982, 566, 958, 39, 1005, 961, 1004, 39, 39, 521,
- 724, 572, 394, 389, 993, 164, 572, 995, 341, 997,
- 697, 538, 177, 176, 914, 928, 916, 979, 290, 448,
- 460, 161, 39, 572, 1011, 531, 924, 157, 926, 927,
- 1012, 531, 531, 318, 572, 1015, 992, 314, 127, 919,
- 39, 232, 919, 232, 182, 183, 175, 178, 180, 181,
- 179, 943, 528, 607, 231, 947, 231, 996, 948, 531,
- 969, 968, 967, 192, 39, 966, 837, 836, 834, 401,
- 39, 40, 945, 568, 15, 14, 822, 719, 801, 694,
- 11, 841, 249, 75, 972, 76, 116, 842, 266, 64,
- 840, 232, 89, 598, 90, 520, 101, 74, 12, 326,
- 100, 99, 177, 176, 231, 79, 119, 531, 526, 519,
- 3, 41, 0, 990, 0, 0, 0, 0, 519, 0,
- 0, 0, 0, 0, 0, 519, 519, 519, 519, 519,
- 188, 189, 190, 191, 182, 183, 175, 178, 180, 181,
- 179, 847, 848, 849, 846, 845, 844, 0, 1014, 531,
- 0, 0, 0, 0, 0, 519, 0, 1020, 169, 171,
- 170, 192, 0, 833, 0, 0, 0, 0, 0, 531,
- 558, 0, 531, 0, 0, 531, 0, 685, 0, 0,
- 0, 0, 0, 0, 688, 689, 690, 691, 692, 0,
- 620, 0, 809, 808, 0, 0, 0, 531, 193, 173,
- 177, 176, 209, 210, 211, 212, 214, 215, 216, 217,
- 218, 219, 220, 221, 213, 0, 531, 0, 0, 0,
- 167, 168, 172, 174, 186, 187, 184, 185, 188, 189,
- 190, 191, 182, 183, 175, 178, 180, 181, 179, 0,
- 0, 0, 0, 0, 0, 0, 519, 519, 519, 519,
+ 531, 531, 531, 531, 531, 531, 531, 531, 531, 923,
+ 909, 531, 958, 519, 446, 470, 260, 261, 796, 163,
+ 39, 226, 234, 521, 937, 813, 704, 705, 239, 285,
+ 260, 261, 855, 707, 704, 705, 880, 910, 531, 259,
+ 860, 861, 956, 521, 45, 231, 521, 874, 926, 521,
+ 453, 572, 963, 572, 971, 39, 232, 39, 610, 599,
+ 797, 601, 600, 897, 259, 39, 894, 39, 39, 283,
+ 259, 521, 550, 1004, 999, 256, 572, 971, 961, 936,
+ 957, 983, 902, 959, 39, 126, 962, 761, 39, 39,
+ 521, 760, 572, 723, 652, 994, 650, 572, 996, 647,
+ 998, 602, 469, 260, 261, 915, 514, 917, 980, 481,
+ 395, 324, 203, 39, 572, 1012, 531, 925, 202, 927,
+ 928, 1013, 531, 531, 199, 572, 1016, 993, 260, 261,
+ 920, 39, 136, 920, 260, 261, 1, 830, 748, 754,
+ 448, 864, 944, 445, 609, 231, 948, 231, 589, 949,
+ 531, 842, 590, 449, 591, 39, 232, 843, 232, 685,
+ 841, 39, 255, 946, 840, 995, 965, 964, 903, 483,
+ 896, 519, 839, 836, 566, 973, 1006, 1005, 725, 394,
+ 519, 389, 164, 341, 698, 538, 929, 519, 519, 519,
+ 519, 519, 290, 460, 161, 231, 157, 318, 531, 314,
+ 127, 403, 575, 401, 991, 335, 232, 945, 1009, 343,
+ 939, 848, 849, 850, 847, 846, 845, 519, 528, 608,
+ 997, 970, 969, 968, 967, 838, 169, 171, 170, 192,
+ 837, 835, 40, 568, 15, 14, 823, 720, 802, 1015,
+ 531, 695, 11, 686, 249, 75, 76, 116, 1021, 266,
+ 689, 690, 691, 692, 693, 64, 834, 89, 598, 90,
+ 531, 520, 101, 531, 74, 12, 531, 326, 167, 168,
+ 179, 182, 183, 184, 185, 186, 187, 189, 191, 100,
+ 99, 79, 119, 810, 809, 526, 3, 41, 531, 193,
+ 173, 177, 176, 0, 0, 0, 0, 0, 172, 0,
+ 174, 178, 180, 181, 188, 190, 175, 531, 0, 519,
519, 519, 519, 519, 519, 519, 519, 519, 519, 519,
519, 519, 519, 519, 519, 519, 519, 519, 519, 519,
- 519, 519, 519, 0, 0, 519, 0, 209, 210, 211,
- 212, 214, 215, 216, 217, 218, 219, 220, 221, 213,
- 0, 0, 0, 0, 0, 0, 0, 668, 666, 667,
- 0, 0, 519, 0, 0, 761, 762, 763, 764, 765,
- 766, 767, 768, 769, 770, 771, 772, 773, 774, 775,
- 776, 777, 778, 779, 780, 781, 782, 783, 784, 785,
- 786, 788, 869, 0, 685, 653, 0, 679, 661, 655,
- 654, 209, 210, 211, 212, 214, 215, 216, 217, 218,
- 219, 220, 221, 213, 0, 0, 0, 0, 0, 670,
- 669, 660, 662, 673, 674, 671, 672, 675, 677, 676,
- 678, 663, 664, 665, 656, 658, 659, 657, 0, 0,
- 519, 0, 0, 0, 0, 0, 519, 519, 0, 0,
+ 519, 519, 519, 519, 519, 519, 0, 0, 519, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 349, 0, 0, 0, 0, 31, 0, 0, 0, 0,
- 0, 0, 0, 0, 519, 209, 210, 211, 212, 214,
- 215, 216, 217, 218, 219, 220, 221, 213, 0, 147,
- 151, 155, 0, 0, 0, 165, 0, 0, 0, 868,
- 0, 0, 51, 198, 0, 871, 872, 0, 206, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 223,
- 0, 0, 519, 235, 236, 237, 238, 0, 154, 240,
- 0, 242, 243, 244, 245, 246, 247, 248, 653, 252,
- 0, 661, 655, 654, 262, 205, 0, 0, 0, 276,
- 277, 0, 279, 280, 0, 0, 0, 0, 227, 227,
- 0, 0, 0, 291, 519, 662, 673, 674, 671, 672,
- 675, 677, 676, 678, 663, 664, 665, 656, 658, 659,
- 657, 910, 0, 0, 519, 0, 0, 519, 0, 0,
- 519, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 240, 0, 0, 0, 0,
- 342, 0, 519, 0, 0, 0, 0, 0, 0, 126,
- 0, 121, 0, 942, 0, 0, 0, 0, 0, 0,
- 0, 519, 0, 361, 362, 363, 364, 365, 366, 367,
- 368, 369, 370, 371, 372, 373, 374, 375, 376, 377,
- 378, 379, 380, 381, 382, 383, 384, 385, 0, 387,
- 0, 155, 0, 354, 0, 0, 0, 0, 717, 0,
- 0, 0, 0, 0, 0, 406, 408, 409, 410, 411,
- 412, 413, 414, 415, 416, 417, 418, 419, 229, 0,
- 0, 230, 0, 0, 0, 0, 0, 391, 392, 0,
- 0, 0, 0, 0, 0, 0, 0, 233, 0, 0,
- 0, 0, 0, 0, 0, 0, 240, 0, 0, 433,
- 433, 0, 0, 0, 0, 422, 441, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 716, 0, 0,
- 155, 155, 0, 120, 466, 0, 0, 433, 0, 0,
- 0, 0, 0, 433, 291, 0, 0, 0, 0, 433,
- 433, 0, 0, 155, 443, 0, 433, 496, 0, 0,
- 0, 0, 500, 0, 0, 0, 653, 462, 464, 661,
- 655, 654, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 478, 0, 0, 0, 0,
- 487, 669, 660, 662, 673, 674, 671, 672, 675, 677,
- 676, 678, 663, 664, 665, 656, 658, 659, 657, 549,
- 0, 0, 0, 0, 0, 0, 553, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 4, 0, 83, 84, 72, 18, 105, 106, 13,
- 88, 121, 0, 30, 555, 0, 0, 95, 29, 20,
- 19, 0, 21, 0, 33, 0, 34, 0, 0, 22,
- 0, 155, 0, 23, 24, 38, 45, 16, 25, 36,
- 0, 0, 37, 10, 0, 27, 0, 32, 81, 82,
- 8, 46, 48, 50, 0, 0, 0, 0, 52, 96,
- 0, 94, 110, 111, 112, 107, 108, 0, 582, 0,
- 583, 0, 0, 93, 0, 0, 0, 613, 9, 113,
- 109, 103, 0, 85, 86, 87, 0, 0, 0, 0,
- 80, 53, 0, 0, 0, 78, 42, 28, 47, 49,
- 0, 626, 628, 55, 56, 911, 65, 66, 67, 68,
- 69, 70, 71, 0, 0, 636, 92, 77, 17, 644,
- 35, 0, 63, 0, 97, 0, 0, 0, 58, 57,
- 59, 60, 73, 120, 668, 666, 667, 0, 0, 0,
+ 669, 667, 668, 0, 0, 519, 0, 0, 0, 0,
+ 0, 0, 762, 763, 764, 765, 766, 767, 768, 769,
+ 770, 771, 772, 773, 774, 775, 776, 777, 778, 779,
+ 780, 781, 782, 783, 784, 785, 786, 787, 789, 0,
+ 0, 686, 671, 670, 658, 664, 665, 672, 673, 674,
+ 675, 678, 679, 0, 0, 669, 667, 668, 870, 0,
+ 0, 654, 0, 680, 662, 656, 655, 0, 0, 0,
+ 0, 0, 661, 0, 663, 657, 659, 660, 676, 677,
+ 666, 0, 0, 519, 0, 0, 0, 0, 0, 519,
+ 519, 0, 0, 0, 0, 0, 0, 671, 670, 658,
+ 664, 665, 672, 673, 674, 675, 678, 679, 0, 0,
+ 0, 0, 31, 0, 0, 798, 654, 519, 680, 662,
+ 656, 655, 0, 0, 0, 0, 0, 661, 0, 663,
+ 657, 659, 660, 676, 677, 666, 147, 151, 155, 0,
+ 0, 0, 165, 0, 0, 0, 869, 0, 0, 51,
+ 198, 0, 872, 873, 0, 206, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 519, 223, 0, 0, 0,
+ 235, 236, 237, 238, 192, 154, 240, 0, 242, 243,
+ 244, 245, 246, 247, 248, 0, 252, 0, 0, 0,
+ 0, 262, 205, 0, 0, 0, 276, 277, 0, 279,
+ 280, 0, 0, 0, 0, 227, 227, 519, 0, 0,
+ 291, 0, 0, 167, 168, 179, 182, 183, 184, 185,
+ 186, 187, 189, 191, 0, 0, 0, 519, 911, 0,
+ 519, 0, 0, 519, 193, 173, 177, 176, 0, 0,
+ 0, 0, 0, 172, 0, 174, 178, 180, 181, 188,
+ 190, 175, 240, 0, 0, 519, 0, 342, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 478, 0, 653, 0, 0, 0, 655, 654, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 342, 701,
- 0, 0, 653, 0, 679, 661, 655, 654, 0, 0,
- 711, 673, 674, 671, 672, 675, 677, 676, 678, 663,
- 664, 665, 656, 658, 659, 657, 670, 669, 660, 662,
- 673, 674, 671, 672, 675, 677, 676, 678, 663, 664,
- 665, 656, 658, 659, 657, 0, 0, 0, 0, 433,
- 391, 715, 715, 0, 0, 0, 0, 0, 0, 0,
- 746, 0, 0, 0, 0, 0, 433, 751, 668, 666,
- 667, 0, 0, 0, 0, 155, 0, 0, 0, 422,
- 422, 0, 0, 0, 0, 0, 0, 0, 0, 155,
+ 943, 0, 0, 0, 519, 0, 0, 0, 0, 0,
+ 361, 362, 363, 364, 365, 366, 367, 368, 369, 370,
+ 371, 372, 373, 374, 375, 376, 377, 378, 379, 380,
+ 381, 382, 383, 384, 385, 0, 387, 0, 155, 0,
+ 354, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 406, 408, 409, 410, 411, 412, 413, 414,
+ 415, 416, 417, 418, 419, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 391, 392, 671, 670, 658, 664,
+ 665, 672, 673, 674, 675, 678, 679, 0, 0, 0,
+ 0, 0, 0, 240, 0, 654, 433, 433, 662, 656,
+ 655, 0, 422, 441, 0, 0, 661, 0, 663, 657,
+ 659, 660, 676, 677, 666, 0, 0, 155, 465, 0,
+ 0, 466, 0, 0, 433, 0, 0, 0, 0, 0,
+ 433, 291, 0, 0, 0, 0, 433, 433, 0, 0,
+ 155, 443, 0, 433, 496, 0, 0, 0, 0, 500,
+ 0, 0, 0, 0, 462, 464, 0, 0, 0, 83,
+ 84, 72, 0, 105, 106, 126, 88, 121, 0, 0,
+ 0, 0, 478, 95, 0, 0, 0, 487, 0, 0,
+ 210, 211, 212, 213, 214, 215, 216, 217, 218, 219,
+ 220, 221, 45, 0, 0, 0, 549, 0, 0, 0,
+ 0, 0, 0, 553, 81, 82, 0, 0, 0, 0,
+ 621, 0, 0, 0, 52, 96, 0, 94, 110, 111,
+ 112, 107, 108, 209, 0, 0, 0, 0, 0, 93,
+ 0, 555, 0, 0, 143, 113, 109, 103, 489, 85,
+ 86, 87, 0, 0, 0, 0, 80, 53, 155, 912,
+ 0, 78, 42, 149, 0, 0, 0, 0, 0, 55,
+ 56, 0, 65, 66, 67, 68, 69, 70, 71, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 669, 667,
+ 668, 0, 0, 0, 0, 582, 0, 583, 0, 0,
+ 0, 0, 0, 0, 614, 92, 77, 0, 0, 0,
+ 0, 63, 482, 97, 0, 0, 488, 58, 57, 59,
+ 60, 73, 120, 0, 0, 0, 0, 0, 627, 629,
+ 671, 670, 658, 664, 665, 672, 673, 674, 675, 678,
+ 679, 668, 637, 0, 0, 0, 0, 0, 0, 654,
+ 0, 680, 662, 656, 655, 0, 0, 0, 0, 0,
+ 661, 0, 663, 657, 659, 660, 676, 677, 666, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 478, 0,
+ 0, 671, 670, 658, 664, 665, 672, 673, 674, 675,
+ 678, 679, 0, 0, 192, 342, 702, 0, 0, 0,
+ 654, 0, 680, 662, 656, 655, 0, 712, 0, 0,
+ 0, 661, 0, 663, 657, 659, 660, 676, 677, 666,
+ 210, 211, 212, 213, 214, 215, 216, 217, 218, 219,
+ 220, 221, 0, 0, 0, 179, 182, 183, 184, 185,
+ 186, 187, 189, 191, 558, 0, 433, 391, 716, 716,
+ 0, 669, 667, 668, 0, 173, 177, 176, 747, 0,
+ 0, 0, 0, 209, 433, 752, 178, 180, 181, 188,
+ 190, 175, 0, 155, 0, 0, 422, 422, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 155, 0, 0,
+ 0, 0, 0, 671, 670, 658, 664, 665, 672, 673,
+ 674, 675, 678, 679, 169, 171, 170, 192, 0, 0,
+ 462, 0, 654, 868, 680, 662, 656, 655, 478, 0,
+ 478, 0, 0, 661, 487, 663, 657, 659, 660, 676,
+ 677, 666, 210, 211, 212, 213, 214, 215, 216, 217,
+ 218, 219, 220, 221, 0, 0, 167, 168, 179, 182,
+ 183, 184, 185, 186, 187, 189, 191, 807, 0, 0,
+ 863, 0, 0, 0, 0, 0, 0, 193, 173, 177,
+ 176, 0, 0, 0, 0, 209, 172, 0, 174, 178,
+ 180, 181, 188, 190, 175, 0, 0, 0, 0, 0,
+ 0, 853, 0, 0, 433, 0, 0, 0, 0, 0,
+ 0, 0, 433, 433, 0, 0, 0, 818, 0, 866,
+ 0, 0, 0, 0, 0, 0, 0, 210, 211, 212,
+ 213, 214, 215, 216, 217, 218, 219, 220, 221, 0,
+ 0, 0, 0, 4, 0, 83, 84, 72, 18, 105,
+ 106, 13, 88, 121, 349, 30, 0, 0, 0, 95,
+ 29, 20, 19, 0, 21, 0, 33, 0, 34, 342,
+ 209, 22, 0, 0, 0, 23, 24, 38, 45, 16,
+ 25, 36, 0, 0, 37, 10, 0, 27, 0, 32,
+ 81, 82, 8, 46, 48, 50, 0, 0, 0, 0,
+ 52, 96, 0, 94, 110, 111, 112, 107, 108, 0,
+ 0, 0, 0, 0, 0, 93, 0, 716, 0, 422,
+ 9, 113, 109, 103, 0, 85, 86, 87, 0, 0,
+ 0, 0, 80, 53, 0, 0, 0, 78, 42, 28,
+ 47, 49, 0, 0, 0, 55, 56, 0, 65, 66,
+ 67, 68, 69, 70, 71, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 478, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 92, 77, 17, 645, 35, 0, 63, 0, 97,
+ 0, 0, 0, 58, 57, 59, 60, 73, 120, 4,
+ 0, 83, 84, 72, 18, 105, 106, 13, 88, 121,
+ 0, 30, 0, 0, 0, 95, 29, 20, 19, 0,
+ 21, 0, 33, 0, 34, 0, 0, 22, 0, 0,
+ 0, 23, 24, 38, 45, 16, 25, 36, 0, 0,
+ 37, 10, 0, 27, 0, 32, 81, 82, 8, 46,
+ 48, 50, 0, 0, 0, 0, 52, 96, 0, 94,
+ 110, 111, 112, 107, 108, 0, 0, 0, 0, 0,
+ 0, 93, 0, 0, 0, 0, 9, 113, 109, 103,
+ 0, 85, 86, 87, 0, 0, 0, 0, 80, 53,
+ 0, 0, 0, 78, 42, 28, 47, 49, 0, 0,
+ 0, 55, 56, 0, 65, 66, 67, 68, 69, 70,
+ 71, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 92, 77, 17,
+ 503, 35, 0, 63, 0, 97, 0, 0, 0, 58,
+ 57, 59, 60, 73, 120, 4, 0, 83, 84, 72,
+ 18, 105, 106, 13, 88, 121, 0, 30, 0, 0,
+ 0, 95, 29, 20, 19, 0, 21, 0, 33, 0,
+ 34, 0, 0, 22, 0, 0, 0, 23, 24, 38,
+ 45, 16, 25, 36, 0, 0, 37, 10, 0, 27,
+ 0, 32, 81, 82, 8, 46, 48, 50, 0, 0,
+ 0, 0, 52, 96, 0, 94, 110, 111, 112, 107,
+ 108, 0, 0, 0, 0, 0, 0, 93, 0, 0,
+ 0, 0, 9, 113, 109, 103, 0, 85, 86, 87,
+ 0, 0, 0, 0, 80, 53, 0, 0, 0, 78,
+ 42, 28, 47, 49, 0, 0, 0, 55, 56, 0,
+ 65, 66, 67, 68, 69, 70, 71, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 653, 867, 679, 661,
- 655, 654, 462, 666, 667, 0, 0, 0, 0, 0,
- 478, 0, 478, 0, 0, 0, 487, 0, 0, 0,
- 670, 669, 660, 662, 673, 674, 671, 672, 675, 677,
- 676, 678, 663, 664, 665, 656, 658, 659, 657, 0,
- 653, 0, 679, 661, 655, 654, 0, 0, 0, 806,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 670, 669, 660, 662, 673, 674,
- 671, 672, 675, 677, 676, 678, 663, 664, 665, 656,
- 658, 659, 657, 852, 0, 0, 433, 0, 0, 0,
- 0, 0, 0, 0, 433, 433, 0, 0, 0, 817,
- 0, 865, 0, 0, 0, 0, 0, 0, 4, 0,
- 83, 84, 72, 18, 105, 106, 13, 88, 121, 0,
- 30, 0, 0, 0, 95, 29, 20, 19, 0, 21,
- 0, 33, 0, 34, 0, 0, 22, 0, 0, 0,
- 23, 24, 38, 45, 16, 25, 36, 0, 0, 37,
- 10, 342, 27, 0, 32, 81, 82, 8, 46, 48,
- 50, 0, 0, 0, 0, 52, 96, 0, 94, 110,
- 111, 112, 107, 108, 0, 0, 0, 0, 0, 0,
- 93, 0, 0, 0, 0, 9, 113, 109, 103, 0,
- 85, 86, 87, 0, 0, 0, 0, 80, 53, 715,
- 0, 422, 78, 42, 28, 47, 49, 0, 0, 0,
- 55, 56, 0, 65, 66, 67, 68, 69, 70, 71,
- 0, 0, 0, 92, 77, 17, 503, 35, 0, 63,
- 0, 97, 0, 0, 0, 58, 57, 59, 60, 73,
- 120, 0, 0, 0, 0, 0, 0, 0, 4, 478,
- 83, 84, 72, 18, 105, 106, 13, 88, 121, 0,
- 30, 0, 0, 0, 95, 29, 20, 19, 0, 21,
- 0, 33, 0, 34, 0, 0, 22, 0, 0, 0,
- 23, 24, 38, 45, 16, 25, 36, 0, 0, 37,
- 10, 0, 27, 0, 32, 81, 82, 8, 46, 48,
- 50, 0, 0, 0, 0, 52, 96, 0, 94, 110,
- 111, 112, 107, 108, 0, 0, 0, 0, 0, 0,
- 93, 0, 0, 0, 0, 9, 113, 109, 103, 0,
- 85, 86, 87, 0, 0, 0, 0, 80, 53, 0,
- 0, 0, 78, 42, 28, 47, 49, 0, 0, 0,
- 55, 56, 0, 65, 66, 67, 68, 69, 70, 71,
0, 0, 0, 92, 77, 17, 0, 35, 0, 63,
0, 97, 0, 0, 0, 58, 57, 59, 60, 73,
120, 328, 0, 83, 84, 72, 18, 105, 106, 13,
@@ -872,21 +873,10 @@ var yyAct = [...]int{
109, 103, 0, 85, 86, 87, 0, 0, 0, 0,
80, 53, 0, 0, 0, 78, 42, 28, 47, 49,
0, 0, 0, 55, 56, 0, 65, 66, 67, 68,
- 69, 70, 71, 0, 0, 0, 92, 77, 17, 1021,
- 35, 0, 63, 0, 97, 0, 0, 0, 58, 57,
- 59, 60, 73, 120, 328, 0, 83, 84, 72, 18,
- 105, 106, 13, 88, 121, 0, 30, 0, 0, 0,
- 95, 29, 20, 19, 0, 21, 0, 33, 0, 34,
- 0, 0, 22, 0, 0, 0, 23, 24, 38, 45,
- 0, 25, 36, 0, 0, 37, 0, 0, 27, 0,
- 32, 81, 82, 332, 46, 48, 50, 0, 0, 0,
- 0, 52, 96, 0, 94, 110, 111, 112, 107, 108,
- 0, 0, 0, 0, 0, 0, 93, 0, 0, 0,
- 0, 143, 113, 109, 103, 0, 85, 86, 87, 0,
- 0, 0, 0, 80, 53, 0, 0, 0, 78, 42,
- 28, 47, 49, 0, 0, 0, 55, 56, 0, 65,
- 66, 67, 68, 69, 70, 71, 0, 0, 0, 92,
- 77, 17, 1016, 35, 0, 63, 0, 97, 0, 0,
+ 69, 70, 71, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 92,
+ 77, 17, 1022, 35, 0, 63, 0, 97, 0, 0,
0, 58, 57, 59, 60, 73, 120, 328, 0, 83,
84, 72, 18, 105, 106, 13, 88, 121, 0, 30,
0, 0, 0, 95, 29, 20, 19, 0, 21, 0,
@@ -899,24 +889,13 @@ var yyAct = [...]int{
86, 87, 0, 0, 0, 0, 80, 53, 0, 0,
0, 78, 42, 28, 47, 49, 0, 0, 0, 55,
56, 0, 65, 66, 67, 68, 69, 70, 71, 0,
- 0, 0, 92, 77, 17, 1000, 35, 0, 63, 0,
- 97, 0, 0, 0, 58, 57, 59, 60, 73, 120,
- 328, 0, 83, 84, 72, 18, 105, 106, 13, 88,
- 121, 0, 30, 0, 0, 0, 95, 29, 20, 19,
- 0, 21, 988, 33, 0, 34, 0, 0, 22, 0,
- 0, 0, 23, 24, 38, 45, 0, 25, 36, 0,
- 0, 37, 0, 0, 27, 0, 32, 81, 82, 332,
- 46, 48, 50, 0, 0, 0, 0, 52, 96, 0,
- 94, 110, 111, 112, 107, 108, 0, 0, 0, 0,
- 0, 0, 93, 0, 0, 0, 0, 143, 113, 109,
- 103, 0, 85, 86, 87, 0, 0, 0, 0, 80,
- 53, 0, 0, 0, 78, 42, 28, 47, 49, 0,
- 0, 0, 55, 56, 0, 65, 66, 67, 68, 69,
- 70, 71, 0, 0, 0, 92, 77, 17, 0, 35,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 92, 77, 17, 1017, 35,
0, 63, 0, 97, 0, 0, 0, 58, 57, 59,
60, 73, 120, 328, 0, 83, 84, 72, 18, 105,
106, 13, 88, 121, 0, 30, 0, 0, 0, 95,
- 29, 20, 19, 0, 21, 0, 33, 974, 34, 0,
+ 29, 20, 19, 0, 21, 0, 33, 0, 34, 0,
0, 22, 0, 0, 0, 23, 24, 38, 45, 0,
25, 36, 0, 0, 37, 0, 0, 27, 0, 32,
81, 82, 332, 46, 48, 50, 0, 0, 0, 0,
@@ -925,21 +904,88 @@ var yyAct = [...]int{
143, 113, 109, 103, 0, 85, 86, 87, 0, 0,
0, 0, 80, 53, 0, 0, 0, 78, 42, 28,
47, 49, 0, 0, 0, 55, 56, 0, 65, 66,
- 67, 68, 69, 70, 71, 0, 0, 0, 92, 77,
- 17, 0, 35, 0, 63, 0, 97, 0, 0, 0,
- 58, 57, 59, 60, 73, 120, 328, 0, 83, 84,
- 72, 18, 105, 106, 13, 88, 121, 0, 30, 0,
- 0, 0, 95, 29, 20, 19, 0, 21, 0, 33,
- 0, 34, 0, 0, 22, 0, 0, 0, 23, 24,
- 38, 45, 0, 25, 36, 0, 0, 37, 0, 0,
- 27, 0, 32, 81, 82, 332, 46, 48, 50, 0,
- 0, 0, 0, 52, 96, 0, 94, 110, 111, 112,
- 107, 108, 0, 0, 0, 0, 0, 0, 93, 0,
- 0, 0, 0, 143, 113, 109, 103, 0, 85, 86,
- 87, 0, 0, 0, 0, 80, 53, 0, 0, 0,
- 78, 42, 28, 47, 49, 0, 0, 0, 55, 56,
- 0, 65, 66, 67, 68, 69, 70, 71, 0, 0,
- 0, 92, 77, 17, 973, 35, 0, 63, 0, 97,
+ 67, 68, 69, 70, 71, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 92, 77, 17, 1001, 35, 0, 63, 0, 97,
+ 0, 0, 0, 58, 57, 59, 60, 73, 120, 328,
+ 0, 83, 84, 72, 18, 105, 106, 13, 88, 121,
+ 0, 30, 0, 0, 0, 95, 29, 20, 19, 0,
+ 21, 989, 33, 0, 34, 0, 0, 22, 0, 0,
+ 0, 23, 24, 38, 45, 0, 25, 36, 0, 0,
+ 37, 0, 0, 27, 0, 32, 81, 82, 332, 46,
+ 48, 50, 0, 0, 0, 0, 52, 96, 0, 94,
+ 110, 111, 112, 107, 108, 0, 0, 0, 0, 0,
+ 0, 93, 0, 0, 0, 0, 143, 113, 109, 103,
+ 0, 85, 86, 87, 0, 0, 0, 0, 80, 53,
+ 0, 0, 0, 78, 42, 28, 47, 49, 0, 0,
+ 0, 55, 56, 0, 65, 66, 67, 68, 69, 70,
+ 71, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 92, 77, 17,
+ 0, 35, 0, 63, 0, 97, 0, 0, 0, 58,
+ 57, 59, 60, 73, 120, 328, 0, 83, 84, 72,
+ 18, 105, 106, 13, 88, 121, 0, 30, 0, 0,
+ 0, 95, 29, 20, 19, 0, 21, 0, 33, 975,
+ 34, 0, 0, 22, 0, 0, 0, 23, 24, 38,
+ 45, 0, 25, 36, 0, 0, 37, 0, 0, 27,
+ 0, 32, 81, 82, 332, 46, 48, 50, 0, 0,
+ 0, 0, 52, 96, 0, 94, 110, 111, 112, 107,
+ 108, 0, 0, 0, 0, 0, 0, 93, 0, 0,
+ 0, 0, 143, 113, 109, 103, 0, 85, 86, 87,
+ 0, 0, 0, 0, 80, 53, 0, 0, 0, 78,
+ 42, 28, 47, 49, 0, 0, 0, 55, 56, 0,
+ 65, 66, 67, 68, 69, 70, 71, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 92, 77, 17, 0, 35, 0, 63,
+ 0, 97, 0, 0, 0, 58, 57, 59, 60, 73,
+ 120, 328, 0, 83, 84, 72, 18, 105, 106, 13,
+ 88, 121, 0, 30, 0, 0, 0, 95, 29, 20,
+ 19, 0, 21, 0, 33, 0, 34, 0, 0, 22,
+ 0, 0, 0, 23, 24, 38, 45, 0, 25, 36,
+ 0, 0, 37, 0, 0, 27, 0, 32, 81, 82,
+ 332, 46, 48, 50, 0, 0, 0, 0, 52, 96,
+ 0, 94, 110, 111, 112, 107, 108, 0, 0, 0,
+ 0, 0, 0, 93, 0, 0, 0, 0, 143, 113,
+ 109, 103, 0, 85, 86, 87, 0, 0, 0, 0,
+ 80, 53, 0, 0, 0, 78, 42, 28, 47, 49,
+ 0, 0, 0, 55, 56, 0, 65, 66, 67, 68,
+ 69, 70, 71, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 92,
+ 77, 17, 974, 35, 0, 63, 0, 97, 0, 0,
+ 0, 58, 57, 59, 60, 73, 120, 328, 0, 83,
+ 84, 72, 18, 105, 106, 13, 88, 121, 0, 30,
+ 0, 0, 0, 95, 29, 20, 19, 0, 21, 0,
+ 33, 0, 34, 0, 0, 22, 0, 0, 0, 23,
+ 24, 38, 45, 0, 25, 36, 0, 0, 37, 0,
+ 0, 27, 0, 32, 81, 82, 332, 46, 48, 50,
+ 0, 0, 0, 0, 52, 96, 0, 94, 110, 111,
+ 112, 107, 108, 0, 0, 0, 0, 0, 0, 93,
+ 0, 0, 0, 0, 143, 113, 109, 103, 0, 85,
+ 86, 87, 0, 0, 0, 0, 80, 53, 0, 0,
+ 0, 78, 42, 28, 47, 49, 0, 0, 0, 55,
+ 56, 0, 65, 66, 67, 68, 69, 70, 71, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 92, 77, 17, 953, 35,
+ 0, 63, 0, 97, 0, 0, 0, 58, 57, 59,
+ 60, 73, 120, 328, 0, 83, 84, 72, 18, 105,
+ 106, 13, 88, 121, 0, 30, 0, 0, 0, 95,
+ 29, 20, 19, 0, 21, 0, 33, 0, 34, 0,
+ 0, 22, 0, 0, 0, 23, 24, 38, 45, 0,
+ 25, 36, 0, 0, 37, 0, 0, 27, 0, 32,
+ 81, 82, 332, 46, 48, 50, 0, 0, 0, 0,
+ 52, 96, 0, 94, 110, 111, 112, 107, 108, 0,
+ 0, 0, 0, 0, 0, 93, 0, 0, 0, 0,
+ 143, 113, 109, 103, 0, 85, 86, 87, 0, 0,
+ 0, 0, 80, 53, 0, 0, 0, 78, 42, 28,
+ 47, 49, 0, 0, 0, 55, 56, 0, 65, 66,
+ 67, 68, 69, 70, 71, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 92, 77, 17, 952, 35, 0, 63, 0, 97,
0, 0, 0, 58, 57, 59, 60, 73, 120, 328,
0, 83, 84, 72, 18, 105, 106, 13, 88, 121,
0, 30, 0, 0, 0, 95, 29, 20, 19, 0,
@@ -952,25 +998,14 @@ var yyAct = [...]int{
0, 85, 86, 87, 0, 0, 0, 0, 80, 53,
0, 0, 0, 78, 42, 28, 47, 49, 0, 0,
0, 55, 56, 0, 65, 66, 67, 68, 69, 70,
- 71, 0, 0, 0, 92, 77, 17, 952, 35, 0,
- 63, 0, 97, 0, 0, 0, 58, 57, 59, 60,
- 73, 120, 328, 0, 83, 84, 72, 18, 105, 106,
- 13, 88, 121, 0, 30, 0, 0, 0, 95, 29,
- 20, 19, 0, 21, 0, 33, 0, 34, 0, 0,
- 22, 0, 0, 0, 23, 24, 38, 45, 0, 25,
- 36, 0, 0, 37, 0, 0, 27, 0, 32, 81,
- 82, 332, 46, 48, 50, 0, 0, 0, 0, 52,
- 96, 0, 94, 110, 111, 112, 107, 108, 0, 0,
- 0, 0, 0, 0, 93, 0, 0, 0, 0, 143,
- 113, 109, 103, 0, 85, 86, 87, 0, 0, 0,
- 0, 80, 53, 0, 0, 0, 78, 42, 28, 47,
- 49, 0, 0, 0, 55, 56, 0, 65, 66, 67,
- 68, 69, 70, 71, 0, 0, 0, 92, 77, 17,
- 951, 35, 0, 63, 0, 97, 0, 0, 0, 58,
+ 71, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 92, 77, 17,
+ 950, 35, 0, 63, 0, 97, 0, 0, 0, 58,
57, 59, 60, 73, 120, 328, 0, 83, 84, 72,
18, 105, 106, 13, 88, 121, 0, 30, 0, 0,
0, 95, 29, 20, 19, 0, 21, 0, 33, 0,
- 34, 0, 0, 22, 0, 0, 0, 23, 24, 38,
+ 34, 887, 0, 22, 0, 0, 0, 23, 24, 38,
45, 0, 25, 36, 0, 0, 37, 0, 0, 27,
0, 32, 81, 82, 332, 46, 48, 50, 0, 0,
0, 0, 52, 96, 0, 94, 110, 111, 112, 107,
@@ -979,24 +1014,13 @@ var yyAct = [...]int{
0, 0, 0, 0, 80, 53, 0, 0, 0, 78,
42, 28, 47, 49, 0, 0, 0, 55, 56, 0,
65, 66, 67, 68, 69, 70, 71, 0, 0, 0,
- 92, 77, 17, 949, 35, 0, 63, 0, 97, 0,
- 0, 0, 58, 57, 59, 60, 73, 120, 328, 0,
- 83, 84, 72, 18, 105, 106, 13, 88, 121, 0,
- 30, 0, 0, 0, 95, 29, 20, 19, 0, 21,
- 0, 33, 0, 34, 886, 0, 22, 0, 0, 0,
- 23, 24, 38, 45, 0, 25, 36, 0, 0, 37,
- 0, 0, 27, 0, 32, 81, 82, 332, 46, 48,
- 50, 0, 0, 0, 0, 52, 96, 0, 94, 110,
- 111, 112, 107, 108, 0, 0, 0, 0, 0, 0,
- 93, 0, 0, 0, 0, 143, 113, 109, 103, 0,
- 85, 86, 87, 0, 0, 0, 0, 80, 53, 0,
- 0, 0, 78, 42, 28, 47, 49, 0, 0, 0,
- 55, 56, 0, 65, 66, 67, 68, 69, 70, 71,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 92, 77, 17, 0, 35, 0, 63,
0, 97, 0, 0, 0, 58, 57, 59, 60, 73,
120, 328, 0, 83, 84, 72, 18, 105, 106, 13,
88, 121, 0, 30, 0, 0, 0, 95, 29, 20,
- 19, 698, 21, 0, 33, 0, 34, 0, 0, 22,
+ 19, 699, 21, 0, 33, 0, 34, 0, 0, 22,
0, 0, 0, 23, 24, 38, 45, 0, 25, 36,
0, 0, 37, 0, 0, 27, 0, 32, 81, 82,
332, 46, 48, 50, 0, 0, 0, 0, 52, 96,
@@ -1005,21 +1029,10 @@ var yyAct = [...]int{
109, 103, 0, 85, 86, 87, 0, 0, 0, 0,
80, 53, 0, 0, 0, 78, 42, 28, 47, 49,
0, 0, 0, 55, 56, 0, 65, 66, 67, 68,
- 69, 70, 71, 0, 0, 0, 92, 77, 17, 0,
- 35, 0, 63, 0, 97, 0, 0, 0, 58, 57,
- 59, 60, 73, 120, 328, 0, 83, 84, 72, 18,
- 105, 106, 13, 88, 121, 0, 30, 0, 0, 0,
- 95, 29, 20, 19, 0, 21, 0, 33, 0, 34,
- 0, 0, 22, 0, 0, 0, 23, 24, 38, 45,
- 0, 25, 36, 0, 0, 37, 0, 0, 27, 0,
- 32, 81, 82, 332, 46, 48, 50, 0, 0, 0,
- 0, 52, 96, 0, 94, 110, 111, 112, 107, 108,
- 0, 0, 0, 0, 0, 0, 93, 0, 0, 0,
- 0, 143, 113, 109, 103, 0, 85, 86, 87, 0,
- 0, 0, 0, 80, 53, 0, 0, 0, 78, 42,
- 28, 47, 49, 0, 0, 0, 55, 56, 0, 65,
- 66, 67, 68, 69, 70, 71, 0, 0, 0, 92,
- 77, 17, 563, 35, 0, 63, 0, 97, 0, 0,
+ 69, 70, 71, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 92,
+ 77, 17, 0, 35, 0, 63, 0, 97, 0, 0,
0, 58, 57, 59, 60, 73, 120, 328, 0, 83,
84, 72, 18, 105, 106, 13, 88, 121, 0, 30,
0, 0, 0, 95, 29, 20, 19, 0, 21, 0,
@@ -1032,47 +1045,41 @@ var yyAct = [...]int{
86, 87, 0, 0, 0, 0, 80, 53, 0, 0,
0, 78, 42, 28, 47, 49, 0, 0, 0, 55,
56, 0, 65, 66, 67, 68, 69, 70, 71, 0,
- 0, 0, 92, 77, 17, 327, 35, 0, 63, 0,
- 97, 0, 0, 0, 58, 57, 59, 60, 73, 120,
- 328, 0, 83, 84, 72, 18, 105, 106, 13, 88,
- 121, 0, 30, 0, 0, 0, 95, 29, 20, 19,
- 0, 21, 0, 33, 0, 34, 0, 0, 22, 0,
- 0, 0, 23, 24, 38, 45, 0, 25, 36, 0,
- 0, 37, 0, 0, 27, 0, 32, 81, 82, 332,
- 46, 48, 50, 0, 0, 0, 0, 52, 96, 0,
- 94, 110, 111, 112, 107, 108, 0, 0, 0, 0,
- 0, 0, 93, 0, 0, 0, 0, 143, 113, 109,
- 103, 0, 85, 86, 87, 0, 0, 0, 0, 80,
- 53, 0, 0, 0, 78, 42, 28, 47, 49, 0,
- 0, 0, 55, 56, 0, 65, 66, 67, 68, 69,
- 70, 71, 0, 0, 0, 92, 77, 17, 0, 35,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 92, 77, 17, 563, 35,
0, 63, 0, 97, 0, 0, 0, 58, 57, 59,
- 60, 73, 120, 83, 84, 72, 18, 105, 106, 13,
- 88, 121, 0, 30, 0, 0, 0, 95, 29, 20,
- 19, 0, 21, 0, 33, 0, 34, 0, 0, 22,
- 0, 0, 0, 23, 24, 38, 45, 0, 25, 36,
- 0, 0, 37, 0, 0, 27, 0, 32, 81, 82,
- 0, 0, 0, 0, 0, 0, 0, 0, 52, 96,
- 0, 94, 110, 111, 112, 107, 108, 0, 0, 0,
- 0, 0, 0, 93, 0, 0, 0, 0, 143, 113,
- 109, 103, 0, 85, 86, 87, 0, 0, 0, 0,
- 80, 53, 0, 0, 0, 78, 42, 28, 0, 0,
- 0, 0, 0, 55, 56, 0, 65, 66, 67, 68,
- 69, 70, 71, 0, 0, 0, 92, 77, 17, 0,
- 35, 946, 63, 0, 97, 0, 0, 0, 58, 57,
- 59, 60, 73, 120, 83, 84, 72, 18, 105, 106,
- 13, 88, 121, 0, 30, 0, 0, 0, 95, 29,
- 20, 19, 0, 21, 0, 33, 0, 34, 0, 0,
- 22, 0, 0, 0, 23, 24, 38, 45, 0, 25,
- 36, 0, 0, 37, 0, 0, 27, 0, 32, 81,
- 82, 0, 0, 0, 0, 0, 0, 0, 0, 52,
- 96, 0, 94, 110, 111, 112, 107, 108, 0, 0,
- 0, 0, 0, 0, 93, 0, 0, 0, 0, 143,
- 113, 109, 103, 0, 85, 86, 87, 0, 0, 0,
- 0, 80, 53, 0, 0, 0, 78, 42, 28, 0,
- 0, 0, 0, 0, 55, 56, 0, 65, 66, 67,
- 68, 69, 70, 71, 0, 0, 0, 92, 77, 17,
- 0, 35, 920, 63, 0, 97, 0, 0, 0, 58,
+ 60, 73, 120, 328, 0, 83, 84, 72, 18, 105,
+ 106, 13, 88, 121, 0, 30, 0, 0, 0, 95,
+ 29, 20, 19, 0, 21, 0, 33, 0, 34, 0,
+ 0, 22, 0, 0, 0, 23, 24, 38, 45, 0,
+ 25, 36, 0, 0, 37, 0, 0, 27, 0, 32,
+ 81, 82, 332, 46, 48, 50, 0, 0, 0, 0,
+ 52, 96, 0, 94, 110, 111, 112, 107, 108, 0,
+ 0, 0, 0, 0, 0, 93, 0, 0, 0, 0,
+ 143, 113, 109, 103, 0, 85, 86, 87, 0, 0,
+ 0, 0, 80, 53, 0, 0, 0, 78, 42, 28,
+ 47, 49, 0, 0, 0, 55, 56, 0, 65, 66,
+ 67, 68, 69, 70, 71, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 92, 77, 17, 327, 35, 0, 63, 0, 97,
+ 0, 0, 0, 58, 57, 59, 60, 73, 120, 328,
+ 0, 83, 84, 72, 18, 105, 106, 13, 88, 121,
+ 0, 30, 0, 0, 0, 95, 29, 20, 19, 0,
+ 21, 0, 33, 0, 34, 0, 0, 22, 0, 0,
+ 0, 23, 24, 38, 45, 0, 25, 36, 0, 0,
+ 37, 0, 0, 27, 0, 32, 81, 82, 332, 46,
+ 48, 50, 0, 0, 0, 0, 52, 96, 0, 94,
+ 110, 111, 112, 107, 108, 0, 0, 0, 0, 0,
+ 0, 93, 0, 0, 0, 0, 143, 113, 109, 103,
+ 0, 85, 86, 87, 0, 0, 0, 0, 80, 53,
+ 0, 0, 0, 78, 42, 28, 47, 49, 0, 0,
+ 0, 55, 56, 0, 65, 66, 67, 68, 69, 70,
+ 71, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 92, 77, 17,
+ 0, 35, 0, 63, 0, 97, 0, 0, 0, 58,
57, 59, 60, 73, 120, 83, 84, 72, 18, 105,
106, 13, 88, 121, 0, 30, 0, 0, 0, 95,
29, 20, 19, 0, 21, 0, 33, 0, 34, 0,
@@ -1084,21 +1091,41 @@ var yyAct = [...]int{
143, 113, 109, 103, 0, 85, 86, 87, 0, 0,
0, 0, 80, 53, 0, 0, 0, 78, 42, 28,
0, 0, 0, 0, 0, 55, 56, 0, 65, 66,
- 67, 68, 69, 70, 71, 0, 0, 0, 92, 77,
- 17, 0, 35, 721, 63, 0, 97, 0, 0, 0,
- 58, 57, 59, 60, 73, 120, 83, 84, 72, 18,
- 105, 106, 13, 88, 121, 0, 30, 0, 0, 0,
- 95, 29, 20, 19, 0, 21, 0, 33, 0, 34,
- 0, 0, 22, 0, 0, 0, 23, 24, 38, 45,
- 0, 25, 36, 0, 0, 37, 0, 0, 27, 0,
- 32, 81, 82, 0, 0, 0, 0, 0, 0, 0,
- 0, 52, 96, 0, 94, 110, 111, 112, 107, 108,
- 0, 0, 0, 0, 0, 0, 93, 0, 0, 0,
- 0, 143, 113, 109, 103, 0, 85, 86, 87, 0,
- 0, 0, 0, 80, 53, 0, 0, 0, 78, 42,
- 28, 0, 0, 0, 0, 0, 55, 56, 0, 65,
- 66, 67, 68, 69, 70, 71, 0, 0, 0, 92,
- 77, 17, 0, 35, 337, 63, 0, 97, 0, 0,
+ 67, 68, 69, 70, 71, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 92, 77, 17, 0, 35, 947, 63, 0, 97,
+ 0, 0, 0, 58, 57, 59, 60, 73, 120, 83,
+ 84, 72, 18, 105, 106, 13, 88, 121, 0, 30,
+ 0, 0, 0, 95, 29, 20, 19, 0, 21, 0,
+ 33, 0, 34, 0, 0, 22, 0, 0, 0, 23,
+ 24, 38, 45, 0, 25, 36, 0, 0, 37, 0,
+ 0, 27, 0, 32, 81, 82, 0, 0, 0, 0,
+ 0, 0, 0, 0, 52, 96, 0, 94, 110, 111,
+ 112, 107, 108, 0, 0, 0, 0, 0, 0, 93,
+ 0, 0, 0, 0, 143, 113, 109, 103, 0, 85,
+ 86, 87, 0, 0, 0, 0, 80, 53, 0, 0,
+ 0, 78, 42, 28, 0, 0, 0, 0, 0, 55,
+ 56, 0, 65, 66, 67, 68, 69, 70, 71, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 92, 77, 17, 0, 35,
+ 921, 63, 0, 97, 0, 0, 0, 58, 57, 59,
+ 60, 73, 120, 83, 84, 72, 18, 105, 106, 13,
+ 88, 121, 0, 30, 0, 0, 0, 95, 29, 20,
+ 19, 0, 21, 0, 33, 0, 34, 0, 0, 22,
+ 0, 0, 0, 23, 24, 38, 45, 0, 25, 36,
+ 0, 0, 37, 0, 0, 27, 0, 32, 81, 82,
+ 0, 0, 0, 0, 0, 0, 0, 0, 52, 96,
+ 0, 94, 110, 111, 112, 107, 108, 0, 0, 0,
+ 0, 0, 0, 93, 0, 0, 0, 0, 143, 113,
+ 109, 103, 0, 85, 86, 87, 0, 0, 0, 0,
+ 80, 53, 0, 0, 0, 78, 42, 28, 0, 0,
+ 0, 0, 0, 55, 56, 0, 65, 66, 67, 68,
+ 69, 70, 71, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 92,
+ 77, 17, 0, 35, 722, 63, 0, 97, 0, 0,
0, 58, 57, 59, 60, 73, 120, 83, 84, 72,
18, 105, 106, 13, 88, 121, 0, 30, 0, 0,
0, 95, 29, 20, 19, 0, 21, 0, 33, 0,
@@ -1111,546 +1138,549 @@ var yyAct = [...]int{
0, 0, 0, 0, 80, 53, 0, 0, 0, 78,
42, 28, 0, 0, 0, 0, 0, 55, 56, 0,
65, 66, 67, 68, 69, 70, 71, 0, 0, 0,
- 92, 77, 17, 0, 35, 334, 63, 0, 97, 0,
- 0, 0, 58, 57, 59, 60, 73, 120, 83, 84,
- 72, 18, 105, 106, 13, 88, 121, 0, 30, 0,
- 0, 0, 95, 29, 20, 19, 0, 21, 0, 33,
- 0, 34, 0, 0, 22, 0, 0, 0, 23, 24,
- 38, 45, 0, 25, 36, 0, 0, 37, 0, 0,
- 27, 0, 32, 81, 82, 0, 0, 0, 0, 0,
- 0, 0, 0, 52, 96, 0, 94, 110, 111, 112,
- 107, 108, 0, 0, 0, 0, 0, 0, 93, 0,
- 0, 0, 0, 143, 113, 109, 103, 0, 85, 86,
- 87, 0, 192, 0, 0, 80, 53, 0, 0, 0,
- 78, 42, 28, 0, 0, 0, 0, 0, 55, 56,
- 0, 65, 66, 67, 68, 69, 70, 71, 0, 0,
- 0, 92, 77, 17, 0, 35, 0, 63, 0, 97,
- 173, 177, 176, 58, 57, 59, 60, 73, 120, 169,
- 171, 170, 192, 0, 0, 0, 0, 0, 0, 0,
- 0, 167, 168, 172, 174, 186, 187, 184, 185, 188,
- 189, 190, 191, 182, 183, 175, 178, 180, 181, 179,
- 0, 0, 862, 0, 0, 0, 0, 0, 0, 193,
- 173, 177, 176, 169, 171, 170, 192, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 167, 168, 172, 174, 186, 187, 184, 185, 188,
- 189, 190, 191, 182, 183, 175, 178, 180, 181, 179,
- 0, 0, 857, 193, 173, 177, 176, 668, 666, 667,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 794, 0, 0, 167, 168, 172, 174, 186,
- 187, 184, 185, 188, 189, 190, 191, 182, 183, 175,
- 178, 180, 181, 179, 797, 653, 0, 679, 661, 655,
- 654, 668, 666, 667, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 755, 0, 0, 670,
- 669, 660, 662, 673, 674, 671, 672, 675, 677, 676,
- 678, 663, 664, 665, 656, 658, 659, 657, 0, 653,
- 0, 679, 661, 655, 654, 169, 171, 170, 192, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 670, 669, 660, 662, 673, 674, 671,
- 672, 675, 677, 676, 678, 663, 664, 665, 656, 658,
- 659, 657, 0, 0, 0, 193, 173, 177, 176, 0,
- 0, 0, 0, 169, 171, 170, 192, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 167, 168, 172,
- 174, 186, 187, 184, 185, 188, 189, 190, 191, 182,
- 183, 175, 178, 180, 181, 179, 752, 0, 0, 0,
- 0, 0, 0, 193, 173, 177, 176, 0, 0, 0,
- 0, 169, 171, 170, 192, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 167, 168, 172, 174, 186,
- 187, 184, 185, 188, 189, 190, 191, 182, 183, 175,
- 178, 180, 181, 179, 708, 0, 0, 0, 0, 0,
- 0, 193, 173, 177, 176, 0, 0, 0, 0, 169,
- 171, 170, 192, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 167, 168, 172, 174, 186, 187, 184,
- 185, 188, 189, 190, 191, 182, 183, 175, 178, 180,
- 181, 179, 643, 0, 0, 0, 0, 0, 0, 193,
- 173, 177, 176, 0, 0, 0, 0, 169, 171, 170,
- 192, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 167, 168, 172, 174, 186, 187, 184, 185, 188,
- 189, 190, 191, 182, 183, 175, 178, 180, 181, 179,
- 640, 0, 0, 0, 0, 0, 0, 193, 173, 177,
- 176, 169, 171, 170, 192, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 167,
- 168, 172, 174, 186, 187, 184, 185, 188, 189, 190,
- 191, 182, 183, 175, 178, 180, 181, 179, 622, 0,
- 0, 193, 173, 177, 176, 0, 0, 0, 0, 169,
- 171, 170, 192, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 167, 168, 172, 174, 186, 187, 184,
- 185, 188, 189, 190, 191, 182, 183, 175, 178, 180,
- 181, 179, 603, 0, 0, 0, 0, 0, 0, 193,
- 173, 177, 176, 0, 0, 169, 171, 170, 192, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 476, 167, 168, 172, 174, 186, 187, 184, 185, 188,
- 189, 190, 191, 182, 183, 175, 178, 180, 181, 179,
- 554, 0, 0, 0, 0, 193, 173, 177, 176, 169,
- 171, 170, 192, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 167, 168, 172,
- 174, 186, 187, 184, 185, 188, 189, 190, 191, 182,
- 183, 175, 178, 180, 181, 179, 0, 0, 0, 193,
- 173, 177, 176, 169, 171, 170, 192, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 405, 0,
- 0, 167, 168, 172, 174, 186, 187, 184, 185, 188,
- 189, 190, 191, 182, 183, 175, 178, 180, 181, 179,
- 429, 0, 0, 193, 173, 177, 176, 169, 171, 170,
- 192, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 167, 168, 172, 174, 186,
- 187, 184, 185, 188, 189, 190, 191, 182, 183, 175,
- 178, 180, 181, 179, 0, 0, 0, 193, 173, 177,
- 176, 0, 0, 0, 169, 171, 170, 192, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 167,
- 168, 172, 174, 186, 187, 184, 185, 188, 189, 190,
- 191, 182, 183, 175, 178, 180, 181, 179, 397, 0,
- 0, 0, 0, 0, 193, 173, 177, 176, 0, 0,
- 0, 169, 171, 170, 192, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 167, 168, 172, 174,
- 186, 187, 184, 185, 188, 189, 190, 191, 182, 183,
- 175, 178, 180, 181, 179, 347, 0, 0, 0, 0,
- 0, 193, 173, 177, 176, 0, 0, 0, 169, 171,
- 170, 192, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 167, 168, 172, 174, 186, 187, 184,
- 185, 188, 189, 190, 191, 182, 183, 175, 178, 180,
- 181, 179, 346, 0, 0, 0, 0, 0, 193, 173,
- 177, 176, 0, 0, 0, 169, 171, 170, 192, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 167, 168, 172, 174, 186, 187, 184, 185, 188, 189,
- 190, 191, 182, 183, 175, 178, 180, 181, 179, 166,
- 0, 0, 0, 0, 0, 193, 173, 177, 176, 668,
- 666, 667, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 167, 168, 172,
- 174, 186, 187, 184, 185, 188, 189, 190, 191, 182,
- 183, 175, 178, 180, 181, 179, 0, 653, 0, 679,
- 661, 655, 654, 169, 171, 170, 192, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 670, 669, 660, 662, 673, 674, 671, 672, 675,
- 677, 676, 678, 663, 664, 665, 656, 658, 659, 657,
- 0, 0, 0, 193, 173, 177, 176, 171, 170, 192,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 167, 168, 172, 174, 186,
- 187, 184, 185, 188, 189, 190, 191, 182, 183, 175,
- 178, 180, 181, 179, 0, 0, 193, 173, 177, 176,
- 0, 667, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 167, 168,
- 172, 174, 186, 187, 184, 185, 188, 189, 190, 191,
- 182, 183, 175, 178, 180, 181, 179, 653, 0, 679,
- 661, 655, 654, 170, 192, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 670, 669, 660, 662, 673, 674, 671, 672, 675,
- 677, 676, 678, 663, 664, 665, 656, 658, 659, 657,
- 0, 193, 173, 177, 176, 192, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 167, 168, 172, 174, 186, 187, 184,
- 185, 188, 189, 190, 191, 182, 183, 175, 178, 180,
- 181, 179, 193, 173, 177, 176, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 167, 168, 172, 174, 186, 187,
- 184, 185, 188, 189, 190, 191, 182, 183, 175, 178,
- 180, 181, 179, 653, 0, 679, 661, 655, 654, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 670, 669, 660,
- 662, 673, 674, 671, 672, 675, 677, 676, 678, 663,
- 664, 665, 656, 658, 659, 657, 653, 0, 0, 661,
- 655, 654, 192, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 670, 669, 660, 662, 673, 674, 671, 672, 675, 677,
- 676, 678, 663, 664, 665, 656, 658, 659, 657, 0,
- 173, 177, 176, 0, 0, 0, 0, 83, 84, 72,
- 0, 105, 106, 126, 88, 121, 0, 0, 0, 0,
- 0, 95, 168, 172, 174, 186, 187, 184, 185, 188,
- 189, 190, 191, 182, 183, 175, 178, 180, 181, 179,
- 45, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 81, 82, 0, 0, 0, 0, 0, 0,
- 0, 0, 52, 96, 0, 94, 110, 111, 112, 107,
- 108, 0, 0, 0, 0, 0, 0, 93, 0, 0,
- 0, 0, 143, 113, 109, 103, 489, 85, 86, 87,
- 0, 0, 0, 0, 80, 53, 0, 0, 0, 78,
- 42, 149, 0, 0, 0, 0, 0, 55, 56, 0,
- 65, 66, 67, 68, 69, 70, 71, 0, 0, 653,
- 92, 77, 661, 655, 654, 0, 63, 482, 97, 0,
- 0, 488, 58, 57, 59, 60, 73, 120, 0, 0,
- 0, 0, 0, 0, 0, 660, 662, 673, 674, 671,
- 672, 675, 677, 676, 678, 663, 664, 665, 656, 658,
- 659, 657, 83, 84, 72, 0, 105, 106, 126, 88,
- 121, 0, 0, 0, 0, 0, 95, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 45, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 81, 82, 0,
- 0, 0, 0, 0, 0, 0, 0, 52, 96, 0,
- 94, 110, 111, 112, 107, 108, 0, 0, 0, 0,
- 0, 0, 93, 0, 192, 0, 0, 143, 113, 109,
- 103, 489, 85, 86, 87, 0, 0, 0, 0, 80,
- 53, 0, 0, 0, 78, 148, 149, 0, 0, 0,
- 0, 0, 55, 56, 0, 65, 66, 67, 68, 69,
- 70, 71, 173, 177, 176, 92, 77, 0, 0, 0,
- 0, 63, 0, 97, 0, 0, 488, 58, 57, 59,
- 60, 73, 120, 0, 0, 172, 174, 186, 187, 184,
- 185, 188, 189, 190, 191, 182, 183, 175, 178, 180,
- 181, 179, 83, 84, 72, 0, 105, 106, 126, 88,
- 121, 0, 0, 0, 0, 0, 95, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 45, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 81, 82, 0,
- 0, 0, 0, 0, 0, 0, 0, 52, 96, 0,
- 94, 110, 111, 112, 107, 108, 0, 0, 0, 0,
- 0, 0, 93, 0, 0, 0, 0, 143, 113, 109,
- 103, 0, 85, 86, 87, 192, 0, 0, 0, 80,
- 53, 0, 0, 0, 78, 148, 149, 0, 0, 0,
- 0, 0, 55, 56, 0, 65, 66, 67, 68, 69,
- 70, 71, 0, 0, 0, 92, 77, 0, 0, 0,
- 0, 63, 0, 97, 177, 176, 866, 58, 57, 59,
- 60, 73, 120, 83, 84, 72, 0, 105, 106, 126,
- 88, 121, 0, 0, 0, 0, 0, 95, 186, 187,
- 184, 185, 188, 189, 190, 191, 182, 183, 175, 178,
- 180, 181, 179, 0, 0, 0, 45, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 81, 82,
- 0, 0, 0, 0, 0, 0, 0, 0, 52, 96,
- 0, 94, 110, 111, 112, 107, 108, 0, 0, 0,
- 0, 0, 0, 93, 0, 0, 0, 0, 143, 113,
- 109, 103, 0, 85, 86, 87, 0, 0, 0, 0,
- 80, 53, 0, 0, 0, 78, 148, 149, 0, 0,
- 0, 0, 0, 55, 56, 0, 65, 66, 67, 68,
- 69, 70, 71, 0, 0, 0, 92, 77, 0, 0,
- 0, 0, 63, 0, 97, 0, 0, 629, 58, 57,
- 59, 60, 73, 120, 83, 84, 72, 0, 105, 106,
- 126, 88, 121, 0, 0, 0, 0, 0, 95, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 45, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 81,
- 82, 0, 0, 0, 0, 0, 0, 0, 0, 52,
- 96, 0, 94, 110, 111, 112, 107, 108, 0, 0,
- 0, 0, 0, 0, 93, 0, 192, 0, 0, 143,
- 113, 109, 103, 0, 85, 86, 87, 0, 0, 0,
- 0, 80, 53, 0, 0, 0, 78, 148, 149, 0,
- 0, 0, 0, 0, 55, 56, 0, 65, 66, 67,
- 68, 69, 70, 71, 173, 177, 176, 92, 77, 0,
- 0, 0, 0, 63, 0, 97, 0, 0, 627, 58,
- 57, 59, 60, 73, 120, 0, 0, 0, 174, 186,
- 187, 184, 185, 188, 189, 190, 191, 182, 183, 175,
- 178, 180, 181, 179, 83, 84, 72, 0, 105, 106,
- 126, 88, 121, 0, 0, 0, 0, 0, 95, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 45, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 81,
- 82, 0, 0, 0, 0, 0, 0, 0, 0, 52,
- 96, 0, 94, 110, 111, 112, 107, 108, 0, 0,
- 0, 0, 0, 0, 93, 0, 0, 0, 0, 143,
- 113, 109, 103, 0, 85, 86, 87, 0, 0, 0,
- 0, 80, 53, 0, 0, 0, 78, 148, 149, 0,
- 0, 0, 0, 0, 55, 56, 0, 65, 66, 67,
- 68, 69, 70, 71, 0, 0, 0, 92, 77, 0,
- 0, 0, 0, 63, 0, 97, 0, 0, 292, 58,
- 57, 59, 60, 73, 120, 83, 84, 72, 0, 105,
- 106, 126, 88, 121, 0, 0, 0, 0, 0, 95,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 45, 0,
+ 0, 0, 0, 92, 77, 17, 0, 35, 337, 63,
+ 0, 97, 0, 0, 0, 58, 57, 59, 60, 73,
+ 120, 83, 84, 72, 18, 105, 106, 13, 88, 121,
+ 0, 30, 0, 0, 0, 95, 29, 20, 19, 0,
+ 21, 0, 33, 0, 34, 0, 0, 22, 0, 0,
+ 0, 23, 24, 38, 45, 0, 25, 36, 0, 0,
+ 37, 0, 0, 27, 0, 32, 81, 82, 0, 0,
+ 0, 0, 0, 0, 0, 0, 52, 96, 0, 94,
+ 110, 111, 112, 107, 108, 0, 0, 0, 0, 0,
+ 0, 93, 0, 0, 0, 0, 143, 113, 109, 103,
+ 0, 85, 86, 87, 0, 0, 0, 0, 80, 53,
+ 0, 0, 0, 78, 42, 28, 0, 0, 0, 0,
+ 0, 55, 56, 0, 65, 66, 67, 68, 69, 70,
+ 71, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 92, 77, 17,
+ 0, 35, 334, 63, 0, 97, 0, 0, 0, 58,
+ 57, 59, 60, 73, 120, 83, 84, 72, 18, 105,
+ 106, 13, 88, 121, 0, 30, 0, 0, 0, 95,
+ 29, 20, 19, 0, 21, 0, 33, 0, 34, 0,
+ 0, 22, 0, 0, 0, 23, 24, 38, 45, 0,
+ 25, 36, 0, 0, 37, 0, 0, 27, 0, 32,
81, 82, 0, 0, 0, 0, 0, 0, 0, 0,
52, 96, 0, 94, 110, 111, 112, 107, 108, 0,
0, 0, 0, 0, 0, 93, 0, 0, 0, 0,
- 143, 113, 109, 103, 0, 85, 86, 87, 0, 192,
+ 143, 113, 109, 103, 0, 85, 86, 87, 0, 0,
+ 0, 0, 80, 53, 0, 0, 0, 78, 42, 28,
+ 0, 0, 0, 0, 0, 55, 56, 0, 65, 66,
+ 67, 68, 69, 70, 71, 83, 84, 72, 0, 105,
+ 106, 126, 88, 121, 0, 0, 0, 0, 0, 95,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 92, 77, 17, 0, 35, 0, 63, 45, 97,
+ 0, 0, 0, 58, 57, 59, 60, 73, 120, 0,
+ 81, 82, 0, 0, 0, 0, 0, 0, 0, 0,
+ 52, 96, 0, 94, 110, 111, 112, 107, 108, 0,
+ 0, 0, 0, 0, 0, 93, 0, 0, 0, 0,
+ 143, 113, 109, 103, 489, 85, 86, 87, 0, 0,
+ 0, 0, 80, 53, 0, 0, 0, 78, 148, 149,
+ 0, 0, 0, 0, 0, 55, 56, 0, 65, 66,
+ 67, 68, 69, 70, 71, 83, 84, 72, 0, 105,
+ 106, 126, 88, 121, 0, 0, 0, 0, 0, 95,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 92, 77, 0, 0, 0, 0, 63, 45, 97,
+ 0, 0, 488, 58, 57, 59, 60, 73, 120, 0,
+ 81, 82, 0, 0, 0, 0, 0, 0, 0, 0,
+ 52, 96, 0, 94, 110, 111, 112, 107, 108, 0,
+ 0, 0, 0, 0, 0, 93, 0, 0, 0, 0,
+ 143, 113, 109, 103, 0, 85, 86, 87, 0, 0,
+ 0, 0, 80, 53, 0, 0, 0, 78, 148, 149,
+ 0, 0, 0, 0, 0, 55, 56, 0, 65, 66,
+ 67, 68, 69, 70, 71, 83, 84, 72, 0, 105,
+ 106, 126, 88, 121, 0, 0, 0, 0, 0, 95,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 92, 77, 0, 0, 0, 0, 63, 45, 97,
+ 0, 0, 867, 58, 57, 59, 60, 73, 120, 0,
+ 81, 82, 0, 0, 0, 0, 0, 0, 0, 0,
+ 52, 96, 0, 94, 110, 111, 112, 107, 108, 0,
+ 0, 0, 0, 0, 0, 93, 0, 0, 0, 0,
+ 143, 113, 109, 103, 0, 85, 86, 87, 0, 0,
+ 0, 0, 80, 53, 0, 0, 0, 78, 148, 149,
+ 0, 0, 0, 0, 0, 55, 56, 0, 65, 66,
+ 67, 68, 69, 70, 71, 83, 84, 72, 0, 105,
+ 106, 126, 88, 121, 0, 0, 0, 0, 0, 95,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 92, 77, 0, 0, 0, 0, 63, 45, 97,
+ 0, 0, 630, 58, 57, 59, 60, 73, 120, 0,
+ 81, 82, 0, 0, 0, 0, 0, 0, 0, 0,
+ 52, 96, 0, 94, 110, 111, 112, 107, 108, 0,
+ 0, 0, 0, 0, 0, 93, 0, 0, 0, 0,
+ 143, 113, 109, 103, 0, 85, 86, 87, 0, 0,
+ 0, 0, 80, 53, 0, 0, 0, 78, 148, 149,
+ 0, 0, 0, 0, 0, 55, 56, 0, 65, 66,
+ 67, 68, 69, 70, 71, 83, 84, 72, 0, 105,
+ 106, 126, 88, 121, 0, 0, 0, 0, 0, 95,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 92, 77, 0, 0, 0, 0, 63, 45, 97,
+ 0, 0, 628, 58, 57, 59, 60, 73, 120, 0,
+ 81, 82, 0, 0, 0, 0, 0, 0, 0, 0,
+ 52, 96, 0, 94, 110, 111, 112, 107, 108, 0,
+ 0, 0, 0, 0, 0, 93, 0, 0, 0, 0,
+ 143, 113, 109, 103, 0, 85, 86, 87, 0, 0,
+ 0, 0, 80, 53, 0, 0, 0, 78, 148, 149,
+ 0, 0, 0, 0, 0, 55, 56, 0, 65, 66,
+ 67, 68, 69, 70, 71, 83, 84, 72, 0, 105,
+ 106, 126, 88, 121, 0, 0, 0, 0, 0, 95,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 92, 77, 0, 0, 0, 0, 63, 45, 97,
+ 0, 0, 292, 58, 57, 59, 60, 73, 120, 0,
+ 81, 82, 0, 0, 0, 0, 0, 0, 0, 0,
+ 52, 96, 0, 94, 110, 111, 112, 107, 108, 0,
+ 0, 0, 0, 0, 0, 93, 0, 0, 0, 0,
+ 143, 113, 109, 103, 0, 85, 86, 87, 0, 0,
0, 0, 80, 53, 0, 0, 0, 78, 42, 149,
0, 0, 0, 0, 0, 55, 56, 0, 65, 66,
- 67, 68, 69, 70, 71, 0, 0, 0, 92, 77,
- 0, 0, 0, 0, 63, 431, 97, 173, 177, 176,
- 58, 57, 59, 60, 73, 120, 83, 84, 72, 0,
- 105, 106, 126, 88, 121, 0, 0, 0, 0, 0,
- 95, 0, 186, 187, 184, 185, 188, 189, 190, 191,
- 182, 183, 175, 178, 180, 181, 179, 0, 0, 45,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 81, 82, 0, 0, 0, 0, 0, 0, 0,
- 0, 52, 96, 0, 94, 110, 111, 112, 107, 108,
- 0, 0, 0, 0, 0, 0, 93, 0, 0, 0,
- 0, 143, 113, 109, 103, 0, 85, 86, 87, 0,
- 0, 0, 0, 80, 53, 0, 0, 0, 78, 148,
- 149, 0, 0, 0, 0, 0, 55, 56, 0, 65,
- 66, 67, 68, 69, 70, 71, 0, 0, 0, 92,
- 77, 0, 0, 0, 0, 63, 0, 97, 0, 0,
- 407, 58, 57, 59, 60, 73, 120, 83, 84, 72,
+ 67, 68, 69, 70, 71, 0, 0, 83, 84, 72,
0, 105, 106, 126, 88, 121, 0, 0, 0, 0,
0, 95, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 45, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 92, 77, 0, 0, 0, 0, 63, 431, 97,
+ 45, 0, 0, 58, 57, 59, 60, 73, 120, 0,
0, 0, 81, 82, 0, 0, 0, 0, 0, 0,
0, 0, 52, 96, 0, 94, 110, 111, 112, 107,
108, 0, 0, 0, 0, 0, 0, 93, 0, 0,
0, 0, 143, 113, 109, 103, 0, 85, 86, 87,
0, 0, 0, 0, 80, 53, 0, 0, 0, 78,
148, 149, 0, 0, 0, 0, 0, 55, 56, 0,
- 65, 66, 67, 68, 69, 70, 71, 0, 0, 0,
- 92, 77, 0, 0, 0, 388, 63, 0, 97, 0,
- 0, 0, 58, 57, 59, 60, 73, 120, 83, 84,
- 72, 0, 105, 106, 126, 88, 121, 0, 0, 0,
- 0, 0, 95, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 45, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 81, 82, 0, 0, 0, 0, 0,
- 0, 0, 0, 52, 96, 0, 94, 110, 111, 112,
- 107, 108, 0, 0, 0, 0, 0, 0, 93, 0,
- 0, 0, 0, 143, 113, 109, 103, 0, 85, 86,
- 87, 0, 0, 0, 0, 80, 53, 0, 0, 0,
- 78, 148, 149, 0, 0, 0, 0, 0, 55, 56,
- 0, 65, 66, 67, 68, 69, 70, 71, 0, 0,
- 0, 92, 77, 0, 0, 152, 0, 63, 0, 97,
- 0, 0, 0, 58, 57, 59, 60, 73, 120, 83,
- 84, 72, 0, 105, 106, 126, 88, 121, 0, 0,
- 0, 0, 0, 95, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 45, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 81, 82, 0, 0, 0, 0,
- 0, 0, 0, 0, 52, 96, 0, 94, 110, 111,
- 112, 107, 108, 0, 0, 0, 0, 0, 0, 93,
- 0, 0, 0, 0, 143, 113, 109, 103, 0, 85,
- 86, 87, 0, 0, 0, 0, 80, 53, 0, 0,
- 0, 78, 148, 149, 0, 0, 0, 0, 0, 55,
- 56, 0, 65, 66, 67, 68, 69, 70, 71, 0,
- 0, 0, 92, 77, 0, 0, 150, 0, 63, 0,
- 97, 0, 0, 0, 58, 57, 59, 60, 73, 120,
- 83, 84, 72, 0, 105, 106, 126, 88, 121, 0,
- 0, 0, 0, 0, 95, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 45, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 81, 82, 0, 0, 0,
- 0, 0, 0, 0, 0, 52, 96, 0, 94, 110,
- 111, 112, 107, 108, 0, 0, 0, 0, 0, 0,
- 93, 0, 0, 0, 0, 143, 113, 109, 103, 0,
- 85, 86, 87, 0, 0, 0, 0, 80, 53, 0,
- 0, 0, 78, 148, 149, 0, 0, 0, 0, 0,
- 55, 56, 0, 65, 66, 67, 68, 69, 70, 71,
+ 65, 66, 67, 68, 69, 70, 71, 83, 84, 72,
+ 0, 105, 106, 126, 88, 121, 0, 0, 0, 0,
+ 0, 95, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 92, 77, 0, 0, 0, 0, 63,
+ 45, 97, 0, 0, 407, 58, 57, 59, 60, 73,
+ 120, 0, 81, 82, 0, 0, 0, 0, 0, 0,
+ 0, 0, 52, 96, 0, 94, 110, 111, 112, 107,
+ 108, 0, 0, 0, 0, 0, 0, 93, 0, 0,
+ 0, 0, 143, 113, 109, 103, 0, 85, 86, 87,
+ 0, 0, 0, 0, 80, 53, 0, 0, 0, 78,
+ 148, 149, 0, 0, 0, 0, 0, 55, 56, 0,
+ 65, 66, 67, 68, 69, 70, 71, 83, 84, 72,
+ 0, 105, 106, 126, 88, 121, 0, 0, 0, 0,
+ 0, 95, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 92, 77, 0, 0, 0, 388, 63,
+ 45, 97, 0, 0, 0, 58, 57, 59, 60, 73,
+ 120, 0, 81, 82, 0, 0, 0, 0, 0, 0,
+ 0, 0, 52, 96, 0, 94, 110, 111, 112, 107,
+ 108, 0, 0, 0, 0, 0, 0, 93, 0, 0,
+ 0, 0, 143, 113, 109, 103, 0, 85, 86, 87,
+ 0, 0, 0, 0, 80, 53, 0, 0, 0, 78,
+ 148, 149, 0, 0, 0, 0, 0, 55, 56, 0,
+ 65, 66, 67, 68, 69, 70, 71, 83, 84, 72,
+ 0, 105, 106, 126, 88, 121, 0, 0, 0, 0,
+ 0, 95, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 92, 77, 0, 0, 152, 0, 63,
+ 45, 97, 0, 0, 0, 58, 57, 59, 60, 73,
+ 120, 0, 81, 82, 0, 0, 0, 0, 0, 0,
+ 0, 0, 52, 96, 0, 94, 110, 111, 112, 107,
+ 108, 0, 0, 0, 0, 0, 0, 93, 0, 0,
+ 0, 0, 143, 113, 109, 103, 0, 85, 86, 87,
+ 0, 0, 0, 0, 80, 53, 0, 0, 0, 78,
+ 148, 149, 0, 0, 0, 0, 0, 55, 56, 0,
+ 65, 66, 67, 68, 69, 70, 71, 83, 84, 72,
+ 0, 105, 106, 126, 88, 121, 0, 0, 0, 0,
+ 0, 95, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 92, 77, 0, 0, 150, 0, 63,
+ 45, 97, 0, 0, 0, 58, 57, 59, 60, 73,
+ 120, 0, 81, 82, 0, 0, 0, 0, 0, 0,
+ 0, 0, 52, 96, 0, 94, 110, 111, 112, 107,
+ 108, 0, 0, 0, 0, 0, 0, 93, 0, 0,
+ 0, 0, 143, 113, 109, 103, 0, 85, 86, 87,
+ 0, 0, 0, 0, 80, 53, 0, 0, 0, 78,
+ 148, 149, 0, 0, 0, 0, 0, 55, 56, 0,
+ 65, 66, 67, 68, 69, 70, 71, 83, 84, 72,
+ 0, 105, 106, 126, 88, 121, 0, 0, 0, 0,
+ 0, 95, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 92, 77, 0, 0, 146, 0, 63,
+ 45, 97, 0, 0, 0, 58, 57, 59, 60, 73,
+ 120, 0, 81, 82, 0, 0, 0, 0, 0, 0,
+ 0, 0, 52, 96, 0, 94, 110, 111, 112, 107,
+ 108, 0, 0, 0, 0, 0, 0, 93, 0, 0,
+ 0, 0, 143, 113, 109, 103, 0, 85, 86, 87,
+ 0, 0, 0, 0, 80, 53, 0, 0, 0, 78,
+ 148, 149, 0, 0, 0, 0, 0, 55, 56, 0,
+ 65, 66, 67, 68, 69, 70, 71, 83, 84, 72,
+ 0, 105, 106, 126, 442, 121, 0, 0, 0, 0,
+ 0, 95, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 92, 77, 0, 0, 0, 0, 63,
+ 45, 97, 0, 0, 0, 58, 57, 59, 60, 73,
+ 120, 0, 81, 82, 0, 0, 0, 0, 0, 0,
+ 0, 0, 52, 96, 0, 94, 110, 111, 112, 107,
+ 108, 0, 0, 0, 0, 0, 0, 93, 0, 0,
+ 0, 0, 143, 113, 109, 103, 0, 85, 86, 87,
+ 0, 0, 0, 0, 80, 53, 0, 0, 0, 78,
+ 148, 149, 0, 0, 0, 0, 0, 55, 56, 0,
+ 65, 66, 67, 68, 69, 70, 71, 83, 84, 72,
+ 0, 105, 106, 126, 88, 121, 0, 0, 0, 0,
+ 0, 95, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 92, 77, 0, 0, 0, 0, 63,
+ 45, 97, 0, 0, 0, 58, 57, 59, 60, 73,
+ 120, 0, 81, 82, 0, 0, 0, 0, 0, 0,
+ 0, 0, 52, 96, 0, 94, 110, 111, 112, 107,
+ 108, 0, 0, 0, 0, 0, 0, 93, 0, 0,
+ 0, 0, 143, 113, 109, 103, 0, 85, 86, 87,
+ 0, 0, 0, 0, 80, 53, 0, 0, 0, 78,
+ 42, 149, 0, 0, 0, 0, 0, 55, 56, 0,
+ 65, 66, 67, 68, 69, 70, 71, 0, 0, 169,
+ 171, 170, 192, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 92, 77, 795, 0, 0, 0, 63,
0, 97, 0, 0, 0, 58, 57, 59, 60, 73,
- 120, 83, 84, 72, 0, 105, 106, 126, 88, 121,
- 0, 0, 0, 0, 0, 95, 0, 0, 0, 0,
+ 120, 167, 168, 179, 182, 183, 184, 185, 186, 187,
+ 189, 191, 0, 0, 669, 667, 668, 0, 0, 0,
+ 0, 858, 193, 173, 177, 176, 0, 0, 0, 0,
+ 0, 172, 0, 174, 178, 180, 181, 188, 190, 175,
+ 756, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 671, 670, 658, 664,
+ 665, 672, 673, 674, 675, 678, 679, 0, 0, 169,
+ 171, 170, 192, 0, 0, 654, 0, 680, 662, 656,
+ 655, 0, 0, 0, 0, 0, 661, 0, 663, 657,
+ 659, 660, 676, 677, 666, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 45, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 81, 82, 0, 0,
- 0, 0, 0, 0, 0, 0, 52, 96, 0, 94,
- 110, 111, 112, 107, 108, 0, 0, 0, 0, 0,
- 0, 93, 0, 0, 0, 0, 143, 113, 109, 103,
- 0, 85, 86, 87, 0, 0, 0, 0, 80, 53,
- 0, 0, 0, 78, 148, 149, 0, 0, 0, 0,
- 0, 55, 56, 0, 65, 66, 67, 68, 69, 70,
- 71, 0, 0, 0, 92, 77, 0, 0, 0, 0,
- 63, 0, 97, 0, 0, 0, 58, 57, 59, 60,
- 73, 120, 83, 84, 72, 0, 105, 106, 126, 442,
- 121, 0, 0, 0, 0, 0, 95, 0, 0, 0,
+ 0, 167, 168, 179, 182, 183, 184, 185, 186, 187,
+ 189, 191, 169, 171, 170, 192, 0, 0, 0, 0,
+ 0, 0, 193, 173, 177, 176, 0, 0, 0, 0,
+ 0, 172, 0, 174, 178, 180, 181, 188, 190, 175,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 45, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 81, 82, 0,
- 0, 0, 0, 0, 0, 0, 0, 52, 96, 0,
- 94, 110, 111, 112, 107, 108, 0, 0, 0, 0,
- 0, 0, 93, 0, 0, 0, 0, 143, 113, 109,
- 103, 0, 85, 86, 87, 0, 0, 0, 0, 80,
- 53, 0, 0, 0, 78, 148, 149, 0, 0, 0,
- 0, 0, 55, 56, 0, 65, 66, 67, 68, 69,
- 70, 71, 0, 0, 0, 92, 77, 0, 0, 0,
- 0, 63, 0, 97, 0, 0, 0, 58, 57, 59,
- 60, 73, 120, 83, 84, 72, 0, 105, 106, 126,
- 88, 121, 0, 0, 0, 0, 0, 95, 0, 0,
+ 0, 0, 0, 0, 167, 168, 179, 182, 183, 184,
+ 185, 186, 187, 189, 191, 0, 0, 0, 753, 169,
+ 171, 170, 192, 0, 0, 193, 173, 177, 176, 0,
+ 0, 0, 0, 0, 172, 0, 174, 178, 180, 181,
+ 188, 190, 175, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 45, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 81, 82,
- 0, 0, 0, 0, 0, 0, 0, 0, 52, 96,
- 0, 94, 110, 111, 112, 107, 108, 0, 0, 0,
- 0, 0, 0, 93, 0, 0, 0, 0, 143, 113,
- 109, 103, 0, 85, 86, 87, 0, 0, 0, 0,
- 80, 53, 105, 106, 126, 78, 42, 149, 0, 0,
- 0, 0, 529, 55, 56, 0, 65, 66, 67, 68,
- 69, 70, 71, 0, 0, 0, 92, 77, 0, 0,
- 0, 0, 63, 0, 97, 0, 0, 0, 58, 57,
- 59, 60, 73, 120, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 524, 0, 527, 110, 111, 112,
- 107, 108, 0, 0, 0, 0, 0, 0, 530, 0,
- 0, 0, 0, 522, 113, 109, 523, 105, 106, 126,
- 0, 0, 0, 0, 0, 0, 0, 529, 0, 0,
- 0, 0, 233, 0, 0, 0, 0, 0, 0, 0,
+ 0, 167, 168, 179, 182, 183, 184, 185, 186, 187,
+ 189, 191, 0, 0, 0, 709, 169, 171, 170, 192,
+ 0, 0, 193, 173, 177, 176, 0, 0, 0, 0,
+ 0, 172, 0, 174, 178, 180, 181, 188, 190, 175,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 787, 536, 0, 525,
- 0, 0, 0, 535, 534, 532, 533, 0, 0, 524,
- 0, 527, 110, 111, 112, 107, 108, 0, 0, 0,
- 0, 0, 0, 530, 0, 0, 0, 0, 522, 113,
- 109, 523, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 233, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 167, 168,
+ 179, 182, 183, 184, 185, 186, 187, 189, 191, 0,
+ 0, 0, 644, 169, 171, 170, 192, 0, 0, 193,
+ 173, 177, 176, 0, 0, 0, 0, 0, 172, 0,
+ 174, 178, 180, 181, 188, 190, 175, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 167, 168, 179, 182, 183,
+ 184, 185, 186, 187, 189, 191, 0, 0, 0, 641,
+ 169, 171, 170, 192, 0, 0, 193, 173, 177, 176,
+ 0, 0, 0, 0, 0, 172, 0, 174, 178, 180,
+ 181, 188, 190, 175, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 167, 168, 179, 182, 183, 184, 185, 186,
+ 187, 189, 191, 169, 171, 170, 192, 0, 0, 0,
+ 623, 0, 0, 193, 173, 177, 176, 0, 0, 0,
+ 0, 0, 172, 0, 174, 178, 180, 181, 188, 190,
+ 175, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 167, 168, 179, 182, 183,
+ 184, 185, 186, 187, 189, 191, 169, 171, 170, 192,
+ 0, 0, 0, 622, 0, 0, 193, 173, 177, 176,
+ 0, 0, 0, 0, 0, 172, 0, 174, 178, 180,
+ 181, 188, 190, 175, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 167, 168,
+ 179, 182, 183, 184, 185, 186, 187, 189, 191, 0,
+ 0, 0, 603, 169, 171, 170, 192, 0, 0, 193,
+ 173, 177, 176, 0, 0, 0, 0, 0, 172, 0,
+ 174, 178, 180, 181, 188, 190, 175, 476, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 167, 168, 179, 182, 183,
+ 184, 185, 186, 187, 189, 191, 169, 171, 170, 192,
+ 0, 554, 0, 0, 0, 0, 193, 173, 177, 176,
+ 0, 0, 0, 0, 0, 172, 0, 174, 178, 180,
+ 181, 188, 190, 175, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 167, 168,
+ 179, 182, 183, 184, 185, 186, 187, 189, 191, 169,
+ 171, 170, 192, 0, 0, 0, 0, 0, 0, 193,
+ 173, 177, 176, 0, 0, 0, 0, 0, 172, 0,
+ 174, 178, 180, 181, 188, 190, 175, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 405, 0, 0,
+ 0, 167, 168, 179, 182, 183, 184, 185, 186, 187,
+ 189, 191, 0, 0, 0, 0, 0, 0, 0, 429,
+ 0, 0, 193, 173, 177, 176, 169, 171, 170, 192,
+ 0, 172, 0, 174, 178, 180, 181, 188, 190, 175,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 167, 168,
+ 179, 182, 183, 184, 185, 186, 187, 189, 191, 169,
+ 171, 170, 192, 0, 0, 0, 0, 0, 0, 193,
+ 173, 177, 176, 0, 0, 0, 0, 0, 172, 0,
+ 174, 178, 180, 181, 188, 190, 175, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 167, 168, 179, 182, 183, 184, 185, 186, 187,
+ 189, 191, 169, 171, 170, 192, 397, 0, 0, 0,
+ 0, 0, 193, 173, 177, 176, 0, 0, 0, 0,
+ 0, 172, 0, 174, 178, 180, 181, 188, 190, 175,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 167, 168, 179, 182, 183, 184,
+ 185, 186, 187, 189, 191, 169, 171, 170, 192, 347,
+ 0, 0, 0, 0, 0, 193, 173, 177, 176, 0,
+ 0, 0, 0, 0, 172, 0, 174, 178, 180, 181,
+ 188, 190, 175, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 167, 168, 179,
+ 182, 183, 184, 185, 186, 187, 189, 191, 169, 171,
+ 170, 192, 346, 0, 0, 0, 0, 0, 193, 173,
+ 177, 176, 0, 0, 0, 0, 0, 172, 0, 174,
+ 178, 180, 181, 188, 190, 175, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 669, 667, 668,
+ 167, 168, 179, 182, 183, 184, 185, 186, 187, 189,
+ 191, 0, 0, 0, 0, 166, 0, 0, 0, 0,
+ 0, 193, 173, 177, 176, 0, 0, 0, 0, 0,
+ 172, 0, 174, 178, 180, 181, 188, 190, 175, 671,
+ 670, 658, 664, 665, 672, 673, 674, 675, 678, 679,
+ 169, 171, 170, 192, 0, 0, 0, 0, 654, 0,
+ 680, 662, 656, 655, 0, 0, 0, 0, 0, 661,
+ 0, 663, 657, 659, 660, 676, 677, 666, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 667, 668, 167, 168, 179, 182, 183, 184, 185, 186,
+ 187, 189, 191, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 193, 173, 177, 176, 0, 0, 0,
+ 0, 0, 172, 0, 174, 178, 180, 181, 188, 190,
+ 175, 671, 670, 658, 664, 665, 672, 673, 674, 675,
+ 678, 679, 171, 170, 192, 0, 0, 0, 0, 0,
+ 654, 0, 680, 662, 656, 655, 0, 0, 0, 0,
+ 0, 661, 0, 663, 657, 659, 660, 676, 677, 666,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 167, 168, 179, 182, 183, 184, 185,
+ 186, 187, 189, 191, 170, 192, 0, 0, 0, 0,
+ 0, 0, 0, 0, 193, 173, 177, 176, 0, 0,
+ 0, 0, 0, 172, 0, 174, 178, 180, 181, 188,
+ 190, 175, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 167, 168, 179, 182, 183, 184,
+ 185, 186, 187, 189, 191, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 193, 173, 177, 176, 0,
+ 0, 0, 0, 0, 172, 0, 174, 178, 180, 181,
+ 188, 190, 175, 671, 670, 658, 664, 665, 672, 673,
+ 674, 675, 678, 679, 192, 0, 0, 0, 0, 0,
+ 0, 0, 654, 0, 680, 662, 656, 655, 0, 0,
+ 0, 0, 0, 661, 0, 663, 657, 659, 660, 676,
+ 677, 666, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 192, 167, 168, 179, 182, 183, 184, 185,
+ 186, 187, 189, 191, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 173, 177, 176, 0, 0,
+ 0, 0, 0, 172, 0, 174, 178, 180, 181, 188,
+ 190, 175, 168, 179, 182, 183, 184, 185, 186, 187,
+ 189, 191, 192, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 173, 177, 176, 0, 0, 0, 0,
+ 0, 172, 0, 174, 178, 180, 181, 188, 190, 175,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 179, 182, 183, 184, 185, 186, 187,
+ 189, 191, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 173, 177, 176, 0, 0, 0, 0,
+ 0, 172, 0, 174, 178, 180, 181, 188, 190, 175,
+ 658, 664, 665, 672, 673, 674, 675, 678, 679, 192,
+ 0, 0, 0, 0, 0, 0, 0, 654, 0, 0,
+ 662, 656, 655, 0, 0, 0, 0, 0, 0, 0,
+ 663, 657, 659, 660, 676, 677, 666, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 179, 182, 183, 184, 185, 186, 187, 189, 191, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 173, 177, 176, 0, 0, 0, 0, 0, 0, 0,
+ 174, 178, 180, 181, 188, 190, 175, 658, 664, 665,
+ 672, 673, 674, 675, 678, 679, 0, 0, 0, 0,
+ 0, 0, 0, 0, 654, 0, 0, 662, 656, 655,
+ 0, 0, 0, 0, 0, 0, 0, 0, 657, 659,
+ 660, 676, 677, 666, 658, 664, 665, 672, 673, 674,
+ 675, 678, 679, 192, 0, 0, 0, 0, 0, 0,
+ 0, 654, 0, 0, 0, 656, 655, 0, 0, 0,
+ 0, 0, 0, 0, 0, 657, 659, 660, 676, 677,
+ 666, 105, 106, 126, 0, 0, 0, 0, 0, 0,
+ 0, 529, 0, 0, 179, 182, 183, 184, 185, 186,
+ 187, 189, 191, 0, 105, 106, 126, 0, 0, 0,
+ 0, 0, 0, 0, 529, 177, 176, 0, 0, 0,
+ 0, 0, 0, 0, 0, 178, 180, 181, 188, 190,
+ 175, 0, 0, 524, 0, 527, 110, 111, 112, 107,
+ 108, 0, 0, 0, 0, 0, 0, 530, 0, 0,
+ 0, 0, 522, 113, 109, 523, 524, 0, 527, 110,
+ 111, 112, 107, 108, 0, 0, 0, 0, 0, 0,
+ 530, 233, 0, 0, 0, 522, 113, 109, 523, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 233, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 788, 536,
+ 0, 525, 0, 0, 0, 535, 534, 532, 533, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 536, 0, 525, 0, 0, 0, 535, 534,
532, 533,
}
var yyPact = [...]int{
- -1000, -1000, 2286, -1000, -1000, -1000, -1000, -1000, 267, 471,
- 610, 73, -1000, 269, -1000, -1000, 852, -1000, 209, 209,
- 4934, 264, 209, 7826, 7695, 7564, 336, 163, 721, 7957,
- -1000, 5808, 263, 262, 261, -1000, 373, 7957, 850, 53,
- 844, 843, 7957, -1000, -1000, -1000, -1000, 661, -1000, 659,
- -1000, 1185, 258, 7957, 402, 449, 449, 7957, 7957, 7957,
- 7957, -1000, -1000, 8219, -1000, 7957, 7957, 7957, 7957, 7957,
- 7957, 7957, 252, 7957, -1000, 170, 167, 891, 7957, 595,
- 702, 250, 246, 7957, 7957, 245, 7957, 7957, -1000, 166,
- -1000, -1000, 887, 781, -1000, 165, 244, 7040, -1000, 159,
- 156, -1000, 206, 808, 543, -1000, -1000, -1000, -1000, -1000,
- -1000, -1000, -1000, -1000, 103, 160, -1000, 537, 210, -1000,
- 372, -1000, 199, 359, -1000, 808, -1000, 57, 571, 540,
- -1000, 621, 808, -1000, 842, -1000, -17, 4015, 4803, 8219,
- 4672, 718, 53, 485, 7957, 255, -1000, 5761, -1000, 688,
- -1000, 5714, -1000, 333, 1259, 5896, -1000, 56, -1000, -1000,
- 411, 45, 53, -18, 38, 5896, -1000, 7957, 7957, 7957,
- 7957, 7957, 7957, 7957, 7957, 7957, 7957, 7957, 7957, 7957,
- 7957, 7957, 7957, 7957, 7957, 7957, 7957, 7957, 7957, 7957,
- 7957, 7957, 702, 7433, 449, 7957, 841, -1000, 5667, 332,
- 286, -1000, 645, 639, -1000, 1185, 5620, -1000, -1000, 7302,
- 7957, 7957, 7957, 7957, 7957, 7957, 7957, 7957, 7957, 7957,
- 7957, 7957, 404, -1000, -1000, -1000, -1000, -1000, 206, 474,
- 808, 536, 525, -1000, -1000, -115, -115, -47, -115, 196,
- 5576, 195, -115, -115, -115, -115, -115, -115, -115, -1000,
- 7171, -1000, -115, 7957, 7957, 376, 706, 684, -1000, 219,
- 8088, 449, 6065, 67, 210, 524, -1000, 422, 445, 808,
- 583, 103, 160, 513, 7957, 7957, 5896, 5896, 7957, 5896,
- 5896, 7957, 532, 706, 697, -1000, 710, 7957, 7040, 145,
- 30, 5532, 449, 7957, 7957, 839, -1000, 6323, 206, 55,
- 7957, 7957, 103, 372, 68, -1000, 7957, 330, -1000, -1000,
- 2146, 206, -1000, 613, 19, -1000, 609, 808, 7, -1000,
- 606, 808, 838, 604, -27, 8379, -1000, -1000, -1000, -1000,
- -1000, -1000, 241, -1000, -1000, -1000, -1000, -1000, 209, 239,
- 329, 20, 5896, -1000, 325, 324, -1000, -1000, -1000, -1000,
- -1000, 163, -1000, 7957, -1000, -1000, 784, 237, 8379, -1000,
- 7957, 6192, 6464, 5939, 6065, 6024, 6876, 6625, 7169, 4,
- 4, 4, -47, -115, -47, -47, 100, 100, 953, 953,
- 953, 953, 863, 863, 863, 863, -1000, 5488, 7957, 3,
- -1000, -1000, 1121, 715, -3, -39, 3882, -1000, -1000, 228,
- 519, 628, 563, 368, 563, 7957, 6065, 351, 6065, 6065,
- 6065, 6065, 6065, 6065, 6065, 6065, 6065, 6065, 6065, 6065,
- -12, -1000, -1000, 224, 808, 206, 67, 67, 212, -1000,
- -1000, -1000, 142, 5896, 133, -1000, -1000, -1000, -1000, 803,
- 836, 5442, 155, 342, 210, 164, -1000, -1000, 103, 160,
- -1000, 7957, -1000, -1000, 148, 808, 422, 67, 103, 148,
- -22, -1000, 1185, -1000, 1046, 193, 5394, 125, -1000, -1000,
- -1000, 107, 192, -1000, -1000, 6890, 6759, -1000, -1000, 106,
- 99, -1000, -1000, -25, 189, -1000, -1000, 1185, 449, 7957,
- -1000, 210, 210, -1000, -1000, 93, 5350, 210, 210, -1000,
- 5302, -1000, 1759, -1000, -1000, -1000, -1000, 571, 831, 522,
- -1000, 540, 830, 517, -1000, 825, 8379, -1000, 5852, -1000,
- -1000, 422, 443, 808, 216, 8379, -1000, -1000, -1000, -1000,
- 615, 508, 8379, 8379, 8379, 8379, 8379, 188, 447, 4148,
- 3749, 323, 7957, 7957, 399, -1000, 737, -1000, -1000, 5254,
- -40, 519, -1000, 5896, 7957, 4932, 322, 449, 1529, 1529,
- 4541, 821, 8379, 687, 519, 187, -4, -1000, 53, -1000,
- -1000, -1000, 422, 436, 808, 365, 563, -1000, -1000, -29,
- -1000, -1000, 1185, -1000, 702, -43, 404, 404, 206, -1000,
- -1000, 161, 572, 7957, -1000, 67, -1000, -1000, 88, -1000,
- -1000, -1000, -1000, -1000, 7957, -1000, -1000, 154, 147, -1000,
- 7957, 7957, 103, 5206, -1000, 422, -1000, -1000, -1000, 7957,
- -1000, -1000, -1000, -1000, -1000, -1000, 5158, 449, 5896, 449,
- -1000, -1000, -1000, 6478, -1000, -1000, 5896, -1000, -1000, -1000,
- -1000, -1000, -1000, -1000, -1000, -1000, -1000, 818, -1000, -1000,
- 811, -1000, -1000, 8379, 8379, 8379, 8379, 8379, 8379, 8379,
- 8379, 8379, 8379, 8379, 8379, 8379, 8379, 8379, 8379, 8379,
- 8379, 8379, 8379, 8379, 8379, 8379, 8379, 8379, 8379, 8304,
- 808, 422, 8379, 83, -11, 5114, 535, 714, -72, -72,
- -81, -81, 5070, 317, -1000, 209, 4934, 429, 316, -1000,
- 315, 5896, -1000, 7957, 233, 396, 314, 709, -1000, 8379,
- 186, 4932, -1000, -1000, 566, -1000, 449, 215, 566, -1000,
- -1000, -1000, -62, -1000, 679, 213, 184, 676, 519, 412,
- 808, 422, -1000, -29, 1023, 563, 210, 7957, -1000, -32,
- 7957, 572, -1000, 80, 210, -1000, 5026, 572, 7957, 7957,
- 79, 4982, -1000, 570, -1000, 6628, -1000, -1000, -1000, -1000,
- -1000, 1911, -81, -81, -72, -72, -72, -72, 1333, 1788,
- 82, 33, 33, -81, 5982, 6108, 1955, 6314, 1571, -14,
- -14, -14, -14, 91, 91, 91, 91, 8379, 1190, 422,
- 183, -1000, -1000, 8379, 8379, -1000, -1000, -1000, -1000, 4934,
- -1000, 375, 209, 234, -1000, 7957, 1051, -1000, -1000, -1000,
- -1000, -1000, 303, -1000, 676, 182, 1529, -1000, 404, 180,
- 3616, 8379, -1000, 363, 563, 358, 355, 207, -1000, 778,
- -1000, 422, 817, -1000, -1000, 767, -30, -1000, 688, 708,
- -1000, 802, 563, -1000, -1000, -1000, -1000, -1000, -1000, -1000,
- -1000, -1000, 6065, -1000, 77, -1000, -1000, 340, -1000, 62,
- 59, -1000, -1000, -1000, 67, 5896, 449, -1000, 6151, 8379,
- -1000, 1807, 5852, -1000, 296, 220, -1000, 179, -1000, 4148,
- -1000, 352, 4410, -1000, -34, 4410, 294, -1000, -1000, 766,
- -1000, -1000, 172, -64, -1000, -46, -66, -1000, 793, 53,
- -1000, -67, -59, -1000, -1000, -1000, -1000, -1000, -1000, -1000,
- 6151, 8379, -1000, -1000, 4148, 4279, 4148, -1000, -1000, -1000,
- -1000, -1000, -1000, -1000, 3483, 178, 3350, 3217, -37, -1000,
- 744, 8379, -1000, 736, 8379, -70, 791, 8379, -1000, 563,
- -1000, 564, 5852, 4148, -1000, -1000, -1000, 3084, 2951, -1000,
- 346, -1000, -1000, -1000, 171, -1000, -1000, -82, -1000, 8379,
- 205, -1000, -1000, 338, 564, -1000, 292, 290, 670, 703,
- 433, -1000, 2818, -1000, 273, -1000, -1000, 733, 8379, -1000,
- 519, -1000, -1000, -1000, -1000, 563, 708, 789, 214, -1000,
- 2685, -1000, -1000, 177, -80, -1000, 787, -1000, -1000, -1000,
- 685, 281, 563, -1000, -1000, 685, -1000, 202, -1000, -1000,
- -1000, -1000, -1000, 563, 2552, 723, -1000, 58, 345, -1000,
- 2419, -1000,
+ -1000, -1000, 2453, -1000, -1000, -1000, -1000, -1000, 317, 508,
+ 616, 113, -1000, 335, -1000, -1000, 1012, -1000, 261, 261,
+ 5561, 315, 261, 6773, 6663, 6553, 403, 150, 897, 6883,
+ -1000, 8071, 314, 313, 312, -1000, 441, 6883, 1004, 45,
+ 998, 992, 6883, -1000, -1000, -1000, -1000, 762, -1000, 751,
+ -1000, 1813, 308, 6883, 493, 404, 404, 6883, 6883, 6883,
+ 6883, -1000, -1000, 7103, -1000, 6883, 6883, 6883, 6883, 6883,
+ 6883, 6883, 304, 6883, -1000, 183, 182, 948, 6883, 725,
+ 405, 303, 302, 6883, 6883, 299, 6883, 6883, -1000, 181,
+ -1000, -1000, 942, 844, -1000, 179, 298, 6111, -1000, 177,
+ 176, -1000, 283, 965, 647, -1000, -1000, -1000, -1000, -1000,
+ -1000, -1000, -1000, -1000, 130, 138, -1000, 637, 263, -1000,
+ 439, -1000, 243, 371, -1000, 965, -1000, 98, 677, 610,
+ -1000, 726, 965, -1000, 991, -1000, -54, 4481, 5407, 7103,
+ 5253, 828, 45, 564, 6883, 301, -1000, 8018, -1000, 799,
+ -1000, 7965, -1000, 398, 2010, 8163, -1000, 88, -1000, -1000,
+ 300, 69, 45, -55, 60, 8163, -1000, 6883, 6883, 6883,
+ 6883, 6883, 6883, 6883, 6883, 6883, 6883, 6883, 6883, 6883,
+ 6883, 6883, 6883, 6883, 6883, 6883, 6883, 6883, 6883, 6883,
+ 6883, 6883, 405, 6443, 404, 6883, 990, -1000, 7912, 397,
+ 374, -1000, 746, 744, -1000, 1813, 7859, -1000, -1000, 6333,
+ 6883, 6883, 6883, 6883, 6883, 6883, 6883, 6883, 6883, 6883,
+ 6883, 6883, 237, -1000, -1000, -1000, -1000, -1000, 283, 541,
+ 965, 636, 632, -1000, -1000, 463, 463, 496, 463, 238,
+ 7792, 236, 463, 463, 463, 463, 463, 463, 463, -1000,
+ 6221, -1000, 463, 6883, 6883, 443, 733, 730, -1000, 271,
+ 6993, 404, 1334, 195, 263, 618, -1000, 524, 531, 965,
+ 708, 130, 138, 573, 6883, 6883, 8163, 8163, 6883, 8163,
+ 8163, 6883, 626, 733, 917, -1000, 830, 6883, 6111, 171,
+ 7, 7739, 404, 6883, 6883, 989, -1000, 1675, 283, 191,
+ 6883, 6883, 130, 439, 276, -1000, 6883, 396, -1000, -1000,
+ 2297, 283, -1000, 716, 50, -1000, 712, 965, -3, -1000,
+ 711, 965, 986, 662, -57, 8826, -1000, -1000, -1000, -1000,
+ -1000, -1000, 292, -1000, -1000, -1000, -1000, -1000, 261, 290,
+ 395, -18, 8163, -1000, 394, 387, -1000, -1000, -1000, -1000,
+ -1000, 150, -1000, 6883, -1000, -1000, 950, 288, 8826, -1000,
+ 6883, 8432, 8482, 8254, 1334, 8305, 8569, 8693, 1814, 35,
+ 35, 35, 496, 463, 496, 496, 342, 342, 700, 700,
+ 700, 700, 57, 57, 57, 57, -1000, 7686, 6883, 23,
+ -1000, -1000, 1925, 812, 16, -71, 4325, -1000, -1000, 281,
+ 718, 727, 607, 438, 607, 6883, 1334, 282, 1334, 1334,
+ 1334, 1334, 1334, 1334, 1334, 1334, 1334, 1334, 1334, 1334,
+ 13, -1000, -1000, 278, 965, 283, 195, 195, 249, -1000,
+ -1000, -1000, 164, 8163, 162, -1000, -1000, -1000, -1000, 939,
+ 981, 7629, 156, 413, 263, 139, -1000, -1000, 130, 138,
+ -1000, 6883, -1000, -1000, 134, 965, 524, 195, 130, 134,
+ -4, -1000, 1813, -1000, 1583, 7576, 7523, 152, -1000, -1000,
+ -1000, 151, 234, -1000, -1000, 6001, 5891, -1000, -1000, 141,
+ 133, -1000, -1000, -9, 228, -1000, -1000, 1813, 404, 6883,
+ -1000, 263, 263, -1000, -1000, 103, 7466, 263, 263, -1000,
+ 7409, -1000, 2141, -1000, -1000, -1000, -1000, 677, 979, 623,
+ -1000, 610, 976, 611, -1000, 974, 8826, -1000, 8110, -1000,
+ -1000, 524, 529, 965, 274, 8826, -1000, -1000, -1000, -1000,
+ 710, 571, 8826, 8826, 8826, 8826, 8826, 227, 551, 4637,
+ 4169, 386, 6883, 6883, 490, -1000, 892, -1000, -1000, 7352,
+ -75, 718, -1000, 8163, 6883, 8394, 385, 404, 132, 132,
+ 5099, 973, 8826, 794, 718, 219, -30, -1000, 45, -1000,
+ -1000, -1000, 524, 527, 965, 437, 607, -1000, -1000, -43,
+ -1000, -1000, 1813, -1000, 405, -78, 237, 237, 283, -1000,
+ -1000, 149, 704, 6883, -1000, 195, -1000, -1000, 99, -1000,
+ -1000, -1000, -1000, -1000, -1000, 6883, -1000, -1000, 175, 131,
+ -1000, 6883, 6883, 130, 7295, -1000, 524, -1000, -1000, -1000,
+ 6883, -1000, -1000, -1000, -1000, -1000, -1000, 7242, 404, 8163,
+ 404, -1000, -1000, -1000, 5671, -1000, -1000, 8163, -1000, -1000,
+ -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, 971, -1000,
+ -1000, 967, -1000, -1000, 8826, 8826, 8826, 8826, 8826, 8826,
+ 8826, 8826, 8826, 8826, 8826, 8826, 8826, 8826, 8826, 8826,
+ 8826, 8826, 8826, 8826, 8826, 8826, 8826, 8826, 8826, 8826,
+ 8803, 965, 524, 8826, 95, -39, 7187, 654, 898, 128,
+ 128, -53, -53, 1218, 384, -1000, 261, 5561, 509, 383,
+ -1000, 381, 8163, -1000, 6883, 286, 467, 375, 884, -1000,
+ 8826, 211, 8394, -1000, -1000, 673, -1000, 404, 267, 673,
+ -1000, -1000, -1000, -84, -1000, 780, 265, 209, 775, 718,
+ 518, 965, 524, -1000, -43, 1003, 607, 263, 6883, -1000,
+ -10, 6883, 704, -1000, 76, 263, -1000, 7132, 704, 6883,
+ 6883, 73, 1927, -1000, 676, -1000, 5781, -1000, -1000, -1000,
+ -1000, -1000, 1874, -53, -53, 128, 128, 128, 128, 8519,
+ 8643, 8606, 224, 224, -53, 1762, 8344, 8202, 102, -65,
+ 20, 20, 20, 20, -40, -40, -40, -40, 8826, 1163,
+ 524, 200, -1000, -1000, 8826, 8826, -1000, -1000, -1000, -1000,
+ 5561, -1000, 504, 261, 277, -1000, 6883, 1029, -1000, -1000,
+ -1000, -1000, -1000, 372, -1000, 775, 198, 132, -1000, 237,
+ 189, 4013, 8826, -1000, 432, 607, 431, 430, 256, -1000,
+ 944, -1000, 524, 669, -1000, -1000, 941, -23, -1000, 799,
+ 621, -1000, 962, 607, -1000, -1000, -1000, -1000, -1000, -1000,
+ -1000, -1000, -1000, 1334, -1000, 67, -1000, -1000, 410, -1000,
+ 66, 51, -1000, -1000, -1000, 195, 8163, 404, -1000, 1467,
+ 8826, -1000, 1711, 8110, -1000, 367, 250, -1000, 187, -1000,
+ 4637, -1000, 429, 4945, -1000, -13, 4945, 363, -1000, -1000,
+ 926, -1000, -1000, 166, -85, -1000, -26, -100, -1000, 959,
+ 45, -1000, -105, -81, -1000, -1000, -1000, -1000, -1000, -1000,
+ -1000, 1467, 8826, -1000, -1000, 4637, 4791, 4637, -1000, -1000,
+ -1000, -1000, -1000, -1000, -1000, 3857, 185, 3701, 3545, -27,
+ -1000, 920, 8826, -1000, 890, 8826, -106, 958, 8826, -1000,
+ 607, -1000, 702, 8110, 4637, -1000, -1000, -1000, 3389, 3233,
+ -1000, 425, -1000, -1000, -1000, 157, -1000, -1000, -107, -1000,
+ 8826, 254, -1000, -1000, 407, 702, -1000, 353, 347, 772,
+ 808, 570, -1000, 3077, -1000, 344, -1000, -1000, 846, 8826,
+ -1000, 718, -1000, -1000, -1000, -1000, 607, 621, 954, 341,
+ -1000, 2921, -1000, -1000, 158, -79, -1000, 953, -1000, -1000,
+ -1000, 789, 334, 607, -1000, -1000, 789, -1000, 253, -1000,
+ -1000, -1000, -1000, -1000, 607, 2765, 838, -1000, 104, 422,
+ -1000, 2609, -1000,
}
var yyPgo = [...]int{
- 0, 29, 1091, 1090, 38, 31, 30, 572, 1088, 1086,
- 134, 217, 204, 88, 1385, 82, 63, 59, 651, 1422,
- 1085, 33, 1081, 1080, 1079, 136, 1078, 36, 37, 1077,
- 1076, 1075, 1074, 135, 1073, 1072, 24, 1069, 26, 48,
- 45, 1068, 634, 34, 1066, 1, 1065, 1063, 27, 1062,
- 73, 68, 61, 1060, 1059, 1058, 35, 1057, 1056, 4,
- 1055, 1054, 1053, 17, 1051, 1049, 1048, 1047, 1046, 51,
- 5, 1045, 1042, 1041, 1040, 1037, 2, 1033, 631, 1032,
- 39, 0, 1018, 1017, 1013, 117, 1007, 1001, 513, 1000,
- 998, 42, 8, 995, 9, 991, 990, 988, 14, 49,
- 985, 983, 982, 980, 976, 974, 3, 971, 16, 962,
- 961, 959, 958, 955, 28, 952, 951, 950, 949, 948,
- 947, 945, 21, 939, 933, 930, 25, 929, 23, 12,
- 928, 40, 924, 923, 922, 914, 41, 6, 19, 18,
- 22, 911, 907, 902, 13, 869, 866, 865, 15, 863,
- 7, 20,
+ 0, 29, 1177, 22, 21, 1176, 49, 41, 39, 544,
+ 1175, 1172, 164, 217, 228, 180, 1362, 64, 51, 59,
+ 855, 1399, 1171, 33, 1170, 1169, 1157, 136, 1155, 40,
+ 37, 1154, 1152, 1151, 1149, 84, 1148, 1147, 20, 1145,
+ 28, 44, 38, 1139, 854, 36, 1137, 1, 1136, 1135,
+ 7, 1134, 52, 43, 42, 1132, 1131, 1128, 31, 1127,
+ 1126, 4, 1125, 1124, 1123, 16, 1122, 1121, 1120, 1115,
+ 48, 5, 1114, 1113, 1112, 1111, 1110, 2, 1109, 607,
+ 1108, 18, 202, 1100, 1099, 1098, 12, 1097, 1095, 6,
+ 19, 1093, 1092, 1091, 9, 50, 0, 1090, 1089, 1087,
+ 117, 1086, 1084, 642, 1083, 1082, 62, 8, 1076, 1075,
+ 1074, 1073, 14, 47, 1072, 1071, 1069, 1068, 1067, 1066,
+ 3, 1064, 23, 1063, 1062, 1060, 35, 1059, 1058, 1057,
+ 1056, 1055, 1054, 1052, 25, 1049, 1044, 1042, 24, 1038,
+ 15, 17, 1034, 34, 1033, 1031, 1029, 1028, 177, 13,
+ 1027, 1026,
}
var yyR1 = [...]int{
- 0, 149, 80, 80, 81, 81, 3, 3, 3, 3,
- 3, 3, 3, 3, 3, 3, 3, 3, 82, 82,
- 4, 4, 4, 4, 83, 83, 5, 5, 5, 5,
- 84, 84, 6, 6, 6, 6, 53, 53, 85, 85,
- 24, 24, 24, 24, 24, 25, 25, 26, 26, 26,
- 26, 26, 26, 26, 26, 26, 26, 26, 26, 26,
- 26, 26, 26, 26, 26, 26, 26, 26, 26, 26,
- 26, 26, 26, 26, 26, 103, 103, 58, 58, 104,
- 104, 105, 105, 59, 101, 101, 56, 51, 52, 144,
- 144, 145, 145, 60, 61, 61, 64, 64, 64, 64,
- 65, 65, 2, 113, 113, 109, 109, 114, 114, 138,
- 138, 137, 137, 137, 147, 147, 148, 148, 57, 57,
- 102, 102, 141, 141, 141, 141, 99, 99, 99, 150,
- 150, 146, 146, 95, 95, 96, 96, 54, 54, 55,
- 55, 106, 106, 107, 107, 63, 63, 62, 62, 62,
- 62, 140, 140, 140, 115, 115, 69, 69, 69, 69,
- 86, 86, 27, 27, 27, 87, 87, 87, 87, 108,
- 108, 66, 66, 66, 66, 68, 116, 116, 143, 143,
- 117, 117, 118, 118, 70, 70, 71, 119, 119, 74,
- 74, 73, 72, 72, 75, 75, 142, 142, 110, 110,
- 111, 111, 120, 120, 76, 76, 76, 76, 76, 76,
- 112, 112, 112, 112, 67, 67, 100, 100, 98, 98,
- 97, 97, 126, 126, 124, 124, 125, 125, 125, 127,
- 127, 42, 15, 15, 15, 15, 15, 15, 15, 15,
- 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
- 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
- 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
- 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
- 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
- 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
- 15, 15, 15, 15, 15, 15, 50, 50, 50, 50,
- 47, 47, 47, 47, 46, 46, 1, 94, 94, 93,
- 93, 93, 93, 23, 23, 23, 23, 23, 23, 23,
- 23, 11, 11, 11, 11, 45, 45, 45, 43, 43,
- 41, 41, 134, 134, 133, 49, 49, 49, 121, 121,
- 121, 139, 139, 7, 7, 7, 7, 7, 7, 7,
- 7, 7, 7, 7, 7, 8, 28, 78, 78, 78,
- 78, 78, 78, 78, 78, 78, 78, 79, 79, 79,
- 79, 79, 79, 79, 79, 79, 79, 79, 79, 79,
- 79, 79, 79, 79, 79, 79, 79, 79, 79, 79,
- 79, 79, 79, 79, 79, 79, 79, 79, 79, 79,
- 35, 35, 35, 35, 29, 29, 29, 29, 29, 29,
- 29, 122, 122, 151, 151, 123, 123, 123, 123, 14,
- 14, 48, 48, 16, 17, 18, 19, 19, 135, 135,
- 128, 130, 130, 77, 129, 129, 129, 40, 40, 44,
- 44, 12, 22, 22, 20, 20, 20, 21, 21, 21,
- 10, 10, 10, 9, 9, 13, 13, 131, 131, 132,
- 132, 132, 39, 39, 136, 136, 92, 92, 38, 38,
- 38, 91, 91, 90, 90, 90, 90, 90, 90, 90,
- 90, 88, 88, 88, 88, 33, 33, 33, 33, 33,
- 33, 34, 34, 34, 37, 37, 37, 37, 37, 37,
- 37, 37, 89, 89, 36, 36, 30, 30, 31, 32,
+ 0, 151, 95, 95, 96, 96, 5, 5, 5, 5,
+ 5, 5, 5, 5, 5, 5, 5, 5, 97, 97,
+ 6, 6, 6, 6, 98, 98, 7, 7, 7, 7,
+ 99, 99, 8, 8, 8, 8, 55, 55, 100, 100,
+ 26, 26, 26, 26, 26, 27, 27, 28, 28, 28,
+ 28, 28, 28, 28, 28, 28, 28, 28, 28, 28,
+ 28, 28, 28, 28, 28, 28, 28, 28, 28, 28,
+ 28, 28, 28, 28, 28, 117, 117, 60, 60, 118,
+ 118, 119, 119, 61, 115, 115, 58, 53, 54, 149,
+ 149, 150, 150, 62, 63, 63, 66, 66, 66, 66,
+ 91, 91, 2, 93, 93, 92, 92, 126, 126, 90,
+ 90, 89, 89, 89, 87, 87, 86, 86, 59, 59,
+ 116, 116, 84, 84, 84, 84, 113, 113, 113, 4,
+ 4, 88, 88, 109, 109, 110, 110, 56, 56, 57,
+ 57, 120, 120, 121, 121, 65, 65, 64, 64, 64,
+ 64, 82, 82, 82, 127, 127, 70, 70, 70, 70,
+ 101, 101, 29, 29, 29, 102, 102, 102, 102, 122,
+ 122, 67, 67, 67, 67, 69, 128, 128, 83, 83,
+ 129, 129, 130, 130, 71, 71, 72, 131, 131, 75,
+ 75, 74, 73, 73, 76, 76, 85, 85, 123, 123,
+ 124, 124, 132, 132, 77, 77, 77, 77, 77, 77,
+ 125, 125, 125, 125, 68, 68, 114, 114, 112, 112,
+ 111, 111, 138, 138, 136, 136, 137, 137, 137, 139,
+ 139, 44, 17, 17, 17, 17, 17, 17, 17, 17,
+ 17, 17, 17, 17, 17, 17, 17, 17, 17, 17,
+ 17, 17, 17, 17, 17, 17, 17, 17, 17, 17,
+ 17, 17, 17, 17, 17, 17, 17, 17, 17, 17,
+ 17, 17, 17, 17, 17, 17, 17, 17, 17, 17,
+ 17, 17, 17, 17, 17, 17, 17, 17, 17, 17,
+ 17, 17, 17, 17, 17, 17, 17, 17, 17, 17,
+ 17, 17, 17, 17, 17, 17, 52, 52, 52, 52,
+ 49, 49, 49, 49, 48, 48, 1, 94, 94, 108,
+ 108, 108, 108, 25, 25, 25, 25, 25, 25, 25,
+ 25, 13, 13, 13, 13, 47, 47, 47, 45, 45,
+ 43, 43, 146, 146, 145, 51, 51, 51, 133, 133,
+ 133, 81, 81, 9, 9, 9, 9, 9, 9, 9,
+ 9, 9, 9, 9, 9, 10, 30, 79, 79, 79,
+ 79, 79, 79, 79, 79, 79, 79, 80, 80, 80,
+ 80, 80, 80, 80, 80, 80, 80, 80, 80, 80,
+ 80, 80, 80, 80, 80, 80, 80, 80, 80, 80,
+ 80, 80, 80, 80, 80, 80, 80, 80, 80, 80,
+ 37, 37, 37, 37, 31, 31, 31, 31, 31, 31,
+ 31, 134, 134, 3, 3, 135, 135, 135, 135, 16,
+ 16, 50, 50, 18, 19, 20, 21, 21, 147, 147,
+ 140, 142, 142, 78, 141, 141, 141, 42, 42, 46,
+ 46, 14, 24, 24, 22, 22, 22, 23, 23, 23,
+ 12, 12, 12, 11, 11, 15, 15, 143, 143, 144,
+ 144, 144, 41, 41, 148, 148, 107, 107, 40, 40,
+ 40, 106, 106, 105, 105, 105, 105, 105, 105, 105,
+ 105, 103, 103, 103, 103, 35, 35, 35, 35, 35,
+ 35, 35, 36, 36, 36, 39, 39, 39, 39, 39,
+ 39, 39, 39, 104, 104, 38, 38, 32, 32, 33,
+ 34,
}
var yyR2 = [...]int{
@@ -1703,115 +1733,116 @@ var yyR2 = [...]int{
4, 4, 1, 1, 4, 0, 1, 1, 1, 4,
4, 1, 1, 3, 1, 2, 3, 1, 1, 4,
0, 0, 2, 5, 3, 3, 1, 6, 4, 4,
- 2, 2, 2, 1, 2, 1, 4, 3, 3, 6,
- 3, 1, 1, 1, 4, 4, 4, 2, 2, 4,
- 2, 2, 1, 3, 1, 1, 3, 3, 3, 3,
+ 2, 2, 2, 1, 2, 1, 4, 3, 3, 3,
+ 6, 3, 1, 1, 1, 4, 4, 4, 2, 2,
+ 4, 2, 2, 1, 3, 1, 1, 3, 3, 3,
+ 3,
}
var yyChk = [...]int{
- -1000, -149, -80, -3, 2, -25, -51, -52, 51, 79,
- 44, -53, -26, 10, -60, -61, 38, 119, 7, 21,
- 20, 23, 30, 34, 35, 39, -50, 46, 98, 19,
- 14, -14, 48, 25, 27, 121, 40, 43, 36, -1,
- -64, -2, 97, -16, -15, 37, 52, 99, 53, 100,
- 54, -19, 59, 92, -18, 104, 105, 130, 129, 131,
- 132, -48, -42, 123, -37, 107, 108, 109, 110, 111,
- 112, 113, 6, 133, -29, -47, -46, 118, 96, -20,
- 91, 49, 50, 4, 5, 84, 85, 86, 11, -35,
- -32, -7, 117, 74, 62, 18, 60, 125, -21, -22,
- -23, -30, -81, 82, -11, 8, 9, 66, 67, 81,
- 63, 64, 65, 80, -10, -136, -44, -12, -40, -9,
- 134, 12, 123, -81, 119, 82, 10, -82, 37, 38,
- -4, -81, 82, 121, 135, 122, 10, -85, -48, 123,
- -48, -25, -1, 79, 123, -48, 121, -14, 97, 98,
- 121, -14, 121, -15, -19, -14, 121, -86, -27, 12,
- 134, -87, -1, 12, -100, -14, 121, 149, 150, 87,
- 89, 88, 151, 128, 152, 163, 130, 129, 164, 167,
- 165, 166, 161, 162, 155, 156, 153, 154, 157, 158,
- 159, 160, 90, 127, 123, 123, 123, 119, -14, 10,
- -144, 128, 10, 10, -15, -19, -14, 52, 52, 136,
- 137, 138, 139, 148, 140, 141, 142, 143, 144, 145,
- 146, 147, 123, -14, 104, 105, -18, -19, -81, 79,
- 82, -11, -12, 98, -18, -14, -14, -14, -14, -42,
- -14, -50, -14, -14, -14, -14, -14, -14, -14, -49,
- 123, -48, -14, 125, 125, -121, 17, -88, -33, 12,
- 76, 77, -14, 57, -43, -11, -41, -81, 79, 82,
- -21, -10, -136, -12, 123, 123, -14, -14, 123, -14,
- -14, 125, -88, 17, 17, 75, -88, 125, 123, -91,
- -90, -14, 128, 125, 125, 82, -140, 123, -81, 78,
- 125, 119, -10, 134, 78, -140, 119, 124, 121, 119,
- -80, -81, 121, 135, -83, -5, -81, 82, -84, -6,
- -81, 82, 29, -81, 10, 136, -24, 120, 2, -25,
- -51, -52, 51, -25, 122, -146, -25, 122, 21, -144,
- -98, -97, -14, -141, 119, 122, 121, 121, 121, 121,
- 121, 135, -16, 119, -19, 121, 135, -144, 136, 121,
- 135, -14, -14, -14, -14, -14, -14, -14, -14, -14,
- -14, -14, -14, -14, -14, -14, -14, -14, -14, -14,
- -14, -14, -14, -14, -14, -14, -43, -14, 122, -101,
- -56, -19, -19, -15, -102, 10, -85, 121, 121, 10,
- 123, -65, 55, -113, 55, 58, -14, 128, -14, -14,
- -14, -14, -14, -14, -14, -14, -14, -14, -14, -14,
- -92, -38, -19, 59, 82, -81, 78, 78, 124, 124,
- 124, 124, -13, -14, -13, 118, -33, -33, 17, 125,
- 57, -14, 11, -19, -131, -132, -40, -39, -10, -136,
- 10, 119, -139, -140, 78, 82, -81, 57, -10, 78,
- -89, -36, -19, -15, -19, -15, -14, -13, 117, 75,
- 75, -13, -91, 126, -151, 135, 58, -17, -19, -13,
- -13, 10, 124, -115, -50, -69, -15, -19, 128, 83,
- -140, -39, -40, 10, 52, -13, -14, -39, -40, 10,
- -14, 121, -80, 120, -140, -4, 121, 135, 29, -81,
- 121, 135, 29, -81, 10, 29, 136, -28, -78, -7,
- -31, -81, 79, 82, 60, 125, -8, 62, -79, 18,
- 74, -11, 131, 132, 130, 129, 123, 123, -95, -85,
- -85, -48, 121, 135, -99, 121, -99, 121, -27, -14,
- 12, 123, -28, -14, 122, -14, 124, 135, 29, 29,
- 124, 135, 136, 120, 123, -106, -107, -63, -62, 60,
- 61, -45, -81, 79, 82, -109, 56, -45, 119, -114,
- -45, -15, -19, -19, 91, 124, 135, 123, -81, -127,
- -125, -124, -126, 125, -128, 57, 126, 126, -34, 10,
- 13, 12, 10, 120, 125, 120, -129, -77, -130, -140,
- 125, 119, -10, -14, -40, -81, -131, -40, 124, 135,
- 124, 124, 124, 126, 126, 124, -14, 128, -14, 128,
- 126, 126, 124, 135, 124, -17, -14, -140, -140, 126,
- 120, -140, -140, 120, 120, -5, 10, 29, -6, 10,
- 29, 10, -28, 125, 130, 129, 164, 167, 165, 166,
- 151, 128, 152, 161, 162, 163, 88, 89, 87, 150,
- 149, 155, 156, 153, 154, 157, 159, 158, 160, 127,
- 82, -81, 123, -122, -123, -78, 17, 78, -78, -78,
- -78, -78, -78, 124, -54, 93, 94, -96, 22, 121,
- -98, -14, 120, 32, 33, -99, 31, -99, 120, 136,
- -106, -14, 121, -56, -137, -19, 128, 59, -137, -57,
- -25, 122, 10, -28, -103, 41, -106, 124, 135, -144,
- 82, -81, 119, -114, -108, 135, -43, 136, -38, -92,
- 125, -126, -128, -13, -131, 126, -14, -135, 125, 125,
- -13, -14, 120, -134, -36, 58, -17, -17, -69, 10,
- 10, -78, -78, -78, -78, -78, -78, -78, -78, -78,
- -78, -78, -78, -78, -78, -78, -78, -78, -78, -78,
- -78, -78, -78, -78, -78, -78, -78, 122, -78, -81,
- -122, 126, -151, 135, 58, 10, 52, 124, 121, -48,
- -25, -55, 93, 94, 121, 121, -14, -150, 122, 121,
- 120, 121, 31, -28, 124, -138, 58, -19, 123, -138,
- -85, 136, -58, 42, 123, 124, -94, 44, -63, -145,
- 83, -81, -108, 120, -66, -110, -67, -68, -111, -120,
- 47, 38, 44, -76, 103, 102, 101, 98, 99, 100,
- -45, -139, -14, 124, -13, 126, -129, 126, -128, -13,
- -13, 126, 120, -133, 57, -14, 128, 126, -78, 122,
- 124, -78, -78, -25, 95, -48, 122, -98, -150, -85,
- 121, -94, 124, -137, -92, 124, 28, -28, 119, -45,
- 119, 119, 123, 12, 120, -112, 12, 121, 135, -1,
- -76, 10, -116, -45, 126, 120, 126, 126, -131, -17,
- -78, 58, 121, 122, -85, 124, -85, 119, -148, -25,
- 122, 124, -148, 121, -85, 12, -85, -85, -93, 12,
- 128, 136, 121, 135, 136, 10, -144, 136, -143, 135,
- 121, 119, -78, -85, -147, -25, 122, -85, -85, 120,
- 124, 120, 120, 124, 135, 12, -28, 12, -28, 136,
- 10, -28, -45, -117, -118, -70, -71, -72, -73, -74,
- -45, 10, -85, 120, 26, 119, 12, 128, 136, -28,
- 123, 120, -70, 121, 121, 45, 29, 78, 24, 121,
- -85, 12, -28, -106, -119, -45, -75, -76, 10, 121,
- 120, 124, 135, 10, -104, -105, -59, 41, -142, 121,
- 119, -45, -59, 123, -85, -45, 120, 12, 124, 119,
- -85, 120,
+ -1000, -151, -95, -5, 2, -27, -53, -54, 51, 79,
+ 44, -55, -28, 10, -62, -63, 38, 142, 7, 21,
+ 20, 23, 30, 34, 35, 39, -52, 46, 98, 19,
+ 14, -16, 48, 25, 27, 144, 40, 43, 36, -1,
+ -66, -2, 97, -18, -17, 37, 52, 99, 53, 100,
+ 54, -21, 59, 92, -20, 104, 105, 153, 152, 154,
+ 155, -50, -44, 146, -39, 107, 108, 109, 110, 111,
+ 112, 113, 6, 156, -31, -49, -48, 141, 96, -22,
+ 91, 49, 50, 4, 5, 84, 85, 86, 11, -37,
+ -34, -9, 140, 74, 62, 18, 60, 148, -23, -24,
+ -25, -32, -96, 82, -13, 8, 9, 66, 67, 81,
+ 63, 64, 65, 80, -12, -148, -46, -14, -42, -11,
+ 157, 12, 146, -96, 142, 82, 10, -97, 37, 38,
+ -6, -96, 82, 144, 158, 145, 10, -100, -50, 146,
+ -50, -27, -1, 79, 146, -50, 144, -16, 97, 98,
+ 144, -16, 144, -17, -21, -16, 144, -101, -29, 12,
+ 157, -102, -1, 12, -114, -16, 144, 129, 130, 87,
+ 89, 88, 159, 151, 161, 167, 153, 152, 162, 131,
+ 163, 164, 132, 133, 134, 135, 136, 137, 165, 138,
+ 166, 139, 90, 150, 146, 146, 146, 142, -16, 10,
+ -149, 151, 10, 10, -17, -21, -16, 52, 52, 160,
+ 117, 118, 119, 120, 121, 122, 123, 124, 125, 126,
+ 127, 128, 146, -16, 104, 105, -20, -21, -96, 79,
+ 82, -13, -14, 98, -20, -16, -16, -16, -16, -44,
+ -16, -52, -16, -16, -16, -16, -16, -16, -16, -51,
+ 146, -50, -16, 148, 148, -133, 17, -103, -35, 12,
+ 76, 77, -16, 57, -45, -13, -43, -96, 79, 82,
+ -23, -12, -148, -14, 146, 146, -16, -16, 146, -16,
+ -16, 148, -103, 17, 17, 75, -103, 148, 146, -106,
+ -105, -16, 151, 148, 148, 82, -82, 146, -96, 78,
+ 148, 142, -12, 157, 78, -82, 142, 147, 144, 142,
+ -95, -96, 144, 158, -98, -7, -96, 82, -99, -8,
+ -96, 82, 29, -96, 10, 160, -26, 143, 2, -27,
+ -53, -54, 51, -27, 145, -88, -27, 145, 21, -149,
+ -112, -111, -16, -84, 142, 145, 144, 144, 144, 144,
+ 144, 158, -18, 142, -21, 144, 158, -149, 160, 144,
+ 158, -16, -16, -16, -16, -16, -16, -16, -16, -16,
+ -16, -16, -16, -16, -16, -16, -16, -16, -16, -16,
+ -16, -16, -16, -16, -16, -16, -45, -16, 145, -115,
+ -58, -21, -21, -17, -116, 10, -100, 144, 144, 10,
+ 146, -91, 55, -93, 55, 58, -16, 151, -16, -16,
+ -16, -16, -16, -16, -16, -16, -16, -16, -16, -16,
+ -107, -40, -21, 59, 82, -96, 78, 78, 147, 147,
+ 147, 147, -15, -16, -15, 141, -35, -35, 17, 148,
+ 57, -16, 11, -21, -143, -144, -42, -41, -12, -148,
+ 10, 142, -81, -82, 78, 82, -96, 57, -12, 78,
+ -104, -38, -21, -17, -21, -16, -16, -15, 140, 75,
+ 75, -15, -106, 149, -3, 158, 58, -19, -21, -15,
+ -15, 10, 147, -127, -52, -70, -17, -21, 151, 83,
+ -82, -41, -42, 10, 52, -15, -16, -41, -42, 10,
+ -16, 144, -95, 143, -82, -6, 144, 158, 29, -96,
+ 144, 158, 29, -96, 10, 29, 160, -30, -79, -9,
+ -33, -96, 79, 82, 60, 148, -10, 62, -80, 18,
+ 74, -13, 154, 155, 153, 152, 146, 146, -109, -100,
+ -100, -50, 144, 158, -113, 144, -113, 144, -29, -16,
+ 12, 146, -30, -16, 145, -16, 147, 158, 29, 29,
+ 147, 158, 160, 143, 146, -120, -121, -65, -64, 60,
+ 61, -47, -96, 79, 82, -92, 56, -47, 142, -126,
+ -47, -17, -21, -21, 91, 147, 158, 146, -96, -139,
+ -137, -136, -138, 148, -140, 57, 149, 149, -36, 10,
+ 13, 12, 10, 143, 143, 148, 143, -141, -78, -142,
+ -82, 148, 142, -12, -16, -42, -96, -143, -42, 147,
+ 158, 147, 147, 147, 149, 149, 147, -16, 151, -16,
+ 151, 149, 149, 147, 158, 147, -19, -16, -82, -82,
+ 149, 143, -82, -82, 143, 143, -7, 10, 29, -8,
+ 10, 29, 10, -30, 148, 153, 152, 162, 131, 163,
+ 164, 159, 151, 161, 132, 133, 167, 88, 89, 87,
+ 130, 129, 134, 135, 136, 137, 165, 166, 138, 139,
+ 150, 82, -96, 146, -134, -135, -79, 17, 78, -79,
+ -79, -79, -79, -79, 147, -56, 93, 94, -110, 22,
+ 144, -112, -16, 143, 32, 33, -113, 31, -113, 143,
+ 160, -120, -16, 144, -58, -89, -21, 151, 59, -89,
+ -59, -27, 145, 10, -30, -117, 41, -120, 147, 158,
+ -149, 82, -96, 142, -126, -122, 158, -45, 160, -40,
+ -107, 148, -138, -140, -15, -143, 149, -16, -147, 148,
+ 148, -15, -16, 143, -146, -38, 58, -19, -19, -70,
+ 10, 10, -79, -79, -79, -79, -79, -79, -79, -79,
+ -79, -79, -79, -79, -79, -79, -79, -79, -79, -79,
+ -79, -79, -79, -79, -79, -79, -79, -79, 145, -79,
+ -96, -134, 149, -3, 158, 58, 10, 52, 147, 144,
+ -50, -27, -57, 93, 94, 144, 144, -16, -4, 145,
+ 144, 143, 144, 31, -30, 147, -90, 58, -21, 146,
+ -90, -100, 160, -60, 42, 146, 147, -94, 44, -65,
+ -150, 83, -96, -122, 143, -67, -123, -68, -69, -124,
+ -132, 47, 38, 44, -77, 103, 102, 101, 98, 99,
+ 100, -47, -81, -16, 147, -15, 149, -141, 149, -140,
+ -15, -15, 149, 143, -145, 57, -16, 151, 149, -79,
+ 145, 147, -79, -79, -27, 95, -50, 145, -112, -4,
+ -100, 144, -94, 147, -89, -107, 147, 28, -30, 142,
+ -47, 142, 142, 146, 12, 143, -125, 12, 144, 158,
+ -1, -77, 10, -128, -47, 149, 143, 149, 149, -143,
+ -19, -79, 58, 144, 145, -100, 147, -100, 142, -86,
+ -27, 145, 147, -86, 144, -100, 12, -100, -100, -108,
+ 12, 151, 160, 144, 158, 160, 10, -149, 160, -83,
+ 158, 144, 142, -79, -100, -87, -27, 145, -100, -100,
+ 143, 147, 143, 143, 147, 158, 12, -30, 12, -30,
+ 160, 10, -30, -47, -129, -130, -71, -72, -73, -74,
+ -75, -47, 10, -100, 143, 26, 142, 12, 151, 160,
+ -30, 146, 143, -71, 144, 144, 45, 29, 78, 24,
+ 144, -100, 12, -30, -120, -131, -47, -76, -77, 10,
+ 144, 143, 147, 158, 10, -118, -119, -61, 41, -85,
+ 144, 142, -47, -61, 146, -100, -47, 143, 12, 147,
+ 142, -100, 143,
}
var yyDef = [...]int{
@@ -1842,8 +1873,8 @@ var yyDef = [...]int{
0, 0, 289, 290, 291, 292, 293, 294, 295, 296,
0, 347, 297, 465, 465, 0, 349, 350, 493, 495,
0, 0, 302, 0, 351, 338, 339, 332, 0, 0,
- 341, -2, 0, 0, 0, 0, 507, 508, 0, 510,
- 511, 465, 0, 0, 0, 364, 0, 465, 481, 0,
+ 341, -2, 0, 0, 0, 0, 508, 509, 0, 511,
+ 512, 465, 0, 0, 0, 364, 0, 465, 481, 0,
423, 486, 0, 465, 465, 0, 323, 0, -2, 0,
465, 0, -2, 475, 0, 330, 0, 0, 11, 3,
0, -2, 14, 0, 0, 25, 26, 0, 0, 31,
@@ -1861,10 +1892,10 @@ var yyDef = [...]int{
432, 346, 0, 466, 0, 301, 494, 491, 492, 0,
0, 0, 414, 0, 446, 467, 468, 471, 447, 0,
472, 0, 231, 352, 0, 0, 334, 0, 458, 0,
- 0, 512, -2, -2, -2, 430, 0, 0, 418, 363,
+ 0, 513, -2, -2, -2, 0, 0, 0, 418, 363,
419, 0, 0, 315, 482, 424, 0, 490, 434, 0,
0, 5, 151, 0, 0, 154, -2, -2, 0, 0,
- 325, 0, 449, -2, 519, 0, 0, 0, 450, -2,
+ 325, 0, 449, -2, 520, 0, 0, 0, 450, -2,
0, 10, 0, 13, 324, 18, 15, 0, 0, 28,
16, 0, 0, 34, 21, 0, 0, 37, 366, 367,
368, -2, 0, 0, 0, 421, 374, 375, 376, 355,
@@ -1874,66 +1905,66 @@ var yyDef = [...]int{
0, 0, 0, 75, -2, 0, 141, 143, 89, 148,
149, 150, 335, 0, 0, 0, 0, 101, 170, 104,
107, -2, -2, 234, 0, 0, 480, 480, 333, 285,
- 230, 227, 228, 465, 223, 0, 311, 310, 0, 501,
- 502, 503, 497, 498, 0, 500, 439, 444, 445, 443,
- 465, 0, 448, 0, 449, 333, 343, 450, 504, 0,
- 505, 506, 509, 313, 312, 314, 484, 0, 485, 0,
- 452, 453, 152, 0, 153, 158, 159, 326, 327, 460,
- 461, 328, 329, 464, 12, 24, 27, 0, 30, 33,
- 0, 23, 36, 0, 0, 0, 0, 0, 0, 0,
+ 230, 227, 228, 465, 223, 0, 311, 310, 0, 502,
+ 503, 504, 497, 498, 499, 0, 501, 439, 444, 445,
+ 443, 465, 0, 448, 0, 449, 333, 343, 450, 505,
+ 0, 506, 507, 510, 313, 312, 314, 484, 0, 485,
+ 0, 452, 453, 152, 0, 153, 158, 159, 326, 327,
+ 460, 461, 328, 329, 464, 12, 24, 27, 0, 30,
+ 33, 0, 23, 36, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, -2, 421, 0, 423, 428, 0, 0, 384, 385,
- 407, 408, 0, 0, 48, 0, 0, 139, 0, 51,
- 0, 220, 122, 0, 0, 0, 0, 0, 164, 0,
- 0, 286, 67, 85, 109, 111, 0, 0, 109, 70,
- 118, 39, 0, 120, 77, 0, 0, 317, 147, 91,
- 0, 337, 170, 106, 200, 0, 351, 0, 476, 0,
- 465, 226, 222, 0, 446, 496, 0, 436, 465, 465,
- 0, 0, 473, 340, 513, 0, 488, 489, 155, 29,
- 35, 0, 378, 379, 380, 381, 382, 383, 386, 387,
- 388, 389, 390, 391, 392, 393, 394, 395, 396, -2,
- -2, -2, -2, -2, -2, -2, -2, 0, 0, -2,
- 0, 373, 422, 424, 0, 365, 518, 409, 44, 0,
- 138, 0, 0, 0, 132, 218, 0, 39, 129, 130,
- 123, 124, 0, 166, 317, 0, 0, 112, 480, 0,
- 0, 0, 72, 0, 0, 0, 0, 0, 144, 0,
- 92, 336, 200, 95, 169, 0, 0, 173, 0, -2,
- 199, 0, 0, 202, 204, 205, 206, 207, 208, 209,
- 108, 235, 232, 479, 0, 225, 440, 0, 438, 0,
- 0, 469, 470, 342, 0, 483, 0, 377, 405, 0,
- 372, 426, 427, 134, 0, 0, 39, 0, 39, -2,
- 125, 0, 0, 110, 0, 0, 0, 121, 39, 0,
- 39, 39, 0, 145, 94, 0, 212, 172, 0, 89,
- 203, 0, 0, 176, 224, 499, 442, 441, 344, 487,
- 406, 0, 49, 39, -2, 0, -2, 39, 68, 116,
- 39, 113, 69, 119, 0, 0, 0, 0, 0, 321,
- 0, 0, 171, 0, 0, 0, 0, 0, 175, 0,
- 178, 180, 425, -2, 52, 114, 39, 0, 0, 78,
- 0, 93, 304, 318, 0, 322, 146, 210, 213, 0,
- 0, 215, 177, 0, 181, 182, 0, 0, 190, 0,
- 0, -2, 0, 305, 0, 39, 319, 0, 0, 214,
- -2, 179, 183, 184, 185, 0, 194, 0, 0, 117,
- 0, 320, 211, 0, 186, 187, 0, -2, 191, 115,
- 80, 0, 0, 192, 76, 79, 81, 0, 174, 196,
- 39, 188, 82, 0, 0, 0, 197, 0, 0, 39,
- 0, 83,
+ 0, 0, -2, 421, 0, 423, 428, 0, 0, 384,
+ 385, 407, 408, 0, 0, 48, 0, 0, 139, 0,
+ 51, 0, 220, 122, 0, 0, 0, 0, 0, 164,
+ 0, 0, 286, 67, 85, 109, 111, 0, 0, 109,
+ 70, 118, 39, 0, 120, 77, 0, 0, 317, 147,
+ 91, 0, 337, 170, 106, 200, 0, 351, 0, 476,
+ 0, 465, 226, 222, 0, 446, 496, 0, 436, 465,
+ 465, 0, 0, 473, 340, 514, 0, 488, 489, 155,
+ 29, 35, 0, 378, 379, 380, 381, 382, 383, 386,
+ 387, 388, 389, 390, 391, 392, 393, 394, 395, 396,
+ -2, -2, -2, -2, -2, -2, -2, -2, 0, 0,
+ -2, 0, 373, 422, 424, 0, 365, 519, 409, 44,
+ 0, 138, 0, 0, 0, 132, 218, 0, 39, 129,
+ 130, 123, 124, 0, 166, 317, 0, 0, 112, 480,
+ 0, 0, 0, 72, 0, 0, 0, 0, 0, 144,
+ 0, 92, 336, 200, 95, 169, 0, 0, 173, 0,
+ -2, 199, 0, 0, 202, 204, 205, 206, 207, 208,
+ 209, 108, 235, 232, 479, 0, 225, 440, 0, 438,
+ 0, 0, 469, 470, 342, 0, 483, 0, 377, 405,
+ 0, 372, 426, 427, 134, 0, 0, 39, 0, 39,
+ -2, 125, 0, 0, 110, 0, 0, 0, 121, 39,
+ 0, 39, 39, 0, 145, 94, 0, 212, 172, 0,
+ 89, 203, 0, 0, 176, 224, 500, 442, 441, 344,
+ 487, 406, 0, 49, 39, -2, 0, -2, 39, 68,
+ 116, 39, 113, 69, 119, 0, 0, 0, 0, 0,
+ 321, 0, 0, 171, 0, 0, 0, 0, 0, 175,
+ 0, 178, 180, 425, -2, 52, 114, 39, 0, 0,
+ 78, 0, 93, 304, 318, 0, 322, 146, 210, 213,
+ 0, 0, 215, 177, 0, 181, 182, 0, 0, 190,
+ 0, 0, -2, 0, 305, 0, 39, 319, 0, 0,
+ 214, -2, 179, 183, 184, 185, 0, 194, 0, 0,
+ 117, 0, 320, 211, 0, 186, 187, 0, -2, 191,
+ 115, 80, 0, 0, 192, 76, 79, 81, 0, 174,
+ 196, 39, 188, 82, 0, 0, 0, 197, 0, 0,
+ 39, 0, 83,
}
var yyTok1 = [...]int{
1, 3, 3, 3, 3, 3, 3, 3, 3, 3,
3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
- 3, 3, 3, 131, 117, 3, 134, 166, 128, 3,
- 123, 124, 164, 130, 135, 129, 163, 165, 3, 3,
- 3, 3, 3, 3, 3, 3, 3, 3, 122, 121,
- 157, 136, 159, 127, 133, 3, 3, 3, 3, 3,
+ 3, 3, 3, 154, 140, 3, 157, 164, 151, 3,
+ 146, 147, 162, 153, 158, 152, 167, 163, 3, 3,
+ 3, 3, 3, 3, 3, 3, 3, 3, 145, 144,
+ 165, 160, 166, 150, 156, 3, 3, 3, 3, 3,
3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
- 3, 125, 3, 126, 152, 3, 118, 3, 3, 3,
+ 3, 148, 3, 149, 161, 3, 141, 3, 3, 3,
3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
- 3, 3, 3, 119, 151, 120, 132,
+ 3, 3, 3, 142, 159, 143, 155,
}
var yyTok2 = [...]int{
@@ -1948,9 +1979,9 @@ var yyTok2 = [...]int{
82, 83, 84, 85, 86, 87, 88, 89, 90, 91,
92, 93, 94, 95, 96, 97, 98, 99, 100, 101,
102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
- 112, 113, 114, 115, 116, 137, 138, 139, 140, 141,
- 142, 143, 144, 145, 146, 147, 148, 149, 150, 153,
- 154, 155, 156, 158, 160, 161, 162, 167,
+ 112, 113, 114, 115, 116, 117, 118, 119, 120, 121,
+ 122, 123, 124, 125, 126, 127, 128, 129, 130, 131,
+ 132, 133, 134, 135, 136, 137, 138, 139,
}
var yyTok3 = [...]int{
0,
@@ -2295,14 +2326,14 @@ yydefault:
case 1:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php5/php5.y:236
+ //line php5/php5.y:281
{
- yylex.(*Parser).rootNode = stmt.NewStmtList(yyDollar[1].list)
+ yylex.(*Parser).rootNode = node.NewRoot(yyDollar[1].list)
yylex.(*Parser).positions.AddPosition(yylex.(*Parser).rootNode, yylex.(*Parser).positionBuilder.NewNodeListPosition(yyDollar[1].list))
}
case 2:
yyDollar = yyS[yypt-2 : yypt+1]
- //line php5/php5.y:244
+ //line php5/php5.y:289
{
if yyDollar[2].node != nil {
yyVAL.list = append(yyDollar[1].list, yyDollar[2].node)
@@ -2310,368 +2341,446 @@ yydefault:
}
case 3:
yyDollar = yyS[yypt-0 : yypt+1]
- //line php5/php5.y:249
+ //line php5/php5.y:294
{
yyVAL.list = []node.Node{}
}
case 4:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php5/php5.y:254
+ //line php5/php5.y:299
{
namePart := name.NewNamePart(yyDollar[1].token.Value)
- yylex.(*Parser).positions.AddPosition(namePart, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
yyVAL.list = []node.Node{namePart}
- yylex.(*Parser).comments.AddComments(namePart, yyDollar[1].token.Comments())
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(namePart, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(namePart, yyDollar[1].token, comment.StringToken)
}
case 5:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php5/php5.y:261
+ //line php5/php5.y:310
{
namePart := name.NewNamePart(yyDollar[3].token.Value)
- yylex.(*Parser).positions.AddPosition(namePart, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[3].token))
yyVAL.list = append(yyDollar[1].list, namePart)
- yylex.(*Parser).comments.AddComments(namePart, yyDollar[3].token.Comments())
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(namePart, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[3].token))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(lastNode(yyDollar[1].list), yyDollar[2].token, comment.NsSeparatorToken)
+ yylex.(*Parser).comments.AddFromToken(namePart, yyDollar[3].token, comment.StringToken)
}
case 6:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php5/php5.y:271
+ //line php5/php5.y:325
{
// error
yyVAL.node = nil
}
case 7:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php5/php5.y:276
+ //line php5/php5.y:330
{
yyVAL.node = yyDollar[1].node
}
case 8:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php5/php5.y:278
+ //line php5/php5.y:332
{
yyVAL.node = yyDollar[1].node
}
case 9:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php5/php5.y:280
+ //line php5/php5.y:334
{
yyVAL.node = yyDollar[1].node
}
case 10:
yyDollar = yyS[yypt-4 : yypt+1]
- //line php5/php5.y:282
+ //line php5/php5.y:336
{
yyVAL.node = stmt.NewHaltCompiler()
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[4].token))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.HaltCompilerToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.OpenParenthesisToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[3].token, comment.CloseParenthesisToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[4].token, comment.SemiColonToken)
}
case 11:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php5/php5.y:288
+ //line php5/php5.y:349
{
name := name.NewName(yyDollar[2].list)
- yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewNodeListPosition(yyDollar[2].list))
yyVAL.node = stmt.NewNamespace(name, nil)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewNodeListPosition(yyDollar[2].list))
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[3].token))
- yylex.(*Parser).comments.AddComments(name, yylex.(*Parser).listGetFirstNodeComments(yyDollar[2].list))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.NamespaceToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[3].token, comment.SemiColonToken)
}
case 12:
yyDollar = yyS[yypt-5 : yypt+1]
- //line php5/php5.y:298
+ //line php5/php5.y:362
{
name := name.NewName(yyDollar[2].list)
- yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewNodeListPosition(yyDollar[2].list))
yyVAL.node = stmt.NewNamespace(name, yyDollar[4].list)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewNodeListPosition(yyDollar[2].list))
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[5].token))
- yylex.(*Parser).comments.AddComments(name, yylex.(*Parser).listGetFirstNodeComments(yyDollar[2].list))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.NamespaceToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[3].token, comment.OpenCurlyBracesToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[5].token, comment.CloseCurlyBracesToken)
}
case 13:
yyDollar = yyS[yypt-4 : yypt+1]
- //line php5/php5.y:308
+ //line php5/php5.y:376
{
yyVAL.node = stmt.NewNamespace(nil, yyDollar[3].list)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[4].token))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.NamespaceToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.OpenCurlyBracesToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[4].token, comment.CloseCurlyBracesToken)
}
case 14:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php5/php5.y:314
+ //line php5/php5.y:388
{
yyVAL.node = stmt.NewUseList(nil, yyDollar[2].list)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[3].token))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.UseToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[3].token, comment.SemiColonToken)
}
case 15:
yyDollar = yyS[yypt-4 : yypt+1]
- //line php5/php5.y:320
+ //line php5/php5.y:399
{
useType := node.NewIdentifier(yyDollar[2].token.Value)
- yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[2].token))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[2].token.Comments())
-
yyVAL.node = stmt.NewUseList(useType, yyDollar[3].list)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[2].token))
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[4].token))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.UseToken)
+ yylex.(*Parser).comments.AddFromToken(useType, yyDollar[2].token, comment.UseToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[4].token, comment.SemiColonToken)
}
case 16:
yyDollar = yyS[yypt-4 : yypt+1]
- //line php5/php5.y:330
+ //line php5/php5.y:413
{
useType := node.NewIdentifier(yyDollar[2].token.Value)
- yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[2].token))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[2].token.Comments())
-
yyVAL.node = stmt.NewUseList(useType, yyDollar[3].list)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[2].token))
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[4].token))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.UseToken)
+ yylex.(*Parser).comments.AddFromToken(useType, yyDollar[2].token, comment.UseToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[4].token, comment.SemiColonToken)
}
case 17:
yyDollar = yyS[yypt-2 : yypt+1]
- //line php5/php5.y:340
+ //line php5/php5.y:427
{
yyVAL.node = yyDollar[1].node
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodeTokenPosition(yyDollar[1].node, yyDollar[2].token))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.SemiColonToken)
}
case 18:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php5/php5.y:345
+ //line php5/php5.y:440
{
yyVAL.list = append(yyDollar[1].list, yyDollar[3].node)
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(lastNode(yyDollar[1].list), yyDollar[2].token, comment.CommaToken)
}
case 19:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php5/php5.y:347
+ //line php5/php5.y:447
{
yyVAL.list = []node.Node{yyDollar[1].node}
}
case 20:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php5/php5.y:352
+ //line php5/php5.y:452
{
name := name.NewName(yyDollar[1].list)
- yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewNodeListPosition(yyDollar[1].list))
yyVAL.node = stmt.NewUse(nil, name, nil)
- yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodeListPosition(yyDollar[1].list))
- yylex.(*Parser).comments.AddComments(name, yylex.(*Parser).listGetFirstNodeComments(yyDollar[1].list))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).listGetFirstNodeComments(yyDollar[1].list))
+ // save position
+ yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewNodeListPosition(yyDollar[1].list))
+ yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodeListPosition(yyDollar[1].list))
}
case 21:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php5/php5.y:362
+ //line php5/php5.y:461
{
name := name.NewName(yyDollar[1].list)
- yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewNodeListPosition(yyDollar[1].list))
alias := node.NewIdentifier(yyDollar[3].token.Value)
- yylex.(*Parser).positions.AddPosition(alias, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[3].token))
yyVAL.node = stmt.NewUse(nil, name, alias)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewNodeListPosition(yyDollar[1].list))
+ yylex.(*Parser).positions.AddPosition(alias, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[3].token))
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodeListTokenPosition(yyDollar[1].list, yyDollar[3].token))
- yylex.(*Parser).comments.AddComments(name, yylex.(*Parser).listGetFirstNodeComments(yyDollar[1].list))
- yylex.(*Parser).comments.AddComments(alias, yyDollar[3].token.Comments())
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).listGetFirstNodeComments(yyDollar[1].list))
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.AsToken)
+ yylex.(*Parser).comments.AddFromToken(alias, yyDollar[3].token, comment.StringToken)
}
case 22:
yyDollar = yyS[yypt-2 : yypt+1]
- //line php5/php5.y:375
+ //line php5/php5.y:476
{
name := name.NewName(yyDollar[2].list)
- yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewNodeListPosition(yyDollar[2].list))
yyVAL.node = stmt.NewUse(nil, name, nil)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewNodeListPosition(yyDollar[2].list))
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodeListPosition(yyDollar[2].list))
- yylex.(*Parser).comments.AddComments(name, yylex.(*Parser).listGetFirstNodeComments(yyDollar[2].list))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).listGetFirstNodeComments(yyDollar[2].list))
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.NsSeparatorToken)
}
case 23:
yyDollar = yyS[yypt-4 : yypt+1]
- //line php5/php5.y:385
+ //line php5/php5.y:488
{
name := name.NewName(yyDollar[2].list)
- yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewNodeListPosition(yyDollar[2].list))
alias := node.NewIdentifier(yyDollar[4].token.Value)
- yylex.(*Parser).positions.AddPosition(alias, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[4].token))
yyVAL.node = stmt.NewUse(nil, name, alias)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewNodeListPosition(yyDollar[2].list))
+ yylex.(*Parser).positions.AddPosition(alias, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[4].token))
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodeListTokenPosition(yyDollar[2].list, yyDollar[4].token))
- yylex.(*Parser).comments.AddComments(name, yylex.(*Parser).listGetFirstNodeComments(yyDollar[2].list))
- yylex.(*Parser).comments.AddComments(alias, yyDollar[4].token.Comments())
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).listGetFirstNodeComments(yyDollar[2].list))
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.NsSeparatorToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[3].token, comment.AsToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[4].token, comment.StringToken)
}
case 24:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php5/php5.y:401
+ //line php5/php5.y:507
{
yyVAL.list = append(yyDollar[1].list, yyDollar[3].node)
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(lastNode(yyDollar[1].list), yyDollar[2].token, comment.CommaToken)
}
case 25:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php5/php5.y:403
+ //line php5/php5.y:514
{
yyVAL.list = []node.Node{yyDollar[1].node}
}
case 26:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php5/php5.y:408
+ //line php5/php5.y:519
{
name := name.NewName(yyDollar[1].list)
- yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewNodeListPosition(yyDollar[1].list))
yyVAL.node = stmt.NewUse(nil, name, nil)
- yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodeListPosition(yyDollar[1].list))
- yylex.(*Parser).comments.AddComments(name, yylex.(*Parser).listGetFirstNodeComments(yyDollar[1].list))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).listGetFirstNodeComments(yyDollar[1].list))
+ // save position
+ yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewNodeListPosition(yyDollar[1].list))
+ yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodeListPosition(yyDollar[1].list))
}
case 27:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php5/php5.y:418
+ //line php5/php5.y:528
{
name := name.NewName(yyDollar[1].list)
- yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewNodeListPosition(yyDollar[1].list))
alias := node.NewIdentifier(yyDollar[3].token.Value)
- yylex.(*Parser).positions.AddPosition(alias, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[3].token))
yyVAL.node = stmt.NewUse(nil, name, alias)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewNodeListPosition(yyDollar[1].list))
+ yylex.(*Parser).positions.AddPosition(alias, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[3].token))
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodeListTokenPosition(yyDollar[1].list, yyDollar[3].token))
- yylex.(*Parser).comments.AddComments(name, yylex.(*Parser).listGetFirstNodeComments(yyDollar[1].list))
- yylex.(*Parser).comments.AddComments(alias, yyDollar[3].token.Comments())
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).listGetFirstNodeComments(yyDollar[1].list))
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.AsToken)
+ yylex.(*Parser).comments.AddFromToken(alias, yyDollar[3].token, comment.StringToken)
}
case 28:
yyDollar = yyS[yypt-2 : yypt+1]
- //line php5/php5.y:431
+ //line php5/php5.y:543
{
name := name.NewName(yyDollar[2].list)
- yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewNodeListPosition(yyDollar[2].list))
yyVAL.node = stmt.NewUse(nil, name, nil)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewNodeListPosition(yyDollar[2].list))
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodeListPosition(yyDollar[2].list))
- yylex.(*Parser).comments.AddComments(name, yylex.(*Parser).listGetFirstNodeComments(yyDollar[2].list))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).listGetFirstNodeComments(yyDollar[2].list))
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.NsSeparatorToken)
}
case 29:
yyDollar = yyS[yypt-4 : yypt+1]
- //line php5/php5.y:441
+ //line php5/php5.y:555
{
name := name.NewName(yyDollar[2].list)
- yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewNodeListPosition(yyDollar[2].list))
alias := node.NewIdentifier(yyDollar[4].token.Value)
- yylex.(*Parser).positions.AddPosition(alias, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[4].token))
yyVAL.node = stmt.NewUse(nil, name, alias)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewNodeListPosition(yyDollar[2].list))
+ yylex.(*Parser).positions.AddPosition(alias, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[4].token))
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodeListTokenPosition(yyDollar[2].list, yyDollar[4].token))
- yylex.(*Parser).comments.AddComments(name, yylex.(*Parser).listGetFirstNodeComments(yyDollar[2].list))
- yylex.(*Parser).comments.AddComments(alias, yyDollar[4].token.Comments())
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).listGetFirstNodeComments(yyDollar[2].list))
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.NsSeparatorToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[3].token, comment.AsToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[4].token, comment.StringToken)
}
case 30:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php5/php5.y:457
+ //line php5/php5.y:574
{
yyVAL.list = append(yyDollar[1].list, yyDollar[3].node)
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(lastNode(yyDollar[1].list), yyDollar[2].token, comment.CommaToken)
}
case 31:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php5/php5.y:459
+ //line php5/php5.y:581
{
yyVAL.list = []node.Node{yyDollar[1].node}
}
case 32:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php5/php5.y:464
+ //line php5/php5.y:586
{
name := name.NewName(yyDollar[1].list)
- yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewNodeListPosition(yyDollar[1].list))
yyVAL.node = stmt.NewUse(nil, name, nil)
- yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodeListPosition(yyDollar[1].list))
- yylex.(*Parser).comments.AddComments(name, yylex.(*Parser).listGetFirstNodeComments(yyDollar[1].list))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).listGetFirstNodeComments(yyDollar[1].list))
+ // save position
+ yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewNodeListPosition(yyDollar[1].list))
+ yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodeListPosition(yyDollar[1].list))
}
case 33:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php5/php5.y:474
+ //line php5/php5.y:595
{
name := name.NewName(yyDollar[1].list)
- yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewNodeListPosition(yyDollar[1].list))
alias := node.NewIdentifier(yyDollar[3].token.Value)
- yylex.(*Parser).positions.AddPosition(alias, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[3].token))
yyVAL.node = stmt.NewUse(nil, name, alias)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewNodeListPosition(yyDollar[1].list))
+ yylex.(*Parser).positions.AddPosition(alias, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[3].token))
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodeListTokenPosition(yyDollar[1].list, yyDollar[3].token))
- yylex.(*Parser).comments.AddComments(name, yylex.(*Parser).listGetFirstNodeComments(yyDollar[1].list))
- yylex.(*Parser).comments.AddComments(alias, yyDollar[3].token.Comments())
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).listGetFirstNodeComments(yyDollar[1].list))
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.AsToken)
+ yylex.(*Parser).comments.AddFromToken(alias, yyDollar[3].token, comment.StringToken)
}
case 34:
yyDollar = yyS[yypt-2 : yypt+1]
- //line php5/php5.y:487
+ //line php5/php5.y:610
{
name := name.NewName(yyDollar[2].list)
- yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewNodeListPosition(yyDollar[2].list))
yyVAL.node = stmt.NewUse(nil, name, nil)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewNodeListPosition(yyDollar[2].list))
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodeListPosition(yyDollar[2].list))
- yylex.(*Parser).comments.AddComments(name, yylex.(*Parser).listGetFirstNodeComments(yyDollar[2].list))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).listGetFirstNodeComments(yyDollar[2].list))
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.NsSeparatorToken)
}
case 35:
yyDollar = yyS[yypt-4 : yypt+1]
- //line php5/php5.y:497
+ //line php5/php5.y:622
{
name := name.NewName(yyDollar[2].list)
- yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewNodeListPosition(yyDollar[2].list))
alias := node.NewIdentifier(yyDollar[4].token.Value)
- yylex.(*Parser).positions.AddPosition(alias, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[4].token))
yyVAL.node = stmt.NewUse(nil, name, alias)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewNodeListPosition(yyDollar[2].list))
+ yylex.(*Parser).positions.AddPosition(alias, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[4].token))
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodeListTokenPosition(yyDollar[2].list, yyDollar[4].token))
- yylex.(*Parser).comments.AddComments(name, yylex.(*Parser).listGetFirstNodeComments(yyDollar[2].list))
- yylex.(*Parser).comments.AddComments(alias, yyDollar[4].token.Comments())
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).listGetFirstNodeComments(yyDollar[2].list))
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.NsSeparatorToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[3].token, comment.AsToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[4].token, comment.StringToken)
}
case 36:
yyDollar = yyS[yypt-5 : yypt+1]
- //line php5/php5.y:513
+ //line php5/php5.y:641
{
name := node.NewIdentifier(yyDollar[3].token.Value)
- yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[3].token))
- yylex.(*Parser).comments.AddComments(name, yyDollar[3].token.Comments())
-
constant := stmt.NewConstant(name, yyDollar[5].node, "")
- yylex.(*Parser).positions.AddPosition(constant, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[3].token, yyDollar[5].node))
- yylex.(*Parser).comments.AddComments(constant, yyDollar[3].token.Comments())
-
constList := yyDollar[1].node.(*stmt.ConstList)
constList.Consts = append(constList.Consts, constant)
-
yyVAL.node = yyDollar[1].node
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[3].token))
+ yylex.(*Parser).positions.AddPosition(constant, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[3].token, yyDollar[5].node))
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodeNodeListPosition(yyDollar[1].node, constList.Consts))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(lastNode(constList.Consts), yyDollar[2].token, comment.CommaToken)
+ yylex.(*Parser).comments.AddFromToken(name, yyDollar[3].token, comment.StringToken)
+ yylex.(*Parser).comments.AddFromToken(constant, yyDollar[4].token, comment.EqualToken)
}
case 37:
yyDollar = yyS[yypt-4 : yypt+1]
- //line php5/php5.y:529
+ //line php5/php5.y:659
{
name := node.NewIdentifier(yyDollar[2].token.Value)
- yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[2].token))
- yylex.(*Parser).comments.AddComments(name, yyDollar[2].token.Comments())
-
constant := stmt.NewConstant(name, yyDollar[4].node, "")
- yylex.(*Parser).positions.AddPosition(constant, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[2].token, yyDollar[4].node))
- yylex.(*Parser).comments.AddComments(constant, yyDollar[2].token.Comments())
-
constList := []node.Node{constant}
-
yyVAL.node = stmt.NewConstList(constList)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[2].token))
+ yylex.(*Parser).positions.AddPosition(constant, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[2].token, yyDollar[4].node))
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenNodeListPosition(yyDollar[1].token, constList))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.ConstToken)
+ yylex.(*Parser).comments.AddFromToken(name, yyDollar[2].token, comment.StringToken)
+ yylex.(*Parser).comments.AddFromToken(constant, yyDollar[3].token, comment.EqualToken)
}
case 38:
yyDollar = yyS[yypt-2 : yypt+1]
- //line php5/php5.y:548
+ //line php5/php5.y:679
{
if yyDollar[2].node != nil {
yyVAL.list = append(yyDollar[1].list, yyDollar[2].node)
@@ -2679,75 +2788,91 @@ yydefault:
}
case 39:
yyDollar = yyS[yypt-0 : yypt+1]
- //line php5/php5.y:554
+ //line php5/php5.y:685
{
yyVAL.list = []node.Node{}
}
case 40:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php5/php5.y:560
+ //line php5/php5.y:691
{
// error
yyVAL.node = nil
}
case 41:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php5/php5.y:565
+ //line php5/php5.y:696
{
yyVAL.node = yyDollar[1].node
}
case 42:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php5/php5.y:567
+ //line php5/php5.y:698
{
yyVAL.node = yyDollar[1].node
}
case 43:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php5/php5.y:569
+ //line php5/php5.y:700
{
yyVAL.node = yyDollar[1].node
}
case 44:
yyDollar = yyS[yypt-4 : yypt+1]
- //line php5/php5.y:571
+ //line php5/php5.y:702
{
yyVAL.node = stmt.NewHaltCompiler()
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[4].token))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.HaltCompilerToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.OpenParenthesisToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[3].token, comment.CloseParenthesisToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[4].token, comment.SemiColonToken)
}
case 45:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php5/php5.y:581
+ //line php5/php5.y:719
{
yyVAL.node = yyDollar[1].node
}
case 46:
yyDollar = yyS[yypt-2 : yypt+1]
- //line php5/php5.y:583
+ //line php5/php5.y:721
{
label := node.NewIdentifier(yyDollar[1].token.Value)
- yylex.(*Parser).positions.AddPosition(label, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
yyVAL.node = stmt.NewLabel(label)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(label, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[2].token))
- yylex.(*Parser).comments.AddComments(label, yyDollar[1].token.Comments())
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(label, yyDollar[1].token, comment.StringToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.ColonToken)
}
case 47:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php5/php5.y:596
+ //line php5/php5.y:737
{
yyVAL.node = stmt.NewStmtList(yyDollar[2].list)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[3].token))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.OpenCurlyBracesToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[3].token, comment.CloseCurlyBracesToken)
}
case 48:
yyDollar = yyS[yypt-5 : yypt+1]
- //line php5/php5.y:602
+ //line php5/php5.y:748
{
yyVAL.node = stmt.NewIf(yyDollar[2].node, yyDollar[3].node, yyDollar[4].list, yyDollar[5].node)
+ // save position
if yyDollar[5].node != nil {
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[5].node))
} else if len(yyDollar[4].list) > 0 {
@@ -2756,2001 +2881,2786 @@ yydefault:
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[3].node))
}
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.IfToken)
}
case 49:
yyDollar = yyS[yypt-8 : yypt+1]
- //line php5/php5.y:616
+ //line php5/php5.y:764
{
stmts := stmt.NewStmtList(yyDollar[4].list)
- yylex.(*Parser).positions.AddPosition(stmts, yylex.(*Parser).positionBuilder.NewNodeListPosition(yyDollar[4].list))
-
yyVAL.node = stmt.NewAltIf(yyDollar[2].node, stmts, yyDollar[5].list, yyDollar[6].node)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(stmts, yylex.(*Parser).positionBuilder.NewNodeListPosition(yyDollar[4].list))
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[8].token))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.IfToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[3].token, comment.ColonToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[7].token, comment.EndifToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[8].token, comment.SemiColonToken)
}
case 50:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php5/php5.y:625
+ //line php5/php5.y:779
{
- if yyDollar[3].altSyntaxNode.isAlt {
- yyVAL.node = stmt.NewAltWhile(yyDollar[2].node, yyDollar[3].altSyntaxNode.node)
- } else {
- yyVAL.node = stmt.NewWhile(yyDollar[2].node, yyDollar[3].altSyntaxNode.node)
+ switch n := yyDollar[3].node.(type) {
+ case *stmt.While:
+ n.Cond = yyDollar[2].node
+ case *stmt.AltWhile:
+ n.Cond = yyDollar[2].node
}
- yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[3].altSyntaxNode.node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+
+ yyVAL.node = yyDollar[3].node
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[3].node))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.WhileToken)
}
case 51:
yyDollar = yyS[yypt-5 : yypt+1]
- //line php5/php5.y:635
+ //line php5/php5.y:796
{
yyVAL.node = stmt.NewDo(yyDollar[2].node, yyDollar[4].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[5].token))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.DoToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[3].token, comment.WhileToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[5].token, comment.SemiColonToken)
}
case 52:
yyDollar = yyS[yypt-9 : yypt+1]
- //line php5/php5.y:641
+ //line php5/php5.y:808
{
- if yyDollar[9].altSyntaxNode.isAlt {
- yyVAL.node = stmt.NewAltFor(yyDollar[3].list, yyDollar[5].list, yyDollar[7].list, yyDollar[9].altSyntaxNode.node)
- } else {
- yyVAL.node = stmt.NewFor(yyDollar[3].list, yyDollar[5].list, yyDollar[7].list, yyDollar[9].altSyntaxNode.node)
+ switch n := yyDollar[9].node.(type) {
+ case *stmt.For:
+ n.Init = yyDollar[3].list
+ n.Cond = yyDollar[5].list
+ n.Loop = yyDollar[7].list
+ case *stmt.AltFor:
+ n.Init = yyDollar[3].list
+ n.Cond = yyDollar[5].list
+ n.Loop = yyDollar[7].list
}
- yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[9].altSyntaxNode.node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+
+ yyVAL.node = yyDollar[9].node
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[9].node))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.ForToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.OpenParenthesisToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[4].token, comment.ForInitSemicolonToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[6].token, comment.ForCondSemicolonToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[8].token, comment.CloseParenthesisToken)
}
case 53:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php5/php5.y:651
+ //line php5/php5.y:833
{
- if yyDollar[3].nodesWithEndToken.endToken.Value == ";" {
- yyVAL.node = stmt.NewAltSwitch(yyDollar[2].node, yyDollar[3].nodesWithEndToken.nodes)
- } else {
- yyVAL.node = stmt.NewSwitch(yyDollar[2].node, yyDollar[3].nodesWithEndToken.nodes)
+ switch n := yyDollar[3].node.(type) {
+ case *stmt.Switch:
+ n.Cond = yyDollar[2].node
+ case *stmt.AltSwitch:
+ n.Cond = yyDollar[2].node
+ default:
+ panic("unexpected node type")
}
- yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[3].nodesWithEndToken.endToken))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+
+ yyVAL.node = yyDollar[3].node
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[3].node))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.SwitchToken)
}
case 54:
yyDollar = yyS[yypt-2 : yypt+1]
- //line php5/php5.y:661
+ //line php5/php5.y:852
{
yyVAL.node = stmt.NewBreak(nil)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[2].token))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.BreakToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.SemiColonToken)
}
case 55:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php5/php5.y:667
+ //line php5/php5.y:863
{
yyVAL.node = stmt.NewBreak(yyDollar[2].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[3].token))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.BreakToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[3].token, comment.SemiColonToken)
}
case 56:
yyDollar = yyS[yypt-2 : yypt+1]
- //line php5/php5.y:673
+ //line php5/php5.y:874
{
yyVAL.node = stmt.NewContinue(nil)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[2].token))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.ContinueToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.SemiColonToken)
}
case 57:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php5/php5.y:679
+ //line php5/php5.y:885
{
yyVAL.node = stmt.NewContinue(yyDollar[2].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[3].token))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.ContinueToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[3].token, comment.SemiColonToken)
}
case 58:
yyDollar = yyS[yypt-2 : yypt+1]
- //line php5/php5.y:685
+ //line php5/php5.y:896
{
yyVAL.node = stmt.NewReturn(nil)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[2].token))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.ReturnToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.SemiColonToken)
}
case 59:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php5/php5.y:691
+ //line php5/php5.y:907
{
yyVAL.node = stmt.NewReturn(yyDollar[2].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[3].token))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.ReturnToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[3].token, comment.SemiColonToken)
}
case 60:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php5/php5.y:697
+ //line php5/php5.y:918
{
yyVAL.node = stmt.NewReturn(yyDollar[2].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[3].token))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.ReturnToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[3].token, comment.SemiColonToken)
}
case 61:
yyDollar = yyS[yypt-2 : yypt+1]
- //line php5/php5.y:703
+ //line php5/php5.y:929
{
yyVAL.node = stmt.NewExpression(yyDollar[1].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodeTokenPosition(yyDollar[1].node, yyDollar[2].token))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.SemiColonToken)
}
case 62:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php5/php5.y:709
+ //line php5/php5.y:939
{
yyVAL.node = stmt.NewGlobal(yyDollar[2].list)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[3].token))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.GlobalToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[3].token, comment.SemiColonToken)
}
case 63:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php5/php5.y:715
+ //line php5/php5.y:950
{
yyVAL.node = stmt.NewStatic(yyDollar[2].list)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[3].token))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.StaticToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[3].token, comment.SemiColonToken)
}
case 64:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php5/php5.y:721
+ //line php5/php5.y:961
{
yyVAL.node = stmt.NewEcho(yyDollar[2].list)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[3].token))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.EchoToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[3].token, comment.SemiColonToken)
}
case 65:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php5/php5.y:727
+ //line php5/php5.y:972
{
yyVAL.node = stmt.NewInlineHtml(yyDollar[1].token.Value)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.InlineHTMLToken)
}
case 66:
yyDollar = yyS[yypt-2 : yypt+1]
- //line php5/php5.y:733
+ //line php5/php5.y:982
{
yyVAL.node = stmt.NewExpression(yyDollar[1].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodeTokenPosition(yyDollar[1].node, yyDollar[2].token))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.SemiColonToken)
}
case 67:
yyDollar = yyS[yypt-5 : yypt+1]
- //line php5/php5.y:739
+ //line php5/php5.y:992
{
yyVAL.node = stmt.NewUnset(yyDollar[3].list)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[5].token))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.UnsetToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.OpenParenthesisToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[4].token, comment.CloseParenthesisToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[5].token, comment.SemiColonToken)
}
case 68:
yyDollar = yyS[yypt-8 : yypt+1]
- //line php5/php5.y:745
+ //line php5/php5.y:1005
{
- if yyDollar[6].foreachVariable.node == nil {
- if yyDollar[8].altSyntaxNode.isAlt {
- yyVAL.node = stmt.NewAltForeach(yyDollar[3].node, nil, yyDollar[5].foreachVariable.node, yyDollar[8].altSyntaxNode.node, yyDollar[5].foreachVariable.byRef)
- } else {
- yyVAL.node = stmt.NewForeach(yyDollar[3].node, nil, yyDollar[5].foreachVariable.node, yyDollar[8].altSyntaxNode.node, yyDollar[5].foreachVariable.byRef)
+ if yyDollar[6].node == nil {
+ switch n := yyDollar[8].node.(type) {
+ case *stmt.Foreach:
+ n.Expr = yyDollar[3].node
+ n.Variable = yyDollar[5].node
+ case *stmt.AltForeach:
+ n.Expr = yyDollar[3].node
+ n.Variable = yyDollar[5].node
}
} else {
- if yyDollar[8].altSyntaxNode.isAlt {
- yyVAL.node = stmt.NewAltForeach(yyDollar[3].node, yyDollar[5].foreachVariable.node, yyDollar[6].foreachVariable.node, yyDollar[8].altSyntaxNode.node, yyDollar[6].foreachVariable.byRef)
- } else {
- yyVAL.node = stmt.NewForeach(yyDollar[3].node, yyDollar[5].foreachVariable.node, yyDollar[6].foreachVariable.node, yyDollar[8].altSyntaxNode.node, yyDollar[6].foreachVariable.byRef)
+ switch n := yyDollar[8].node.(type) {
+ case *stmt.Foreach:
+ n.Expr = yyDollar[3].node
+ n.Key = yyDollar[5].node
+ n.Variable = yyDollar[6].node
+ case *stmt.AltForeach:
+ n.Expr = yyDollar[3].node
+ n.Key = yyDollar[5].node
+ n.Variable = yyDollar[6].node
}
}
- yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[8].altSyntaxNode.node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+
+ yyVAL.node = yyDollar[8].node
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[8].node))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.ForeachToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.OpenParenthesisToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[4].token, comment.AsToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[7].token, comment.CloseParenthesisToken)
}
case 69:
yyDollar = yyS[yypt-8 : yypt+1]
- //line php5/php5.y:763
+ //line php5/php5.y:1040
{
- if yyDollar[6].foreachVariable.node == nil {
- if yyDollar[8].altSyntaxNode.isAlt {
- yyVAL.node = stmt.NewAltForeach(yyDollar[3].node, nil, yyDollar[5].foreachVariable.node, yyDollar[8].altSyntaxNode.node, yyDollar[5].foreachVariable.byRef)
- } else {
- yyVAL.node = stmt.NewForeach(yyDollar[3].node, nil, yyDollar[5].foreachVariable.node, yyDollar[8].altSyntaxNode.node, yyDollar[5].foreachVariable.byRef)
+ if yyDollar[6].node == nil {
+ switch n := yyDollar[8].node.(type) {
+ case *stmt.Foreach:
+ n.Expr = yyDollar[3].node
+ n.Variable = yyDollar[5].node
+ case *stmt.AltForeach:
+ n.Expr = yyDollar[3].node
+ n.Variable = yyDollar[5].node
}
} else {
- if yyDollar[8].altSyntaxNode.isAlt {
- yyVAL.node = stmt.NewAltForeach(yyDollar[3].node, yyDollar[5].foreachVariable.node, yyDollar[6].foreachVariable.node, yyDollar[8].altSyntaxNode.node, yyDollar[6].foreachVariable.byRef)
- } else {
- yyVAL.node = stmt.NewForeach(yyDollar[3].node, yyDollar[5].foreachVariable.node, yyDollar[6].foreachVariable.node, yyDollar[8].altSyntaxNode.node, yyDollar[6].foreachVariable.byRef)
+ switch n := yyDollar[8].node.(type) {
+ case *stmt.Foreach:
+ n.Expr = yyDollar[3].node
+ n.Key = yyDollar[5].node
+ n.Variable = yyDollar[6].node
+ case *stmt.AltForeach:
+ n.Expr = yyDollar[3].node
+ n.Key = yyDollar[5].node
+ n.Variable = yyDollar[6].node
}
}
- yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[8].altSyntaxNode.node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+
+ // save position
+ yyVAL.node = yyDollar[8].node
+
+ yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[8].node))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.ForeachToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.OpenParenthesisToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[4].token, comment.AsToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[7].token, comment.CloseParenthesisToken)
}
case 70:
yyDollar = yyS[yypt-5 : yypt+1]
- //line php5/php5.y:781
+ //line php5/php5.y:1075
{
yyVAL.node = stmt.NewDeclare(yyDollar[3].list, yyDollar[5].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[5].node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.DeclareToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.OpenParenthesisToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[4].token, comment.CloseParenthesisToken)
}
case 71:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php5/php5.y:787
+ //line php5/php5.y:1087
{
yyVAL.node = stmt.NewNop()
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.SemiColonToken)
}
case 72:
yyDollar = yyS[yypt-6 : yypt+1]
- //line php5/php5.y:793
+ //line php5/php5.y:1097
{
yyVAL.node = stmt.NewTry(yyDollar[3].list, yyDollar[5].list, yyDollar[6].node)
+ // save position
if yyDollar[6].node == nil {
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenNodeListPosition(yyDollar[1].token, yyDollar[5].list))
} else {
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[6].node))
}
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.TryToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.OpenCurlyBracesToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[4].token, comment.CloseCurlyBracesToken)
}
case 73:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php5/php5.y:805
+ //line php5/php5.y:1113
{
yyVAL.node = stmt.NewThrow(yyDollar[2].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[3].token))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.ThrowToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[3].token, comment.SemiColonToken)
}
case 74:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php5/php5.y:811
+ //line php5/php5.y:1124
{
label := node.NewIdentifier(yyDollar[2].token.Value)
- yylex.(*Parser).positions.AddPosition(label, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[2].token))
yyVAL.node = stmt.NewGoto(label)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(label, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[2].token))
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[3].token))
- yylex.(*Parser).comments.AddComments(label, yyDollar[2].token.Comments())
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.GotoToken)
+ yylex.(*Parser).comments.AddFromToken(label, yyDollar[2].token, comment.StringToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[3].token, comment.SemiColonToken)
}
case 75:
yyDollar = yyS[yypt-0 : yypt+1]
- //line php5/php5.y:824
+ //line php5/php5.y:1141
{
yyVAL.list = []node.Node{}
}
case 76:
yyDollar = yyS[yypt-9 : yypt+1]
- //line php5/php5.y:826
+ //line php5/php5.y:1143
{
identifier := node.NewIdentifier(strings.TrimLeft(yyDollar[4].token.Value, "$"))
- yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[4].token))
- yylex.(*Parser).comments.AddComments(identifier, yyDollar[4].token.Comments())
-
variable := expr.NewVariable(identifier)
- yylex.(*Parser).positions.AddPosition(variable, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[4].token))
- yylex.(*Parser).comments.AddComments(variable, yyDollar[4].token.Comments())
-
catch := stmt.NewCatch([]node.Node{yyDollar[3].node}, variable, yyDollar[7].list)
- yylex.(*Parser).positions.AddPosition(catch, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[8].token))
- yylex.(*Parser).comments.AddComments(catch, yyDollar[1].token.Comments())
-
yyVAL.list = append([]node.Node{catch}, yyDollar[9].list...)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[4].token))
+ yylex.(*Parser).positions.AddPosition(variable, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[4].token))
+ yylex.(*Parser).positions.AddPosition(catch, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[8].token))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(catch, yyDollar[1].token, comment.CatchToken)
+ yylex.(*Parser).comments.AddFromToken(catch, yyDollar[2].token, comment.OpenParenthesisToken)
+ yylex.(*Parser).comments.AddFromToken(variable, yyDollar[4].token, comment.StringToken)
+ yylex.(*Parser).comments.AddFromToken(catch, yyDollar[5].token, comment.CloseParenthesisToken)
+ yylex.(*Parser).comments.AddFromToken(catch, yyDollar[6].token, comment.OpenCurlyBracesToken)
+ yylex.(*Parser).comments.AddFromToken(catch, yyDollar[8].token, comment.CloseCurlyBracesToken)
}
case 77:
yyDollar = yyS[yypt-0 : yypt+1]
- //line php5/php5.y:844
+ //line php5/php5.y:1165
{
yyVAL.node = nil
}
case 78:
yyDollar = yyS[yypt-4 : yypt+1]
- //line php5/php5.y:846
+ //line php5/php5.y:1167
{
yyVAL.node = stmt.NewFinally(yyDollar[3].list)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[4].token))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.FinallyToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.OpenCurlyBracesToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[4].token, comment.CloseCurlyBracesToken)
}
case 79:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php5/php5.y:855
+ //line php5/php5.y:1182
{
yyVAL.list = yyDollar[1].list
}
case 80:
yyDollar = yyS[yypt-0 : yypt+1]
- //line php5/php5.y:857
+ //line php5/php5.y:1184
{
yyVAL.list = []node.Node{}
}
case 81:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php5/php5.y:862
+ //line php5/php5.y:1189
{
yyVAL.list = []node.Node{yyDollar[1].node}
}
case 82:
yyDollar = yyS[yypt-2 : yypt+1]
- //line php5/php5.y:864
+ //line php5/php5.y:1191
{
yyVAL.list = append(yyDollar[1].list, yyDollar[2].node)
}
case 83:
yyDollar = yyS[yypt-8 : yypt+1]
- //line php5/php5.y:869
+ //line php5/php5.y:1196
{
identifier := node.NewIdentifier(strings.TrimLeft(yyDollar[4].token.Value, "$"))
- yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[4].token))
- yylex.(*Parser).comments.AddComments(identifier, yyDollar[4].token.Comments())
-
variable := expr.NewVariable(identifier)
- yylex.(*Parser).positions.AddPosition(variable, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[4].token))
- yylex.(*Parser).comments.AddComments(variable, yyDollar[4].token.Comments())
-
yyVAL.node = stmt.NewCatch([]node.Node{yyDollar[3].node}, variable, yyDollar[7].list)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[4].token))
+ yylex.(*Parser).positions.AddPosition(variable, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[4].token))
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[8].token))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.CatchToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.OpenParenthesisToken)
+ yylex.(*Parser).comments.AddFromToken(variable, yyDollar[4].token, comment.StringToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[5].token, comment.CloseParenthesisToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[6].token, comment.OpenCurlyBracesToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[8].token, comment.CloseCurlyBracesToken)
}
case 84:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php5/php5.y:886
+ //line php5/php5.y:1218
{
yyVAL.list = []node.Node{yyDollar[1].node}
}
case 85:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php5/php5.y:888
+ //line php5/php5.y:1220
{
yyVAL.list = append(yyDollar[1].list, yyDollar[3].node)
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(lastNode(yyDollar[1].list), yyDollar[2].token, comment.CommaToken)
}
case 86:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php5/php5.y:893
+ //line php5/php5.y:1230
{
yyVAL.node = yyDollar[1].node
}
case 87:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php5/php5.y:898
+ //line php5/php5.y:1235
{
yyVAL.node = yyDollar[1].node
}
case 88:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php5/php5.y:903
+ //line php5/php5.y:1240
{
yyVAL.node = yyDollar[1].node
}
case 89:
yyDollar = yyS[yypt-0 : yypt+1]
- //line php5/php5.y:908
+ //line php5/php5.y:1245
{
- yyVAL.boolWithToken = boolWithToken{false, nil}
+ yyVAL.token = nil
}
case 90:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php5/php5.y:910
+ //line php5/php5.y:1247
{
- yyVAL.boolWithToken = boolWithToken{true, &yyDollar[1].token}
+ yyVAL.token = yyDollar[1].token
}
case 91:
yyDollar = yyS[yypt-0 : yypt+1]
- //line php5/php5.y:915
+ //line php5/php5.y:1252
{
- yyVAL.boolWithToken = boolWithToken{false, nil}
+ yyVAL.token = nil
}
case 92:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php5/php5.y:917
+ //line php5/php5.y:1254
{
- yyVAL.boolWithToken = boolWithToken{true, &yyDollar[1].token}
+ yyVAL.token = yyDollar[1].token
}
case 93:
yyDollar = yyS[yypt-9 : yypt+1]
- //line php5/php5.y:922
+ //line php5/php5.y:1259
{
name := node.NewIdentifier(yyDollar[3].token.Value)
- yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[3].token))
- yylex.(*Parser).comments.AddComments(name, yyDollar[3].token.Comments())
+ yyVAL.node = stmt.NewFunction(name, yyDollar[2].token != nil, yyDollar[5].list, nil, yyDollar[8].list, "")
- yyVAL.node = stmt.NewFunction(name, yyDollar[2].boolWithToken.value, yyDollar[5].list, nil, yyDollar[8].list, "")
+ // save position
+ yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[3].token))
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[9].token))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.FunctionToken)
+ if yyDollar[2].token != nil {
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.AmpersandToken)
+ }
+ yylex.(*Parser).comments.AddFromToken(name, yyDollar[3].token, comment.StringToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[4].token, comment.OpenParenthesisToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[6].token, comment.CloseParenthesisToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[7].token, comment.OpenCurlyBracesToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[9].token, comment.CloseCurlyBracesToken)
}
case 94:
yyDollar = yyS[yypt-7 : yypt+1]
- //line php5/php5.y:935
+ //line php5/php5.y:1282
{
+ name := node.NewIdentifier(yyDollar[2].token.Value)
switch n := yyDollar[1].node.(type) {
case *stmt.Class:
- name := node.NewIdentifier(yyDollar[2].token.Value)
- yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[2].token))
n.ClassName = name
n.Stmts = yyDollar[6].list
- n.Extends = yyDollar[3].node
- n.Implements = yyDollar[4].list
+ n.Extends = yyDollar[3].ClassExtends
+ n.Implements = yyDollar[4].ClassImplements
case *stmt.Trait:
// TODO: is it possible that trait extend or implement
- name := node.NewIdentifier(yyDollar[2].token.Value)
- yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[2].token))
n.TraitName = name
n.Stmts = yyDollar[6].list
}
-
yyVAL.node = yyDollar[1].node
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[2].token))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(name, yyDollar[2].token, comment.StringToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[5].token, comment.OpenCurlyBracesToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[7].token, comment.CloseCurlyBracesToken)
}
case 95:
yyDollar = yyS[yypt-6 : yypt+1]
- //line php5/php5.y:956
+ //line php5/php5.y:1307
{
name := node.NewIdentifier(yyDollar[2].token.Value)
- yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[2].token))
- yylex.(*Parser).comments.AddComments(name, yyDollar[2].token.Comments())
+ yyVAL.node = stmt.NewInterface(name, yyDollar[3].InterfaceExtends, yyDollar[5].list, "")
- yyVAL.node = stmt.NewInterface(name, yyDollar[3].list, yyDollar[5].list, "")
+ // save position
+ yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[2].token))
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[6].token))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(name, yyDollar[2].token, comment.StringToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[4].token, comment.OpenCurlyBracesToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[6].token, comment.CloseCurlyBracesToken)
}
case 96:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php5/php5.y:970
+ //line php5/php5.y:1325
{
yyVAL.node = stmt.NewClass(nil, nil, nil, nil, nil, nil, "")
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.ClassToken)
}
case 97:
yyDollar = yyS[yypt-2 : yypt+1]
- //line php5/php5.y:976
+ //line php5/php5.y:1335
{
classModifier := node.NewIdentifier(yyDollar[1].token.Value)
- yylex.(*Parser).positions.AddPosition(classModifier, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
- yylex.(*Parser).comments.AddComments(classModifier, yyDollar[1].token.Comments())
-
yyVAL.node = stmt.NewClass(nil, []node.Node{classModifier}, nil, nil, nil, nil, "")
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(classModifier, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[2].token))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(classModifier, yyDollar[1].token, comment.AbstractToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.ClassToken)
}
case 98:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php5/php5.y:986
+ //line php5/php5.y:1348
{
yyVAL.node = stmt.NewTrait(nil, nil, "")
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.TraitToken)
}
case 99:
yyDollar = yyS[yypt-2 : yypt+1]
- //line php5/php5.y:992
+ //line php5/php5.y:1358
{
classModifier := node.NewIdentifier(yyDollar[1].token.Value)
- yylex.(*Parser).positions.AddPosition(classModifier, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
- yylex.(*Parser).comments.AddComments(classModifier, yyDollar[1].token.Comments())
-
yyVAL.node = stmt.NewClass(nil, []node.Node{classModifier}, nil, nil, nil, nil, "")
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(classModifier, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[2].token))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(classModifier, yyDollar[1].token, comment.FinalToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.ClassToken)
}
case 100:
yyDollar = yyS[yypt-0 : yypt+1]
- //line php5/php5.y:1005
+ //line php5/php5.y:1374
{
- yyVAL.node = nil
+ yyVAL.ClassExtends = nil
}
case 101:
yyDollar = yyS[yypt-2 : yypt+1]
- //line php5/php5.y:1007
+ //line php5/php5.y:1376
{
- yyVAL.node = yyDollar[2].node
+ yyVAL.ClassExtends = stmt.NewClassExtends(yyDollar[2].node)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(yyVAL.ClassExtends, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[2].node))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.ClassExtends, yyDollar[1].token, comment.ExtendsToken)
}
case 102:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php5/php5.y:1012
+ //line php5/php5.y:1389
{
yyVAL.token = yyDollar[1].token
}
case 103:
yyDollar = yyS[yypt-0 : yypt+1]
- //line php5/php5.y:1017
+ //line php5/php5.y:1394
{
- yyVAL.list = nil
+ yyVAL.InterfaceExtends = nil
}
case 104:
yyDollar = yyS[yypt-2 : yypt+1]
- //line php5/php5.y:1019
+ //line php5/php5.y:1396
{
- yyVAL.list = yyDollar[2].list
+ yyVAL.InterfaceExtends = stmt.NewInterfaceExtends(yyDollar[2].list)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(yyVAL.InterfaceExtends, yylex.(*Parser).positionBuilder.NewTokenNodeListPosition(yyDollar[1].token, yyDollar[2].list))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.InterfaceExtends, yyDollar[1].token, comment.ExtendsToken)
}
case 105:
yyDollar = yyS[yypt-0 : yypt+1]
- //line php5/php5.y:1024
+ //line php5/php5.y:1409
{
- yyVAL.list = nil
+ yyVAL.ClassImplements = nil
}
case 106:
yyDollar = yyS[yypt-2 : yypt+1]
- //line php5/php5.y:1026
+ //line php5/php5.y:1411
{
- yyVAL.list = yyDollar[2].list
+ yyVAL.ClassImplements = stmt.NewClassImplements(yyDollar[2].list)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(yyVAL.ClassImplements, yylex.(*Parser).positionBuilder.NewTokenNodeListPosition(yyDollar[1].token, yyDollar[2].list))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.ClassImplements, yyDollar[1].token, comment.ImplementsToken)
}
case 107:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php5/php5.y:1031
+ //line php5/php5.y:1424
{
yyVAL.list = []node.Node{yyDollar[1].node}
}
case 108:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php5/php5.y:1033
+ //line php5/php5.y:1426
{
yyVAL.list = append(yyDollar[1].list, yyDollar[3].node)
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(lastNode(yyDollar[1].list), yyDollar[2].token, comment.CommaToken)
}
case 109:
yyDollar = yyS[yypt-0 : yypt+1]
- //line php5/php5.y:1038
+ //line php5/php5.y:1436
{
- yyVAL.foreachVariable = foreachVariable{nil, false}
+ yyVAL.node = nil
}
case 110:
yyDollar = yyS[yypt-2 : yypt+1]
- //line php5/php5.y:1040
+ //line php5/php5.y:1438
{
- yyVAL.foreachVariable = yyDollar[2].foreachVariable
+ yyVAL.node = yyDollar[2].node
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.DoubleArrowToken)
}
case 111:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php5/php5.y:1045
+ //line php5/php5.y:1448
{
- yyVAL.foreachVariable = foreachVariable{yyDollar[1].node, false}
+ yyVAL.node = yyDollar[1].node
}
case 112:
yyDollar = yyS[yypt-2 : yypt+1]
- //line php5/php5.y:1047
+ //line php5/php5.y:1450
{
- yyVAL.foreachVariable = foreachVariable{yyDollar[2].node, true}
+ yyVAL.node = expr.NewReference(yyDollar[2].node)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(yyDollar[2].node, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[2].node))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.AmpersandToken)
}
case 113:
yyDollar = yyS[yypt-4 : yypt+1]
- //line php5/php5.y:1049
+ //line php5/php5.y:1460
{
- list := expr.NewList(yyDollar[3].list)
- yylex.(*Parser).positions.AddPosition(list, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[4].token))
- yyVAL.foreachVariable = foreachVariable{list, false}
- yylex.(*Parser).comments.AddComments(list, yyDollar[1].token.Comments())
+ yyVAL.node = expr.NewList(yyDollar[3].list)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[4].token))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.ListToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.OpenParenthesisToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[4].token, comment.CloseParenthesisToken)
}
case 114:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php5/php5.y:1059
+ //line php5/php5.y:1475
{
- yyVAL.altSyntaxNode = altSyntaxNode{yyDollar[1].node, false}
+ yyVAL.node = stmt.NewFor(nil, nil, nil, yyDollar[1].node)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodePosition(yyDollar[1].node))
}
case 115:
yyDollar = yyS[yypt-4 : yypt+1]
- //line php5/php5.y:1061
+ //line php5/php5.y:1482
{
- yyVAL.altSyntaxNode = altSyntaxNode{stmt.NewStmtList(yyDollar[2].list), true}
- yylex.(*Parser).positions.AddPosition(yyVAL.altSyntaxNode.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[4].token))
+ stmtList := stmt.NewStmtList(yyDollar[2].list)
+ yyVAL.node = stmt.NewAltFor(nil, nil, nil, stmtList)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(stmtList, yylex.(*Parser).positionBuilder.NewNodeListPosition(yyDollar[2].list))
+ yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[4].token))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.ColonToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[3].token, comment.EndforToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[4].token, comment.SemiColonToken)
}
case 116:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php5/php5.y:1070
+ //line php5/php5.y:1499
{
- yyVAL.altSyntaxNode = altSyntaxNode{yyDollar[1].node, false}
+ yyVAL.node = stmt.NewForeach(nil, nil, nil, yyDollar[1].node)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodePosition(yyDollar[1].node))
}
case 117:
yyDollar = yyS[yypt-4 : yypt+1]
- //line php5/php5.y:1072
+ //line php5/php5.y:1506
{
- yyVAL.altSyntaxNode = altSyntaxNode{stmt.NewStmtList(yyDollar[2].list), true}
- yylex.(*Parser).positions.AddPosition(yyVAL.altSyntaxNode.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[4].token))
+ stmtList := stmt.NewStmtList(yyDollar[2].list)
+ yyVAL.node = stmt.NewAltForeach(nil, nil, nil, stmtList)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(stmtList, yylex.(*Parser).positionBuilder.NewNodeListPosition(yyDollar[2].list))
+ yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[4].token))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.ColonToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[3].token, comment.EndforeachToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[4].token, comment.SemiColonToken)
}
case 118:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php5/php5.y:1081
+ //line php5/php5.y:1524
{
yyVAL.node = yyDollar[1].node
}
case 119:
yyDollar = yyS[yypt-4 : yypt+1]
- //line php5/php5.y:1083
+ //line php5/php5.y:1526
{
yyVAL.node = stmt.NewStmtList(yyDollar[2].list)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[4].token))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.ColonToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[3].token, comment.EnddeclareToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[4].token, comment.SemiColonToken)
}
case 120:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php5/php5.y:1093
+ //line php5/php5.y:1542
{
name := node.NewIdentifier(yyDollar[1].token.Value)
- yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
- yylex.(*Parser).comments.AddComments(name, yyDollar[1].token.Comments())
-
constant := stmt.NewConstant(name, yyDollar[3].node, "")
- yylex.(*Parser).positions.AddPosition(constant, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[3].node))
- yylex.(*Parser).comments.AddComments(constant, yyDollar[1].token.Comments())
-
yyVAL.list = []node.Node{constant}
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
+ yylex.(*Parser).positions.AddPosition(constant, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[3].node))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(name, yyDollar[1].token, comment.StringToken)
+ yylex.(*Parser).comments.AddFromToken(constant, yyDollar[2].token, comment.EqualToken)
}
case 121:
yyDollar = yyS[yypt-5 : yypt+1]
- //line php5/php5.y:1105
+ //line php5/php5.y:1556
{
name := node.NewIdentifier(yyDollar[3].token.Value)
- yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[3].token))
- yylex.(*Parser).comments.AddComments(name, yyDollar[3].token.Comments())
-
constant := stmt.NewConstant(name, yyDollar[5].node, "")
- yylex.(*Parser).positions.AddPosition(constant, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[3].token, yyDollar[5].node))
- yylex.(*Parser).comments.AddComments(constant, yyDollar[3].token.Comments())
-
yyVAL.list = append(yyDollar[1].list, constant)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[3].token))
+ yylex.(*Parser).positions.AddPosition(constant, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[3].token, yyDollar[5].node))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(lastNode(yyDollar[1].list), yyDollar[2].token, comment.CommaToken)
+ yylex.(*Parser).comments.AddFromToken(name, yyDollar[3].token, comment.StringToken)
+ yylex.(*Parser).comments.AddFromToken(constant, yyDollar[4].token, comment.EqualToken)
}
case 122:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php5/php5.y:1121
+ //line php5/php5.y:1575
{
- yyVAL.nodesWithEndToken = &nodesWithEndToken{yyDollar[2].list, yyDollar[3].token}
+ caseList := stmt.NewCaseList(yyDollar[2].list)
+ yyVAL.node = stmt.NewSwitch(nil, caseList)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(caseList, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[3].token))
+ yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[3].token))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(caseList, yyDollar[1].token, comment.OpenCurlyBracesToken)
+ yylex.(*Parser).comments.AddFromToken(caseList, yyDollar[3].token, comment.CloseCurlyBracesToken)
}
case 123:
yyDollar = yyS[yypt-4 : yypt+1]
- //line php5/php5.y:1123
+ //line php5/php5.y:1588
{
- yyVAL.nodesWithEndToken = &nodesWithEndToken{yyDollar[3].list, yyDollar[4].token}
+ caseList := stmt.NewCaseList(yyDollar[3].list)
+ yyVAL.node = stmt.NewSwitch(nil, caseList)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(caseList, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[4].token))
+ yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[4].token))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(caseList, yyDollar[1].token, comment.OpenCurlyBracesToken)
+ yylex.(*Parser).comments.AddFromToken(caseList, yyDollar[2].token, comment.SemiColonToken)
+ yylex.(*Parser).comments.AddFromToken(caseList, yyDollar[4].token, comment.CloseCurlyBracesToken)
}
case 124:
yyDollar = yyS[yypt-4 : yypt+1]
- //line php5/php5.y:1125
+ //line php5/php5.y:1602
{
- yyVAL.nodesWithEndToken = &nodesWithEndToken{yyDollar[2].list, yyDollar[4].token}
+ caseList := stmt.NewCaseList(yyDollar[2].list)
+ yyVAL.node = stmt.NewAltSwitch(nil, caseList)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(caseList, yylex.(*Parser).positionBuilder.NewNodeListPosition(yyDollar[2].list))
+ yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[4].token))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(caseList, yyDollar[1].token, comment.ColonToken)
+ yylex.(*Parser).comments.AddFromToken(caseList, yyDollar[3].token, comment.EndswitchToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[4].token, comment.SemiColonToken)
}
case 125:
yyDollar = yyS[yypt-5 : yypt+1]
- //line php5/php5.y:1127
+ //line php5/php5.y:1616
{
- yyVAL.nodesWithEndToken = &nodesWithEndToken{yyDollar[3].list, yyDollar[5].token}
+
+ caseList := stmt.NewCaseList(yyDollar[3].list)
+ yyVAL.node = stmt.NewAltSwitch(nil, caseList)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(caseList, yylex.(*Parser).positionBuilder.NewNodeListPosition(yyDollar[3].list))
+ yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[5].token))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(caseList, yyDollar[1].token, comment.ColonToken)
+ yylex.(*Parser).comments.AddFromToken(caseList, yyDollar[2].token, comment.SemiColonToken)
+ yylex.(*Parser).comments.AddFromToken(caseList, yyDollar[4].token, comment.EndswitchToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[5].token, comment.SemiColonToken)
}
case 126:
yyDollar = yyS[yypt-0 : yypt+1]
- //line php5/php5.y:1133
+ //line php5/php5.y:1636
{
yyVAL.list = []node.Node{}
}
case 127:
yyDollar = yyS[yypt-5 : yypt+1]
- //line php5/php5.y:1135
+ //line php5/php5.y:1638
{
_case := stmt.NewCase(yyDollar[3].node, yyDollar[5].list)
- yylex.(*Parser).positions.AddPosition(_case, yylex.(*Parser).positionBuilder.NewTokenNodeListPosition(yyDollar[2].token, yyDollar[5].list))
yyVAL.list = append(yyDollar[1].list, _case)
- yylex.(*Parser).comments.AddComments(_case, yyDollar[2].token.Comments())
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(_case, yylex.(*Parser).positionBuilder.NewTokenNodeListPosition(yyDollar[2].token, yyDollar[5].list))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(_case, yyDollar[2].token, comment.CaseToken)
+ yylex.(*Parser).comments.AddFromToken(_case, yyDollar[4].token, comment.CaseSeparatorToken)
}
case 128:
yyDollar = yyS[yypt-4 : yypt+1]
- //line php5/php5.y:1142
+ //line php5/php5.y:1650
{
_default := stmt.NewDefault(yyDollar[4].list)
- yylex.(*Parser).positions.AddPosition(_default, yylex.(*Parser).positionBuilder.NewTokenNodeListPosition(yyDollar[2].token, yyDollar[4].list))
yyVAL.list = append(yyDollar[1].list, _default)
- yylex.(*Parser).comments.AddComments(_default, yyDollar[2].token.Comments())
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(_default, yylex.(*Parser).positionBuilder.NewTokenNodeListPosition(yyDollar[2].token, yyDollar[4].list))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(_default, yyDollar[2].token, comment.DefaultToken)
+ yylex.(*Parser).comments.AddFromToken(_default, yyDollar[3].token, comment.CaseSeparatorToken)
+ }
+ case 129:
+ yyDollar = yyS[yypt-1 : yypt+1]
+ //line php5/php5.y:1666
+ {
+ yyVAL.token = yyDollar[1].token
+ }
+ case 130:
+ yyDollar = yyS[yypt-1 : yypt+1]
+ //line php5/php5.y:1668
+ {
+ yyVAL.token = yyDollar[1].token
}
case 131:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php5/php5.y:1159
+ //line php5/php5.y:1674
{
- yyVAL.altSyntaxNode = altSyntaxNode{yyDollar[1].node, false}
+ yyVAL.node = stmt.NewWhile(nil, yyDollar[1].node)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodePosition(yyDollar[1].node))
}
case 132:
yyDollar = yyS[yypt-4 : yypt+1]
- //line php5/php5.y:1161
+ //line php5/php5.y:1681
{
- yyVAL.altSyntaxNode = altSyntaxNode{stmt.NewStmtList(yyDollar[2].list), true}
- yylex.(*Parser).positions.AddPosition(yyVAL.altSyntaxNode.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[4].token))
+ stmtList := stmt.NewStmtList(yyDollar[2].list)
+ yyVAL.node = stmt.NewAltWhile(nil, stmtList)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(stmtList, yylex.(*Parser).positionBuilder.NewNodeListPosition(yyDollar[2].list))
+ yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[4].token))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.ColonToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[3].token, comment.EndwhileToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[4].token, comment.SemiColonToken)
}
case 133:
yyDollar = yyS[yypt-0 : yypt+1]
- //line php5/php5.y:1171
+ //line php5/php5.y:1700
{
yyVAL.list = nil
}
case 134:
yyDollar = yyS[yypt-4 : yypt+1]
- //line php5/php5.y:1173
+ //line php5/php5.y:1702
{
_elseIf := stmt.NewElseIf(yyDollar[3].node, yyDollar[4].node)
- yylex.(*Parser).positions.AddPosition(_elseIf, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[2].token, yyDollar[4].node))
- yylex.(*Parser).comments.AddComments(_elseIf, yyDollar[2].token.Comments())
-
yyVAL.list = append(yyDollar[1].list, _elseIf)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(_elseIf, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[2].token, yyDollar[4].node))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(_elseIf, yyDollar[2].token, comment.ElseifToken)
}
case 135:
yyDollar = yyS[yypt-0 : yypt+1]
- //line php5/php5.y:1185
+ //line php5/php5.y:1717
{
yyVAL.list = nil
}
case 136:
yyDollar = yyS[yypt-5 : yypt+1]
- //line php5/php5.y:1187
+ //line php5/php5.y:1719
{
stmts := stmt.NewStmtList(yyDollar[5].list)
- yylex.(*Parser).positions.AddPosition(stmts, yylex.(*Parser).positionBuilder.NewNodeListPosition(yyDollar[5].list))
-
_elseIf := stmt.NewAltElseIf(yyDollar[3].node, stmts)
- yylex.(*Parser).positions.AddPosition(_elseIf, yylex.(*Parser).positionBuilder.NewTokenNodeListPosition(yyDollar[2].token, yyDollar[5].list))
- yylex.(*Parser).comments.AddComments(_elseIf, yyDollar[2].token.Comments())
-
yyVAL.list = append(yyDollar[1].list, _elseIf)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(stmts, yylex.(*Parser).positionBuilder.NewNodeListPosition(yyDollar[5].list))
+ yylex.(*Parser).positions.AddPosition(_elseIf, yylex.(*Parser).positionBuilder.NewTokenNodeListPosition(yyDollar[2].token, yyDollar[5].list))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(_elseIf, yyDollar[2].token, comment.ElseifToken)
+ yylex.(*Parser).comments.AddFromToken(_elseIf, yyDollar[4].token, comment.ColonToken)
}
case 137:
yyDollar = yyS[yypt-0 : yypt+1]
- //line php5/php5.y:1202
+ //line php5/php5.y:1737
{
yyVAL.node = nil
}
case 138:
yyDollar = yyS[yypt-2 : yypt+1]
- //line php5/php5.y:1204
+ //line php5/php5.y:1739
{
yyVAL.node = stmt.NewElse(yyDollar[2].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[2].node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.ElseToken)
}
case 139:
yyDollar = yyS[yypt-0 : yypt+1]
- //line php5/php5.y:1214
+ //line php5/php5.y:1753
{
yyVAL.node = nil
}
case 140:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php5/php5.y:1216
+ //line php5/php5.y:1755
{
stmts := stmt.NewStmtList(yyDollar[3].list)
- yylex.(*Parser).positions.AddPosition(stmts, yylex.(*Parser).positionBuilder.NewNodeListPosition(yyDollar[3].list))
-
yyVAL.node = stmt.NewAltElse(stmts)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(stmts, yylex.(*Parser).positionBuilder.NewNodeListPosition(yyDollar[3].list))
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenNodeListPosition(yyDollar[1].token, yyDollar[3].list))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.ElseToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.ColonToken)
}
case 141:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php5/php5.y:1229
+ //line php5/php5.y:1772
{
yyVAL.list = yyDollar[1].list
}
case 142:
yyDollar = yyS[yypt-0 : yypt+1]
- //line php5/php5.y:1231
+ //line php5/php5.y:1774
{
yyVAL.list = nil
}
case 143:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php5/php5.y:1236
+ //line php5/php5.y:1779
{
yyVAL.list = []node.Node{yyDollar[1].node}
}
case 144:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php5/php5.y:1238
+ //line php5/php5.y:1781
{
yyVAL.list = append(yyDollar[1].list, yyDollar[3].node)
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(lastNode(yyDollar[1].list), yyDollar[2].token, comment.CommaToken)
}
case 145:
yyDollar = yyS[yypt-4 : yypt+1]
- //line php5/php5.y:1243
+ //line php5/php5.y:1791
{
identifier := node.NewIdentifier(strings.TrimLeft(yyDollar[4].token.Value, "$"))
- yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[4].token))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[4].token.Comments())
-
variable := expr.NewVariable(identifier)
+ yyVAL.node = node.NewParameter(yyDollar[1].node, variable, nil, yyDollar[2].token != nil, yyDollar[3].token != nil)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[4].token))
yylex.(*Parser).positions.AddPosition(variable, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[4].token))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[4].token.Comments())
-
- yyVAL.node = node.NewParameter(yyDollar[1].node, variable, nil, yyDollar[2].boolWithToken.value, yyDollar[3].boolWithToken.value)
-
if yyDollar[1].node != nil {
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodeTokenPosition(yyDollar[1].node, yyDollar[4].token))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node])
- } else if yyDollar[2].boolWithToken.value == true {
- yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(*yyDollar[2].boolWithToken.token, yyDollar[4].token))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[2].boolWithToken.token.Comments())
- } else if yyDollar[3].boolWithToken.value == true {
- yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(*yyDollar[3].boolWithToken.token, yyDollar[4].token))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[3].boolWithToken.token.Comments())
+ } else if yyDollar[2].token != nil {
+ yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[2].token, yyDollar[4].token))
+ } else if yyDollar[3].token != nil {
+ yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[3].token, yyDollar[4].token))
} else {
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[4].token))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[4].token.Comments())
}
+
+ // save comments
+ if yyDollar[2].token != nil {
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.AmpersandToken)
+ }
+ if yyDollar[3].token != nil {
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[3].token, comment.EllipsisToken)
+ }
+ yylex.(*Parser).comments.AddFromToken(variable, yyDollar[4].token, comment.VariableToken)
}
case 146:
yyDollar = yyS[yypt-6 : yypt+1]
- //line php5/php5.y:1269
+ //line php5/php5.y:1819
{
identifier := node.NewIdentifier(strings.TrimLeft(yyDollar[4].token.Value, "$"))
- yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[4].token))
- yylex.(*Parser).comments.AddComments(identifier, yyDollar[4].token.Comments())
-
variable := expr.NewVariable(identifier)
+ yyVAL.node = node.NewParameter(yyDollar[1].node, variable, yyDollar[6].node, yyDollar[2].token != nil, yyDollar[3].token != nil)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[4].token))
yylex.(*Parser).positions.AddPosition(variable, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[4].token))
- yylex.(*Parser).comments.AddComments(variable, yyDollar[4].token.Comments())
-
- yyVAL.node = node.NewParameter(yyDollar[1].node, variable, yyDollar[6].node, yyDollar[2].boolWithToken.value, yyDollar[3].boolWithToken.value)
-
if yyDollar[1].node != nil {
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[6].node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node])
- } else if yyDollar[2].boolWithToken.value == true {
- yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenNodePosition(*yyDollar[2].boolWithToken.token, yyDollar[6].node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[2].boolWithToken.token.Comments())
- } else if yyDollar[3].boolWithToken.value == true {
- yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenNodePosition(*yyDollar[3].boolWithToken.token, yyDollar[6].node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[3].boolWithToken.token.Comments())
+ } else if yyDollar[2].token != nil {
+ yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[2].token, yyDollar[6].node))
+ } else if yyDollar[3].token != nil {
+ yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[3].token, yyDollar[6].node))
} else {
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[4].token, yyDollar[6].node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[4].token.Comments())
}
+
+ // save comments
+ if yyDollar[2].token != nil {
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.AmpersandToken)
+ }
+ if yyDollar[3].token != nil {
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[3].token, comment.EllipsisToken)
+ }
+ yylex.(*Parser).comments.AddFromToken(variable, yyDollar[4].token, comment.VariableToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[5].token, comment.EqualToken)
}
case 147:
yyDollar = yyS[yypt-0 : yypt+1]
- //line php5/php5.y:1299
+ //line php5/php5.y:1852
{
yyVAL.node = nil
}
case 148:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php5/php5.y:1301
+ //line php5/php5.y:1854
{
yyVAL.node = node.NewIdentifier(yyDollar[1].token.Value)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.ArrayToken)
}
case 149:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php5/php5.y:1307
+ //line php5/php5.y:1864
{
yyVAL.node = node.NewIdentifier(yyDollar[1].token.Value)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.CallableToken)
}
case 150:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php5/php5.y:1313
+ //line php5/php5.y:1874
{
yyVAL.node = yyDollar[1].node
}
case 151:
yyDollar = yyS[yypt-2 : yypt+1]
- //line php5/php5.y:1319
+ //line php5/php5.y:1880
{
- yyVAL.nodesWithEndToken = &nodesWithEndToken{[]node.Node{}, yyDollar[2].token}
+ yyVAL.node = node.NewArgumentList(nil)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[2].token))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.OpenParenthesisToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.CloseParenthesisToken)
}
case 152:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php5/php5.y:1321
+ //line php5/php5.y:1891
{
- yyVAL.nodesWithEndToken = &nodesWithEndToken{yyDollar[2].list, yyDollar[3].token}
+ yyVAL.node = node.NewArgumentList(yyDollar[2].list)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[3].token))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.OpenParenthesisToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[3].token, comment.CloseParenthesisToken)
}
case 153:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php5/php5.y:1323
+ //line php5/php5.y:1902
{
arg := node.NewArgument(yyDollar[2].node, false, false)
- yylex.(*Parser).positions.AddPosition(arg, yylex.(*Parser).positionBuilder.NewNodePosition(yyDollar[2].node))
- yylex.(*Parser).comments.AddComments(arg, yylex.(*Parser).comments[yyDollar[2].node])
+ yyVAL.node = node.NewArgumentList([]node.Node{arg})
- yyVAL.nodesWithEndToken = &nodesWithEndToken{[]node.Node{arg}, yyDollar[3].token}
+ // save position
+ yylex.(*Parser).positions.AddPosition(arg, yylex.(*Parser).positionBuilder.NewNodePosition(yyDollar[2].node))
+ yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[3].token))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.OpenParenthesisToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[3].token, comment.CloseParenthesisToken)
}
case 154:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php5/php5.y:1335
+ //line php5/php5.y:1919
{
yyVAL.list = []node.Node{yyDollar[1].node}
}
case 155:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php5/php5.y:1337
+ //line php5/php5.y:1921
{
yyVAL.list = append(yyDollar[1].list, yyDollar[3].node)
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(lastNode(yyDollar[1].list), yyDollar[2].token, comment.CommaToken)
}
case 156:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php5/php5.y:1342
+ //line php5/php5.y:1931
{
yyVAL.node = node.NewArgument(yyDollar[1].node, false, false)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodePosition(yyDollar[1].node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node])
}
case 157:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php5/php5.y:1348
+ //line php5/php5.y:1938
{
yyVAL.node = node.NewArgument(yyDollar[1].node, false, false)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodePosition(yyDollar[1].node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node])
}
case 158:
yyDollar = yyS[yypt-2 : yypt+1]
- //line php5/php5.y:1354
+ //line php5/php5.y:1945
{
yyVAL.node = node.NewArgument(yyDollar[2].node, false, true)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodePosition(yyDollar[2].node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.AmpersandToken)
}
case 159:
yyDollar = yyS[yypt-2 : yypt+1]
- //line php5/php5.y:1360
+ //line php5/php5.y:1955
{
yyVAL.node = node.NewArgument(yyDollar[2].node, true, false)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[2].node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.EllipsisToken)
}
case 160:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php5/php5.y:1369
+ //line php5/php5.y:1968
{
yyVAL.list = append(yyDollar[1].list, yyDollar[3].node)
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(lastNode(yyDollar[1].list), yyDollar[2].token, comment.CommaToken)
}
case 161:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php5/php5.y:1371
+ //line php5/php5.y:1975
{
yyVAL.list = []node.Node{yyDollar[1].node}
}
case 162:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php5/php5.y:1377
+ //line php5/php5.y:1981
{
name := node.NewIdentifier(strings.TrimLeft(yyDollar[1].token.Value, "$"))
- yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
yyVAL.node = expr.NewVariable(name)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
- yylex.(*Parser).comments.AddComments(name, yyDollar[1].token.Comments())
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.VariableToken)
}
case 163:
yyDollar = yyS[yypt-2 : yypt+1]
- //line php5/php5.y:1387
+ //line php5/php5.y:1993
{
yyVAL.node = expr.NewVariable(yyDollar[2].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[2].node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.DollarToken)
}
case 164:
yyDollar = yyS[yypt-4 : yypt+1]
- //line php5/php5.y:1393
+ //line php5/php5.y:2003
{
yyVAL.node = expr.NewVariable(yyDollar[3].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[4].token))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.DollarToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.OpenCurlyBracesToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[4].token, comment.CloseCurlyBracesToken)
}
case 165:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php5/php5.y:1403
+ //line php5/php5.y:2019
{
identifier := node.NewIdentifier(strings.TrimLeft(yyDollar[3].token.Value, "$"))
- yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[3].token))
-
variable := expr.NewVariable(identifier)
- yylex.(*Parser).positions.AddPosition(variable, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[3].token))
-
staticVar := stmt.NewStaticVar(variable, nil)
- yylex.(*Parser).positions.AddPosition(staticVar, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[3].token))
-
yyVAL.list = append(yyDollar[1].list, staticVar)
- yylex.(*Parser).comments.AddComments(identifier, yyDollar[3].token.Comments())
- yylex.(*Parser).comments.AddComments(variable, yyDollar[3].token.Comments())
- yylex.(*Parser).comments.AddComments(staticVar, yyDollar[3].token.Comments())
+ // save position
+ yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[3].token))
+ yylex.(*Parser).positions.AddPosition(variable, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[3].token))
+ yylex.(*Parser).positions.AddPosition(staticVar, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[3].token))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(lastNode(yyDollar[1].list), yyDollar[2].token, comment.CommaToken)
+ yylex.(*Parser).comments.AddFromToken(variable, yyDollar[3].token, comment.VariableToken)
}
case 166:
yyDollar = yyS[yypt-5 : yypt+1]
- //line php5/php5.y:1420
+ //line php5/php5.y:2035
{
identifier := node.NewIdentifier(strings.TrimLeft(yyDollar[3].token.Value, "$"))
- yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[3].token))
-
variable := expr.NewVariable(identifier)
- yylex.(*Parser).positions.AddPosition(variable, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[3].token))
-
staticVar := stmt.NewStaticVar(variable, yyDollar[5].node)
- yylex.(*Parser).positions.AddPosition(staticVar, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[3].token, yyDollar[5].node))
-
yyVAL.list = append(yyDollar[1].list, staticVar)
- yylex.(*Parser).comments.AddComments(identifier, yyDollar[3].token.Comments())
- yylex.(*Parser).comments.AddComments(variable, yyDollar[3].token.Comments())
- yylex.(*Parser).comments.AddComments(staticVar, yyDollar[3].token.Comments())
+ // save position
+ yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[3].token))
+ yylex.(*Parser).positions.AddPosition(variable, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[3].token))
+ yylex.(*Parser).positions.AddPosition(staticVar, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[3].token, yyDollar[5].node))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(lastNode(yyDollar[1].list), yyDollar[2].token, comment.CommaToken)
+ yylex.(*Parser).comments.AddFromToken(variable, yyDollar[3].token, comment.VariableToken)
+ yylex.(*Parser).comments.AddFromToken(staticVar, yyDollar[4].token, comment.EqualToken)
}
case 167:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php5/php5.y:1437
+ //line php5/php5.y:2052
{
identifier := node.NewIdentifier(strings.TrimLeft(yyDollar[1].token.Value, "$"))
- yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
-
variable := expr.NewVariable(identifier)
- yylex.(*Parser).positions.AddPosition(variable, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
-
staticVar := stmt.NewStaticVar(variable, nil)
- yylex.(*Parser).positions.AddPosition(staticVar, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
-
yyVAL.list = []node.Node{staticVar}
- yylex.(*Parser).comments.AddComments(identifier, yyDollar[1].token.Comments())
- yylex.(*Parser).comments.AddComments(variable, yyDollar[1].token.Comments())
- yylex.(*Parser).comments.AddComments(staticVar, yyDollar[1].token.Comments())
+ // save position
+ yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
+ yylex.(*Parser).positions.AddPosition(variable, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
+ yylex.(*Parser).positions.AddPosition(staticVar, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(variable, yyDollar[1].token, comment.VariableToken)
}
case 168:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php5/php5.y:1454
+ //line php5/php5.y:2067
{
identifier := node.NewIdentifier(strings.TrimLeft(yyDollar[1].token.Value, "$"))
- yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
-
variable := expr.NewVariable(identifier)
- yylex.(*Parser).positions.AddPosition(variable, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
-
staticVar := stmt.NewStaticVar(variable, yyDollar[3].node)
- yylex.(*Parser).positions.AddPosition(staticVar, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[3].node))
-
yyVAL.list = []node.Node{staticVar}
- yylex.(*Parser).comments.AddComments(identifier, yyDollar[1].token.Comments())
- yylex.(*Parser).comments.AddComments(variable, yyDollar[1].token.Comments())
- yylex.(*Parser).comments.AddComments(staticVar, yyDollar[1].token.Comments())
+ // save position
+ yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
+ yylex.(*Parser).positions.AddPosition(variable, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
+ yylex.(*Parser).positions.AddPosition(staticVar, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[3].node))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(variable, yyDollar[1].token, comment.VariableToken)
+ yylex.(*Parser).comments.AddFromToken(staticVar, yyDollar[2].token, comment.EqualToken)
}
case 169:
yyDollar = yyS[yypt-2 : yypt+1]
- //line php5/php5.y:1476
+ //line php5/php5.y:2087
{
yyVAL.list = append(yyDollar[1].list, yyDollar[2].node)
}
case 170:
yyDollar = yyS[yypt-0 : yypt+1]
- //line php5/php5.y:1478
+ //line php5/php5.y:2089
{
yyVAL.list = []node.Node{}
}
case 171:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php5/php5.y:1484
+ //line php5/php5.y:2095
{
yyVAL.node = stmt.NewPropertyList(yyDollar[1].list, yyDollar[2].list)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodeListTokenPosition(yyDollar[1].list, yyDollar[3].token))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).listGetFirstNodeComments(yyDollar[1].list))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[3].token, comment.SemiColonToken)
}
case 172:
yyDollar = yyS[yypt-2 : yypt+1]
- //line php5/php5.y:1490
+ //line php5/php5.y:2105
{
yyVAL.node = yyDollar[1].node
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodeTokenPosition(yyDollar[1].node, yyDollar[2].token))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.SemiColonToken)
}
case 173:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php5/php5.y:1492
+ //line php5/php5.y:2115
{
yyVAL.node = yyDollar[1].node
}
case 174:
yyDollar = yyS[yypt-8 : yypt+1]
- //line php5/php5.y:1494
+ //line php5/php5.y:2119
{
name := node.NewIdentifier(yyDollar[4].token.Value)
- yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[4].token))
- yylex.(*Parser).comments.AddComments(name, yyDollar[4].token.Comments())
+ yyVAL.node = stmt.NewClassMethod(name, yyDollar[1].list, yyDollar[3].token != nil, yyDollar[6].list, nil, yyDollar[8].node, "")
- yyVAL.node = stmt.NewClassMethod(name, yyDollar[1].list, yyDollar[3].boolWithToken.value, yyDollar[6].list, nil, yyDollar[8].nodesWithEndToken.nodes, "")
- yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewOptionalListTokensPosition(yyDollar[1].list, yyDollar[2].token, yyDollar[8].nodesWithEndToken.endToken))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).listGetFirstNodeComments(yyDollar[1].list))
+ // save position
+ yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[4].token))
+ if yyDollar[1].list == nil {
+ yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[2].token, yyDollar[8].node))
+ } else {
+ yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodeListNodePosition(yyDollar[1].list, yyDollar[8].node))
+ }
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.FunctionToken)
+ if yyDollar[3].token != nil {
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[3].token, comment.AmpersandToken)
+ }
+ yylex.(*Parser).comments.AddFromToken(name, yyDollar[4].token, comment.IdentifierToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[5].token, comment.OpenParenthesisToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[7].token, comment.CloseParenthesisToken)
}
case 175:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php5/php5.y:1507
+ //line php5/php5.y:2144
{
- yyVAL.node = stmt.NewTraitUse(yyDollar[2].list, yyDollar[3].nodesWithEndToken.nodes)
- yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[3].nodesWithEndToken.endToken))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+ 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)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[3].node))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.UseToken)
}
case 176:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php5/php5.y:1516
+ //line php5/php5.y:2164
{
yyVAL.list = []node.Node{yyDollar[1].node}
}
case 177:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php5/php5.y:1518
+ //line php5/php5.y:2166
{
yyVAL.list = append(yyDollar[1].list, yyDollar[3].node)
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(lastNode(yyDollar[1].list), yyDollar[2].token, comment.CommaToken)
}
case 178:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php5/php5.y:1523
+ //line php5/php5.y:2176
{
- yyVAL.nodesWithEndToken = &nodesWithEndToken{nil, yyDollar[1].token}
+ yyVAL.node = stmt.NewNop()
+
+ yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.SemiColonToken)
+
}
case 179:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php5/php5.y:1525
+ //line php5/php5.y:2186
{
- yyVAL.nodesWithEndToken = &nodesWithEndToken{yyDollar[2].list, yyDollar[3].token}
+ yyVAL.node = stmt.NewTraitAdaptationList(yyDollar[2].list)
+
+ yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[3].token))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.OpenCurlyBracesToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[3].token, comment.CloseCurlyBracesToken)
}
case 180:
yyDollar = yyS[yypt-0 : yypt+1]
- //line php5/php5.y:1530
+ //line php5/php5.y:2199
{
yyVAL.list = nil
}
case 181:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php5/php5.y:1532
+ //line php5/php5.y:2201
{
yyVAL.list = yyDollar[1].list
}
case 182:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php5/php5.y:1537
+ //line php5/php5.y:2206
{
yyVAL.list = []node.Node{yyDollar[1].node}
}
case 183:
yyDollar = yyS[yypt-2 : yypt+1]
- //line php5/php5.y:1539
+ //line php5/php5.y:2208
{
yyVAL.list = append(yyDollar[1].list, yyDollar[2].node)
}
case 184:
yyDollar = yyS[yypt-2 : yypt+1]
- //line php5/php5.y:1544
+ //line php5/php5.y:2213
{
yyVAL.node = yyDollar[1].node
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.SemiColonToken)
}
case 185:
yyDollar = yyS[yypt-2 : yypt+1]
- //line php5/php5.y:1546
+ //line php5/php5.y:2220
{
yyVAL.node = yyDollar[1].node
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.SemiColonToken)
}
case 186:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php5/php5.y:1551
+ //line php5/php5.y:2230
{
yyVAL.node = stmt.NewTraitUsePrecedence(yyDollar[1].node, yyDollar[3].list)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodeNodeListPosition(yyDollar[1].node, yyDollar[3].list))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.InsteadofToken)
}
case 187:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php5/php5.y:1560
+ //line php5/php5.y:2243
{
yyVAL.list = []node.Node{yyDollar[1].node}
}
case 188:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php5/php5.y:1562
+ //line php5/php5.y:2245
{
yyVAL.list = append(yyDollar[1].list, yyDollar[3].node)
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(lastNode(yyDollar[1].list), yyDollar[2].token, comment.CommaToken)
}
case 189:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php5/php5.y:1567
+ //line php5/php5.y:2255
{
name := node.NewIdentifier(yyDollar[1].token.Value)
- yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
- yylex.(*Parser).comments.AddComments(name, yyDollar[1].token.Comments())
-
yyVAL.node = stmt.NewTraitMethodRef(nil, name)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(name, yyDollar[1].token, comment.IdentifierToken)
}
case 190:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php5/php5.y:1577
+ //line php5/php5.y:2267
{
yyVAL.node = yyDollar[1].node
}
case 191:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php5/php5.y:1582
+ //line php5/php5.y:2272
{
target := node.NewIdentifier(yyDollar[3].token.Value)
- yylex.(*Parser).positions.AddPosition(target, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[3].token))
- yylex.(*Parser).comments.AddComments(target, yyDollar[3].token.Comments())
-
yyVAL.node = stmt.NewTraitMethodRef(yyDollar[1].node, target)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(target, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[3].token))
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodeTokenPosition(yyDollar[1].node, yyDollar[3].token))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.PaamayimNekudotayimToken)
+ yylex.(*Parser).comments.AddFromToken(target, yyDollar[3].token, comment.IdentifierToken)
}
case 192:
yyDollar = yyS[yypt-4 : yypt+1]
- //line php5/php5.y:1595
+ //line php5/php5.y:2288
{
alias := node.NewIdentifier(yyDollar[4].token.Value)
- yylex.(*Parser).positions.AddPosition(alias, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[4].token))
yyVAL.node = stmt.NewTraitUseAlias(yyDollar[1].node, yyDollar[3].node, alias)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(alias, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[4].token))
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodeTokenPosition(yyDollar[1].node, yyDollar[4].token))
- yylex.(*Parser).comments.AddComments(alias, yyDollar[4].token.Comments())
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node])
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.AsToken)
+ yylex.(*Parser).comments.AddFromToken(alias, yyDollar[4].token, comment.IdentifierToken)
}
case 193:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php5/php5.y:1605
+ //line php5/php5.y:2301
{
yyVAL.node = stmt.NewTraitUseAlias(yyDollar[1].node, yyDollar[3].node, nil)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.AsToken)
}
case 194:
yyDollar = yyS[yypt-0 : yypt+1]
- //line php5/php5.y:1614
+ //line php5/php5.y:2314
{
yyVAL.node = nil
}
case 195:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php5/php5.y:1616
+ //line php5/php5.y:2316
{
yyVAL.node = yyDollar[1].node
}
case 196:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php5/php5.y:1621
+ //line php5/php5.y:2321
{
- yyVAL.nodesWithEndToken = &nodesWithEndToken{nil, yyDollar[1].token}
+ yyVAL.node = stmt.NewNop()
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.SemiColonToken)
}
case 197:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php5/php5.y:1623
+ //line php5/php5.y:2331
{
- yyVAL.nodesWithEndToken = &nodesWithEndToken{yyDollar[2].list, yyDollar[3].token}
+ yyVAL.node = stmt.NewStmtList(yyDollar[2].list)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[3].token))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.OpenCurlyBracesToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[3].token, comment.CloseCurlyBracesToken)
}
case 198:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php5/php5.y:1628
+ //line php5/php5.y:2345
{
yyVAL.list = yyDollar[1].list
}
case 199:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php5/php5.y:1630
+ //line php5/php5.y:2347
{
modifier := node.NewIdentifier(yyDollar[1].token.Value)
- yylex.(*Parser).positions.AddPosition(modifier, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
- yylex.(*Parser).comments.AddComments(modifier, yyDollar[1].token.Comments())
-
yyVAL.list = []node.Node{modifier}
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(modifier, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(modifier, yyDollar[1].token, comment.VarToken)
}
case 200:
yyDollar = yyS[yypt-0 : yypt+1]
- //line php5/php5.y:1641
+ //line php5/php5.y:2361
{
yyVAL.list = nil
}
case 201:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php5/php5.y:1643
+ //line php5/php5.y:2363
{
yyVAL.list = yyDollar[1].list
}
case 202:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php5/php5.y:1648
+ //line php5/php5.y:2368
{
yyVAL.list = []node.Node{yyDollar[1].node}
}
case 203:
yyDollar = yyS[yypt-2 : yypt+1]
- //line php5/php5.y:1650
+ //line php5/php5.y:2370
{
yyVAL.list = append(yyDollar[1].list, yyDollar[2].node)
}
case 204:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php5/php5.y:1655
+ //line php5/php5.y:2375
{
yyVAL.node = node.NewIdentifier(yyDollar[1].token.Value)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.PublicToken)
}
case 205:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php5/php5.y:1661
+ //line php5/php5.y:2385
{
yyVAL.node = node.NewIdentifier(yyDollar[1].token.Value)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.ProtectedToken)
}
case 206:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php5/php5.y:1667
+ //line php5/php5.y:2395
{
yyVAL.node = node.NewIdentifier(yyDollar[1].token.Value)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.PrivateToken)
}
case 207:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php5/php5.y:1673
+ //line php5/php5.y:2405
{
yyVAL.node = node.NewIdentifier(yyDollar[1].token.Value)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.StaticToken)
}
case 208:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php5/php5.y:1679
+ //line php5/php5.y:2415
{
yyVAL.node = node.NewIdentifier(yyDollar[1].token.Value)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.AbstractToken)
}
case 209:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php5/php5.y:1685
+ //line php5/php5.y:2425
{
yyVAL.node = node.NewIdentifier(yyDollar[1].token.Value)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.FinalToken)
}
case 210:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php5/php5.y:1694
+ //line php5/php5.y:2438
{
identifier := node.NewIdentifier(strings.TrimLeft(yyDollar[3].token.Value, "$"))
- yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[3].token))
- yylex.(*Parser).comments.AddComments(identifier, yyDollar[3].token.Comments())
-
variable := expr.NewVariable(identifier)
- yylex.(*Parser).positions.AddPosition(variable, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[3].token))
- yylex.(*Parser).comments.AddComments(variable, yyDollar[3].token.Comments())
-
property := stmt.NewProperty(variable, nil, "")
- yylex.(*Parser).positions.AddPosition(property, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[3].token))
- yylex.(*Parser).comments.AddComments(property, yyDollar[3].token.Comments())
-
yyVAL.list = append(yyDollar[1].list, property)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[3].token))
+ yylex.(*Parser).positions.AddPosition(variable, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[3].token))
+ yylex.(*Parser).positions.AddPosition(property, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[3].token))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(lastNode(yyDollar[1].list), yyDollar[2].token, comment.CommaToken)
+ yylex.(*Parser).comments.AddFromToken(variable, yyDollar[3].token, comment.VariableToken)
}
case 211:
yyDollar = yyS[yypt-5 : yypt+1]
- //line php5/php5.y:1710
+ //line php5/php5.y:2454
{
identifier := node.NewIdentifier(strings.TrimLeft(yyDollar[3].token.Value, "$"))
- yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[3].token))
- yylex.(*Parser).comments.AddComments(identifier, yyDollar[3].token.Comments())
-
variable := expr.NewVariable(identifier)
- yylex.(*Parser).positions.AddPosition(variable, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[3].token))
- yylex.(*Parser).comments.AddComments(variable, yyDollar[3].token.Comments())
-
property := stmt.NewProperty(variable, yyDollar[5].node, "")
- yylex.(*Parser).positions.AddPosition(property, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[3].token, yyDollar[5].node))
- yylex.(*Parser).comments.AddComments(property, yyDollar[3].token.Comments())
-
yyVAL.list = append(yyDollar[1].list, property)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[3].token))
+ yylex.(*Parser).positions.AddPosition(variable, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[3].token))
+ yylex.(*Parser).positions.AddPosition(property, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[3].token, yyDollar[5].node))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(lastNode(yyDollar[1].list), yyDollar[2].token, comment.CommaToken)
+ yylex.(*Parser).comments.AddFromToken(variable, yyDollar[3].token, comment.VariableToken)
+ yylex.(*Parser).comments.AddFromToken(property, yyDollar[4].token, comment.EqualToken)
}
case 212:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php5/php5.y:1726
+ //line php5/php5.y:2471
{
identifier := node.NewIdentifier(strings.TrimLeft(yyDollar[1].token.Value, "$"))
- yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
- yylex.(*Parser).comments.AddComments(identifier, yyDollar[1].token.Comments())
-
variable := expr.NewVariable(identifier)
- yylex.(*Parser).positions.AddPosition(variable, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
- yylex.(*Parser).comments.AddComments(variable, yyDollar[1].token.Comments())
-
property := stmt.NewProperty(variable, nil, "")
- yylex.(*Parser).positions.AddPosition(property, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
- yylex.(*Parser).comments.AddComments(property, yyDollar[1].token.Comments())
-
yyVAL.list = []node.Node{property}
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
+ yylex.(*Parser).positions.AddPosition(variable, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
+ yylex.(*Parser).positions.AddPosition(property, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(variable, yyDollar[1].token, comment.VariableToken)
}
case 213:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php5/php5.y:1742
+ //line php5/php5.y:2486
{
identifier := node.NewIdentifier(strings.TrimLeft(yyDollar[1].token.Value, "$"))
- yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
- yylex.(*Parser).comments.AddComments(identifier, yyDollar[1].token.Comments())
-
variable := expr.NewVariable(identifier)
- yylex.(*Parser).positions.AddPosition(variable, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
- yylex.(*Parser).comments.AddComments(variable, yyDollar[1].token.Comments())
-
property := stmt.NewProperty(variable, yyDollar[3].node, "")
- yylex.(*Parser).positions.AddPosition(property, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[3].node))
- yylex.(*Parser).comments.AddComments(property, yyDollar[1].token.Comments())
-
yyVAL.list = []node.Node{property}
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
+ yylex.(*Parser).positions.AddPosition(variable, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
+ yylex.(*Parser).positions.AddPosition(property, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[3].node))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(variable, yyDollar[1].token, comment.VariableToken)
+ yylex.(*Parser).comments.AddFromToken(property, yyDollar[2].token, comment.EqualToken)
}
case 214:
yyDollar = yyS[yypt-5 : yypt+1]
- //line php5/php5.y:1761
+ //line php5/php5.y:2505
{
name := node.NewIdentifier(yyDollar[3].token.Value)
- yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[3].token))
- yylex.(*Parser).comments.AddComments(name, yyDollar[3].token.Comments())
-
constant := stmt.NewConstant(name, yyDollar[5].node, "")
- yylex.(*Parser).positions.AddPosition(constant, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[3].token, yyDollar[5].node))
- yylex.(*Parser).comments.AddComments(constant, yyDollar[3].token.Comments())
+ constList := yyDollar[1].node.(*stmt.ClassConstList)
+ constList.Consts = append(constList.Consts, constant)
+ yyVAL.node = yyDollar[1].node
- yyDollar[1].node.(*stmt.ClassConstList).Consts = append(yyDollar[1].node.(*stmt.ClassConstList).Consts, constant)
+ // save position
+ yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[3].token))
+ yylex.(*Parser).positions.AddPosition(constant, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[3].token, yyDollar[5].node))
yylex.(*Parser).positions.AddPosition(yyDollar[1].node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[5].node))
- yyVAL.node = yyDollar[1].node
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(lastNode(constList.Consts), yyDollar[2].token, comment.CommaToken)
+ yylex.(*Parser).comments.AddFromToken(name, yyDollar[3].token, comment.IdentifierToken)
+ yylex.(*Parser).comments.AddFromToken(constant, yyDollar[4].token, comment.EqualToken)
}
case 215:
yyDollar = yyS[yypt-4 : yypt+1]
- //line php5/php5.y:1776
+ //line php5/php5.y:2523
{
name := node.NewIdentifier(yyDollar[2].token.Value)
- yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[2].token))
- yylex.(*Parser).comments.AddComments(name, yyDollar[2].token.Comments())
-
constant := stmt.NewConstant(name, yyDollar[4].node, "")
- yylex.(*Parser).positions.AddPosition(constant, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[2].token, yyDollar[4].node))
- yylex.(*Parser).comments.AddComments(constant, yyDollar[2].token.Comments())
-
yyVAL.node = stmt.NewClassConstList(nil, []node.Node{constant})
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[2].token))
+ yylex.(*Parser).positions.AddPosition(constant, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[2].token, yyDollar[4].node))
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[4].node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.ConstToken)
+ yylex.(*Parser).comments.AddFromToken(name, yyDollar[2].token, comment.IdentifierToken)
+ yylex.(*Parser).comments.AddFromToken(constant, yyDollar[3].token, comment.EqualToken)
}
case 216:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php5/php5.y:1793
+ //line php5/php5.y:2542
{
yyVAL.list = append(yyDollar[1].list, yyDollar[3].node)
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(lastNode(yyDollar[1].list), yyDollar[2].token, comment.CommaToken)
}
case 217:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php5/php5.y:1795
+ //line php5/php5.y:2549
{
yyVAL.list = []node.Node{yyDollar[1].node}
}
case 218:
yyDollar = yyS[yypt-0 : yypt+1]
- //line php5/php5.y:1801
+ //line php5/php5.y:2555
{
yyVAL.list = nil
}
case 219:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php5/php5.y:1803
+ //line php5/php5.y:2557
{
yyVAL.list = yyDollar[1].list
}
case 220:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php5/php5.y:1808
+ //line php5/php5.y:2562
{
yyVAL.list = append(yyDollar[1].list, yyDollar[3].node)
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(lastNode(yyDollar[1].list), yyDollar[2].token, comment.CommaToken)
}
case 221:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php5/php5.y:1810
+ //line php5/php5.y:2569
{
yyVAL.list = []node.Node{yyDollar[1].node}
}
case 222:
yyDollar = yyS[yypt-2 : yypt+1]
- //line php5/php5.y:1815
+ //line php5/php5.y:2574
{
yyVAL.list = append(yyDollar[1].list, yyDollar[2].list...)
}
case 223:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php5/php5.y:1817
+ //line php5/php5.y:2576
{
yyVAL.list = yyDollar[1].list
}
case 224:
yyDollar = yyS[yypt-4 : yypt+1]
- //line php5/php5.y:1822
+ //line php5/php5.y:2581
{
fetch := expr.NewArrayDimFetch(nil, yyDollar[3].node)
+ yyVAL.list = append(yyDollar[1].list, fetch)
+
+ // save position
yylex.(*Parser).positions.AddPosition(fetch, yylex.(*Parser).positionBuilder.NewNodePosition(yyDollar[3].node))
- yyVAL.list = append(yyDollar[1].list, fetch)
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(fetch, yyDollar[2].token, comment.OpenSquareBracket)
+ yylex.(*Parser).comments.AddFromToken(fetch, yyDollar[4].token, comment.CloseSquareBracket)
}
case 225:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php5/php5.y:1829
+ //line php5/php5.y:2593
{
fetch := expr.NewArrayDimFetch(nil, yyDollar[2].node)
+ yyVAL.list = []node.Node{fetch}
+
+ // save position
yylex.(*Parser).positions.AddPosition(fetch, yylex.(*Parser).positionBuilder.NewNodePosition(yyDollar[2].node))
- yyVAL.list = []node.Node{fetch}
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(fetch, yyDollar[1].token, comment.OpenSquareBracket)
+ yylex.(*Parser).comments.AddFromToken(fetch, yyDollar[3].token, comment.CloseSquareBracket)
}
case 226:
yyDollar = yyS[yypt-2 : yypt+1]
- //line php5/php5.y:1839
+ //line php5/php5.y:2608
{
yyVAL.list = append(yyDollar[1].list, yyDollar[2].list...)
}
case 227:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php5/php5.y:1841
+ //line php5/php5.y:2610
{
yyVAL.list = yyDollar[1].list
}
case 228:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php5/php5.y:1843
+ //line php5/php5.y:2612
{
yyVAL.list = yyDollar[1].list
}
case 229:
yyDollar = yyS[yypt-0 : yypt+1]
- //line php5/php5.y:1848
+ //line php5/php5.y:2617
{
yyVAL.list = nil
}
case 230:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php5/php5.y:1850
+ //line php5/php5.y:2619
{
yyVAL.list = yyDollar[1].list
}
case 231:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php5/php5.y:1855
+ //line php5/php5.y:2624
{
- if yyDollar[3].nodesWithEndToken != nil {
- yyVAL.node = expr.NewNew(yyDollar[2].node, yyDollar[3].nodesWithEndToken.nodes)
- yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[3].nodesWithEndToken.endToken))
+
+ if yyDollar[3].node != nil {
+ yyVAL.node = expr.NewNew(yyDollar[2].node, yyDollar[3].node.(*node.ArgumentList))
+ yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[3].node))
} else {
yyVAL.node = expr.NewNew(yyDollar[2].node, nil)
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[2].node))
}
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.NewToken)
}
case 232:
yyDollar = yyS[yypt-6 : yypt+1]
- //line php5/php5.y:1870
+ //line php5/php5.y:2641
{
list := expr.NewList(yyDollar[3].list)
- yylex.(*Parser).positions.AddPosition(list, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[4].token))
yyVAL.node = assign.NewAssign(list, yyDollar[6].node)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(list, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[4].token))
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[6].node))
- yylex.(*Parser).comments.AddComments(list, yyDollar[1].token.Comments())
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(list, yyDollar[1].token, comment.ListToken)
+ yylex.(*Parser).comments.AddFromToken(list, yyDollar[2].token, comment.OpenParenthesisToken)
+ yylex.(*Parser).comments.AddFromToken(list, yyDollar[4].token, comment.CloseParenthesisToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[5].token, comment.EqualToken)
}
case 233:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php5/php5.y:1880
+ //line php5/php5.y:2656
{
yyVAL.node = assign.NewAssign(yyDollar[1].node, yyDollar[3].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.EqualToken)
}
case 234:
yyDollar = yyS[yypt-4 : yypt+1]
- //line php5/php5.y:1886
+ //line php5/php5.y:2666
{
yyVAL.node = assign.NewReference(yyDollar[1].node, yyDollar[4].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[4].node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.EqualToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[3].token, comment.AmpersandToken)
}
case 235:
yyDollar = yyS[yypt-6 : yypt+1]
- //line php5/php5.y:1892
+ //line php5/php5.y:2677
{
- _new := expr.NewNew(yyDollar[5].node, nil)
- yylex.(*Parser).positions.AddPosition(_new, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[4].token, yyDollar[5].node))
+ var _new *expr.New
- if yyDollar[6].nodesWithEndToken != nil {
- _new = expr.NewNew(yyDollar[5].node, yyDollar[6].nodesWithEndToken.nodes)
- yylex.(*Parser).positions.AddPosition(_new, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[4].token, yyDollar[6].nodesWithEndToken.endToken))
+ if yyDollar[6].node != nil {
+ _new = expr.NewNew(yyDollar[5].node, yyDollar[6].node.(*node.ArgumentList))
+ } else {
+ _new = expr.NewNew(yyDollar[5].node, nil)
}
- yylex.(*Parser).comments.AddComments(_new, yylex.(*Parser).comments[yyDollar[1].node])
-
yyVAL.node = assign.NewReference(yyDollar[1].node, _new)
+
+ // save position
+ if yyDollar[6].node != nil {
+ yylex.(*Parser).positions.AddPosition(_new, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[4].token, yyDollar[6].node))
+ } else {
+ yylex.(*Parser).positions.AddPosition(_new, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[4].token, yyDollar[5].node))
+ }
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, _new))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.EqualToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[3].token, comment.AmpersandToken)
+ yylex.(*Parser).comments.AddFromToken(_new, yyDollar[4].token, comment.NewToken)
}
case 236:
yyDollar = yyS[yypt-2 : yypt+1]
- //line php5/php5.y:1907
+ //line php5/php5.y:2701
{
yyVAL.node = expr.NewClone(yyDollar[2].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[2].node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.CloneToken)
}
case 237:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php5/php5.y:1913
+ //line php5/php5.y:2711
{
yyVAL.node = assign.NewPlus(yyDollar[1].node, yyDollar[3].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.PlusEqualToken)
}
case 238:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php5/php5.y:1919
+ //line php5/php5.y:2721
{
yyVAL.node = assign.NewMinus(yyDollar[1].node, yyDollar[3].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.MinusEqualToken)
}
case 239:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php5/php5.y:1925
+ //line php5/php5.y:2731
{
yyVAL.node = assign.NewMul(yyDollar[1].node, yyDollar[3].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.MulEqualToken)
}
case 240:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php5/php5.y:1931
+ //line php5/php5.y:2741
{
yyVAL.node = assign.NewPow(yyDollar[1].node, yyDollar[3].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.PowEqualToken)
}
case 241:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php5/php5.y:1937
+ //line php5/php5.y:2751
{
yyVAL.node = assign.NewDiv(yyDollar[1].node, yyDollar[3].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.DivEqualToken)
}
case 242:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php5/php5.y:1943
+ //line php5/php5.y:2761
{
yyVAL.node = assign.NewConcat(yyDollar[1].node, yyDollar[3].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.ConcatEqualToken)
}
case 243:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php5/php5.y:1949
+ //line php5/php5.y:2771
{
yyVAL.node = assign.NewMod(yyDollar[1].node, yyDollar[3].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.ModEqualToken)
}
case 244:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php5/php5.y:1955
+ //line php5/php5.y:2781
{
yyVAL.node = assign.NewBitwiseAnd(yyDollar[1].node, yyDollar[3].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.AndEqualToken)
}
case 245:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php5/php5.y:1961
+ //line php5/php5.y:2791
{
yyVAL.node = assign.NewBitwiseOr(yyDollar[1].node, yyDollar[3].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.OrEqualToken)
}
case 246:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php5/php5.y:1967
+ //line php5/php5.y:2801
{
yyVAL.node = assign.NewBitwiseXor(yyDollar[1].node, yyDollar[3].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.XorEqualToken)
}
case 247:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php5/php5.y:1973
+ //line php5/php5.y:2811
{
yyVAL.node = assign.NewShiftLeft(yyDollar[1].node, yyDollar[3].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.SlEqualToken)
}
case 248:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php5/php5.y:1979
+ //line php5/php5.y:2821
{
yyVAL.node = assign.NewShiftRight(yyDollar[1].node, yyDollar[3].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.SrEqualToken)
}
case 249:
yyDollar = yyS[yypt-2 : yypt+1]
- //line php5/php5.y:1985
+ //line php5/php5.y:2831
{
yyVAL.node = expr.NewPostInc(yyDollar[1].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodeTokenPosition(yyDollar[1].node, yyDollar[2].token))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.IncToken)
}
case 250:
yyDollar = yyS[yypt-2 : yypt+1]
- //line php5/php5.y:1991
+ //line php5/php5.y:2841
{
yyVAL.node = expr.NewPreInc(yyDollar[2].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[2].node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.IncToken)
}
case 251:
yyDollar = yyS[yypt-2 : yypt+1]
- //line php5/php5.y:1997
+ //line php5/php5.y:2851
{
yyVAL.node = expr.NewPostDec(yyDollar[1].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodeTokenPosition(yyDollar[1].node, yyDollar[2].token))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.DecToken)
}
case 252:
yyDollar = yyS[yypt-2 : yypt+1]
- //line php5/php5.y:2003
+ //line php5/php5.y:2861
{
yyVAL.node = expr.NewPreDec(yyDollar[2].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[2].node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.DecToken)
}
case 253:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php5/php5.y:2009
+ //line php5/php5.y:2871
{
yyVAL.node = binary.NewBooleanOr(yyDollar[1].node, yyDollar[3].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.BooleanOrToken)
}
case 254:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php5/php5.y:2015
+ //line php5/php5.y:2881
{
yyVAL.node = binary.NewBooleanAnd(yyDollar[1].node, yyDollar[3].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.BooleanAndToken)
}
case 255:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php5/php5.y:2021
+ //line php5/php5.y:2891
{
yyVAL.node = binary.NewLogicalOr(yyDollar[1].node, yyDollar[3].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.LogicalOrToken)
}
case 256:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php5/php5.y:2027
+ //line php5/php5.y:2901
{
yyVAL.node = binary.NewLogicalAnd(yyDollar[1].node, yyDollar[3].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.LogicalAndToken)
}
case 257:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php5/php5.y:2033
+ //line php5/php5.y:2911
{
yyVAL.node = binary.NewLogicalXor(yyDollar[1].node, yyDollar[3].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.LogicalXorToken)
}
case 258:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php5/php5.y:2039
+ //line php5/php5.y:2921
{
yyVAL.node = binary.NewBitwiseOr(yyDollar[1].node, yyDollar[3].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.VerticalBarToken)
}
case 259:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php5/php5.y:2045
+ //line php5/php5.y:2931
{
yyVAL.node = binary.NewBitwiseAnd(yyDollar[1].node, yyDollar[3].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.AmpersandToken)
}
case 260:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php5/php5.y:2051
+ //line php5/php5.y:2941
{
yyVAL.node = binary.NewBitwiseXor(yyDollar[1].node, yyDollar[3].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.CaretToken)
}
case 261:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php5/php5.y:2057
+ //line php5/php5.y:2951
{
yyVAL.node = binary.NewConcat(yyDollar[1].node, yyDollar[3].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.DotToken)
}
case 262:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php5/php5.y:2063
+ //line php5/php5.y:2961
{
yyVAL.node = binary.NewPlus(yyDollar[1].node, yyDollar[3].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.PlusToken)
}
case 263:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php5/php5.y:2069
+ //line php5/php5.y:2971
{
yyVAL.node = binary.NewMinus(yyDollar[1].node, yyDollar[3].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.MinusToken)
}
case 264:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php5/php5.y:2075
+ //line php5/php5.y:2981
{
yyVAL.node = binary.NewMul(yyDollar[1].node, yyDollar[3].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.AsteriskToken)
}
case 265:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php5/php5.y:2081
+ //line php5/php5.y:2991
{
yyVAL.node = binary.NewPow(yyDollar[1].node, yyDollar[3].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.PowToken)
}
case 266:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php5/php5.y:2087
+ //line php5/php5.y:3001
{
yyVAL.node = binary.NewDiv(yyDollar[1].node, yyDollar[3].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.SlashToken)
}
case 267:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php5/php5.y:2093
+ //line php5/php5.y:3011
{
yyVAL.node = binary.NewMod(yyDollar[1].node, yyDollar[3].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.PercentToken)
}
case 268:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php5/php5.y:2099
+ //line php5/php5.y:3021
{
yyVAL.node = binary.NewShiftLeft(yyDollar[1].node, yyDollar[3].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.SlToken)
}
case 269:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php5/php5.y:2105
+ //line php5/php5.y:3031
{
yyVAL.node = binary.NewShiftRight(yyDollar[1].node, yyDollar[3].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.SrToken)
}
case 270:
yyDollar = yyS[yypt-2 : yypt+1]
- //line php5/php5.y:2111
+ //line php5/php5.y:3041
{
yyVAL.node = expr.NewUnaryPlus(yyDollar[2].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[2].node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.PlusToken)
}
case 271:
yyDollar = yyS[yypt-2 : yypt+1]
- //line php5/php5.y:2117
+ //line php5/php5.y:3051
{
yyVAL.node = expr.NewUnaryMinus(yyDollar[2].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[2].node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.MinusToken)
}
case 272:
yyDollar = yyS[yypt-2 : yypt+1]
- //line php5/php5.y:2123
+ //line php5/php5.y:3061
{
yyVAL.node = expr.NewBooleanNot(yyDollar[2].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[2].node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.ExclamationMarkToken)
}
case 273:
yyDollar = yyS[yypt-2 : yypt+1]
- //line php5/php5.y:2129
+ //line php5/php5.y:3071
{
yyVAL.node = expr.NewBitwiseNot(yyDollar[2].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[2].node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.TildeToken)
}
case 274:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php5/php5.y:2135
+ //line php5/php5.y:3081
{
yyVAL.node = binary.NewIdentical(yyDollar[1].node, yyDollar[3].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.IsIdenticalToken)
}
case 275:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php5/php5.y:2141
+ //line php5/php5.y:3091
{
yyVAL.node = binary.NewNotIdentical(yyDollar[1].node, yyDollar[3].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.IsNotIdenticalToken)
}
case 276:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php5/php5.y:2147
+ //line php5/php5.y:3101
{
yyVAL.node = binary.NewEqual(yyDollar[1].node, yyDollar[3].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.IsEqualToken)
}
case 277:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php5/php5.y:2153
+ //line php5/php5.y:3111
{
yyVAL.node = binary.NewNotEqual(yyDollar[1].node, yyDollar[3].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.IsNotEqualToken)
}
case 278:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php5/php5.y:2159
+ //line php5/php5.y:3121
{
yyVAL.node = binary.NewSmaller(yyDollar[1].node, yyDollar[3].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.LessToken)
}
case 279:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php5/php5.y:2165
+ //line php5/php5.y:3131
{
yyVAL.node = binary.NewSmallerOrEqual(yyDollar[1].node, yyDollar[3].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.IsSmallerOrEqualToken)
}
case 280:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php5/php5.y:2171
+ //line php5/php5.y:3141
{
yyVAL.node = binary.NewGreater(yyDollar[1].node, yyDollar[3].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.GreaterToken)
}
case 281:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php5/php5.y:2177
+ //line php5/php5.y:3151
{
yyVAL.node = binary.NewGreaterOrEqual(yyDollar[1].node, yyDollar[3].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.IsGreaterOrEqualToken)
}
case 282:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php5/php5.y:2183
+ //line php5/php5.y:3161
{
yyVAL.node = expr.NewInstanceOf(yyDollar[1].node, yyDollar[3].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.InstanceofToken)
}
case 283:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php5/php5.y:2189
+ //line php5/php5.y:3171
{
yyVAL.node = yyDollar[1].node
}
case 284:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php5/php5.y:2191
+ //line php5/php5.y:3173
{
yyVAL.node = yyDollar[1].node
}
case 285:
yyDollar = yyS[yypt-4 : yypt+1]
- //line php5/php5.y:2193
+ //line php5/php5.y:3175
{
yyVAL.node = yyDollar[2].node
@@ -4758,518 +5668,703 @@ yydefault:
switch nn := n.(type) {
case *expr.ArrayDimFetch:
nn.Variable = yyVAL.node
- yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyVAL.node, nn))
- yylex.(*Parser).comments.AddComments(nn, yyDollar[1].token.Comments())
yyVAL.node = nn
case *expr.PropertyFetch:
nn.Variable = yyVAL.node
- yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyVAL.node, nn))
- yylex.(*Parser).comments.AddComments(nn, yyDollar[1].token.Comments())
yyVAL.node = nn
case *expr.MethodCall:
nn.Variable = yyVAL.node
- yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyVAL.node, nn))
- yylex.(*Parser).comments.AddComments(nn, yyDollar[1].token.Comments())
yyVAL.node = nn
}
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyVAL.node, n))
}
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.OpenParenthesisToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[3].token, comment.CloseParenthesisToken)
}
case 286:
yyDollar = yyS[yypt-5 : yypt+1]
- //line php5/php5.y:2219
+ //line php5/php5.y:3202
{
yyVAL.node = expr.NewTernary(yyDollar[1].node, yyDollar[3].node, yyDollar[5].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[5].node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.QuestionMarkToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[4].token, comment.ColonToken)
}
case 287:
yyDollar = yyS[yypt-4 : yypt+1]
- //line php5/php5.y:2225
+ //line php5/php5.y:3213
{
yyVAL.node = expr.NewTernary(yyDollar[1].node, nil, yyDollar[4].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[4].node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.QuestionMarkToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[3].token, comment.ColonToken)
}
case 288:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php5/php5.y:2231
+ //line php5/php5.y:3224
{
yyVAL.node = yyDollar[1].node
}
case 289:
yyDollar = yyS[yypt-2 : yypt+1]
- //line php5/php5.y:2233
+ //line php5/php5.y:3226
{
yyVAL.node = cast.NewInt(yyDollar[2].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[2].node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.IntCastToken)
}
case 290:
yyDollar = yyS[yypt-2 : yypt+1]
- //line php5/php5.y:2239
+ //line php5/php5.y:3236
{
yyVAL.node = cast.NewDouble(yyDollar[2].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[2].node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.DoubleCastToken)
}
case 291:
yyDollar = yyS[yypt-2 : yypt+1]
- //line php5/php5.y:2245
+ //line php5/php5.y:3246
{
yyVAL.node = cast.NewString(yyDollar[2].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[2].node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.StringCastToken)
}
case 292:
yyDollar = yyS[yypt-2 : yypt+1]
- //line php5/php5.y:2251
+ //line php5/php5.y:3256
{
yyVAL.node = cast.NewArray(yyDollar[2].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[2].node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.ArrayCastToken)
}
case 293:
yyDollar = yyS[yypt-2 : yypt+1]
- //line php5/php5.y:2257
+ //line php5/php5.y:3266
{
yyVAL.node = cast.NewObject(yyDollar[2].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[2].node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.ObjectCastToken)
}
case 294:
yyDollar = yyS[yypt-2 : yypt+1]
- //line php5/php5.y:2263
+ //line php5/php5.y:3276
{
yyVAL.node = cast.NewBool(yyDollar[2].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[2].node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.BoolCastToken)
}
case 295:
yyDollar = yyS[yypt-2 : yypt+1]
- //line php5/php5.y:2269
+ //line php5/php5.y:3286
{
yyVAL.node = cast.NewUnset(yyDollar[2].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[2].node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.UnsetCastToken)
}
case 296:
yyDollar = yyS[yypt-2 : yypt+1]
- //line php5/php5.y:2275
+ //line php5/php5.y:3296
{
if strings.EqualFold(yyDollar[1].token.Value, "die") {
- yyVAL.node = expr.NewDie(yyDollar[2].node)
+ yyVAL.node = expr.NewDie(nil)
+ if yyDollar[2].node != nil {
+ yyVAL.node.(*expr.Die).Expr = yyDollar[2].node.(*expr.Exit).Expr
+ }
} else {
- yyVAL.node = expr.NewExit(yyDollar[2].node)
+ yyVAL.node = expr.NewExit(nil)
+ if yyDollar[2].node != nil {
+ yyVAL.node.(*expr.Exit).Expr = yyDollar[2].node.(*expr.Exit).Expr
+ }
+ }
+
+ // save position
+ if yyDollar[2].node == nil {
+ yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
+ } else {
+ yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[2].node))
+ }
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.ExitToken)
+
+ if yyDollar[2].node != nil {
+ yylex.(*Parser).comments.AddFromChildNode(yyVAL.node, yyDollar[2].node)
}
- yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[2].node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
}
case 297:
yyDollar = yyS[yypt-2 : yypt+1]
- //line php5/php5.y:2285
+ //line php5/php5.y:3324
{
yyVAL.node = expr.NewErrorSuppress(yyDollar[2].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[2].node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.AtToken)
}
case 298:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php5/php5.y:2291
+ //line php5/php5.y:3334
{
yyVAL.node = yyDollar[1].node
}
case 299:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php5/php5.y:2293
+ //line php5/php5.y:3336
{
yyVAL.node = yyDollar[1].node
}
case 300:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php5/php5.y:2295
+ //line php5/php5.y:3338
{
yyVAL.node = yyDollar[1].node
}
case 301:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php5/php5.y:2297
+ //line php5/php5.y:3340
{
yyVAL.node = expr.NewShellExec(yyDollar[2].list)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[3].token))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.BackquoteToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[3].token, comment.BackquoteToken)
}
case 302:
yyDollar = yyS[yypt-2 : yypt+1]
- //line php5/php5.y:2303
+ //line php5/php5.y:3351
{
yyVAL.node = expr.NewPrint(yyDollar[2].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[2].node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.PrintToken)
}
case 303:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php5/php5.y:2309
+ //line php5/php5.y:3361
{
yyVAL.node = expr.NewYield(nil, nil)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.YieldToken)
}
case 304:
yyDollar = yyS[yypt-9 : yypt+1]
- //line php5/php5.y:2315
+ //line php5/php5.y:3371
{
- yyVAL.node = expr.NewClosure(yyDollar[4].list, yyDollar[6].list, nil, yyDollar[8].list, false, yyDollar[2].boolWithToken.value, "")
+ yyVAL.node = expr.NewClosure(yyDollar[4].list, yyDollar[6].ClosureUse, nil, yyDollar[8].list, false, yyDollar[2].token != nil, "")
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[9].token))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.FunctionToken)
+ if yyDollar[2].token != nil {
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.AmpersandToken)
+ }
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[3].token, comment.OpenParenthesisToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[5].token, comment.CloseParenthesisToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[7].token, comment.OpenCurlyBracesToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[9].token, comment.CloseCurlyBracesToken)
}
case 305:
yyDollar = yyS[yypt-10 : yypt+1]
- //line php5/php5.y:2322
+ //line php5/php5.y:3388
{
- yyVAL.node = expr.NewClosure(yyDollar[5].list, yyDollar[7].list, nil, yyDollar[9].list, true, yyDollar[3].boolWithToken.value, "")
+ yyVAL.node = expr.NewClosure(yyDollar[5].list, yyDollar[7].ClosureUse, nil, yyDollar[9].list, true, yyDollar[3].token != nil, "")
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[10].token))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.StaticToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.FunctionToken)
+ if yyDollar[3].token != nil {
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[3].token, comment.AmpersandToken)
+ }
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[4].token, comment.OpenParenthesisToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[6].token, comment.CloseParenthesisToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[8].token, comment.OpenCurlyBracesToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[10].token, comment.CloseCurlyBracesToken)
}
case 306:
yyDollar = yyS[yypt-2 : yypt+1]
- //line php5/php5.y:2332
+ //line php5/php5.y:3409
{
yyVAL.node = expr.NewYield(nil, yyDollar[2].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[2].node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.YieldToken)
}
case 307:
yyDollar = yyS[yypt-2 : yypt+1]
- //line php5/php5.y:2338
+ //line php5/php5.y:3419
{
yyVAL.node = expr.NewYield(nil, yyDollar[2].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[2].node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.YieldToken)
}
case 308:
yyDollar = yyS[yypt-4 : yypt+1]
- //line php5/php5.y:2344
+ //line php5/php5.y:3429
{
yyVAL.node = expr.NewYield(yyDollar[2].node, yyDollar[4].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[4].node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.YieldToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[3].token, comment.DoubleArrowToken)
}
case 309:
yyDollar = yyS[yypt-4 : yypt+1]
- //line php5/php5.y:2350
+ //line php5/php5.y:3440
{
yyVAL.node = expr.NewYield(yyDollar[2].node, yyDollar[4].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[4].node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.YieldToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[3].token, comment.DoubleArrowToken)
}
case 310:
yyDollar = yyS[yypt-4 : yypt+1]
- //line php5/php5.y:2359
+ //line php5/php5.y:3454
{
yyVAL.node = expr.NewArrayDimFetch(yyDollar[1].node, yyDollar[3].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodeTokenPosition(yyDollar[1].node, yyDollar[4].token))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.OpenSquareBracket)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[4].token, comment.CloseSquareBracket)
}
case 311:
yyDollar = yyS[yypt-4 : yypt+1]
- //line php5/php5.y:2365
+ //line php5/php5.y:3465
{
yyVAL.node = expr.NewArrayDimFetch(yyDollar[1].node, yyDollar[3].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodeTokenPosition(yyDollar[1].node, yyDollar[4].token))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.OpenSquareBracket)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[4].token, comment.CloseSquareBracket)
}
case 312:
yyDollar = yyS[yypt-4 : yypt+1]
- //line php5/php5.y:2371
+ //line php5/php5.y:3476
{
str := scalar.NewString(yyDollar[1].token.Value)
- yylex.(*Parser).positions.AddPosition(str, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
- yylex.(*Parser).comments.AddComments(str, yyDollar[1].token.Comments())
-
yyVAL.node = expr.NewArrayDimFetch(str, yyDollar[3].node)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(str, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodeTokenPosition(str, yyDollar[4].token))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[str])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.OpenSquareBracket)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[4].token, comment.CloseSquareBracket)
}
case 313:
yyDollar = yyS[yypt-4 : yypt+1]
- //line php5/php5.y:2381
+ //line php5/php5.y:3489
{
yyVAL.node = expr.NewArrayDimFetch(yyDollar[1].node, yyDollar[3].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodeTokenPosition(yyDollar[1].node, yyDollar[4].token))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.OpenSquareBracket)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[4].token, comment.CloseSquareBracket)
}
case 314:
yyDollar = yyS[yypt-4 : yypt+1]
- //line php5/php5.y:2390
+ //line php5/php5.y:3503
{
yyVAL.node = expr.NewArray(yyDollar[3].list)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[4].token))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.ArrayToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.OpenParenthesisToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[4].token, comment.CloseParenthesisToken)
}
case 315:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php5/php5.y:2396
+ //line php5/php5.y:3515
{
yyVAL.node = expr.NewShortArray(yyDollar[2].list)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[3].token))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.OpenSquareBracket)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[3].token, comment.CloseSquareBracket)
}
case 316:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php5/php5.y:2405
+ //line php5/php5.y:3529
{
yyVAL.token = yyDollar[1].token
}
case 317:
yyDollar = yyS[yypt-0 : yypt+1]
- //line php5/php5.y:2410
+ //line php5/php5.y:3534
{
- yyVAL.list = []node.Node{}
+ yyVAL.ClosureUse = nil
}
case 318:
yyDollar = yyS[yypt-4 : yypt+1]
- //line php5/php5.y:2412
+ //line php5/php5.y:3536
{
- yyVAL.list = yyDollar[3].list
+ yyVAL.ClosureUse = expr.NewClosureUse(yyDollar[3].list)
+
+ yylex.(*Parser).positions.AddPosition(yyVAL.ClosureUse, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[4].token))
}
case 319:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php5/php5.y:2417
+ //line php5/php5.y:3545
{
identifier := node.NewIdentifier(strings.TrimLeft(yyDollar[3].token.Value, "$"))
- yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[3].token))
- yylex.(*Parser).comments.AddComments(identifier, yyDollar[3].token.Comments())
-
variable := expr.NewVariable(identifier)
+ yyVAL.list = append(yyDollar[1].list, variable)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[3].token))
yylex.(*Parser).positions.AddPosition(variable, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[3].token))
- yylex.(*Parser).comments.AddComments(variable, yyDollar[3].token.Comments())
- use := expr.NewClosureUse(variable, false)
- yylex.(*Parser).positions.AddPosition(use, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[3].token))
- yylex.(*Parser).comments.AddComments(use, yyDollar[3].token.Comments())
-
- yyVAL.list = append(yyDollar[1].list, use)
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(lastNode(yyDollar[1].list), yyDollar[2].token, comment.CommaToken)
+ yylex.(*Parser).comments.AddFromToken(variable, yyDollar[3].token, comment.VariableToken)
}
case 320:
yyDollar = yyS[yypt-4 : yypt+1]
- //line php5/php5.y:2433
+ //line php5/php5.y:3559
{
identifier := node.NewIdentifier(strings.TrimLeft(yyDollar[4].token.Value, "$"))
- yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[4].token))
- yylex.(*Parser).comments.AddComments(identifier, yyDollar[4].token.Comments())
-
variable := expr.NewVariable(identifier)
+ reference := expr.NewReference(variable)
+ yyVAL.list = append(yyDollar[1].list, reference)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[4].token))
yylex.(*Parser).positions.AddPosition(variable, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[4].token))
- yylex.(*Parser).comments.AddComments(variable, yyDollar[3].token.Comments())
- use := expr.NewClosureUse(variable, true)
- yylex.(*Parser).positions.AddPosition(use, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[3].token, yyDollar[4].token))
- yylex.(*Parser).comments.AddComments(use, yyDollar[3].token.Comments())
-
- yyVAL.list = append(yyDollar[1].list, use)
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(lastNode(yyDollar[1].list), yyDollar[2].token, comment.CommaToken)
+ yylex.(*Parser).comments.AddFromToken(reference, yyDollar[3].token, comment.VariableToken)
+ yylex.(*Parser).comments.AddFromToken(variable, yyDollar[4].token, comment.VariableToken)
}
case 321:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php5/php5.y:2449
+ //line php5/php5.y:3575
{
identifier := node.NewIdentifier(strings.TrimLeft(yyDollar[1].token.Value, "$"))
- yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
- yylex.(*Parser).comments.AddComments(identifier, yyDollar[1].token.Comments())
-
variable := expr.NewVariable(identifier)
+ yyVAL.list = []node.Node{variable}
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
yylex.(*Parser).positions.AddPosition(variable, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
- yylex.(*Parser).comments.AddComments(variable, yyDollar[1].token.Comments())
- use := expr.NewClosureUse(variable, false)
- yylex.(*Parser).positions.AddPosition(use, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
- yylex.(*Parser).comments.AddComments(use, yyDollar[1].token.Comments())
-
- yyVAL.list = []node.Node{use}
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(variable, yyDollar[1].token, comment.VariableToken)
}
case 322:
yyDollar = yyS[yypt-2 : yypt+1]
- //line php5/php5.y:2465
+ //line php5/php5.y:3588
{
identifier := node.NewIdentifier(strings.TrimLeft(yyDollar[2].token.Value, "$"))
- yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[2].token))
- yylex.(*Parser).comments.AddComments(identifier, yyDollar[2].token.Comments())
-
variable := expr.NewVariable(identifier)
+ reference := expr.NewReference(variable)
+ yyVAL.list = []node.Node{reference}
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[2].token))
yylex.(*Parser).positions.AddPosition(variable, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[2].token))
- yylex.(*Parser).comments.AddComments(variable, yyDollar[1].token.Comments())
+ yylex.(*Parser).positions.AddPosition(reference, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[2].token))
- use := expr.NewClosureUse(variable, true)
- yylex.(*Parser).positions.AddPosition(use, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[2].token))
- yylex.(*Parser).comments.AddComments(use, yyDollar[1].token.Comments())
-
- yyVAL.list = []node.Node{use}
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(reference, yyDollar[1].token, comment.VariableToken)
+ yylex.(*Parser).comments.AddFromToken(variable, yyDollar[2].token, comment.VariableToken)
}
case 323:
yyDollar = yyS[yypt-2 : yypt+1]
- //line php5/php5.y:2484
+ //line php5/php5.y:3607
{
name := name.NewName(yyDollar[1].list)
- yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewNodeListPosition(yyDollar[1].list))
- yylex.(*Parser).comments.AddComments(name, yylex.(*Parser).listGetFirstNodeComments(yyDollar[1].list))
+ yyVAL.node = expr.NewFunctionCall(name, yyDollar[2].node.(*node.ArgumentList))
- yyVAL.node = expr.NewFunctionCall(name, yyDollar[2].nodesWithEndToken.nodes)
- yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodeTokenPosition(name, yyDollar[2].nodesWithEndToken.endToken))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[name])
+ // save position
+ yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewNodeListPosition(yyDollar[1].list))
+ yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(name, yyDollar[2].node))
}
case 324:
yyDollar = yyS[yypt-4 : yypt+1]
- //line php5/php5.y:2494
+ //line php5/php5.y:3616
{
funcName := name.NewRelative(yyDollar[3].list)
- yylex.(*Parser).positions.AddPosition(funcName, yylex.(*Parser).positionBuilder.NewTokenNodeListPosition(yyDollar[1].token, yyDollar[3].list))
- yylex.(*Parser).comments.AddComments(funcName, yyDollar[1].token.Comments())
+ yyVAL.node = expr.NewFunctionCall(funcName, yyDollar[4].node.(*node.ArgumentList))
- yyVAL.node = expr.NewFunctionCall(funcName, yyDollar[4].nodesWithEndToken.nodes)
- yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodeTokenPosition(funcName, yyDollar[4].nodesWithEndToken.endToken))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[funcName])
+ // save position
+ yylex.(*Parser).positions.AddPosition(funcName, yylex.(*Parser).positionBuilder.NewTokenNodeListPosition(yyDollar[1].token, yyDollar[3].list))
+ yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(funcName, yyDollar[4].node))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(funcName, yyDollar[1].token, comment.NamespaceToken)
+ yylex.(*Parser).comments.AddFromToken(funcName, yyDollar[2].token, comment.NsSeparatorToken)
}
case 325:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php5/php5.y:2504
+ //line php5/php5.y:3629
{
funcName := name.NewFullyQualified(yyDollar[2].list)
- yylex.(*Parser).positions.AddPosition(funcName, yylex.(*Parser).positionBuilder.NewTokenNodeListPosition(yyDollar[1].token, yyDollar[2].list))
- yylex.(*Parser).comments.AddComments(funcName, yyDollar[1].token.Comments())
+ yyVAL.node = expr.NewFunctionCall(funcName, yyDollar[3].node.(*node.ArgumentList))
- yyVAL.node = expr.NewFunctionCall(funcName, yyDollar[3].nodesWithEndToken.nodes)
- yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodeTokenPosition(funcName, yyDollar[3].nodesWithEndToken.endToken))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[funcName])
+ // save position
+ yylex.(*Parser).positions.AddPosition(funcName, yylex.(*Parser).positionBuilder.NewTokenNodeListPosition(yyDollar[1].token, yyDollar[2].list))
+ yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(funcName, yyDollar[3].node))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(funcName, yyDollar[1].token, comment.NsSeparatorToken)
}
case 326:
yyDollar = yyS[yypt-4 : yypt+1]
- //line php5/php5.y:2514
+ //line php5/php5.y:3641
{
- yyVAL.node = expr.NewStaticCall(yyDollar[1].node, yyDollar[3].node, yyDollar[4].nodesWithEndToken.nodes)
- yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodeTokenPosition(yyDollar[1].node, yyDollar[4].nodesWithEndToken.endToken))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node])
+ yyVAL.node = expr.NewStaticCall(yyDollar[1].node, yyDollar[3].node, yyDollar[4].node.(*node.ArgumentList))
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[4].node))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.PaamayimNekudotayimToken)
}
case 327:
yyDollar = yyS[yypt-4 : yypt+1]
- //line php5/php5.y:2520
+ //line php5/php5.y:3651
{
- yyVAL.node = expr.NewStaticCall(yyDollar[1].node, yyDollar[3].node, yyDollar[4].nodesWithEndToken.nodes)
- yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodeTokenPosition(yyDollar[1].node, yyDollar[4].nodesWithEndToken.endToken))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node])
+ yyVAL.node = expr.NewStaticCall(yyDollar[1].node, yyDollar[3].node, yyDollar[4].node.(*node.ArgumentList))
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[4].node))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.PaamayimNekudotayimToken)
}
case 328:
yyDollar = yyS[yypt-4 : yypt+1]
- //line php5/php5.y:2526
+ //line php5/php5.y:3661
{
- yyVAL.node = expr.NewStaticCall(yyDollar[1].node, yyDollar[3].node, yyDollar[4].nodesWithEndToken.nodes)
- yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodeTokenPosition(yyDollar[1].node, yyDollar[4].nodesWithEndToken.endToken))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node])
+ yyVAL.node = expr.NewStaticCall(yyDollar[1].node, yyDollar[3].node, yyDollar[4].node.(*node.ArgumentList))
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[4].node))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.PaamayimNekudotayimToken)
}
case 329:
yyDollar = yyS[yypt-4 : yypt+1]
- //line php5/php5.y:2532
+ //line php5/php5.y:3671
{
- yyVAL.node = expr.NewStaticCall(yyDollar[1].node, yyDollar[3].node, yyDollar[4].nodesWithEndToken.nodes)
- yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodeTokenPosition(yyDollar[1].node, yyDollar[4].nodesWithEndToken.endToken))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node])
+ yyVAL.node = expr.NewStaticCall(yyDollar[1].node, yyDollar[3].node, yyDollar[4].node.(*node.ArgumentList))
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[4].node))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.PaamayimNekudotayimToken)
}
case 330:
yyDollar = yyS[yypt-2 : yypt+1]
- //line php5/php5.y:2538
+ //line php5/php5.y:3681
{
- yyVAL.node = expr.NewFunctionCall(yyDollar[1].node, yyDollar[2].nodesWithEndToken.nodes)
- yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodeTokenPosition(yyDollar[1].node, yyDollar[2].nodesWithEndToken.endToken))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node])
+ yyVAL.node = expr.NewFunctionCall(yyDollar[1].node, yyDollar[2].node.(*node.ArgumentList))
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[2].node))
}
case 331:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php5/php5.y:2547
+ //line php5/php5.y:3691
{
yyVAL.node = node.NewIdentifier(yyDollar[1].token.Value)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.StaticToken)
}
case 332:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php5/php5.y:2553
+ //line php5/php5.y:3701
{
yyVAL.node = name.NewName(yyDollar[1].list)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodeListPosition(yyDollar[1].list))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).listGetFirstNodeComments(yyDollar[1].list))
}
case 333:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php5/php5.y:2559
+ //line php5/php5.y:3708
{
yyVAL.node = name.NewRelative(yyDollar[3].list)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenNodeListPosition(yyDollar[1].token, yyDollar[3].list))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.NamespaceToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.NsSeparatorToken)
}
case 334:
yyDollar = yyS[yypt-2 : yypt+1]
- //line php5/php5.y:2565
+ //line php5/php5.y:3719
{
yyVAL.node = name.NewFullyQualified(yyDollar[2].list)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenNodeListPosition(yyDollar[1].token, yyDollar[2].list))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.NsSeparatorToken)
}
case 335:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php5/php5.y:2574
+ //line php5/php5.y:3732
{
yyVAL.node = name.NewName(yyDollar[1].list)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodeListPosition(yyDollar[1].list))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).listGetFirstNodeComments(yyDollar[1].list))
}
case 336:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php5/php5.y:2580
+ //line php5/php5.y:3739
{
yyVAL.node = name.NewRelative(yyDollar[3].list)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenNodeListPosition(yyDollar[1].token, yyDollar[3].list))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.NamespaceToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.NsSeparatorToken)
}
case 337:
yyDollar = yyS[yypt-2 : yypt+1]
- //line php5/php5.y:2586
+ //line php5/php5.y:3750
{
yyVAL.node = name.NewFullyQualified(yyDollar[2].list)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenNodeListPosition(yyDollar[1].token, yyDollar[2].list))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.NsSeparatorToken)
}
case 338:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php5/php5.y:2595
+ //line php5/php5.y:3763
{
yyVAL.node = yyDollar[1].node
}
case 339:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php5/php5.y:2597
+ //line php5/php5.y:3765
{
yyVAL.node = yyDollar[1].node
}
case 340:
yyDollar = yyS[yypt-4 : yypt+1]
- //line php5/php5.y:2602
+ //line php5/php5.y:3770
{
yyVAL.node = yyDollar[1].node
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyDollar[3].list[0], yyDollar[2].token, comment.ObjectOperatorToken)
+
for _, n := range yyDollar[3].list {
switch nn := n.(type) {
case *expr.ArrayDimFetch:
nn.Variable = yyVAL.node
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyVAL.node, nn))
- yylex.(*Parser).comments.AddComments(nn, yylex.(*Parser).comments[yyDollar[1].node])
yyVAL.node = nn
case *expr.PropertyFetch:
nn.Variable = yyVAL.node
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyVAL.node, nn))
- yylex.(*Parser).comments.AddComments(nn, yylex.(*Parser).comments[yyDollar[1].node])
yyVAL.node = nn
}
}
@@ -5279,746 +6374,1003 @@ yydefault:
case *expr.ArrayDimFetch:
nn.Variable = yyVAL.node
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyVAL.node, nn))
- yylex.(*Parser).comments.AddComments(nn, yylex.(*Parser).comments[yyDollar[1].node])
yyVAL.node = nn
case *expr.PropertyFetch:
nn.Variable = yyVAL.node
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyVAL.node, nn))
- yylex.(*Parser).comments.AddComments(nn, yylex.(*Parser).comments[yyDollar[1].node])
yyVAL.node = nn
}
}
}
case 341:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php5/php5.y:2638
+ //line php5/php5.y:3805
{
yyVAL.node = yyDollar[1].node
}
case 342:
yyDollar = yyS[yypt-2 : yypt+1]
- //line php5/php5.y:2644
+ //line php5/php5.y:3811
{
yyVAL.list = append(yyDollar[1].list, yyDollar[2].list...)
}
case 343:
yyDollar = yyS[yypt-0 : yypt+1]
- //line php5/php5.y:2646
+ //line php5/php5.y:3813
{
yyVAL.list = []node.Node{}
}
case 344:
yyDollar = yyS[yypt-2 : yypt+1]
- //line php5/php5.y:2652
+ //line php5/php5.y:3819
{
yyVAL.list = yyDollar[2].list
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyDollar[2].list[0], yyDollar[1].token, comment.ObjectOperatorToken)
}
case 345:
yyDollar = yyS[yypt-0 : yypt+1]
- //line php5/php5.y:2657
+ //line php5/php5.y:3829
{
yyVAL.node = nil
}
case 346:
yyDollar = yyS[yypt-2 : yypt+1]
- //line php5/php5.y:2659
+ //line php5/php5.y:3831
{
- yyVAL.node = nil
+ yyVAL.node = expr.NewExit(nil)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[2].token))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.OpenParenthesisToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.CloseParenthesisToken)
}
case 347:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php5/php5.y:2661
+ //line php5/php5.y:3842
{
- yyVAL.node = yyDollar[1].node
+ yyVAL.node = expr.NewExit(yyDollar[1].node)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodePosition(yyDollar[1].node))
}
case 348:
yyDollar = yyS[yypt-0 : yypt+1]
- //line php5/php5.y:2666
+ //line php5/php5.y:3852
{
yyVAL.list = []node.Node{}
}
case 349:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php5/php5.y:2668
+ //line php5/php5.y:3854
{
yyVAL.list = []node.Node{scalar.NewEncapsedStringPart(yyDollar[1].token.Value)}
}
case 350:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php5/php5.y:2670
+ //line php5/php5.y:3856
{
yyVAL.list = yyDollar[1].list
}
case 351:
yyDollar = yyS[yypt-0 : yypt+1]
- //line php5/php5.y:2675
+ //line php5/php5.y:3861
{
- yyVAL.nodesWithEndToken = nil
+ yyVAL.node = nil
}
case 352:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php5/php5.y:2677
+ //line php5/php5.y:3863
{
- yyVAL.nodesWithEndToken = yyDollar[1].nodesWithEndToken
+ yyVAL.node = yyDollar[1].node
}
case 353:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php5/php5.y:2682
+ //line php5/php5.y:3868
{
yyVAL.node = scalar.NewLnumber(yyDollar[1].token.Value)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.LnumberToken)
}
case 354:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php5/php5.y:2688
+ //line php5/php5.y:3878
{
yyVAL.node = scalar.NewDnumber(yyDollar[1].token.Value)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.DnumberToken)
}
case 355:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php5/php5.y:2694
+ //line php5/php5.y:3888
{
yyVAL.node = scalar.NewString(yyDollar[1].token.Value)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.ConstantEncapsedStringToken)
}
case 356:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php5/php5.y:2700
+ //line php5/php5.y:3898
{
yyVAL.node = scalar.NewMagicConstant(yyDollar[1].token.Value)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.LineToken)
}
case 357:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php5/php5.y:2706
+ //line php5/php5.y:3908
{
yyVAL.node = scalar.NewMagicConstant(yyDollar[1].token.Value)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.FileToken)
}
case 358:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php5/php5.y:2712
+ //line php5/php5.y:3918
{
yyVAL.node = scalar.NewMagicConstant(yyDollar[1].token.Value)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.DirToken)
}
case 359:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php5/php5.y:2718
+ //line php5/php5.y:3928
{
yyVAL.node = scalar.NewMagicConstant(yyDollar[1].token.Value)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.TraitCToken)
}
case 360:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php5/php5.y:2724
+ //line php5/php5.y:3938
{
yyVAL.node = scalar.NewMagicConstant(yyDollar[1].token.Value)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.MethodCToken)
}
case 361:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php5/php5.y:2730
+ //line php5/php5.y:3948
{
yyVAL.node = scalar.NewMagicConstant(yyDollar[1].token.Value)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.FuncCToken)
}
case 362:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php5/php5.y:2736
+ //line php5/php5.y:3958
{
yyVAL.node = scalar.NewMagicConstant(yyDollar[1].token.Value)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.NsCToken)
}
case 363:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php5/php5.y:2742
+ //line php5/php5.y:3968
{
encapsed := scalar.NewEncapsedStringPart(yyDollar[2].token.Value)
- yylex.(*Parser).positions.AddPosition(encapsed, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[2].token))
- yylex.(*Parser).comments.AddComments(encapsed, yyDollar[2].token.Comments())
-
yyVAL.node = scalar.NewHeredoc(yyDollar[1].token.Value, []node.Node{encapsed})
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(encapsed, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[2].token))
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[3].token))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.StartHeredocToken)
}
case 364:
yyDollar = yyS[yypt-2 : yypt+1]
- //line php5/php5.y:2752
+ //line php5/php5.y:3980
{
yyVAL.node = scalar.NewHeredoc(yyDollar[1].token.Value, nil)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[2].token))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.StartHeredocToken)
}
case 365:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php5/php5.y:2761
+ //line php5/php5.y:3993
{
target := node.NewIdentifier(yyDollar[3].token.Value)
- yylex.(*Parser).positions.AddPosition(target, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[3].token))
yyVAL.node = expr.NewClassConstFetch(yyDollar[1].node, target)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(target, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[3].token))
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodeTokenPosition(yyDollar[1].node, yyDollar[3].token))
- yylex.(*Parser).comments.AddComments(target, yyDollar[3].token.Comments())
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node])
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.PaamayimNekudotayimToken)
+ yylex.(*Parser).comments.AddFromToken(target, yyDollar[3].token, comment.IdentifierToken)
}
case 366:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php5/php5.y:2774
+ //line php5/php5.y:4009
{
yyVAL.node = yyDollar[1].node
}
case 367:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php5/php5.y:2779
+ //line php5/php5.y:4014
{
yyVAL.node = yyDollar[1].node
}
case 368:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php5/php5.y:2781
+ //line php5/php5.y:4016
{
yyVAL.node = yyDollar[1].node
}
case 369:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php5/php5.y:2783
+ //line php5/php5.y:4018
{
name := name.NewName(yyDollar[1].list)
- yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewNodeListPosition(yyDollar[1].list))
- yylex.(*Parser).comments.AddComments(name, yylex.(*Parser).listGetFirstNodeComments(yyDollar[1].list))
-
yyVAL.node = expr.NewConstFetch(name)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewNodeListPosition(yyDollar[1].list))
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodePosition(name))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[name])
}
case 370:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php5/php5.y:2793
+ //line php5/php5.y:4027
{
name := name.NewRelative(yyDollar[3].list)
- yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewTokenNodeListPosition(yyDollar[1].token, yyDollar[3].list))
- yylex.(*Parser).comments.AddComments(name, yyDollar[1].token.Comments())
-
yyVAL.node = expr.NewConstFetch(name)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewTokenNodeListPosition(yyDollar[1].token, yyDollar[3].list))
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenNodeListPosition(yyDollar[1].token, yyDollar[3].list))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[name])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.NamespaceToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.NsSeparatorToken)
}
case 371:
yyDollar = yyS[yypt-2 : yypt+1]
- //line php5/php5.y:2803
+ //line php5/php5.y:4040
{
name := name.NewFullyQualified(yyDollar[2].list)
- yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewTokenNodeListPosition(yyDollar[1].token, yyDollar[2].list))
- yylex.(*Parser).comments.AddComments(name, yyDollar[1].token.Comments())
-
yyVAL.node = expr.NewConstFetch(name)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewTokenNodeListPosition(yyDollar[1].token, yyDollar[2].list))
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenNodeListPosition(yyDollar[1].token, yyDollar[2].list))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[name])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.NsSeparatorToken)
}
case 372:
yyDollar = yyS[yypt-4 : yypt+1]
- //line php5/php5.y:2813
+ //line php5/php5.y:4052
{
yyVAL.node = expr.NewArray(yyDollar[3].list)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[4].token))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.ArrayToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.OpenParenthesisToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[4].token, comment.CloseParenthesisToken)
}
case 373:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php5/php5.y:2819
+ //line php5/php5.y:4064
{
yyVAL.node = expr.NewShortArray(yyDollar[2].list)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[3].token))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.OpenSquareBracket)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[3].token, comment.CloseSquareBracket)
}
case 374:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php5/php5.y:2825
+ //line php5/php5.y:4075
{
yyVAL.node = yyDollar[1].node
}
case 375:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php5/php5.y:2827
+ //line php5/php5.y:4077
{
yyVAL.node = scalar.NewMagicConstant(yyDollar[1].token.Value)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.ClassCToken)
}
case 376:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php5/php5.y:2833
+ //line php5/php5.y:4087
{
yyVAL.node = yyDollar[1].node
}
case 377:
yyDollar = yyS[yypt-4 : yypt+1]
- //line php5/php5.y:2838
+ //line php5/php5.y:4092
{
yyVAL.node = expr.NewArrayDimFetch(yyDollar[1].node, yyDollar[3].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodeTokenPosition(yyDollar[1].node, yyDollar[4].token))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.OpenSquareBracket)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[4].token, comment.CloseSquareBracket)
}
case 378:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php5/php5.y:2844
+ //line php5/php5.y:4103
{
yyVAL.node = binary.NewPlus(yyDollar[1].node, yyDollar[3].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.PlusToken)
}
case 379:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php5/php5.y:2850
+ //line php5/php5.y:4113
{
yyVAL.node = binary.NewMinus(yyDollar[1].node, yyDollar[3].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.MinusToken)
}
case 380:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php5/php5.y:2856
+ //line php5/php5.y:4123
{
yyVAL.node = binary.NewMul(yyDollar[1].node, yyDollar[3].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.AsteriskToken)
}
case 381:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php5/php5.y:2862
+ //line php5/php5.y:4133
{
yyVAL.node = binary.NewPow(yyDollar[1].node, yyDollar[3].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.PowToken)
}
case 382:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php5/php5.y:2868
+ //line php5/php5.y:4143
{
yyVAL.node = binary.NewDiv(yyDollar[1].node, yyDollar[3].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.SlashToken)
}
case 383:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php5/php5.y:2874
+ //line php5/php5.y:4153
{
yyVAL.node = binary.NewMod(yyDollar[1].node, yyDollar[3].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.PercentToken)
}
case 384:
yyDollar = yyS[yypt-2 : yypt+1]
- //line php5/php5.y:2880
+ //line php5/php5.y:4163
{
yyVAL.node = expr.NewBooleanNot(yyDollar[2].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[2].node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.ExclamationMarkToken)
}
case 385:
yyDollar = yyS[yypt-2 : yypt+1]
- //line php5/php5.y:2886
+ //line php5/php5.y:4173
{
yyVAL.node = expr.NewBitwiseNot(yyDollar[2].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[2].node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.TildeToken)
}
case 386:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php5/php5.y:2892
+ //line php5/php5.y:4183
{
yyVAL.node = binary.NewBitwiseOr(yyDollar[1].node, yyDollar[3].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.VerticalBarToken)
}
case 387:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php5/php5.y:2898
+ //line php5/php5.y:4193
{
yyVAL.node = binary.NewBitwiseAnd(yyDollar[1].node, yyDollar[3].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.AmpersandToken)
}
case 388:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php5/php5.y:2904
+ //line php5/php5.y:4203
{
yyVAL.node = binary.NewBitwiseXor(yyDollar[1].node, yyDollar[3].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.CaretToken)
}
case 389:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php5/php5.y:2910
+ //line php5/php5.y:4213
{
yyVAL.node = binary.NewShiftLeft(yyDollar[1].node, yyDollar[3].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.SlToken)
}
case 390:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php5/php5.y:2916
+ //line php5/php5.y:4223
{
yyVAL.node = binary.NewShiftRight(yyDollar[1].node, yyDollar[3].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.SrToken)
}
case 391:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php5/php5.y:2922
+ //line php5/php5.y:4233
{
yyVAL.node = binary.NewConcat(yyDollar[1].node, yyDollar[3].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.DotToken)
}
case 392:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php5/php5.y:2928
+ //line php5/php5.y:4243
{
yyVAL.node = binary.NewLogicalXor(yyDollar[1].node, yyDollar[3].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.LogicalXorToken)
}
case 393:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php5/php5.y:2934
+ //line php5/php5.y:4253
{
yyVAL.node = binary.NewLogicalAnd(yyDollar[1].node, yyDollar[3].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.LogicalAndToken)
}
case 394:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php5/php5.y:2940
+ //line php5/php5.y:4263
{
yyVAL.node = binary.NewLogicalOr(yyDollar[1].node, yyDollar[3].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.LogicalOrToken)
}
case 395:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php5/php5.y:2946
+ //line php5/php5.y:4273
{
yyVAL.node = binary.NewBooleanAnd(yyDollar[1].node, yyDollar[3].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.BooleanAndToken)
}
case 396:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php5/php5.y:2952
+ //line php5/php5.y:4283
{
yyVAL.node = binary.NewBooleanOr(yyDollar[1].node, yyDollar[3].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.BooleanOrToken)
}
case 397:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php5/php5.y:2958
+ //line php5/php5.y:4293
{
yyVAL.node = binary.NewIdentical(yyDollar[1].node, yyDollar[3].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.IsIdenticalToken)
}
case 398:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php5/php5.y:2964
+ //line php5/php5.y:4303
{
yyVAL.node = binary.NewNotIdentical(yyDollar[1].node, yyDollar[3].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.IsNotIdenticalToken)
}
case 399:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php5/php5.y:2970
+ //line php5/php5.y:4313
{
yyVAL.node = binary.NewEqual(yyDollar[1].node, yyDollar[3].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.IsEqualToken)
}
case 400:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php5/php5.y:2976
+ //line php5/php5.y:4323
{
yyVAL.node = binary.NewNotEqual(yyDollar[1].node, yyDollar[3].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.IsNotEqualToken)
}
case 401:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php5/php5.y:2982
+ //line php5/php5.y:4333
{
yyVAL.node = binary.NewSmaller(yyDollar[1].node, yyDollar[3].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.LessToken)
}
case 402:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php5/php5.y:2988
+ //line php5/php5.y:4343
{
yyVAL.node = binary.NewGreater(yyDollar[1].node, yyDollar[3].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.GreaterToken)
}
case 403:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php5/php5.y:2994
+ //line php5/php5.y:4353
{
yyVAL.node = binary.NewSmallerOrEqual(yyDollar[1].node, yyDollar[3].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.IsSmallerOrEqualToken)
}
case 404:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php5/php5.y:3000
+ //line php5/php5.y:4363
{
yyVAL.node = binary.NewGreaterOrEqual(yyDollar[1].node, yyDollar[3].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.IsGreaterOrEqualToken)
}
case 405:
yyDollar = yyS[yypt-4 : yypt+1]
- //line php5/php5.y:3006
+ //line php5/php5.y:4373
{
yyVAL.node = expr.NewTernary(yyDollar[1].node, nil, yyDollar[4].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[4].node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.QuestionMarkToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[3].token, comment.ColonToken)
}
case 406:
yyDollar = yyS[yypt-5 : yypt+1]
- //line php5/php5.y:3012
+ //line php5/php5.y:4384
{
yyVAL.node = expr.NewTernary(yyDollar[1].node, yyDollar[3].node, yyDollar[5].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[5].node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.QuestionMarkToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[4].token, comment.ColonToken)
}
case 407:
yyDollar = yyS[yypt-2 : yypt+1]
- //line php5/php5.y:3018
+ //line php5/php5.y:4395
{
yyVAL.node = expr.NewUnaryPlus(yyDollar[2].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[2].node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.PlusToken)
}
case 408:
yyDollar = yyS[yypt-2 : yypt+1]
- //line php5/php5.y:3024
+ //line php5/php5.y:4405
{
yyVAL.node = expr.NewUnaryMinus(yyDollar[2].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[2].node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.MinusToken)
}
case 409:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php5/php5.y:3030
+ //line php5/php5.y:4415
{
yyVAL.node = yyDollar[2].node
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.OpenParenthesisToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[3].token, comment.CloseParenthesisToken)
}
case 410:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php5/php5.y:3035
+ //line php5/php5.y:4426
{
yyVAL.node = yyDollar[1].node
}
case 411:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php5/php5.y:3037
+ //line php5/php5.y:4428
{
name := name.NewName(yyDollar[1].list)
- yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewNodeListPosition(yyDollar[1].list))
- yylex.(*Parser).comments.AddComments(name, yylex.(*Parser).listGetFirstNodeComments(yyDollar[1].list))
-
yyVAL.node = expr.NewConstFetch(name)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewNodeListPosition(yyDollar[1].list))
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodePosition(name))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[name])
}
case 412:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php5/php5.y:3047
+ //line php5/php5.y:4437
{
name := name.NewRelative(yyDollar[3].list)
- yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewTokenNodeListPosition(yyDollar[1].token, yyDollar[3].list))
- yylex.(*Parser).comments.AddComments(name, yyDollar[1].token.Comments())
-
yyVAL.node = expr.NewConstFetch(name)
+ yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewTokenNodeListPosition(yyDollar[1].token, yyDollar[3].list))
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodePosition(name))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[name])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.NamespaceToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.NsSeparatorToken)
}
case 413:
yyDollar = yyS[yypt-2 : yypt+1]
- //line php5/php5.y:3057
+ //line php5/php5.y:4448
{
name := name.NewFullyQualified(yyDollar[2].list)
- yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewTokenNodeListPosition(yyDollar[1].token, yyDollar[2].list))
- yylex.(*Parser).comments.AddComments(name, yyDollar[1].token.Comments())
-
yyVAL.node = expr.NewConstFetch(name)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewTokenNodeListPosition(yyDollar[1].token, yyDollar[2].list))
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodePosition(name))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[name])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.NsSeparatorToken)
}
case 414:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php5/php5.y:3070
+ //line php5/php5.y:4463
{
name := node.NewIdentifier(yyDollar[1].token.Value)
- yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
yyVAL.node = expr.NewVariable(name)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
- yylex.(*Parser).comments.AddComments(name, yyDollar[1].token.Comments())
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(name, yyDollar[1].token, comment.StringVarnameToken)
}
case 415:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php5/php5.y:3080
+ //line php5/php5.y:4475
{
yyVAL.node = yyDollar[1].node
}
case 416:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php5/php5.y:3082
+ //line php5/php5.y:4477
{
yyVAL.node = yyDollar[1].node
}
case 417:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php5/php5.y:3084
+ //line php5/php5.y:4479
{
yyVAL.node = yyDollar[1].node
}
case 418:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php5/php5.y:3086
+ //line php5/php5.y:4481
{
yyVAL.node = scalar.NewEncapsed(yyDollar[2].list)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[3].token))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.DoubleQuoteToken)
}
case 419:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php5/php5.y:3092
+ //line php5/php5.y:4491
{
yyVAL.node = scalar.NewHeredoc(yyDollar[1].token.Value, yyDollar[2].list)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[3].token))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.StartHeredocToken)
}
case 420:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php5/php5.y:3098
+ //line php5/php5.y:4501
{
yyVAL.node = scalar.NewMagicConstant(yyDollar[1].token.Value)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.ClassCToken)
}
case 421:
yyDollar = yyS[yypt-0 : yypt+1]
- //line php5/php5.y:3107
+ //line php5/php5.y:4514
{
yyVAL.list = nil
}
case 422:
yyDollar = yyS[yypt-2 : yypt+1]
- //line php5/php5.y:3109
+ //line php5/php5.y:4516
{
yyVAL.list = yyDollar[1].list
+
+ // save comments
+ if yyDollar[2].token != nil {
+ yylex.(*Parser).comments.AddFromToken(lastNode(yyDollar[1].list), yyDollar[2].token, comment.CommaToken)
+ }
+ }
+ case 423:
+ yyDollar = yyS[yypt-0 : yypt+1]
+ //line php5/php5.y:4528
+ {
+ yyVAL.token = nil
+ }
+ case 424:
+ yyDollar = yyS[yypt-1 : yypt+1]
+ //line php5/php5.y:4530
+ {
+ yyVAL.token = yyDollar[1].token
}
case 425:
yyDollar = yyS[yypt-5 : yypt+1]
- //line php5/php5.y:3119
+ //line php5/php5.y:4535
{
- arrayItem := expr.NewArrayItem(yyDollar[3].node, yyDollar[5].node, false)
- yylex.(*Parser).positions.AddPosition(arrayItem, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[3].node, yyDollar[5].node))
- yylex.(*Parser).comments.AddComments(arrayItem, yylex.(*Parser).comments[yyDollar[3].node])
-
+ arrayItem := expr.NewArrayItem(yyDollar[3].node, yyDollar[5].node)
yyVAL.list = append(yyDollar[1].list, arrayItem)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(arrayItem, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[3].node, yyDollar[5].node))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(lastNode(yyDollar[1].list), yyDollar[2].token, comment.CommaToken)
+ yylex.(*Parser).comments.AddFromToken(arrayItem, yyDollar[4].token, comment.DoubleArrowToken)
}
case 426:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php5/php5.y:3127
+ //line php5/php5.y:4547
{
- arrayItem := expr.NewArrayItem(nil, yyDollar[3].node, false)
- yylex.(*Parser).positions.AddPosition(arrayItem, yylex.(*Parser).positionBuilder.NewNodePosition(yyDollar[3].node))
- yylex.(*Parser).comments.AddComments(arrayItem, yylex.(*Parser).comments[yyDollar[3].node])
-
+ arrayItem := expr.NewArrayItem(nil, yyDollar[3].node)
yyVAL.list = append(yyDollar[1].list, arrayItem)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(arrayItem, yylex.(*Parser).positionBuilder.NewNodePosition(yyDollar[3].node))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(lastNode(yyDollar[1].list), yyDollar[2].token, comment.CommaToken)
}
case 427:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php5/php5.y:3135
+ //line php5/php5.y:4558
{
- arrayItem := expr.NewArrayItem(yyDollar[1].node, yyDollar[3].node, false)
- yylex.(*Parser).positions.AddPosition(arrayItem, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node))
- yylex.(*Parser).comments.AddComments(arrayItem, yylex.(*Parser).comments[yyDollar[1].node])
-
+ arrayItem := expr.NewArrayItem(yyDollar[1].node, yyDollar[3].node)
yyVAL.list = []node.Node{arrayItem}
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(arrayItem, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(arrayItem, yyDollar[2].token, comment.DoubleArrowToken)
}
case 428:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php5/php5.y:3143
+ //line php5/php5.y:4569
{
- arrayItem := expr.NewArrayItem(nil, yyDollar[1].node, false)
- yylex.(*Parser).positions.AddPosition(arrayItem, yylex.(*Parser).positionBuilder.NewNodePosition(yyDollar[1].node))
- yylex.(*Parser).comments.AddComments(arrayItem, yylex.(*Parser).comments[yyDollar[1].node])
-
+ arrayItem := expr.NewArrayItem(nil, yyDollar[1].node)
yyVAL.list = []node.Node{arrayItem}
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(arrayItem, yylex.(*Parser).positionBuilder.NewNodePosition(yyDollar[1].node))
}
case 429:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php5/php5.y:3154
+ //line php5/php5.y:4580
{
yyVAL.node = yyDollar[1].node
}
case 430:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php5/php5.y:3156
+ //line php5/php5.y:4582
{
yyVAL.node = yyDollar[1].node
}
case 431:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php5/php5.y:3161
+ //line php5/php5.y:4587
{
yyVAL.node = yyDollar[2].node
}
case 432:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php5/php5.y:3163
+ //line php5/php5.y:4589
{
yyVAL.node = yyDollar[2].node
}
case 433:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php5/php5.y:3169
+ //line php5/php5.y:4595
{
yyVAL.node = yyDollar[1].node
}
case 434:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php5/php5.y:3175
+ //line php5/php5.y:4601
{
yyVAL.node = yyDollar[1].node
}
case 435:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php5/php5.y:3180
+ //line php5/php5.y:4606
{
yyVAL.node = yyDollar[1].node
}
case 436:
yyDollar = yyS[yypt-5 : yypt+1]
- //line php5/php5.y:3185
+ //line php5/php5.y:4611
{
yyVAL.node = yyDollar[1].node
@@ -6027,24 +7379,24 @@ yydefault:
yyDollar[3].list = append(yyDollar[3].list[:len(yyDollar[3].list)-1], yyDollar[4].list...)
}
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyDollar[3].list[0], yyDollar[2].token, comment.ObjectOperatorToken)
+
for _, n := range yyDollar[3].list {
switch nn := n.(type) {
case *expr.ArrayDimFetch:
nn.Variable = yyVAL.node
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyVAL.node, nn))
- yylex.(*Parser).comments.AddComments(nn, yylex.(*Parser).comments[yyDollar[1].node])
yyVAL.node = nn
case *expr.PropertyFetch:
nn.Variable = yyVAL.node
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyVAL.node, nn))
- yylex.(*Parser).comments.AddComments(nn, yylex.(*Parser).comments[yyDollar[1].node])
yyVAL.node = nn
case *expr.MethodCall:
nn.Variable = yyVAL.node
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyVAL.node, nn))
- yylex.(*Parser).comments.AddComments(nn, yylex.(*Parser).comments[yyDollar[1].node])
yyVAL.node = nn
}
}
@@ -6054,44 +7406,41 @@ yydefault:
case *expr.ArrayDimFetch:
nn.Variable = yyVAL.node
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyVAL.node, nn))
- yylex.(*Parser).comments.AddComments(nn, yylex.(*Parser).comments[yyDollar[1].node])
yyVAL.node = nn
case *expr.PropertyFetch:
nn.Variable = yyVAL.node
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyVAL.node, nn))
- yylex.(*Parser).comments.AddComments(nn, yylex.(*Parser).comments[yyDollar[1].node])
yyVAL.node = nn
case *expr.MethodCall:
nn.Variable = yyVAL.node
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyVAL.node, nn))
- yylex.(*Parser).comments.AddComments(nn, yylex.(*Parser).comments[yyDollar[1].node])
yyVAL.node = nn
}
}
}
case 437:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php5/php5.y:3238
+ //line php5/php5.y:4661
{
yyVAL.node = yyDollar[1].node
}
case 438:
yyDollar = yyS[yypt-2 : yypt+1]
- //line php5/php5.y:3243
+ //line php5/php5.y:4666
{
yyVAL.list = append(yyDollar[1].list, yyDollar[2].list...)
}
case 439:
yyDollar = yyS[yypt-0 : yypt+1]
- //line php5/php5.y:3245
+ //line php5/php5.y:4668
{
yyVAL.list = []node.Node{}
}
case 440:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php5/php5.y:3251
+ //line php5/php5.y:4674
{
if yyDollar[3].list != nil {
yyDollar[3].list[0].(*expr.MethodCall).Method = yyDollar[2].list[len(yyDollar[2].list)-1].(*expr.PropertyFetch).Property
@@ -6099,59 +7448,74 @@ yydefault:
}
yyVAL.list = yyDollar[2].list
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyDollar[2].list[0], yyDollar[1].token, comment.ObjectOperatorToken)
}
case 441:
yyDollar = yyS[yypt-4 : yypt+1]
- //line php5/php5.y:3263
+ //line php5/php5.y:4689
{
fetch := expr.NewArrayDimFetch(nil, yyDollar[3].node)
+ yyVAL.list = append(yyDollar[1].list, fetch)
+
+ // save position
yylex.(*Parser).positions.AddPosition(fetch, yylex.(*Parser).positionBuilder.NewNodePosition(yyDollar[3].node))
- yyVAL.list = append(yyDollar[1].list, fetch)
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(fetch, yyDollar[2].token, comment.OpenSquareBracket)
+ yylex.(*Parser).comments.AddFromToken(fetch, yyDollar[4].token, comment.CloseSquareBracket)
}
case 442:
yyDollar = yyS[yypt-4 : yypt+1]
- //line php5/php5.y:3270
+ //line php5/php5.y:4701
{
fetch := expr.NewArrayDimFetch(nil, yyDollar[3].node)
+ yyVAL.list = []node.Node{yyDollar[1].node, fetch}
+
+ // save position
yylex.(*Parser).positions.AddPosition(fetch, yylex.(*Parser).positionBuilder.NewNodePosition(yyDollar[3].node))
- yyVAL.list = []node.Node{yyDollar[1].node, fetch}
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(fetch, yyDollar[2].token, comment.OpenSquareBracket)
+ yylex.(*Parser).comments.AddFromToken(fetch, yyDollar[4].token, comment.CloseSquareBracket)
}
case 443:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php5/php5.y:3280
+ //line php5/php5.y:4716
{
- yyVAL.node = expr.NewMethodCall(nil, nil, yyDollar[1].nodesWithEndToken.nodes)
- yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodeListTokenPosition(yyDollar[1].nodesWithEndToken.nodes, yyDollar[1].nodesWithEndToken.endToken))
+ yyVAL.node = expr.NewMethodCall(nil, nil, yyDollar[1].node.(*node.ArgumentList))
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodePosition(yyDollar[1].node))
}
case 444:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php5/php5.y:3288
+ //line php5/php5.y:4726
{
yyVAL.list = []node.Node{yyDollar[1].node}
}
case 445:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php5/php5.y:3290
+ //line php5/php5.y:4728
{
yyVAL.list = yyDollar[1].list
}
case 446:
yyDollar = yyS[yypt-0 : yypt+1]
- //line php5/php5.y:3292
+ //line php5/php5.y:4730
{
yyVAL.list = nil
}
case 447:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php5/php5.y:3297
+ //line php5/php5.y:4735
{
yyVAL.node = yyDollar[1].node
}
case 448:
yyDollar = yyS[yypt-2 : yypt+1]
- //line php5/php5.y:3299
+ //line php5/php5.y:4737
{
yyDollar[1].simpleIndirectReference.last.SetVarName(yyDollar[2].node)
@@ -6163,69 +7527,87 @@ yydefault:
}
case 449:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php5/php5.y:3312
+ //line php5/php5.y:4750
{
yyVAL.node = expr.NewStaticPropertyFetch(yyDollar[1].node, yyDollar[3].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.PaamayimNekudotayimToken)
}
case 450:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php5/php5.y:3318
+ //line php5/php5.y:4760
{
yyVAL.node = expr.NewStaticPropertyFetch(yyDollar[1].node, yyDollar[3].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.PaamayimNekudotayimToken)
}
case 451:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php5/php5.y:3328
+ //line php5/php5.y:4774
{
yyVAL.node = yyDollar[1].node
}
case 452:
yyDollar = yyS[yypt-4 : yypt+1]
- //line php5/php5.y:3333
+ //line php5/php5.y:4779
{
yyVAL.node = expr.NewArrayDimFetch(yyDollar[1].node, yyDollar[3].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodeTokenPosition(yyDollar[1].node, yyDollar[4].token))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.OpenSquareBracket)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[4].token, comment.CloseSquareBracket)
}
case 453:
yyDollar = yyS[yypt-4 : yypt+1]
- //line php5/php5.y:3339
+ //line php5/php5.y:4790
{
yyVAL.node = expr.NewArrayDimFetch(yyDollar[1].node, yyDollar[3].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodeTokenPosition(yyDollar[1].node, yyDollar[4].token))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.OpenSquareBracket)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[4].token, comment.CloseSquareBracket)
}
case 454:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php5/php5.y:3347
+ //line php5/php5.y:4803
{
yyVAL.node = yyDollar[1].node
}
case 455:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php5/php5.y:3348
+ //line php5/php5.y:4804
{
yyVAL.node = yyDollar[1].node
}
case 456:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php5/php5.y:3349
+ //line php5/php5.y:4805
{
yyVAL.node = yyDollar[1].node
}
case 457:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php5/php5.y:3355
+ //line php5/php5.y:4811
{
yyVAL.node = yyDollar[1].node
}
case 458:
yyDollar = yyS[yypt-2 : yypt+1]
- //line php5/php5.y:3357
+ //line php5/php5.y:4813
{
yyDollar[1].simpleIndirectReference.last.SetVarName(yyDollar[2].node)
@@ -6237,153 +7619,203 @@ yydefault:
}
case 459:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php5/php5.y:3367
+ //line php5/php5.y:4823
{
yyVAL.node = yyDollar[1].node
}
case 460:
yyDollar = yyS[yypt-4 : yypt+1]
- //line php5/php5.y:3372
+ //line php5/php5.y:4828
{
yyVAL.node = expr.NewArrayDimFetch(yyDollar[1].node, yyDollar[3].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodeTokenPosition(yyDollar[1].node, yyDollar[4].token))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.OpenSquareBracket)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[4].token, comment.CloseSquareBracket)
}
case 461:
yyDollar = yyS[yypt-4 : yypt+1]
- //line php5/php5.y:3378
+ //line php5/php5.y:4839
{
yyVAL.node = expr.NewArrayDimFetch(yyDollar[1].node, yyDollar[3].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodeTokenPosition(yyDollar[1].node, yyDollar[4].token))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.OpenCurlyBracesToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[4].token, comment.CloseCurlyBracesToken)
}
case 462:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php5/php5.y:3384
+ //line php5/php5.y:4850
{
yyVAL.node = yyDollar[1].node
}
case 463:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php5/php5.y:3390
+ //line php5/php5.y:4856
{
name := node.NewIdentifier(strings.TrimLeft(yyDollar[1].token.Value, "$"))
- yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
yyVAL.node = expr.NewVariable(name)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
- yylex.(*Parser).comments.AddComments(name, yyDollar[1].token.Comments())
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.VariableToken)
}
case 464:
yyDollar = yyS[yypt-4 : yypt+1]
- //line php5/php5.y:3400
+ //line php5/php5.y:4868
{
yyVAL.node = expr.NewVariable(yyDollar[3].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[4].token))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.DollarToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.OpenCurlyBracesToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[4].token, comment.CloseCurlyBracesToken)
}
case 465:
yyDollar = yyS[yypt-0 : yypt+1]
- //line php5/php5.y:3409
+ //line php5/php5.y:4883
{
yyVAL.node = nil
}
case 466:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php5/php5.y:3411
+ //line php5/php5.y:4885
{
yyVAL.node = yyDollar[1].node
}
case 467:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php5/php5.y:3417
+ //line php5/php5.y:4891
{
yyVAL.list = yyDollar[1].list
}
case 468:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php5/php5.y:3419
+ //line php5/php5.y:4893
{
fetch := expr.NewPropertyFetch(nil, yyDollar[1].node)
- yylex.(*Parser).positions.AddPosition(fetch, yylex.(*Parser).positionBuilder.NewNodePosition(yyDollar[1].node))
-
yyVAL.list = []node.Node{fetch}
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(fetch, yylex.(*Parser).positionBuilder.NewNodePosition(yyDollar[1].node))
}
case 469:
yyDollar = yyS[yypt-4 : yypt+1]
- //line php5/php5.y:3429
+ //line php5/php5.y:4904
{
fetch := expr.NewArrayDimFetch(nil, yyDollar[3].node)
+ yyVAL.list = append(yyDollar[1].list, fetch)
+
+ // save position
yylex.(*Parser).positions.AddPosition(fetch, yylex.(*Parser).positionBuilder.NewNodePosition(yyDollar[3].node))
- yyVAL.list = append(yyDollar[1].list, fetch)
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(fetch, yyDollar[2].token, comment.OpenSquareBracket)
+ yylex.(*Parser).comments.AddFromToken(fetch, yyDollar[4].token, comment.CloseSquareBracket)
}
case 470:
yyDollar = yyS[yypt-4 : yypt+1]
- //line php5/php5.y:3436
+ //line php5/php5.y:4916
{
fetch := expr.NewArrayDimFetch(nil, yyDollar[3].node)
+ yyVAL.list = append(yyDollar[1].list, fetch)
+
+ // save position
yylex.(*Parser).positions.AddPosition(fetch, yylex.(*Parser).positionBuilder.NewNodePosition(yyDollar[3].node))
- yyVAL.list = append(yyDollar[1].list, fetch)
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(fetch, yyDollar[2].token, comment.OpenCurlyBracesToken)
+ yylex.(*Parser).comments.AddFromToken(fetch, yyDollar[4].token, comment.CloseCurlyBracesToken)
}
case 471:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php5/php5.y:3443
+ //line php5/php5.y:4928
{
fetch := expr.NewPropertyFetch(nil, yyDollar[1].node)
- yylex.(*Parser).positions.AddPosition(fetch, yylex.(*Parser).positionBuilder.NewNodePosition(yyDollar[1].node))
-
yyVAL.list = []node.Node{fetch}
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(fetch, yylex.(*Parser).positionBuilder.NewNodePosition(yyDollar[1].node))
}
case 472:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php5/php5.y:3453
+ //line php5/php5.y:4939
{
yyVAL.node = node.NewIdentifier(yyDollar[1].token.Value)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.StringToken)
}
case 473:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php5/php5.y:3459
+ //line php5/php5.y:4949
{
yyVAL.node = yyDollar[2].node
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[3].token))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.OpenCurlyBracesToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[3].token, comment.CloseCurlyBracesToken)
}
case 474:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php5/php5.y:3464
+ //line php5/php5.y:4963
{
n := expr.NewVariable(nil)
- yylex.(*Parser).positions.AddPosition(n, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
- yylex.(*Parser).comments.AddComments(n, yyDollar[1].token.Comments())
-
yyVAL.simpleIndirectReference = simpleIndirectReference{[]*expr.Variable{n}, n}
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(n, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(n, yyDollar[1].token, comment.DollarToken)
}
case 475:
yyDollar = yyS[yypt-2 : yypt+1]
- //line php5/php5.y:3472
+ //line php5/php5.y:4974
{
n := expr.NewVariable(nil)
- yylex.(*Parser).positions.AddPosition(n, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[2].token))
- yylex.(*Parser).comments.AddComments(n, yyDollar[2].token.Comments())
yyDollar[1].simpleIndirectReference.last.SetVarName(n)
-
yyDollar[1].simpleIndirectReference.all = append(yyDollar[1].simpleIndirectReference.all, n)
yyDollar[1].simpleIndirectReference.last = n
yyVAL.simpleIndirectReference = yyDollar[1].simpleIndirectReference
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(n, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[2].token))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(n, yyDollar[2].token, comment.DollarToken)
}
case 476:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php5/php5.y:3487
+ //line php5/php5.y:4992
{
yyVAL.list = append(yyDollar[1].list, yyDollar[3].node)
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(lastNode(yyDollar[1].list), yyDollar[2].token, comment.CommaToken)
}
case 477:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php5/php5.y:3489
+ //line php5/php5.y:4999
{
if yyDollar[1].node == nil {
yyVAL.list = []node.Node{}
@@ -6393,395 +7825,540 @@ yydefault:
}
case 478:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php5/php5.y:3501
+ //line php5/php5.y:5011
{
- yyVAL.node = expr.NewArrayItem(nil, yyDollar[1].node, false)
+ yyVAL.node = expr.NewArrayItem(nil, yyDollar[1].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodePosition(yyDollar[1].node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node])
}
case 479:
yyDollar = yyS[yypt-4 : yypt+1]
- //line php5/php5.y:3507
+ //line php5/php5.y:5018
{
item := expr.NewList(yyDollar[3].list)
- yylex.(*Parser).positions.AddPosition(item, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[4].token))
- yylex.(*Parser).comments.AddComments(item, yyDollar[1].token.Comments())
+ yyVAL.node = expr.NewArrayItem(nil, item)
- yyVAL.node = expr.NewArrayItem(nil, item, false)
+ // save position
+ yylex.(*Parser).positions.AddPosition(item, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[4].token))
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodePosition(item))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[item])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(item, yyDollar[1].token, comment.ListToken)
+ yylex.(*Parser).comments.AddFromToken(item, yyDollar[2].token, comment.OpenParenthesisToken)
+ yylex.(*Parser).comments.AddFromToken(item, yyDollar[4].token, comment.CloseParenthesisToken)
}
case 480:
yyDollar = yyS[yypt-0 : yypt+1]
- //line php5/php5.y:3517
+ //line php5/php5.y:5032
{
yyVAL.node = nil
}
case 481:
yyDollar = yyS[yypt-0 : yypt+1]
- //line php5/php5.y:3523
+ //line php5/php5.y:5038
{
yyVAL.list = []node.Node{}
}
case 482:
yyDollar = yyS[yypt-2 : yypt+1]
- //line php5/php5.y:3525
+ //line php5/php5.y:5040
{
yyVAL.list = yyDollar[1].list
+
+ // save comments
+ if yyDollar[2].token != nil {
+ yylex.(*Parser).comments.AddFromToken(lastNode(yyDollar[1].list), yyDollar[2].token, comment.CommaToken)
+ }
}
case 483:
yyDollar = yyS[yypt-5 : yypt+1]
- //line php5/php5.y:3530
+ //line php5/php5.y:5052
{
- arrayItem := expr.NewArrayItem(yyDollar[3].node, yyDollar[5].node, false)
- yylex.(*Parser).positions.AddPosition(arrayItem, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[3].node, yyDollar[5].node))
- yylex.(*Parser).comments.AddComments(arrayItem, yylex.(*Parser).comments[yyDollar[3].node])
-
+ arrayItem := expr.NewArrayItem(yyDollar[3].node, yyDollar[5].node)
yyVAL.list = append(yyDollar[1].list, arrayItem)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(arrayItem, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[3].node, yyDollar[5].node))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(lastNode(yyDollar[1].list), yyDollar[2].token, comment.CommaToken)
+ yylex.(*Parser).comments.AddFromToken(arrayItem, yyDollar[4].token, comment.DoubleArrowToken)
}
case 484:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php5/php5.y:3538
+ //line php5/php5.y:5064
{
- arrayItem := expr.NewArrayItem(nil, yyDollar[3].node, false)
- yylex.(*Parser).positions.AddPosition(arrayItem, yylex.(*Parser).positionBuilder.NewNodePosition(yyDollar[3].node))
- yylex.(*Parser).comments.AddComments(arrayItem, yylex.(*Parser).comments[yyDollar[3].node])
-
+ arrayItem := expr.NewArrayItem(nil, yyDollar[3].node)
yyVAL.list = append(yyDollar[1].list, arrayItem)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(arrayItem, yylex.(*Parser).positionBuilder.NewNodePosition(yyDollar[3].node))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(lastNode(yyDollar[1].list), yyDollar[2].token, comment.CommaToken)
}
case 485:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php5/php5.y:3546
+ //line php5/php5.y:5075
{
- arrayItem := expr.NewArrayItem(yyDollar[1].node, yyDollar[3].node, false)
- yylex.(*Parser).positions.AddPosition(arrayItem, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node))
- yylex.(*Parser).comments.AddComments(arrayItem, yylex.(*Parser).comments[yyDollar[1].node])
-
+ arrayItem := expr.NewArrayItem(yyDollar[1].node, yyDollar[3].node)
yyVAL.list = []node.Node{arrayItem}
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(arrayItem, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(arrayItem, yyDollar[2].token, comment.DoubleArrowToken)
}
case 486:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php5/php5.y:3554
+ //line php5/php5.y:5086
{
- arrayItem := expr.NewArrayItem(nil, yyDollar[1].node, false)
- yylex.(*Parser).positions.AddPosition(arrayItem, yylex.(*Parser).positionBuilder.NewNodePosition(yyDollar[1].node))
- yylex.(*Parser).comments.AddComments(arrayItem, yylex.(*Parser).comments[yyDollar[1].node])
-
+ arrayItem := expr.NewArrayItem(nil, yyDollar[1].node)
yyVAL.list = []node.Node{arrayItem}
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(arrayItem, yylex.(*Parser).positionBuilder.NewNodePosition(yyDollar[1].node))
}
case 487:
yyDollar = yyS[yypt-6 : yypt+1]
- //line php5/php5.y:3562
+ //line php5/php5.y:5094
{
- arrayItem := expr.NewArrayItem(yyDollar[3].node, yyDollar[6].node, true)
- yylex.(*Parser).positions.AddPosition(arrayItem, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[3].node, yyDollar[6].node))
- yylex.(*Parser).comments.AddComments(arrayItem, yylex.(*Parser).comments[yyDollar[3].node])
-
+ reference := expr.NewReference(yyDollar[6].node)
+ arrayItem := expr.NewArrayItem(yyDollar[3].node, reference)
yyVAL.list = append(yyDollar[1].list, arrayItem)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(reference, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[5].token, yyDollar[6].node))
+ yylex.(*Parser).positions.AddPosition(arrayItem, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[3].node, yyDollar[6].node))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(lastNode(yyDollar[1].list), yyDollar[2].token, comment.CommaToken)
+ yylex.(*Parser).comments.AddFromToken(arrayItem, yyDollar[4].token, comment.DoubleArrowToken)
+ yylex.(*Parser).comments.AddFromToken(reference, yyDollar[5].token, comment.AmpersandToken)
}
case 488:
yyDollar = yyS[yypt-4 : yypt+1]
- //line php5/php5.y:3570
+ //line php5/php5.y:5109
{
- arrayItem := expr.NewArrayItem(nil, yyDollar[4].node, true)
- yylex.(*Parser).positions.AddPosition(arrayItem, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[3].token, yyDollar[4].node))
- yylex.(*Parser).comments.AddComments(arrayItem, yyDollar[3].token.Comments())
-
+ reference := expr.NewReference(yyDollar[4].node)
+ arrayItem := expr.NewArrayItem(nil, reference)
yyVAL.list = append(yyDollar[1].list, arrayItem)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(reference, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[3].token, yyDollar[4].node))
+ yylex.(*Parser).positions.AddPosition(arrayItem, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[3].token, yyDollar[4].node))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(lastNode(yyDollar[1].list), yyDollar[2].token, comment.CommaToken)
+ yylex.(*Parser).comments.AddFromToken(reference, yyDollar[3].token, comment.AmpersandToken)
}
case 489:
yyDollar = yyS[yypt-4 : yypt+1]
- //line php5/php5.y:3578
+ //line php5/php5.y:5123
{
- arrayItem := expr.NewArrayItem(yyDollar[1].node, yyDollar[4].node, true)
- yylex.(*Parser).positions.AddPosition(arrayItem, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[4].node))
- yylex.(*Parser).comments.AddComments(arrayItem, yylex.(*Parser).comments[yyDollar[1].node])
-
+ reference := expr.NewReference(yyDollar[4].node)
+ arrayItem := expr.NewArrayItem(yyDollar[1].node, reference)
yyVAL.list = []node.Node{arrayItem}
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(reference, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[3].token, yyDollar[4].node))
+ yylex.(*Parser).positions.AddPosition(arrayItem, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[4].node))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(arrayItem, yyDollar[2].token, comment.DoubleArrowToken)
+ yylex.(*Parser).comments.AddFromToken(reference, yyDollar[3].token, comment.AmpersandToken)
}
case 490:
yyDollar = yyS[yypt-2 : yypt+1]
- //line php5/php5.y:3586
+ //line php5/php5.y:5137
{
- arrayItem := expr.NewArrayItem(nil, yyDollar[2].node, true)
- yylex.(*Parser).positions.AddPosition(arrayItem, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[2].node))
- yylex.(*Parser).comments.AddComments(arrayItem, yyDollar[1].token.Comments())
-
+ reference := expr.NewReference(yyDollar[2].node)
+ arrayItem := expr.NewArrayItem(nil, reference)
yyVAL.list = []node.Node{arrayItem}
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(reference, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[2].node))
+ yylex.(*Parser).positions.AddPosition(arrayItem, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[2].node))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(reference, yyDollar[1].token, comment.AmpersandToken)
}
case 491:
yyDollar = yyS[yypt-2 : yypt+1]
- //line php5/php5.y:3597
+ //line php5/php5.y:5153
{
yyVAL.list = append(yyDollar[1].list, yyDollar[2].node)
}
case 492:
yyDollar = yyS[yypt-2 : yypt+1]
- //line php5/php5.y:3599
+ //line php5/php5.y:5155
{
encapsed := scalar.NewEncapsedStringPart(yyDollar[2].token.Value)
- yylex.(*Parser).positions.AddPosition(encapsed, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[2].token))
yyVAL.list = append(yyDollar[1].list, encapsed)
- yylex.(*Parser).comments.AddComments(encapsed, yyDollar[2].token.Comments())
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(encapsed, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[2].token))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(encapsed, yyDollar[2].token, comment.EncapsedAndWhitespaceToken)
}
case 493:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php5/php5.y:3606
+ //line php5/php5.y:5166
{
yyVAL.list = []node.Node{yyDollar[1].node}
}
case 494:
yyDollar = yyS[yypt-2 : yypt+1]
- //line php5/php5.y:3608
+ //line php5/php5.y:5168
{
encapsed := scalar.NewEncapsedStringPart(yyDollar[1].token.Value)
- yylex.(*Parser).positions.AddPosition(encapsed, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
yyVAL.list = []node.Node{encapsed, yyDollar[2].node}
- yylex.(*Parser).comments.AddComments(encapsed, yyDollar[1].token.Comments())
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(encapsed, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(encapsed, yyDollar[1].token, comment.EncapsedAndWhitespaceToken)
}
case 495:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php5/php5.y:3618
+ //line php5/php5.y:5182
{
name := node.NewIdentifier(strings.TrimLeft(yyDollar[1].token.Value, "$"))
- yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
yyVAL.node = expr.NewVariable(name)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
- yylex.(*Parser).comments.AddComments(name, yyDollar[1].token.Comments())
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.VariableToken)
}
case 496:
yyDollar = yyS[yypt-4 : yypt+1]
- //line php5/php5.y:3628
+ //line php5/php5.y:5194
{
identifier := node.NewIdentifier(strings.TrimLeft(yyDollar[1].token.Value, "$"))
- yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
variable := expr.NewVariable(identifier)
- yylex.(*Parser).positions.AddPosition(variable, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
yyVAL.node = expr.NewArrayDimFetch(variable, yyDollar[3].node)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
+ yylex.(*Parser).positions.AddPosition(variable, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[4].token))
- yylex.(*Parser).comments.AddComments(identifier, yyDollar[1].token.Comments())
- yylex.(*Parser).comments.AddComments(variable, yyDollar[1].token.Comments())
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(variable, yyDollar[1].token, comment.VariableToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.OpenSquareBracket)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[4].token, comment.CloseSquareBracket)
}
case 497:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php5/php5.y:3641
+ //line php5/php5.y:5210
{
identifier := node.NewIdentifier(strings.TrimLeft(yyDollar[1].token.Value, "$"))
- yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
variable := expr.NewVariable(identifier)
- yylex.(*Parser).positions.AddPosition(variable, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
fetch := node.NewIdentifier(yyDollar[3].token.Value)
- yylex.(*Parser).positions.AddPosition(fetch, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[3].token))
yyVAL.node = expr.NewPropertyFetch(variable, fetch)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
+ yylex.(*Parser).positions.AddPosition(variable, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
+ yylex.(*Parser).positions.AddPosition(fetch, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[3].token))
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[3].token))
- yylex.(*Parser).comments.AddComments(identifier, yyDollar[1].token.Comments())
- yylex.(*Parser).comments.AddComments(variable, yyDollar[1].token.Comments())
- yylex.(*Parser).comments.AddComments(fetch, yyDollar[3].token.Comments())
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(variable, yyDollar[1].token, comment.VariableToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.ObjectOperatorToken)
+ yylex.(*Parser).comments.AddFromToken(fetch, yyDollar[3].token, comment.StringToken)
}
case 498:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php5/php5.y:3657
+ //line php5/php5.y:5228
{
- yyVAL.node = yyDollar[2].node
+ yyVAL.node = expr.NewVariable(yyDollar[2].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[3].token))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.DollarOpenCurlyBracesToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[3].token, comment.CloseCurlyBracesToken)
}
case 499:
- yyDollar = yyS[yypt-6 : yypt+1]
- //line php5/php5.y:3663
+ yyDollar = yyS[yypt-3 : yypt+1]
+ //line php5/php5.y:5239
{
- identifier := node.NewIdentifier(yyDollar[2].token.Value)
- yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[2].token))
- variable := expr.NewVariable(identifier)
- yylex.(*Parser).positions.AddPosition(variable, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[2].token))
- yyVAL.node = expr.NewArrayDimFetch(variable, yyDollar[4].node)
- yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[6].token))
+ name := node.NewIdentifier(yyDollar[2].token.Value)
+ yyVAL.node = expr.NewVariable(name)
- yylex.(*Parser).comments.AddComments(identifier, yyDollar[2].token.Comments())
- yylex.(*Parser).comments.AddComments(variable, yyDollar[1].token.Comments())
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+ // save position
+ yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[2].token))
+ yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[3].token))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.DollarOpenCurlyBracesToken)
+ yylex.(*Parser).comments.AddFromToken(name, yyDollar[2].token, comment.StringVarnameToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[3].token, comment.CloseCurlyBracesToken)
}
case 500:
- yyDollar = yyS[yypt-3 : yypt+1]
- //line php5/php5.y:3677
+ yyDollar = yyS[yypt-6 : yypt+1]
+ //line php5/php5.y:5253
{
- yyVAL.node = yyDollar[2].node
+ identifier := node.NewIdentifier(yyDollar[2].token.Value)
+ variable := expr.NewVariable(identifier)
+ yyVAL.node = expr.NewArrayDimFetch(variable, yyDollar[4].node)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[2].token))
+ yylex.(*Parser).positions.AddPosition(variable, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[2].token))
+ yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[6].token))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.DollarOpenCurlyBracesToken)
+ yylex.(*Parser).comments.AddFromToken(variable, yyDollar[2].token, comment.StringVarnameToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[3].token, comment.OpenSquareBracket)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[5].token, comment.CloseSquareBracket)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[6].token, comment.CloseCurlyBracesToken)
}
case 501:
- yyDollar = yyS[yypt-1 : yypt+1]
- //line php5/php5.y:3682
+ yyDollar = yyS[yypt-3 : yypt+1]
+ //line php5/php5.y:5271
{
- yyVAL.node = scalar.NewString(yyDollar[1].token.Value)
- yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+ yyVAL.node = yyDollar[2].node
}
case 502:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php5/php5.y:3688
+ //line php5/php5.y:5278
+ {
+ yyVAL.node = scalar.NewString(yyDollar[1].token.Value)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.StringToken)
+ }
+ case 503:
+ yyDollar = yyS[yypt-1 : yypt+1]
+ //line php5/php5.y:5288
{
// TODO: add option to handle 64 bit integer
if _, err := strconv.Atoi(yyDollar[1].token.Value); err == nil {
yyVAL.node = scalar.NewLnumber(yyDollar[1].token.Value)
- yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
} else {
yyVAL.node = scalar.NewString(yyDollar[1].token.Value)
- yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
}
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
- }
- case 503:
- yyDollar = yyS[yypt-1 : yypt+1]
- //line php5/php5.y:3700
- {
- identifier := node.NewIdentifier(strings.TrimLeft(yyDollar[1].token.Value, "$"))
- yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
- yyVAL.node = expr.NewVariable(identifier)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
- yylex.(*Parser).comments.AddComments(identifier, yyDollar[1].token.Comments())
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.NumStringToken)
}
case 504:
- yyDollar = yyS[yypt-4 : yypt+1]
- //line php5/php5.y:3713
+ yyDollar = yyS[yypt-1 : yypt+1]
+ //line php5/php5.y:5303
{
- yyVAL.node = expr.NewIsset(yyDollar[3].list)
- yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[4].token))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+ identifier := node.NewIdentifier(strings.TrimLeft(yyDollar[1].token.Value, "$"))
+ yyVAL.node = expr.NewVariable(identifier)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
+ yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.VariableToken)
}
case 505:
yyDollar = yyS[yypt-4 : yypt+1]
- //line php5/php5.y:3719
+ //line php5/php5.y:5318
{
- yyVAL.node = expr.NewEmpty(yyDollar[3].node)
+ yyVAL.node = expr.NewIsset(yyDollar[3].list)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[4].token))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.IssetToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.OpenParenthesisToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[4].token, comment.CloseParenthesisToken)
}
case 506:
yyDollar = yyS[yypt-4 : yypt+1]
- //line php5/php5.y:3725
+ //line php5/php5.y:5330
{
yyVAL.node = expr.NewEmpty(yyDollar[3].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[4].token))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.EmptyToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.OpenParenthesisToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[4].token, comment.CloseParenthesisToken)
}
case 507:
- yyDollar = yyS[yypt-2 : yypt+1]
- //line php5/php5.y:3731
+ yyDollar = yyS[yypt-4 : yypt+1]
+ //line php5/php5.y:5342
{
- yyVAL.node = expr.NewInclude(yyDollar[2].node)
- yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[2].node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+ yyVAL.node = expr.NewEmpty(yyDollar[3].node)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[4].token))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.EmptyToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.OpenParenthesisToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[4].token, comment.CloseParenthesisToken)
}
case 508:
yyDollar = yyS[yypt-2 : yypt+1]
- //line php5/php5.y:3737
+ //line php5/php5.y:5354
{
- yyVAL.node = expr.NewIncludeOnce(yyDollar[2].node)
+ yyVAL.node = expr.NewInclude(yyDollar[2].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[2].node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.IncludeToken)
}
case 509:
- yyDollar = yyS[yypt-4 : yypt+1]
- //line php5/php5.y:3743
+ yyDollar = yyS[yypt-2 : yypt+1]
+ //line php5/php5.y:5364
{
- yyVAL.node = expr.NewEval(yyDollar[3].node)
- yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[4].token))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+ yyVAL.node = expr.NewIncludeOnce(yyDollar[2].node)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[2].node))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.IncludeOnceToken)
}
case 510:
- yyDollar = yyS[yypt-2 : yypt+1]
- //line php5/php5.y:3749
+ yyDollar = yyS[yypt-4 : yypt+1]
+ //line php5/php5.y:5374
{
- yyVAL.node = expr.NewRequire(yyDollar[2].node)
- yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[2].node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+ yyVAL.node = expr.NewEval(yyDollar[3].node)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[4].token))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.EvalToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.OpenParenthesisToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[4].token, comment.CloseParenthesisToken)
}
case 511:
yyDollar = yyS[yypt-2 : yypt+1]
- //line php5/php5.y:3755
+ //line php5/php5.y:5386
{
- yyVAL.node = expr.NewRequireOnce(yyDollar[2].node)
+ yyVAL.node = expr.NewRequire(yyDollar[2].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[2].node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.RequireToken)
}
case 512:
+ yyDollar = yyS[yypt-2 : yypt+1]
+ //line php5/php5.y:5396
+ {
+ yyVAL.node = expr.NewRequireOnce(yyDollar[2].node)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[2].node))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.RequireOnceToken)
+ }
+ case 513:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php5/php5.y:3764
+ //line php5/php5.y:5409
{
yyVAL.list = []node.Node{yyDollar[1].node}
}
- case 513:
+ case 514:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php5/php5.y:3766
+ //line php5/php5.y:5411
{
yyVAL.list = append(yyDollar[1].list, yyDollar[3].node)
- }
- case 514:
- yyDollar = yyS[yypt-1 : yypt+1]
- //line php5/php5.y:3771
- {
- yyVAL.node = yyDollar[1].node
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(lastNode(yyDollar[1].list), yyDollar[2].token, comment.CommaToken)
}
case 515:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php5/php5.y:3773
+ //line php5/php5.y:5421
{
yyVAL.node = yyDollar[1].node
}
case 516:
- yyDollar = yyS[yypt-3 : yypt+1]
- //line php5/php5.y:3778
+ yyDollar = yyS[yypt-1 : yypt+1]
+ //line php5/php5.y:5423
{
- target := node.NewIdentifier(yyDollar[3].token.Value)
- yylex.(*Parser).positions.AddPosition(target, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[3].token))
- yyVAL.node = expr.NewClassConstFetch(yyDollar[1].node, target)
- yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodeTokenPosition(yyDollar[1].node, yyDollar[3].token))
-
- yylex.(*Parser).comments.AddComments(target, yyDollar[3].token.Comments())
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node])
+ yyVAL.node = yyDollar[1].node
}
case 517:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php5/php5.y:3788
+ //line php5/php5.y:5428
{
target := node.NewIdentifier(yyDollar[3].token.Value)
- yylex.(*Parser).positions.AddPosition(target, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[3].token))
yyVAL.node = expr.NewClassConstFetch(yyDollar[1].node, target)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(target, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[3].token))
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodeTokenPosition(yyDollar[1].node, yyDollar[3].token))
- yylex.(*Parser).comments.AddComments(target, yyDollar[3].token.Comments())
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node])
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.PaamayimNekudotayimToken)
}
case 518:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php5/php5.y:3801
+ //line php5/php5.y:5440
{
target := node.NewIdentifier(yyDollar[3].token.Value)
- yylex.(*Parser).positions.AddPosition(target, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[3].token))
yyVAL.node = expr.NewClassConstFetch(yyDollar[1].node, target)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(target, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[3].token))
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodeTokenPosition(yyDollar[1].node, yyDollar[3].token))
- yylex.(*Parser).comments.AddComments(target, yyDollar[3].token.Comments())
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node])
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.PaamayimNekudotayimToken)
}
case 519:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php5/php5.y:3814
+ //line php5/php5.y:5455
{
target := node.NewIdentifier(yyDollar[3].token.Value)
- yylex.(*Parser).positions.AddPosition(target, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[3].token))
yyVAL.node = expr.NewClassConstFetch(yyDollar[1].node, target)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(target, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[3].token))
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodeTokenPosition(yyDollar[1].node, yyDollar[3].token))
- yylex.(*Parser).comments.AddComments(target, yyDollar[3].token.Comments())
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node])
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.PaamayimNekudotayimToken)
+ }
+ case 520:
+ yyDollar = yyS[yypt-3 : yypt+1]
+ //line php5/php5.y:5470
+ {
+ target := node.NewIdentifier(yyDollar[3].token.Value)
+ yyVAL.node = expr.NewClassConstFetch(yyDollar[1].node, target)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(target, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[3].token))
+ yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodeTokenPosition(yyDollar[1].node, yyDollar[3].token))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.PaamayimNekudotayimToken)
}
}
goto yystack /* stack new state and value */
diff --git a/php5/php5.y b/php5/php5.y
index f79ac9a..a25a750 100644
--- a/php5/php5.y
+++ b/php5/php5.y
@@ -5,7 +5,8 @@ import (
"strings"
"strconv"
- "github.com/z7zmey/php-parser/token"
+ "github.com/z7zmey/php-parser/comment"
+ "github.com/z7zmey/php-parser/scanner"
"github.com/z7zmey/php-parser/node"
"github.com/z7zmey/php-parser/node/scalar"
"github.com/z7zmey/php-parser/node/name"
@@ -19,14 +20,15 @@ import (
%}
%union{
- node node.Node
- token token.Token
- boolWithToken boolWithToken
- list []node.Node
- foreachVariable foreachVariable
- nodesWithEndToken *nodesWithEndToken
+ node node.Node
+ token *scanner.Token
+ list []node.Node
simpleIndirectReference simpleIndirectReference
- altSyntaxNode altSyntaxNode
+
+ ClassExtends *stmt.ClassExtends
+ ClassImplements *stmt.ClassImplements
+ InterfaceExtends *stmt.InterfaceExtends
+ ClosureUse *expr.ClosureUse
}
%type $unk
@@ -143,6 +145,29 @@ import (
%token T_COALESCE
%token T_SPACESHIP
%token T_NOELSE
+%token T_PLUS_EQUAL
+%token T_MINUS_EQUAL
+%token T_MUL_EQUAL
+%token T_POW_EQUAL
+%token T_DIV_EQUAL
+%token T_CONCAT_EQUAL
+%token T_MOD_EQUAL
+%token T_AND_EQUAL
+%token T_OR_EQUAL
+%token T_XOR_EQUAL
+%token T_SL_EQUAL
+%token T_SR_EQUAL
+%token T_BOOLEAN_OR
+%token T_BOOLEAN_AND
+%token T_POW
+%token T_SL
+%token T_SR
+%token T_IS_IDENTICAL
+%token T_IS_NOT_IDENTICAL
+%token T_IS_EQUAL
+%token T_IS_NOT_EQUAL
+%token T_IS_SMALLER_OR_EQUAL
+%token T_IS_GREATER_OR_EQUAL
%token '"'
%token '`'
%token '{'
@@ -161,6 +186,16 @@ import (
%token '~'
%token '@'
%token '$'
+%token ','
+%token '|'
+%token '='
+%token '^'
+%token '*'
+%token '/'
+%token '%'
+%token '<'
+%token '>'
+%token '.'
%left T_INCLUDE T_INCLUDE_ONCE T_EVAL T_REQUIRE T_REQUIRE_ONCE
%left ','
@@ -193,6 +228,8 @@ import (
%right T_STATIC T_ABSTRACT T_FINAL T_PRIVATE T_PROTECTED T_PUBLIC
%type function interface_entry
+%type possible_comma
+%type case_separator
%type top_statement use_declaration use_function_declaration use_const_declaration common_scalar
%type static_class_constant compound_variable reference_variable class_name variable_class_name
@@ -205,17 +242,28 @@ import (
%type exit_expr yield_expr function_declaration_statement class_declaration_statement constant_declaration
%type else_single new_else_single unset_variable declare_statement
%type finally_statement additional_catch unticked_function_declaration_statement unticked_class_declaration_statement
-%type optional_class_type parameter class_entry_type extends_from class_statement class_constant_declaration
+%type optional_class_type parameter class_entry_type class_statement class_constant_declaration
%type trait_use_statement function_call_parameter trait_adaptation_statement trait_precedence trait_alias
%type trait_method_reference_fully_qualified trait_method_reference trait_modifiers member_modifier method
%type static_scalar_value static_operation
+%type ctor_arguments function_call_parameter_list
+%type trait_adaptations
+%type switch_case_list
+%type method_body
+%type foreach_statement for_statement while_statement
+%type foreach_variable foreach_optional_arg
+
+%type extends_from
+%type implements_list
+%type interface_extends_list
+%type lexical_vars
%type top_statement_list namespace_name use_declarations use_function_declarations use_const_declarations
%type inner_statement_list global_var_list static_var_list encaps_list isset_variables non_empty_array_pair_list
-%type array_pair_list assignment_list lexical_var_list lexical_vars elseif_list new_elseif_list non_empty_for_expr
+%type array_pair_list assignment_list lexical_var_list elseif_list new_elseif_list non_empty_for_expr
%type for_expr case_list echo_expr_list unset_variables declare_list catch_statement additional_catches
-%type non_empty_additional_catches parameter_list non_empty_parameter_list class_statement_list implements_list
-%type class_statement_list variable_modifiers method_modifiers class_variable_declaration interface_extends_list
+%type non_empty_additional_catches parameter_list non_empty_parameter_list class_statement_list
+%type class_statement_list variable_modifiers method_modifiers class_variable_declaration
%type interface_list non_empty_function_call_parameter_list trait_list trait_adaptation_list non_empty_trait_adaptation_list
%type trait_reference_list non_empty_member_modifiers backticks_expr static_array_pair_list non_empty_static_array_pair_list
@@ -224,17 +272,14 @@ import (
%type dynamic_class_name_variable_properties variable_properties
%type simple_indirect_reference
-%type foreach_variable foreach_optional_arg
-%type ctor_arguments function_call_parameter_list switch_case_list method_body trait_adaptations
-%type is_reference is_variadic
-%type while_statement for_statement foreach_statement
+%type is_reference is_variadic
%%
start:
top_statement_list
{
- yylex.(*Parser).rootNode = stmt.NewStmtList($1)
+ yylex.(*Parser).rootNode = node.NewRoot($1)
yylex.(*Parser).positions.AddPosition(yylex.(*Parser).rootNode, yylex.(*Parser).positionBuilder.NewNodeListPosition($1))
}
;
@@ -253,16 +298,25 @@ namespace_name:
T_STRING
{
namePart := name.NewNamePart($1.Value)
- yylex.(*Parser).positions.AddPosition(namePart, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
$$ = []node.Node{namePart}
- yylex.(*Parser).comments.AddComments(namePart, $1.Comments())
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(namePart, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(namePart, $1, comment.StringToken)
}
| namespace_name T_NS_SEPARATOR T_STRING
{
namePart := name.NewNamePart($3.Value)
- yylex.(*Parser).positions.AddPosition(namePart, yylex.(*Parser).positionBuilder.NewTokenPosition($3))
$$ = append($1, namePart)
- yylex.(*Parser).comments.AddComments(namePart, $3.Comments())
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(namePart, yylex.(*Parser).positionBuilder.NewTokenPosition($3))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(lastNode($1), $2, comment.NsSeparatorToken)
+ yylex.(*Parser).comments.AddFromToken(namePart, $3, comment.StringToken)
}
;
@@ -281,68 +335,114 @@ top_statement:
| T_HALT_COMPILER '(' ')' ';'
{
$$ = stmt.NewHaltCompiler()
+
+ // save position
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $4))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.HaltCompilerToken)
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.OpenParenthesisToken)
+ yylex.(*Parser).comments.AddFromToken($$, $3, comment.CloseParenthesisToken)
+ yylex.(*Parser).comments.AddFromToken($$, $4, comment.SemiColonToken)
}
| T_NAMESPACE namespace_name ';'
{
name := name.NewName($2)
- yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewNodeListPosition($2))
$$ = stmt.NewNamespace(name, nil)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewNodeListPosition($2))
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $3))
- yylex.(*Parser).comments.AddComments(name, yylex.(*Parser).listGetFirstNodeComments($2))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.NamespaceToken)
+ yylex.(*Parser).comments.AddFromToken($$, $3, comment.SemiColonToken)
}
| T_NAMESPACE namespace_name '{' top_statement_list '}'
{
name := name.NewName($2)
- yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewNodeListPosition($2))
$$ = stmt.NewNamespace(name, $4)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewNodeListPosition($2))
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $5))
- yylex.(*Parser).comments.AddComments(name, yylex.(*Parser).listGetFirstNodeComments($2))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.NamespaceToken)
+ yylex.(*Parser).comments.AddFromToken($$, $3, comment.OpenCurlyBracesToken)
+ yylex.(*Parser).comments.AddFromToken($$, $5, comment.CloseCurlyBracesToken)
}
| T_NAMESPACE '{' top_statement_list '}'
{
$$ = stmt.NewNamespace(nil, $3)
+
+ // save position
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $4))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.NamespaceToken)
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.OpenCurlyBracesToken)
+ yylex.(*Parser).comments.AddFromToken($$, $4, comment.CloseCurlyBracesToken)
}
| T_USE use_declarations ';'
{
$$ = stmt.NewUseList(nil, $2)
+
+ // save position
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $3))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.UseToken)
+ yylex.(*Parser).comments.AddFromToken($$, $3, comment.SemiColonToken)
}
| T_USE T_FUNCTION use_function_declarations ';'
{
useType := node.NewIdentifier($2.Value)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenPosition($2))
- yylex.(*Parser).comments.AddComments($$, $2.Comments())
-
$$ = stmt.NewUseList(useType, $3)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenPosition($2))
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $4))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.UseToken)
+ yylex.(*Parser).comments.AddFromToken(useType, $2, comment.UseToken)
+ yylex.(*Parser).comments.AddFromToken($$, $4, comment.SemiColonToken)
}
| T_USE T_CONST use_const_declarations ';'
{
useType := node.NewIdentifier($2.Value)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenPosition($2))
- yylex.(*Parser).comments.AddComments($$, $2.Comments())
-
$$ = stmt.NewUseList(useType, $3)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenPosition($2))
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $4))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.UseToken)
+ yylex.(*Parser).comments.AddFromToken(useType, $2, comment.UseToken)
+ yylex.(*Parser).comments.AddFromToken($$, $4, comment.SemiColonToken)
}
| constant_declaration ';'
- { $$ = $1 }
+ {
+ $$ = $1
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodeTokenPosition($1, $2))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.SemiColonToken)
+ }
;
use_declarations:
use_declarations ',' use_declaration
- { $$ = append($1, $3) }
+ {
+ $$ = append($1, $3)
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(lastNode($1), $2, comment.CommaToken)
+ }
| use_declaration
{ $$ = []node.Node{$1} }
;
@@ -351,54 +451,65 @@ use_declaration:
namespace_name
{
name := name.NewName($1)
- yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewNodeListPosition($1))
$$ = stmt.NewUse(nil, name, nil)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodeListPosition($1))
- yylex.(*Parser).comments.AddComments(name, yylex.(*Parser).listGetFirstNodeComments($1))
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).listGetFirstNodeComments($1))
+ // save position
+ yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewNodeListPosition($1))
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodeListPosition($1))
}
| namespace_name T_AS T_STRING
{
name := name.NewName($1)
- yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewNodeListPosition($1))
alias := node.NewIdentifier($3.Value)
- yylex.(*Parser).positions.AddPosition(alias, yylex.(*Parser).positionBuilder.NewTokenPosition($3))
$$ = stmt.NewUse(nil, name, alias)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewNodeListPosition($1))
+ yylex.(*Parser).positions.AddPosition(alias, yylex.(*Parser).positionBuilder.NewTokenPosition($3))
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodeListTokenPosition($1, $3))
- yylex.(*Parser).comments.AddComments(name, yylex.(*Parser).listGetFirstNodeComments($1))
- yylex.(*Parser).comments.AddComments(alias, $3.Comments())
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).listGetFirstNodeComments($1))
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.AsToken)
+ yylex.(*Parser).comments.AddFromToken(alias, $3, comment.StringToken)
}
| T_NS_SEPARATOR namespace_name
{
name := name.NewName($2)
- yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewNodeListPosition($2))
$$ = stmt.NewUse(nil, name, nil)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewNodeListPosition($2))
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodeListPosition($2))
- yylex.(*Parser).comments.AddComments(name, yylex.(*Parser).listGetFirstNodeComments($2))
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).listGetFirstNodeComments($2))
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.NsSeparatorToken)
}
| T_NS_SEPARATOR namespace_name T_AS T_STRING
{
name := name.NewName($2)
- yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewNodeListPosition($2))
alias := node.NewIdentifier($4.Value)
- yylex.(*Parser).positions.AddPosition(alias, yylex.(*Parser).positionBuilder.NewTokenPosition($4))
$$ = stmt.NewUse(nil, name, alias)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewNodeListPosition($2))
+ yylex.(*Parser).positions.AddPosition(alias, yylex.(*Parser).positionBuilder.NewTokenPosition($4))
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodeListTokenPosition($2, $4))
- yylex.(*Parser).comments.AddComments(name, yylex.(*Parser).listGetFirstNodeComments($2))
- yylex.(*Parser).comments.AddComments(alias, $4.Comments())
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).listGetFirstNodeComments($2))
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.NsSeparatorToken)
+ yylex.(*Parser).comments.AddFromToken($$, $3, comment.AsToken)
+ yylex.(*Parser).comments.AddFromToken($$, $4, comment.StringToken)
}
;
use_function_declarations:
use_function_declarations ',' use_function_declaration
- { $$ = append($1, $3) }
+ {
+ $$ = append($1, $3)
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(lastNode($1), $2, comment.CommaToken)
+ }
| use_function_declaration
{ $$ = []node.Node{$1} }
;
@@ -407,54 +518,65 @@ use_function_declaration:
namespace_name
{
name := name.NewName($1)
- yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewNodeListPosition($1))
$$ = stmt.NewUse(nil, name, nil)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodeListPosition($1))
- yylex.(*Parser).comments.AddComments(name, yylex.(*Parser).listGetFirstNodeComments($1))
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).listGetFirstNodeComments($1))
+ // save position
+ yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewNodeListPosition($1))
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodeListPosition($1))
}
| namespace_name T_AS T_STRING
{
name := name.NewName($1)
- yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewNodeListPosition($1))
alias := node.NewIdentifier($3.Value)
- yylex.(*Parser).positions.AddPosition(alias, yylex.(*Parser).positionBuilder.NewTokenPosition($3))
$$ = stmt.NewUse(nil, name, alias)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewNodeListPosition($1))
+ yylex.(*Parser).positions.AddPosition(alias, yylex.(*Parser).positionBuilder.NewTokenPosition($3))
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodeListTokenPosition($1, $3))
- yylex.(*Parser).comments.AddComments(name, yylex.(*Parser).listGetFirstNodeComments($1))
- yylex.(*Parser).comments.AddComments(alias, $3.Comments())
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).listGetFirstNodeComments($1))
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.AsToken)
+ yylex.(*Parser).comments.AddFromToken(alias, $3, comment.StringToken)
}
| T_NS_SEPARATOR namespace_name
{
name := name.NewName($2)
- yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewNodeListPosition($2))
$$ = stmt.NewUse(nil, name, nil)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewNodeListPosition($2))
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodeListPosition($2))
- yylex.(*Parser).comments.AddComments(name, yylex.(*Parser).listGetFirstNodeComments($2))
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).listGetFirstNodeComments($2))
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.NsSeparatorToken)
}
| T_NS_SEPARATOR namespace_name T_AS T_STRING
{
name := name.NewName($2)
- yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewNodeListPosition($2))
alias := node.NewIdentifier($4.Value)
- yylex.(*Parser).positions.AddPosition(alias, yylex.(*Parser).positionBuilder.NewTokenPosition($4))
$$ = stmt.NewUse(nil, name, alias)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewNodeListPosition($2))
+ yylex.(*Parser).positions.AddPosition(alias, yylex.(*Parser).positionBuilder.NewTokenPosition($4))
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodeListTokenPosition($2, $4))
- yylex.(*Parser).comments.AddComments(name, yylex.(*Parser).listGetFirstNodeComments($2))
- yylex.(*Parser).comments.AddComments(alias, $4.Comments())
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).listGetFirstNodeComments($2))
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.NsSeparatorToken)
+ yylex.(*Parser).comments.AddFromToken($$, $3, comment.AsToken)
+ yylex.(*Parser).comments.AddFromToken($$, $4, comment.StringToken)
}
;
use_const_declarations:
use_const_declarations ',' use_const_declaration
- { $$ = append($1, $3) }
+ {
+ $$ = append($1, $3)
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(lastNode($1), $2, comment.CommaToken)
+ }
| use_const_declaration
{ $$ = []node.Node{$1} }
;
@@ -463,48 +585,54 @@ use_const_declaration:
namespace_name
{
name := name.NewName($1)
- yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewNodeListPosition($1))
$$ = stmt.NewUse(nil, name, nil)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodeListPosition($1))
- yylex.(*Parser).comments.AddComments(name, yylex.(*Parser).listGetFirstNodeComments($1))
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).listGetFirstNodeComments($1))
+ // save position
+ yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewNodeListPosition($1))
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodeListPosition($1))
}
| namespace_name T_AS T_STRING
{
name := name.NewName($1)
- yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewNodeListPosition($1))
alias := node.NewIdentifier($3.Value)
- yylex.(*Parser).positions.AddPosition(alias, yylex.(*Parser).positionBuilder.NewTokenPosition($3))
$$ = stmt.NewUse(nil, name, alias)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewNodeListPosition($1))
+ yylex.(*Parser).positions.AddPosition(alias, yylex.(*Parser).positionBuilder.NewTokenPosition($3))
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodeListTokenPosition($1, $3))
- yylex.(*Parser).comments.AddComments(name, yylex.(*Parser).listGetFirstNodeComments($1))
- yylex.(*Parser).comments.AddComments(alias, $3.Comments())
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).listGetFirstNodeComments($1))
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.AsToken)
+ yylex.(*Parser).comments.AddFromToken(alias, $3, comment.StringToken)
}
| T_NS_SEPARATOR namespace_name
{
name := name.NewName($2)
- yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewNodeListPosition($2))
$$ = stmt.NewUse(nil, name, nil)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewNodeListPosition($2))
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodeListPosition($2))
- yylex.(*Parser).comments.AddComments(name, yylex.(*Parser).listGetFirstNodeComments($2))
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).listGetFirstNodeComments($2))
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.NsSeparatorToken)
}
| T_NS_SEPARATOR namespace_name T_AS T_STRING
{
name := name.NewName($2)
- yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewNodeListPosition($2))
alias := node.NewIdentifier($4.Value)
- yylex.(*Parser).positions.AddPosition(alias, yylex.(*Parser).positionBuilder.NewTokenPosition($4))
$$ = stmt.NewUse(nil, name, alias)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewNodeListPosition($2))
+ yylex.(*Parser).positions.AddPosition(alias, yylex.(*Parser).positionBuilder.NewTokenPosition($4))
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodeListTokenPosition($2, $4))
- yylex.(*Parser).comments.AddComments(name, yylex.(*Parser).listGetFirstNodeComments($2))
- yylex.(*Parser).comments.AddComments(alias, $4.Comments())
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).listGetFirstNodeComments($2))
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.NsSeparatorToken)
+ yylex.(*Parser).comments.AddFromToken($$, $3, comment.AsToken)
+ yylex.(*Parser).comments.AddFromToken($$, $4, comment.StringToken)
}
;
@@ -512,34 +640,37 @@ constant_declaration:
constant_declaration ',' T_STRING '=' static_scalar
{
name := node.NewIdentifier($3.Value)
- yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewTokenPosition($3))
- yylex.(*Parser).comments.AddComments(name, $3.Comments())
-
constant := stmt.NewConstant(name, $5, "")
- yylex.(*Parser).positions.AddPosition(constant, yylex.(*Parser).positionBuilder.NewTokenNodePosition($3, $5))
- yylex.(*Parser).comments.AddComments(constant, $3.Comments())
-
constList := $1.(*stmt.ConstList)
constList.Consts = append(constList.Consts, constant)
-
$$ = $1
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewTokenPosition($3))
+ yylex.(*Parser).positions.AddPosition(constant, yylex.(*Parser).positionBuilder.NewTokenNodePosition($3, $5))
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodeNodeListPosition($1, constList.Consts))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(lastNode(constList.Consts), $2, comment.CommaToken)
+ yylex.(*Parser).comments.AddFromToken(name, $3, comment.StringToken)
+ yylex.(*Parser).comments.AddFromToken(constant, $4, comment.EqualToken)
}
| T_CONST T_STRING '=' static_scalar
{
name := node.NewIdentifier($2.Value)
- yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewTokenPosition($2))
- yylex.(*Parser).comments.AddComments(name, $2.Comments())
-
constant := stmt.NewConstant(name, $4, "")
- yylex.(*Parser).positions.AddPosition(constant, yylex.(*Parser).positionBuilder.NewTokenNodePosition($2, $4))
- yylex.(*Parser).comments.AddComments(constant, $2.Comments())
-
constList := []node.Node{constant}
-
$$ = stmt.NewConstList(constList)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewTokenPosition($2))
+ yylex.(*Parser).positions.AddPosition(constant, yylex.(*Parser).positionBuilder.NewTokenNodePosition($2, $4))
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodeListPosition($1, constList))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.ConstToken)
+ yylex.(*Parser).comments.AddFromToken(name, $2, comment.StringToken)
+ yylex.(*Parser).comments.AddFromToken(constant, $3, comment.EqualToken)
}
;
@@ -570,8 +701,15 @@ inner_statement:
| T_HALT_COMPILER '(' ')' ';'
{
$$ = stmt.NewHaltCompiler()
+
+ // save position
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $4))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.HaltCompilerToken)
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.OpenParenthesisToken)
+ yylex.(*Parser).comments.AddFromToken($$, $3, comment.CloseParenthesisToken)
+ yylex.(*Parser).comments.AddFromToken($$, $4, comment.SemiColonToken)
}
;
@@ -582,12 +720,15 @@ statement:
| T_STRING ':'
{
label := node.NewIdentifier($1.Value)
- yylex.(*Parser).positions.AddPosition(label, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
$$ = stmt.NewLabel(label)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(label, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $2))
- yylex.(*Parser).comments.AddComments(label, $1.Comments())
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(label, $1, comment.StringToken)
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.ColonToken)
}
;
@@ -595,13 +736,19 @@ unticked_statement:
'{' inner_statement_list '}'
{
$$ = stmt.NewStmtList($2)
+
+ // save position
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $3))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.OpenCurlyBracesToken)
+ yylex.(*Parser).comments.AddFromToken($$, $3, comment.CloseCurlyBracesToken)
}
| T_IF parenthesis_expr statement elseif_list else_single
{
$$ = stmt.NewIf($2, $3, $4, $5)
-
+
+ // save position
if $5 != nil {
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $5))
} else if len($4) > 0 {
@@ -610,212 +757,382 @@ unticked_statement:
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $3))
}
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.IfToken)
}
| T_IF parenthesis_expr ':' inner_statement_list new_elseif_list new_else_single T_ENDIF ';'
{
stmts := stmt.NewStmtList($4)
- yylex.(*Parser).positions.AddPosition(stmts, yylex.(*Parser).positionBuilder.NewNodeListPosition($4))
-
$$ = stmt.NewAltIf($2, stmts, $5, $6)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(stmts, yylex.(*Parser).positionBuilder.NewNodeListPosition($4))
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $8))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.IfToken)
+ yylex.(*Parser).comments.AddFromToken($$, $3, comment.ColonToken)
+ yylex.(*Parser).comments.AddFromToken($$, $7, comment.EndifToken)
+ yylex.(*Parser).comments.AddFromToken($$, $8, comment.SemiColonToken)
}
| T_WHILE parenthesis_expr while_statement
{
- if ($3.isAlt) {
- $$ = stmt.NewAltWhile($2, $3.node)
- } else {
- $$ = stmt.NewWhile($2, $3.node)
+ switch n := $3.(type) {
+ case *stmt.While :
+ n.Cond = $2
+ case *stmt.AltWhile :
+ n.Cond = $2
}
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $3.node))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
+
+ $$ = $3
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $3))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.WhileToken)
}
| T_DO statement T_WHILE parenthesis_expr ';'
{
$$ = stmt.NewDo($2, $4)
+
+ // save position
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $5))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.DoToken)
+ yylex.(*Parser).comments.AddFromToken($$, $3, comment.WhileToken)
+ yylex.(*Parser).comments.AddFromToken($$, $5, comment.SemiColonToken)
}
| T_FOR '(' for_expr ';' for_expr ';' for_expr ')' for_statement
{
- if ($9.isAlt) {
- $$ = stmt.NewAltFor($3, $5, $7, $9.node)
- } else {
- $$ = stmt.NewFor($3, $5, $7, $9.node)
+ switch n := $9.(type) {
+ case *stmt.For :
+ n.Init = $3
+ n.Cond = $5
+ n.Loop = $7
+ case *stmt.AltFor :
+ n.Init = $3
+ n.Cond = $5
+ n.Loop = $7
}
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $9.node))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
+
+ $$ = $9
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $9))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.ForToken)
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.OpenParenthesisToken)
+ yylex.(*Parser).comments.AddFromToken($$, $4, comment.ForInitSemicolonToken)
+ yylex.(*Parser).comments.AddFromToken($$, $6, comment.ForCondSemicolonToken)
+ yylex.(*Parser).comments.AddFromToken($$, $8, comment.CloseParenthesisToken)
}
| T_SWITCH parenthesis_expr switch_case_list
{
- if ($3.endToken.Value == ";") {
- $$ = stmt.NewAltSwitch($2, $3.nodes)
- } else {
- $$ = stmt.NewSwitch($2, $3.nodes)
+ switch n := $3.(type) {
+ case *stmt.Switch:
+ n.Cond = $2
+ case *stmt.AltSwitch:
+ n.Cond = $2
+ default:
+ panic("unexpected node type")
}
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $3.endToken))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
+
+ $$ = $3
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $3))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.SwitchToken)
}
| T_BREAK ';'
{
$$ = stmt.NewBreak(nil)
+
+ // save position
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $2))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.BreakToken)
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.SemiColonToken)
}
| T_BREAK expr ';'
{
$$ = stmt.NewBreak($2)
+
+ // save position
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $3))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.BreakToken)
+ yylex.(*Parser).comments.AddFromToken($$, $3, comment.SemiColonToken)
}
| T_CONTINUE ';'
{
$$ = stmt.NewContinue(nil)
+
+ // save position
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $2))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.ContinueToken)
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.SemiColonToken)
}
| T_CONTINUE expr ';'
{
$$ = stmt.NewContinue($2)
+
+ // save position
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $3))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.ContinueToken)
+ yylex.(*Parser).comments.AddFromToken($$, $3, comment.SemiColonToken)
}
| T_RETURN ';'
{
$$ = stmt.NewReturn(nil)
+
+ // save position
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $2))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.ReturnToken)
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.SemiColonToken)
}
| T_RETURN expr_without_variable ';'
{
$$ = stmt.NewReturn($2)
+
+ // save position
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $3))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.ReturnToken)
+ yylex.(*Parser).comments.AddFromToken($$, $3, comment.SemiColonToken)
}
| T_RETURN variable ';'
{
$$ = stmt.NewReturn($2)
+
+ // save position
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $3))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.ReturnToken)
+ yylex.(*Parser).comments.AddFromToken($$, $3, comment.SemiColonToken)
}
| yield_expr ';'
{
$$ = stmt.NewExpression($1)
+
+ // save position
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodeTokenPosition($1, $2))
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.SemiColonToken)
}
| T_GLOBAL global_var_list ';'
{
$$ = stmt.NewGlobal($2)
+
+ // save position
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $3))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.GlobalToken)
+ yylex.(*Parser).comments.AddFromToken($$, $3, comment.SemiColonToken)
}
| T_STATIC static_var_list ';'
{
$$ = stmt.NewStatic($2)
+
+ // save position
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $3))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.StaticToken)
+ yylex.(*Parser).comments.AddFromToken($$, $3, comment.SemiColonToken)
}
| T_ECHO echo_expr_list ';'
{
$$ = stmt.NewEcho($2)
+
+ // save position
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $3))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.EchoToken)
+ yylex.(*Parser).comments.AddFromToken($$, $3, comment.SemiColonToken)
}
| T_INLINE_HTML
{
$$ = stmt.NewInlineHtml($1.Value)
+
+ // save position
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.InlineHTMLToken)
}
| expr ';'
{
$$ = stmt.NewExpression($1)
+
+ // save position
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodeTokenPosition($1, $2))
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.SemiColonToken)
}
| T_UNSET '(' unset_variables ')' ';'
{
$$ = stmt.NewUnset($3)
+
+ // save position
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $5))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.UnsetToken)
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.OpenParenthesisToken)
+ yylex.(*Parser).comments.AddFromToken($$, $4, comment.CloseParenthesisToken)
+ yylex.(*Parser).comments.AddFromToken($$, $5, comment.SemiColonToken)
}
| T_FOREACH '(' variable T_AS foreach_variable foreach_optional_arg ')' foreach_statement
{
- if $6.node == nil {
- if ($8.isAlt) {
- $$ = stmt.NewAltForeach($3, nil, $5.node, $8.node, $5.byRef)
- } else {
- $$ = stmt.NewForeach($3, nil, $5.node, $8.node, $5.byRef)
+ if $6 == nil {
+ switch n := $8.(type) {
+ case *stmt.Foreach :
+ n.Expr = $3
+ n.Variable = $5
+ case *stmt.AltForeach :
+ n.Expr = $3
+ n.Variable = $5
}
} else {
- if ($8.isAlt) {
- $$ = stmt.NewAltForeach($3, $5.node, $6.node, $8.node, $6.byRef)
- } else {
- $$ = stmt.NewForeach($3, $5.node, $6.node, $8.node, $6.byRef)
+ switch n := $8.(type) {
+ case *stmt.Foreach :
+ n.Expr = $3
+ n.Key = $5
+ n.Variable = $6
+ case *stmt.AltForeach :
+ n.Expr = $3
+ n.Key = $5
+ n.Variable = $6
}
}
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $8.node))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
+
+ $$ = $8
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $8))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.ForeachToken)
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.OpenParenthesisToken)
+ yylex.(*Parser).comments.AddFromToken($$, $4, comment.AsToken)
+ yylex.(*Parser).comments.AddFromToken($$, $7, comment.CloseParenthesisToken)
}
| T_FOREACH '(' expr_without_variable T_AS foreach_variable foreach_optional_arg ')' foreach_statement
{
- if $6.node == nil {
- if ($8.isAlt) {
- $$ = stmt.NewAltForeach($3, nil, $5.node, $8.node, $5.byRef)
- } else {
- $$ = stmt.NewForeach($3, nil, $5.node, $8.node, $5.byRef)
+ if $6 == nil {
+ switch n := $8.(type) {
+ case *stmt.Foreach :
+ n.Expr = $3
+ n.Variable = $5
+ case *stmt.AltForeach :
+ n.Expr = $3
+ n.Variable = $5
}
} else {
- if ($8.isAlt) {
- $$ = stmt.NewAltForeach($3, $5.node, $6.node, $8.node, $6.byRef)
- } else {
- $$ = stmt.NewForeach($3, $5.node, $6.node, $8.node, $6.byRef)
+ switch n := $8.(type) {
+ case *stmt.Foreach :
+ n.Expr = $3
+ n.Key = $5
+ n.Variable = $6
+ case *stmt.AltForeach :
+ n.Expr = $3
+ n.Key = $5
+ n.Variable = $6
}
}
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $8.node))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
+
+ // save position
+ $$ = $8
+
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $8))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.ForeachToken)
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.OpenParenthesisToken)
+ yylex.(*Parser).comments.AddFromToken($$, $4, comment.AsToken)
+ yylex.(*Parser).comments.AddFromToken($$, $7, comment.CloseParenthesisToken)
}
| T_DECLARE '(' declare_list ')' declare_statement
{
$$ = stmt.NewDeclare($3, $5)
+
+ // save position
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $5))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.DeclareToken)
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.OpenParenthesisToken)
+ yylex.(*Parser).comments.AddFromToken($$, $4, comment.CloseParenthesisToken)
}
| ';'
{
$$ = stmt.NewNop()
+
+ // save position
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.SemiColonToken)
}
| T_TRY '{' inner_statement_list '}' catch_statement finally_statement
{
$$ = stmt.NewTry($3, $5, $6)
+ // save position
if $6 == nil {
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodeListPosition($1, $5))
} else {
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $6))
}
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.TryToken)
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.OpenCurlyBracesToken)
+ yylex.(*Parser).comments.AddFromToken($$, $4, comment.CloseCurlyBracesToken)
}
| T_THROW expr ';'
{
$$ = stmt.NewThrow($2)
+
+ // save position
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $3))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.ThrowToken)
+ yylex.(*Parser).comments.AddFromToken($$, $3, comment.SemiColonToken)
}
| T_GOTO T_STRING ';'
{
label := node.NewIdentifier($2.Value)
- yylex.(*Parser).positions.AddPosition(label, yylex.(*Parser).positionBuilder.NewTokenPosition($2))
$$ = stmt.NewGoto(label)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(label, yylex.(*Parser).positionBuilder.NewTokenPosition($2))
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $3))
- yylex.(*Parser).comments.AddComments(label, $2.Comments())
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.GotoToken)
+ yylex.(*Parser).comments.AddFromToken(label, $2, comment.StringToken)
+ yylex.(*Parser).comments.AddFromToken($$, $3, comment.SemiColonToken)
}
;
@@ -825,18 +1142,22 @@ catch_statement:
| T_CATCH '(' fully_qualified_class_name T_VARIABLE ')' '{' inner_statement_list '}' additional_catches
{
identifier := node.NewIdentifier(strings.TrimLeft($4.Value, "$"))
- yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition($4))
- yylex.(*Parser).comments.AddComments(identifier, $4.Comments())
-
variable := expr.NewVariable(identifier)
- yylex.(*Parser).positions.AddPosition(variable, yylex.(*Parser).positionBuilder.NewTokenPosition($4))
- yylex.(*Parser).comments.AddComments(variable, $4.Comments())
-
catch := stmt.NewCatch([]node.Node{$3}, variable, $7)
- yylex.(*Parser).positions.AddPosition(catch, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $8))
- yylex.(*Parser).comments.AddComments(catch, $1.Comments())
-
$$ = append([]node.Node{catch}, $9...)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition($4))
+ yylex.(*Parser).positions.AddPosition(variable, yylex.(*Parser).positionBuilder.NewTokenPosition($4))
+ yylex.(*Parser).positions.AddPosition(catch, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $8))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(catch, $1, comment.CatchToken)
+ yylex.(*Parser).comments.AddFromToken(catch, $2, comment.OpenParenthesisToken)
+ yylex.(*Parser).comments.AddFromToken(variable, $4, comment.StringToken)
+ yylex.(*Parser).comments.AddFromToken(catch, $5, comment.CloseParenthesisToken)
+ yylex.(*Parser).comments.AddFromToken(catch, $6, comment.OpenCurlyBracesToken)
+ yylex.(*Parser).comments.AddFromToken(catch, $8, comment.CloseCurlyBracesToken)
}
finally_statement:
@@ -845,8 +1166,14 @@ finally_statement:
| T_FINALLY '{' inner_statement_list '}'
{
$$ = stmt.NewFinally($3)
+
+ // save position
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $4))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.FinallyToken)
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.OpenCurlyBracesToken)
+ yylex.(*Parser).comments.AddFromToken($$, $4, comment.CloseCurlyBracesToken)
}
;
@@ -868,16 +1195,21 @@ additional_catch:
T_CATCH '(' fully_qualified_class_name T_VARIABLE ')' '{' inner_statement_list '}'
{
identifier := node.NewIdentifier(strings.TrimLeft($4.Value, "$"))
- yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition($4))
- yylex.(*Parser).comments.AddComments(identifier, $4.Comments())
-
variable := expr.NewVariable(identifier)
- yylex.(*Parser).positions.AddPosition(variable, yylex.(*Parser).positionBuilder.NewTokenPosition($4))
- yylex.(*Parser).comments.AddComments(variable, $4.Comments())
-
$$ = stmt.NewCatch([]node.Node{$3}, variable, $7)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition($4))
+ yylex.(*Parser).positions.AddPosition(variable, yylex.(*Parser).positionBuilder.NewTokenPosition($4))
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $8))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.CatchToken)
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.OpenParenthesisToken)
+ yylex.(*Parser).comments.AddFromToken(variable, $4, comment.StringToken)
+ yylex.(*Parser).comments.AddFromToken($$, $5, comment.CloseParenthesisToken)
+ yylex.(*Parser).comments.AddFromToken($$, $6, comment.OpenCurlyBracesToken)
+ yylex.(*Parser).comments.AddFromToken($$, $8, comment.CloseCurlyBracesToken)
}
;
@@ -885,7 +1217,12 @@ unset_variables:
unset_variable
{ $$ = []node.Node{$1} }
| unset_variables ',' unset_variable
- { $$ = append($1, $3) }
+ {
+ $$ = append($1, $3)
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(lastNode($1), $2, comment.CommaToken)
+ }
;
unset_variable:
@@ -905,38 +1242,47 @@ class_declaration_statement:
is_reference:
/* empty */
- { $$ = boolWithToken{false, nil} }
+ { $$ = nil }
| '&'
- { $$ = boolWithToken{true, &$1} }
+ { $$ = $1 }
;
is_variadic:
/* empty */
- { $$ = boolWithToken{false, nil} }
+ { $$ = nil }
| T_ELLIPSIS
- { $$ = boolWithToken{true, &$1} }
+ { $$ = $1 }
;
unticked_function_declaration_statement:
function is_reference T_STRING '(' parameter_list ')' '{' inner_statement_list '}'
{
name := node.NewIdentifier($3.Value)
- yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewTokenPosition($3))
- yylex.(*Parser).comments.AddComments(name, $3.Comments())
+ $$ = stmt.NewFunction(name, $2 != nil, $5, nil, $8, "")
- $$ = stmt.NewFunction(name, $2.value, $5, nil, $8, "")
+ // save position
+ yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewTokenPosition($3))
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $9))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.FunctionToken)
+ if $2 != nil {
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.AmpersandToken)
+ }
+ yylex.(*Parser).comments.AddFromToken(name, $3, comment.StringToken)
+ yylex.(*Parser).comments.AddFromToken($$, $4, comment.OpenParenthesisToken)
+ yylex.(*Parser).comments.AddFromToken($$, $6, comment.CloseParenthesisToken)
+ yylex.(*Parser).comments.AddFromToken($$, $7, comment.OpenCurlyBracesToken)
+ yylex.(*Parser).comments.AddFromToken($$, $9, comment.CloseCurlyBracesToken)
}
;
unticked_class_declaration_statement:
class_entry_type T_STRING extends_from implements_list '{' class_statement_list '}'
{
+ name := node.NewIdentifier($2.Value)
switch n := $1.(type) {
case *stmt.Class :
- name := node.NewIdentifier($2.Value)
- yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewTokenPosition($2))
n.ClassName = name
n.Stmts = $6
n.Extends = $3
@@ -944,23 +1290,32 @@ unticked_class_declaration_statement:
case *stmt.Trait :
// TODO: is it possible that trait extend or implement
- name := node.NewIdentifier($2.Value)
- yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewTokenPosition($2))
n.TraitName = name
n.Stmts = $6
}
-
$$ = $1
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewTokenPosition($2))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(name, $2, comment.StringToken)
+ yylex.(*Parser).comments.AddFromToken($$, $5, comment.OpenCurlyBracesToken)
+ yylex.(*Parser).comments.AddFromToken($$, $7, comment.CloseCurlyBracesToken)
}
| interface_entry T_STRING interface_extends_list '{' class_statement_list '}'
{
name := node.NewIdentifier($2.Value)
- yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewTokenPosition($2))
- yylex.(*Parser).comments.AddComments(name, $2.Comments())
-
$$ = stmt.NewInterface(name, $3, $5, "")
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewTokenPosition($2))
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $6))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(name, $2, comment.StringToken)
+ yylex.(*Parser).comments.AddFromToken($$, $4, comment.OpenCurlyBracesToken)
+ yylex.(*Parser).comments.AddFromToken($$, $6, comment.CloseCurlyBracesToken)
}
;
@@ -969,34 +1324,48 @@ class_entry_type:
T_CLASS
{
$$ = stmt.NewClass(nil, nil, nil, nil, nil, nil, "")
+
+ // save position
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.ClassToken)
}
| T_ABSTRACT T_CLASS
{
classModifier := node.NewIdentifier($1.Value)
- yylex.(*Parser).positions.AddPosition(classModifier, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
- yylex.(*Parser).comments.AddComments(classModifier, $1.Comments())
-
$$ = stmt.NewClass(nil, []node.Node{classModifier}, nil, nil, nil, nil, "")
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(classModifier, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $2))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(classModifier, $1, comment.AbstractToken)
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.ClassToken)
}
| T_TRAIT
{
$$ = stmt.NewTrait(nil, nil, "")
+
+ // save position
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.TraitToken)
}
| T_FINAL T_CLASS
{
classModifier := node.NewIdentifier($1.Value)
- yylex.(*Parser).positions.AddPosition(classModifier, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
- yylex.(*Parser).comments.AddComments(classModifier, $1.Comments())
-
$$ = stmt.NewClass(nil, []node.Node{classModifier}, nil, nil, nil, nil, "")
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(classModifier, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $2))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(classModifier, $1, comment.FinalToken)
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.ClassToken)
}
;
@@ -1004,7 +1373,15 @@ extends_from:
/* empty */
{ $$ = nil }
| T_EXTENDS fully_qualified_class_name
- { $$ = $2 }
+ {
+ $$ = stmt.NewClassExtends($2);
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $2))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.ExtendsToken)
+ }
;
interface_entry:
@@ -1016,62 +1393,128 @@ interface_extends_list:
/* empty */
{ $$ = nil }
| T_EXTENDS interface_list
- { $$ = $2 }
+ {
+ $$ = stmt.NewInterfaceExtends($2);
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodeListPosition($1, $2))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.ExtendsToken)
+ }
;
implements_list:
/* empty */
{ $$ = nil }
| T_IMPLEMENTS interface_list
- { $$ = $2 }
+ {
+ $$ = stmt.NewClassImplements($2);
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodeListPosition($1, $2))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.ImplementsToken)
+ }
;
interface_list:
fully_qualified_class_name
{ $$ = []node.Node{$1} }
| interface_list ',' fully_qualified_class_name
- { $$ = append($1, $3) }
+ {
+ $$ = append($1, $3)
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(lastNode($1), $2, comment.CommaToken)
+ }
;
foreach_optional_arg:
/* empty */
- { $$ = foreachVariable{nil, false} }
+ { $$ = nil }
| T_DOUBLE_ARROW foreach_variable
- { $$ = $2 }
+ {
+ $$ = $2
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.DoubleArrowToken)
+ }
;
foreach_variable:
variable
- { $$ = foreachVariable{$1, false} }
+ { $$ = $1 }
| '&' variable
- { $$ = foreachVariable{$2, true} }
+ {
+ $$ = expr.NewReference($2)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($2, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $2))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.AmpersandToken)
+ }
| T_LIST '(' assignment_list ')'
{
- list := expr.NewList($3)
- yylex.(*Parser).positions.AddPosition(list, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $4))
- $$ = foreachVariable{list, false}
- yylex.(*Parser).comments.AddComments(list, $1.Comments())
+ $$ = expr.NewList($3)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $4))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.ListToken)
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.OpenParenthesisToken)
+ yylex.(*Parser).comments.AddFromToken($$, $4, comment.CloseParenthesisToken)
}
;
for_statement:
statement
- { $$ = altSyntaxNode{$1, false} }
+ {
+ $$ = stmt.NewFor(nil, nil, nil, $1)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodePosition($1))
+ }
| ':' inner_statement_list T_ENDFOR ';'
{
- $$ = altSyntaxNode{stmt.NewStmtList($2), true}
- yylex.(*Parser).positions.AddPosition($$.node, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $4))
+ stmtList := stmt.NewStmtList($2)
+ $$ = stmt.NewAltFor(nil, nil, nil, stmtList)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(stmtList, yylex.(*Parser).positionBuilder.NewNodeListPosition($2))
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $4))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.ColonToken)
+ yylex.(*Parser).comments.AddFromToken($$, $3, comment.EndforToken)
+ yylex.(*Parser).comments.AddFromToken($$, $4, comment.SemiColonToken)
}
;
-
foreach_statement:
statement
- { $$ = altSyntaxNode{$1, false} }
+ {
+ $$ = stmt.NewForeach(nil, nil, nil, $1)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodePosition($1))
+ }
| ':' inner_statement_list T_ENDFOREACH ';'
{
- $$ = altSyntaxNode{stmt.NewStmtList($2), true}
- yylex.(*Parser).positions.AddPosition($$.node, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $4))
+ stmtList := stmt.NewStmtList($2)
+ $$ = stmt.NewAltForeach(nil, nil, nil, stmtList)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(stmtList, yylex.(*Parser).positionBuilder.NewNodeListPosition($2))
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $4))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.ColonToken)
+ yylex.(*Parser).comments.AddFromToken($$, $3, comment.EndforeachToken)
+ yylex.(*Parser).comments.AddFromToken($$, $4, comment.SemiColonToken)
}
;
@@ -1082,8 +1525,14 @@ declare_statement:
| ':' inner_statement_list T_ENDDECLARE ';'
{
$$ = stmt.NewStmtList($2)
+
+ // save position
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $4))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.ColonToken)
+ yylex.(*Parser).comments.AddFromToken($$, $3, comment.EnddeclareToken)
+ yylex.(*Parser).comments.AddFromToken($$, $4, comment.SemiColonToken)
}
;
@@ -1092,39 +1541,93 @@ declare_list:
T_STRING '=' static_scalar
{
name := node.NewIdentifier($1.Value)
- yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
- yylex.(*Parser).comments.AddComments(name, $1.Comments())
-
constant := stmt.NewConstant(name, $3, "")
- yylex.(*Parser).positions.AddPosition(constant, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $3))
- yylex.(*Parser).comments.AddComments(constant, $1.Comments())
-
$$ = []node.Node{constant}
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
+ yylex.(*Parser).positions.AddPosition(constant, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $3))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(name, $1, comment.StringToken)
+ yylex.(*Parser).comments.AddFromToken(constant, $2, comment.EqualToken)
}
| declare_list ',' T_STRING '=' static_scalar
{
name := node.NewIdentifier($3.Value)
- yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewTokenPosition($3))
- yylex.(*Parser).comments.AddComments(name, $3.Comments())
-
constant := stmt.NewConstant(name, $5, "")
- yylex.(*Parser).positions.AddPosition(constant, yylex.(*Parser).positionBuilder.NewTokenNodePosition($3, $5))
- yylex.(*Parser).comments.AddComments(constant, $3.Comments())
-
$$ = append($1, constant)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewTokenPosition($3))
+ yylex.(*Parser).positions.AddPosition(constant, yylex.(*Parser).positionBuilder.NewTokenNodePosition($3, $5))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(lastNode($1), $2, comment.CommaToken)
+ yylex.(*Parser).comments.AddFromToken(name, $3, comment.StringToken)
+ yylex.(*Parser).comments.AddFromToken(constant, $4, comment.EqualToken)
}
;
switch_case_list:
'{' case_list '}'
- { $$ = &nodesWithEndToken{$2, $3} }
+ {
+ caseList := stmt.NewCaseList($2)
+ $$ = stmt.NewSwitch(nil, caseList)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(caseList, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $3))
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $3))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(caseList, $1, comment.OpenCurlyBracesToken)
+ yylex.(*Parser).comments.AddFromToken(caseList, $3, comment.CloseCurlyBracesToken)
+ }
| '{' ';' case_list '}'
- { $$ = &nodesWithEndToken{$3, $4} }
+ {
+ caseList := stmt.NewCaseList($3)
+ $$ = stmt.NewSwitch(nil, caseList)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(caseList, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $4))
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $4))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(caseList, $1, comment.OpenCurlyBracesToken)
+ yylex.(*Parser).comments.AddFromToken(caseList, $2, comment.SemiColonToken)
+ yylex.(*Parser).comments.AddFromToken(caseList, $4, comment.CloseCurlyBracesToken)
+ }
| ':' case_list T_ENDSWITCH ';'
- { $$ = &nodesWithEndToken{$2, $4} }
+ {
+ caseList := stmt.NewCaseList($2)
+ $$ = stmt.NewAltSwitch(nil, caseList)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(caseList, yylex.(*Parser).positionBuilder.NewNodeListPosition($2))
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $4))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(caseList, $1, comment.ColonToken)
+ yylex.(*Parser).comments.AddFromToken(caseList, $3, comment.EndswitchToken)
+ yylex.(*Parser).comments.AddFromToken($$, $4, comment.SemiColonToken)
+ }
| ':' ';' case_list T_ENDSWITCH ';'
- { $$ = &nodesWithEndToken{$3, $5} }
+ {
+
+ caseList := stmt.NewCaseList($3)
+ $$ = stmt.NewAltSwitch(nil, caseList)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(caseList, yylex.(*Parser).positionBuilder.NewNodeListPosition($3))
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $5))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(caseList, $1, comment.ColonToken)
+ yylex.(*Parser).comments.AddFromToken(caseList, $2, comment.SemiColonToken)
+ yylex.(*Parser).comments.AddFromToken(caseList, $4, comment.EndswitchToken)
+ yylex.(*Parser).comments.AddFromToken($$, $5, comment.SemiColonToken)
+ }
;
@@ -1134,33 +1637,59 @@ case_list:
| case_list T_CASE expr case_separator inner_statement_list
{
_case := stmt.NewCase($3, $5)
- yylex.(*Parser).positions.AddPosition(_case, yylex.(*Parser).positionBuilder.NewTokenNodeListPosition($2, $5))
$$ = append($1, _case)
- yylex.(*Parser).comments.AddComments(_case, $2.Comments())
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(_case, yylex.(*Parser).positionBuilder.NewTokenNodeListPosition($2, $5))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(_case, $2, comment.CaseToken)
+ yylex.(*Parser).comments.AddFromToken(_case, $4, comment.CaseSeparatorToken)
}
| case_list T_DEFAULT case_separator inner_statement_list
{
_default := stmt.NewDefault($4)
- yylex.(*Parser).positions.AddPosition(_default, yylex.(*Parser).positionBuilder.NewTokenNodeListPosition($2, $4))
$$ = append($1, _default)
- yylex.(*Parser).comments.AddComments(_default, $2.Comments())
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(_default, yylex.(*Parser).positionBuilder.NewTokenNodeListPosition($2, $4))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(_default, $2, comment.DefaultToken)
+ yylex.(*Parser).comments.AddFromToken(_default, $3, comment.CaseSeparatorToken)
}
;
case_separator:
':'
+ { $$ = $1 }
| ';'
+ { $$ = $1 }
;
while_statement:
statement
- { $$ = altSyntaxNode{$1, false} }
+ {
+ $$ = stmt.NewWhile(nil, $1)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodePosition($1))
+ }
| ':' inner_statement_list T_ENDWHILE ';'
{
- $$ = altSyntaxNode{stmt.NewStmtList($2), true}
- yylex.(*Parser).positions.AddPosition($$.node, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $4))
+ stmtList := stmt.NewStmtList($2)
+ $$ = stmt.NewAltWhile(nil, stmtList)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(stmtList, yylex.(*Parser).positionBuilder.NewNodeListPosition($2))
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $4))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.ColonToken)
+ yylex.(*Parser).comments.AddFromToken($$, $3, comment.EndwhileToken)
+ yylex.(*Parser).comments.AddFromToken($$, $4, comment.SemiColonToken)
}
;
@@ -1172,10 +1701,13 @@ elseif_list:
| elseif_list T_ELSEIF parenthesis_expr statement
{
_elseIf := stmt.NewElseIf($3, $4)
- yylex.(*Parser).positions.AddPosition(_elseIf, yylex.(*Parser).positionBuilder.NewTokenNodePosition($2, $4))
- yylex.(*Parser).comments.AddComments(_elseIf, $2.Comments())
-
$$ = append($1, _elseIf)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(_elseIf, yylex.(*Parser).positionBuilder.NewTokenNodePosition($2, $4))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(_elseIf, $2, comment.ElseifToken)
}
;
@@ -1186,13 +1718,16 @@ new_elseif_list:
| new_elseif_list T_ELSEIF parenthesis_expr ':' inner_statement_list
{
stmts := stmt.NewStmtList($5)
- yylex.(*Parser).positions.AddPosition(stmts, yylex.(*Parser).positionBuilder.NewNodeListPosition($5))
-
_elseIf := stmt.NewAltElseIf($3, stmts)
- yylex.(*Parser).positions.AddPosition(_elseIf, yylex.(*Parser).positionBuilder.NewTokenNodeListPosition($2, $5))
- yylex.(*Parser).comments.AddComments(_elseIf, $2.Comments())
-
$$ = append($1, _elseIf)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(stmts, yylex.(*Parser).positionBuilder.NewNodeListPosition($5))
+ yylex.(*Parser).positions.AddPosition(_elseIf, yylex.(*Parser).positionBuilder.NewTokenNodeListPosition($2, $5))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(_elseIf, $2, comment.ElseifToken)
+ yylex.(*Parser).comments.AddFromToken(_elseIf, $4, comment.ColonToken)
}
;
@@ -1203,8 +1738,12 @@ else_single:
| T_ELSE statement
{
$$ = stmt.NewElse($2)
+
+ // save position
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $2))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.ElseToken)
}
;
@@ -1215,11 +1754,15 @@ new_else_single:
| T_ELSE ':' inner_statement_list
{
stmts := stmt.NewStmtList($3)
- yylex.(*Parser).positions.AddPosition(stmts, yylex.(*Parser).positionBuilder.NewNodeListPosition($3))
-
$$ = stmt.NewAltElse(stmts)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(stmts, yylex.(*Parser).positionBuilder.NewNodeListPosition($3))
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodeListPosition($1, $3))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.ElseToken)
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.ColonToken)
}
;
@@ -1235,61 +1778,71 @@ non_empty_parameter_list:
parameter
{ $$ = []node.Node{$1} }
| non_empty_parameter_list ',' parameter
- { $$ = append($1, $3) }
+ {
+ $$ = append($1, $3)
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(lastNode($1), $2, comment.CommaToken)
+ }
;
parameter:
optional_class_type is_reference is_variadic T_VARIABLE
{
identifier := node.NewIdentifier(strings.TrimLeft($4.Value, "$"))
- yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition($4))
- yylex.(*Parser).comments.AddComments($$, $4.Comments())
-
variable := expr.NewVariable(identifier)
+ $$ = node.NewParameter($1, variable, nil, $2 != nil, $3 != nil)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition($4))
yylex.(*Parser).positions.AddPosition(variable, yylex.(*Parser).positionBuilder.NewTokenPosition($4))
- yylex.(*Parser).comments.AddComments($$, $4.Comments())
-
- $$ = node.NewParameter($1, variable, nil, $2.value, $3.value)
-
if $1 != nil {
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodeTokenPosition($1, $4))
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1])
- } else if $2.value == true {
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition(*$2.token, $4))
- yylex.(*Parser).comments.AddComments($$, $2.token.Comments())
- } else if $3.value == true {
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition(*$3.token, $4))
- yylex.(*Parser).comments.AddComments($$, $3.token.Comments())
+ } else if $2 != nil {
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($2, $4))
+ } else if $3 != nil {
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($3, $4))
} else {
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenPosition($4))
- yylex.(*Parser).comments.AddComments($$, $4.Comments())
}
+
+ // save comments
+ if $2 != nil {
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.AmpersandToken)
+ }
+ if $3 != nil {
+ yylex.(*Parser).comments.AddFromToken($$, $3, comment.EllipsisToken)
+ }
+ yylex.(*Parser).comments.AddFromToken(variable, $4, comment.VariableToken)
}
| optional_class_type is_reference is_variadic T_VARIABLE '=' static_scalar
{
identifier := node.NewIdentifier(strings.TrimLeft($4.Value, "$"))
- yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition($4))
- yylex.(*Parser).comments.AddComments(identifier, $4.Comments())
-
variable := expr.NewVariable(identifier)
+ $$ = node.NewParameter($1, variable, $6, $2 != nil, $3 != nil)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition($4))
yylex.(*Parser).positions.AddPosition(variable, yylex.(*Parser).positionBuilder.NewTokenPosition($4))
- yylex.(*Parser).comments.AddComments(variable, $4.Comments())
-
- $$ = node.NewParameter($1, variable, $6, $2.value, $3.value)
-
if $1 != nil {
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $6))
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1])
- } else if $2.value == true {
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition(*$2.token, $6))
- yylex.(*Parser).comments.AddComments($$, $2.token.Comments())
- } else if $3.value == true {
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition(*$3.token, $6))
- yylex.(*Parser).comments.AddComments($$, $3.token.Comments())
+ } else if $2 != nil {
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($2, $6))
+ } else if $3 != nil {
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($3, $6))
} else {
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($4, $6))
- yylex.(*Parser).comments.AddComments($$, $4.Comments())
}
+
+ // save comments
+ if $2 != nil {
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.AmpersandToken)
+ }
+ if $3 != nil {
+ yylex.(*Parser).comments.AddFromToken($$, $3, comment.EllipsisToken)
+ }
+ yylex.(*Parser).comments.AddFromToken(variable, $4, comment.VariableToken)
+ yylex.(*Parser).comments.AddFromToken($$, $5, comment.EqualToken)
}
;
@@ -1300,14 +1853,22 @@ optional_class_type:
| T_ARRAY
{
$$ = node.NewIdentifier($1.Value)
+
+ // save position
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.ArrayToken)
}
| T_CALLABLE
{
$$ = node.NewIdentifier($1.Value)
+
+ // save position
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.CallableToken)
}
| fully_qualified_class_name
{ $$ = $1 }
@@ -1316,16 +1877,39 @@ optional_class_type:
function_call_parameter_list:
'(' ')'
- { $$ = &nodesWithEndToken{[]node.Node{}, $2} }
+ {
+ $$ = node.NewArgumentList(nil)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $2))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.OpenParenthesisToken)
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.CloseParenthesisToken)
+ }
| '(' non_empty_function_call_parameter_list ')'
- { $$ = &nodesWithEndToken{$2, $3} }
+ {
+ $$ = node.NewArgumentList($2)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $3))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.OpenParenthesisToken)
+ yylex.(*Parser).comments.AddFromToken($$, $3, comment.CloseParenthesisToken)
+ }
| '(' yield_expr ')'
{
arg := node.NewArgument($2, false, false)
- yylex.(*Parser).positions.AddPosition(arg, yylex.(*Parser).positionBuilder.NewNodePosition($2))
- yylex.(*Parser).comments.AddComments(arg, yylex.(*Parser).comments[$2])
+ $$ = node.NewArgumentList([]node.Node{arg})
- $$ = &nodesWithEndToken{[]node.Node{arg}, $3}
+ // save position
+ yylex.(*Parser).positions.AddPosition(arg, yylex.(*Parser).positionBuilder.NewNodePosition($2))
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $3))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.OpenParenthesisToken)
+ yylex.(*Parser).comments.AddFromToken($$, $3, comment.CloseParenthesisToken)
}
;
@@ -1334,39 +1918,59 @@ non_empty_function_call_parameter_list:
function_call_parameter
{ $$ = []node.Node{$1} }
| non_empty_function_call_parameter_list ',' function_call_parameter
- { $$ = append($1, $3) }
+ {
+ $$ = append($1, $3)
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(lastNode($1), $2, comment.CommaToken)
+ }
;
function_call_parameter:
expr_without_variable
{
$$ = node.NewArgument($1, false, false)
+
+ // save position
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodePosition($1))
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1])
}
| variable
{
$$ = node.NewArgument($1, false, false)
+
+ // save position
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodePosition($1))
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1])
}
| '&' w_variable
{
$$ = node.NewArgument($2, false, true)
+
+ // save position
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodePosition($2))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.AmpersandToken)
}
| T_ELLIPSIS expr
{
$$ = node.NewArgument($2, true, false)
+
+ // save position
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $2))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.EllipsisToken)
}
;
global_var_list:
global_var_list ',' global_var
- { $$ = append($1, $3) }
+ {
+ $$ = append($1, $3)
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(lastNode($1), $2, comment.CommaToken)
+ }
| global_var
{ $$ = []node.Node{$1} }
;
@@ -1376,24 +1980,36 @@ global_var:
T_VARIABLE
{
name := node.NewIdentifier(strings.TrimLeft($1.Value, "$"))
- yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
$$ = expr.NewVariable(name)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
- yylex.(*Parser).comments.AddComments(name, $1.Comments())
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.VariableToken)
}
| '$' r_variable
{
$$ = expr.NewVariable($2)
+
+ // save position
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $2))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.DollarToken)
}
| '$' '{' expr '}'
{
$$ = expr.NewVariable($3)
+
+ // save position
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $4))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.DollarToken)
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.OpenCurlyBracesToken)
+ yylex.(*Parser).comments.AddFromToken($$, $4, comment.CloseCurlyBracesToken)
}
;
@@ -1402,72 +2018,67 @@ static_var_list:
static_var_list ',' T_VARIABLE
{
identifier := node.NewIdentifier(strings.TrimLeft($3.Value, "$"))
- yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition($3))
-
variable := expr.NewVariable(identifier)
- yylex.(*Parser).positions.AddPosition(variable, yylex.(*Parser).positionBuilder.NewTokenPosition($3))
-
staticVar := stmt.NewStaticVar(variable, nil)
+ $$ = append($1, staticVar)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition($3))
+ yylex.(*Parser).positions.AddPosition(variable, yylex.(*Parser).positionBuilder.NewTokenPosition($3))
yylex.(*Parser).positions.AddPosition(staticVar, yylex.(*Parser).positionBuilder.NewTokenPosition($3))
- $$ = append($1, staticVar)
-
- yylex.(*Parser).comments.AddComments(identifier, $3.Comments())
- yylex.(*Parser).comments.AddComments(variable, $3.Comments())
- yylex.(*Parser).comments.AddComments(staticVar, $3.Comments())
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(lastNode($1), $2, comment.CommaToken)
+ yylex.(*Parser).comments.AddFromToken(variable, $3, comment.VariableToken)
}
| static_var_list ',' T_VARIABLE '=' static_scalar
{
identifier := node.NewIdentifier(strings.TrimLeft($3.Value, "$"))
- yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition($3))
-
variable := expr.NewVariable(identifier)
- yylex.(*Parser).positions.AddPosition(variable, yylex.(*Parser).positionBuilder.NewTokenPosition($3))
-
staticVar := stmt.NewStaticVar(variable, $5)
+ $$ = append($1, staticVar)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition($3))
+ yylex.(*Parser).positions.AddPosition(variable, yylex.(*Parser).positionBuilder.NewTokenPosition($3))
yylex.(*Parser).positions.AddPosition(staticVar, yylex.(*Parser).positionBuilder.NewTokenNodePosition($3, $5))
- $$ = append($1, staticVar)
-
- yylex.(*Parser).comments.AddComments(identifier, $3.Comments())
- yylex.(*Parser).comments.AddComments(variable, $3.Comments())
- yylex.(*Parser).comments.AddComments(staticVar, $3.Comments())
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(lastNode($1), $2, comment.CommaToken)
+ yylex.(*Parser).comments.AddFromToken(variable, $3, comment.VariableToken)
+ yylex.(*Parser).comments.AddFromToken(staticVar, $4, comment.EqualToken)
}
| T_VARIABLE
{
identifier := node.NewIdentifier(strings.TrimLeft($1.Value, "$"))
- yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
-
variable := expr.NewVariable(identifier)
- yylex.(*Parser).positions.AddPosition(variable, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
-
staticVar := stmt.NewStaticVar(variable, nil)
+ $$ = []node.Node{staticVar}
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
+ yylex.(*Parser).positions.AddPosition(variable, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
yylex.(*Parser).positions.AddPosition(staticVar, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
- $$ = []node.Node{staticVar}
-
- yylex.(*Parser).comments.AddComments(identifier, $1.Comments())
- yylex.(*Parser).comments.AddComments(variable, $1.Comments())
- yylex.(*Parser).comments.AddComments(staticVar, $1.Comments())
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(variable, $1, comment.VariableToken)
}
| T_VARIABLE '=' static_scalar
{
identifier := node.NewIdentifier(strings.TrimLeft($1.Value, "$"))
- yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
-
variable := expr.NewVariable(identifier)
- yylex.(*Parser).positions.AddPosition(variable, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
-
staticVar := stmt.NewStaticVar(variable, $3)
+ $$ = []node.Node{staticVar}
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
+ yylex.(*Parser).positions.AddPosition(variable, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
yylex.(*Parser).positions.AddPosition(staticVar, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $3))
- $$ = []node.Node{staticVar}
-
- yylex.(*Parser).comments.AddComments(identifier, $1.Comments())
- yylex.(*Parser).comments.AddComments(variable, $1.Comments())
- yylex.(*Parser).comments.AddComments(staticVar, $1.Comments())
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(variable, $1, comment.VariableToken)
+ yylex.(*Parser).comments.AddFromToken(staticVar, $2, comment.EqualToken)
}
-
;
@@ -1483,31 +2094,68 @@ class_statement:
variable_modifiers class_variable_declaration ';'
{
$$ = stmt.NewPropertyList($1, $2)
+
+ // save position
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodeListTokenPosition($1, $3))
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).listGetFirstNodeComments($1))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $3, comment.SemiColonToken)
}
| class_constant_declaration ';'
- { $$ = $1 }
+ {
+ $$ = $1
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodeTokenPosition($1, $2))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.SemiColonToken)
+ }
| trait_use_statement
- { $$ = $1 }
+ {
+ $$ = $1
+ }
| method_modifiers function is_reference T_STRING '(' parameter_list ')' method_body
{
name := node.NewIdentifier($4.Value)
+ $$ = stmt.NewClassMethod(name, $1, $3 != nil, $6, nil, $8, "")
+
+ // save position
yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewTokenPosition($4))
- yylex.(*Parser).comments.AddComments(name, $4.Comments())
-
- $$ = stmt.NewClassMethod(name, $1, $3.value, $6, nil, $8.nodes, "")
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewOptionalListTokensPosition($1, $2, $8.endToken))
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).listGetFirstNodeComments($1))
+ if $1 == nil {
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($2, $8))
+ } else {
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodeListNodePosition($1, $8))
+ }
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.FunctionToken)
+ if $3 != nil {
+ yylex.(*Parser).comments.AddFromToken($$, $3, comment.AmpersandToken)
+ }
+ yylex.(*Parser).comments.AddFromToken(name, $4, comment.IdentifierToken)
+ yylex.(*Parser).comments.AddFromToken($$, $5, comment.OpenParenthesisToken)
+ yylex.(*Parser).comments.AddFromToken($$, $7, comment.CloseParenthesisToken)
}
;
trait_use_statement:
T_USE trait_list trait_adaptations
{
- $$ = stmt.NewTraitUse($2, $3.nodes)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $3.endToken))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
+ var adaptationList *stmt.TraitAdaptationList
+ switch n := $3.(type) {
+ case *stmt.TraitAdaptationList:
+ adaptationList = n
+ default:
+ adaptationList = nil
+ }
+ $$ = stmt.NewTraitUse($2, adaptationList)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $3))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.UseToken)
}
;
@@ -1515,14 +2163,35 @@ trait_list:
fully_qualified_class_name
{ $$ = []node.Node{$1} }
| trait_list ',' fully_qualified_class_name
- { $$ = append($1, $3) }
+ {
+ $$ = append($1, $3)
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(lastNode($1), $2, comment.CommaToken)
+ }
;
trait_adaptations:
';'
- { $$ = &nodesWithEndToken{nil, $1} }
+ {
+ $$ = stmt.NewNop()
+
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.SemiColonToken)
+
+ }
| '{' trait_adaptation_list '}'
- { $$ = &nodesWithEndToken{$2, $3} }
+ {
+ $$ = stmt.NewTraitAdaptationList($2)
+
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $3))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.OpenCurlyBracesToken)
+ yylex.(*Parser).comments.AddFromToken($$, $3, comment.CloseCurlyBracesToken)
+ }
;
trait_adaptation_list:
@@ -1541,17 +2210,31 @@ non_empty_trait_adaptation_list:
trait_adaptation_statement:
trait_precedence ';'
- { $$ = $1 }
+ {
+ $$ = $1;
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.SemiColonToken)
+ }
| trait_alias ';'
- { $$ = $1 }
+ {
+ $$ = $1;
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.SemiColonToken)
+ }
;
trait_precedence:
trait_method_reference_fully_qualified T_INSTEADOF trait_reference_list
{
$$ = stmt.NewTraitUsePrecedence($1, $3)
+
+ // save position
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodeNodeListPosition($1, $3))
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.InsteadofToken)
}
;
@@ -1559,19 +2242,26 @@ trait_reference_list:
fully_qualified_class_name
{ $$ = []node.Node{$1} }
| trait_reference_list ',' fully_qualified_class_name
- { $$ = append($1, $3) }
+ {
+ $$ = append($1, $3)
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(lastNode($1), $2, comment.CommaToken)
+ }
;
trait_method_reference:
T_STRING
{
name := node.NewIdentifier($1.Value)
- yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
- yylex.(*Parser).comments.AddComments(name, $1.Comments())
-
$$ = stmt.NewTraitMethodRef(nil, name)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(name, $1, comment.IdentifierToken)
}
| trait_method_reference_fully_qualified
{ $$ = $1 }
@@ -1581,12 +2271,15 @@ trait_method_reference_fully_qualified:
fully_qualified_class_name T_PAAMAYIM_NEKUDOTAYIM T_STRING
{
target := node.NewIdentifier($3.Value)
- yylex.(*Parser).positions.AddPosition(target, yylex.(*Parser).positionBuilder.NewTokenPosition($3))
- yylex.(*Parser).comments.AddComments(target, $3.Comments())
-
$$ = stmt.NewTraitMethodRef($1, target)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(target, yylex.(*Parser).positionBuilder.NewTokenPosition($3))
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodeTokenPosition($1, $3))
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.PaamayimNekudotayimToken)
+ yylex.(*Parser).comments.AddFromToken(target, $3, comment.IdentifierToken)
}
;
@@ -1594,18 +2287,25 @@ trait_alias:
trait_method_reference T_AS trait_modifiers T_STRING
{
alias := node.NewIdentifier($4.Value)
- yylex.(*Parser).positions.AddPosition(alias, yylex.(*Parser).positionBuilder.NewTokenPosition($4))
$$ = stmt.NewTraitUseAlias($1, $3, alias)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(alias, yylex.(*Parser).positionBuilder.NewTokenPosition($4))
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodeTokenPosition($1, $4))
-
- yylex.(*Parser).comments.AddComments(alias, $4.Comments())
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.AsToken)
+ yylex.(*Parser).comments.AddFromToken(alias, $4, comment.IdentifierToken)
}
| trait_method_reference T_AS member_modifier
{
$$ = stmt.NewTraitUseAlias($1, $3, nil)
+
+ // save position
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3))
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.AsToken)
}
;
@@ -1617,10 +2317,27 @@ trait_modifiers:
;
method_body:
- ';' /* abstract method */
- { $$ = &nodesWithEndToken{nil, $1} }
+ ';' /* abstract method */
+ {
+ $$ = stmt.NewNop()
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.SemiColonToken)
+ }
| '{' inner_statement_list '}'
- { $$ = &nodesWithEndToken{$2, $3} }
+ {
+ $$ = stmt.NewStmtList($2)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $3))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.OpenCurlyBracesToken)
+ yylex.(*Parser).comments.AddFromToken($$, $3, comment.CloseCurlyBracesToken)
+ }
;
variable_modifiers:
@@ -1629,10 +2346,13 @@ variable_modifiers:
| T_VAR
{
modifier := node.NewIdentifier($1.Value)
- yylex.(*Parser).positions.AddPosition(modifier, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
- yylex.(*Parser).comments.AddComments(modifier, $1.Comments())
-
$$ = []node.Node{modifier}
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(modifier, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(modifier, $1, comment.VarToken)
}
;
@@ -1654,38 +2374,62 @@ member_modifier:
T_PUBLIC
{
$$ = node.NewIdentifier($1.Value)
+
+ // save position
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.PublicToken)
}
| T_PROTECTED
{
$$ = node.NewIdentifier($1.Value)
+
+ // save position
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.ProtectedToken)
}
| T_PRIVATE
{
$$ = node.NewIdentifier($1.Value)
+
+ // save position
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.PrivateToken)
}
| T_STATIC
{
$$ = node.NewIdentifier($1.Value)
+
+ // save position
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.StaticToken)
}
| T_ABSTRACT
{
$$ = node.NewIdentifier($1.Value)
+
+ // save position
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.AbstractToken)
}
| T_FINAL
{
$$ = node.NewIdentifier($1.Value)
+
+ // save position
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.FinalToken)
}
;
@@ -1693,66 +2437,66 @@ class_variable_declaration:
class_variable_declaration ',' T_VARIABLE
{
identifier := node.NewIdentifier(strings.TrimLeft($3.Value, "$"))
- yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition($3))
- yylex.(*Parser).comments.AddComments(identifier, $3.Comments())
-
variable := expr.NewVariable(identifier)
- yylex.(*Parser).positions.AddPosition(variable, yylex.(*Parser).positionBuilder.NewTokenPosition($3))
- yylex.(*Parser).comments.AddComments(variable, $3.Comments())
-
property := stmt.NewProperty(variable, nil, "")
- yylex.(*Parser).positions.AddPosition(property, yylex.(*Parser).positionBuilder.NewTokenPosition($3))
- yylex.(*Parser).comments.AddComments(property, $3.Comments())
-
$$ = append($1, property)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition($3))
+ yylex.(*Parser).positions.AddPosition(variable, yylex.(*Parser).positionBuilder.NewTokenPosition($3))
+ yylex.(*Parser).positions.AddPosition(property, yylex.(*Parser).positionBuilder.NewTokenPosition($3))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(lastNode($1), $2, comment.CommaToken)
+ yylex.(*Parser).comments.AddFromToken(variable, $3, comment.VariableToken)
}
| class_variable_declaration ',' T_VARIABLE '=' static_scalar
{
identifier := node.NewIdentifier(strings.TrimLeft($3.Value, "$"))
- yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition($3))
- yylex.(*Parser).comments.AddComments(identifier, $3.Comments())
-
variable := expr.NewVariable(identifier)
- yylex.(*Parser).positions.AddPosition(variable, yylex.(*Parser).positionBuilder.NewTokenPosition($3))
- yylex.(*Parser).comments.AddComments(variable, $3.Comments())
-
property := stmt.NewProperty(variable, $5, "")
- yylex.(*Parser).positions.AddPosition(property, yylex.(*Parser).positionBuilder.NewTokenNodePosition($3, $5))
- yylex.(*Parser).comments.AddComments(property, $3.Comments())
-
$$ = append($1, property)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition($3))
+ yylex.(*Parser).positions.AddPosition(variable, yylex.(*Parser).positionBuilder.NewTokenPosition($3))
+ yylex.(*Parser).positions.AddPosition(property, yylex.(*Parser).positionBuilder.NewTokenNodePosition($3, $5))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(lastNode($1), $2, comment.CommaToken)
+ yylex.(*Parser).comments.AddFromToken(variable, $3, comment.VariableToken)
+ yylex.(*Parser).comments.AddFromToken(property, $4, comment.EqualToken)
}
| T_VARIABLE
{
identifier := node.NewIdentifier(strings.TrimLeft($1.Value, "$"))
- yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
- yylex.(*Parser).comments.AddComments(identifier, $1.Comments())
-
variable := expr.NewVariable(identifier)
- yylex.(*Parser).positions.AddPosition(variable, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
- yylex.(*Parser).comments.AddComments(variable, $1.Comments())
-
property := stmt.NewProperty(variable, nil, "")
- yylex.(*Parser).positions.AddPosition(property, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
- yylex.(*Parser).comments.AddComments(property, $1.Comments())
-
$$ = []node.Node{property}
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
+ yylex.(*Parser).positions.AddPosition(variable, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
+ yylex.(*Parser).positions.AddPosition(property, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(variable, $1, comment.VariableToken)
}
| T_VARIABLE '=' static_scalar
{
identifier := node.NewIdentifier(strings.TrimLeft($1.Value, "$"))
- yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
- yylex.(*Parser).comments.AddComments(identifier, $1.Comments())
-
variable := expr.NewVariable(identifier)
- yylex.(*Parser).positions.AddPosition(variable, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
- yylex.(*Parser).comments.AddComments(variable, $1.Comments())
-
property := stmt.NewProperty(variable, $3, "")
- yylex.(*Parser).positions.AddPosition(property, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $3))
- yylex.(*Parser).comments.AddComments(property, $1.Comments())
-
$$ = []node.Node{property}
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
+ yylex.(*Parser).positions.AddPosition(variable, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
+ yylex.(*Parser).positions.AddPosition(property, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $3))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(variable, $1, comment.VariableToken)
+ yylex.(*Parser).comments.AddFromToken(property, $2, comment.EqualToken)
}
;
@@ -1760,37 +2504,47 @@ class_constant_declaration:
class_constant_declaration ',' T_STRING '=' static_scalar
{
name := node.NewIdentifier($3.Value)
- yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewTokenPosition($3))
- yylex.(*Parser).comments.AddComments(name, $3.Comments())
-
constant := stmt.NewConstant(name, $5, "")
- yylex.(*Parser).positions.AddPosition(constant, yylex.(*Parser).positionBuilder.NewTokenNodePosition($3, $5))
- yylex.(*Parser).comments.AddComments(constant, $3.Comments())
+ constList := $1.(*stmt.ClassConstList)
+ constList.Consts = append(constList.Consts, constant)
+ $$ = $1
- $1.(*stmt.ClassConstList).Consts = append($1.(*stmt.ClassConstList).Consts, constant)
+ // save position
+ yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewTokenPosition($3))
+ yylex.(*Parser).positions.AddPosition(constant, yylex.(*Parser).positionBuilder.NewTokenNodePosition($3, $5))
yylex.(*Parser).positions.AddPosition($1, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $5))
- $$ = $1
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(lastNode(constList.Consts), $2, comment.CommaToken)
+ yylex.(*Parser).comments.AddFromToken(name, $3, comment.IdentifierToken)
+ yylex.(*Parser).comments.AddFromToken(constant, $4, comment.EqualToken)
}
| T_CONST T_STRING '=' static_scalar
{
name := node.NewIdentifier($2.Value)
- yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewTokenPosition($2))
- yylex.(*Parser).comments.AddComments(name, $2.Comments())
-
constant := stmt.NewConstant(name, $4, "")
- yylex.(*Parser).positions.AddPosition(constant, yylex.(*Parser).positionBuilder.NewTokenNodePosition($2, $4))
- yylex.(*Parser).comments.AddComments(constant, $2.Comments())
-
$$ = stmt.NewClassConstList(nil, []node.Node{constant})
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewTokenPosition($2))
+ yylex.(*Parser).positions.AddPosition(constant, yylex.(*Parser).positionBuilder.NewTokenNodePosition($2, $4))
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $4))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.ConstToken)
+ yylex.(*Parser).comments.AddFromToken(name, $2, comment.IdentifierToken)
+ yylex.(*Parser).comments.AddFromToken(constant, $3, comment.EqualToken)
}
;
echo_expr_list:
echo_expr_list ',' expr
- { $$ = append($1, $3) }
+ {
+ $$ = append($1, $3)
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(lastNode($1), $2, comment.CommaToken)
+ }
| expr
{ $$ = []node.Node{$1} }
;
@@ -1805,7 +2559,12 @@ for_expr:
non_empty_for_expr:
non_empty_for_expr ',' expr
- { $$ = append($1, $3) }
+ {
+ $$ = append($1, $3)
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(lastNode($1), $2, comment.CommaToken)
+ }
| expr
{ $$ = []node.Node{$1} }
;
@@ -1821,16 +2580,26 @@ chaining_dereference:
chaining_dereference '[' dim_offset ']'
{
fetch := expr.NewArrayDimFetch(nil, $3)
+ $$ = append($1, fetch)
+
+ // save position
yylex.(*Parser).positions.AddPosition(fetch, yylex.(*Parser).positionBuilder.NewNodePosition($3))
- $$ = append($1, fetch)
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(fetch, $2, comment.OpenSquareBracket)
+ yylex.(*Parser).comments.AddFromToken(fetch, $4, comment.CloseSquareBracket)
}
| '[' dim_offset ']'
{
fetch := expr.NewArrayDimFetch(nil, $2)
+ $$ = []node.Node{fetch}
+
+ // save position
yylex.(*Parser).positions.AddPosition(fetch, yylex.(*Parser).positionBuilder.NewNodePosition($2))
- $$ = []node.Node{fetch}
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(fetch, $1, comment.OpenSquareBracket)
+ yylex.(*Parser).comments.AddFromToken(fetch, $3, comment.CloseSquareBracket)
}
;
@@ -1853,15 +2622,17 @@ instance_call:
new_expr:
T_NEW class_name_reference ctor_arguments
{
+
if $3 != nil {
- $$ = expr.NewNew($2, $3.nodes)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $3.endToken))
+ $$ = expr.NewNew($2, $3.(*node.ArgumentList))
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $3))
} else {
$$ = expr.NewNew($2, nil)
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $2))
}
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.NewToken)
}
;
@@ -1869,321 +2640,532 @@ expr_without_variable:
T_LIST '(' assignment_list ')' '=' expr
{
list := expr.NewList($3)
- yylex.(*Parser).positions.AddPosition(list, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $4))
$$ = assign.NewAssign(list, $6)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(list, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $4))
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $6))
- yylex.(*Parser).comments.AddComments(list, $1.Comments())
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(list, $1, comment.ListToken)
+ yylex.(*Parser).comments.AddFromToken(list, $2, comment.OpenParenthesisToken)
+ yylex.(*Parser).comments.AddFromToken(list, $4, comment.CloseParenthesisToken)
+ yylex.(*Parser).comments.AddFromToken($$, $5, comment.EqualToken)
}
| variable '=' expr
{
$$ = assign.NewAssign($1, $3)
+
+ // save position
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3))
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.EqualToken)
}
| variable '=' '&' variable
{
$$ = assign.NewReference($1, $4)
+
+ // save position
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $4))
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.EqualToken)
+ yylex.(*Parser).comments.AddFromToken($$, $3, comment.AmpersandToken)
}
| variable '=' '&' T_NEW class_name_reference ctor_arguments
{
- _new := expr.NewNew($5, nil)
- yylex.(*Parser).positions.AddPosition(_new, yylex.(*Parser).positionBuilder.NewTokenNodePosition($4, $5))
+ var _new *expr.New
if $6 != nil {
- _new = expr.NewNew($5, $6.nodes)
- yylex.(*Parser).positions.AddPosition(_new, yylex.(*Parser).positionBuilder.NewTokensPosition($4, $6.endToken))
+ _new = expr.NewNew($5, $6.(*node.ArgumentList))
+ } else {
+ _new = expr.NewNew($5, nil)
}
- yylex.(*Parser).comments.AddComments(_new, yylex.(*Parser).comments[$1])
-
$$ = assign.NewReference($1, _new)
+
+ // save position
+ if $6 != nil {
+ yylex.(*Parser).positions.AddPosition(_new, yylex.(*Parser).positionBuilder.NewTokenNodePosition($4, $6))
+ } else {
+ yylex.(*Parser).positions.AddPosition(_new, yylex.(*Parser).positionBuilder.NewTokenNodePosition($4, $5))
+ }
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, _new))
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.EqualToken)
+ yylex.(*Parser).comments.AddFromToken($$, $3, comment.AmpersandToken)
+ yylex.(*Parser).comments.AddFromToken(_new, $4, comment.NewToken)
}
| T_CLONE expr
{
$$ = expr.NewClone($2)
+
+ // save position
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $2))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.CloneToken)
}
| variable T_PLUS_EQUAL expr
{
$$ = assign.NewPlus($1, $3)
+
+ // save position
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3))
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.PlusEqualToken)
}
| variable T_MINUS_EQUAL expr
{
$$ = assign.NewMinus($1, $3)
+
+ // save position
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3))
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.MinusEqualToken)
}
| variable T_MUL_EQUAL expr
{
$$ = assign.NewMul($1, $3)
+
+ // save position
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3))
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.MulEqualToken)
}
| variable T_POW_EQUAL expr
{
$$ = assign.NewPow($1, $3)
+
+ // save position
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3))
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.PowEqualToken)
}
| variable T_DIV_EQUAL expr
{
$$ = assign.NewDiv($1, $3)
+
+ // save position
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3))
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.DivEqualToken)
}
| variable T_CONCAT_EQUAL expr
{
$$ = assign.NewConcat($1, $3)
+
+ // save position
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3))
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.ConcatEqualToken)
}
| variable T_MOD_EQUAL expr
{
$$ = assign.NewMod($1, $3)
+
+ // save position
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3))
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.ModEqualToken)
}
| variable T_AND_EQUAL expr
{
$$ = assign.NewBitwiseAnd($1, $3)
+
+ // save position
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3))
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.AndEqualToken)
}
| variable T_OR_EQUAL expr
{
$$ = assign.NewBitwiseOr($1, $3)
+
+ // save position
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3))
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.OrEqualToken)
}
| variable T_XOR_EQUAL expr
{
$$ = assign.NewBitwiseXor($1, $3)
+
+ // save position
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3))
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.XorEqualToken)
}
| variable T_SL_EQUAL expr
{
$$ = assign.NewShiftLeft($1, $3)
+
+ // save position
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3))
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.SlEqualToken)
}
| variable T_SR_EQUAL expr
{
$$ = assign.NewShiftRight($1, $3)
+
+ // save position
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3))
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.SrEqualToken)
}
| rw_variable T_INC
{
$$ = expr.NewPostInc($1)
+
+ // save position
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodeTokenPosition($1, $2))
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.IncToken)
}
| T_INC rw_variable
{
$$ = expr.NewPreInc($2)
+
+ // save position
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $2))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.IncToken)
}
| rw_variable T_DEC
{
$$ = expr.NewPostDec($1)
+
+ // save position
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodeTokenPosition($1, $2))
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.DecToken)
}
| T_DEC rw_variable
{
$$ = expr.NewPreDec($2)
+
+ // save position
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $2))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.DecToken)
}
| expr T_BOOLEAN_OR expr
{
$$ = binary.NewBooleanOr($1, $3)
+
+ // save position
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3))
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.BooleanOrToken)
}
| expr T_BOOLEAN_AND expr
{
$$ = binary.NewBooleanAnd($1, $3)
+
+ // save position
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3))
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.BooleanAndToken)
}
| expr T_LOGICAL_OR expr
{
$$ = binary.NewLogicalOr($1, $3)
+
+ // save position
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3))
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.LogicalOrToken)
}
| expr T_LOGICAL_AND expr
{
$$ = binary.NewLogicalAnd($1, $3)
+
+ // save position
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3))
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.LogicalAndToken)
}
| expr T_LOGICAL_XOR expr
{
$$ = binary.NewLogicalXor($1, $3)
+
+ // save position
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3))
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.LogicalXorToken)
}
| expr '|' expr
{
$$ = binary.NewBitwiseOr($1, $3)
+
+ // save position
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3))
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.VerticalBarToken)
}
| expr '&' expr
{
$$ = binary.NewBitwiseAnd($1, $3)
+
+ // save position
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3))
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.AmpersandToken)
}
| expr '^' expr
{
$$ = binary.NewBitwiseXor($1, $3)
+
+ // save position
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3))
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.CaretToken)
}
| expr '.' expr
{
$$ = binary.NewConcat($1, $3)
+
+ // save position
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3))
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.DotToken)
}
| expr '+' expr
{
$$ = binary.NewPlus($1, $3)
+
+ // save position
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3))
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.PlusToken)
}
| expr '-' expr
{
$$ = binary.NewMinus($1, $3)
+
+ // save position
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3))
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.MinusToken)
}
| expr '*' expr
{
$$ = binary.NewMul($1, $3)
+
+ // save position
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3))
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.AsteriskToken)
}
| expr T_POW expr
{
$$ = binary.NewPow($1, $3)
+
+ // save position
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3))
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.PowToken)
}
| expr '/' expr
{
$$ = binary.NewDiv($1, $3)
+
+ // save position
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3))
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.SlashToken)
}
| expr '%' expr
{
$$ = binary.NewMod($1, $3)
+
+ // save position
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3))
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.PercentToken)
}
| expr T_SL expr
{
$$ = binary.NewShiftLeft($1, $3)
+
+ // save position
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3))
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.SlToken)
}
| expr T_SR expr
{
$$ = binary.NewShiftRight($1, $3)
+
+ // save position
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3))
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.SrToken)
}
| '+' expr %prec T_INC
{
$$ = expr.NewUnaryPlus($2)
+
+ // save position
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $2))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.PlusToken)
}
| '-' expr %prec T_INC
{
$$ = expr.NewUnaryMinus($2)
+
+ // save position
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $2))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.MinusToken)
}
| '!' expr
{
$$ = expr.NewBooleanNot($2)
+
+ // save position
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $2))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.ExclamationMarkToken)
}
| '~' expr
{
$$ = expr.NewBitwiseNot($2)
+
+ // save position
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $2))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.TildeToken)
}
| expr T_IS_IDENTICAL expr
{
$$ = binary.NewIdentical($1, $3)
+
+ // save position
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3))
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.IsIdenticalToken)
}
| expr T_IS_NOT_IDENTICAL expr
{
$$ = binary.NewNotIdentical($1, $3)
+
+ // save position
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3))
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.IsNotIdenticalToken)
}
| expr T_IS_EQUAL expr
{
$$ = binary.NewEqual($1, $3)
+
+ // save position
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3))
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.IsEqualToken)
}
| expr T_IS_NOT_EQUAL expr
{
$$ = binary.NewNotEqual($1, $3)
+
+ // save position
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3))
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.IsNotEqualToken)
}
| expr '<' expr
{
$$ = binary.NewSmaller($1, $3)
+
+ // save position
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3))
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.LessToken)
}
| expr T_IS_SMALLER_OR_EQUAL expr
{
$$ = binary.NewSmallerOrEqual($1, $3)
+
+ // save position
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3))
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.IsSmallerOrEqualToken)
}
| expr '>' expr
{
$$ = binary.NewGreater($1, $3)
+
+ // save position
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3))
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.GreaterToken)
}
| expr T_IS_GREATER_OR_EQUAL expr
{
$$ = binary.NewGreaterOrEqual($1, $3)
+
+ // save position
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3))
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.IsGreaterOrEqualToken)
}
| expr T_INSTANCEOF class_name_reference
{
$$ = expr.NewInstanceOf($1, $3)
+
+ // save position
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3))
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.InstanceofToken)
}
| parenthesis_expr
{ $$ = $1 }
@@ -2197,95 +3179,156 @@ expr_without_variable:
switch nn := n.(type) {
case *expr.ArrayDimFetch:
nn.Variable = $$
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($$, nn))
- yylex.(*Parser).comments.AddComments(nn, $1.Comments())
$$ = nn
case *expr.PropertyFetch:
nn.Variable = $$
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($$, nn))
- yylex.(*Parser).comments.AddComments(nn, $1.Comments())
$$ = nn
case *expr.MethodCall:
nn.Variable = $$
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($$, nn))
- yylex.(*Parser).comments.AddComments(nn, $1.Comments())
$$ = nn
}
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($$, n))
}
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.OpenParenthesisToken)
+ yylex.(*Parser).comments.AddFromToken($$, $3, comment.CloseParenthesisToken)
}
| expr '?' expr ':' expr
{
$$ = expr.NewTernary($1, $3, $5)
+
+ // save position
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $5))
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.QuestionMarkToken)
+ yylex.(*Parser).comments.AddFromToken($$, $4, comment.ColonToken)
}
| expr '?' ':' expr
{
$$ = expr.NewTernary($1, nil, $4)
+
+ // save position
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $4))
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.QuestionMarkToken)
+ yylex.(*Parser).comments.AddFromToken($$, $3, comment.ColonToken)
}
| internal_functions_in_yacc
{ $$ = $1 }
| T_INT_CAST expr
{
$$ = cast.NewInt($2)
+
+ // save position
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $2))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.IntCastToken)
}
| T_DOUBLE_CAST expr
{
$$ = cast.NewDouble($2)
+
+ // save position
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $2))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.DoubleCastToken)
}
| T_STRING_CAST expr
{
$$ = cast.NewString($2)
+
+ // save position
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $2))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.StringCastToken)
}
| T_ARRAY_CAST expr
{
$$ = cast.NewArray($2)
+
+ // save position
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $2))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.ArrayCastToken)
}
| T_OBJECT_CAST expr
{
$$ = cast.NewObject($2)
+
+ // save position
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $2))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.ObjectCastToken)
}
| T_BOOL_CAST expr
{
$$ = cast.NewBool($2)
+
+ // save position
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $2))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.BoolCastToken)
}
| T_UNSET_CAST expr
{
$$ = cast.NewUnset($2)
+
+ // save position
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $2))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.UnsetCastToken)
}
| T_EXIT exit_expr
{
if (strings.EqualFold($1.Value, "die")) {
- $$ = expr.NewDie($2)
+ $$ = expr.NewDie(nil)
+ if $2 != nil {
+ $$.(*expr.Die).Expr = $2.(*expr.Exit).Expr
+ }
} else {
- $$ = expr.NewExit($2)
+ $$ = expr.NewExit(nil)
+ if $2 != nil {
+ $$.(*expr.Exit).Expr = $2.(*expr.Exit).Expr
+ }
+ }
+
+ // save position
+ if $2 == nil {
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
+ } else {
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $2))
+ }
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.ExitToken)
+
+ if $2 != nil {
+ yylex.(*Parser).comments.AddFromChildNode($$, $2)
}
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $2))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
}
| '@' expr
{
$$ = expr.NewErrorSuppress($2)
+
+ // save position
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $2))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.AtToken)
}
| scalar
{ $$ = $1 }
@@ -2296,34 +3339,68 @@ expr_without_variable:
| '`' backticks_expr '`'
{
$$ = expr.NewShellExec($2)
+
+ // save position
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $3))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.BackquoteToken)
+ yylex.(*Parser).comments.AddFromToken($$, $3, comment.BackquoteToken)
}
| T_PRINT expr
{
$$ = expr.NewPrint($2)
+
+ // save position
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $2))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.PrintToken)
}
| T_YIELD
{
$$ = expr.NewYield(nil, nil)
+
+ // save position
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.YieldToken)
}
| function is_reference '(' parameter_list ')' lexical_vars '{' inner_statement_list '}'
{
- $$ = expr.NewClosure($4, $6, nil, $8, false, $2.value, "")
+ $$ = expr.NewClosure($4, $6, nil, $8, false, $2 != nil, "")
+
+ // save position
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $9))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.FunctionToken)
+ if $2 != nil {
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.AmpersandToken)
+ }
+ yylex.(*Parser).comments.AddFromToken($$, $3, comment.OpenParenthesisToken)
+ yylex.(*Parser).comments.AddFromToken($$, $5, comment.CloseParenthesisToken)
+ yylex.(*Parser).comments.AddFromToken($$, $7, comment.OpenCurlyBracesToken)
+ yylex.(*Parser).comments.AddFromToken($$, $9, comment.CloseCurlyBracesToken)
}
| T_STATIC function is_reference '(' parameter_list ')' lexical_vars '{' inner_statement_list '}'
{
- $$ = expr.NewClosure($5, $7, nil, $9, true, $3.value, "")
+ $$ = expr.NewClosure($5, $7, nil, $9, true, $3 != nil, "")
+
+ // save position
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $10))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.StaticToken)
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.FunctionToken)
+ if $3 != nil {
+ yylex.(*Parser).comments.AddFromToken($$, $3, comment.AmpersandToken)
+ }
+ yylex.(*Parser).comments.AddFromToken($$, $4, comment.OpenParenthesisToken)
+ yylex.(*Parser).comments.AddFromToken($$, $6, comment.CloseParenthesisToken)
+ yylex.(*Parser).comments.AddFromToken($$, $8, comment.OpenCurlyBracesToken)
+ yylex.(*Parser).comments.AddFromToken($$, $10, comment.CloseCurlyBracesToken)
}
;
@@ -2331,26 +3408,44 @@ yield_expr:
T_YIELD expr_without_variable
{
$$ = expr.NewYield(nil, $2)
+
+ // save position
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $2))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.YieldToken)
}
| T_YIELD variable
{
$$ = expr.NewYield(nil, $2)
+
+ // save position
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $2))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.YieldToken)
}
| T_YIELD expr T_DOUBLE_ARROW expr_without_variable
{
$$ = expr.NewYield($2, $4)
+
+ // save position
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $4))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.YieldToken)
+ yylex.(*Parser).comments.AddFromToken($$, $3, comment.DoubleArrowToken)
}
| T_YIELD expr T_DOUBLE_ARROW variable
{
$$ = expr.NewYield($2, $4)
+
+ // save position
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $4))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.YieldToken)
+ yylex.(*Parser).comments.AddFromToken($$, $3, comment.DoubleArrowToken)
}
;
@@ -2358,30 +3453,48 @@ combined_scalar_offset:
combined_scalar '[' dim_offset ']'
{
$$ = expr.NewArrayDimFetch($1, $3)
+
+ // save position
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodeTokenPosition($1, $4))
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.OpenSquareBracket)
+ yylex.(*Parser).comments.AddFromToken($$, $4, comment.CloseSquareBracket)
}
| combined_scalar_offset '[' dim_offset ']'
{
$$ = expr.NewArrayDimFetch($1, $3)
+
+ // save position
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodeTokenPosition($1, $4))
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.OpenSquareBracket)
+ yylex.(*Parser).comments.AddFromToken($$, $4, comment.CloseSquareBracket)
}
| T_CONSTANT_ENCAPSED_STRING '[' dim_offset ']'
{
str := scalar.NewString($1.Value)
- yylex.(*Parser).positions.AddPosition(str, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
- yylex.(*Parser).comments.AddComments(str, $1.Comments())
-
$$ = expr.NewArrayDimFetch(str, $3)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(str, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodeTokenPosition(str, $4))
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[str])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.OpenSquareBracket)
+ yylex.(*Parser).comments.AddFromToken($$, $4, comment.CloseSquareBracket)
}
| general_constant '[' dim_offset ']'
{
$$ = expr.NewArrayDimFetch($1, $3)
+
+ // save position
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodeTokenPosition($1, $4))
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.OpenSquareBracket)
+ yylex.(*Parser).comments.AddFromToken($$, $4, comment.CloseSquareBracket)
}
;
@@ -2389,14 +3502,25 @@ combined_scalar:
T_ARRAY '(' array_pair_list ')'
{
$$ = expr.NewArray($3)
+
+ // save position
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $4))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.ArrayToken)
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.OpenParenthesisToken)
+ yylex.(*Parser).comments.AddFromToken($$, $4, comment.CloseParenthesisToken)
}
| '[' array_pair_list ']'
{
$$ = expr.NewShortArray($2)
+
+ // save position
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $3))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.OpenSquareBracket)
+ yylex.(*Parser).comments.AddFromToken($$, $3, comment.CloseSquareBracket)
}
;
@@ -2407,75 +3531,74 @@ function:
lexical_vars:
/* empty */
- { $$ = []node.Node{} }
+ { $$ = nil }
| T_USE '(' lexical_var_list ')'
- { $$ = $3; }
+ {
+ $$ = expr.NewClosureUse($3)
+
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $4))
+ }
;
lexical_var_list:
lexical_var_list ',' T_VARIABLE
{
identifier := node.NewIdentifier(strings.TrimLeft($3.Value, "$"))
- yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition($3))
- yylex.(*Parser).comments.AddComments(identifier, $3.Comments())
-
variable := expr.NewVariable(identifier)
+ $$ = append($1, variable)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition($3))
yylex.(*Parser).positions.AddPosition(variable, yylex.(*Parser).positionBuilder.NewTokenPosition($3))
- yylex.(*Parser).comments.AddComments(variable, $3.Comments())
-
- use := expr.NewClosureUse(variable, false)
- yylex.(*Parser).positions.AddPosition(use, yylex.(*Parser).positionBuilder.NewTokenPosition($3))
- yylex.(*Parser).comments.AddComments(use, $3.Comments())
-
- $$ = append($1, use)
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(lastNode($1), $2, comment.CommaToken)
+ yylex.(*Parser).comments.AddFromToken(variable, $3, comment.VariableToken)
}
| lexical_var_list ',' '&' T_VARIABLE
{
identifier := node.NewIdentifier(strings.TrimLeft($4.Value, "$"))
- yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition($4))
- yylex.(*Parser).comments.AddComments(identifier, $4.Comments())
-
variable := expr.NewVariable(identifier)
+ reference := expr.NewReference(variable)
+ $$ = append($1, reference)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition($4))
yylex.(*Parser).positions.AddPosition(variable, yylex.(*Parser).positionBuilder.NewTokenPosition($4))
- yylex.(*Parser).comments.AddComments(variable, $3.Comments())
- use := expr.NewClosureUse(variable, true)
- yylex.(*Parser).positions.AddPosition(use, yylex.(*Parser).positionBuilder.NewTokensPosition($3, $4))
- yylex.(*Parser).comments.AddComments(use, $3.Comments())
-
- $$ = append($1, use)
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(lastNode($1), $2, comment.CommaToken)
+ yylex.(*Parser).comments.AddFromToken(reference, $3, comment.VariableToken)
+ yylex.(*Parser).comments.AddFromToken(variable, $4, comment.VariableToken)
}
| T_VARIABLE
{
identifier := node.NewIdentifier(strings.TrimLeft($1.Value, "$"))
- yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
- yylex.(*Parser).comments.AddComments(identifier, $1.Comments())
-
variable := expr.NewVariable(identifier)
+ $$ = []node.Node{variable}
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
yylex.(*Parser).positions.AddPosition(variable, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
- yylex.(*Parser).comments.AddComments(variable, $1.Comments())
-
- use := expr.NewClosureUse(variable, false)
- yylex.(*Parser).positions.AddPosition(use, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
- yylex.(*Parser).comments.AddComments(use, $1.Comments())
-
- $$ = []node.Node{use}
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(variable, $1, comment.VariableToken)
}
| '&' T_VARIABLE
{
identifier := node.NewIdentifier(strings.TrimLeft($2.Value, "$"))
- yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition($2))
- yylex.(*Parser).comments.AddComments(identifier, $2.Comments())
-
variable := expr.NewVariable(identifier)
+ reference := expr.NewReference(variable)
+ $$ = []node.Node{reference}
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition($2))
yylex.(*Parser).positions.AddPosition(variable, yylex.(*Parser).positionBuilder.NewTokenPosition($2))
- yylex.(*Parser).comments.AddComments(variable, $1.Comments())
-
- use := expr.NewClosureUse(variable, true)
- yylex.(*Parser).positions.AddPosition(use, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $2))
- yylex.(*Parser).comments.AddComments(use, $1.Comments())
-
- $$ = []node.Node{use}
+ yylex.(*Parser).positions.AddPosition(reference, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $2))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(reference, $1, comment.VariableToken)
+ yylex.(*Parser).comments.AddFromToken(variable, $2, comment.VariableToken)
}
;
@@ -2483,62 +3606,83 @@ function_call:
namespace_name function_call_parameter_list
{
name := name.NewName($1)
+ $$ = expr.NewFunctionCall(name, $2.(*node.ArgumentList))
+
+ // save position
yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewNodeListPosition($1))
- yylex.(*Parser).comments.AddComments(name, yylex.(*Parser).listGetFirstNodeComments($1))
-
- $$ = expr.NewFunctionCall(name, $2.nodes)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodeTokenPosition(name, $2.endToken))
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[name])
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition(name, $2))
}
| T_NAMESPACE T_NS_SEPARATOR namespace_name function_call_parameter_list
{
funcName := name.NewRelative($3)
+ $$ = expr.NewFunctionCall(funcName, $4.(*node.ArgumentList))
+
+ // save position
yylex.(*Parser).positions.AddPosition(funcName, yylex.(*Parser).positionBuilder.NewTokenNodeListPosition($1, $3))
- yylex.(*Parser).comments.AddComments(funcName, $1.Comments())
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition(funcName, $4))
- $$ = expr.NewFunctionCall(funcName, $4.nodes)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodeTokenPosition(funcName, $4.endToken))
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[funcName])
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(funcName, $1, comment.NamespaceToken)
+ yylex.(*Parser).comments.AddFromToken(funcName, $2, comment.NsSeparatorToken)
}
| T_NS_SEPARATOR namespace_name function_call_parameter_list
{
funcName := name.NewFullyQualified($2)
+ $$ = expr.NewFunctionCall(funcName, $3.(*node.ArgumentList))
+
+ // save position
yylex.(*Parser).positions.AddPosition(funcName, yylex.(*Parser).positionBuilder.NewTokenNodeListPosition($1, $2))
- yylex.(*Parser).comments.AddComments(funcName, $1.Comments())
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition(funcName, $3))
- $$ = expr.NewFunctionCall(funcName, $3.nodes)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodeTokenPosition(funcName, $3.endToken))
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[funcName])
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(funcName, $1, comment.NsSeparatorToken)
}
| class_name T_PAAMAYIM_NEKUDOTAYIM variable_name function_call_parameter_list
{
- $$ = expr.NewStaticCall($1, $3, $4.nodes)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodeTokenPosition($1, $4.endToken))
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1])
+ $$ = expr.NewStaticCall($1, $3, $4.(*node.ArgumentList))
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $4))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.PaamayimNekudotayimToken)
}
| class_name T_PAAMAYIM_NEKUDOTAYIM variable_without_objects function_call_parameter_list
{
- $$ = expr.NewStaticCall($1, $3, $4.nodes)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodeTokenPosition($1, $4.endToken))
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1])
+ $$ = expr.NewStaticCall($1, $3, $4.(*node.ArgumentList))
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $4))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.PaamayimNekudotayimToken)
}
| variable_class_name T_PAAMAYIM_NEKUDOTAYIM variable_name function_call_parameter_list
{
- $$ = expr.NewStaticCall($1, $3, $4.nodes)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodeTokenPosition($1, $4.endToken))
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1])
+ $$ = expr.NewStaticCall($1, $3, $4.(*node.ArgumentList))
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $4))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.PaamayimNekudotayimToken)
}
| variable_class_name T_PAAMAYIM_NEKUDOTAYIM variable_without_objects function_call_parameter_list
{
- $$ = expr.NewStaticCall($1, $3, $4.nodes)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodeTokenPosition($1, $4.endToken))
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1])
+ $$ = expr.NewStaticCall($1, $3, $4.(*node.ArgumentList))
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $4))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.PaamayimNekudotayimToken)
}
| variable_without_objects function_call_parameter_list
{
- $$ = expr.NewFunctionCall($1, $2.nodes)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodeTokenPosition($1, $2.endToken))
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1])
+ $$ = expr.NewFunctionCall($1, $2.(*node.ArgumentList))
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $2))
}
;
@@ -2546,26 +3690,40 @@ class_name:
T_STATIC
{
$$ = node.NewIdentifier($1.Value)
+
+ // save position
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.StaticToken)
}
| namespace_name
{
$$ = name.NewName($1)
+
+ // save position
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodeListPosition($1))
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).listGetFirstNodeComments($1))
}
| T_NAMESPACE T_NS_SEPARATOR namespace_name
{
$$ = name.NewRelative($3)
+
+ // save position
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodeListPosition($1, $3))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.NamespaceToken)
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.NsSeparatorToken)
}
| T_NS_SEPARATOR namespace_name
{
$$ = name.NewFullyQualified($2)
+
+ // save position
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodeListPosition($1, $2))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.NsSeparatorToken)
}
;
@@ -2573,20 +3731,30 @@ fully_qualified_class_name:
namespace_name
{
$$ = name.NewName($1)
+
+ // save position
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodeListPosition($1))
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).listGetFirstNodeComments($1))
}
| T_NAMESPACE T_NS_SEPARATOR namespace_name
{
$$ = name.NewRelative($3)
+
+ // save position
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodeListPosition($1, $3))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.NamespaceToken)
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.NsSeparatorToken)
}
| T_NS_SEPARATOR namespace_name
{
$$ = name.NewFullyQualified($2)
+
+ // save position
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodeListPosition($1, $2))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.NsSeparatorToken)
}
;
@@ -2602,18 +3770,19 @@ dynamic_class_name_reference:
{
$$ = $1
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($3[0], $2, comment.ObjectOperatorToken)
+
for _, n := range($3) {
switch nn := n.(type) {
case *expr.ArrayDimFetch:
nn.Variable = $$
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($$, nn))
- yylex.(*Parser).comments.AddComments(nn, yylex.(*Parser).comments[$1])
$$ = nn
case *expr.PropertyFetch:
nn.Variable = $$
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($$, nn))
- yylex.(*Parser).comments.AddComments(nn, yylex.(*Parser).comments[$1])
$$ = nn
}
}
@@ -2623,13 +3792,11 @@ dynamic_class_name_reference:
case *expr.ArrayDimFetch:
nn.Variable = $$
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($$, nn))
- yylex.(*Parser).comments.AddComments(nn, yylex.(*Parser).comments[$1])
$$ = nn
case *expr.PropertyFetch:
nn.Variable = $$
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($$, nn))
- yylex.(*Parser).comments.AddComments(nn, yylex.(*Parser).comments[$1])
$$ = nn
}
}
@@ -2649,16 +3816,35 @@ dynamic_class_name_variable_properties:
dynamic_class_name_variable_property:
T_OBJECT_OPERATOR object_property
- { $$ = $2 }
+ {
+ $$ = $2
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($2[0], $1, comment.ObjectOperatorToken)
+ }
;
exit_expr:
/* empty */
{ $$ = nil }
| '(' ')'
- { $$ = nil }
+ {
+ $$ = expr.NewExit(nil);
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $2))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.OpenParenthesisToken)
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.CloseParenthesisToken)
+ }
| parenthesis_expr
- { $$ = $1 }
+ {
+ $$ = expr.NewExit($1);
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodePosition($1))
+ }
;
backticks_expr:
@@ -2681,78 +3867,124 @@ common_scalar:
T_LNUMBER
{
$$ = scalar.NewLnumber($1.Value)
+
+ // save position
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.LnumberToken)
}
| T_DNUMBER
{
$$ = scalar.NewDnumber($1.Value)
+
+ // save position
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.DnumberToken)
}
| T_CONSTANT_ENCAPSED_STRING
{
$$ = scalar.NewString($1.Value)
+
+ // save position
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.ConstantEncapsedStringToken)
}
| T_LINE
{
$$ = scalar.NewMagicConstant($1.Value)
+
+ // save position
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.LineToken)
}
| T_FILE
{
$$ = scalar.NewMagicConstant($1.Value)
+
+ // save position
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.FileToken)
}
| T_DIR
{
$$ = scalar.NewMagicConstant($1.Value)
+
+ // save position
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.DirToken)
}
| T_TRAIT_C
{
$$ = scalar.NewMagicConstant($1.Value)
+
+ // save position
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.TraitCToken)
}
| T_METHOD_C
{
$$ = scalar.NewMagicConstant($1.Value)
+
+ // save position
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.MethodCToken)
}
| T_FUNC_C
{
$$ = scalar.NewMagicConstant($1.Value)
+
+ // save position
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.FuncCToken)
}
| T_NS_C
{
$$ = scalar.NewMagicConstant($1.Value)
+
+ // save position
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.NsCToken)
}
- | T_START_HEREDOC T_ENCAPSED_AND_WHITESPACE T_END_HEREDOC
+ | T_START_HEREDOC T_ENCAPSED_AND_WHITESPACE T_END_HEREDOC
{
encapsed := scalar.NewEncapsedStringPart($2.Value)
- yylex.(*Parser).positions.AddPosition(encapsed, yylex.(*Parser).positionBuilder.NewTokenPosition($2))
- yylex.(*Parser).comments.AddComments(encapsed, $2.Comments())
-
$$ = scalar.NewHeredoc($1.Value, []node.Node{encapsed})
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(encapsed, yylex.(*Parser).positionBuilder.NewTokenPosition($2))
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $3))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.StartHeredocToken)
}
| T_START_HEREDOC T_END_HEREDOC
{
$$ = scalar.NewHeredoc($1.Value, nil)
+
+ // save position
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $2))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.StartHeredocToken)
}
;
@@ -2760,12 +3992,15 @@ static_class_constant:
class_name T_PAAMAYIM_NEKUDOTAYIM T_STRING
{
target := node.NewIdentifier($3.Value)
- yylex.(*Parser).positions.AddPosition(target, yylex.(*Parser).positionBuilder.NewTokenPosition($3))
$$ = expr.NewClassConstFetch($1, target)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(target, yylex.(*Parser).positionBuilder.NewTokenPosition($3))
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodeTokenPosition($1, $3))
- yylex.(*Parser).comments.AddComments(target, $3.Comments())
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1])
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.PaamayimNekudotayimToken)
+ yylex.(*Parser).comments.AddFromToken(target, $3, comment.IdentifierToken)
}
;
@@ -2782,52 +4017,71 @@ static_scalar_value:
| namespace_name
{
name := name.NewName($1)
- yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewNodeListPosition($1))
- yylex.(*Parser).comments.AddComments(name, yylex.(*Parser).listGetFirstNodeComments($1))
-
$$ = expr.NewConstFetch(name)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewNodeListPosition($1))
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodePosition(name))
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[name])
}
| T_NAMESPACE T_NS_SEPARATOR namespace_name
{
name := name.NewRelative($3)
- yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewTokenNodeListPosition($1, $3))
- yylex.(*Parser).comments.AddComments(name, $1.Comments())
-
$$ = expr.NewConstFetch(name)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewTokenNodeListPosition($1, $3))
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodeListPosition($1, $3))
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[name])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.NamespaceToken)
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.NsSeparatorToken)
}
| T_NS_SEPARATOR namespace_name
{
name := name.NewFullyQualified($2)
- yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewTokenNodeListPosition($1, $2))
- yylex.(*Parser).comments.AddComments(name, $1.Comments())
-
$$ = expr.NewConstFetch(name)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewTokenNodeListPosition($1, $2))
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodeListPosition($1, $2))
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[name])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.NsSeparatorToken)
}
| T_ARRAY '(' static_array_pair_list ')'
{
$$ = expr.NewArray($3)
+
+ // save position
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $4))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.ArrayToken)
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.OpenParenthesisToken)
+ yylex.(*Parser).comments.AddFromToken($$, $4, comment.CloseParenthesisToken)
}
| '[' static_array_pair_list ']'
{
$$ = expr.NewShortArray($2)
+
+ // save position
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $3))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.OpenSquareBracket)
+ yylex.(*Parser).comments.AddFromToken($$, $3, comment.CloseSquareBracket)
}
| static_class_constant
{ $$ = $1 }
| T_CLASS_C
{
$$ = scalar.NewMagicConstant($1.Value)
+
+ // save position
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.ClassCToken)
}
| static_operation
{ $$ = $1 }
@@ -2837,197 +4091,334 @@ static_operation:
static_scalar_value '[' static_scalar_value ']'
{
$$ = expr.NewArrayDimFetch($1, $3)
+
+ // save position
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodeTokenPosition($1, $4))
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.OpenSquareBracket)
+ yylex.(*Parser).comments.AddFromToken($$, $4, comment.CloseSquareBracket)
}
| static_scalar_value '+' static_scalar_value
{
$$ = binary.NewPlus($1, $3)
+
+ // save position
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3))
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.PlusToken)
}
| static_scalar_value '-' static_scalar_value
{
$$ = binary.NewMinus($1, $3)
+
+ // save position
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3))
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.MinusToken)
}
| static_scalar_value '*' static_scalar_value
{
$$ = binary.NewMul($1, $3)
+
+ // save position
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3))
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.AsteriskToken)
}
| static_scalar_value T_POW static_scalar_value
{
$$ = binary.NewPow($1, $3)
+
+ // save position
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3))
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.PowToken)
}
| static_scalar_value '/' static_scalar_value
{
$$ = binary.NewDiv($1, $3)
+
+ // save position
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3))
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.SlashToken)
}
| static_scalar_value '%' static_scalar_value
{
$$ = binary.NewMod($1, $3)
+
+ // save position
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3))
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.PercentToken)
}
| '!' static_scalar_value
{
$$ = expr.NewBooleanNot($2)
+
+ // save position
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $2))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.ExclamationMarkToken)
}
| '~' static_scalar_value
{
$$ = expr.NewBitwiseNot($2)
+
+ // save position
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $2))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.TildeToken)
}
| static_scalar_value '|' static_scalar_value
{
$$ = binary.NewBitwiseOr($1, $3)
+
+ // save position
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3))
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.VerticalBarToken)
}
| static_scalar_value '&' static_scalar_value
{
$$ = binary.NewBitwiseAnd($1, $3)
+
+ // save position
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3))
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.AmpersandToken)
}
| static_scalar_value '^' static_scalar_value
{
$$ = binary.NewBitwiseXor($1, $3)
+
+ // save position
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3))
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.CaretToken)
}
| static_scalar_value T_SL static_scalar_value
{
$$ = binary.NewShiftLeft($1, $3)
+
+ // save position
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3))
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.SlToken)
}
| static_scalar_value T_SR static_scalar_value
{
$$ = binary.NewShiftRight($1, $3)
+
+ // save position
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3))
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.SrToken)
}
| static_scalar_value '.' static_scalar_value
{
$$ = binary.NewConcat($1, $3)
+
+ // save position
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3))
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.DotToken)
}
| static_scalar_value T_LOGICAL_XOR static_scalar_value
{
$$ = binary.NewLogicalXor($1, $3)
+
+ // save position
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3))
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.LogicalXorToken)
}
| static_scalar_value T_LOGICAL_AND static_scalar_value
{
$$ = binary.NewLogicalAnd($1, $3)
+
+ // save position
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3))
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.LogicalAndToken)
}
| static_scalar_value T_LOGICAL_OR static_scalar_value
{
$$ = binary.NewLogicalOr($1, $3)
+
+ // save position
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3))
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.LogicalOrToken)
}
| static_scalar_value T_BOOLEAN_AND static_scalar_value
{
$$ = binary.NewBooleanAnd($1, $3)
+
+ // save position
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3))
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.BooleanAndToken)
}
| static_scalar_value T_BOOLEAN_OR static_scalar_value
{
$$ = binary.NewBooleanOr($1, $3)
+
+ // save position
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3))
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.BooleanOrToken)
}
| static_scalar_value T_IS_IDENTICAL static_scalar_value
{
$$ = binary.NewIdentical($1, $3)
+
+ // save position
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3))
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.IsIdenticalToken)
}
| static_scalar_value T_IS_NOT_IDENTICAL static_scalar_value
{
$$ = binary.NewNotIdentical($1, $3)
+
+ // save position
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3))
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.IsNotIdenticalToken)
}
| static_scalar_value T_IS_EQUAL static_scalar_value
{
$$ = binary.NewEqual($1, $3)
+
+ // save position
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3))
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.IsEqualToken)
}
| static_scalar_value T_IS_NOT_EQUAL static_scalar_value
{
$$ = binary.NewNotEqual($1, $3)
+
+ // save position
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3))
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.IsNotEqualToken)
}
| static_scalar_value '<' static_scalar_value
{
$$ = binary.NewSmaller($1, $3)
+
+ // save position
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3))
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.LessToken)
}
| static_scalar_value '>' static_scalar_value
{
$$ = binary.NewGreater($1, $3)
+
+ // save position
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3))
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.GreaterToken)
}
| static_scalar_value T_IS_SMALLER_OR_EQUAL static_scalar_value
{
$$ = binary.NewSmallerOrEqual($1, $3)
+
+ // save position
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3))
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.IsSmallerOrEqualToken)
}
| static_scalar_value T_IS_GREATER_OR_EQUAL static_scalar_value
{
$$ = binary.NewGreaterOrEqual($1, $3)
+
+ // save position
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3))
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.IsGreaterOrEqualToken)
}
| static_scalar_value '?' ':' static_scalar_value
{
$$ = expr.NewTernary($1, nil, $4)
+
+ // save position
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $4))
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.QuestionMarkToken)
+ yylex.(*Parser).comments.AddFromToken($$, $3, comment.ColonToken)
}
| static_scalar_value '?' static_scalar_value ':' static_scalar_value
{
$$ = expr.NewTernary($1, $3, $5)
+
+ // save position
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $5))
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.QuestionMarkToken)
+ yylex.(*Parser).comments.AddFromToken($$, $4, comment.ColonToken)
}
| '+' static_scalar_value
{
$$ = expr.NewUnaryPlus($2)
+
+ // save position
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $2))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.PlusToken)
}
| '-' static_scalar_value
{
$$ = expr.NewUnaryMinus($2)
+
+ // save position
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $2))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.MinusToken)
}
| '(' static_scalar_value ')'
- { $$ = $2 }
+ {
+ $$ = $2
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.OpenParenthesisToken)
+ yylex.(*Parser).comments.AddFromToken($$, $3, comment.CloseParenthesisToken)
+ }
;
general_constant:
@@ -3036,32 +4427,34 @@ general_constant:
| namespace_name
{
name := name.NewName($1)
- yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewNodeListPosition($1))
- yylex.(*Parser).comments.AddComments(name, yylex.(*Parser).listGetFirstNodeComments($1))
-
$$ = expr.NewConstFetch(name)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewNodeListPosition($1))
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodePosition(name))
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[name])
}
| T_NAMESPACE T_NS_SEPARATOR namespace_name
{
name := name.NewRelative($3)
- yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewTokenNodeListPosition($1, $3))
- yylex.(*Parser).comments.AddComments(name, $1.Comments())
-
$$ = expr.NewConstFetch(name)
+ yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewTokenNodeListPosition($1, $3))
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodePosition(name))
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[name])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.NamespaceToken)
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.NsSeparatorToken)
}
| T_NS_SEPARATOR namespace_name
{
name := name.NewFullyQualified($2)
- yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewTokenNodeListPosition($1, $2))
- yylex.(*Parser).comments.AddComments(name, $1.Comments())
-
$$ = expr.NewConstFetch(name)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewTokenNodeListPosition($1, $2))
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodePosition(name))
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[name])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.NsSeparatorToken)
}
;
@@ -3069,12 +4462,14 @@ scalar:
T_STRING_VARNAME
{
name := node.NewIdentifier($1.Value)
- yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
$$ = expr.NewVariable(name)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
- yylex.(*Parser).comments.AddComments(name, $1.Comments())
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(name, $1, comment.StringVarnameToken)
}
| general_constant
{ $$ = $1 }
@@ -3085,20 +4480,32 @@ scalar:
| '"' encaps_list '"'
{
$$ = scalar.NewEncapsed($2)
+
+ // save position
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $3))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.DoubleQuoteToken)
}
| T_START_HEREDOC encaps_list T_END_HEREDOC
{
$$ = scalar.NewHeredoc($1.Value, $2)
+
+ // save position
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $3))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.StartHeredocToken)
}
| T_CLASS_C
{
$$ = scalar.NewMagicConstant($1.Value)
+
+ // save position
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.ClassCToken)
}
;
@@ -3106,46 +4513,65 @@ static_array_pair_list:
/* empty */
{ $$ = nil }
| non_empty_static_array_pair_list possible_comma
- { $$ = $1 }
+ {
+ $$ = $1
+
+ // save comments
+ if $2 != nil {
+ yylex.(*Parser).comments.AddFromToken(lastNode($1), $2, comment.CommaToken)
+ }
+ }
;
possible_comma:
/* empty */
+ { $$ = nil }
| ','
+ { $$ = $1 }
;
non_empty_static_array_pair_list:
non_empty_static_array_pair_list ',' static_scalar_value T_DOUBLE_ARROW static_scalar_value
{
- arrayItem := expr.NewArrayItem($3, $5, false)
- yylex.(*Parser).positions.AddPosition(arrayItem, yylex.(*Parser).positionBuilder.NewNodesPosition($3, $5))
- yylex.(*Parser).comments.AddComments(arrayItem, yylex.(*Parser).comments[$3])
-
+ arrayItem := expr.NewArrayItem($3, $5)
$$ = append($1, arrayItem)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(arrayItem, yylex.(*Parser).positionBuilder.NewNodesPosition($3, $5))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(lastNode($1), $2, comment.CommaToken)
+ yylex.(*Parser).comments.AddFromToken(arrayItem, $4, comment.DoubleArrowToken)
}
| non_empty_static_array_pair_list ',' static_scalar_value
{
- arrayItem := expr.NewArrayItem(nil, $3, false)
- yylex.(*Parser).positions.AddPosition(arrayItem, yylex.(*Parser).positionBuilder.NewNodePosition($3))
- yylex.(*Parser).comments.AddComments(arrayItem, yylex.(*Parser).comments[$3])
-
+ arrayItem := expr.NewArrayItem(nil, $3)
$$ = append($1, arrayItem)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(arrayItem, yylex.(*Parser).positionBuilder.NewNodePosition($3))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(lastNode($1), $2, comment.CommaToken)
}
| static_scalar_value T_DOUBLE_ARROW static_scalar_value
{
- arrayItem := expr.NewArrayItem($1, $3, false)
- yylex.(*Parser).positions.AddPosition(arrayItem, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3))
- yylex.(*Parser).comments.AddComments(arrayItem, yylex.(*Parser).comments[$1])
-
+ arrayItem := expr.NewArrayItem($1, $3)
$$ = []node.Node{arrayItem}
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(arrayItem, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(arrayItem, $2, comment.DoubleArrowToken)
}
| static_scalar_value
{
- arrayItem := expr.NewArrayItem(nil, $1, false)
- yylex.(*Parser).positions.AddPosition(arrayItem, yylex.(*Parser).positionBuilder.NewNodePosition($1))
- yylex.(*Parser).comments.AddComments(arrayItem, yylex.(*Parser).comments[$1])
-
+ arrayItem := expr.NewArrayItem(nil, $1)
$$ = []node.Node{arrayItem}
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(arrayItem, yylex.(*Parser).positionBuilder.NewNodePosition($1))
}
;
@@ -3190,24 +4616,24 @@ variable:
$3 = append($3[:len($3)-1], $4...)
}
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($3[0], $2, comment.ObjectOperatorToken)
+
for _, n := range($3) {
switch nn := n.(type) {
case *expr.ArrayDimFetch:
nn.Variable = $$
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($$, nn))
- yylex.(*Parser).comments.AddComments(nn, yylex.(*Parser).comments[$1])
$$ = nn
case *expr.PropertyFetch:
nn.Variable = $$
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($$, nn))
- yylex.(*Parser).comments.AddComments(nn, yylex.(*Parser).comments[$1])
$$ = nn
case *expr.MethodCall:
nn.Variable = $$
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($$, nn))
- yylex.(*Parser).comments.AddComments(nn, yylex.(*Parser).comments[$1])
$$ = nn
}
}
@@ -3217,19 +4643,16 @@ variable:
case *expr.ArrayDimFetch:
nn.Variable = $$
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($$, nn))
- yylex.(*Parser).comments.AddComments(nn, yylex.(*Parser).comments[$1])
$$ = nn
case *expr.PropertyFetch:
nn.Variable = $$
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($$, nn))
- yylex.(*Parser).comments.AddComments(nn, yylex.(*Parser).comments[$1])
$$ = nn
case *expr.MethodCall:
nn.Variable = $$
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($$, nn))
- yylex.(*Parser).comments.AddComments(nn, yylex.(*Parser).comments[$1])
$$ = nn
}
}
@@ -3255,6 +4678,9 @@ variable_property:
}
$$ = $2
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($2[0], $1, comment.ObjectOperatorToken)
}
;
@@ -3262,24 +4688,36 @@ array_method_dereference:
array_method_dereference '[' dim_offset ']'
{
fetch := expr.NewArrayDimFetch(nil, $3)
+ $$ = append($1, fetch)
+
+ // save position
yylex.(*Parser).positions.AddPosition(fetch, yylex.(*Parser).positionBuilder.NewNodePosition($3))
- $$ = append($1, fetch)
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(fetch, $2, comment.OpenSquareBracket)
+ yylex.(*Parser).comments.AddFromToken(fetch, $4, comment.CloseSquareBracket)
}
| method '[' dim_offset ']'
{
fetch := expr.NewArrayDimFetch(nil, $3)
+ $$ = []node.Node{$1, fetch}
+
+ // save position
yylex.(*Parser).positions.AddPosition(fetch, yylex.(*Parser).positionBuilder.NewNodePosition($3))
- $$ = []node.Node{$1, fetch}
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(fetch, $2, comment.OpenSquareBracket)
+ yylex.(*Parser).comments.AddFromToken(fetch, $4, comment.CloseSquareBracket)
}
;
method:
function_call_parameter_list
{
- $$ = expr.NewMethodCall(nil, nil, $1.nodes)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodeListTokenPosition($1.nodes, $1.endToken))
+ $$ = expr.NewMethodCall(nil, nil, $1.(*node.ArgumentList))
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodePosition($1))
}
;
@@ -3311,14 +4749,22 @@ static_member:
class_name T_PAAMAYIM_NEKUDOTAYIM variable_without_objects
{
$$ = expr.NewStaticPropertyFetch($1, $3)
+
+ // save position
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3))
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.PaamayimNekudotayimToken)
}
| variable_class_name T_PAAMAYIM_NEKUDOTAYIM variable_without_objects
{
$$ = expr.NewStaticPropertyFetch($1, $3)
+
+ // save position
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3))
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.PaamayimNekudotayimToken)
}
;
@@ -3332,14 +4778,24 @@ array_function_dereference:
array_function_dereference '[' dim_offset ']'
{
$$ = expr.NewArrayDimFetch($1, $3)
+
+ // save position
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodeTokenPosition($1, $4))
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.OpenSquareBracket)
+ yylex.(*Parser).comments.AddFromToken($$, $4, comment.CloseSquareBracket)
}
| function_call '[' dim_offset ']'
{
$$ = expr.NewArrayDimFetch($1, $3)
+
+ // save position
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodeTokenPosition($1, $4))
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.OpenSquareBracket)
+ yylex.(*Parser).comments.AddFromToken($$, $4, comment.CloseSquareBracket)
}
;
@@ -3371,14 +4827,24 @@ reference_variable:
reference_variable '[' dim_offset ']'
{
$$ = expr.NewArrayDimFetch($1, $3)
+
+ // save position
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodeTokenPosition($1, $4))
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.OpenSquareBracket)
+ yylex.(*Parser).comments.AddFromToken($$, $4, comment.CloseSquareBracket)
}
| reference_variable '{' expr '}'
{
$$ = expr.NewArrayDimFetch($1, $3)
+
+ // save position
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodeTokenPosition($1, $4))
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.OpenCurlyBracesToken)
+ yylex.(*Parser).comments.AddFromToken($$, $4, comment.CloseCurlyBracesToken)
}
| compound_variable
{ $$ = $1 }
@@ -3389,18 +4855,26 @@ compound_variable:
T_VARIABLE
{
name := node.NewIdentifier(strings.TrimLeft($1.Value, "$"))
- yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
$$ = expr.NewVariable(name)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
- yylex.(*Parser).comments.AddComments(name, $1.Comments())
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.VariableToken)
}
| '$' '{' expr '}'
{
$$ = expr.NewVariable($3)
+
+ // save position
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $4))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.DollarToken)
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.OpenCurlyBracesToken)
+ yylex.(*Parser).comments.AddFromToken($$, $4, comment.CloseCurlyBracesToken)
}
;
@@ -3418,9 +4892,10 @@ object_property:
| variable_without_objects
{
fetch := expr.NewPropertyFetch(nil, $1)
- yylex.(*Parser).positions.AddPosition(fetch, yylex.(*Parser).positionBuilder.NewNodePosition($1))
-
$$ = []node.Node{fetch}
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(fetch, yylex.(*Parser).positionBuilder.NewNodePosition($1))
}
;
@@ -3428,23 +4903,34 @@ object_dim_list:
object_dim_list '[' dim_offset ']'
{
fetch := expr.NewArrayDimFetch(nil, $3)
+ $$ = append($1, fetch)
+
+ // save position
yylex.(*Parser).positions.AddPosition(fetch, yylex.(*Parser).positionBuilder.NewNodePosition($3))
- $$ = append($1, fetch)
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(fetch, $2, comment.OpenSquareBracket)
+ yylex.(*Parser).comments.AddFromToken(fetch, $4, comment.CloseSquareBracket)
}
| object_dim_list '{' expr '}'
{
fetch := expr.NewArrayDimFetch(nil, $3)
+ $$ = append($1, fetch)
+
+ // save position
yylex.(*Parser).positions.AddPosition(fetch, yylex.(*Parser).positionBuilder.NewNodePosition($3))
- $$ = append($1, fetch)
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(fetch, $2, comment.OpenCurlyBracesToken)
+ yylex.(*Parser).comments.AddFromToken(fetch, $4, comment.CloseCurlyBracesToken)
}
| variable_name
{
fetch := expr.NewPropertyFetch(nil, $1)
- yylex.(*Parser).positions.AddPosition(fetch, yylex.(*Parser).positionBuilder.NewNodePosition($1))
-
$$ = []node.Node{fetch}
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(fetch, yylex.(*Parser).positionBuilder.NewNodePosition($1))
}
;
@@ -3452,39 +4938,63 @@ variable_name:
T_STRING
{
$$ = node.NewIdentifier($1.Value)
+
+ // save position
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.StringToken)
}
| '{' expr '}'
- { $$ = $2 }
+ {
+ $$ = $2
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $3))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.OpenCurlyBracesToken)
+ yylex.(*Parser).comments.AddFromToken($$, $3, comment.CloseCurlyBracesToken)
+ }
;
simple_indirect_reference:
'$'
{
n := expr.NewVariable(nil)
- yylex.(*Parser).positions.AddPosition(n, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
- yylex.(*Parser).comments.AddComments(n, $1.Comments())
-
$$ = simpleIndirectReference{[]*expr.Variable{n}, n}
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(n, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(n, $1, comment.DollarToken)
}
| simple_indirect_reference '$'
{
n := expr.NewVariable(nil)
- yylex.(*Parser).positions.AddPosition(n, yylex.(*Parser).positionBuilder.NewTokenPosition($2))
- yylex.(*Parser).comments.AddComments(n, $2.Comments())
$1.last.SetVarName(n)
-
$1.all = append($1.all, n)
$1.last = n
$$ = $1
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(n, yylex.(*Parser).positionBuilder.NewTokenPosition($2))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(n, $2, comment.DollarToken)
}
;
assignment_list:
assignment_list ',' assignment_list_element
- { $$ = append($1, $3) }
+ {
+ $$ = append($1, $3)
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(lastNode($1), $2, comment.CommaToken)
+ }
| assignment_list_element
{
if $1 == nil {
@@ -3499,19 +5009,24 @@ assignment_list:
assignment_list_element:
variable
{
- $$ = expr.NewArrayItem(nil, $1, false)
+ $$ = expr.NewArrayItem(nil, $1)
+
+ // save position
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodePosition($1))
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1])
}
| T_LIST '(' assignment_list ')'
{
item := expr.NewList($3)
+ $$ = expr.NewArrayItem(nil, item)
+
+ // save position
yylex.(*Parser).positions.AddPosition(item, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $4))
- yylex.(*Parser).comments.AddComments(item, $1.Comments())
-
- $$ = expr.NewArrayItem(nil, item, false)
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodePosition(item))
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[item])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(item, $1, comment.ListToken)
+ yylex.(*Parser).comments.AddFromToken(item, $2, comment.OpenParenthesisToken)
+ yylex.(*Parser).comments.AddFromToken(item, $4, comment.CloseParenthesisToken)
}
| /* empty */
{ $$ = nil }
@@ -3522,73 +5037,114 @@ array_pair_list:
/* empty */
{ $$ = []node.Node{} }
| non_empty_array_pair_list possible_comma
- { $$ = $1 }
+ {
+ $$ = $1
+
+ // save comments
+ if $2 != nil {
+ yylex.(*Parser).comments.AddFromToken(lastNode($1), $2, comment.CommaToken)
+ }
+ }
;
non_empty_array_pair_list:
non_empty_array_pair_list ',' expr T_DOUBLE_ARROW expr
{
- arrayItem := expr.NewArrayItem($3, $5, false)
- yylex.(*Parser).positions.AddPosition(arrayItem, yylex.(*Parser).positionBuilder.NewNodesPosition($3, $5))
- yylex.(*Parser).comments.AddComments(arrayItem, yylex.(*Parser).comments[$3])
-
+ arrayItem := expr.NewArrayItem($3, $5)
$$ = append($1, arrayItem)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(arrayItem, yylex.(*Parser).positionBuilder.NewNodesPosition($3, $5))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(lastNode($1), $2, comment.CommaToken)
+ yylex.(*Parser).comments.AddFromToken(arrayItem, $4, comment.DoubleArrowToken)
}
| non_empty_array_pair_list ',' expr
{
- arrayItem := expr.NewArrayItem(nil, $3, false)
- yylex.(*Parser).positions.AddPosition(arrayItem, yylex.(*Parser).positionBuilder.NewNodePosition($3))
- yylex.(*Parser).comments.AddComments(arrayItem, yylex.(*Parser).comments[$3])
-
+ arrayItem := expr.NewArrayItem(nil, $3)
$$ = append($1, arrayItem)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(arrayItem, yylex.(*Parser).positionBuilder.NewNodePosition($3))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(lastNode($1), $2, comment.CommaToken)
}
| expr T_DOUBLE_ARROW expr
{
- arrayItem := expr.NewArrayItem($1, $3, false)
- yylex.(*Parser).positions.AddPosition(arrayItem, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3))
- yylex.(*Parser).comments.AddComments(arrayItem, yylex.(*Parser).comments[$1])
-
+ arrayItem := expr.NewArrayItem($1, $3)
$$ = []node.Node{arrayItem}
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(arrayItem, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(arrayItem, $2, comment.DoubleArrowToken)
}
| expr
{
- arrayItem := expr.NewArrayItem(nil, $1, false)
- yylex.(*Parser).positions.AddPosition(arrayItem, yylex.(*Parser).positionBuilder.NewNodePosition($1))
- yylex.(*Parser).comments.AddComments(arrayItem, yylex.(*Parser).comments[$1])
-
+ arrayItem := expr.NewArrayItem(nil, $1)
$$ = []node.Node{arrayItem}
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(arrayItem, yylex.(*Parser).positionBuilder.NewNodePosition($1))
}
| non_empty_array_pair_list ',' expr T_DOUBLE_ARROW '&' w_variable
{
- arrayItem := expr.NewArrayItem($3, $6, true)
- yylex.(*Parser).positions.AddPosition(arrayItem, yylex.(*Parser).positionBuilder.NewNodesPosition($3, $6))
- yylex.(*Parser).comments.AddComments(arrayItem, yylex.(*Parser).comments[$3])
-
+ reference := expr.NewReference($6)
+ arrayItem := expr.NewArrayItem($3, reference)
$$ = append($1, arrayItem)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(reference, yylex.(*Parser).positionBuilder.NewTokenNodePosition($5, $6))
+ yylex.(*Parser).positions.AddPosition(arrayItem, yylex.(*Parser).positionBuilder.NewNodesPosition($3, $6))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(lastNode($1), $2, comment.CommaToken)
+ yylex.(*Parser).comments.AddFromToken(arrayItem, $4, comment.DoubleArrowToken)
+ yylex.(*Parser).comments.AddFromToken(reference, $5, comment.AmpersandToken)
}
| non_empty_array_pair_list ',' '&' w_variable
{
- arrayItem := expr.NewArrayItem(nil, $4, true)
- yylex.(*Parser).positions.AddPosition(arrayItem, yylex.(*Parser).positionBuilder.NewTokenNodePosition($3, $4))
- yylex.(*Parser).comments.AddComments(arrayItem, $3.Comments())
-
+ reference := expr.NewReference($4)
+ arrayItem := expr.NewArrayItem(nil, reference)
$$ = append($1, arrayItem)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(reference, yylex.(*Parser).positionBuilder.NewTokenNodePosition($3, $4))
+ yylex.(*Parser).positions.AddPosition(arrayItem, yylex.(*Parser).positionBuilder.NewTokenNodePosition($3, $4))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(lastNode($1), $2, comment.CommaToken)
+ yylex.(*Parser).comments.AddFromToken(reference, $3, comment.AmpersandToken)
}
| expr T_DOUBLE_ARROW '&' w_variable
{
- arrayItem := expr.NewArrayItem($1, $4, true)
- yylex.(*Parser).positions.AddPosition(arrayItem, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $4))
- yylex.(*Parser).comments.AddComments(arrayItem, yylex.(*Parser).comments[$1])
-
+ reference := expr.NewReference($4)
+ arrayItem := expr.NewArrayItem($1, reference)
$$ = []node.Node{arrayItem}
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(reference, yylex.(*Parser).positionBuilder.NewTokenNodePosition($3, $4))
+ yylex.(*Parser).positions.AddPosition(arrayItem, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $4))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(arrayItem, $2, comment.DoubleArrowToken)
+ yylex.(*Parser).comments.AddFromToken(reference, $3, comment.AmpersandToken)
}
| '&' w_variable
{
- arrayItem := expr.NewArrayItem(nil, $2, true)
- yylex.(*Parser).positions.AddPosition(arrayItem, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $2))
- yylex.(*Parser).comments.AddComments(arrayItem, $1.Comments())
-
+ reference := expr.NewReference($2)
+ arrayItem := expr.NewArrayItem(nil, reference)
$$ = []node.Node{arrayItem}
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(reference, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $2))
+ yylex.(*Parser).positions.AddPosition(arrayItem, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $2))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(reference, $1, comment.AmpersandToken)
}
;
@@ -3598,18 +5154,26 @@ encaps_list:
| encaps_list T_ENCAPSED_AND_WHITESPACE
{
encapsed := scalar.NewEncapsedStringPart($2.Value)
- yylex.(*Parser).positions.AddPosition(encapsed, yylex.(*Parser).positionBuilder.NewTokenPosition($2))
$$ = append($1, encapsed)
- yylex.(*Parser).comments.AddComments(encapsed, $2.Comments())
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(encapsed, yylex.(*Parser).positionBuilder.NewTokenPosition($2))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(encapsed, $2, comment.EncapsedAndWhitespaceToken)
}
| encaps_var
{ $$ = []node.Node{$1} }
| T_ENCAPSED_AND_WHITESPACE encaps_var
{
encapsed := scalar.NewEncapsedStringPart($1.Value)
- yylex.(*Parser).positions.AddPosition(encapsed, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
$$ = []node.Node{encapsed, $2}
- yylex.(*Parser).comments.AddComments(encapsed, $1.Comments())
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(encapsed, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(encapsed, $1, comment.EncapsedAndWhitespaceToken)
}
;
@@ -3617,153 +5181,239 @@ encaps_var:
T_VARIABLE
{
name := node.NewIdentifier(strings.TrimLeft($1.Value, "$"))
- yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
$$ = expr.NewVariable(name)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
- yylex.(*Parser).comments.AddComments(name, $1.Comments())
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.VariableToken)
}
| T_VARIABLE '[' encaps_var_offset ']'
{
identifier := node.NewIdentifier(strings.TrimLeft($1.Value, "$"))
- yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
variable := expr.NewVariable(identifier)
- yylex.(*Parser).positions.AddPosition(variable, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
$$ = expr.NewArrayDimFetch(variable, $3)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
+ yylex.(*Parser).positions.AddPosition(variable, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $4))
- yylex.(*Parser).comments.AddComments(identifier, $1.Comments())
- yylex.(*Parser).comments.AddComments(variable, $1.Comments())
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(variable, $1, comment.VariableToken)
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.OpenSquareBracket)
+ yylex.(*Parser).comments.AddFromToken($$, $4, comment.CloseSquareBracket)
}
| T_VARIABLE T_OBJECT_OPERATOR T_STRING
{
identifier := node.NewIdentifier(strings.TrimLeft($1.Value, "$"))
- yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
variable := expr.NewVariable(identifier)
- yylex.(*Parser).positions.AddPosition(variable, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
fetch := node.NewIdentifier($3.Value)
- yylex.(*Parser).positions.AddPosition(fetch, yylex.(*Parser).positionBuilder.NewTokenPosition($3))
$$ = expr.NewPropertyFetch(variable, fetch)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
+ yylex.(*Parser).positions.AddPosition(variable, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
+ yylex.(*Parser).positions.AddPosition(fetch, yylex.(*Parser).positionBuilder.NewTokenPosition($3))
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $3))
-
- yylex.(*Parser).comments.AddComments(identifier, $1.Comments())
- yylex.(*Parser).comments.AddComments(variable, $1.Comments())
- yylex.(*Parser).comments.AddComments(fetch, $3.Comments())
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(variable, $1, comment.VariableToken)
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.ObjectOperatorToken)
+ yylex.(*Parser).comments.AddFromToken(fetch, $3, comment.StringToken)
}
| T_DOLLAR_OPEN_CURLY_BRACES expr '}'
{
- $$ = $2
+ $$ = expr.NewVariable($2)
+
+ // save position
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $3))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.DollarOpenCurlyBracesToken)
+ yylex.(*Parser).comments.AddFromToken($$, $3, comment.CloseCurlyBracesToken)
+ }
+ | T_DOLLAR_OPEN_CURLY_BRACES T_STRING_VARNAME '}'
+ {
+ name := node.NewIdentifier($2.Value)
+ $$ = expr.NewVariable(name)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewTokenPosition($2))
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $3))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.DollarOpenCurlyBracesToken)
+ yylex.(*Parser).comments.AddFromToken(name, $2, comment.StringVarnameToken)
+ yylex.(*Parser).comments.AddFromToken($$, $3, comment.CloseCurlyBracesToken)
}
| T_DOLLAR_OPEN_CURLY_BRACES T_STRING_VARNAME '[' expr ']' '}'
{
identifier := node.NewIdentifier($2.Value)
- yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition($2))
variable := expr.NewVariable(identifier)
- yylex.(*Parser).positions.AddPosition(variable, yylex.(*Parser).positionBuilder.NewTokenPosition($2))
$$ = expr.NewArrayDimFetch(variable, $4)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition($2))
+ yylex.(*Parser).positions.AddPosition(variable, yylex.(*Parser).positionBuilder.NewTokenPosition($2))
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $6))
-
- yylex.(*Parser).comments.AddComments(identifier, $2.Comments())
- yylex.(*Parser).comments.AddComments(variable, $1.Comments())
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.DollarOpenCurlyBracesToken)
+ yylex.(*Parser).comments.AddFromToken(variable, $2, comment.StringVarnameToken)
+ yylex.(*Parser).comments.AddFromToken($$, $3, comment.OpenSquareBracket)
+ yylex.(*Parser).comments.AddFromToken($$, $5, comment.CloseSquareBracket)
+ yylex.(*Parser).comments.AddFromToken($$, $6, comment.CloseCurlyBracesToken)
}
| T_CURLY_OPEN variable '}'
- { $$ = $2; }
+ {
+ $$ = $2;
+ }
;
encaps_var_offset:
T_STRING
{
$$ = scalar.NewString($1.Value)
+
+ // save position
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.StringToken)
}
| T_NUM_STRING
{
// TODO: add option to handle 64 bit integer
if _, err := strconv.Atoi($1.Value); err == nil {
$$ = scalar.NewLnumber($1.Value)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
} else {
$$ = scalar.NewString($1.Value)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
}
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.NumStringToken)
}
| T_VARIABLE
{
identifier := node.NewIdentifier(strings.TrimLeft($1.Value, "$"))
- yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
$$ = expr.NewVariable(identifier)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
- yylex.(*Parser).comments.AddComments(identifier, $1.Comments())
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.VariableToken)
}
;
internal_functions_in_yacc:
- T_ISSET '(' isset_variables ')'
- {
- $$ = expr.NewIsset($3)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $4))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
- }
+ T_ISSET '(' isset_variables ')'
+ {
+ $$ = expr.NewIsset($3)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $4))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.IssetToken)
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.OpenParenthesisToken)
+ yylex.(*Parser).comments.AddFromToken($$, $4, comment.CloseParenthesisToken)
+ }
| T_EMPTY '(' variable ')'
- {
- $$ = expr.NewEmpty($3)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $4))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
- }
- | T_EMPTY '(' expr_without_variable ')'
- {
- $$ = expr.NewEmpty($3)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $4))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
- }
+ {
+ $$ = expr.NewEmpty($3)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $4))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.EmptyToken)
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.OpenParenthesisToken)
+ yylex.(*Parser).comments.AddFromToken($$, $4, comment.CloseParenthesisToken)
+ }
+ | T_EMPTY '(' expr ')'
+ {
+ $$ = expr.NewEmpty($3)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $4))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.EmptyToken)
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.OpenParenthesisToken)
+ yylex.(*Parser).comments.AddFromToken($$, $4, comment.CloseParenthesisToken)
+ }
| T_INCLUDE expr
- {
- $$ = expr.NewInclude($2)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $2))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
- }
+ {
+ $$ = expr.NewInclude($2)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $2))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.IncludeToken)
+ }
| T_INCLUDE_ONCE expr
- {
- $$ = expr.NewIncludeOnce($2)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $2))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
- }
+ {
+ $$ = expr.NewIncludeOnce($2)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $2))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.IncludeOnceToken)
+ }
| T_EVAL '(' expr ')'
- {
- $$ = expr.NewEval($3)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $4))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
- }
+ {
+ $$ = expr.NewEval($3)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $4))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.EvalToken)
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.OpenParenthesisToken)
+ yylex.(*Parser).comments.AddFromToken($$, $4, comment.CloseParenthesisToken)
+ }
| T_REQUIRE expr
- {
- $$ = expr.NewRequire($2)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $2))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
- }
+ {
+ $$ = expr.NewRequire($2)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $2))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.RequireToken)
+ }
| T_REQUIRE_ONCE expr
- {
- $$ = expr.NewRequireOnce($2)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $2))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
- }
+ {
+ $$ = expr.NewRequireOnce($2)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $2))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.RequireOnceToken)
+ }
;
isset_variables:
isset_variable
{ $$ = []node.Node{$1} }
| isset_variables ',' isset_variable
- { $$ = append($1, $3) }
+ {
+ $$ = append($1, $3)
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(lastNode($1), $2, comment.CommaToken)
+ }
;
isset_variable:
@@ -3777,22 +5427,26 @@ class_constant:
class_name T_PAAMAYIM_NEKUDOTAYIM T_STRING
{
target := node.NewIdentifier($3.Value)
- yylex.(*Parser).positions.AddPosition(target, yylex.(*Parser).positionBuilder.NewTokenPosition($3))
$$ = expr.NewClassConstFetch($1, target)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(target, yylex.(*Parser).positionBuilder.NewTokenPosition($3))
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodeTokenPosition($1, $3))
- yylex.(*Parser).comments.AddComments(target, $3.Comments())
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1])
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.PaamayimNekudotayimToken)
}
| variable_class_name T_PAAMAYIM_NEKUDOTAYIM T_STRING
{
target := node.NewIdentifier($3.Value)
- yylex.(*Parser).positions.AddPosition(target, yylex.(*Parser).positionBuilder.NewTokenPosition($3))
$$ = expr.NewClassConstFetch($1, target)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(target, yylex.(*Parser).positionBuilder.NewTokenPosition($3))
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodeTokenPosition($1, $3))
- yylex.(*Parser).comments.AddComments(target, $3.Comments())
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1])
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.PaamayimNekudotayimToken)
}
;
@@ -3800,12 +5454,14 @@ static_class_name_scalar:
class_name T_PAAMAYIM_NEKUDOTAYIM T_CLASS
{
target := node.NewIdentifier($3.Value)
- yylex.(*Parser).positions.AddPosition(target, yylex.(*Parser).positionBuilder.NewTokenPosition($3))
$$ = expr.NewClassConstFetch($1, target)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(target, yylex.(*Parser).positionBuilder.NewTokenPosition($3))
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodeTokenPosition($1, $3))
- yylex.(*Parser).comments.AddComments(target, $3.Comments())
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1])
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.PaamayimNekudotayimToken)
}
;
@@ -3813,38 +5469,20 @@ class_name_scalar:
class_name T_PAAMAYIM_NEKUDOTAYIM T_CLASS
{
target := node.NewIdentifier($3.Value)
- yylex.(*Parser).positions.AddPosition(target, yylex.(*Parser).positionBuilder.NewTokenPosition($3))
$$ = expr.NewClassConstFetch($1, target)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(target, yylex.(*Parser).positionBuilder.NewTokenPosition($3))
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodeTokenPosition($1, $3))
- yylex.(*Parser).comments.AddComments(target, $3.Comments())
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1])
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.PaamayimNekudotayimToken)
}
;
%%
-type foreachVariable struct {
- node node.Node
- byRef bool
-}
-
-type nodesWithEndToken struct {
- nodes []node.Node
- endToken token.Token
-}
-
-type boolWithToken struct {
- value bool
- token *token.Token
-}
-
type simpleIndirectReference struct {
all []*expr.Variable
last *expr.Variable
}
-
-type altSyntaxNode struct {
- node node.Node
- isAlt bool
-}
diff --git a/php5/php5_test.go b/php5/php5_test.go
index 4dccea5..8a5dc81 100644
--- a/php5/php5_test.go
+++ b/php5/php5_test.go
@@ -429,23 +429,27 @@ func TestPhp5(t *testing.T) {
},
}
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Expression{
Expr: &expr.FunctionCall{
Function: &name.Name{Parts: []node.Node{&name.NamePart{Value: "foo"}}},
- Arguments: []node.Node{
- &node.Argument{Variadic: false, Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}}},
- &node.Argument{Variadic: true, Expr: &expr.Variable{VarName: &node.Identifier{Value: "b"}}},
+ ArgumentList: &node.ArgumentList{
+ Arguments: []node.Node{
+ &node.Argument{Variadic: false, Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}}},
+ &node.Argument{Variadic: true, Expr: &expr.Variable{VarName: &node.Identifier{Value: "b"}}},
+ },
},
},
},
&stmt.Expression{
Expr: &expr.FunctionCall{
Function: &expr.Variable{VarName: &node.Identifier{Value: "foo"}},
- Arguments: []node.Node{
- &node.Argument{Variadic: false, Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}}},
- &node.Argument{Variadic: true, Expr: &expr.Variable{VarName: &node.Identifier{Value: "b"}}},
+ ArgumentList: &node.ArgumentList{
+ Arguments: []node.Node{
+ &node.Argument{Variadic: false, Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}}},
+ &node.Argument{Variadic: true, Expr: &expr.Variable{VarName: &node.Identifier{Value: "b"}}},
+ },
},
},
},
@@ -453,9 +457,11 @@ func TestPhp5(t *testing.T) {
Expr: &expr.MethodCall{
Variable: &expr.Variable{VarName: &node.Identifier{Value: "foo"}},
Method: &node.Identifier{Value: "bar"},
- Arguments: []node.Node{
- &node.Argument{Variadic: false, Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}}},
- &node.Argument{Variadic: true, Expr: &expr.Variable{VarName: &node.Identifier{Value: "b"}}},
+ ArgumentList: &node.ArgumentList{
+ Arguments: []node.Node{
+ &node.Argument{Variadic: false, Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}}},
+ &node.Argument{Variadic: true, Expr: &expr.Variable{VarName: &node.Identifier{Value: "b"}}},
+ },
},
},
},
@@ -463,9 +469,11 @@ func TestPhp5(t *testing.T) {
Expr: &expr.StaticCall{
Class: &name.Name{Parts: []node.Node{&name.NamePart{Value: "foo"}}},
Call: &node.Identifier{Value: "bar"},
- Arguments: []node.Node{
- &node.Argument{Variadic: false, Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}}},
- &node.Argument{Variadic: true, Expr: &expr.Variable{VarName: &node.Identifier{Value: "b"}}},
+ ArgumentList: &node.ArgumentList{
+ Arguments: []node.Node{
+ &node.Argument{Variadic: false, Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}}},
+ &node.Argument{Variadic: true, Expr: &expr.Variable{VarName: &node.Identifier{Value: "b"}}},
+ },
},
},
},
@@ -473,18 +481,22 @@ func TestPhp5(t *testing.T) {
Expr: &expr.StaticCall{
Class: &expr.Variable{VarName: &node.Identifier{Value: "foo"}},
Call: &node.Identifier{Value: "bar"},
- Arguments: []node.Node{
- &node.Argument{Variadic: false, Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}}},
- &node.Argument{Variadic: true, Expr: &expr.Variable{VarName: &node.Identifier{Value: "b"}}},
+ ArgumentList: &node.ArgumentList{
+ Arguments: []node.Node{
+ &node.Argument{Variadic: false, Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}}},
+ &node.Argument{Variadic: true, Expr: &expr.Variable{VarName: &node.Identifier{Value: "b"}}},
+ },
},
},
},
&stmt.Expression{
Expr: &expr.New{
Class: &name.Name{Parts: []node.Node{&name.NamePart{Value: "foo"}}},
- Arguments: []node.Node{
- &node.Argument{Variadic: false, Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}}},
- &node.Argument{Variadic: true, Expr: &expr.Variable{VarName: &node.Identifier{Value: "b"}}},
+ ArgumentList: &node.ArgumentList{
+ Arguments: []node.Node{
+ &node.Argument{Variadic: false, Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}}},
+ &node.Argument{Variadic: true, Expr: &expr.Variable{VarName: &node.Identifier{Value: "b"}}},
+ },
},
},
},
@@ -502,14 +514,15 @@ func TestPhp5(t *testing.T) {
MethodName: &node.Identifier{Value: "foo"},
Modifiers: []node.Node{&node.Identifier{Value: "public"}},
Params: expectedParams,
- Stmts: []node.Node{},
+ Stmt: &stmt.StmtList{
+ Stmts: []node.Node{},
+ },
},
},
},
&stmt.Expression{
Expr: &expr.Closure{
Params: expectedParams,
- Uses: []node.Node{},
Stmts: []node.Node{},
},
},
@@ -517,7 +530,6 @@ func TestPhp5(t *testing.T) {
Expr: &expr.Closure{
Static: true,
Params: expectedParams,
- Uses: []node.Node{},
Stmts: []node.Node{},
},
},
@@ -665,9 +677,9 @@ func TestPhp5(t *testing.T) {
Parts: []node.Node{
&scalar.EncapsedStringPart{Value: "test "},
&expr.MethodCall{
- Variable: &expr.Variable{VarName: &node.Identifier{Value: "foo"}},
- Method: &node.Identifier{Value: "bar"},
- Arguments: []node.Node{},
+ Variable: &expr.Variable{VarName: &node.Identifier{Value: "foo"}},
+ Method: &node.Identifier{Value: "bar"},
+ ArgumentList: &node.ArgumentList{},
},
},
},
@@ -764,7 +776,9 @@ func TestPhp5(t *testing.T) {
&stmt.ClassMethod{
PhpDocComment: "",
MethodName: &node.Identifier{Value: "bar"},
- Stmts: []node.Node{},
+ Stmt: &stmt.StmtList{
+ Stmts: []node.Node{},
+ },
},
},
},
@@ -779,7 +793,9 @@ func TestPhp5(t *testing.T) {
&node.Identifier{Value: "public"},
&node.Identifier{Value: "static"},
},
- Stmts: []node.Node{},
+ Stmt: &stmt.StmtList{
+ Stmts: []node.Node{},
+ },
},
},
},
@@ -794,7 +810,9 @@ func TestPhp5(t *testing.T) {
&node.Identifier{Value: "final"},
&node.Identifier{Value: "private"},
},
- Stmts: []node.Node{},
+ Stmt: &stmt.StmtList{
+ Stmts: []node.Node{},
+ },
},
&stmt.ClassMethod{
PhpDocComment: "",
@@ -803,7 +821,9 @@ func TestPhp5(t *testing.T) {
Modifiers: []node.Node{
&node.Identifier{Value: "protected"},
},
- Stmts: []node.Node{},
+ Stmt: &stmt.StmtList{
+ Stmts: []node.Node{},
+ },
},
},
},
@@ -821,6 +841,7 @@ func TestPhp5(t *testing.T) {
&node.Identifier{Value: "abstract"},
&node.Identifier{Value: "public"},
},
+ Stmt: &stmt.Nop{},
},
},
},
@@ -829,20 +850,8 @@ func TestPhp5(t *testing.T) {
Modifiers: []node.Node{
&node.Identifier{Value: "final"},
},
- Extends: &name.Name{
- Parts: []node.Node{
- &name.NamePart{Value: "bar"},
- },
- },
- Stmts: []node.Node{},
- },
- &stmt.Class{
- ClassName: &node.Identifier{Value: "foo"},
- Modifiers: []node.Node{
- &node.Identifier{Value: "final"},
- },
- Implements: []node.Node{
- &name.Name{
+ Extends: &stmt.ClassExtends{
+ ClassName: &name.Name{
Parts: []node.Node{
&name.NamePart{Value: "bar"},
},
@@ -855,15 +864,33 @@ func TestPhp5(t *testing.T) {
Modifiers: []node.Node{
&node.Identifier{Value: "final"},
},
- Implements: []node.Node{
- &name.Name{
- Parts: []node.Node{
- &name.NamePart{Value: "bar"},
+ Implements: &stmt.ClassImplements{
+ InterfaceNames: []node.Node{
+ &name.Name{
+ Parts: []node.Node{
+ &name.NamePart{Value: "bar"},
+ },
},
},
- &name.Name{
- Parts: []node.Node{
- &name.NamePart{Value: "baz"},
+ },
+ Stmts: []node.Node{},
+ },
+ &stmt.Class{
+ ClassName: &node.Identifier{Value: "foo"},
+ Modifiers: []node.Node{
+ &node.Identifier{Value: "final"},
+ },
+ Implements: &stmt.ClassImplements{
+ InterfaceNames: []node.Node{
+ &name.Name{
+ Parts: []node.Node{
+ &name.NamePart{Value: "bar"},
+ },
+ },
+ &name.Name{
+ Parts: []node.Node{
+ &name.NamePart{Value: "baz"},
+ },
},
},
},
@@ -1036,21 +1063,20 @@ func TestPhp5(t *testing.T) {
Stmt: &stmt.StmtList{Stmts: []node.Node{}},
},
&stmt.Foreach{
- ByRef: true,
- Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
- Key: &expr.Variable{VarName: &node.Identifier{Value: "k"}},
- Variable: &expr.Variable{VarName: &node.Identifier{Value: "v"}},
- Stmt: &stmt.StmtList{Stmts: []node.Node{}},
+ Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
+ Key: &expr.Variable{VarName: &node.Identifier{Value: "k"}},
+ Variable: &expr.Reference{
+ Variable: &expr.Variable{VarName: &node.Identifier{Value: "v"}},
+ },
+ Stmt: &stmt.StmtList{Stmts: []node.Node{}},
},
&stmt.Foreach{
- ByRef: false,
- Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
- Key: &expr.Variable{VarName: &node.Identifier{Value: "k"}},
+ Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
+ Key: &expr.Variable{VarName: &node.Identifier{Value: "k"}},
Variable: &expr.List{
Items: []node.Node{
&expr.ArrayItem{
- ByRef: false,
- Val: &expr.Variable{VarName: &node.Identifier{Value: "v"}},
+ Val: &expr.Variable{VarName: &node.Identifier{Value: "v"}},
},
},
},
@@ -1134,7 +1160,7 @@ func TestPhp5(t *testing.T) {
&name.NamePart{Value: "foo"},
},
},
- Arguments: []node.Node{},
+ ArgumentList: &node.ArgumentList{},
},
},
},
@@ -1213,10 +1239,12 @@ func TestPhp5(t *testing.T) {
&stmt.Interface{
PhpDocComment: "",
InterfaceName: &node.Identifier{Value: "Foo"},
- Extends: []node.Node{
- &name.Name{
- Parts: []node.Node{
- &name.NamePart{Value: "Bar"},
+ Extends: &stmt.InterfaceExtends{
+ InterfaceNames: []node.Node{
+ &name.Name{
+ Parts: []node.Node{
+ &name.NamePart{Value: "Bar"},
+ },
},
},
},
@@ -1225,15 +1253,17 @@ func TestPhp5(t *testing.T) {
&stmt.Interface{
PhpDocComment: "",
InterfaceName: &node.Identifier{Value: "Foo"},
- Extends: []node.Node{
- &name.Name{
- Parts: []node.Node{
- &name.NamePart{Value: "Bar"},
+ Extends: &stmt.InterfaceExtends{
+ InterfaceNames: []node.Node{
+ &name.Name{
+ Parts: []node.Node{
+ &name.NamePart{Value: "Bar"},
+ },
},
- },
- &name.Name{
- Parts: []node.Node{
- &name.NamePart{Value: "Baz"},
+ &name.Name{
+ Parts: []node.Node{
+ &name.NamePart{Value: "Baz"},
+ },
},
},
},
@@ -1342,63 +1372,71 @@ func TestPhp5(t *testing.T) {
},
&stmt.AltSwitch{
Cond: &scalar.Lnumber{Value: "1"},
- Cases: []node.Node{
- &stmt.Case{
- Cond: &scalar.Lnumber{Value: "1"},
- Stmts: []node.Node{},
- },
- &stmt.Default{
- Stmts: []node.Node{},
- },
- &stmt.Case{
- Cond: &scalar.Lnumber{Value: "2"},
- Stmts: []node.Node{},
+ CaseList: &stmt.CaseList{
+ Cases: []node.Node{
+ &stmt.Case{
+ Cond: &scalar.Lnumber{Value: "1"},
+ Stmts: []node.Node{},
+ },
+ &stmt.Default{
+ Stmts: []node.Node{},
+ },
+ &stmt.Case{
+ Cond: &scalar.Lnumber{Value: "2"},
+ Stmts: []node.Node{},
+ },
},
},
},
&stmt.AltSwitch{
Cond: &scalar.Lnumber{Value: "1"},
- Cases: []node.Node{
- &stmt.Case{
- Cond: &scalar.Lnumber{Value: "1"},
- Stmts: []node.Node{},
- },
- &stmt.Case{
- Cond: &scalar.Lnumber{Value: "2"},
- Stmts: []node.Node{},
- },
- },
- },
- &stmt.Switch{
- Cond: &scalar.Lnumber{Value: "1"},
- Cases: []node.Node{
- &stmt.Case{
- Cond: &scalar.Lnumber{Value: "1"},
- Stmts: []node.Node{
- &stmt.Break{},
+ CaseList: &stmt.CaseList{
+ Cases: []node.Node{
+ &stmt.Case{
+ Cond: &scalar.Lnumber{Value: "1"},
+ Stmts: []node.Node{},
},
- },
- &stmt.Case{
- Cond: &scalar.Lnumber{Value: "2"},
- Stmts: []node.Node{
- &stmt.Break{},
+ &stmt.Case{
+ Cond: &scalar.Lnumber{Value: "2"},
+ Stmts: []node.Node{},
},
},
},
},
&stmt.Switch{
Cond: &scalar.Lnumber{Value: "1"},
- Cases: []node.Node{
- &stmt.Case{
- Cond: &scalar.Lnumber{Value: "1"},
- Stmts: []node.Node{
- &stmt.Break{},
+ CaseList: &stmt.CaseList{
+ Cases: []node.Node{
+ &stmt.Case{
+ Cond: &scalar.Lnumber{Value: "1"},
+ Stmts: []node.Node{
+ &stmt.Break{},
+ },
+ },
+ &stmt.Case{
+ Cond: &scalar.Lnumber{Value: "2"},
+ Stmts: []node.Node{
+ &stmt.Break{},
+ },
},
},
- &stmt.Case{
- Cond: &scalar.Lnumber{Value: "2"},
- Stmts: []node.Node{
- &stmt.Break{},
+ },
+ },
+ &stmt.Switch{
+ Cond: &scalar.Lnumber{Value: "1"},
+ CaseList: &stmt.CaseList{
+ Cases: []node.Node{
+ &stmt.Case{
+ Cond: &scalar.Lnumber{Value: "1"},
+ Stmts: []node.Node{
+ &stmt.Break{},
+ },
+ },
+ &stmt.Case{
+ Cond: &scalar.Lnumber{Value: "2"},
+ Stmts: []node.Node{
+ &stmt.Break{},
+ },
},
},
},
@@ -1443,6 +1481,7 @@ func TestPhp5(t *testing.T) {
},
},
},
+ TraitAdaptationList: &stmt.TraitAdaptationList{},
},
},
},
@@ -1463,12 +1502,14 @@ func TestPhp5(t *testing.T) {
},
},
},
- Adaptations: []node.Node{
- &stmt.TraitUseAlias{
- Ref: &stmt.TraitMethodRef{
- Method: &node.Identifier{Value: "one"},
+ TraitAdaptationList: &stmt.TraitAdaptationList{
+ Adaptations: []node.Node{
+ &stmt.TraitUseAlias{
+ Ref: &stmt.TraitMethodRef{
+ Method: &node.Identifier{Value: "one"},
+ },
+ Modifier: &node.Identifier{Value: "public"},
},
- Modifier: &node.Identifier{Value: "public"},
},
},
},
@@ -1491,13 +1532,15 @@ func TestPhp5(t *testing.T) {
},
},
},
- Adaptations: []node.Node{
- &stmt.TraitUseAlias{
- Ref: &stmt.TraitMethodRef{
- Method: &node.Identifier{Value: "one"},
+ TraitAdaptationList: &stmt.TraitAdaptationList{
+ Adaptations: []node.Node{
+ &stmt.TraitUseAlias{
+ Ref: &stmt.TraitMethodRef{
+ Method: &node.Identifier{Value: "one"},
+ },
+ Modifier: &node.Identifier{Value: "public"},
+ Alias: &node.Identifier{Value: "two"},
},
- Modifier: &node.Identifier{Value: "public"},
- Alias: &node.Identifier{Value: "two"},
},
},
},
@@ -1520,39 +1563,41 @@ func TestPhp5(t *testing.T) {
},
},
},
- Adaptations: []node.Node{
- &stmt.TraitUsePrecedence{
- Ref: &stmt.TraitMethodRef{
- Trait: &name.Name{
- Parts: []node.Node{
- &name.NamePart{Value: "Bar"},
+ TraitAdaptationList: &stmt.TraitAdaptationList{
+ Adaptations: []node.Node{
+ &stmt.TraitUsePrecedence{
+ Ref: &stmt.TraitMethodRef{
+ Trait: &name.Name{
+ Parts: []node.Node{
+ &name.NamePart{Value: "Bar"},
+ },
},
+ Method: &node.Identifier{Value: "one"},
},
- Method: &node.Identifier{Value: "one"},
- },
- Insteadof: []node.Node{
- &name.Name{
- Parts: []node.Node{
- &name.NamePart{Value: "Baz"},
+ Insteadof: []node.Node{
+ &name.Name{
+ Parts: []node.Node{
+ &name.NamePart{Value: "Baz"},
+ },
},
- },
- &name.Name{
- Parts: []node.Node{
- &name.NamePart{Value: "Quux"},
+ &name.Name{
+ Parts: []node.Node{
+ &name.NamePart{Value: "Quux"},
+ },
},
},
},
- },
- &stmt.TraitUseAlias{
- Ref: &stmt.TraitMethodRef{
- Trait: &name.Name{
- Parts: []node.Node{
- &name.NamePart{Value: "Baz"},
+ &stmt.TraitUseAlias{
+ Ref: &stmt.TraitMethodRef{
+ Trait: &name.Name{
+ Parts: []node.Node{
+ &name.NamePart{Value: "Baz"},
+ },
},
+ Method: &node.Identifier{Value: "one"},
},
- Method: &node.Identifier{Value: "one"},
+ Alias: &node.Identifier{Value: "two"},
},
- Alias: &node.Identifier{Value: "two"},
},
},
},
@@ -1857,8 +1902,7 @@ func TestPhp5(t *testing.T) {
Expr: &expr.Array{
Items: []node.Node{
&expr.ArrayItem{
- ByRef: false,
- Val: &scalar.Lnumber{Value: "1"},
+ Val: &scalar.Lnumber{Value: "1"},
},
},
},
@@ -1867,13 +1911,11 @@ func TestPhp5(t *testing.T) {
Expr: &expr.Array{
Items: []node.Node{
&expr.ArrayItem{
- ByRef: false,
- Key: &scalar.Lnumber{Value: "1"},
- Val: &scalar.Lnumber{Value: "1"},
+ Key: &scalar.Lnumber{Value: "1"},
+ Val: &scalar.Lnumber{Value: "1"},
},
&expr.ArrayItem{
- ByRef: true,
- Val: &expr.Variable{VarName: &node.Identifier{Value: "b"}},
+ Val: &expr.Reference{Variable: &expr.Variable{VarName: &node.Identifier{Value: "b"}}},
},
},
},
@@ -1882,9 +1924,8 @@ func TestPhp5(t *testing.T) {
Expr: &expr.Array{
Items: []node.Node{
&expr.ArrayItem{
- ByRef: true,
- Key: &scalar.Lnumber{Value: "3"},
- Val: &expr.Variable{VarName: &node.Identifier{Value: "b"}},
+ Key: &scalar.Lnumber{Value: "3"},
+ Val: &expr.Reference{Variable: &expr.Variable{VarName: &node.Identifier{Value: "b"}}},
},
},
},
@@ -1893,22 +1934,18 @@ func TestPhp5(t *testing.T) {
Expr: &expr.Array{
Items: []node.Node{
&expr.ArrayItem{
- ByRef: true,
- Val: &expr.Variable{VarName: &node.Identifier{Value: "b"}},
+ Val: &expr.Reference{Variable: &expr.Variable{VarName: &node.Identifier{Value: "b"}}},
},
&expr.ArrayItem{
- ByRef: false,
- Key: &scalar.Lnumber{Value: "1"},
- Val: &scalar.Lnumber{Value: "1"},
+ Key: &scalar.Lnumber{Value: "1"},
+ Val: &scalar.Lnumber{Value: "1"},
},
&expr.ArrayItem{
- ByRef: false,
- Val: &scalar.Lnumber{Value: "1"},
+ Val: &scalar.Lnumber{Value: "1"},
},
&expr.ArrayItem{
- ByRef: true,
- Key: &scalar.Lnumber{Value: "3"},
- Val: &expr.Variable{VarName: &node.Identifier{Value: "b"}},
+ Key: &scalar.Lnumber{Value: "3"},
+ Val: &expr.Reference{Variable: &expr.Variable{VarName: &node.Identifier{Value: "b"}}},
},
},
},
@@ -1948,7 +1985,6 @@ func TestPhp5(t *testing.T) {
ReturnsRef: false,
Static: false,
PhpDocComment: "",
- Uses: []node.Node{},
Stmts: []node.Node{},
},
},
@@ -1969,14 +2005,10 @@ func TestPhp5(t *testing.T) {
Variable: &expr.Variable{VarName: &node.Identifier{Value: "b"}},
},
},
- Uses: []node.Node{
- &expr.ClosureUse{
- ByRef: false,
- Variable: &expr.Variable{VarName: &node.Identifier{Value: "c"}},
- },
- &expr.ClosureUse{
- ByRef: true,
- Variable: &expr.Variable{VarName: &node.Identifier{Value: "d"}},
+ ClosureUse: &expr.ClosureUse{
+ Uses: []node.Node{
+ &expr.Variable{VarName: &node.Identifier{Value: "c"}},
+ &expr.Reference{Variable: &expr.Variable{VarName: &node.Identifier{Value: "d"}}},
},
},
Stmts: []node.Node{},
@@ -1999,14 +2031,10 @@ func TestPhp5(t *testing.T) {
Variable: &expr.Variable{VarName: &node.Identifier{Value: "b"}},
},
},
- Uses: []node.Node{
- &expr.ClosureUse{
- ByRef: true,
- Variable: &expr.Variable{VarName: &node.Identifier{Value: "c"}},
- },
- &expr.ClosureUse{
- ByRef: false,
- Variable: &expr.Variable{VarName: &node.Identifier{Value: "d"}},
+ ClosureUse: &expr.ClosureUse{
+ Uses: []node.Node{
+ &expr.Reference{Variable: &expr.Variable{VarName: &node.Identifier{Value: "c"}}},
+ &expr.Variable{VarName: &node.Identifier{Value: "d"}},
},
},
Stmts: []node.Node{},
@@ -2017,7 +2045,6 @@ func TestPhp5(t *testing.T) {
ReturnsRef: false,
Static: false,
PhpDocComment: "",
- Uses: []node.Node{},
Stmts: []node.Node{},
},
},
@@ -2081,7 +2108,7 @@ func TestPhp5(t *testing.T) {
&name.NamePart{Value: "foo"},
},
},
- Arguments: []node.Node{},
+ ArgumentList: &node.ArgumentList{},
},
},
&stmt.Expression{
@@ -2091,11 +2118,13 @@ func TestPhp5(t *testing.T) {
&name.NamePart{Value: "foo"},
},
},
- Arguments: []node.Node{
- &node.Argument{
- Variadic: false,
- IsReference: true,
- Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
+ ArgumentList: &node.ArgumentList{
+ Arguments: []node.Node{
+ &node.Argument{
+ Variadic: false,
+ IsReference: true,
+ Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
+ },
},
},
},
@@ -2107,12 +2136,14 @@ func TestPhp5(t *testing.T) {
&name.NamePart{Value: "foo"},
},
},
- Arguments: []node.Node{
- &node.Argument{
- Variadic: false,
- IsReference: false,
- Expr: &expr.ShortArray{
- Items: []node.Node{},
+ ArgumentList: &node.ArgumentList{
+ Arguments: []node.Node{
+ &node.Argument{
+ Variadic: false,
+ IsReference: false,
+ Expr: &expr.ShortArray{
+ Items: []node.Node{},
+ },
},
},
},
@@ -2121,12 +2152,14 @@ func TestPhp5(t *testing.T) {
&stmt.Expression{
Expr: &expr.FunctionCall{
Function: &expr.Variable{VarName: &node.Identifier{Value: "foo"}},
- Arguments: []node.Node{
- &node.Argument{
- Variadic: false,
- IsReference: false,
- Expr: &expr.Yield{
- Value: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
+ ArgumentList: &node.ArgumentList{
+ Arguments: []node.Node{
+ &node.Argument{
+ Variadic: false,
+ IsReference: false,
+ Expr: &expr.Yield{
+ Value: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
+ },
},
},
},
@@ -2232,12 +2265,10 @@ func TestPhp5(t *testing.T) {
Variable: &expr.List{
Items: []node.Node{
&expr.ArrayItem{
- ByRef: false,
- Val: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
+ Val: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
},
&expr.ArrayItem{
- ByRef: false,
- Val: &expr.Variable{VarName: &node.Identifier{Value: "b"}},
+ Val: &expr.Variable{VarName: &node.Identifier{Value: "b"}},
},
},
},
@@ -2249,7 +2280,6 @@ func TestPhp5(t *testing.T) {
Variable: &expr.List{
Items: []node.Node{
&expr.ArrayItem{
- ByRef: false,
Val: &expr.ArrayDimFetch{
Variable: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
},
@@ -2264,12 +2294,10 @@ func TestPhp5(t *testing.T) {
Variable: &expr.List{
Items: []node.Node{
&expr.ArrayItem{
- ByRef: false,
Val: &expr.List{
Items: []node.Node{
&expr.ArrayItem{
- ByRef: false,
- Val: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
+ Val: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
},
},
},
@@ -2281,9 +2309,9 @@ func TestPhp5(t *testing.T) {
},
&stmt.Expression{
Expr: &expr.MethodCall{
- Variable: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
- Method: &node.Identifier{Value: "foo"},
- Arguments: []node.Node{},
+ Variable: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
+ Method: &node.Identifier{Value: "foo"},
+ ArgumentList: &node.ArgumentList{},
},
},
&stmt.Expression{
@@ -2302,7 +2330,7 @@ func TestPhp5(t *testing.T) {
&name.NamePart{Value: "Foo"},
},
},
- Arguments: []node.Node{},
+ ArgumentList: &node.ArgumentList{},
},
},
&stmt.Expression{
@@ -2312,7 +2340,7 @@ func TestPhp5(t *testing.T) {
&name.NamePart{Value: "Foo"},
},
},
- Arguments: []node.Node{},
+ ArgumentList: &node.ArgumentList{},
},
},
&stmt.Expression{
@@ -2346,8 +2374,8 @@ func TestPhp5(t *testing.T) {
},
Property: &node.Identifier{Value: "bar"},
},
- Method: &node.Identifier{Value: "baz"},
- Arguments: []node.Node{},
+ Method: &node.Identifier{Value: "baz"},
+ ArgumentList: &node.ArgumentList{},
},
Property: &node.Identifier{Value: "quux"},
},
@@ -2358,9 +2386,9 @@ func TestPhp5(t *testing.T) {
Expr: &expr.ArrayDimFetch{
Variable: &expr.ArrayDimFetch{
Variable: &expr.MethodCall{
- Variable: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
- Method: &node.Identifier{Value: "foo"},
- Arguments: []node.Node{},
+ Variable: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
+ Method: &node.Identifier{Value: "foo"},
+ ArgumentList: &node.ArgumentList{},
},
Dim: &scalar.Lnumber{Value: "1"},
},
@@ -2396,8 +2424,7 @@ func TestPhp5(t *testing.T) {
Expr: &expr.ShortArray{
Items: []node.Node{
&expr.ArrayItem{
- ByRef: false,
- Val: &scalar.Lnumber{Value: "1"},
+ Val: &scalar.Lnumber{Value: "1"},
},
},
},
@@ -2406,13 +2433,11 @@ func TestPhp5(t *testing.T) {
Expr: &expr.ShortArray{
Items: []node.Node{
&expr.ArrayItem{
- ByRef: false,
- Key: &scalar.Lnumber{Value: "1"},
- Val: &scalar.Lnumber{Value: "1"},
+ Key: &scalar.Lnumber{Value: "1"},
+ Val: &scalar.Lnumber{Value: "1"},
},
&expr.ArrayItem{
- ByRef: true,
- Val: &expr.Variable{VarName: &node.Identifier{Value: "b"}},
+ Val: &expr.Reference{Variable: &expr.Variable{VarName: &node.Identifier{Value: "b"}}},
},
},
},
@@ -2424,8 +2449,8 @@ func TestPhp5(t *testing.T) {
&name.NamePart{Value: "Foo"},
},
},
- Call: &node.Identifier{Value: "bar"},
- Arguments: []node.Node{},
+ Call: &node.Identifier{Value: "bar"},
+ ArgumentList: &node.ArgumentList{},
},
},
&stmt.Expression{
@@ -2435,8 +2460,8 @@ func TestPhp5(t *testing.T) {
&name.NamePart{Value: "Foo"},
},
},
- Call: &node.Identifier{Value: "bar"},
- Arguments: []node.Node{},
+ Call: &node.Identifier{Value: "bar"},
+ ArgumentList: &node.ArgumentList{},
},
},
&stmt.Expression{
@@ -2446,8 +2471,8 @@ func TestPhp5(t *testing.T) {
&name.NamePart{Value: "Foo"},
},
},
- Call: &node.Identifier{Value: "bar"},
- Arguments: []node.Node{},
+ Call: &node.Identifier{Value: "bar"},
+ ArgumentList: &node.ArgumentList{},
},
},
&stmt.Expression{
@@ -2457,15 +2482,15 @@ func TestPhp5(t *testing.T) {
&name.NamePart{Value: "Foo"},
},
},
- Call: &expr.Variable{VarName: &node.Identifier{Value: "bar"}},
- Arguments: []node.Node{},
+ Call: &expr.Variable{VarName: &node.Identifier{Value: "bar"}},
+ ArgumentList: &node.ArgumentList{},
},
},
&stmt.Expression{
Expr: &expr.StaticCall{
- Class: &expr.Variable{VarName: &node.Identifier{Value: "foo"}},
- Call: &expr.Variable{VarName: &node.Identifier{Value: "bar"}},
- Arguments: []node.Node{},
+ Class: &expr.Variable{VarName: &node.Identifier{Value: "foo"}},
+ Call: &expr.Variable{VarName: &node.Identifier{Value: "bar"}},
+ ArgumentList: &node.ArgumentList{},
},
},
&stmt.Expression{
@@ -2815,11 +2840,13 @@ func TestPhp5(t *testing.T) {
&name.NamePart{Value: "Foo"},
},
},
- Arguments: []node.Node{
- &node.Argument{
- Variadic: false,
- IsReference: false,
- Expr: &expr.Variable{VarName: &node.Identifier{Value: "b"}},
+ ArgumentList: &node.ArgumentList{
+ Arguments: []node.Node{
+ &node.Argument{
+ Variadic: false,
+ IsReference: false,
+ Expr: &expr.Variable{VarName: &node.Identifier{Value: "b"}},
+ },
},
},
},
@@ -2910,7 +2937,7 @@ func TestPhp5(t *testing.T) {
&name.NamePart{Value: "Foo"},
},
},
- Arguments: []node.Node{},
+ ArgumentList: &node.ArgumentList{},
},
},
&stmt.Expression{
@@ -2922,10 +2949,10 @@ func TestPhp5(t *testing.T) {
&name.NamePart{Value: "Foo"},
},
},
- Arguments: []node.Node{},
+ ArgumentList: &node.ArgumentList{},
},
- Method: &node.Identifier{Value: "bar"},
- Arguments: []node.Node{},
+ Method: &node.Identifier{Value: "bar"},
+ ArgumentList: &node.ArgumentList{},
},
Property: &node.Identifier{Value: "baz"},
},
@@ -2939,7 +2966,7 @@ func TestPhp5(t *testing.T) {
&name.NamePart{Value: "Foo"},
},
},
- Arguments: []node.Node{},
+ ArgumentList: &node.ArgumentList{},
},
Dim: &scalar.Lnumber{Value: "0"},
},
@@ -2955,12 +2982,12 @@ func TestPhp5(t *testing.T) {
&name.NamePart{Value: "Foo"},
},
},
- Arguments: []node.Node{},
+ ArgumentList: &node.ArgumentList{},
},
Dim: &scalar.Lnumber{Value: "0"},
},
- Method: &node.Identifier{Value: "bar"},
- Arguments: []node.Node{},
+ Method: &node.Identifier{Value: "bar"},
+ ArgumentList: &node.ArgumentList{},
},
},
&stmt.Expression{
@@ -2969,12 +2996,10 @@ func TestPhp5(t *testing.T) {
Variable: &expr.Array{
Items: []node.Node{
&expr.ArrayItem{
- ByRef: false,
Val: &expr.ShortArray{
Items: []node.Node{
&expr.ArrayItem{
- ByRef: false,
- Val: &scalar.Lnumber{Value: "0"},
+ Val: &scalar.Lnumber{Value: "0"},
},
},
},
@@ -3071,8 +3096,7 @@ func TestPhp5(t *testing.T) {
Variable: &expr.ShortArray{
Items: []node.Node{
&expr.ArrayItem{
- ByRef: false,
- Val: &scalar.Lnumber{Value: "1"},
+ Val: &scalar.Lnumber{Value: "1"},
},
},
},
@@ -3522,13 +3546,11 @@ func TestPhp5(t *testing.T) {
Expr: &expr.Array{
Items: []node.Node{
&expr.ArrayItem{
- ByRef: false,
- Key: &scalar.Lnumber{Value: "1"},
- Val: &scalar.Lnumber{Value: "1"},
+ Key: &scalar.Lnumber{Value: "1"},
+ Val: &scalar.Lnumber{Value: "1"},
},
&expr.ArrayItem{
- ByRef: false,
- Val: &scalar.Lnumber{Value: "2"},
+ Val: &scalar.Lnumber{Value: "2"},
},
},
},
@@ -3543,13 +3565,11 @@ func TestPhp5(t *testing.T) {
Variable: &expr.ShortArray{
Items: []node.Node{
&expr.ArrayItem{
- ByRef: false,
- Val: &scalar.Lnumber{Value: "1"},
+ Val: &scalar.Lnumber{Value: "1"},
},
&expr.ArrayItem{
- ByRef: false,
- Key: &scalar.Lnumber{Value: "2"},
- Val: &scalar.Lnumber{Value: "2"},
+ Key: &scalar.Lnumber{Value: "2"},
+ Val: &scalar.Lnumber{Value: "2"},
},
},
},
@@ -3574,16 +3594,16 @@ func TestPhp5(t *testing.T) {
},
&stmt.Expression{
Expr: &expr.FunctionCall{
- Function: &expr.Variable{VarName: &node.Identifier{Value: "foo"}},
- Arguments: []node.Node{},
+ Function: &expr.Variable{VarName: &node.Identifier{Value: "foo"}},
+ ArgumentList: &node.ArgumentList{},
},
},
&stmt.Expression{
Expr: &expr.ArrayDimFetch{
Variable: &expr.ArrayDimFetch{
Variable: &expr.FunctionCall{
- Function: &expr.Variable{VarName: &node.Identifier{Value: "foo"}},
- Arguments: []node.Node{},
+ Function: &expr.Variable{VarName: &node.Identifier{Value: "foo"}},
+ ArgumentList: &node.ArgumentList{},
},
Dim: &scalar.Lnumber{Value: "0"},
},
@@ -3601,9 +3621,9 @@ func TestPhp5(t *testing.T) {
},
&stmt.Expression{
Expr: &expr.StaticCall{
- Class: &expr.Variable{VarName: &node.Identifier{Value: "foo"}},
- Call: &expr.Variable{VarName: &node.Identifier{Value: "bar"}},
- Arguments: []node.Node{},
+ Class: &expr.Variable{VarName: &node.Identifier{Value: "foo"}},
+ Call: &expr.Variable{VarName: &node.Identifier{Value: "bar"}},
+ ArgumentList: &node.ArgumentList{},
},
},
&stmt.Expression{
@@ -3634,7 +3654,7 @@ func TestPhp5Strings(t *testing.T) {
';
`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Expression{
Expr: &scalar.String{Value: "\"test\""},
@@ -3678,7 +3698,7 @@ CAD;
CAD;
`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Expression{
Expr: &scalar.Heredoc{
diff --git a/php7/parser.go b/php7/parser.go
index 62f9de7..1b153f3 100644
--- a/php7/parser.go
+++ b/php7/parser.go
@@ -3,15 +3,13 @@ package php7
import (
"io"
- "github.com/z7zmey/php-parser/comment"
"github.com/z7zmey/php-parser/errors"
"github.com/z7zmey/php-parser/node"
- "github.com/z7zmey/php-parser/position"
+ "github.com/z7zmey/php-parser/parser"
"github.com/z7zmey/php-parser/scanner"
- "github.com/z7zmey/php-parser/token"
)
-func (lval *yySymType) Token(t token.Token) {
+func (lval *yySymType) Token(t *scanner.Token) {
lval.token = t
}
@@ -19,12 +17,12 @@ func (lval *yySymType) Token(t token.Token) {
type Parser struct {
*scanner.Lexer
path string
- lastToken *token.Token
- positionBuilder *position.Builder
+ currentToken *scanner.Token
+ positionBuilder *parser.PositionBuilder
errors []*errors.Error
rootNode node.Node
- comments comment.Comments
- positions position.Positions
+ comments parser.Comments
+ positions parser.Positions
}
// NewParser creates and returns new Parser
@@ -46,12 +44,12 @@ func NewParser(src io.Reader, path string) *Parser {
// Lex proxy to lexer Lex
func (l *Parser) Lex(lval *yySymType) int {
t := l.Lexer.Lex(lval)
- l.lastToken = &lval.token
+ l.currentToken = lval.token
return t
}
func (l *Parser) Error(msg string) {
- l.errors = append(l.errors, errors.NewError(msg, *l.lastToken))
+ l.errors = append(l.errors, errors.NewError(msg, l.currentToken))
}
// Parse the php7 Parser entrypoint
@@ -59,9 +57,9 @@ func (l *Parser) Parse() int {
// init
l.errors = nil
l.rootNode = nil
- l.comments = comment.Comments{}
- l.positions = position.Positions{}
- l.positionBuilder = &position.Builder{
+ l.comments = parser.Comments{}
+ l.positions = parser.Positions{}
+ l.positionBuilder = &parser.PositionBuilder{
Positions: &l.positions,
}
@@ -70,16 +68,6 @@ func (l *Parser) Parse() int {
return yyParse(l)
}
-func (l *Parser) listGetFirstNodeComments(list []node.Node) []comment.Comment {
- if len(list) == 0 {
- return nil
- }
-
- node := list[0]
-
- return l.comments[node]
-}
-
// GetPath return path to file
func (l *Parser) GetPath() string {
return l.path
@@ -96,11 +84,21 @@ func (l *Parser) GetErrors() []*errors.Error {
}
// GetComments returns comments list
-func (l *Parser) GetComments() comment.Comments {
+func (l *Parser) GetComments() parser.Comments {
return l.comments
}
// GetPositions returns positions list
-func (l *Parser) GetPositions() position.Positions {
+func (l *Parser) GetPositions() parser.Positions {
return l.positions
}
+
+// helpers
+
+func lastNode(nn []node.Node) node.Node {
+ return nn[len(nn)-1]
+}
+
+func firstNode(nn []node.Node) node.Node {
+ return nn[0]
+}
diff --git a/php7/php7.go b/php7/php7.go
index 8f1d4b2..49ad011 100644
--- a/php7/php7.go
+++ b/php7/php7.go
@@ -8,6 +8,7 @@ import (
"strconv"
"strings"
+ "github.com/z7zmey/php-parser/comment"
"github.com/z7zmey/php-parser/node"
"github.com/z7zmey/php-parser/node/expr"
"github.com/z7zmey/php-parser/node/expr/assign"
@@ -16,20 +17,21 @@ import (
"github.com/z7zmey/php-parser/node/name"
"github.com/z7zmey/php-parser/node/scalar"
"github.com/z7zmey/php-parser/node/stmt"
- "github.com/z7zmey/php-parser/token"
+ "github.com/z7zmey/php-parser/scanner"
)
-//line php7/php7.y:21
+//line php7/php7.y:22
type yySymType struct {
- yys int
- node node.Node
- token token.Token
- boolWithToken boolWithToken
- list []node.Node
- foreachVariable foreachVariable
- nodesWithEndToken *nodesWithEndToken
- str string
- altSyntaxNode altSyntaxNode
+ yys int
+ node node.Node
+ token *scanner.Token
+ list []node.Node
+ str string
+
+ ClassExtends *stmt.ClassExtends
+ ClassImplements *stmt.ClassImplements
+ InterfaceExtends *stmt.InterfaceExtends
+ ClosureUse *expr.ClosureUse
}
const T_INCLUDE = 57346
@@ -148,26 +150,26 @@ const T_NOELSE = 57458
const T_PLUS_EQUAL = 57459
const T_MINUS_EQUAL = 57460
const T_MUL_EQUAL = 57461
-const T_DIV_EQUAL = 57462
-const T_CONCAT_EQUAL = 57463
-const T_MOD_EQUAL = 57464
-const T_AND_EQUAL = 57465
-const T_OR_EQUAL = 57466
-const T_XOR_EQUAL = 57467
-const T_SL_EQUAL = 57468
-const T_SR_EQUAL = 57469
-const T_POW_EQUAL = 57470
+const T_POW_EQUAL = 57462
+const T_DIV_EQUAL = 57463
+const T_CONCAT_EQUAL = 57464
+const T_MOD_EQUAL = 57465
+const T_AND_EQUAL = 57466
+const T_OR_EQUAL = 57467
+const T_XOR_EQUAL = 57468
+const T_SL_EQUAL = 57469
+const T_SR_EQUAL = 57470
const T_BOOLEAN_OR = 57471
const T_BOOLEAN_AND = 57472
-const T_IS_EQUAL = 57473
-const T_IS_NOT_EQUAL = 57474
-const T_IS_IDENTICAL = 57475
-const T_IS_NOT_IDENTICAL = 57476
-const T_IS_SMALLER_OR_EQUAL = 57477
-const T_IS_GREATER_OR_EQUAL = 57478
-const T_SL = 57479
-const T_SR = 57480
-const T_POW = 57481
+const T_POW = 57473
+const T_SL = 57474
+const T_SR = 57475
+const T_IS_IDENTICAL = 57476
+const T_IS_NOT_IDENTICAL = 57477
+const T_IS_EQUAL = 57478
+const T_IS_NOT_EQUAL = 57479
+const T_IS_SMALLER_OR_EQUAL = 57480
+const T_IS_GREATER_OR_EQUAL = 57481
var yyToknames = [...]string{
"$end",
@@ -286,6 +288,29 @@ var yyToknames = [...]string{
"T_COALESCE",
"T_SPACESHIP",
"T_NOELSE",
+ "T_PLUS_EQUAL",
+ "T_MINUS_EQUAL",
+ "T_MUL_EQUAL",
+ "T_POW_EQUAL",
+ "T_DIV_EQUAL",
+ "T_CONCAT_EQUAL",
+ "T_MOD_EQUAL",
+ "T_AND_EQUAL",
+ "T_OR_EQUAL",
+ "T_XOR_EQUAL",
+ "T_SL_EQUAL",
+ "T_SR_EQUAL",
+ "T_BOOLEAN_OR",
+ "T_BOOLEAN_AND",
+ "T_POW",
+ "T_SL",
+ "T_SR",
+ "T_IS_IDENTICAL",
+ "T_IS_NOT_IDENTICAL",
+ "T_IS_EQUAL",
+ "T_IS_NOT_EQUAL",
+ "T_IS_SMALLER_OR_EQUAL",
+ "T_IS_GREATER_OR_EQUAL",
"'\"'",
"'`'",
"'{'",
@@ -305,38 +330,15 @@ var yyToknames = [...]string{
"'@'",
"'$'",
"','",
- "'='",
- "T_PLUS_EQUAL",
- "T_MINUS_EQUAL",
- "T_MUL_EQUAL",
- "T_DIV_EQUAL",
- "T_CONCAT_EQUAL",
- "T_MOD_EQUAL",
- "T_AND_EQUAL",
- "T_OR_EQUAL",
- "T_XOR_EQUAL",
- "T_SL_EQUAL",
- "T_SR_EQUAL",
- "T_POW_EQUAL",
- "T_BOOLEAN_OR",
- "T_BOOLEAN_AND",
"'|'",
+ "'='",
"'^'",
- "T_IS_EQUAL",
- "T_IS_NOT_EQUAL",
- "T_IS_IDENTICAL",
- "T_IS_NOT_IDENTICAL",
- "'<'",
- "T_IS_SMALLER_OR_EQUAL",
- "'>'",
- "T_IS_GREATER_OR_EQUAL",
- "T_SL",
- "T_SR",
- "'.'",
"'*'",
"'/'",
"'%'",
- "T_POW",
+ "'<'",
+ "'>'",
+ "'.'",
}
var yyStatenames = [...]string{}
@@ -344,27 +346,7 @@ const yyEofCode = 1
const yyErrCode = 2
const yyInitialStackSize = 16
-//line php7/php7.y:2635
-
-type foreachVariable struct {
- node node.Node
- byRef bool
-}
-
-type nodesWithEndToken struct {
- nodes []node.Node
- endToken token.Token
-}
-
-type boolWithToken struct {
- value bool
- token *token.Token
-}
-
-type altSyntaxNode struct {
- node node.Node
- isAlt bool
-}
+//line php7/php7.y:4306
//line yacctab:1
var yyExca = [...]int{
@@ -377,18 +359,18 @@ var yyExca = [...]int{
-1, 44,
57, 422,
78, 422,
- 119, 422,
- 125, 422,
+ 142, 422,
+ 148, 422,
-2, 417,
-1, 48,
- 123, 425,
+ 146, 425,
-2, 434,
-1, 84,
57, 424,
78, 424,
- 119, 424,
- 123, 427,
- 125, 424,
+ 142, 424,
+ 146, 427,
+ 148, 424,
-2, 412,
-1, 107,
78, 385,
@@ -396,127 +378,127 @@ var yyExca = [...]int{
-1, 229,
57, 422,
78, 422,
- 119, 422,
- 125, 422,
+ 142, 422,
+ 148, 422,
-2, 313,
-1, 232,
- 123, 427,
+ 146, 427,
-2, 424,
-1, 235,
57, 422,
78, 422,
- 119, 422,
- 125, 422,
+ 142, 422,
+ 148, 422,
-2, 315,
-1, 354,
115, 0,
- 153, 0,
- 154, 0,
- 155, 0,
- 156, 0,
+ 134, 0,
+ 135, 0,
+ 136, 0,
+ 137, 0,
-2, 337,
-1, 355,
115, 0,
- 153, 0,
- 154, 0,
- 155, 0,
- 156, 0,
+ 134, 0,
+ 135, 0,
+ 136, 0,
+ 137, 0,
-2, 338,
-1, 356,
115, 0,
- 153, 0,
- 154, 0,
- 155, 0,
- 156, 0,
+ 134, 0,
+ 135, 0,
+ 136, 0,
+ 137, 0,
-2, 339,
-1, 357,
115, 0,
- 153, 0,
- 154, 0,
- 155, 0,
- 156, 0,
+ 134, 0,
+ 135, 0,
+ 136, 0,
+ 137, 0,
-2, 340,
-1, 358,
- 157, 0,
- 158, 0,
- 159, 0,
- 160, 0,
+ 138, 0,
+ 139, 0,
+ 165, 0,
+ 166, 0,
-2, 341,
-1, 359,
- 157, 0,
- 158, 0,
- 159, 0,
- 160, 0,
+ 138, 0,
+ 139, 0,
+ 165, 0,
+ 166, 0,
-2, 342,
-1, 360,
- 157, 0,
- 158, 0,
- 159, 0,
- 160, 0,
+ 138, 0,
+ 139, 0,
+ 165, 0,
+ 166, 0,
-2, 343,
-1, 361,
- 157, 0,
- 158, 0,
- 159, 0,
- 160, 0,
+ 138, 0,
+ 139, 0,
+ 165, 0,
+ 166, 0,
-2, 344,
-1, 362,
115, 0,
- 153, 0,
- 154, 0,
- 155, 0,
- 156, 0,
+ 134, 0,
+ 135, 0,
+ 136, 0,
+ 137, 0,
-2, 345,
-1, 369,
- 124, 163,
- 135, 163,
+ 147, 163,
+ 158, 163,
-2, 422,
-1, 413,
- 124, 462,
- 126, 462,
- 135, 462,
+ 147, 462,
+ 149, 462,
+ 158, 462,
-2, 422,
-1, 417,
57, 423,
78, 423,
- 119, 423,
- 123, 426,
- 125, 423,
+ 142, 423,
+ 146, 426,
+ 148, 423,
-2, 347,
-1, 431,
- 123, 448,
+ 146, 448,
-2, 415,
-1, 432,
- 123, 450,
+ 146, 450,
-2, 440,
-1, 511,
- 123, 448,
+ 146, 448,
-2, 416,
-1, 512,
- 123, 450,
+ 146, 450,
-2, 441,
-1, 571,
- 124, 213,
+ 147, 213,
-2, 218,
-1, 596,
- 123, 426,
+ 146, 426,
-2, 423,
-1, 648,
- 124, 213,
+ 147, 213,
-2, 218,
-1, 653,
- 124, 183,
+ 147, 183,
-2, 422,
-1, 661,
- 124, 213,
+ 147, 213,
-2, 218,
-1, 686,
- 124, 461,
- 126, 461,
- 135, 461,
+ 147, 461,
+ 149, 461,
+ 158, 461,
-2, 422,
-1, 719,
- 124, 184,
+ 147, 184,
-2, 422,
-1, 739,
12, 265,
@@ -527,10 +509,10 @@ var yyExca = [...]int{
95, 208,
-2, 0,
-1, 778,
- 124, 183,
+ 147, 183,
-2, 422,
-1, 780,
- 124, 186,
+ 147, 186,
-2, 396,
-1, 800,
93, 209,
@@ -541,7 +523,7 @@ var yyExca = [...]int{
31, 199,
32, 199,
33, 199,
- 120, 199,
+ 143, 199,
-2, 0,
-1, 882,
29, 76,
@@ -550,16 +532,16 @@ var yyExca = [...]int{
31, 198,
32, 198,
33, 198,
- 120, 198,
+ 143, 198,
-2, 0,
-1, 914,
- 124, 213,
+ 147, 213,
-2, 218,
}
const yyPrivate = 57344
-const yyLast = 7331
+const yyLast = 7805
var yyAct = [...]int{
@@ -571,143 +553,199 @@ var yyAct = [...]int{
132, 189, 8, 225, 228, 128, 143, 236, 237, 238,
239, 240, 147, 2, 241, 242, 243, 244, 245, 246,
247, 127, 250, 125, 513, 258, 259, 260, 315, 314,
- 137, 7, 6, 430, 264, 165, 854, 870, 864, 273,
- 274, 892, 276, 277, 842, 684, 841, 269, 230, 230,
- 82, 868, 893, 140, 141, 835, 179, 406, 832, 105,
- 677, 541, 590, 568, 335, 869, 331, 334, 309, 254,
- 105, 111, 833, 677, 308, 302, 329, 759, 336, 307,
- 332, 301, 319, 115, 121, 704, 324, 325, 84, 728,
- 330, 44, 306, 308, 626, 302, 621, 105, 566, 285,
- 287, 190, 556, 411, 337, 338, 339, 340, 341, 342,
+ 137, 7, 6, 430, 264, 870, 864, 684, 835, 273,
+ 274, 854, 276, 277, 842, 590, 841, 269, 230, 230,
+ 82, 334, 309, 140, 141, 406, 892, 105, 868, 832,
+ 677, 541, 335, 568, 331, 329, 307, 893, 677, 254,
+ 759, 111, 869, 833, 308, 302, 336, 704, 332, 330,
+ 308, 301, 319, 115, 121, 728, 324, 325, 84, 626,
+ 621, 44, 306, 105, 566, 302, 556, 411, 105, 285,
+ 287, 190, 862, 730, 337, 338, 339, 340, 341, 342,
343, 344, 345, 346, 347, 348, 349, 350, 351, 352,
353, 354, 355, 356, 357, 358, 359, 360, 361, 362,
- 295, 364, 366, 165, 370, 321, 266, 372, 730, 780,
- 219, 269, 862, 232, 232, 693, 229, 235, 333, 79,
- 424, 380, 388, 390, 391, 392, 393, 394, 395, 396,
- 397, 398, 399, 400, 401, 689, 407, 402, 138, 404,
- 179, 225, 610, 261, 144, 855, 230, 283, 179, 384,
- 597, 106, 415, 606, 290, 225, 292, 600, 607, 603,
- 601, 299, 106, 585, 305, 410, 926, 409, 888, 820,
- 138, 819, 218, 809, 826, 801, 371, 425, 217, 163,
- 162, 416, 138, 784, 363, 773, 431, 511, 423, 106,
- 230, 727, 523, 524, 717, 698, 525, 179, 696, 688,
- 266, 650, 638, 628, 529, 270, 598, 533, 117, 225,
- 589, 168, 169, 161, 164, 166, 167, 165, 403, 291,
- 914, 230, 164, 166, 167, 165, 284, 828, 863, 782,
- 551, 813, 812, 920, 720, 535, 163, 162, 687, 661,
- 306, 232, 648, 646, 369, 286, 647, 5, 571, 554,
- 418, 552, 414, 385, 383, 561, 288, 151, 669, 670,
- 560, 9, 429, 520, 275, 8, 272, 510, 518, 271,
- 161, 164, 166, 167, 165, 249, 602, 134, 538, 220,
- 112, 117, 216, 105, 550, 232, 564, 184, 413, 519,
- 289, 183, 420, 421, 7, 6, 544, 182, 136, 270,
- 135, 131, 570, 562, 580, 113, 581, 558, 577, 582,
- 583, 575, 751, 387, 579, 559, 232, 188, 420, 427,
- 421, 421, 420, 268, 903, 668, 179, 294, 588, 293,
- 517, 902, 225, 592, 887, 225, 516, 850, 930, 408,
- 929, 821, 543, 815, 546, 572, 157, 156, 179, 609,
- 134, 808, 765, 112, 612, 752, 768, 769, 768, 769,
- 716, 595, 714, 712, 710, 163, 162, 587, 707, 233,
- 555, 540, 181, 178, 537, 738, 591, 386, 740, 120,
- 374, 328, 432, 512, 327, 180, 159, 163, 162, 326,
- 296, 909, 611, 174, 175, 176, 177, 168, 169, 161,
- 164, 166, 167, 165, 844, 106, 807, 153, 154, 158,
- 160, 172, 173, 170, 171, 174, 175, 176, 177, 168,
- 169, 161, 164, 166, 167, 165, 214, 215, 804, 745,
- 746, 747, 744, 743, 742, 802, 761, 138, 616, 738,
- 536, 117, 740, 105, 814, 608, 767, 886, 859, 110,
- 144, 883, 117, 536, 857, 627, 803, 536, 201, 202,
- 203, 204, 206, 207, 208, 209, 210, 211, 212, 213,
- 205, 620, 613, 790, 783, 642, 324, 644, 637, 617,
- 733, 625, 676, 536, 649, 306, 576, 634, 619, 185,
- 5, 109, 419, 745, 746, 747, 744, 743, 742, 298,
- 673, 789, 674, 671, 9, 640, 579, 255, 8, 643,
- 134, 685, 422, 112, 304, 865, 304, 615, 117, 117,
- 658, 105, 196, 197, 114, 651, 114, 289, 691, 233,
- 230, 230, 672, 198, 200, 199, 681, 7, 6, 117,
- 906, 117, 523, 253, 117, 123, 124, 533, 515, 702,
- 191, 117, 263, 304, 231, 262, 234, 230, 718, 574,
- 379, 116, 636, 708, 304, 106, 630, 289, 382, 631,
- 701, 256, 257, 715, 304, 705, 634, 225, 904, 695,
- 671, 722, 703, 699, 697, 46, 726, 546, 134, 546,
- 122, 112, 547, 671, 706, 786, 713, 77, 78, 732,
- 671, 669, 670, 721, 753, 754, 549, 233, 225, 749,
- 134, 545, 528, 112, 748, 255, 300, 542, 230, 146,
- 134, 731, 757, 112, 192, 232, 232, 303, 369, 653,
- 750, 324, 255, 905, 755, 614, 320, 422, 408, 618,
- 690, 225, 701, 106, 634, 894, 762, 280, 281, 794,
- 758, 829, 232, 760, 148, 686, 763, 724, 725, 777,
- 671, 770, 255, 772, 766, 117, 797, 779, 798, 775,
- 579, 791, 546, 800, 787, 796, 795, 546, 546, 256,
- 257, 148, 230, 745, 746, 747, 744, 743, 742, 810,
- 117, 635, 123, 124, 604, 527, 256, 257, 818, 805,
- 129, 816, 768, 769, 119, 824, 146, 548, 827, 536,
- 806, 377, 817, 232, 823, 375, 719, 1, 195, 255,
- 194, 834, 193, 845, 278, 526, 256, 257, 830, 639,
- 187, 255, 38, 849, 739, 736, 422, 771, 768, 769,
- 851, 843, 737, 381, 546, 255, 546, 848, 663, 531,
- 282, 222, 521, 860, 853, 367, 867, 738, 671, 255,
- 740, 846, 858, 871, 252, 873, 880, 866, 839, 884,
- 885, 775, 145, 792, 879, 142, 323, 232, 149, 890,
- 778, 891, 279, 256, 257, 895, 836, 889, 660, 822,
- 251, 898, 840, 645, 896, 256, 257, 880, 899, 928,
- 224, 546, 897, 43, 901, 879, 42, 16, 908, 256,
- 257, 745, 746, 747, 744, 743, 742, 15, 599, 912,
- 267, 49, 48, 256, 257, 913, 108, 50, 83, 81,
- 919, 922, 915, 831, 918, 917, 579, 72, 248, 923,
- 62, 265, 924, 61, 878, 877, 671, 876, 875, 927,
- 735, 4, 931, 88, 89, 70, 47, 93, 94, 36,
- 45, 105, 665, 27, 723, 657, 310, 110, 26, 18,
- 17, 118, 19, 297, 30, 3, 31, 435, 788, 20,
- 729, 0, 0, 21, 22, 35, 37, 13, 23, 33,
+ 295, 364, 366, 219, 370, 321, 266, 372, 780, 693,
+ 689, 269, 610, 232, 232, 606, 229, 235, 333, 79,
+ 607, 380, 388, 390, 391, 392, 393, 394, 395, 396,
+ 397, 398, 399, 400, 401, 597, 585, 402, 138, 404,
+ 424, 225, 179, 410, 144, 600, 230, 603, 601, 384,
+ 261, 926, 415, 888, 290, 225, 292, 407, 855, 820,
+ 179, 299, 826, 819, 305, 809, 801, 409, 518, 784,
+ 138, 773, 106, 727, 717, 698, 371, 425, 696, 688,
+ 650, 416, 138, 165, 363, 638, 431, 511, 218, 519,
+ 230, 628, 523, 524, 217, 598, 525, 589, 283, 914,
+ 266, 165, 168, 169, 529, 270, 291, 533, 106, 225,
+ 117, 863, 105, 106, 164, 166, 167, 828, 403, 813,
+ 812, 230, 163, 162, 782, 720, 284, 687, 661, 289,
+ 551, 423, 164, 166, 167, 535, 648, 161, 286, 646,
+ 306, 232, 647, 751, 369, 571, 554, 5, 552, 414,
+ 418, 385, 268, 517, 383, 561, 288, 151, 275, 516,
+ 560, 9, 429, 520, 179, 8, 272, 510, 271, 249,
+ 220, 216, 184, 183, 117, 182, 105, 136, 538, 134,
+ 135, 387, 112, 131, 550, 232, 564, 602, 413, 294,
+ 113, 293, 420, 421, 7, 6, 544, 188, 233, 270,
+ 920, 903, 570, 562, 580, 165, 581, 558, 577, 582,
+ 583, 575, 768, 769, 579, 559, 232, 902, 420, 427,
+ 421, 421, 420, 930, 887, 929, 163, 162, 588, 850,
+ 821, 179, 225, 592, 815, 225, 164, 166, 167, 408,
+ 808, 161, 543, 134, 546, 572, 112, 768, 769, 609,
+ 765, 752, 716, 714, 612, 712, 710, 106, 707, 555,
+ 540, 595, 233, 537, 386, 374, 328, 587, 155, 157,
+ 156, 179, 165, 168, 169, 327, 591, 326, 296, 175,
+ 177, 117, 432, 512, 536, 844, 807, 804, 802, 761,
+ 536, 536, 611, 163, 162, 181, 178, 608, 909, 886,
+ 859, 117, 536, 164, 166, 167, 174, 176, 161, 857,
+ 153, 154, 165, 168, 169, 170, 171, 172, 173, 175,
+ 177, 106, 179, 814, 803, 813, 812, 790, 783, 733,
+ 255, 180, 159, 163, 162, 422, 676, 138, 616, 576,
+ 158, 185, 160, 164, 166, 167, 174, 176, 161, 419,
+ 144, 669, 670, 114, 165, 627, 253, 304, 767, 198,
+ 200, 199, 789, 165, 114, 120, 304, 191, 196, 197,
+ 134, 620, 613, 112, 117, 642, 324, 644, 637, 617,
+ 304, 625, 117, 117, 649, 306, 304, 634, 619, 289,
+ 5, 304, 906, 718, 256, 257, 574, 515, 263, 117,
+ 673, 262, 674, 671, 9, 640, 579, 379, 8, 643,
+ 289, 685, 904, 116, 77, 78, 702, 615, 382, 631,
+ 658, 786, 636, 630, 146, 651, 123, 124, 691, 905,
+ 230, 230, 672, 549, 547, 320, 681, 7, 6, 542,
+ 690, 668, 523, 134, 303, 894, 112, 533, 117, 46,
+ 105, 255, 724, 725, 545, 300, 110, 230, 528, 794,
+ 280, 281, 829, 708, 745, 746, 747, 744, 743, 742,
+ 701, 122, 148, 715, 117, 705, 634, 225, 148, 695,
+ 671, 722, 703, 699, 697, 298, 726, 546, 192, 546,
+ 796, 795, 117, 671, 706, 604, 713, 146, 109, 732,
+ 671, 123, 124, 721, 753, 754, 635, 117, 225, 749,
+ 816, 768, 769, 129, 748, 256, 257, 134, 230, 119,
+ 112, 731, 757, 548, 536, 232, 232, 255, 369, 653,
+ 750, 324, 422, 377, 755, 614, 233, 255, 408, 618,
+ 375, 225, 701, 195, 634, 194, 762, 771, 768, 769,
+ 758, 193, 232, 760, 187, 686, 763, 669, 670, 777,
+ 671, 770, 1, 772, 766, 38, 797, 779, 798, 775,
+ 579, 791, 546, 800, 787, 739, 134, 546, 546, 112,
+ 736, 737, 230, 663, 231, 531, 234, 222, 521, 810,
+ 527, 256, 257, 860, 738, 106, 367, 740, 818, 805,
+ 526, 256, 257, 873, 145, 824, 792, 142, 827, 323,
+ 806, 149, 817, 232, 823, 836, 719, 660, 822, 255,
+ 251, 834, 381, 639, 278, 255, 845, 928, 830, 645,
+ 422, 255, 840, 849, 224, 43, 282, 42, 16, 15,
+ 851, 843, 599, 267, 546, 49, 546, 848, 745, 746,
+ 747, 744, 743, 742, 853, 48, 867, 108, 671, 255,
+ 50, 846, 858, 871, 252, 83, 880, 866, 839, 884,
+ 885, 775, 81, 72, 879, 248, 62, 232, 265, 890,
+ 778, 891, 279, 256, 257, 895, 61, 889, 878, 256,
+ 257, 898, 877, 883, 896, 256, 257, 880, 899, 876,
+ 875, 546, 897, 735, 901, 879, 45, 665, 908, 723,
+ 657, 310, 118, 297, 3, 435, 788, 729, 0, 912,
+ 0, 0, 0, 256, 257, 913, 0, 0, 0, 0,
+ 919, 922, 915, 0, 918, 917, 579, 0, 0, 923,
+ 0, 0, 924, 0, 0, 0, 671, 0, 0, 927,
+ 0, 4, 931, 88, 89, 70, 47, 93, 94, 36,
+ 0, 105, 0, 27, 0, 0, 0, 110, 26, 18,
+ 17, 0, 19, 0, 30, 0, 31, 0, 0, 20,
+ 0, 0, 0, 21, 22, 35, 37, 13, 23, 33,
0, 0, 34, 12, 0, 24, 0, 29, 86, 87,
10, 39, 40, 41, 0, 0, 0, 0, 51, 109,
- 0, 102, 98, 99, 100, 95, 96, 0, 0, 0,
- 0, 0, 0, 103, 0, 0, 0, 0, 11, 101,
+ 0, 102, 98, 99, 100, 95, 96, 738, 0, 0,
+ 740, 0, 0, 103, 0, 0, 0, 0, 11, 101,
97, 112, 0, 90, 91, 92, 0, 0, 0, 0,
85, 53, 0, 0, 0, 74, 75, 25, 77, 78,
0, 0, 0, 54, 55, 76, 63, 64, 65, 66,
- 67, 68, 69, 0, 0, 0, 104, 73, 14, 629,
- 32, 0, 60, 0, 52, 0, 0, 0, 57, 56,
- 58, 59, 71, 106, 4, 0, 88, 89, 70, 47,
- 93, 94, 36, 0, 105, 0, 27, 0, 0, 0,
- 110, 26, 18, 17, 0, 19, 0, 30, 0, 31,
- 0, 0, 20, 0, 0, 0, 21, 22, 35, 37,
- 13, 23, 33, 0, 0, 34, 12, 0, 24, 0,
- 29, 86, 87, 10, 39, 40, 41, 0, 0, 0,
- 0, 51, 109, 0, 102, 98, 99, 100, 95, 96,
- 0, 0, 0, 0, 0, 0, 103, 0, 0, 0,
- 0, 11, 101, 97, 112, 0, 90, 91, 92, 0,
- 0, 0, 0, 85, 53, 0, 0, 0, 74, 75,
- 25, 77, 78, 0, 0, 0, 54, 55, 76, 63,
- 64, 65, 66, 67, 68, 69, 0, 0, 0, 104,
- 73, 14, 539, 32, 0, 60, 0, 52, 0, 0,
+ 67, 68, 69, 0, 214, 215, 0, 0, 0, 0,
+ 0, 745, 746, 747, 744, 743, 742, 202, 203, 204,
+ 205, 206, 207, 208, 209, 210, 211, 212, 213, 104,
+ 73, 14, 629, 32, 0, 60, 0, 52, 0, 0,
0, 57, 56, 58, 59, 71, 106, 4, 0, 88,
- 89, 70, 47, 93, 94, 36, 0, 105, 0, 27,
- 0, 0, 0, 110, 26, 18, 17, 0, 19, 0,
+ 89, 70, 47, 93, 94, 36, 865, 105, 0, 27,
+ 201, 0, 0, 110, 26, 18, 17, 0, 19, 0,
30, 0, 31, 0, 0, 20, 0, 0, 0, 21,
22, 35, 37, 13, 23, 33, 0, 0, 34, 12,
0, 24, 0, 29, 86, 87, 10, 39, 40, 41,
0, 0, 0, 0, 51, 109, 0, 102, 98, 99,
- 100, 95, 96, 0, 0, 0, 0, 0, 0, 103,
+ 100, 95, 96, 738, 0, 0, 740, 0, 0, 103,
0, 0, 0, 0, 11, 101, 97, 112, 0, 90,
91, 92, 0, 0, 0, 0, 85, 53, 0, 0,
0, 74, 75, 25, 77, 78, 0, 0, 0, 54,
55, 76, 63, 64, 65, 66, 67, 68, 69, 0,
- 0, 0, 104, 73, 14, 0, 32, 0, 60, 0,
- 52, 0, 0, 0, 57, 56, 58, 59, 71, 106,
- 312, 0, 88, 89, 70, 47, 93, 94, 36, 0,
- 105, 0, 27, 0, 0, 0, 110, 26, 18, 17,
- 0, 19, 0, 30, 0, 31, 0, 0, 20, 0,
- 0, 0, 21, 22, 35, 37, 0, 23, 33, 0,
- 0, 34, 0, 0, 24, 0, 29, 86, 87, 318,
- 39, 40, 41, 0, 0, 0, 0, 51, 109, 0,
- 102, 98, 99, 100, 95, 96, 0, 0, 0, 0,
- 0, 0, 103, 0, 0, 0, 0, 134, 101, 97,
- 112, 0, 90, 91, 92, 0, 0, 0, 0, 85,
- 53, 0, 0, 0, 74, 75, 25, 77, 78, 0,
- 0, 0, 54, 55, 76, 63, 64, 65, 66, 67,
- 68, 69, 0, 0, 0, 104, 73, 14, 932, 32,
+ 0, 0, 0, 0, 0, 0, 0, 745, 746, 747,
+ 744, 743, 742, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 104, 73, 14, 539, 32,
+ 0, 60, 0, 52, 0, 0, 0, 57, 56, 58,
+ 59, 71, 106, 4, 0, 88, 89, 70, 47, 93,
+ 94, 36, 831, 105, 0, 27, 0, 0, 0, 110,
+ 26, 18, 17, 0, 19, 0, 30, 0, 31, 0,
+ 0, 20, 0, 0, 0, 21, 22, 35, 37, 13,
+ 23, 33, 0, 0, 34, 12, 0, 24, 0, 29,
+ 86, 87, 10, 39, 40, 41, 0, 0, 0, 0,
+ 51, 109, 0, 102, 98, 99, 100, 95, 96, 738,
+ 0, 0, 740, 0, 0, 103, 0, 0, 0, 0,
+ 11, 101, 97, 112, 0, 90, 91, 92, 0, 0,
+ 0, 0, 85, 53, 0, 0, 0, 74, 75, 25,
+ 77, 78, 0, 0, 0, 54, 55, 76, 63, 64,
+ 65, 66, 67, 68, 69, 0, 0, 0, 0, 0,
+ 0, 0, 0, 745, 746, 747, 744, 743, 742, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 104, 73, 14, 0, 32, 0, 60, 0, 52,
+ 0, 0, 0, 57, 56, 58, 59, 71, 106, 312,
+ 0, 88, 89, 70, 47, 93, 94, 36, 799, 105,
+ 0, 27, 0, 0, 0, 110, 26, 18, 17, 0,
+ 19, 0, 30, 0, 31, 0, 0, 20, 0, 0,
+ 0, 21, 22, 35, 37, 0, 23, 33, 0, 0,
+ 34, 0, 0, 24, 0, 29, 86, 87, 318, 39,
+ 40, 41, 0, 0, 0, 0, 51, 109, 0, 102,
+ 98, 99, 100, 95, 96, 738, 0, 0, 740, 0,
+ 0, 103, 0, 0, 0, 0, 134, 101, 97, 112,
+ 0, 90, 91, 92, 0, 0, 0, 0, 85, 53,
+ 0, 0, 0, 74, 75, 25, 77, 78, 0, 0,
+ 0, 54, 55, 76, 63, 64, 65, 66, 67, 68,
+ 69, 0, 0, 0, 0, 0, 0, 0, 0, 745,
+ 746, 747, 744, 743, 742, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 104, 73, 14,
+ 932, 32, 0, 60, 0, 52, 0, 0, 0, 57,
+ 56, 58, 59, 71, 106, 312, 0, 88, 89, 70,
+ 47, 93, 94, 36, 734, 105, 0, 27, 0, 0,
+ 0, 110, 26, 18, 17, 0, 19, 0, 30, 0,
+ 31, 0, 0, 20, 0, 0, 0, 21, 22, 35,
+ 37, 0, 23, 33, 0, 0, 34, 0, 0, 24,
+ 0, 29, 86, 87, 318, 39, 40, 41, 0, 0,
+ 0, 0, 51, 109, 0, 102, 98, 99, 100, 95,
+ 96, 0, 0, 0, 0, 0, 0, 103, 0, 0,
+ 0, 0, 134, 101, 97, 112, 0, 90, 91, 92,
+ 0, 0, 0, 0, 85, 53, 0, 0, 0, 74,
+ 75, 25, 77, 78, 0, 0, 0, 54, 55, 76,
+ 63, 64, 65, 66, 67, 68, 69, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 104, 73, 14, 925, 32, 0, 60,
+ 0, 52, 0, 0, 0, 57, 56, 58, 59, 71,
+ 106, 312, 0, 88, 89, 70, 47, 93, 94, 36,
+ 0, 105, 0, 27, 0, 0, 0, 110, 26, 18,
+ 17, 0, 19, 0, 30, 0, 31, 0, 0, 20,
+ 0, 0, 0, 21, 22, 35, 37, 0, 23, 33,
+ 0, 0, 34, 0, 0, 24, 0, 29, 86, 87,
+ 318, 39, 40, 41, 0, 0, 0, 0, 51, 109,
+ 0, 102, 98, 99, 100, 95, 96, 0, 0, 0,
+ 0, 0, 0, 103, 0, 0, 0, 0, 134, 101,
+ 97, 112, 0, 90, 91, 92, 0, 0, 0, 0,
+ 85, 53, 0, 0, 0, 74, 75, 25, 77, 78,
+ 0, 0, 0, 54, 55, 76, 63, 64, 65, 66,
+ 67, 68, 69, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 104,
+ 73, 14, 921, 32, 0, 60, 0, 52, 0, 0,
+ 0, 57, 56, 58, 59, 71, 106, 312, 0, 88,
+ 89, 70, 47, 93, 94, 36, 0, 105, 0, 27,
+ 0, 0, 0, 110, 26, 18, 17, 0, 19, 0,
+ 30, 0, 31, 0, 0, 20, 0, 0, 0, 21,
+ 22, 35, 37, 0, 23, 33, 0, 0, 34, 0,
+ 0, 24, 0, 29, 86, 87, 318, 39, 40, 41,
+ 0, 0, 0, 0, 51, 109, 0, 102, 98, 99,
+ 100, 95, 96, 0, 0, 0, 0, 0, 0, 103,
+ 0, 0, 0, 0, 134, 101, 97, 112, 0, 90,
+ 91, 92, 0, 0, 0, 0, 85, 53, 0, 0,
+ 0, 74, 75, 25, 77, 78, 0, 0, 0, 54,
+ 55, 76, 63, 64, 65, 66, 67, 68, 69, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 104, 73, 14, 911, 32,
0, 60, 0, 52, 0, 0, 0, 57, 56, 58,
59, 71, 106, 312, 0, 88, 89, 70, 47, 93,
94, 36, 0, 105, 0, 27, 0, 0, 0, 110,
@@ -720,25 +758,14 @@ var yyAct = [...]int{
134, 101, 97, 112, 0, 90, 91, 92, 0, 0,
0, 0, 85, 53, 0, 0, 0, 74, 75, 25,
77, 78, 0, 0, 0, 54, 55, 76, 63, 64,
- 65, 66, 67, 68, 69, 0, 0, 0, 104, 73,
- 14, 925, 32, 0, 60, 0, 52, 0, 0, 0,
- 57, 56, 58, 59, 71, 106, 312, 0, 88, 89,
- 70, 47, 93, 94, 36, 0, 105, 0, 27, 0,
- 0, 0, 110, 26, 18, 17, 0, 19, 0, 30,
- 0, 31, 0, 0, 20, 0, 0, 0, 21, 22,
- 35, 37, 0, 23, 33, 0, 0, 34, 0, 0,
- 24, 0, 29, 86, 87, 318, 39, 40, 41, 0,
- 0, 0, 0, 51, 109, 0, 102, 98, 99, 100,
- 95, 96, 0, 0, 0, 0, 0, 0, 103, 0,
- 0, 0, 0, 134, 101, 97, 112, 0, 90, 91,
- 92, 0, 0, 0, 0, 85, 53, 0, 0, 0,
- 74, 75, 25, 77, 78, 0, 0, 0, 54, 55,
- 76, 63, 64, 65, 66, 67, 68, 69, 0, 0,
- 0, 104, 73, 14, 921, 32, 0, 60, 0, 52,
+ 65, 66, 67, 68, 69, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 104, 73, 14, 910, 32, 0, 60, 0, 52,
0, 0, 0, 57, 56, 58, 59, 71, 106, 312,
0, 88, 89, 70, 47, 93, 94, 36, 0, 105,
0, 27, 0, 0, 0, 110, 26, 18, 17, 0,
- 19, 0, 30, 0, 31, 0, 0, 20, 0, 0,
+ 19, 907, 30, 0, 31, 0, 0, 20, 0, 0,
0, 21, 22, 35, 37, 0, 23, 33, 0, 0,
34, 0, 0, 24, 0, 29, 86, 87, 318, 39,
40, 41, 0, 0, 0, 0, 51, 109, 0, 102,
@@ -747,24 +774,13 @@ var yyAct = [...]int{
0, 90, 91, 92, 0, 0, 0, 0, 85, 53,
0, 0, 0, 74, 75, 25, 77, 78, 0, 0,
0, 54, 55, 76, 63, 64, 65, 66, 67, 68,
- 69, 0, 0, 0, 104, 73, 14, 911, 32, 0,
- 60, 0, 52, 0, 0, 0, 57, 56, 58, 59,
- 71, 106, 312, 0, 88, 89, 70, 47, 93, 94,
- 36, 0, 105, 0, 27, 0, 0, 0, 110, 26,
- 18, 17, 0, 19, 0, 30, 0, 31, 0, 0,
- 20, 0, 0, 0, 21, 22, 35, 37, 0, 23,
- 33, 0, 0, 34, 0, 0, 24, 0, 29, 86,
- 87, 318, 39, 40, 41, 0, 0, 0, 0, 51,
- 109, 0, 102, 98, 99, 100, 95, 96, 0, 0,
- 0, 0, 0, 0, 103, 0, 0, 0, 0, 134,
- 101, 97, 112, 0, 90, 91, 92, 0, 0, 0,
- 0, 85, 53, 0, 0, 0, 74, 75, 25, 77,
- 78, 0, 0, 0, 54, 55, 76, 63, 64, 65,
- 66, 67, 68, 69, 0, 0, 0, 104, 73, 14,
- 910, 32, 0, 60, 0, 52, 0, 0, 0, 57,
+ 69, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 104, 73, 14,
+ 0, 32, 0, 60, 0, 52, 0, 0, 0, 57,
56, 58, 59, 71, 106, 312, 0, 88, 89, 70,
47, 93, 94, 36, 0, 105, 0, 27, 0, 0,
- 0, 110, 26, 18, 17, 0, 19, 907, 30, 0,
+ 0, 110, 26, 18, 17, 0, 19, 0, 30, 0,
31, 0, 0, 20, 0, 0, 0, 21, 22, 35,
37, 0, 23, 33, 0, 0, 34, 0, 0, 24,
0, 29, 86, 87, 318, 39, 40, 41, 0, 0,
@@ -774,19 +790,8 @@ var yyAct = [...]int{
0, 0, 0, 0, 85, 53, 0, 0, 0, 74,
75, 25, 77, 78, 0, 0, 0, 54, 55, 76,
63, 64, 65, 66, 67, 68, 69, 0, 0, 0,
- 104, 73, 14, 0, 32, 0, 60, 0, 52, 0,
- 0, 0, 57, 56, 58, 59, 71, 106, 312, 0,
- 88, 89, 70, 47, 93, 94, 36, 0, 105, 0,
- 27, 0, 0, 0, 110, 26, 18, 17, 0, 19,
- 0, 30, 0, 31, 0, 0, 20, 0, 0, 0,
- 21, 22, 35, 37, 0, 23, 33, 0, 0, 34,
- 0, 0, 24, 0, 29, 86, 87, 318, 39, 40,
- 41, 0, 0, 0, 0, 51, 109, 0, 102, 98,
- 99, 100, 95, 96, 0, 0, 0, 0, 0, 0,
- 103, 0, 0, 0, 0, 134, 101, 97, 112, 0,
- 90, 91, 92, 0, 0, 0, 0, 85, 53, 0,
- 0, 0, 74, 75, 25, 77, 78, 0, 0, 0,
- 54, 55, 76, 63, 64, 65, 66, 67, 68, 69,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 104, 73, 14, 856, 32, 0, 60,
0, 52, 0, 0, 0, 57, 56, 58, 59, 71,
106, 312, 0, 88, 89, 70, 47, 93, 94, 36,
@@ -800,25 +805,14 @@ var yyAct = [...]int{
97, 112, 0, 90, 91, 92, 0, 0, 0, 0,
85, 53, 0, 0, 0, 74, 75, 25, 77, 78,
0, 0, 0, 54, 55, 76, 63, 64, 65, 66,
- 67, 68, 69, 0, 0, 0, 104, 73, 14, 0,
- 32, 0, 60, 0, 52, 0, 0, 0, 57, 56,
- 58, 59, 71, 106, 312, 0, 88, 89, 70, 47,
- 93, 94, 36, 0, 105, 0, 27, 0, 0, 0,
- 110, 26, 18, 17, 0, 19, 0, 30, 0, 31,
- 781, 0, 20, 0, 0, 0, 21, 22, 35, 37,
- 0, 23, 33, 0, 0, 34, 0, 0, 24, 0,
- 29, 86, 87, 318, 39, 40, 41, 0, 0, 0,
- 0, 51, 109, 0, 102, 98, 99, 100, 95, 96,
- 0, 0, 0, 0, 0, 0, 103, 0, 0, 0,
- 0, 134, 101, 97, 112, 0, 90, 91, 92, 0,
- 0, 0, 0, 85, 53, 0, 0, 0, 74, 75,
- 25, 77, 78, 0, 0, 0, 54, 55, 76, 63,
- 64, 65, 66, 67, 68, 69, 0, 0, 0, 104,
+ 67, 68, 69, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 104,
73, 14, 0, 32, 0, 60, 0, 52, 0, 0,
0, 57, 56, 58, 59, 71, 106, 312, 0, 88,
89, 70, 47, 93, 94, 36, 0, 105, 0, 27,
- 0, 0, 0, 110, 26, 18, 17, 764, 19, 0,
- 30, 0, 31, 0, 0, 20, 0, 0, 0, 21,
+ 0, 0, 0, 110, 26, 18, 17, 0, 19, 0,
+ 30, 0, 31, 781, 0, 20, 0, 0, 0, 21,
22, 35, 37, 0, 23, 33, 0, 0, 34, 0,
0, 24, 0, 29, 86, 87, 318, 39, 40, 41,
0, 0, 0, 0, 51, 109, 0, 102, 98, 99,
@@ -827,24 +821,13 @@ var yyAct = [...]int{
91, 92, 0, 0, 0, 0, 85, 53, 0, 0,
0, 74, 75, 25, 77, 78, 0, 0, 0, 54,
55, 76, 63, 64, 65, 66, 67, 68, 69, 0,
- 0, 0, 104, 73, 14, 0, 32, 0, 60, 0,
- 52, 0, 0, 0, 57, 56, 58, 59, 71, 106,
- 312, 0, 88, 89, 70, 47, 93, 94, 36, 0,
- 105, 0, 27, 0, 0, 0, 110, 26, 18, 17,
- 0, 19, 0, 30, 0, 31, 0, 0, 20, 0,
- 0, 0, 21, 22, 35, 37, 0, 23, 33, 0,
- 0, 34, 0, 0, 24, 0, 29, 86, 87, 318,
- 39, 40, 41, 0, 0, 0, 0, 51, 109, 0,
- 102, 98, 99, 100, 95, 96, 0, 0, 0, 0,
- 0, 0, 103, 0, 0, 0, 0, 134, 101, 97,
- 112, 0, 90, 91, 92, 0, 0, 0, 0, 85,
- 53, 0, 0, 680, 74, 75, 25, 77, 78, 0,
- 0, 0, 54, 55, 76, 63, 64, 65, 66, 67,
- 68, 69, 0, 0, 0, 104, 73, 14, 0, 32,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 104, 73, 14, 0, 32,
0, 60, 0, 52, 0, 0, 0, 57, 56, 58,
59, 71, 106, 312, 0, 88, 89, 70, 47, 93,
94, 36, 0, 105, 0, 27, 0, 0, 0, 110,
- 26, 18, 17, 0, 19, 0, 30, 0, 31, 0,
+ 26, 18, 17, 764, 19, 0, 30, 0, 31, 0,
0, 20, 0, 0, 0, 21, 22, 35, 37, 0,
23, 33, 0, 0, 34, 0, 0, 24, 0, 29,
86, 87, 318, 39, 40, 41, 0, 0, 0, 0,
@@ -853,21 +836,10 @@ var yyAct = [...]int{
134, 101, 97, 112, 0, 90, 91, 92, 0, 0,
0, 0, 85, 53, 0, 0, 0, 74, 75, 25,
77, 78, 0, 0, 0, 54, 55, 76, 63, 64,
- 65, 66, 67, 68, 69, 0, 0, 0, 104, 73,
- 14, 569, 32, 0, 60, 0, 52, 0, 0, 0,
- 57, 56, 58, 59, 71, 106, 312, 0, 88, 89,
- 70, 47, 93, 94, 36, 0, 105, 0, 27, 0,
- 0, 0, 110, 26, 18, 17, 0, 19, 0, 30,
- 0, 31, 0, 0, 20, 0, 0, 0, 21, 22,
- 35, 37, 0, 23, 33, 0, 0, 34, 0, 0,
- 24, 0, 29, 86, 87, 318, 39, 40, 41, 0,
- 0, 0, 0, 51, 109, 0, 102, 98, 99, 100,
- 95, 96, 0, 0, 0, 0, 0, 0, 103, 0,
- 0, 0, 0, 134, 101, 97, 112, 0, 90, 91,
- 92, 0, 0, 0, 0, 85, 53, 0, 0, 0,
- 74, 75, 25, 77, 78, 0, 0, 0, 54, 55,
- 76, 63, 64, 65, 66, 67, 68, 69, 0, 0,
- 0, 104, 73, 14, 311, 32, 0, 60, 0, 52,
+ 65, 66, 67, 68, 69, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 104, 73, 14, 0, 32, 0, 60, 0, 52,
0, 0, 0, 57, 56, 58, 59, 71, 106, 312,
0, 88, 89, 70, 47, 93, 94, 36, 0, 105,
0, 27, 0, 0, 0, 110, 26, 18, 17, 0,
@@ -878,59 +850,84 @@ var yyAct = [...]int{
98, 99, 100, 95, 96, 0, 0, 0, 0, 0,
0, 103, 0, 0, 0, 0, 134, 101, 97, 112,
0, 90, 91, 92, 0, 0, 0, 0, 85, 53,
- 0, 0, 0, 74, 75, 25, 77, 78, 0, 0,
+ 0, 0, 680, 74, 75, 25, 77, 78, 0, 0,
0, 54, 55, 76, 63, 64, 65, 66, 67, 68,
- 69, 0, 0, 0, 104, 73, 14, 0, 32, 0,
- 60, 0, 52, 0, 0, 0, 57, 56, 58, 59,
- 71, 106, 443, 444, 454, 455, 0, 0, 434, 0,
- 105, 0, 0, 0, 0, 0, 0, 459, 460, 461,
- 462, 463, 464, 465, 466, 467, 468, 469, 489, 490,
- 491, 492, 493, 481, 482, 483, 484, 485, 470, 471,
- 472, 473, 474, 475, 476, 477, 478, 479, 480, 0,
- 501, 499, 500, 496, 497, 0, 0, 488, 494, 495,
- 502, 503, 505, 504, 506, 507, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 498, 509, 508,
- 0, 0, 445, 446, 447, 448, 449, 450, 451, 452,
- 453, 456, 457, 458, 486, 487, 437, 438, 439, 440,
- 441, 442, 0, 0, 88, 89, 70, 47, 93, 94,
- 36, 0, 105, 0, 27, 0, 0, 433, 110, 26,
- 18, 17, 0, 19, 0, 30, 0, 31, 0, 0,
- 20, 0, 106, 0, 21, 22, 35, 133, 0, 23,
- 33, 0, 0, 34, 0, 0, 24, 0, 29, 86,
- 87, 0, 0, 0, 0, 0, 0, 0, 0, 51,
- 109, 0, 102, 98, 99, 100, 95, 96, 0, 0,
- 0, 0, 0, 0, 103, 0, 0, 0, 0, 134,
- 101, 97, 112, 0, 90, 91, 92, 0, 0, 0,
- 0, 85, 53, 0, 0, 0, 74, 75, 25, 0,
- 0, 0, 0, 0, 54, 55, 76, 63, 64, 65,
- 66, 67, 68, 69, 0, 0, 0, 104, 73, 14,
- 0, 32, 776, 60, 0, 52, 0, 0, 0, 57,
- 56, 58, 59, 71, 106, 88, 89, 70, 47, 93,
- 94, 36, 0, 105, 0, 27, 0, 0, 0, 110,
- 26, 18, 17, 0, 19, 0, 30, 0, 31, 0,
- 0, 20, 0, 0, 0, 21, 22, 35, 133, 0,
- 23, 33, 0, 0, 34, 0, 0, 24, 0, 29,
- 86, 87, 0, 0, 0, 0, 0, 0, 0, 0,
- 51, 109, 0, 102, 98, 99, 100, 95, 96, 0,
- 0, 0, 0, 0, 0, 103, 0, 0, 0, 0,
- 134, 101, 97, 112, 0, 90, 91, 92, 0, 0,
- 0, 0, 85, 53, 0, 0, 0, 74, 75, 25,
- 0, 0, 0, 0, 0, 54, 55, 76, 63, 64,
- 65, 66, 67, 68, 69, 0, 0, 0, 104, 73,
- 14, 0, 32, 847, 60, 0, 52, 0, 0, 0,
- 57, 56, 58, 59, 71, 106, 88, 89, 70, 47,
- 93, 94, 36, 0, 105, 0, 27, 0, 0, 0,
- 110, 26, 18, 17, 0, 19, 0, 30, 0, 31,
- 0, 0, 20, 0, 0, 0, 21, 22, 35, 133,
- 0, 23, 33, 0, 0, 34, 0, 0, 24, 0,
- 29, 86, 87, 0, 0, 0, 0, 0, 0, 0,
- 0, 51, 109, 0, 102, 98, 99, 100, 95, 96,
- 0, 0, 0, 0, 0, 0, 103, 0, 0, 0,
- 0, 134, 101, 97, 112, 0, 90, 91, 92, 0,
- 0, 0, 0, 85, 53, 0, 0, 0, 74, 75,
- 25, 0, 0, 0, 0, 0, 54, 55, 76, 63,
- 64, 65, 66, 67, 68, 69, 0, 0, 0, 104,
- 73, 14, 0, 32, 682, 60, 0, 52, 0, 0,
+ 69, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 104, 73, 14,
+ 0, 32, 0, 60, 0, 52, 0, 0, 0, 57,
+ 56, 58, 59, 71, 106, 312, 0, 88, 89, 70,
+ 47, 93, 94, 36, 0, 105, 0, 27, 0, 0,
+ 0, 110, 26, 18, 17, 0, 19, 0, 30, 0,
+ 31, 0, 0, 20, 0, 0, 0, 21, 22, 35,
+ 37, 0, 23, 33, 0, 0, 34, 0, 0, 24,
+ 0, 29, 86, 87, 318, 39, 40, 41, 0, 0,
+ 0, 0, 51, 109, 0, 102, 98, 99, 100, 95,
+ 96, 0, 0, 0, 0, 0, 0, 103, 0, 0,
+ 0, 0, 134, 101, 97, 112, 0, 90, 91, 92,
+ 0, 0, 0, 0, 85, 53, 0, 0, 0, 74,
+ 75, 25, 77, 78, 0, 0, 0, 54, 55, 76,
+ 63, 64, 65, 66, 67, 68, 69, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 104, 73, 14, 569, 32, 0, 60,
+ 0, 52, 0, 0, 0, 57, 56, 58, 59, 71,
+ 106, 312, 0, 88, 89, 70, 47, 93, 94, 36,
+ 0, 105, 0, 27, 0, 0, 0, 110, 26, 18,
+ 17, 0, 19, 0, 30, 0, 31, 0, 0, 20,
+ 0, 0, 0, 21, 22, 35, 37, 0, 23, 33,
+ 0, 0, 34, 0, 0, 24, 0, 29, 86, 87,
+ 318, 39, 40, 41, 0, 0, 0, 0, 51, 109,
+ 0, 102, 98, 99, 100, 95, 96, 0, 0, 0,
+ 0, 0, 0, 103, 0, 0, 0, 0, 134, 101,
+ 97, 112, 0, 90, 91, 92, 0, 0, 0, 0,
+ 85, 53, 0, 0, 0, 74, 75, 25, 77, 78,
+ 0, 0, 0, 54, 55, 76, 63, 64, 65, 66,
+ 67, 68, 69, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 104,
+ 73, 14, 311, 32, 0, 60, 0, 52, 0, 0,
+ 0, 57, 56, 58, 59, 71, 106, 312, 0, 88,
+ 89, 70, 47, 93, 94, 36, 0, 105, 0, 27,
+ 0, 0, 0, 110, 26, 18, 17, 0, 19, 0,
+ 30, 0, 31, 0, 0, 20, 0, 0, 0, 21,
+ 22, 35, 37, 0, 23, 33, 0, 0, 34, 0,
+ 0, 24, 0, 29, 86, 87, 318, 39, 40, 41,
+ 0, 0, 0, 0, 51, 109, 0, 102, 98, 99,
+ 100, 95, 96, 0, 0, 0, 0, 0, 0, 103,
+ 0, 0, 0, 0, 134, 101, 97, 112, 0, 90,
+ 91, 92, 0, 0, 0, 0, 85, 53, 0, 0,
+ 0, 74, 75, 25, 77, 78, 0, 0, 0, 54,
+ 55, 76, 63, 64, 65, 66, 67, 68, 69, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 104, 73, 14, 0, 32,
+ 0, 60, 0, 52, 0, 0, 0, 57, 56, 58,
+ 59, 71, 106, 443, 444, 454, 455, 0, 0, 434,
+ 0, 105, 0, 0, 0, 0, 0, 0, 459, 460,
+ 461, 462, 463, 464, 465, 466, 467, 468, 469, 489,
+ 490, 491, 492, 493, 481, 482, 483, 484, 485, 470,
+ 471, 472, 473, 474, 475, 476, 477, 478, 479, 480,
+ 0, 501, 499, 500, 496, 497, 0, 0, 488, 494,
+ 495, 502, 503, 505, 504, 506, 507, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 498, 509,
+ 508, 0, 0, 445, 446, 447, 448, 449, 450, 451,
+ 452, 453, 456, 457, 458, 486, 487, 437, 438, 439,
+ 440, 441, 442, 88, 89, 70, 47, 93, 94, 36,
+ 0, 105, 0, 27, 0, 0, 0, 110, 26, 18,
+ 17, 0, 19, 0, 30, 0, 31, 0, 0, 20,
+ 0, 0, 0, 21, 22, 35, 133, 0, 23, 33,
+ 0, 433, 34, 0, 0, 24, 0, 29, 86, 87,
+ 0, 0, 0, 0, 0, 0, 106, 0, 51, 109,
+ 0, 102, 98, 99, 100, 95, 96, 0, 0, 0,
+ 0, 0, 0, 103, 0, 0, 0, 0, 134, 101,
+ 97, 112, 0, 90, 91, 92, 0, 0, 0, 0,
+ 85, 53, 0, 0, 0, 74, 75, 25, 0, 0,
+ 0, 0, 0, 54, 55, 76, 63, 64, 65, 66,
+ 67, 68, 69, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 104,
+ 73, 14, 0, 32, 776, 60, 0, 52, 0, 0,
0, 57, 56, 58, 59, 71, 106, 88, 89, 70,
47, 93, 94, 36, 0, 105, 0, 27, 0, 0,
0, 110, 26, 18, 17, 0, 19, 0, 30, 0,
@@ -943,20 +940,40 @@ var yyAct = [...]int{
0, 0, 0, 0, 85, 53, 0, 0, 0, 74,
75, 25, 0, 0, 0, 0, 0, 54, 55, 76,
63, 64, 65, 66, 67, 68, 69, 0, 0, 0,
- 104, 73, 14, 0, 32, 659, 60, 0, 52, 0,
- 0, 0, 57, 56, 58, 59, 71, 106, 88, 89,
- 70, 47, 93, 94, 36, 0, 105, 0, 27, 0,
- 0, 0, 110, 26, 18, 17, 0, 19, 0, 30,
- 0, 31, 0, 0, 20, 0, 0, 0, 21, 22,
- 35, 133, 0, 23, 33, 0, 0, 34, 0, 0,
- 24, 0, 29, 86, 87, 0, 0, 0, 0, 0,
- 0, 0, 0, 51, 109, 0, 102, 98, 99, 100,
- 95, 96, 0, 0, 0, 0, 0, 0, 103, 0,
- 0, 0, 0, 134, 101, 97, 112, 0, 90, 91,
- 92, 0, 0, 0, 0, 85, 53, 0, 0, 0,
- 74, 75, 25, 0, 0, 0, 0, 0, 54, 55,
- 76, 63, 64, 65, 66, 67, 68, 69, 0, 0,
- 0, 104, 73, 14, 0, 32, 641, 60, 0, 52,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 104, 73, 14, 0, 32, 847, 60,
+ 0, 52, 0, 0, 0, 57, 56, 58, 59, 71,
+ 106, 88, 89, 70, 47, 93, 94, 36, 0, 105,
+ 0, 27, 0, 0, 0, 110, 26, 18, 17, 0,
+ 19, 0, 30, 0, 31, 0, 0, 20, 0, 0,
+ 0, 21, 22, 35, 133, 0, 23, 33, 0, 0,
+ 34, 0, 0, 24, 0, 29, 86, 87, 0, 0,
+ 0, 0, 0, 0, 0, 0, 51, 109, 0, 102,
+ 98, 99, 100, 95, 96, 0, 0, 0, 0, 0,
+ 0, 103, 0, 0, 0, 0, 134, 101, 97, 112,
+ 0, 90, 91, 92, 0, 0, 0, 0, 85, 53,
+ 0, 0, 0, 74, 75, 25, 0, 0, 0, 0,
+ 0, 54, 55, 76, 63, 64, 65, 66, 67, 68,
+ 69, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 104, 73, 14,
+ 0, 32, 682, 60, 0, 52, 0, 0, 0, 57,
+ 56, 58, 59, 71, 106, 88, 89, 70, 47, 93,
+ 94, 36, 0, 105, 0, 27, 0, 0, 0, 110,
+ 26, 18, 17, 0, 19, 0, 30, 0, 31, 0,
+ 0, 20, 0, 0, 0, 21, 22, 35, 133, 0,
+ 23, 33, 0, 0, 34, 0, 0, 24, 0, 29,
+ 86, 87, 0, 0, 0, 0, 0, 0, 0, 0,
+ 51, 109, 0, 102, 98, 99, 100, 95, 96, 0,
+ 0, 0, 0, 0, 0, 103, 0, 0, 0, 0,
+ 134, 101, 97, 112, 0, 90, 91, 92, 0, 0,
+ 0, 0, 85, 53, 0, 0, 0, 74, 75, 25,
+ 0, 0, 0, 0, 0, 54, 55, 76, 63, 64,
+ 65, 66, 67, 68, 69, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 104, 73, 14, 0, 32, 659, 60, 0, 52,
0, 0, 0, 57, 56, 58, 59, 71, 106, 88,
89, 70, 47, 93, 94, 36, 0, 105, 0, 27,
0, 0, 0, 110, 26, 18, 17, 0, 19, 0,
@@ -965,145 +982,30 @@ var yyAct = [...]int{
0, 24, 0, 29, 86, 87, 0, 0, 0, 0,
0, 0, 0, 0, 51, 109, 0, 102, 98, 99,
100, 95, 96, 0, 0, 0, 0, 0, 0, 103,
- 0, 179, 0, 0, 134, 101, 97, 112, 0, 90,
+ 0, 0, 0, 0, 134, 101, 97, 112, 0, 90,
91, 92, 0, 0, 0, 0, 85, 53, 0, 0,
- 0, 74, 75, 25, 0, 0, 178, 0, 0, 54,
- 55, 76, 63, 64, 65, 66, 67, 68, 69, 159,
- 163, 162, 104, 73, 14, 0, 32, 0, 60, 0,
- 52, 0, 0, 0, 57, 56, 58, 59, 71, 106,
- 155, 157, 156, 179, 172, 173, 170, 171, 174, 175,
- 176, 177, 168, 169, 161, 164, 166, 167, 165, 0,
- 0, 0, 0, 0, 0, 0, 0, 181, 178, 738,
- 0, 0, 740, 0, 813, 812, 0, 0, 0, 0,
- 180, 159, 163, 162, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 155, 157, 156, 179, 0, 0,
- 0, 0, 153, 154, 158, 160, 172, 173, 170, 171,
- 174, 175, 176, 177, 168, 169, 161, 164, 166, 167,
- 165, 181, 178, 745, 746, 747, 744, 743, 742, 0,
- 0, 0, 0, 756, 180, 159, 163, 162, 0, 0,
- 0, 0, 0, 0, 0, 799, 0, 0, 155, 157,
- 156, 179, 0, 0, 0, 0, 153, 154, 158, 160,
- 172, 173, 170, 171, 174, 175, 176, 177, 168, 169,
- 161, 164, 166, 167, 165, 181, 178, 0, 0, 0,
- 0, 0, 0, 0, 0, 709, 0, 0, 180, 159,
- 163, 162, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 155, 157, 156, 179, 0, 0, 0, 0,
- 153, 154, 158, 160, 172, 173, 170, 171, 174, 175,
- 176, 177, 168, 169, 161, 164, 166, 167, 165, 181,
- 178, 0, 0, 0, 0, 694, 0, 0, 0, 0,
- 0, 0, 180, 159, 163, 162, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 155, 157, 156, 179,
- 0, 0, 0, 0, 153, 154, 158, 160, 172, 173,
- 170, 171, 174, 175, 176, 177, 168, 169, 161, 164,
- 166, 167, 165, 181, 178, 0, 0, 0, 0, 692,
- 0, 0, 0, 0, 0, 0, 180, 159, 163, 162,
+ 0, 74, 75, 25, 0, 0, 0, 0, 0, 54,
+ 55, 76, 63, 64, 65, 66, 67, 68, 69, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 155, 157, 156, 179, 0, 0, 0, 0, 153, 154,
- 158, 160, 172, 173, 170, 171, 174, 175, 176, 177,
- 168, 169, 161, 164, 166, 167, 165, 181, 178, 738,
- 0, 0, 740, 683, 0, 0, 0, 0, 0, 0,
- 180, 159, 163, 162, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 155, 157, 156, 179, 0, 0,
- 0, 0, 153, 154, 158, 160, 172, 173, 170, 171,
- 174, 175, 176, 177, 168, 169, 161, 164, 166, 167,
- 165, 181, 178, 745, 746, 747, 744, 743, 742, 0,
- 0, 679, 0, 0, 180, 159, 163, 162, 0, 0,
- 0, 0, 0, 0, 0, 734, 0, 0, 155, 157,
- 156, 179, 0, 0, 0, 0, 153, 154, 158, 160,
- 172, 173, 170, 171, 174, 175, 176, 177, 168, 169,
- 161, 164, 166, 167, 165, 181, 178, 0, 0, 0,
- 0, 0, 0, 0, 0, 678, 0, 0, 180, 159,
- 163, 162, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 155, 157, 156, 179, 0, 0, 0, 0,
- 153, 154, 158, 160, 172, 173, 170, 171, 174, 175,
- 176, 177, 168, 169, 161, 164, 166, 167, 165, 181,
- 178, 0, 0, 0, 0, 624, 0, 0, 0, 0,
- 0, 0, 180, 159, 163, 162, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 155, 157, 156, 179,
- 0, 0, 0, 0, 153, 154, 158, 160, 172, 173,
- 170, 171, 174, 175, 176, 177, 168, 169, 161, 164,
- 166, 167, 165, 181, 178, 0, 0, 0, 0, 0,
- 0, 0, 0, 623, 0, 0, 180, 159, 163, 162,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 155, 157, 156, 179, 0, 0, 0, 0, 153, 154,
- 158, 160, 172, 173, 170, 171, 174, 175, 176, 177,
- 168, 169, 161, 164, 166, 167, 165, 181, 178, 0,
- 0, 0, 0, 0, 0, 0, 0, 622, 0, 0,
- 180, 159, 163, 162, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 155, 157, 156, 179, 0, 0,
- 0, 0, 153, 154, 158, 160, 172, 173, 170, 171,
- 174, 175, 176, 177, 168, 169, 161, 164, 166, 167,
- 165, 181, 178, 0, 0, 0, 0, 605, 0, 0,
- 0, 0, 0, 0, 180, 159, 163, 162, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 155, 157,
- 156, 179, 0, 0, 0, 0, 153, 154, 158, 160,
- 172, 173, 170, 171, 174, 175, 176, 177, 168, 169,
- 161, 164, 166, 167, 165, 181, 178, 0, 0, 0,
- 0, 0, 0, 0, 0, 596, 0, 0, 180, 159,
- 163, 162, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 155, 157, 156, 179, 0, 0, 0, 0,
- 153, 154, 158, 160, 172, 173, 170, 171, 174, 175,
- 176, 177, 168, 169, 161, 164, 166, 167, 165, 181,
- 178, 0, 0, 0, 0, 586, 0, 0, 0, 0,
- 0, 0, 180, 159, 163, 162, 0, 0, 0, 0,
- 0, 0, 567, 0, 0, 0, 155, 157, 156, 179,
- 0, 0, 0, 0, 153, 154, 158, 160, 172, 173,
- 170, 171, 174, 175, 176, 177, 168, 169, 161, 164,
- 166, 167, 165, 181, 178, 0, 0, 0, 0, 0,
- 0, 0, 0, 584, 0, 0, 180, 159, 163, 162,
+ 0, 0, 0, 0, 0, 104, 73, 14, 0, 32,
+ 641, 60, 0, 52, 0, 0, 0, 57, 56, 58,
+ 59, 71, 106, 88, 89, 70, 47, 93, 94, 36,
+ 0, 105, 0, 27, 0, 0, 0, 110, 26, 18,
+ 17, 0, 19, 0, 30, 0, 31, 0, 0, 20,
+ 0, 0, 0, 21, 22, 35, 133, 0, 23, 33,
+ 0, 0, 34, 0, 0, 24, 0, 29, 86, 87,
+ 0, 0, 0, 0, 0, 0, 0, 0, 51, 109,
+ 0, 102, 98, 99, 100, 95, 96, 0, 0, 0,
+ 0, 0, 0, 103, 0, 0, 0, 0, 134, 101,
+ 97, 112, 0, 90, 91, 92, 0, 0, 0, 0,
+ 85, 53, 0, 0, 0, 74, 75, 25, 0, 0,
+ 0, 0, 0, 54, 55, 76, 63, 64, 65, 66,
+ 67, 68, 69, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 155, 157, 156, 179, 0, 0, 0, 0, 153, 154,
- 158, 160, 172, 173, 170, 171, 174, 175, 176, 177,
- 168, 169, 161, 164, 166, 167, 165, 181, 178, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 180, 159, 163, 162, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 155, 157, 156, 179, 0, 0,
- 0, 0, 153, 154, 158, 160, 172, 173, 170, 171,
- 174, 175, 176, 177, 168, 169, 161, 164, 166, 167,
- 165, 181, 178, 0, 0, 0, 0, 0, 0, 563,
- 0, 0, 0, 0, 180, 159, 163, 162, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 155, 157,
- 156, 179, 0, 0, 0, 0, 153, 154, 158, 160,
- 172, 173, 170, 171, 174, 175, 176, 177, 168, 169,
- 161, 164, 166, 167, 165, 181, 178, 0, 0, 0,
- 0, 0, 0, 0, 0, 557, 0, 0, 180, 159,
- 163, 162, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 155, 157, 156, 179, 0, 0, 0, 0,
- 153, 154, 158, 160, 172, 173, 170, 171, 174, 175,
- 176, 177, 168, 169, 161, 164, 166, 167, 165, 181,
- 178, 0, 0, 0, 0, 0, 0, 0, 0, 553,
- 0, 0, 180, 159, 163, 162, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 155, 157, 156, 179,
- 0, 0, 0, 0, 153, 154, 158, 160, 172, 173,
- 170, 171, 174, 175, 176, 177, 168, 169, 161, 164,
- 166, 167, 165, 181, 178, 412, 0, 0, 0, 0,
- 0, 0, 0, 417, 0, 0, 180, 159, 163, 162,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 155, 157, 156, 179, 153, 154,
- 158, 160, 172, 173, 170, 171, 174, 175, 176, 177,
- 168, 169, 161, 164, 166, 167, 165, 0, 0, 0,
- 0, 181, 178, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 180, 159, 163, 162, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 155, 157,
- 156, 179, 0, 0, 0, 0, 153, 154, 158, 160,
- 172, 173, 170, 171, 174, 175, 176, 177, 168, 169,
- 161, 164, 166, 167, 165, 181, 178, 0, 0, 0,
- 0, 0, 373, 0, 0, 0, 0, 0, 180, 159,
- 163, 162, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 155, 157, 156, 179, 0, 0, 0, 0,
- 153, 154, 158, 160, 172, 173, 170, 171, 174, 175,
- 176, 177, 168, 169, 161, 164, 166, 167, 165, 181,
- 178, 0, 0, 0, 0, 0, 152, 0, 0, 0,
- 0, 0, 180, 159, 163, 162, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 155, 157, 156, 179,
- 0, 0, 0, 0, 153, 154, 158, 160, 172, 173,
- 170, 171, 174, 175, 176, 177, 168, 169, 161, 164,
- 166, 167, 165, 181, 178, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 180, 159, 163, 162,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 153, 154,
- 158, 160, 172, 173, 170, 171, 174, 175, 176, 177,
- 168, 169, 161, 164, 166, 167, 165, 443, 444, 454,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 104,
+ 73, 14, 0, 32, 0, 60, 0, 52, 0, 0,
+ 0, 57, 56, 58, 59, 71, 106, 443, 444, 454,
455, 0, 0, 882, 0, 0, 0, 0, 0, 0,
0, 0, 459, 460, 461, 462, 463, 464, 465, 466,
467, 468, 469, 489, 490, 491, 492, 493, 481, 482,
@@ -1113,237 +1015,364 @@ var yyAct = [...]int{
507, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 881, 509, 508, 112, 0, 445, 446, 447,
448, 449, 450, 451, 452, 453, 456, 457, 458, 486,
- 487, 437, 438, 439, 440, 441, 442, 0, 0, 443,
- 444, 454, 455, 0, 0, 882, 0, 0, 0, 0,
- 0, 0, 0, 900, 459, 460, 461, 462, 463, 464,
- 465, 466, 467, 468, 469, 489, 490, 491, 492, 493,
- 481, 482, 483, 484, 485, 470, 471, 472, 473, 474,
- 475, 476, 477, 478, 479, 480, 0, 501, 499, 500,
- 496, 497, 0, 0, 488, 494, 495, 502, 503, 505,
- 504, 506, 507, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 881, 509, 508, 112, 0, 445,
- 446, 447, 448, 449, 450, 451, 452, 453, 456, 457,
- 458, 486, 487, 437, 438, 439, 440, 441, 442, 156,
- 179, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 872, 0, 0, 0, 0,
- 0, 0, 428, 0, 181, 178, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 180, 159, 163,
- 162, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 179, 0, 0, 0, 0, 153,
- 154, 158, 160, 172, 173, 170, 171, 174, 175, 176,
- 177, 168, 169, 161, 164, 166, 167, 165, 181, 178,
+ 487, 437, 438, 439, 440, 441, 442, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 180, 159, 163, 162, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 179, 0,
- 0, 0, 0, 153, 154, 158, 160, 172, 173, 170,
- 171, 174, 175, 176, 177, 168, 169, 161, 164, 166,
- 167, 165, 181, 178, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 180, 159, 163, 162, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 179, 0, 0, 0, 0, 153, 154, 158,
- 160, 172, 173, 170, 171, 174, 175, 176, 177, 168,
- 169, 161, 164, 166, 167, 165, 181, 178, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 159, 163, 162, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 179, 0, 0, 0, 0,
- 0, 153, 154, 158, 160, 172, 173, 170, 171, 174,
- 175, 176, 177, 168, 169, 161, 164, 166, 167, 165,
- 178, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 159, 163, 162, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 179, 0,
- 0, 0, 0, 0, 0, 154, 158, 160, 172, 173,
- 170, 171, 174, 175, 176, 177, 168, 169, 161, 164,
- 166, 167, 165, 178, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 159, 163, 162, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 179, 0, 0, 0, 0, 0, 0, 0, 158,
- 160, 172, 173, 170, 171, 174, 175, 176, 177, 168,
- 169, 161, 164, 166, 167, 165, 178, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 159,
- 163, 162, 0, 0, 0, 0, 88, 89, 70, 0,
- 93, 94, 117, 0, 105, 0, 0, 0, 0, 0,
- 110, 0, 0, 160, 172, 173, 170, 171, 174, 175,
- 176, 177, 168, 169, 161, 164, 166, 167, 165, 133,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 86, 87, 0, 0, 0, 0, 0, 0, 0,
- 0, 51, 109, 0, 102, 98, 99, 100, 95, 96,
- 0, 0, 0, 0, 0, 0, 103, 0, 0, 0,
- 0, 134, 101, 97, 112, 534, 90, 91, 92, 0,
- 0, 0, 0, 85, 53, 0, 0, 0, 74, 75,
- 139, 0, 0, 0, 0, 0, 54, 55, 76, 63,
- 64, 65, 66, 67, 68, 69, 0, 0, 0, 104,
- 73, 0, 0, 0, 0, 60, 530, 52, 0, 0,
- 0, 57, 56, 58, 59, 71, 106, 88, 89, 70,
- 0, 93, 94, 117, 0, 105, 0, 0, 0, 0,
- 0, 110, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 133, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 86, 87, 0, 0, 0, 0, 0, 0,
- 0, 0, 227, 109, 0, 102, 98, 99, 100, 95,
- 96, 0, 0, 0, 0, 0, 0, 103, 0, 0,
- 0, 0, 134, 101, 97, 112, 0, 90, 91, 92,
- 0, 0, 0, 0, 85, 53, 0, 0, 0, 74,
- 75, 139, 0, 0, 0, 0, 0, 54, 55, 76,
- 63, 64, 65, 66, 67, 68, 69, 0, 0, 0,
- 104, 73, 0, 0, 0, 0, 60, 0, 52, 0,
- 0, 226, 57, 56, 58, 59, 71, 106, 88, 89,
- 70, 0, 93, 94, 117, 0, 105, 0, 0, 0,
- 0, 0, 110, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 133, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 86, 87, 0, 0, 0, 0, 0,
- 0, 0, 0, 51, 109, 0, 102, 98, 99, 100,
- 95, 96, 0, 0, 0, 0, 0, 0, 103, 0,
- 0, 0, 0, 134, 101, 97, 112, 534, 90, 91,
- 92, 0, 0, 0, 0, 85, 53, 0, 0, 0,
- 74, 75, 139, 0, 0, 0, 0, 0, 54, 55,
- 76, 63, 64, 65, 66, 67, 68, 69, 0, 0,
- 0, 104, 73, 0, 0, 0, 0, 60, 0, 52,
- 0, 0, 0, 57, 56, 58, 59, 71, 106, 88,
- 89, 70, 0, 93, 94, 117, 0, 105, 0, 0,
- 0, 0, 0, 110, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 133, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 86, 87, 0, 0, 0, 0,
- 0, 0, 0, 0, 594, 109, 0, 102, 98, 99,
- 100, 95, 96, 0, 0, 0, 0, 0, 0, 103,
- 0, 0, 0, 0, 134, 101, 97, 112, 0, 90,
- 91, 92, 0, 0, 0, 0, 85, 53, 0, 0,
- 0, 74, 75, 139, 0, 0, 0, 0, 0, 54,
- 55, 76, 63, 64, 65, 66, 67, 68, 69, 0,
- 0, 0, 104, 73, 0, 0, 0, 0, 60, 0,
- 52, 0, 0, 593, 57, 56, 58, 59, 71, 106,
- 88, 89, 70, 0, 93, 94, 117, 426, 105, 0,
- 0, 0, 0, 0, 110, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 133, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 86, 87, 0, 0, 0,
- 0, 0, 0, 0, 0, 51, 109, 0, 102, 98,
- 99, 100, 95, 96, 0, 0, 0, 0, 0, 0,
- 103, 0, 0, 0, 0, 134, 101, 97, 112, 0,
- 90, 91, 92, 0, 0, 0, 0, 85, 53, 0,
- 0, 0, 74, 75, 139, 0, 0, 0, 0, 0,
- 54, 55, 76, 63, 64, 65, 66, 67, 68, 69,
- 0, 0, 0, 104, 73, 0, 0, 0, 0, 60,
- 0, 52, 0, 0, 0, 57, 56, 58, 59, 71,
- 106, 88, 89, 70, 0, 93, 94, 117, 0, 105,
- 0, 0, 0, 0, 0, 110, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 133, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 86, 87, 0, 0,
- 0, 0, 0, 0, 0, 0, 51, 109, 0, 102,
- 98, 99, 100, 95, 96, 0, 0, 0, 0, 0,
- 0, 103, 0, 0, 0, 0, 134, 101, 97, 112,
- 0, 90, 91, 92, 0, 0, 0, 0, 85, 53,
- 0, 0, 0, 74, 75, 139, 0, 0, 0, 0,
- 0, 54, 55, 76, 63, 64, 65, 66, 67, 68,
- 69, 0, 0, 0, 104, 73, 0, 0, 0, 0,
- 60, 0, 52, 0, 0, 389, 57, 56, 58, 59,
- 71, 106, 88, 89, 70, 0, 93, 94, 117, 0,
- 105, 0, 0, 0, 0, 0, 110, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 133, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 86, 87, 0,
- 0, 0, 0, 0, 0, 0, 0, 51, 109, 0,
- 102, 98, 99, 100, 95, 96, 0, 0, 0, 0,
- 0, 0, 103, 0, 0, 0, 0, 134, 101, 97,
- 112, 0, 90, 91, 92, 0, 0, 0, 0, 85,
- 53, 0, 0, 0, 74, 75, 139, 0, 0, 0,
- 0, 0, 54, 55, 76, 63, 64, 65, 66, 67,
- 68, 69, 0, 0, 0, 104, 73, 0, 0, 0,
- 365, 60, 0, 52, 0, 0, 0, 57, 56, 58,
- 59, 71, 106, 88, 89, 70, 0, 93, 94, 117,
- 0, 105, 0, 0, 0, 0, 0, 110, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 133, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 86, 87,
- 0, 0, 0, 0, 0, 0, 0, 0, 51, 109,
- 0, 102, 98, 99, 100, 95, 96, 0, 0, 0,
- 0, 0, 0, 103, 179, 0, 0, 0, 134, 101,
- 97, 112, 0, 90, 91, 92, 0, 0, 0, 0,
- 85, 53, 0, 0, 0, 74, 75, 139, 0, 178,
- 0, 0, 0, 54, 55, 76, 63, 64, 65, 66,
- 67, 68, 69, 163, 162, 0, 104, 73, 0, 0,
- 0, 0, 60, 0, 52, 0, 0, 0, 57, 56,
- 58, 59, 71, 106, 0, 0, 0, 172, 173, 170,
- 171, 174, 175, 176, 177, 168, 169, 161, 164, 166,
- 167, 165, 443, 444, 454, 455, 0, 0, 434, 0,
- 0, 0, 0, 0, 0, 0, 0, 459, 460, 461,
+ 0, 0, 443, 444, 454, 455, 0, 0, 882, 0,
+ 0, 0, 0, 0, 0, 0, 900, 459, 460, 461,
462, 463, 464, 465, 466, 467, 468, 469, 489, 490,
491, 492, 493, 481, 482, 483, 484, 485, 470, 471,
472, 473, 474, 475, 476, 477, 478, 479, 480, 0,
501, 499, 500, 496, 497, 0, 0, 488, 494, 495,
502, 503, 505, 504, 506, 507, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 498, 509, 508,
- 0, 0, 445, 446, 447, 448, 449, 450, 451, 452,
+ 0, 0, 0, 0, 0, 0, 0, 881, 509, 508,
+ 112, 0, 445, 446, 447, 448, 449, 450, 451, 452,
453, 456, 457, 458, 486, 487, 437, 438, 439, 440,
- 441, 442, 443, 444, 454, 455, 0, 0, 916, 0,
- 0, 0, 0, 0, 0, 0, 0, 459, 460, 461,
- 462, 463, 464, 465, 466, 467, 468, 469, 489, 490,
- 491, 492, 493, 481, 482, 483, 484, 485, 470, 471,
- 472, 473, 474, 475, 476, 477, 478, 479, 480, 0,
- 501, 499, 500, 496, 497, 0, 0, 488, 494, 495,
- 502, 503, 505, 504, 506, 507, 117, 0, 105, 0,
- 0, 0, 0, 0, 110, 0, 0, 498, 509, 508,
- 0, 0, 445, 446, 447, 448, 449, 450, 451, 452,
- 453, 456, 457, 458, 486, 487, 745, 746, 747, 744,
- 743, 742, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 655, 109, 0, 0, 0,
+ 441, 442, 88, 89, 70, 0, 93, 94, 117, 0,
+ 105, 0, 0, 0, 0, 0, 110, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 134, 0, 0, 112, 0,
+ 0, 0, 0, 0, 0, 133, 0, 0, 0, 0,
+ 0, 872, 0, 0, 0, 0, 0, 86, 87, 0,
+ 0, 0, 0, 0, 0, 0, 0, 51, 109, 0,
+ 102, 98, 99, 100, 95, 96, 0, 0, 0, 0,
+ 0, 0, 103, 0, 0, 0, 0, 134, 101, 97,
+ 112, 534, 90, 91, 92, 0, 0, 0, 0, 85,
+ 53, 0, 0, 0, 74, 75, 139, 0, 0, 0,
+ 0, 0, 54, 55, 76, 63, 64, 65, 66, 67,
+ 68, 69, 0, 0, 88, 89, 70, 0, 93, 94,
+ 117, 0, 105, 0, 0, 0, 0, 0, 110, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 104, 73,
+ 0, 0, 0, 0, 60, 530, 52, 133, 0, 0,
+ 57, 56, 58, 59, 71, 106, 0, 0, 0, 86,
+ 87, 0, 0, 0, 0, 0, 0, 0, 0, 227,
+ 109, 0, 102, 98, 99, 100, 95, 96, 0, 0,
+ 0, 0, 0, 0, 103, 0, 0, 0, 0, 134,
+ 101, 97, 112, 0, 90, 91, 92, 0, 0, 0,
+ 0, 85, 53, 0, 0, 0, 74, 75, 139, 0,
+ 0, 0, 0, 0, 54, 55, 76, 63, 64, 65,
+ 66, 67, 68, 69, 88, 89, 70, 0, 93, 94,
+ 117, 0, 105, 0, 0, 0, 0, 0, 110, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 233, 0, 0, 0, 0, 0,
+ 104, 73, 0, 0, 0, 0, 60, 133, 52, 0,
+ 0, 226, 57, 56, 58, 59, 71, 106, 0, 86,
+ 87, 0, 0, 0, 0, 0, 0, 0, 0, 51,
+ 109, 0, 102, 98, 99, 100, 95, 96, 0, 0,
+ 0, 0, 0, 0, 103, 0, 0, 0, 0, 134,
+ 101, 97, 112, 534, 90, 91, 92, 0, 0, 0,
+ 0, 85, 53, 0, 0, 0, 74, 75, 139, 0,
+ 0, 0, 0, 0, 54, 55, 76, 63, 64, 65,
+ 66, 67, 68, 69, 88, 89, 70, 0, 93, 94,
+ 117, 0, 105, 0, 0, 0, 0, 0, 110, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 231,
- 0, 656, 0, 0, 654, 0, 0, 0, 0, 0,
- 106,
+ 104, 73, 0, 0, 0, 0, 60, 133, 52, 0,
+ 0, 0, 57, 56, 58, 59, 71, 106, 0, 86,
+ 87, 0, 0, 0, 0, 0, 0, 0, 0, 594,
+ 109, 0, 102, 98, 99, 100, 95, 96, 0, 0,
+ 0, 0, 0, 0, 103, 0, 0, 0, 0, 134,
+ 101, 97, 112, 0, 90, 91, 92, 0, 0, 0,
+ 0, 85, 53, 0, 0, 0, 74, 75, 139, 0,
+ 0, 0, 0, 0, 54, 55, 76, 63, 64, 65,
+ 66, 67, 68, 69, 88, 89, 70, 0, 93, 94,
+ 117, 426, 105, 0, 0, 0, 0, 0, 110, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 104, 73, 0, 0, 0, 0, 60, 133, 52, 0,
+ 0, 593, 57, 56, 58, 59, 71, 106, 0, 86,
+ 87, 0, 0, 0, 0, 0, 0, 0, 0, 51,
+ 109, 0, 102, 98, 99, 100, 95, 96, 0, 0,
+ 0, 0, 0, 0, 103, 0, 0, 0, 0, 134,
+ 101, 97, 112, 0, 90, 91, 92, 0, 0, 0,
+ 0, 85, 53, 0, 0, 0, 74, 75, 139, 0,
+ 0, 0, 0, 0, 54, 55, 76, 63, 64, 65,
+ 66, 67, 68, 69, 88, 89, 70, 0, 93, 94,
+ 117, 0, 105, 0, 0, 0, 0, 0, 110, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 104, 73, 0, 0, 0, 0, 60, 133, 52, 0,
+ 0, 0, 57, 56, 58, 59, 71, 106, 0, 86,
+ 87, 0, 0, 0, 0, 0, 0, 0, 0, 51,
+ 109, 0, 102, 98, 99, 100, 95, 96, 0, 0,
+ 0, 0, 0, 0, 103, 0, 0, 0, 0, 134,
+ 101, 97, 112, 0, 90, 91, 92, 0, 0, 0,
+ 0, 85, 53, 0, 0, 0, 74, 75, 139, 0,
+ 0, 0, 0, 0, 54, 55, 76, 63, 64, 65,
+ 66, 67, 68, 69, 88, 89, 70, 0, 93, 94,
+ 117, 0, 105, 0, 0, 0, 0, 0, 110, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 104, 73, 0, 0, 0, 0, 60, 133, 52, 0,
+ 0, 389, 57, 56, 58, 59, 71, 106, 0, 86,
+ 87, 0, 0, 0, 0, 0, 0, 0, 0, 51,
+ 109, 0, 102, 98, 99, 100, 95, 96, 0, 0,
+ 0, 0, 0, 0, 103, 0, 0, 0, 0, 134,
+ 101, 97, 112, 0, 90, 91, 92, 0, 0, 0,
+ 0, 85, 53, 0, 0, 0, 74, 75, 139, 0,
+ 0, 0, 0, 0, 54, 55, 76, 63, 64, 65,
+ 66, 67, 68, 69, 88, 89, 70, 0, 93, 94,
+ 117, 0, 105, 0, 0, 0, 0, 0, 110, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 104, 73, 0, 0, 0, 365, 60, 133, 52, 0,
+ 0, 0, 57, 56, 58, 59, 71, 106, 0, 86,
+ 87, 0, 0, 0, 0, 0, 0, 0, 0, 51,
+ 109, 0, 102, 98, 99, 100, 95, 96, 0, 0,
+ 0, 0, 0, 0, 103, 0, 0, 0, 0, 134,
+ 101, 97, 112, 0, 90, 91, 92, 0, 0, 0,
+ 0, 85, 53, 0, 0, 0, 74, 75, 139, 0,
+ 0, 0, 0, 0, 54, 55, 76, 63, 64, 65,
+ 66, 67, 68, 69, 0, 0, 155, 157, 156, 179,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 104, 73, 0, 181, 178, 0, 60, 0, 52, 0,
+ 0, 0, 57, 56, 58, 59, 71, 106, 153, 154,
+ 165, 168, 169, 170, 171, 172, 173, 175, 177, 0,
+ 155, 157, 156, 179, 0, 0, 0, 0, 756, 180,
+ 159, 163, 162, 0, 0, 0, 0, 0, 158, 0,
+ 160, 164, 166, 167, 174, 176, 161, 181, 178, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 153, 154, 165, 168, 169, 170, 171, 172,
+ 173, 175, 177, 0, 155, 157, 156, 179, 0, 0,
+ 709, 0, 0, 180, 159, 163, 162, 0, 0, 0,
+ 0, 0, 158, 0, 160, 164, 166, 167, 174, 176,
+ 161, 181, 178, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 153, 154, 165, 168,
+ 169, 170, 171, 172, 173, 175, 177, 0, 0, 0,
+ 694, 155, 157, 156, 179, 0, 0, 180, 159, 163,
+ 162, 0, 0, 0, 0, 0, 158, 0, 160, 164,
+ 166, 167, 174, 176, 161, 0, 0, 0, 181, 178,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 153, 154, 165, 168, 169, 170, 171,
+ 172, 173, 175, 177, 0, 0, 0, 692, 155, 157,
+ 156, 179, 0, 0, 180, 159, 163, 162, 0, 0,
+ 0, 0, 0, 158, 0, 160, 164, 166, 167, 174,
+ 176, 161, 0, 0, 0, 181, 178, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 153, 154, 165, 168, 169, 170, 171, 172, 173, 175,
+ 177, 0, 0, 0, 683, 155, 157, 156, 179, 0,
+ 0, 180, 159, 163, 162, 0, 0, 0, 0, 0,
+ 158, 0, 160, 164, 166, 167, 174, 176, 161, 0,
+ 0, 0, 181, 178, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 153, 154, 165,
+ 168, 169, 170, 171, 172, 173, 175, 177, 0, 155,
+ 157, 156, 179, 0, 0, 679, 0, 0, 180, 159,
+ 163, 162, 0, 0, 0, 0, 0, 158, 0, 160,
+ 164, 166, 167, 174, 176, 161, 181, 178, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 153, 154, 165, 168, 169, 170, 171, 172, 173,
+ 175, 177, 0, 155, 157, 156, 179, 0, 0, 678,
+ 0, 0, 180, 159, 163, 162, 0, 0, 0, 0,
+ 0, 158, 0, 160, 164, 166, 167, 174, 176, 161,
+ 181, 178, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 153, 154, 165, 168, 169,
+ 170, 171, 172, 173, 175, 177, 0, 0, 0, 624,
+ 155, 157, 156, 179, 0, 0, 180, 159, 163, 162,
+ 0, 0, 0, 0, 0, 158, 0, 160, 164, 166,
+ 167, 174, 176, 161, 0, 0, 0, 181, 178, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 153, 154, 165, 168, 169, 170, 171, 172,
+ 173, 175, 177, 0, 155, 157, 156, 179, 0, 0,
+ 623, 0, 0, 180, 159, 163, 162, 0, 0, 0,
+ 0, 0, 158, 0, 160, 164, 166, 167, 174, 176,
+ 161, 181, 178, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 153, 154, 165, 168,
+ 169, 170, 171, 172, 173, 175, 177, 0, 155, 157,
+ 156, 179, 0, 0, 622, 0, 0, 180, 159, 163,
+ 162, 0, 0, 0, 0, 0, 158, 0, 160, 164,
+ 166, 167, 174, 176, 161, 181, 178, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 153, 154, 165, 168, 169, 170, 171, 172, 173, 175,
+ 177, 0, 0, 0, 605, 155, 157, 156, 179, 0,
+ 0, 180, 159, 163, 162, 0, 0, 0, 0, 0,
+ 158, 0, 160, 164, 166, 167, 174, 176, 161, 0,
+ 0, 0, 181, 178, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 153, 154, 165,
+ 168, 169, 170, 171, 172, 173, 175, 177, 0, 155,
+ 157, 156, 179, 0, 0, 596, 0, 0, 180, 159,
+ 163, 162, 0, 0, 0, 0, 0, 158, 0, 160,
+ 164, 166, 167, 174, 176, 161, 181, 178, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 153, 154, 165, 168, 169, 170, 171, 172, 173,
+ 175, 177, 567, 0, 0, 586, 155, 157, 156, 179,
+ 0, 0, 180, 159, 163, 162, 0, 0, 0, 0,
+ 0, 158, 0, 160, 164, 166, 167, 174, 176, 161,
+ 0, 0, 0, 181, 178, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 153, 154,
+ 165, 168, 169, 170, 171, 172, 173, 175, 177, 0,
+ 155, 157, 156, 179, 0, 0, 584, 0, 0, 180,
+ 159, 163, 162, 0, 0, 0, 0, 0, 158, 0,
+ 160, 164, 166, 167, 174, 176, 161, 181, 178, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 153, 154, 165, 168, 169, 170, 171, 172,
+ 173, 175, 177, 0, 155, 157, 156, 179, 0, 0,
+ 0, 0, 0, 180, 159, 163, 162, 0, 0, 0,
+ 0, 0, 158, 0, 160, 164, 166, 167, 174, 176,
+ 161, 181, 178, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 153, 154, 165, 168,
+ 169, 170, 171, 172, 173, 175, 177, 0, 155, 157,
+ 156, 179, 563, 0, 0, 0, 0, 180, 159, 163,
+ 162, 0, 0, 0, 0, 0, 158, 0, 160, 164,
+ 166, 167, 174, 176, 161, 181, 178, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 153, 154, 165, 168, 169, 170, 171, 172, 173, 175,
+ 177, 0, 155, 157, 156, 179, 0, 0, 557, 0,
+ 0, 180, 159, 163, 162, 0, 0, 0, 0, 0,
+ 158, 0, 160, 164, 166, 167, 174, 176, 161, 181,
+ 178, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 153, 154, 165, 168, 169, 170,
+ 171, 172, 173, 175, 177, 0, 155, 157, 156, 179,
+ 0, 0, 553, 0, 0, 180, 159, 163, 162, 0,
+ 0, 0, 0, 0, 158, 0, 160, 164, 166, 167,
+ 174, 176, 161, 181, 178, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 412, 0, 0, 0, 153, 154,
+ 165, 168, 169, 170, 171, 172, 173, 175, 177, 0,
+ 0, 0, 0, 0, 0, 0, 417, 0, 0, 180,
+ 159, 163, 162, 155, 157, 156, 179, 0, 158, 0,
+ 160, 164, 166, 167, 174, 176, 161, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 181, 178, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 153, 154, 165, 168, 169,
+ 170, 171, 172, 173, 175, 177, 0, 155, 157, 156,
+ 179, 0, 0, 0, 0, 0, 180, 159, 163, 162,
+ 0, 0, 0, 0, 0, 158, 0, 160, 164, 166,
+ 167, 174, 176, 161, 181, 178, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 153,
+ 154, 165, 168, 169, 170, 171, 172, 173, 175, 177,
+ 0, 0, 0, 0, 373, 155, 157, 156, 179, 0,
+ 180, 159, 163, 162, 0, 0, 0, 0, 0, 158,
+ 0, 160, 164, 166, 167, 174, 176, 161, 0, 0,
+ 0, 0, 181, 178, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 153, 154, 165,
+ 168, 169, 170, 171, 172, 173, 175, 177, 0, 0,
+ 0, 0, 152, 155, 157, 156, 179, 0, 180, 159,
+ 163, 162, 0, 0, 0, 0, 0, 158, 0, 160,
+ 164, 166, 167, 174, 176, 161, 0, 0, 0, 0,
+ 181, 178, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 153, 154, 165, 168, 169,
+ 170, 171, 172, 173, 175, 177, 0, 0, 157, 156,
+ 179, 0, 0, 0, 0, 0, 180, 159, 163, 162,
+ 0, 0, 0, 0, 0, 158, 0, 160, 164, 166,
+ 167, 174, 176, 161, 181, 178, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 153,
+ 154, 165, 168, 169, 170, 171, 172, 173, 175, 177,
+ 0, 0, 0, 156, 179, 0, 0, 0, 0, 0,
+ 180, 159, 163, 162, 0, 0, 0, 0, 0, 158,
+ 0, 160, 164, 166, 167, 174, 176, 161, 181, 178,
+ 428, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 153, 154, 165, 168, 169, 170, 171,
+ 172, 173, 175, 177, 0, 0, 0, 0, 0, 0,
+ 0, 0, 179, 0, 180, 159, 163, 162, 0, 0,
+ 0, 0, 0, 158, 0, 160, 164, 166, 167, 174,
+ 176, 161, 0, 0, 0, 0, 181, 178, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 153, 154, 165, 168, 169, 170, 171, 172, 173,
+ 175, 177, 0, 0, 0, 0, 179, 0, 0, 0,
+ 0, 0, 180, 159, 163, 162, 0, 0, 0, 0,
+ 0, 158, 0, 160, 164, 166, 167, 174, 176, 161,
+ 181, 178, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 153, 154, 165, 168, 169,
+ 170, 171, 172, 173, 175, 177, 0, 0, 0, 0,
+ 179, 0, 0, 0, 0, 0, 180, 159, 163, 162,
+ 0, 0, 0, 0, 0, 158, 0, 160, 164, 166,
+ 167, 174, 176, 161, 181, 178, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 153,
+ 154, 165, 168, 169, 170, 171, 172, 173, 175, 177,
+ 0, 0, 0, 179, 0, 0, 0, 0, 0, 0,
+ 0, 159, 163, 162, 0, 0, 0, 0, 0, 158,
+ 0, 160, 164, 166, 167, 174, 176, 161, 178, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 179, 154, 165, 168, 169, 170, 171, 172,
+ 173, 175, 177, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 159, 163, 162, 178, 0, 0,
+ 0, 0, 158, 0, 160, 164, 166, 167, 174, 176,
+ 161, 179, 0, 165, 168, 169, 170, 171, 172, 173,
+ 175, 177, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 159, 163, 162, 178, 0, 0, 0,
+ 0, 158, 0, 160, 164, 166, 167, 174, 176, 161,
+ 179, 0, 165, 168, 169, 170, 171, 172, 173, 175,
+ 177, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 159, 163, 162, 178, 0, 0, 0, 0,
+ 0, 0, 160, 164, 166, 167, 174, 176, 161, 179,
+ 0, 165, 168, 169, 170, 171, 172, 173, 175, 177,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 159, 163, 162, 178, 0, 0, 0, 0, 0,
+ 0, 0, 164, 166, 167, 174, 176, 161, 0, 0,
+ 165, 168, 169, 170, 171, 172, 173, 175, 177, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 163, 162, 443, 444, 454, 455, 0, 0, 434,
+ 0, 164, 166, 167, 174, 176, 161, 0, 459, 460,
+ 461, 462, 463, 464, 465, 466, 467, 468, 469, 489,
+ 490, 491, 492, 493, 481, 482, 483, 484, 485, 470,
+ 471, 472, 473, 474, 475, 476, 477, 478, 479, 480,
+ 0, 501, 499, 500, 496, 497, 0, 0, 488, 494,
+ 495, 502, 503, 505, 504, 506, 507, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 498, 509,
+ 508, 0, 0, 445, 446, 447, 448, 449, 450, 451,
+ 452, 453, 456, 457, 458, 486, 487, 437, 438, 439,
+ 440, 441, 442, 443, 444, 454, 455, 0, 0, 916,
+ 0, 0, 0, 0, 0, 0, 0, 0, 459, 460,
+ 461, 462, 463, 464, 465, 466, 467, 468, 469, 489,
+ 490, 491, 492, 493, 481, 482, 483, 484, 485, 470,
+ 471, 472, 473, 474, 475, 476, 477, 478, 479, 480,
+ 0, 501, 499, 500, 496, 497, 0, 0, 488, 494,
+ 495, 502, 503, 505, 504, 506, 507, 117, 0, 105,
+ 0, 0, 0, 0, 0, 110, 0, 0, 498, 509,
+ 508, 0, 0, 445, 446, 447, 448, 449, 450, 451,
+ 452, 453, 456, 457, 458, 486, 487, 745, 746, 747,
+ 744, 743, 742, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 655, 109, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 134, 0, 0, 112,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 233, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 231, 0, 656, 0, 0, 654, 0,
+ 0, 0, 0, 0, 106,
}
var yyPact = [...]int{
- -1000, -1000, 1195, -1000, -1000, -1000, -1000, -1000, -1000, -1000,
- 262, 522, 588, 770, -1000, -1000, -1000, 258, 3945, 257,
- 255, 6889, 6889, 6889, 135, 749, 6889, -1000, 5185, 254,
- 248, 244, -1000, 450, 6889, 800, 275, 23, 578, 792,
- 790, 788, 509, 520, 402, -1000, -1000, 239, -1000, -1000,
- 133, 236, 6103, 6889, 511, 511, 6889, 6889, 6889, 6889,
- 6889, -1000, -1000, 6889, 6889, 6889, 6889, 6889, 6889, 6889,
- 232, 6889, -1000, 827, 6889, 6889, 6889, -1000, -1000, -1000,
- 98, -1000, 557, 554, -1000, 351, 226, 223, 6889, 6889,
- 221, 6889, 6889, -1000, -1000, -1000, -1000, -1000, -1000, -1000,
- -1000, -1000, -1000, 787, 813, -1000, 108, 202, 202, 213,
- -1000, 525, 760, 175, 760, 288, -1000, -1000, 349, 614,
- 10, 625, 760, -1000, -1000, -1000, -1000, 8, -1000, -18,
- 2924, 6889, 695, 23, 524, 6889, 6889, 348, 5239, 662,
- 343, 340, 5, -1000, -1000, -5, 23, -1000, -19, -7,
- -1000, 5239, -1000, 6889, 6889, 6889, 6889, 6889, 6889, 6889,
- 6889, 6889, 6889, 6889, 6889, 6889, 6889, 6889, 6889, 6889,
- 6889, 6889, 6889, 6889, 6889, 6889, 6889, 6889, 6889, 589,
- 6758, 6889, 511, 6889, 770, -1000, 5131, 339, -1000, 785,
- -1000, 781, -1000, 585, -1000, 593, 211, 3945, 210, 336,
- 271, 6627, 6889, 6889, 6889, 6889, 6889, 6889, 6889, 6889,
- 6889, 6889, 6889, 6889, -1000, -1000, 6889, 6889, 6889, 97,
- 6103, 119, 18, -1000, -1000, 5077, 511, 209, -1000, -1000,
- 98, 6889, -1000, -1000, 6103, -1000, -82, -82, 16, -82,
- 5019, -82, -82, -82, -82, -82, -82, -82, -1000, 6889,
- -82, 454, 683, 799, -1000, 143, 6496, 511, 5628, 5574,
- 5628, 6889, 3188, 3188, 202, -1000, 550, 291, 202, -1000,
- -1000, 6889, 6889, 5239, 5239, 6889, 5239, 5239, 730, -1000,
- 700, 575, 683, 6889, -1000, -1000, 5972, -1000, 6103, 779,
- 525, 333, 525, -1000, -1000, 1062, -1000, 330, -10, 615,
- 760, -1000, 609, 553, 777, 604, -1000, -1000, 770, 6889,
- -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, 208, 4965,
- 206, -1000, 329, 17, 5239, 4911, -1000, -1000, -1000, -1000,
- 135, -1000, 722, -1000, 6889, -1000, 6889, 5735, 5788, 338,
- 5628, 5520, 5841, 6874, 3931, 138, 138, 138, 16, -82,
- 16, 16, 187, 187, 316, 316, 316, 316, 130, 130,
- 130, 130, 316, -1000, 4857, 6889, 5682, 13, -1000, -1000,
- 4803, -11, 2791, -1000, -1000, -1000, 205, 585, 583, 611,
- 447, -1000, 611, 6889, -1000, 6889, -1000, -1000, 5628, 6889,
- 5628, 5628, 5628, 5628, 5628, 5628, 5628, 5628, 5628, 5628,
- 5628, 5628, 4749, 117, 4695, 202, -1000, 6889, -1000, 166,
- -24, 6103, 6365, -1000, 6103, 4641, 104, -1000, 162, -1000,
- -1000, -1000, -1000, 227, 764, 4587, 113, 405, 6889, 96,
- 202, -1000, -1000, 6889, -1000, -1000, -1000, -1000, -1000, -1000,
+ -1000, -1000, 1241, -1000, -1000, -1000, -1000, -1000, -1000, -1000,
+ 224, 451, 569, 683, -1000, -1000, -1000, 217, 4449, 214,
+ 211, 5600, 5600, 5600, 131, 640, 5600, -1000, 6798, 209,
+ 207, 206, -1000, 379, 5600, 724, 232, 0, 495, 721,
+ 715, 713, 455, 446, 940, -1000, -1000, 205, -1000, -1000,
+ 126, 204, 4940, 5600, 618, 618, 5600, 5600, 5600, 5600,
+ 5600, -1000, -1000, 5600, 5600, 5600, 5600, 5600, 5600, 5600,
+ 203, 5600, -1000, 827, 5600, 5600, 5600, -1000, -1000, -1000,
+ 82, -1000, 503, 500, -1000, 280, 202, 200, 5600, 5600,
+ 192, 5600, 5600, -1000, -1000, -1000, -1000, -1000, -1000, -1000,
+ -1000, -1000, -1000, 787, 799, -1000, 136, 172, 172, 190,
+ -1000, 487, 662, 139, 662, 227, -1000, -1000, 314, 553,
+ -13, 542, 662, -1000, -1000, -1000, -1000, -28, -1000, -58,
+ 3269, 5600, 594, 0, 462, 5600, 5600, 313, 6856, 567,
+ 311, 302, -29, -1000, -1000, -30, 0, -1000, -59, -32,
+ -1000, 6856, -1000, 5600, 5600, 5600, 5600, 5600, 5600, 5600,
+ 5600, 5600, 5600, 5600, 5600, 5600, 5600, 5600, 5600, 5600,
+ 5600, 5600, 5600, 5600, 5600, 5600, 5600, 5600, 5600, 344,
+ 5490, 5600, 618, 5600, 683, -1000, 6740, 301, -1000, 710,
+ -1000, 703, -1000, 532, -1000, 543, 188, 4449, 185, 300,
+ 216, 5380, 5600, 5600, 5600, 5600, 5600, 5600, 5600, 5600,
+ 5600, 5600, 5600, 5600, -1000, -1000, 5600, 5600, 5600, 95,
+ 4940, 74, -11, -1000, -1000, 6686, 618, 183, -1000, -1000,
+ 82, 5600, -1000, -1000, 4940, -1000, 403, 403, 412, 403,
+ 6619, 403, 403, 403, 403, 403, 403, 403, -1000, 5600,
+ 403, 388, 619, 793, -1000, 163, 5270, 618, 7076, 7022,
+ 7076, 5600, 3579, 3579, 172, -1000, 499, 191, 172, -1000,
+ -1000, 5600, 5600, 6856, 6856, 5600, 6856, 6856, 705, -1000,
+ 695, 498, 619, 5600, -1000, -1000, 4828, -1000, 4940, 694,
+ 487, 299, 487, -1000, -1000, 1085, -1000, 296, -33, 537,
+ 662, -1000, 552, 472, 693, 531, -1000, -1000, 683, 5600,
+ -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, 182, 6565,
+ 180, -1000, 295, -12, 6856, 6511, -1000, -1000, -1000, -1000,
+ 131, -1000, 646, -1000, 5600, -1000, 5600, 7183, 7222, 6910,
+ 7076, 6964, 7261, 7339, 7300, 132, 132, 132, 412, 403,
+ 412, 412, 254, 254, 321, 321, 321, 321, 150, 150,
+ 150, 150, 321, -1000, 6457, 5600, 7130, -14, -1000, -1000,
+ 6403, -34, 3113, -1000, -1000, -1000, 179, 532, 520, 544,
+ 377, -1000, 544, 5600, -1000, 5600, -1000, -1000, 7076, 5600,
+ 7076, 7076, 7076, 7076, 7076, 7076, 7076, 7076, 7076, 7076,
+ 7076, 7076, 6349, 67, 6292, 172, -1000, 5600, -1000, 130,
+ -65, 4940, 5160, -1000, 4940, 6238, 66, -1000, 128, -1000,
+ -1000, -1000, -1000, 215, 665, 6181, 52, 334, 5600, 43,
+ 172, -1000, -1000, 5600, -1000, -1000, -1000, -1000, -1000, -1000,
-1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000,
-1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000,
-1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000,
@@ -1351,117 +1380,117 @@ var yyPact = [...]int{
-1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000,
-1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000,
-1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000,
- 202, -1000, -1000, -1000, -1000, 135, 6889, 6889, 97, 135,
- 585, 11, -1000, 5239, 4533, 4479, -1000, -1000, -1000, 4425,
- -1000, 9, -1000, 5239, 6889, 159, -1000, -1000, 929, -1000,
- -1000, -1000, 527, 567, -1000, 760, 565, 735, -1000, 523,
- -1000, 5239, 158, 3814, 6889, 6889, 6889, 204, -1000, -1000,
- 199, 5239, -1000, 6889, 5682, 157, 511, 7196, 3683, -1000,
- 196, 278, 583, -1000, 611, -1000, -1000, 443, -12, -1000,
- 4371, 4317, 2658, 6874, 3552, -1000, -1000, -1000, 4263, -41,
- 6889, -1000, 5239, 511, 195, 155, -1000, -1000, -1000, 89,
- -1000, -1000, 707, -1000, -1000, -1000, -1000, 6889, -1000, 5628,
- -1000, -1000, 4209, -1000, -1000, 69, 4155, -1000, -1000, 583,
- 154, 6889, -1000, -1000, -1000, 151, 6234, 5239, -1000, -1000,
- 760, 510, 0, -1000, -1000, 760, 735, -1000, 327, -1000,
- -1000, -1000, 4101, 323, 5239, -1000, 322, 321, 278, 5682,
- 319, -1000, 150, 580, 511, 191, 6103, -1000, -1000, -1000,
- 696, 278, 147, 4, -1000, 60, -1000, -1000, 621, -1000,
- -1000, -1000, -1000, 441, -12, 4335, -1000, 611, 3945, 270,
- 314, -1000, -1000, -1000, 6889, 5628, -1000, 6103, -41, -1000,
- -1000, 4047, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000,
- -8, -1000, 760, 396, 735, -1000, 0, -1000, 2525, 311,
- 6889, 406, -1000, 786, -1000, 141, -1000, 3290, 7196, -1000,
- 6103, 63, 2392, -1000, 186, 435, 139, 631, 278, 498,
- -1000, -1000, 434, -1000, -1000, -1000, 717, 718, 611, 665,
- -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, 4065, -1000,
- -1000, -1000, -1000, 3057, 5628, 131, 395, 417, 388, 760,
- -8, -1000, -1000, 366, 310, -1000, 129, -1000, 6889, 190,
- 404, 302, 750, 631, -1000, -1000, -1000, 127, -1000, 125,
- -1000, 300, 611, -1000, 132, 132, 184, -1000, 719, -1000,
- -1000, 793, -13, -1000, -31, 7038, 23, -25, -1000, -1000,
- 3057, -41, -1000, -1000, -1000, -1000, 364, -1000, -1000, 3421,
- 3993, -1000, -1000, -1000, -1000, -1000, 296, 132, 2259, 3290,
- -1000, -1000, 74, -1000, 2126, 415, 278, 409, 180, -48,
- 475, -1000, -1000, 717, -1000, 6889, -20, -1000, -49, 7038,
- -1000, -1000, 5505, 411, -1000, -1000, -1000, -1000, -1000, 3057,
- -1000, 408, 293, -1000, 124, 611, -1000, -1000, -1000, -1000,
- -33, -1000, -1000, 713, 6889, -1000, -1000, 5239, -1000, 7038,
- 6889, -1000, -1000, 5403, -1000, 290, 283, 613, 684, 542,
- -1000, 524, -1000, -1000, 1993, 3057, -1000, -1000, 352, -1000,
- 1860, 1727, -1000, 180, -1000, 5239, -1000, -1000, 5239, 177,
- -1000, -1000, -1000, -1000, 611, 7138, 7038, 192, 1594, -1000,
- -1000, -1000, -1000, -1000, 278, -12, -1000, -1000, 7038, -1000,
- -1000, -1000, 1461, 122, -1000, -1000, 132, 299, -1000, -1000,
- -1000, 1328, -1000,
+ 172, -1000, -1000, -1000, -1000, 131, 5600, 5600, 95, 131,
+ 532, -18, -1000, 6856, 6127, 6073, -1000, -1000, -1000, 6016,
+ -1000, -19, -1000, 6856, 5600, 124, -1000, -1000, 929, -1000,
+ -1000, -1000, 461, 517, -1000, 662, 508, 644, -1000, 460,
+ -1000, 6856, 118, 4295, 5600, 5600, 5600, 177, -1000, -1000,
+ 170, 6856, -1000, 5600, 7130, 113, 618, 7647, 4141, -1000,
+ 162, 471, 520, -1000, 544, -1000, -1000, 374, -40, -1000,
+ 5962, 5908, 2957, 7339, 3987, -1000, -1000, -1000, 5851, -73,
+ 5600, -1000, 6856, 618, 161, 112, -1000, -1000, -1000, 41,
+ -1000, -1000, 607, -1000, -1000, -1000, -1000, 5600, -1000, 7076,
+ -1000, -1000, 5794, -1000, -1000, 40, 5737, -1000, -1000, 520,
+ 111, 5600, -1000, -1000, -1000, 108, 5050, 6856, -1000, -1000,
+ 662, 454, -31, -1000, -1000, 662, 644, -1000, 294, -1000,
+ -1000, -1000, 5683, 292, 6856, -1000, 291, 289, 471, 7130,
+ 288, -1000, 107, 515, 618, 159, 4940, -1000, -1000, -1000,
+ 591, 471, 106, -23, -1000, 2, -1000, -1000, 677, -1000,
+ -1000, -1000, -1000, 367, -40, 1421, -1000, 544, 4449, 178,
+ 287, -1000, -1000, -1000, 5600, 7076, -1000, 4940, -73, -1000,
+ -1000, 5629, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000,
+ -38, -1000, 662, 326, 644, -1000, -31, -1000, 2801, 286,
+ 5600, 395, -1000, 696, -1000, 104, -1000, 3679, 7647, -1000,
+ 4940, 39, 2645, -1000, 158, 366, 102, 557, 471, 459,
+ -1000, -1000, 365, -1000, -1000, -1000, 627, 633, 544, 546,
+ -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, 1265, -1000,
+ -1000, -1000, -1000, 3425, 7076, 99, 325, 362, 324, 662,
+ -38, -1000, -1000, 323, 276, -1000, 98, -1000, 5600, 155,
+ 360, 270, 659, 557, -1000, -1000, -1000, 96, -1000, 92,
+ -1000, 266, 544, -1000, 97, 97, 151, -1000, 630, -1000,
+ -1000, 1109, -35, -1000, -72, 7489, 0, -48, -1000, -1000,
+ 3425, -73, -1000, -1000, -1000, -1000, 322, -1000, -1000, 3833,
+ 361, -1000, -1000, -1000, -1000, -1000, 265, 97, 2489, 3679,
+ -1000, -1000, 79, -1000, 2333, 347, 471, 338, 140, -74,
+ 953, -1000, -1000, 627, -1000, 5600, -36, -1000, -75, 7489,
+ -1000, -1000, 4728, 730, -1000, -1000, -1000, -1000, -1000, 3425,
+ -1000, 337, 260, -1000, 86, 544, -1000, -1000, -1000, -1000,
+ -41, -1000, -1000, 613, 5600, -1000, -1000, 6856, -1000, 7489,
+ 5600, -1000, -1000, 4603, -1000, 253, 237, 547, 580, 494,
+ -1000, 462, -1000, -1000, 2177, 3425, -1000, -1000, 336, -1000,
+ 2021, 1865, -1000, 140, -1000, 6856, -1000, -1000, 6856, 133,
+ -1000, -1000, -1000, -1000, 544, 7589, 7489, 236, 1709, -1000,
+ -1000, -1000, -1000, -1000, 471, -40, -1000, -1000, 7489, -1000,
+ -1000, -1000, 1553, 84, -1000, -1000, 97, 261, -1000, -1000,
+ -1000, 1397, -1000,
}
var yyPgo = [...]int{
- 0, 960, 958, 51, 9, 957, 3, 955, 11, 31,
- 79, 78, 49, 45, 953, 21, 951, 73, 19, 55,
- 946, 0, 80, 945, 944, 38, 141, 47, 25, 942,
- 36, 940, 56, 62, 930, 10, 928, 927, 925, 924,
- 13, 46, 923, 921, 100, 84, 199, 920, 918, 917,
- 5, 909, 83, 40, 908, 138, 43, 907, 906, 902,
- 901, 900, 119, 898, 897, 887, 886, 12, 883, 880,
- 44, 42, 32, 2, 15, 665, 8, 771, 20, 879,
- 873, 872, 41, 74, 623, 870, 121, 869, 868, 866,
- 71, 858, 33, 856, 855, 30, 37, 853, 852, 28,
- 845, 835, 459, 833, 18, 832, 831, 26, 829, 63,
- 1, 4, 828, 17, 823, 39, 822, 815, 814, 7,
- 812, 6, 809, 803, 14, 797, 29, 16,
+ 0, 897, 896, 51, 9, 895, 3, 29, 16, 894,
+ 11, 31, 79, 78, 49, 45, 893, 21, 892, 73,
+ 19, 55, 891, 0, 80, 890, 889, 38, 141, 25,
+ 887, 36, 886, 56, 62, 883, 10, 880, 879, 872,
+ 868, 13, 46, 866, 858, 100, 84, 199, 856, 855,
+ 853, 5, 852, 83, 40, 845, 138, 43, 840, 837,
+ 835, 825, 823, 119, 822, 819, 818, 817, 12, 815,
+ 814, 44, 42, 32, 2, 15, 629, 41, 74, 812,
+ 809, 807, 14, 806, 803, 47, 39, 802, 18, 8,
+ 686, 20, 536, 800, 121, 798, 797, 795, 71, 791,
+ 33, 789, 787, 30, 37, 786, 784, 28, 783, 776,
+ 545, 773, 768, 767, 26, 765, 63, 1, 4, 763,
+ 17, 761, 760, 755, 7, 745, 6, 742,
}
var yyR1 = [...]int{
- 0, 125, 4, 4, 4, 4, 4, 4, 4, 4,
+ 0, 127, 4, 4, 4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4, 4, 4, 4, 5,
- 5, 5, 5, 5, 5, 5, 6, 6, 109, 109,
- 86, 86, 8, 8, 8, 7, 7, 7, 7, 7,
- 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
- 77, 77, 14, 14, 16, 16, 126, 126, 96, 96,
- 95, 95, 102, 102, 15, 15, 18, 18, 17, 17,
- 90, 90, 110, 110, 20, 20, 20, 20, 20, 20,
- 20, 9, 9, 9, 9, 9, 9, 9, 9, 9,
+ 5, 5, 5, 5, 5, 5, 6, 6, 116, 116,
+ 94, 94, 10, 10, 10, 9, 9, 9, 9, 9,
9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
- 9, 9, 9, 9, 9, 88, 88, 87, 87, 24,
- 24, 101, 101, 25, 10, 1, 1, 2, 2, 11,
- 11, 120, 120, 75, 75, 12, 13, 27, 27, 114,
- 114, 115, 115, 78, 78, 78, 78, 123, 123, 124,
- 124, 23, 23, 80, 80, 80, 80, 99, 99, 99,
- 127, 127, 122, 122, 66, 66, 64, 64, 68, 68,
- 65, 65, 111, 111, 112, 112, 28, 28, 29, 29,
- 74, 74, 72, 72, 72, 73, 73, 82, 82, 108,
- 108, 30, 30, 94, 94, 32, 98, 98, 33, 33,
- 113, 113, 34, 34, 34, 34, 119, 119, 81, 81,
- 81, 100, 100, 35, 35, 36, 37, 37, 37, 37,
- 39, 39, 38, 79, 79, 117, 117, 116, 116, 118,
- 118, 76, 76, 76, 76, 76, 76, 97, 97, 40,
- 40, 89, 89, 67, 19, 91, 91, 41, 92, 92,
- 93, 93, 43, 42, 42, 31, 31, 31, 31, 31,
- 31, 31, 31, 31, 31, 31, 31, 31, 31, 31,
- 31, 31, 31, 31, 31, 31, 31, 31, 31, 31,
- 31, 31, 31, 31, 31, 31, 31, 31, 31, 31,
- 31, 31, 31, 31, 31, 31, 31, 31, 31, 31,
- 31, 31, 31, 31, 31, 31, 31, 31, 31, 31,
- 31, 31, 31, 31, 31, 31, 31, 31, 31, 31,
- 31, 31, 31, 31, 31, 31, 31, 31, 31, 31,
- 31, 121, 3, 3, 104, 104, 103, 103, 50, 50,
- 51, 51, 51, 51, 44, 44, 45, 45, 48, 48,
- 85, 85, 85, 83, 83, 55, 55, 55, 49, 49,
- 49, 49, 49, 49, 49, 49, 49, 49, 49, 49,
- 49, 49, 49, 49, 56, 56, 56, 21, 21, 22,
- 22, 54, 57, 57, 57, 58, 58, 58, 59, 59,
- 59, 59, 59, 59, 26, 26, 26, 46, 46, 46,
- 60, 60, 61, 61, 61, 61, 61, 61, 52, 52,
- 52, 53, 53, 53, 107, 70, 70, 106, 106, 69,
- 69, 69, 69, 69, 69, 84, 84, 84, 84, 62,
- 62, 62, 62, 62, 62, 62, 63, 63, 63, 63,
- 47, 47, 47, 47, 47, 47, 47, 105, 105, 71,
+ 90, 90, 16, 16, 18, 18, 7, 7, 104, 104,
+ 103, 103, 110, 110, 17, 17, 20, 20, 19, 19,
+ 98, 98, 117, 117, 22, 22, 22, 22, 22, 22,
+ 22, 11, 11, 11, 11, 11, 11, 11, 11, 11,
+ 11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
+ 11, 11, 11, 11, 11, 96, 96, 95, 95, 26,
+ 26, 109, 109, 27, 12, 1, 1, 2, 2, 13,
+ 13, 125, 125, 76, 76, 14, 15, 85, 85, 87,
+ 87, 86, 86, 91, 91, 91, 91, 83, 83, 82,
+ 82, 25, 25, 80, 80, 80, 80, 107, 107, 107,
+ 8, 8, 84, 84, 67, 67, 65, 65, 69, 69,
+ 66, 66, 118, 118, 119, 119, 29, 29, 30, 30,
+ 75, 75, 73, 73, 73, 74, 74, 77, 77, 115,
+ 115, 31, 31, 102, 102, 33, 106, 106, 34, 34,
+ 120, 120, 35, 35, 35, 35, 124, 124, 79, 79,
+ 79, 108, 108, 36, 36, 37, 38, 38, 38, 38,
+ 40, 40, 39, 81, 81, 122, 122, 121, 121, 123,
+ 123, 89, 89, 89, 89, 89, 89, 105, 105, 41,
+ 41, 97, 97, 68, 21, 99, 99, 42, 100, 100,
+ 101, 101, 44, 43, 43, 32, 32, 32, 32, 32,
+ 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
+ 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
+ 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
+ 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
+ 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
+ 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
+ 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
+ 32, 126, 3, 3, 88, 88, 111, 111, 51, 51,
+ 52, 52, 52, 52, 45, 45, 46, 46, 49, 49,
+ 93, 93, 93, 78, 78, 56, 56, 56, 50, 50,
+ 50, 50, 50, 50, 50, 50, 50, 50, 50, 50,
+ 50, 50, 50, 50, 57, 57, 57, 23, 23, 24,
+ 24, 55, 58, 58, 58, 59, 59, 59, 60, 60,
+ 60, 60, 60, 60, 28, 28, 28, 47, 47, 47,
+ 61, 61, 62, 62, 62, 62, 62, 62, 53, 53,
+ 53, 54, 54, 54, 114, 71, 71, 113, 113, 70,
+ 70, 70, 70, 70, 70, 92, 92, 92, 92, 63,
+ 63, 63, 63, 63, 63, 63, 64, 64, 64, 64,
+ 48, 48, 48, 48, 48, 48, 48, 112, 112, 72,
}
var yyR2 = [...]int{
@@ -1517,50 +1546,50 @@ var yyR2 = [...]int{
}
var yyChk = [...]int{
- -1000, -125, -109, -7, 2, -9, -10, -11, -12, -13,
- 51, 79, 44, 38, 119, -64, -65, 21, 20, 23,
- 30, 34, 35, 39, 46, 98, 19, 14, -21, 48,
- 25, 27, 121, 40, 43, 36, 10, 37, -120, 52,
- 53, 54, -66, -68, -26, -31, -75, 7, -59, -60,
- -57, 59, 125, 92, 104, 105, 130, 129, 131, 132,
- 123, -42, -47, 107, 108, 109, 110, 111, 112, 113,
- 6, 133, -49, 118, 96, 97, 106, 99, 100, -46,
- -56, -51, -44, -54, -55, 91, 49, 50, 4, 5,
+ -1000, -127, -116, -9, 2, -11, -12, -13, -14, -15,
+ 51, 79, 44, 38, 142, -65, -66, 21, 20, 23,
+ 30, 34, 35, 39, 46, 98, 19, 14, -23, 48,
+ 25, 27, 144, 40, 43, 36, 10, 37, -125, 52,
+ 53, 54, -67, -69, -28, -32, -76, 7, -60, -61,
+ -58, 59, 148, 92, 104, 105, 153, 152, 154, 155,
+ 146, -43, -48, 107, 108, 109, 110, 111, 112, 113,
+ 6, 156, -50, 141, 96, 97, 106, 99, 100, -47,
+ -57, -52, -45, -55, -56, 91, 49, 50, 4, 5,
84, 85, 86, 8, 9, 66, 67, 81, 63, 64,
- 65, 80, 62, 74, 117, 12, 134, -8, -58, 60,
- 18, -86, 82, 123, 82, -86, 119, 10, -16, -77,
- -102, -86, 82, 37, 38, -17, -18, -90, -19, 10,
- -110, 123, -9, 37, 79, 123, 123, -22, -21, 98,
- -22, -22, -94, -32, -46, -98, 37, -33, 12, -91,
- -41, -21, 121, 149, 150, 87, 89, 88, 151, 128,
- 152, 163, 130, 129, 164, 167, 165, 166, 161, 162,
- 155, 156, 153, 154, 157, 158, 159, 160, 115, 90,
- 127, 114, 123, 123, 123, 119, -21, 10, 122, -3,
- 128, 52, -75, 10, 10, 10, 93, 94, 93, 95,
- 94, 136, 137, 138, 139, 148, 140, 141, 142, 143,
- 144, 145, 146, 147, 104, 105, 123, 125, 119, 57,
- 123, -107, -106, -70, -69, -21, 128, 59, -21, -26,
- -56, 123, -55, 98, 125, -26, -21, -21, -21, -21,
- -21, -21, -21, -21, -21, -21, -21, -21, -48, 123,
- -21, -85, 17, -84, -62, 12, 76, 77, -21, -21,
- -21, 125, 78, 78, -45, -43, -44, -61, 52, -8,
- -46, 123, 123, -21, -21, 123, -21, -21, 17, 75,
- -84, -84, 17, 119, -46, -82, 123, -82, 123, 82,
- -86, 124, -86, 121, 119, -109, 121, -14, -102, -86,
- 82, 121, 135, 82, 29, -86, -18, 121, 135, 136,
- -20, 120, 2, -9, -10, -11, -12, -13, 51, -21,
- 21, -3, -92, -93, -21, -21, 121, 121, 121, 121,
- 135, 121, 135, -3, 136, 121, 135, -21, -21, -21,
- -21, -21, -21, -21, -21, -21, -21, -21, -21, -21,
- -21, -21, -21, -21, -21, -21, -21, -21, -21, -21,
- -21, -21, -21, -45, -21, 122, -21, -101, -25, -26,
- -21, -90, -110, 121, 121, 10, -121, 10, -27, 55,
- -121, -114, 55, 123, -9, 123, 121, 122, -21, 128,
- -21, -21, -21, -21, -21, -21, -21, -21, -21, -21,
- -21, -21, -21, -22, -21, -53, 10, 119, -46, -107,
- 126, 135, 58, -26, 123, -21, -107, 124, -22, 118,
- -62, -62, 17, 125, 57, -21, 11, -26, 58, -22,
- -52, -6, -46, 119, 10, -5, -4, 98, 99, 100,
+ 65, 80, 62, 74, 140, 12, 157, -10, -59, 60,
+ 18, -94, 82, 146, 82, -94, 142, 10, -18, -90,
+ -110, -94, 82, 37, 38, -19, -20, -98, -21, 10,
+ -117, 146, -11, 37, 79, 146, 146, -24, -23, 98,
+ -24, -24, -102, -33, -47, -106, 37, -34, 12, -99,
+ -42, -23, 144, 129, 130, 87, 89, 88, 159, 151,
+ 161, 167, 153, 152, 162, 131, 163, 164, 132, 133,
+ 134, 135, 136, 137, 165, 138, 166, 139, 115, 90,
+ 150, 114, 146, 146, 146, 142, -23, 10, 145, -3,
+ 151, 52, -76, 10, 10, 10, 93, 94, 93, 95,
+ 94, 160, 117, 118, 119, 120, 121, 122, 123, 124,
+ 125, 126, 127, 128, 104, 105, 146, 148, 142, 57,
+ 146, -114, -113, -71, -70, -23, 151, 59, -23, -28,
+ -57, 146, -56, 98, 148, -28, -23, -23, -23, -23,
+ -23, -23, -23, -23, -23, -23, -23, -23, -49, 146,
+ -23, -93, 17, -92, -63, 12, 76, 77, -23, -23,
+ -23, 148, 78, 78, -46, -44, -45, -62, 52, -10,
+ -47, 146, 146, -23, -23, 146, -23, -23, 17, 75,
+ -92, -92, 17, 142, -47, -77, 146, -77, 146, 82,
+ -94, 147, -94, 144, 142, -116, 144, -16, -110, -94,
+ 82, 144, 158, 82, 29, -94, -20, 144, 158, 160,
+ -22, 143, 2, -11, -12, -13, -14, -15, 51, -23,
+ 21, -3, -100, -101, -23, -23, 144, 144, 144, 144,
+ 158, 144, 158, -3, 160, 144, 158, -23, -23, -23,
+ -23, -23, -23, -23, -23, -23, -23, -23, -23, -23,
+ -23, -23, -23, -23, -23, -23, -23, -23, -23, -23,
+ -23, -23, -23, -46, -23, 145, -23, -109, -27, -28,
+ -23, -98, -117, 144, 144, 10, -126, 10, -85, 55,
+ -126, -87, 55, 146, -11, 146, 144, 145, -23, 151,
+ -23, -23, -23, -23, -23, -23, -23, -23, -23, -23,
+ -23, -23, -23, -24, -23, -54, 10, 142, -47, -114,
+ 149, 158, 58, -28, 146, -23, -114, 147, -24, 141,
+ -63, -63, 17, 148, 57, -23, 11, -28, 58, -24,
+ -53, -6, -47, 142, 10, -5, -4, 98, 99, 100,
101, 102, 103, 4, 5, 84, 85, 86, 87, 88,
89, 90, 91, 92, 6, 7, 93, 94, 95, 19,
20, 21, 22, 23, 24, 25, 26, 27, 28, 29,
@@ -1568,49 +1597,49 @@ var yyChk = [...]int{
50, 35, 36, 37, 38, 39, 96, 97, 59, 30,
31, 32, 33, 34, 60, 61, 55, 56, 79, 53,
54, 52, 62, 63, 65, 64, 66, 67, 81, 80,
- -52, -6, -46, -83, -82, 78, 125, 119, 57, 78,
- -83, -105, -71, -21, -21, -21, 75, 75, 117, -21,
- 124, -108, -30, -21, 83, -107, 10, 121, -109, 120,
- 121, 121, 82, -86, -17, 82, -86, 119, 10, 82,
- -19, -21, 123, 124, 123, 121, 135, 124, -32, -33,
- -121, -21, -41, 122, -21, -126, 135, 29, 124, 120,
- -121, 123, -27, -115, 56, -8, 119, -121, -119, -8,
- -21, -21, -110, -21, 124, 126, 120, -82, -21, 124,
- 136, -70, -21, 128, 59, -107, 124, 126, 124, -63,
- 10, 13, 129, 12, 10, 120, 120, 125, 120, -21,
- 126, -82, -21, -82, -46, -22, -21, -53, -46, -27,
- -126, 135, 124, 124, 120, -126, 135, -21, 124, 120,
- 119, 82, -96, -15, -18, -77, 119, -121, 124, -122,
- -9, 122, -21, -92, -21, -80, 119, 122, 123, -21,
- 124, -25, -78, -26, 128, 59, 125, -23, -9, 122,
- -88, 123, -111, -112, -28, -29, -74, -72, 127, 60,
- 61, -8, -115, -121, -119, -113, 119, 135, 124, 124,
- 95, -9, 122, 120, 136, -21, -26, 123, 124, 126,
- 13, -21, 120, 126, 120, -115, 124, -71, 124, -30,
- -95, -18, 119, -126, 135, -18, -96, 121, -110, 124,
- 121, -99, 121, -99, 121, -111, 121, 124, 58, -26,
- 123, -107, -110, -24, 41, 42, -111, 124, 135, -1,
- 128, -72, -121, 119, 120, -34, -117, -116, 44, -118,
- 47, -76, 103, 102, 101, 98, 99, 100, -113, -8,
- -9, 122, 121, -110, -21, -107, 126, -121, -126, 135,
- -95, 120, -15, -126, 22, 121, -92, 120, 32, 33,
- -99, 31, -99, 124, -124, -9, 122, -78, -26, -107,
- 126, 28, 123, 119, 124, -104, 44, -28, -2, 83,
- 119, -113, -97, -40, 12, 38, 37, -119, -76, 120,
- -110, 124, 120, 119, 120, -18, -126, 120, 121, 124,
- -21, -127, 122, 121, 120, 121, 31, -104, -110, 124,
- 124, 121, -87, -8, -110, -73, 122, -73, 123, 12,
- -113, 120, 121, 135, -121, 136, -89, -67, -6, -3,
- -81, 121, 119, -113, 120, -123, -9, 122, -127, -110,
- 121, -73, 26, -124, 12, 151, 120, 119, -74, 119,
- -103, -50, 12, 128, 136, 120, -40, -21, 121, 135,
- 136, -6, 120, -100, -35, -36, -37, -38, -39, -8,
- -6, 79, 10, 120, -110, -110, 119, 121, 124, -8,
- -110, -110, 124, 135, 12, -21, -121, -67, -21, -121,
- 120, -35, 121, 121, 45, 29, 78, 24, -110, 119,
- 120, 120, -50, -121, 123, -119, 10, -4, -76, -6,
- 121, 120, -110, -111, -6, 120, 124, -73, -79, 121,
- 119, -110, 120,
+ -53, -6, -47, -78, -77, 78, 148, 142, 57, 78,
+ -78, -112, -72, -23, -23, -23, 75, 75, 140, -23,
+ 147, -115, -31, -23, 83, -114, 10, 144, -116, 143,
+ 144, 144, 82, -94, -19, 82, -94, 142, 10, 82,
+ -21, -23, 146, 147, 146, 144, 158, 147, -33, -34,
+ -126, -23, -42, 145, -23, -7, 158, 29, 147, 143,
+ -126, 146, -85, -86, 56, -10, 142, -126, -124, -10,
+ -23, -23, -117, -23, 147, 149, 143, -77, -23, 147,
+ 160, -71, -23, 151, 59, -114, 147, 149, 147, -64,
+ 10, 13, 152, 12, 10, 143, 143, 148, 143, -23,
+ 149, -77, -23, -77, -47, -24, -23, -54, -47, -85,
+ -7, 158, 147, 147, 143, -7, 158, -23, 147, 143,
+ 142, 82, -104, -17, -20, -90, 142, -126, 147, -84,
+ -11, 145, -23, -100, -23, -80, 142, 145, 146, -23,
+ 147, -27, -91, -28, 151, 59, 148, -25, -11, 145,
+ -96, 146, -118, -119, -29, -30, -75, -73, 150, 60,
+ 61, -10, -86, -126, -124, -120, 142, 158, 147, 147,
+ 95, -11, 145, 143, 160, -23, -28, 146, 147, 149,
+ 13, -23, 143, 149, 143, -86, 147, -72, 147, -31,
+ -103, -20, 142, -7, 158, -20, -104, 144, -117, 147,
+ 144, -107, 144, -107, 144, -118, 144, 147, 58, -28,
+ 146, -114, -117, -26, 41, 42, -118, 147, 158, -1,
+ 151, -73, -126, 142, 143, -35, -122, -121, 44, -123,
+ 47, -89, 103, 102, 101, 98, 99, 100, -120, -10,
+ -11, 145, 144, -117, -23, -114, 149, -126, -7, 158,
+ -103, 143, -17, -7, 22, 144, -100, 143, 32, 33,
+ -107, 31, -107, 147, -82, -11, 145, -91, -28, -114,
+ 149, 28, 146, 142, 147, -88, 44, -29, -2, 83,
+ 142, -120, -105, -41, 12, 38, 37, -124, -89, 143,
+ -117, 147, 143, 142, 143, -20, -7, 143, 144, 147,
+ -23, -8, 145, 144, 143, 144, 31, -88, -117, 147,
+ 147, 144, -95, -10, -117, -74, 145, -74, 146, 12,
+ -120, 143, 144, 158, -126, 160, -97, -68, -6, -3,
+ -79, 144, 142, -120, 143, -83, -11, 145, -8, -117,
+ 144, -74, 26, -82, 12, 159, 143, 142, -75, 142,
+ -111, -51, 12, 151, 160, 143, -41, -23, 144, 158,
+ 160, -6, 143, -108, -36, -37, -38, -39, -40, -10,
+ -6, 79, 10, 143, -117, -117, 142, 144, 147, -10,
+ -117, -117, 147, 158, 12, -23, -126, -68, -23, -126,
+ 143, -36, 144, 144, 45, 29, 78, 24, -117, 142,
+ 143, 143, -51, -126, 146, -124, 10, -4, -89, -6,
+ 144, 143, -117, -118, -6, 143, 147, -74, -81, 144,
+ 142, -117, 143,
}
var yyDef = [...]int{
@@ -1714,16 +1743,16 @@ var yyTok1 = [...]int{
1, 3, 3, 3, 3, 3, 3, 3, 3, 3,
3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
- 3, 3, 3, 131, 117, 3, 134, 166, 128, 3,
- 123, 124, 164, 130, 135, 129, 163, 165, 3, 3,
- 3, 3, 3, 3, 3, 3, 3, 3, 122, 121,
- 157, 136, 159, 127, 133, 3, 3, 3, 3, 3,
+ 3, 3, 3, 154, 140, 3, 157, 164, 151, 3,
+ 146, 147, 162, 153, 158, 152, 167, 163, 3, 3,
+ 3, 3, 3, 3, 3, 3, 3, 3, 145, 144,
+ 165, 160, 166, 150, 156, 3, 3, 3, 3, 3,
3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
- 3, 125, 3, 126, 152, 3, 118, 3, 3, 3,
+ 3, 148, 3, 149, 161, 3, 141, 3, 3, 3,
3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
- 3, 3, 3, 119, 151, 120, 132,
+ 3, 3, 3, 142, 159, 143, 155,
}
var yyTok2 = [...]int{
@@ -1738,9 +1767,9 @@ var yyTok2 = [...]int{
82, 83, 84, 85, 86, 87, 88, 89, 90, 91,
92, 93, 94, 95, 96, 97, 98, 99, 100, 101,
102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
- 112, 113, 114, 115, 116, 137, 138, 139, 140, 141,
- 142, 143, 144, 145, 146, 147, 148, 149, 150, 153,
- 154, 155, 156, 158, 160, 161, 162, 167,
+ 112, 113, 114, 115, 116, 117, 118, 119, 120, 121,
+ 122, 123, 124, 125, 126, 127, 128, 129, 130, 131,
+ 132, 133, 134, 135, 136, 137, 138, 139,
}
var yyTok3 = [...]int{
0,
@@ -2085,470 +2114,472 @@ yydefault:
case 1:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php7/php7.y:257
+ //line php7/php7.y:300
{
- yylex.(*Parser).rootNode = stmt.NewStmtList(yyDollar[1].list)
+ yylex.(*Parser).rootNode = node.NewRoot(yyDollar[1].list)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yylex.(*Parser).rootNode, yylex.(*Parser).positionBuilder.NewNodeListPosition(yyDollar[1].list))
}
case 2:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php7/php7.y:264
+ //line php7/php7.y:309
{
yyVAL.token = yyDollar[1].token
}
case 3:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php7/php7.y:264
+ //line php7/php7.y:309
{
yyVAL.token = yyDollar[1].token
}
case 4:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php7/php7.y:264
+ //line php7/php7.y:309
{
yyVAL.token = yyDollar[1].token
}
case 5:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php7/php7.y:264
+ //line php7/php7.y:309
{
yyVAL.token = yyDollar[1].token
}
case 6:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php7/php7.y:264
+ //line php7/php7.y:309
{
yyVAL.token = yyDollar[1].token
}
case 7:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php7/php7.y:264
+ //line php7/php7.y:309
{
yyVAL.token = yyDollar[1].token
}
case 8:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php7/php7.y:264
+ //line php7/php7.y:309
{
yyVAL.token = yyDollar[1].token
}
case 9:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php7/php7.y:264
+ //line php7/php7.y:309
{
yyVAL.token = yyDollar[1].token
}
case 10:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php7/php7.y:265
+ //line php7/php7.y:310
{
yyVAL.token = yyDollar[1].token
}
case 11:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php7/php7.y:265
+ //line php7/php7.y:310
{
yyVAL.token = yyDollar[1].token
}
case 12:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php7/php7.y:265
+ //line php7/php7.y:310
{
yyVAL.token = yyDollar[1].token
}
case 13:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php7/php7.y:265
+ //line php7/php7.y:310
{
yyVAL.token = yyDollar[1].token
}
case 14:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php7/php7.y:265
+ //line php7/php7.y:310
{
yyVAL.token = yyDollar[1].token
}
case 15:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php7/php7.y:265
+ //line php7/php7.y:310
{
yyVAL.token = yyDollar[1].token
}
case 16:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php7/php7.y:265
+ //line php7/php7.y:310
{
yyVAL.token = yyDollar[1].token
}
case 17:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php7/php7.y:265
+ //line php7/php7.y:310
{
yyVAL.token = yyDollar[1].token
}
case 18:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php7/php7.y:265
+ //line php7/php7.y:310
{
yyVAL.token = yyDollar[1].token
}
case 19:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php7/php7.y:265
+ //line php7/php7.y:310
{
yyVAL.token = yyDollar[1].token
}
case 20:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php7/php7.y:265
+ //line php7/php7.y:310
{
yyVAL.token = yyDollar[1].token
}
case 21:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php7/php7.y:265
+ //line php7/php7.y:310
{
yyVAL.token = yyDollar[1].token
}
case 22:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php7/php7.y:266
+ //line php7/php7.y:311
{
yyVAL.token = yyDollar[1].token
}
case 23:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php7/php7.y:266
+ //line php7/php7.y:311
{
yyVAL.token = yyDollar[1].token
}
case 24:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php7/php7.y:266
+ //line php7/php7.y:311
{
yyVAL.token = yyDollar[1].token
}
case 25:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php7/php7.y:266
+ //line php7/php7.y:311
{
yyVAL.token = yyDollar[1].token
}
case 26:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php7/php7.y:266
+ //line php7/php7.y:311
{
yyVAL.token = yyDollar[1].token
}
case 27:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php7/php7.y:266
+ //line php7/php7.y:311
{
yyVAL.token = yyDollar[1].token
}
case 28:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php7/php7.y:266
+ //line php7/php7.y:311
{
yyVAL.token = yyDollar[1].token
}
case 29:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php7/php7.y:266
+ //line php7/php7.y:311
{
yyVAL.token = yyDollar[1].token
}
case 30:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php7/php7.y:266
+ //line php7/php7.y:311
{
yyVAL.token = yyDollar[1].token
}
case 31:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php7/php7.y:266
+ //line php7/php7.y:311
{
yyVAL.token = yyDollar[1].token
}
case 32:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php7/php7.y:267
+ //line php7/php7.y:312
{
yyVAL.token = yyDollar[1].token
}
case 33:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php7/php7.y:267
+ //line php7/php7.y:312
{
yyVAL.token = yyDollar[1].token
}
case 34:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php7/php7.y:267
+ //line php7/php7.y:312
{
yyVAL.token = yyDollar[1].token
}
case 35:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php7/php7.y:267
+ //line php7/php7.y:312
{
yyVAL.token = yyDollar[1].token
}
case 36:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php7/php7.y:267
+ //line php7/php7.y:312
{
yyVAL.token = yyDollar[1].token
}
case 37:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php7/php7.y:267
+ //line php7/php7.y:312
{
yyVAL.token = yyDollar[1].token
}
case 38:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php7/php7.y:267
+ //line php7/php7.y:312
{
yyVAL.token = yyDollar[1].token
}
case 39:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php7/php7.y:267
+ //line php7/php7.y:312
{
yyVAL.token = yyDollar[1].token
}
case 40:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php7/php7.y:267
+ //line php7/php7.y:312
{
yyVAL.token = yyDollar[1].token
}
case 41:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php7/php7.y:267
+ //line php7/php7.y:312
{
yyVAL.token = yyDollar[1].token
}
case 42:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php7/php7.y:268
+ //line php7/php7.y:313
{
yyVAL.token = yyDollar[1].token
}
case 43:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php7/php7.y:268
+ //line php7/php7.y:313
{
yyVAL.token = yyDollar[1].token
}
case 44:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php7/php7.y:268
+ //line php7/php7.y:313
{
yyVAL.token = yyDollar[1].token
}
case 45:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php7/php7.y:268
+ //line php7/php7.y:313
{
yyVAL.token = yyDollar[1].token
}
case 46:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php7/php7.y:268
+ //line php7/php7.y:313
{
yyVAL.token = yyDollar[1].token
}
case 47:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php7/php7.y:268
+ //line php7/php7.y:313
{
yyVAL.token = yyDollar[1].token
}
case 48:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php7/php7.y:268
+ //line php7/php7.y:313
{
yyVAL.token = yyDollar[1].token
}
case 49:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php7/php7.y:268
+ //line php7/php7.y:313
{
yyVAL.token = yyDollar[1].token
}
case 50:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php7/php7.y:268
+ //line php7/php7.y:313
{
yyVAL.token = yyDollar[1].token
}
case 51:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php7/php7.y:268
+ //line php7/php7.y:313
{
yyVAL.token = yyDollar[1].token
}
case 52:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php7/php7.y:268
+ //line php7/php7.y:313
{
yyVAL.token = yyDollar[1].token
}
case 53:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php7/php7.y:269
+ //line php7/php7.y:314
{
yyVAL.token = yyDollar[1].token
}
case 54:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php7/php7.y:269
+ //line php7/php7.y:314
{
yyVAL.token = yyDollar[1].token
}
case 55:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php7/php7.y:269
+ //line php7/php7.y:314
{
yyVAL.token = yyDollar[1].token
}
case 56:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php7/php7.y:269
+ //line php7/php7.y:314
{
yyVAL.token = yyDollar[1].token
}
case 57:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php7/php7.y:269
+ //line php7/php7.y:314
{
yyVAL.token = yyDollar[1].token
}
case 58:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php7/php7.y:269
+ //line php7/php7.y:314
{
yyVAL.token = yyDollar[1].token
}
case 59:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php7/php7.y:269
+ //line php7/php7.y:314
{
yyVAL.token = yyDollar[1].token
}
case 60:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php7/php7.y:269
+ //line php7/php7.y:314
{
yyVAL.token = yyDollar[1].token
}
case 61:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php7/php7.y:270
+ //line php7/php7.y:315
{
yyVAL.token = yyDollar[1].token
}
case 62:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php7/php7.y:270
+ //line php7/php7.y:315
{
yyVAL.token = yyDollar[1].token
}
case 63:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php7/php7.y:270
+ //line php7/php7.y:315
{
yyVAL.token = yyDollar[1].token
}
case 64:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php7/php7.y:270
+ //line php7/php7.y:315
{
yyVAL.token = yyDollar[1].token
}
case 65:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php7/php7.y:270
+ //line php7/php7.y:315
{
yyVAL.token = yyDollar[1].token
}
case 66:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php7/php7.y:270
+ //line php7/php7.y:315
{
yyVAL.token = yyDollar[1].token
}
case 67:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php7/php7.y:270
+ //line php7/php7.y:315
{
yyVAL.token = yyDollar[1].token
}
case 68:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php7/php7.y:270
+ //line php7/php7.y:315
{
yyVAL.token = yyDollar[1].token
}
case 69:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php7/php7.y:274
+ //line php7/php7.y:320
{
yyVAL.token = yyDollar[1].token
}
case 70:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php7/php7.y:275
+ //line php7/php7.y:321
{
yyVAL.token = yyDollar[1].token
}
case 71:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php7/php7.y:275
+ //line php7/php7.y:321
{
yyVAL.token = yyDollar[1].token
}
case 72:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php7/php7.y:275
+ //line php7/php7.y:321
{
yyVAL.token = yyDollar[1].token
}
case 73:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php7/php7.y:275
+ //line php7/php7.y:321
{
yyVAL.token = yyDollar[1].token
}
case 74:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php7/php7.y:275
+ //line php7/php7.y:321
{
yyVAL.token = yyDollar[1].token
}
case 75:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php7/php7.y:275
+ //line php7/php7.y:321
{
yyVAL.token = yyDollar[1].token
}
case 76:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php7/php7.y:279
+ //line php7/php7.y:326
{
yyVAL.token = yyDollar[1].token
}
case 77:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php7/php7.y:280
+ //line php7/php7.y:328
{
yyVAL.token = yyDollar[1].token
}
case 78:
yyDollar = yyS[yypt-2 : yypt+1]
- //line php7/php7.y:285
+ //line php7/php7.y:333
{
if yyDollar[2].node != nil {
yyVAL.list = append(yyDollar[1].list, yyDollar[2].node)
@@ -2556,327 +2587,465 @@ yydefault:
}
case 79:
yyDollar = yyS[yypt-0 : yypt+1]
- //line php7/php7.y:290
+ //line php7/php7.y:339
{
yyVAL.list = []node.Node{}
}
case 80:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php7/php7.y:295
+ //line php7/php7.y:344
{
namePart := name.NewNamePart(yyDollar[1].token.Value)
- yylex.(*Parser).positions.AddPosition(namePart, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
yyVAL.list = []node.Node{namePart}
- yylex.(*Parser).comments.AddComments(namePart, yyDollar[1].token.Comments())
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(namePart, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(namePart, yyDollar[1].token, comment.StringToken)
}
case 81:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php7/php7.y:302
+ //line php7/php7.y:355
{
namePart := name.NewNamePart(yyDollar[3].token.Value)
- yylex.(*Parser).positions.AddPosition(namePart, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[3].token))
yyVAL.list = append(yyDollar[1].list, namePart)
- yylex.(*Parser).comments.AddComments(namePart, yyDollar[3].token.Comments())
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(namePart, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[3].token))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(lastNode(yyDollar[1].list), yyDollar[2].token, comment.NsSeparatorToken)
+ yylex.(*Parser).comments.AddFromToken(namePart, yyDollar[3].token, comment.StringToken)
}
case 82:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php7/php7.y:312
+ //line php7/php7.y:370
{
yyVAL.node = name.NewName(yyDollar[1].list)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodeListPosition(yyDollar[1].list))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).listGetFirstNodeComments(yyDollar[1].list))
}
case 83:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php7/php7.y:318
+ //line php7/php7.y:377
{
yyVAL.node = name.NewRelative(yyDollar[3].list)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenNodeListPosition(yyDollar[1].token, yyDollar[3].list))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.NamespaceToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.NsSeparatorToken)
}
case 84:
yyDollar = yyS[yypt-2 : yypt+1]
- //line php7/php7.y:324
+ //line php7/php7.y:388
{
yyVAL.node = name.NewFullyQualified(yyDollar[2].list)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenNodeListPosition(yyDollar[1].token, yyDollar[2].list))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.NsSeparatorToken)
}
case 85:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php7/php7.y:333
+ //line php7/php7.y:401
{
// error
yyVAL.node = nil
}
case 86:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php7/php7.y:337
+ //line php7/php7.y:406
{
yyVAL.node = yyDollar[1].node
}
case 87:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php7/php7.y:338
+ //line php7/php7.y:408
{
yyVAL.node = yyDollar[1].node
}
case 88:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php7/php7.y:339
+ //line php7/php7.y:410
{
yyVAL.node = yyDollar[1].node
}
case 89:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php7/php7.y:340
+ //line php7/php7.y:412
{
yyVAL.node = yyDollar[1].node
}
case 90:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php7/php7.y:341
+ //line php7/php7.y:414
{
yyVAL.node = yyDollar[1].node
}
case 91:
yyDollar = yyS[yypt-4 : yypt+1]
- //line php7/php7.y:342
+ //line php7/php7.y:416
{
yyVAL.node = stmt.NewHaltCompiler()
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[4].token))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.HaltCompilerToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.OpenParenthesisToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[3].token, comment.CloseParenthesisToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[4].token, comment.SemiColonToken)
}
case 92:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php7/php7.y:344
+ //line php7/php7.y:429
{
name := name.NewName(yyDollar[2].list)
- yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewNodeListPosition(yyDollar[2].list))
yyVAL.node = stmt.NewNamespace(name, nil)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewNodeListPosition(yyDollar[2].list))
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[3].token))
- yylex.(*Parser).comments.AddComments(name, yylex.(*Parser).listGetFirstNodeComments(yyDollar[2].list))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.NamespaceToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[3].token, comment.SemiColonToken)
}
case 93:
yyDollar = yyS[yypt-5 : yypt+1]
- //line php7/php7.y:354
+ //line php7/php7.y:442
{
name := name.NewName(yyDollar[2].list)
- yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewNodeListPosition(yyDollar[2].list))
yyVAL.node = stmt.NewNamespace(name, yyDollar[4].list)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewNodeListPosition(yyDollar[2].list))
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[5].token))
- yylex.(*Parser).comments.AddComments(name, yylex.(*Parser).listGetFirstNodeComments(yyDollar[2].list))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.NamespaceToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[3].token, comment.OpenCurlyBracesToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[5].token, comment.CloseCurlyBracesToken)
}
case 94:
yyDollar = yyS[yypt-4 : yypt+1]
- //line php7/php7.y:364
+ //line php7/php7.y:456
{
yyVAL.node = stmt.NewNamespace(nil, yyDollar[3].list)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[4].token))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.NamespaceToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.OpenCurlyBracesToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[4].token, comment.CloseCurlyBracesToken)
}
case 95:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php7/php7.y:369
+ //line php7/php7.y:468
{
yyVAL.node = yyDollar[2].node
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[3].token))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.UseToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[3].token, comment.SemiColonToken)
}
case 96:
yyDollar = yyS[yypt-4 : yypt+1]
- //line php7/php7.y:370
+ //line php7/php7.y:479
{
yyVAL.node = yyDollar[3].node.(*stmt.GroupUse).SetUseType(yyDollar[2].node)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[4].token))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.UseToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[4].token, comment.SemiColonToken)
}
case 97:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php7/php7.y:372
+ //line php7/php7.y:490
{
yyVAL.node = stmt.NewUseList(nil, yyDollar[2].list)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[3].token))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.UseToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[3].token, comment.SemiColonToken)
}
case 98:
yyDollar = yyS[yypt-4 : yypt+1]
- //line php7/php7.y:377
+ //line php7/php7.y:501
{
yyVAL.node = stmt.NewUseList(yyDollar[2].node, yyDollar[3].list)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[4].token))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.UseToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[4].token, comment.SemiColonToken)
}
case 99:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php7/php7.y:379
+ //line php7/php7.y:512
{
yyVAL.node = stmt.NewConstList(yyDollar[2].list)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[3].token))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.ConstToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[3].token, comment.SemiColonToken)
}
case 100:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php7/php7.y:388
+ //line php7/php7.y:526
{
yyVAL.node = node.NewIdentifier(yyDollar[1].token.Value)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.FunctionToken)
}
case 101:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php7/php7.y:394
+ //line php7/php7.y:536
{
yyVAL.node = node.NewIdentifier(yyDollar[1].token.Value)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.ConstToken)
}
case 102:
yyDollar = yyS[yypt-6 : yypt+1]
- //line php7/php7.y:403
+ //line php7/php7.y:549
{
name := name.NewName(yyDollar[1].list)
- yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewNodeListPosition(yyDollar[1].list))
yyVAL.node = stmt.NewGroupUse(nil, name, yyDollar[4].list)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewNodeListPosition(yyDollar[1].list))
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodeListTokenPosition(yyDollar[1].list, yyDollar[6].token))
- yylex.(*Parser).comments.AddComments(name, yylex.(*Parser).listGetFirstNodeComments(yyDollar[1].list))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).listGetFirstNodeComments(yyDollar[1].list))
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.NsSeparatorToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[3].token, comment.OpenCurlyBracesToken)
+ if yyDollar[5].token != nil {
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[5].token, comment.CommaToken)
+ }
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[6].token, comment.CloseCurlyBracesToken)
}
case 103:
yyDollar = yyS[yypt-7 : yypt+1]
- //line php7/php7.y:413
+ //line php7/php7.y:566
{
name := name.NewName(yyDollar[2].list)
- yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewNodeListPosition(yyDollar[2].list))
yyVAL.node = stmt.NewGroupUse(nil, name, yyDollar[5].list)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewNodeListPosition(yyDollar[2].list))
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[7].token))
- yylex.(*Parser).comments.AddComments(name, yylex.(*Parser).listGetFirstNodeComments(yyDollar[2].list))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.NsSeparatorToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[3].token, comment.NsSeparatorToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[4].token, comment.OpenCurlyBracesToken)
+ if yyDollar[6].token != nil {
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[6].token, comment.CommaToken)
+ }
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[7].token, comment.CloseCurlyBracesToken)
}
case 104:
yyDollar = yyS[yypt-6 : yypt+1]
- //line php7/php7.y:426
+ //line php7/php7.y:587
{
name := name.NewName(yyDollar[1].list)
- yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewNodeListPosition(yyDollar[1].list))
yyVAL.node = stmt.NewGroupUse(nil, name, yyDollar[4].list)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewNodeListPosition(yyDollar[1].list))
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodeListTokenPosition(yyDollar[1].list, yyDollar[6].token))
- yylex.(*Parser).comments.AddComments(name, yylex.(*Parser).listGetFirstNodeComments(yyDollar[1].list))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).listGetFirstNodeComments(yyDollar[1].list))
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.NsSeparatorToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[3].token, comment.OpenCurlyBracesToken)
+ if yyDollar[5].token != nil {
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[5].token, comment.CommaToken)
+ }
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[6].token, comment.CloseCurlyBracesToken)
}
case 105:
yyDollar = yyS[yypt-7 : yypt+1]
- //line php7/php7.y:436
+ //line php7/php7.y:604
{
name := name.NewName(yyDollar[2].list)
- yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewNodeListPosition(yyDollar[2].list))
yyVAL.node = stmt.NewGroupUse(nil, name, yyDollar[5].list)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewNodeListPosition(yyDollar[2].list))
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[7].token))
- yylex.(*Parser).comments.AddComments(name, yylex.(*Parser).listGetFirstNodeComments(yyDollar[2].list))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.NsSeparatorToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[3].token, comment.NsSeparatorToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[4].token, comment.OpenCurlyBracesToken)
+ if yyDollar[6].token != nil {
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[6].token, comment.CommaToken)
+ }
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[7].token, comment.CloseCurlyBracesToken)
+ }
+ case 106:
+ yyDollar = yyS[yypt-0 : yypt+1]
+ //line php7/php7.y:625
+ {
+ yyVAL.token = nil
+ }
+ case 107:
+ yyDollar = yyS[yypt-1 : yypt+1]
+ //line php7/php7.y:627
+ {
+ yyVAL.token = yyDollar[1].token
}
case 108:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php7/php7.y:454
+ //line php7/php7.y:632
{
yyVAL.list = append(yyDollar[1].list, yyDollar[3].node)
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(lastNode(yyDollar[1].list), yyDollar[2].token, comment.CommaToken)
}
case 109:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php7/php7.y:455
+ //line php7/php7.y:639
{
yyVAL.list = []node.Node{yyDollar[1].node}
}
case 110:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php7/php7.y:460
+ //line php7/php7.y:644
{
yyVAL.list = append(yyDollar[1].list, yyDollar[3].node)
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(lastNode(yyDollar[1].list), yyDollar[2].token, comment.CommaToken)
}
case 111:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php7/php7.y:461
+ //line php7/php7.y:651
{
yyVAL.list = []node.Node{yyDollar[1].node}
}
case 112:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php7/php7.y:465
+ //line php7/php7.y:656
{
yyVAL.list = append(yyDollar[1].list, yyDollar[3].node)
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(lastNode(yyDollar[1].list), yyDollar[2].token, comment.CommaToken)
}
case 113:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php7/php7.y:466
+ //line php7/php7.y:663
{
yyVAL.list = []node.Node{yyDollar[1].node}
}
case 114:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php7/php7.y:470
+ //line php7/php7.y:668
{
yyVAL.node = yyDollar[1].node
}
case 115:
yyDollar = yyS[yypt-2 : yypt+1]
- //line php7/php7.y:471
+ //line php7/php7.y:670
{
yyVAL.node = yyDollar[2].node.(*stmt.Use).SetUseType(yyDollar[1].node)
}
case 116:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php7/php7.y:476
+ //line php7/php7.y:675
{
name := name.NewName(yyDollar[1].list)
- yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewNodeListPosition(yyDollar[1].list))
yyVAL.node = stmt.NewUse(nil, name, nil)
- yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodeListPosition(yyDollar[1].list))
- yylex.(*Parser).comments.AddComments(name, yylex.(*Parser).listGetFirstNodeComments(yyDollar[1].list))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).listGetFirstNodeComments(yyDollar[1].list))
+ // save position
+ yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewNodeListPosition(yyDollar[1].list))
+ yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodeListPosition(yyDollar[1].list))
}
case 117:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php7/php7.y:486
+ //line php7/php7.y:684
{
name := name.NewName(yyDollar[1].list)
- yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewNodeListPosition(yyDollar[1].list))
alias := node.NewIdentifier(yyDollar[3].token.Value)
- yylex.(*Parser).positions.AddPosition(alias, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[3].token))
yyVAL.node = stmt.NewUse(nil, name, alias)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewNodeListPosition(yyDollar[1].list))
+ yylex.(*Parser).positions.AddPosition(alias, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[3].token))
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodeListTokenPosition(yyDollar[1].list, yyDollar[3].token))
- yylex.(*Parser).comments.AddComments(name, yylex.(*Parser).listGetFirstNodeComments(yyDollar[1].list))
- yylex.(*Parser).comments.AddComments(alias, yyDollar[3].token.Comments())
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).listGetFirstNodeComments(yyDollar[1].list))
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.AsToken)
+ yylex.(*Parser).comments.AddFromToken(alias, yyDollar[3].token, comment.StringToken)
}
case 118:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php7/php7.y:501
+ //line php7/php7.y:702
{
yyVAL.node = yyDollar[1].node
}
case 119:
yyDollar = yyS[yypt-2 : yypt+1]
- //line php7/php7.y:502
+ //line php7/php7.y:704
{
yyVAL.node = yyDollar[2].node
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.NsSeparatorToken)
}
case 120:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php7/php7.y:506
+ //line php7/php7.y:714
{
yyVAL.list = append(yyDollar[1].list, yyDollar[3].node)
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(lastNode(yyDollar[1].list), yyDollar[2].token, comment.CommaToken)
}
case 121:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php7/php7.y:507
+ //line php7/php7.y:721
{
yyVAL.list = []node.Node{yyDollar[1].node}
}
case 122:
yyDollar = yyS[yypt-2 : yypt+1]
- //line php7/php7.y:512
+ //line php7/php7.y:726
{
if yyDollar[2].node != nil {
yyVAL.list = append(yyDollar[1].list, yyDollar[2].node)
@@ -2884,234 +3053,374 @@ yydefault:
}
case 123:
yyDollar = yyS[yypt-0 : yypt+1]
- //line php7/php7.y:517
+ //line php7/php7.y:732
{
yyVAL.list = []node.Node{}
}
case 124:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php7/php7.y:522
+ //line php7/php7.y:737
{
// error
yyVAL.node = nil
}
case 125:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php7/php7.y:526
+ //line php7/php7.y:742
{
yyVAL.node = yyDollar[1].node
}
case 126:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php7/php7.y:527
+ //line php7/php7.y:744
{
yyVAL.node = yyDollar[1].node
}
case 127:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php7/php7.y:528
+ //line php7/php7.y:746
{
yyVAL.node = yyDollar[1].node
}
case 128:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php7/php7.y:529
+ //line php7/php7.y:748
{
yyVAL.node = yyDollar[1].node
}
case 129:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php7/php7.y:530
+ //line php7/php7.y:750
{
yyVAL.node = yyDollar[1].node
}
case 130:
yyDollar = yyS[yypt-4 : yypt+1]
- //line php7/php7.y:532
+ //line php7/php7.y:752
{
yyVAL.node = stmt.NewHaltCompiler()
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[4].token))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.HaltCompilerToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.OpenParenthesisToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[3].token, comment.CloseParenthesisToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[4].token, comment.SemiColonToken)
}
case 131:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php7/php7.y:540
+ //line php7/php7.y:767
{
yyVAL.node = stmt.NewStmtList(yyDollar[2].list)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[3].token))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.OpenCurlyBracesToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[3].token, comment.CloseCurlyBracesToken)
}
case 132:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php7/php7.y:545
+ //line php7/php7.y:778
{
yyVAL.node = yyDollar[1].node
}
case 133:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php7/php7.y:546
+ //line php7/php7.y:780
{
yyVAL.node = yyDollar[1].node
}
case 134:
yyDollar = yyS[yypt-5 : yypt+1]
- //line php7/php7.y:548
+ //line php7/php7.y:782
{
- if yyDollar[5].altSyntaxNode.isAlt {
- yyVAL.node = stmt.NewAltWhile(yyDollar[3].node, yyDollar[5].altSyntaxNode.node)
- } else {
- yyVAL.node = stmt.NewWhile(yyDollar[3].node, yyDollar[5].altSyntaxNode.node)
+ switch n := yyDollar[5].node.(type) {
+ case *stmt.While:
+ n.Cond = yyDollar[3].node
+ case *stmt.AltWhile:
+ n.Cond = yyDollar[3].node
}
- yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[5].altSyntaxNode.node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+
+ yyVAL.node = yyDollar[5].node
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[5].node))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.WhileToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.OpenParenthesisToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[4].token, comment.CloseParenthesisToken)
}
case 135:
yyDollar = yyS[yypt-7 : yypt+1]
- //line php7/php7.y:558
+ //line php7/php7.y:801
{
yyVAL.node = stmt.NewDo(yyDollar[2].node, yyDollar[5].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[7].token))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.DoToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[3].token, comment.WhileToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[4].token, comment.OpenParenthesisToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[6].token, comment.CloseParenthesisToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[7].token, comment.SemiColonToken)
}
case 136:
yyDollar = yyS[yypt-9 : yypt+1]
- //line php7/php7.y:564
+ //line php7/php7.y:815
{
- if yyDollar[9].altSyntaxNode.isAlt {
- yyVAL.node = stmt.NewAltFor(yyDollar[3].list, yyDollar[5].list, yyDollar[7].list, yyDollar[9].altSyntaxNode.node)
- } else {
- yyVAL.node = stmt.NewFor(yyDollar[3].list, yyDollar[5].list, yyDollar[7].list, yyDollar[9].altSyntaxNode.node)
+ switch n := yyDollar[9].node.(type) {
+ case *stmt.For:
+ n.Init = yyDollar[3].list
+ n.Cond = yyDollar[5].list
+ n.Loop = yyDollar[7].list
+ case *stmt.AltFor:
+ n.Init = yyDollar[3].list
+ n.Cond = yyDollar[5].list
+ n.Loop = yyDollar[7].list
}
- yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[9].altSyntaxNode.node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+
+ yyVAL.node = yyDollar[9].node
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[9].node))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.ForToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.OpenParenthesisToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[4].token, comment.ForInitSemicolonToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[6].token, comment.ForCondSemicolonToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[8].token, comment.CloseParenthesisToken)
}
case 137:
yyDollar = yyS[yypt-5 : yypt+1]
- //line php7/php7.y:574
+ //line php7/php7.y:840
{
- if yyDollar[5].nodesWithEndToken.endToken.Value == ";" {
- yyVAL.node = stmt.NewAltSwitch(yyDollar[3].node, yyDollar[5].nodesWithEndToken.nodes)
- } else {
- yyVAL.node = stmt.NewSwitch(yyDollar[3].node, yyDollar[5].nodesWithEndToken.nodes)
+ switch n := yyDollar[5].node.(type) {
+ case *stmt.Switch:
+ n.Cond = yyDollar[3].node
+ case *stmt.AltSwitch:
+ n.Cond = yyDollar[3].node
+ default:
+ panic("unexpected node type")
}
- yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[5].nodesWithEndToken.endToken))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+
+ yyVAL.node = yyDollar[5].node
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[5].node))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.SwitchToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.OpenParenthesisToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[4].token, comment.CloseParenthesisToken)
}
case 138:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php7/php7.y:584
+ //line php7/php7.y:861
{
yyVAL.node = stmt.NewBreak(yyDollar[2].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[3].token))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.BreakToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[3].token, comment.SemiColonToken)
}
case 139:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php7/php7.y:590
+ //line php7/php7.y:872
{
yyVAL.node = stmt.NewContinue(yyDollar[2].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[3].token))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.ContinueToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[3].token, comment.SemiColonToken)
}
case 140:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php7/php7.y:596
+ //line php7/php7.y:883
{
yyVAL.node = stmt.NewReturn(yyDollar[2].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[3].token))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.ReturnToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[3].token, comment.SemiColonToken)
}
case 141:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php7/php7.y:602
+ //line php7/php7.y:894
{
yyVAL.node = stmt.NewGlobal(yyDollar[2].list)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[3].token))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.GlobalToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[3].token, comment.SemiColonToken)
}
case 142:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php7/php7.y:608
+ //line php7/php7.y:905
{
yyVAL.node = stmt.NewStatic(yyDollar[2].list)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[3].token))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.StaticToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[3].token, comment.SemiColonToken)
}
case 143:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php7/php7.y:614
+ //line php7/php7.y:916
{
yyVAL.node = stmt.NewEcho(yyDollar[2].list)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[3].token))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.EchoToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[3].token, comment.SemiColonToken)
}
case 144:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php7/php7.y:620
+ //line php7/php7.y:927
{
yyVAL.node = stmt.NewInlineHtml(yyDollar[1].token.Value)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.InlineHTMLToken)
}
case 145:
yyDollar = yyS[yypt-2 : yypt+1]
- //line php7/php7.y:626
+ //line php7/php7.y:937
{
yyVAL.node = stmt.NewExpression(yyDollar[1].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodeTokenPosition(yyDollar[1].node, yyDollar[2].token))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.SemiColonToken)
}
case 146:
yyDollar = yyS[yypt-6 : yypt+1]
- //line php7/php7.y:632
+ //line php7/php7.y:947
{
yyVAL.node = stmt.NewUnset(yyDollar[3].list)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[6].token))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.UnsetToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.OpenParenthesisToken)
+ if yyDollar[4].token != nil {
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[4].token, comment.CommaToken)
+ }
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[5].token, comment.CloseParenthesisToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[6].token, comment.SemiColonToken)
}
case 147:
yyDollar = yyS[yypt-7 : yypt+1]
- //line php7/php7.y:638
+ //line php7/php7.y:963
{
- if yyDollar[7].altSyntaxNode.isAlt {
- yyVAL.node = stmt.NewAltForeach(yyDollar[3].node, nil, yyDollar[5].foreachVariable.node, yyDollar[7].altSyntaxNode.node, yyDollar[5].foreachVariable.byRef)
- } else {
- yyVAL.node = stmt.NewForeach(yyDollar[3].node, nil, yyDollar[5].foreachVariable.node, yyDollar[7].altSyntaxNode.node, yyDollar[5].foreachVariable.byRef)
+ switch n := yyDollar[7].node.(type) {
+ case *stmt.Foreach:
+ n.Expr = yyDollar[3].node
+ n.Variable = yyDollar[5].node
+ case *stmt.AltForeach:
+ n.Expr = yyDollar[3].node
+ n.Variable = yyDollar[5].node
}
- yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[7].altSyntaxNode.node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+
+ yyVAL.node = yyDollar[7].node
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[7].node))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.ForeachToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.OpenParenthesisToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[4].token, comment.AsToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[6].token, comment.CloseParenthesisToken)
}
case 148:
yyDollar = yyS[yypt-9 : yypt+1]
- //line php7/php7.y:648
+ //line php7/php7.y:985
{
- if yyDollar[9].altSyntaxNode.isAlt {
- yyVAL.node = stmt.NewAltForeach(yyDollar[3].node, yyDollar[5].node, yyDollar[7].foreachVariable.node, yyDollar[9].altSyntaxNode.node, yyDollar[7].foreachVariable.byRef)
- } else {
- yyVAL.node = stmt.NewForeach(yyDollar[3].node, yyDollar[5].node, yyDollar[7].foreachVariable.node, yyDollar[9].altSyntaxNode.node, yyDollar[7].foreachVariable.byRef)
+ switch n := yyDollar[9].node.(type) {
+ case *stmt.Foreach:
+ n.Expr = yyDollar[3].node
+ n.Key = yyDollar[5].node
+ n.Variable = yyDollar[7].node
+ case *stmt.AltForeach:
+ n.Expr = yyDollar[3].node
+ n.Key = yyDollar[5].node
+ n.Variable = yyDollar[7].node
}
- yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[9].altSyntaxNode.node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+
+ yyVAL.node = yyDollar[9].node
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[9].node))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.ForeachToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.OpenParenthesisToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[4].token, comment.AsToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[6].token, comment.DoubleArrowToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[8].token, comment.CloseParenthesisToken)
}
case 149:
yyDollar = yyS[yypt-5 : yypt+1]
- //line php7/php7.y:658
+ //line php7/php7.y:1010
{
yyVAL.node = stmt.NewDeclare(yyDollar[3].list, yyDollar[5].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[5].node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.DeclareToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.OpenParenthesisToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[4].token, comment.CloseParenthesisToken)
}
case 150:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php7/php7.y:664
+ //line php7/php7.y:1022
{
yyVAL.node = stmt.NewNop()
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.SemiColonToken)
}
case 151:
yyDollar = yyS[yypt-6 : yypt+1]
- //line php7/php7.y:670
+ //line php7/php7.y:1032
{
if yyDollar[6].node == nil {
yyVAL.node = stmt.NewTry(yyDollar[3].list, yyDollar[5].list, yyDollar[6].node)
@@ -3121,2382 +3430,3359 @@ yydefault:
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[6].node))
}
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.TryToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.OpenCurlyBracesToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[4].token, comment.CloseCurlyBracesToken)
}
case 152:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php7/php7.y:682
+ //line php7/php7.y:1047
{
yyVAL.node = stmt.NewThrow(yyDollar[2].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[3].token))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.ThrowToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[3].token, comment.SemiColonToken)
}
case 153:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php7/php7.y:688
+ //line php7/php7.y:1058
{
label := node.NewIdentifier(yyDollar[2].token.Value)
- yylex.(*Parser).positions.AddPosition(label, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[2].token))
yyVAL.node = stmt.NewGoto(label)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(label, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[2].token))
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[3].token))
- yylex.(*Parser).comments.AddComments(label, yyDollar[2].token.Comments())
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.GotoToken)
+ yylex.(*Parser).comments.AddFromToken(label, yyDollar[2].token, comment.StringToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[3].token, comment.SemiColonToken)
}
case 154:
yyDollar = yyS[yypt-2 : yypt+1]
- //line php7/php7.y:698
+ //line php7/php7.y:1072
{
label := node.NewIdentifier(yyDollar[1].token.Value)
- yylex.(*Parser).positions.AddPosition(label, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
yyVAL.node = stmt.NewLabel(label)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(label, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[2].token))
- yylex.(*Parser).comments.AddComments(label, yyDollar[1].token.Comments())
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(label, yyDollar[1].token, comment.StringToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.ColonToken)
}
case 155:
yyDollar = yyS[yypt-0 : yypt+1]
- //line php7/php7.y:709
+ //line php7/php7.y:1087
{
yyVAL.list = []node.Node{}
}
case 156:
yyDollar = yyS[yypt-9 : yypt+1]
- //line php7/php7.y:711
+ //line php7/php7.y:1089
{
identifier := node.NewIdentifier(strings.TrimLeft(yyDollar[5].token.Value, "$"))
- yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[5].token))
variable := expr.NewVariable(identifier)
- yylex.(*Parser).positions.AddPosition(variable, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[5].token))
catch := stmt.NewCatch(yyDollar[4].list, variable, yyDollar[8].list)
- yylex.(*Parser).positions.AddPosition(catch, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[2].token, yyDollar[9].token))
yyVAL.list = append(yyDollar[1].list, catch)
- yylex.(*Parser).comments.AddComments(identifier, yyDollar[5].token.Comments())
- yylex.(*Parser).comments.AddComments(variable, yyDollar[5].token.Comments())
- yylex.(*Parser).comments.AddComments(catch, yyDollar[2].token.Comments())
+ // save position
+ yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[5].token))
+ yylex.(*Parser).positions.AddPosition(variable, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[5].token))
+ yylex.(*Parser).positions.AddPosition(catch, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[2].token, yyDollar[9].token))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(catch, yyDollar[2].token, comment.CatchToken)
+ yylex.(*Parser).comments.AddFromToken(catch, yyDollar[3].token, comment.OpenParenthesisToken)
+ yylex.(*Parser).comments.AddFromToken(variable, yyDollar[5].token, comment.StringToken)
+ yylex.(*Parser).comments.AddFromToken(catch, yyDollar[6].token, comment.CloseParenthesisToken)
+ yylex.(*Parser).comments.AddFromToken(catch, yyDollar[7].token, comment.OpenCurlyBracesToken)
+ yylex.(*Parser).comments.AddFromToken(catch, yyDollar[9].token, comment.CloseCurlyBracesToken)
}
case 157:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php7/php7.y:726
+ //line php7/php7.y:1111
{
yyVAL.list = []node.Node{yyDollar[1].node}
}
case 158:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php7/php7.y:727
+ //line php7/php7.y:1113
{
yyVAL.list = append(yyDollar[1].list, yyDollar[3].node)
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(lastNode(yyDollar[1].list), yyDollar[2].token, comment.VerticalBarToken)
}
case 159:
yyDollar = yyS[yypt-0 : yypt+1]
- //line php7/php7.y:731
+ //line php7/php7.y:1123
{
yyVAL.node = nil
}
case 160:
yyDollar = yyS[yypt-4 : yypt+1]
- //line php7/php7.y:733
+ //line php7/php7.y:1125
{
yyVAL.node = stmt.NewFinally(yyDollar[3].list)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[4].token))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.FinallyToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.OpenCurlyBracesToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[4].token, comment.CloseCurlyBracesToken)
}
case 161:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php7/php7.y:741
+ //line php7/php7.y:1140
{
yyVAL.list = []node.Node{yyDollar[1].node}
}
case 162:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php7/php7.y:742
+ //line php7/php7.y:1142
{
yyVAL.list = append(yyDollar[1].list, yyDollar[3].node)
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(lastNode(yyDollar[1].list), yyDollar[2].token, comment.CommaToken)
}
case 163:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php7/php7.y:746
+ //line php7/php7.y:1152
{
yyVAL.node = yyDollar[1].node
}
case 164:
yyDollar = yyS[yypt-11 : yypt+1]
- //line php7/php7.y:751
+ //line php7/php7.y:1157
{
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)
+
+ // save position
yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[3].token))
- yyVAL.node = stmt.NewFunction(name, yyDollar[2].boolWithToken.value, yyDollar[6].list, yyDollar[8].node, yyDollar[10].list, yyDollar[4].str)
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[11].token))
- yylex.(*Parser).comments.AddComments(name, yyDollar[3].token.Comments())
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.FunctionToken)
+ if yyDollar[2].token != nil {
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.AmpersandToken)
+ }
+ yylex.(*Parser).comments.AddFromToken(name, yyDollar[3].token, comment.StringToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[5].token, comment.OpenParenthesisToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[7].token, comment.CloseParenthesisToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[9].token, comment.OpenCurlyBracesToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[11].token, comment.CloseCurlyBracesToken)
}
case 165:
yyDollar = yyS[yypt-0 : yypt+1]
- //line php7/php7.y:763
+ //line php7/php7.y:1181
{
- yyVAL.boolWithToken = boolWithToken{false, nil}
+ yyVAL.token = nil
}
case 166:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php7/php7.y:764
+ //line php7/php7.y:1183
{
- yyVAL.boolWithToken = boolWithToken{true, &yyDollar[1].token}
+ yyVAL.token = yyDollar[1].token
}
case 167:
yyDollar = yyS[yypt-0 : yypt+1]
- //line php7/php7.y:768
+ //line php7/php7.y:1188
{
- yyVAL.boolWithToken = boolWithToken{false, nil}
+ yyVAL.token = nil
}
case 168:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php7/php7.y:769
+ //line php7/php7.y:1190
{
- yyVAL.boolWithToken = boolWithToken{true, &yyDollar[1].token}
+ yyVAL.token = yyDollar[1].token
}
case 169:
yyDollar = yyS[yypt-9 : yypt+1]
- //line php7/php7.y:774
+ //line php7/php7.y:1195
{
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)
+
+ // save position
yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[3].token))
- yyVAL.node = stmt.NewClass(name, yyDollar[1].list, nil, yyDollar[4].node, yyDollar[5].list, yyDollar[8].list, yyDollar[6].str)
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewOptionalListTokensPosition(yyDollar[1].list, yyDollar[2].token, yyDollar[9].token))
- yylex.(*Parser).comments.AddComments(name, yyDollar[3].token.Comments())
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).listGetFirstNodeComments(yyDollar[1].list))
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.ClassToken)
+ yylex.(*Parser).comments.AddFromToken(name, yyDollar[3].token, comment.StringToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[7].token, comment.OpenCurlyBracesToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[9].token, comment.CloseCurlyBracesToken)
}
case 170:
yyDollar = yyS[yypt-8 : yypt+1]
- //line php7/php7.y:784
+ //line php7/php7.y:1210
{
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)
+
+ // save position
yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[2].token))
- yyVAL.node = stmt.NewClass(name, nil, nil, yyDollar[3].node, yyDollar[4].list, yyDollar[7].list, yyDollar[5].str)
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[8].token))
- yylex.(*Parser).comments.AddComments(name, yyDollar[2].token.Comments())
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.ClassToken)
+ yylex.(*Parser).comments.AddFromToken(name, yyDollar[2].token, comment.StringToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[6].token, comment.OpenCurlyBracesToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[8].token, comment.CloseCurlyBracesToken)
}
case 171:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php7/php7.y:796
+ //line php7/php7.y:1228
{
yyVAL.list = []node.Node{yyDollar[1].node}
}
case 172:
yyDollar = yyS[yypt-2 : yypt+1]
- //line php7/php7.y:797
+ //line php7/php7.y:1230
{
yyVAL.list = append(yyDollar[1].list, yyDollar[2].node)
}
case 173:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php7/php7.y:802
+ //line php7/php7.y:1235
{
yyVAL.node = node.NewIdentifier(yyDollar[1].token.Value)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.AbstractToken)
}
case 174:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php7/php7.y:808
+ //line php7/php7.y:1245
{
yyVAL.node = node.NewIdentifier(yyDollar[1].token.Value)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.FinalToken)
}
case 175:
yyDollar = yyS[yypt-6 : yypt+1]
- //line php7/php7.y:817
+ //line php7/php7.y:1258
{
name := node.NewIdentifier(yyDollar[2].token.Value)
- yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[2].token))
yyVAL.node = stmt.NewTrait(name, yyDollar[5].list, yyDollar[3].str)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[2].token))
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[6].token))
- yylex.(*Parser).comments.AddComments(name, yyDollar[2].token.Comments())
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.TraitToken)
+ yylex.(*Parser).comments.AddFromToken(name, yyDollar[2].token, comment.StringToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[4].token, comment.OpenCurlyBracesToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[6].token, comment.CloseCurlyBracesToken)
}
case 176:
yyDollar = yyS[yypt-7 : yypt+1]
- //line php7/php7.y:830
+ //line php7/php7.y:1276
{
name := node.NewIdentifier(yyDollar[2].token.Value)
+ yyVAL.node = stmt.NewInterface(name, yyDollar[3].InterfaceExtends, yyDollar[6].list, yyDollar[4].str)
+
+ // save position
yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[2].token))
- yyVAL.node = stmt.NewInterface(name, yyDollar[3].list, yyDollar[6].list, yyDollar[4].str)
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[7].token))
- yylex.(*Parser).comments.AddComments(name, yyDollar[2].token.Comments())
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.InterfaceToken)
+ yylex.(*Parser).comments.AddFromToken(name, yyDollar[2].token, comment.StringToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[5].token, comment.OpenCurlyBracesToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[7].token, comment.CloseCurlyBracesToken)
}
case 177:
yyDollar = yyS[yypt-0 : yypt+1]
- //line php7/php7.y:842
+ //line php7/php7.y:1294
{
- yyVAL.node = nil
+ yyVAL.ClassExtends = nil
}
case 178:
yyDollar = yyS[yypt-2 : yypt+1]
- //line php7/php7.y:843
+ //line php7/php7.y:1296
{
- yyVAL.node = yyDollar[2].node
+ yyVAL.ClassExtends = stmt.NewClassExtends(yyDollar[2].node)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(yyVAL.ClassExtends, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[2].node))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.ClassExtends, yyDollar[1].token, comment.ExtendsToken)
}
case 179:
yyDollar = yyS[yypt-0 : yypt+1]
- //line php7/php7.y:847
+ //line php7/php7.y:1309
{
- yyVAL.list = nil
+ yyVAL.InterfaceExtends = nil
}
case 180:
yyDollar = yyS[yypt-2 : yypt+1]
- //line php7/php7.y:848
+ //line php7/php7.y:1311
{
- yyVAL.list = yyDollar[2].list
+ yyVAL.InterfaceExtends = stmt.NewInterfaceExtends(yyDollar[2].list)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(yyVAL.InterfaceExtends, yylex.(*Parser).positionBuilder.NewTokenNodeListPosition(yyDollar[1].token, yyDollar[2].list))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.InterfaceExtends, yyDollar[1].token, comment.ExtendsToken)
}
case 181:
yyDollar = yyS[yypt-0 : yypt+1]
- //line php7/php7.y:852
+ //line php7/php7.y:1324
{
- yyVAL.list = nil
+ yyVAL.ClassImplements = nil
}
case 182:
yyDollar = yyS[yypt-2 : yypt+1]
- //line php7/php7.y:853
+ //line php7/php7.y:1326
{
- yyVAL.list = yyDollar[2].list
+ yyVAL.ClassImplements = stmt.NewClassImplements(yyDollar[2].list)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(yyVAL.ClassImplements, yylex.(*Parser).positionBuilder.NewTokenNodeListPosition(yyDollar[1].token, yyDollar[2].list))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.ClassImplements, yyDollar[1].token, comment.ImplementsToken)
}
case 183:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php7/php7.y:857
+ //line php7/php7.y:1339
{
- yyVAL.foreachVariable = foreachVariable{yyDollar[1].node, false}
+ yyVAL.node = yyDollar[1].node
}
case 184:
yyDollar = yyS[yypt-2 : yypt+1]
- //line php7/php7.y:858
+ //line php7/php7.y:1343
{
- yyVAL.foreachVariable = foreachVariable{yyDollar[2].node, true}
+ yyVAL.node = expr.NewReference(yyDollar[2].node)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(yyDollar[2].node, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[2].node))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.AmpersandToken)
}
case 185:
yyDollar = yyS[yypt-4 : yypt+1]
- //line php7/php7.y:860
+ //line php7/php7.y:1353
{
- list := expr.NewList(yyDollar[3].list)
- yylex.(*Parser).positions.AddPosition(list, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[4].token))
- yyVAL.foreachVariable = foreachVariable{list, false}
- yylex.(*Parser).comments.AddComments(list, yyDollar[1].token.Comments())
+ yyVAL.node = expr.NewList(yyDollar[3].list)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[4].token))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.ListToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.OpenParenthesisToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[4].token, comment.CloseParenthesisToken)
}
case 186:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php7/php7.y:867
+ //line php7/php7.y:1365
{
- list := expr.NewShortList(yyDollar[2].list)
- yylex.(*Parser).positions.AddPosition(list, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[3].token))
- yyVAL.foreachVariable = foreachVariable{list, false}
- yylex.(*Parser).comments.AddComments(list, yyDollar[1].token.Comments())
+ yyVAL.node = expr.NewShortList(yyDollar[2].list)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[3].token))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.OpenSquareBracket)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[3].token, comment.CloseSquareBracket)
}
case 187:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php7/php7.y:877
+ //line php7/php7.y:1379
{
- yyVAL.altSyntaxNode = altSyntaxNode{yyDollar[1].node, false}
+ yyVAL.node = stmt.NewFor(nil, nil, nil, yyDollar[1].node)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodePosition(yyDollar[1].node))
}
case 188:
yyDollar = yyS[yypt-4 : yypt+1]
- //line php7/php7.y:879
+ //line php7/php7.y:1386
{
- yyVAL.altSyntaxNode = altSyntaxNode{stmt.NewStmtList(yyDollar[2].list), true}
- yylex.(*Parser).positions.AddPosition(yyVAL.altSyntaxNode.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[4].token))
+ stmtList := stmt.NewStmtList(yyDollar[2].list)
+ yyVAL.node = stmt.NewAltFor(nil, nil, nil, stmtList)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(stmtList, yylex.(*Parser).positionBuilder.NewNodeListPosition(yyDollar[2].list))
+ yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[4].token))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.ColonToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[3].token, comment.EndforToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[4].token, comment.SemiColonToken)
}
case 189:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php7/php7.y:887
+ //line php7/php7.y:1403
{
- yyVAL.altSyntaxNode = altSyntaxNode{yyDollar[1].node, false}
+ yyVAL.node = stmt.NewForeach(nil, nil, nil, yyDollar[1].node)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodePosition(yyDollar[1].node))
}
case 190:
yyDollar = yyS[yypt-4 : yypt+1]
- //line php7/php7.y:889
+ //line php7/php7.y:1410
{
- yyVAL.altSyntaxNode = altSyntaxNode{stmt.NewStmtList(yyDollar[2].list), true}
- yylex.(*Parser).positions.AddPosition(yyVAL.altSyntaxNode.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[4].token))
+ stmtList := stmt.NewStmtList(yyDollar[2].list)
+ yyVAL.node = stmt.NewAltForeach(nil, nil, nil, stmtList)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(stmtList, yylex.(*Parser).positionBuilder.NewNodeListPosition(yyDollar[2].list))
+ yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[4].token))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.ColonToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[3].token, comment.EndforeachToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[4].token, comment.SemiColonToken)
}
case 191:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php7/php7.y:896
+ //line php7/php7.y:1427
{
yyVAL.node = yyDollar[1].node
}
case 192:
yyDollar = yyS[yypt-4 : yypt+1]
- //line php7/php7.y:898
+ //line php7/php7.y:1429
{
yyVAL.node = stmt.NewStmtList(yyDollar[2].list)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[4].token))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.ColonToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[3].token, comment.EnddeclareToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[4].token, comment.SemiColonToken)
}
case 193:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php7/php7.y:906
+ //line php7/php7.y:1444
{
- yyVAL.nodesWithEndToken = &nodesWithEndToken{yyDollar[2].list, yyDollar[3].token}
+ caseList := stmt.NewCaseList(yyDollar[2].list)
+ yyVAL.node = stmt.NewSwitch(nil, caseList)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(caseList, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[3].token))
+ yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[3].token))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(caseList, yyDollar[1].token, comment.OpenCurlyBracesToken)
+ yylex.(*Parser).comments.AddFromToken(caseList, yyDollar[3].token, comment.CloseCurlyBracesToken)
}
case 194:
yyDollar = yyS[yypt-4 : yypt+1]
- //line php7/php7.y:907
+ //line php7/php7.y:1457
{
- yyVAL.nodesWithEndToken = &nodesWithEndToken{yyDollar[3].list, yyDollar[4].token}
+ caseList := stmt.NewCaseList(yyDollar[3].list)
+ yyVAL.node = stmt.NewSwitch(nil, caseList)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(caseList, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[4].token))
+ yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[4].token))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(caseList, yyDollar[1].token, comment.OpenCurlyBracesToken)
+ yylex.(*Parser).comments.AddFromToken(caseList, yyDollar[2].token, comment.SemiColonToken)
+ yylex.(*Parser).comments.AddFromToken(caseList, yyDollar[4].token, comment.CloseCurlyBracesToken)
}
case 195:
yyDollar = yyS[yypt-4 : yypt+1]
- //line php7/php7.y:908
+ //line php7/php7.y:1471
{
- yyVAL.nodesWithEndToken = &nodesWithEndToken{yyDollar[2].list, yyDollar[4].token}
+ caseList := stmt.NewCaseList(yyDollar[2].list)
+ yyVAL.node = stmt.NewAltSwitch(nil, caseList)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(caseList, yylex.(*Parser).positionBuilder.NewNodeListPosition(yyDollar[2].list))
+ yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[4].token))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(caseList, yyDollar[1].token, comment.ColonToken)
+ yylex.(*Parser).comments.AddFromToken(caseList, yyDollar[3].token, comment.EndswitchToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[4].token, comment.SemiColonToken)
}
case 196:
yyDollar = yyS[yypt-5 : yypt+1]
- //line php7/php7.y:909
+ //line php7/php7.y:1485
{
- yyVAL.nodesWithEndToken = &nodesWithEndToken{yyDollar[3].list, yyDollar[5].token}
+
+ caseList := stmt.NewCaseList(yyDollar[3].list)
+ yyVAL.node = stmt.NewAltSwitch(nil, caseList)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(caseList, yylex.(*Parser).positionBuilder.NewNodeListPosition(yyDollar[3].list))
+ yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[5].token))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(caseList, yyDollar[1].token, comment.ColonToken)
+ yylex.(*Parser).comments.AddFromToken(caseList, yyDollar[2].token, comment.SemiColonToken)
+ yylex.(*Parser).comments.AddFromToken(caseList, yyDollar[4].token, comment.EndswitchToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[5].token, comment.SemiColonToken)
}
case 197:
yyDollar = yyS[yypt-0 : yypt+1]
- //line php7/php7.y:913
+ //line php7/php7.y:1504
{
yyVAL.list = []node.Node{}
}
case 198:
yyDollar = yyS[yypt-5 : yypt+1]
- //line php7/php7.y:915
+ //line php7/php7.y:1506
{
_case := stmt.NewCase(yyDollar[3].node, yyDollar[5].list)
- yylex.(*Parser).positions.AddPosition(_case, yylex.(*Parser).positionBuilder.NewTokenNodeListPosition(yyDollar[2].token, yyDollar[5].list))
yyVAL.list = append(yyDollar[1].list, _case)
- yylex.(*Parser).comments.AddComments(_case, yyDollar[2].token.Comments())
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(_case, yylex.(*Parser).positionBuilder.NewTokenNodeListPosition(yyDollar[2].token, yyDollar[5].list))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(_case, yyDollar[2].token, comment.CaseToken)
+ yylex.(*Parser).comments.AddFromToken(_case, yyDollar[4].token, comment.CaseSeparatorToken)
}
case 199:
yyDollar = yyS[yypt-4 : yypt+1]
- //line php7/php7.y:922
+ //line php7/php7.y:1518
{
_default := stmt.NewDefault(yyDollar[4].list)
- yylex.(*Parser).positions.AddPosition(_default, yylex.(*Parser).positionBuilder.NewTokenNodeListPosition(yyDollar[2].token, yyDollar[4].list))
yyVAL.list = append(yyDollar[1].list, _default)
- yylex.(*Parser).comments.AddComments(_default, yyDollar[2].token.Comments())
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(_default, yylex.(*Parser).positionBuilder.NewTokenNodeListPosition(yyDollar[2].token, yyDollar[4].list))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(_default, yyDollar[2].token, comment.DefaultToken)
+ yylex.(*Parser).comments.AddFromToken(_default, yyDollar[3].token, comment.CaseSeparatorToken)
+ }
+ case 200:
+ yyDollar = yyS[yypt-1 : yypt+1]
+ //line php7/php7.y:1533
+ {
+ yyVAL.token = yyDollar[1].token
+ }
+ case 201:
+ yyDollar = yyS[yypt-1 : yypt+1]
+ //line php7/php7.y:1535
+ {
+ yyVAL.token = yyDollar[1].token
}
case 202:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php7/php7.y:937
+ //line php7/php7.y:1540
{
- yyVAL.altSyntaxNode = altSyntaxNode{yyDollar[1].node, false}
+ yyVAL.node = stmt.NewWhile(nil, yyDollar[1].node)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodePosition(yyDollar[1].node))
}
case 203:
yyDollar = yyS[yypt-4 : yypt+1]
- //line php7/php7.y:939
+ //line php7/php7.y:1547
{
- yyVAL.altSyntaxNode = altSyntaxNode{stmt.NewStmtList(yyDollar[2].list), true}
- yylex.(*Parser).positions.AddPosition(yyVAL.altSyntaxNode.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[4].token))
+ stmtList := stmt.NewStmtList(yyDollar[2].list)
+ yyVAL.node = stmt.NewAltWhile(nil, stmtList)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(stmtList, yylex.(*Parser).positionBuilder.NewNodeListPosition(yyDollar[2].list))
+ yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[4].token))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.ColonToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[3].token, comment.EndwhileToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[4].token, comment.SemiColonToken)
}
case 204:
yyDollar = yyS[yypt-5 : yypt+1]
- //line php7/php7.y:947
+ //line php7/php7.y:1564
{
yyVAL.node = stmt.NewIf(yyDollar[3].node, yyDollar[5].node, nil, nil)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[5].node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.IfToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.OpenParenthesisToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[4].token, comment.CloseParenthesisToken)
}
case 205:
yyDollar = yyS[yypt-6 : yypt+1]
- //line php7/php7.y:953
+ //line php7/php7.y:1576
{
_elseIf := stmt.NewElseIf(yyDollar[4].node, yyDollar[6].node)
- yylex.(*Parser).positions.AddPosition(_elseIf, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[2].token, yyDollar[6].node))
yyVAL.node = yyDollar[1].node.(*stmt.If).AddElseIf(_elseIf)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(_elseIf, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[2].token, yyDollar[6].node))
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[6].node))
- yylex.(*Parser).comments.AddComments(_elseIf, yyDollar[2].token.Comments())
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(_elseIf, yyDollar[2].token, comment.ElseifToken)
+ yylex.(*Parser).comments.AddFromToken(_elseIf, yyDollar[3].token, comment.OpenParenthesisToken)
+ yylex.(*Parser).comments.AddFromToken(_elseIf, yyDollar[5].token, comment.CloseParenthesisToken)
}
case 206:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php7/php7.y:964
+ //line php7/php7.y:1593
{
yyVAL.node = yyDollar[1].node
}
case 207:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php7/php7.y:966
+ //line php7/php7.y:1595
{
_else := stmt.NewElse(yyDollar[3].node)
- yylex.(*Parser).positions.AddPosition(_else, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[2].token, yyDollar[3].node))
yyVAL.node = yyDollar[1].node.(*stmt.If).SetElse(_else)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(_else, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[2].token, yyDollar[3].node))
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[2].token.Comments())
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.ElseToken)
}
case 208:
yyDollar = yyS[yypt-6 : yypt+1]
- //line php7/php7.y:978
+ //line php7/php7.y:1610
{
stmts := stmt.NewStmtList(yyDollar[6].list)
- yylex.(*Parser).positions.AddPosition(stmts, yylex.(*Parser).positionBuilder.NewNodeListPosition(yyDollar[6].list))
yyVAL.node = stmt.NewAltIf(yyDollar[3].node, stmts, nil, nil)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(stmts, yylex.(*Parser).positionBuilder.NewNodeListPosition(yyDollar[6].list))
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenNodeListPosition(yyDollar[1].token, yyDollar[6].list))
- yylex.(*Parser).comments.AddComments(stmts, yyDollar[5].token.Comments())
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.IfToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.OpenParenthesisToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[4].token, comment.CloseParenthesisToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[5].token, comment.ColonToken)
}
case 209:
yyDollar = yyS[yypt-7 : yypt+1]
- //line php7/php7.y:988
+ //line php7/php7.y:1625
{
stmts := stmt.NewStmtList(yyDollar[7].list)
- yylex.(*Parser).positions.AddPosition(stmts, yylex.(*Parser).positionBuilder.NewNodeListPosition(yyDollar[7].list))
_elseIf := stmt.NewAltElseIf(yyDollar[4].node, stmts)
- yylex.(*Parser).positions.AddPosition(_elseIf, yylex.(*Parser).positionBuilder.NewTokenNodeListPosition(yyDollar[2].token, yyDollar[7].list))
yyVAL.node = yyDollar[1].node.(*stmt.AltIf).AddElseIf(_elseIf)
- yylex.(*Parser).comments.AddComments(stmts, yyDollar[6].token.Comments())
- yylex.(*Parser).comments.AddComments(_elseIf, yyDollar[2].token.Comments())
+ // save position
+ yylex.(*Parser).positions.AddPosition(stmts, yylex.(*Parser).positionBuilder.NewNodeListPosition(yyDollar[7].list))
+ yylex.(*Parser).positions.AddPosition(_elseIf, yylex.(*Parser).positionBuilder.NewTokenNodeListPosition(yyDollar[2].token, yyDollar[7].list))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(_elseIf, yyDollar[2].token, comment.ElseifToken)
+ yylex.(*Parser).comments.AddFromToken(_elseIf, yyDollar[3].token, comment.OpenParenthesisToken)
+ yylex.(*Parser).comments.AddFromToken(_elseIf, yyDollar[5].token, comment.CloseParenthesisToken)
+ yylex.(*Parser).comments.AddFromToken(_elseIf, yyDollar[6].token, comment.ColonToken)
}
case 210:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php7/php7.y:1002
+ //line php7/php7.y:1644
{
yyVAL.node = yyDollar[1].node
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodeTokenPosition(yyDollar[1].node, yyDollar[3].token))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.EndifToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[3].token, comment.SemiColonToken)
}
case 211:
yyDollar = yyS[yypt-6 : yypt+1]
- //line php7/php7.y:1007
+ //line php7/php7.y:1655
{
stmts := stmt.NewStmtList(yyDollar[4].list)
- yylex.(*Parser).positions.AddPosition(stmts, yylex.(*Parser).positionBuilder.NewNodeListPosition(yyDollar[4].list))
_else := stmt.NewAltElse(stmts)
- yylex.(*Parser).positions.AddPosition(_else, yylex.(*Parser).positionBuilder.NewTokenNodeListPosition(yyDollar[2].token, yyDollar[4].list))
yyVAL.node = yyDollar[1].node.(*stmt.AltIf).SetElse(_else)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(stmts, yylex.(*Parser).positionBuilder.NewNodeListPosition(yyDollar[4].list))
+ yylex.(*Parser).positions.AddPosition(_else, yylex.(*Parser).positionBuilder.NewTokenNodeListPosition(yyDollar[2].token, yyDollar[4].list))
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodeTokenPosition(yyDollar[1].node, yyDollar[6].token))
- yylex.(*Parser).comments.AddComments(stmts, yyDollar[3].token.Comments())
- yylex.(*Parser).comments.AddComments(_else, yyDollar[2].token.Comments())
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(_else, yyDollar[2].token, comment.ElseToken)
+ yylex.(*Parser).comments.AddFromToken(_else, yyDollar[3].token, comment.ColonToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[5].token, comment.EndifToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[6].token, comment.SemiColonToken)
}
case 212:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php7/php7.y:1021
+ //line php7/php7.y:1675
{
yyVAL.list = yyDollar[1].list
}
case 213:
yyDollar = yyS[yypt-0 : yypt+1]
- //line php7/php7.y:1022
+ //line php7/php7.y:1677
{
yyVAL.list = nil
}
case 214:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php7/php7.y:1026
+ //line php7/php7.y:1682
{
yyVAL.list = []node.Node{yyDollar[1].node}
}
case 215:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php7/php7.y:1027
+ //line php7/php7.y:1684
{
yyVAL.list = append(yyDollar[1].list, yyDollar[3].node)
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(lastNode(yyDollar[1].list), yyDollar[2].token, comment.CommaToken)
}
case 216:
yyDollar = yyS[yypt-4 : yypt+1]
- //line php7/php7.y:1032
+ //line php7/php7.y:1694
{
identifier := node.NewIdentifier(strings.TrimLeft(yyDollar[4].token.Value, "$"))
- yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[4].token))
variable := expr.NewVariable(identifier)
+ yyVAL.node = node.NewParameter(yyDollar[1].node, variable, nil, yyDollar[2].token != nil, yyDollar[3].token != nil)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[4].token))
yylex.(*Parser).positions.AddPosition(variable, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[4].token))
-
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[4].token.Comments())
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[4].token.Comments())
-
if yyDollar[1].node != nil {
- yyVAL.node = node.NewParameter(yyDollar[1].node, variable, nil, yyDollar[2].boolWithToken.value, yyDollar[3].boolWithToken.value)
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodeTokenPosition(yyDollar[1].node, yyDollar[4].token))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node])
- } else if yyDollar[2].boolWithToken.value == true {
- yyVAL.node = node.NewParameter(yyDollar[1].node, variable, nil, yyDollar[2].boolWithToken.value, yyDollar[3].boolWithToken.value)
- yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(*yyDollar[2].boolWithToken.token, yyDollar[4].token))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[2].boolWithToken.token.Comments())
- } else if yyDollar[3].boolWithToken.value == true {
- yyVAL.node = node.NewParameter(yyDollar[1].node, variable, nil, yyDollar[2].boolWithToken.value, yyDollar[3].boolWithToken.value)
- yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(*yyDollar[3].boolWithToken.token, yyDollar[4].token))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[3].boolWithToken.token.Comments())
+ } else if yyDollar[2].token != nil {
+ yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[2].token, yyDollar[4].token))
+ } else if yyDollar[3].token != nil {
+ yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[3].token, yyDollar[4].token))
} else {
- yyVAL.node = node.NewParameter(yyDollar[1].node, variable, nil, yyDollar[2].boolWithToken.value, yyDollar[3].boolWithToken.value)
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[4].token))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[4].token.Comments())
}
+
+ // save comments
+ if yyDollar[2].token != nil {
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.AmpersandToken)
+ }
+ if yyDollar[3].token != nil {
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[3].token, comment.EllipsisToken)
+ }
+ yylex.(*Parser).comments.AddFromToken(variable, yyDollar[4].token, comment.VariableToken)
}
case 217:
yyDollar = yyS[yypt-6 : yypt+1]
- //line php7/php7.y:1060
+ //line php7/php7.y:1722
{
identifier := node.NewIdentifier(strings.TrimLeft(yyDollar[4].token.Value, "$"))
- yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[4].token))
variable := expr.NewVariable(identifier)
+ yyVAL.node = node.NewParameter(yyDollar[1].node, variable, yyDollar[6].node, yyDollar[2].token != nil, yyDollar[3].token != nil)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[4].token))
yylex.(*Parser).positions.AddPosition(variable, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[4].token))
-
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[4].token.Comments())
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[4].token.Comments())
-
if yyDollar[1].node != nil {
- yyVAL.node = node.NewParameter(yyDollar[1].node, variable, yyDollar[6].node, yyDollar[2].boolWithToken.value, yyDollar[3].boolWithToken.value)
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[6].node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node])
- } else if yyDollar[2].boolWithToken.value == true {
- yyVAL.node = node.NewParameter(yyDollar[1].node, variable, yyDollar[6].node, yyDollar[2].boolWithToken.value, yyDollar[3].boolWithToken.value)
- yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenNodePosition(*yyDollar[2].boolWithToken.token, yyDollar[6].node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[2].boolWithToken.token.Comments())
- } else if yyDollar[3].boolWithToken.value == true {
- yyVAL.node = node.NewParameter(yyDollar[1].node, variable, yyDollar[6].node, yyDollar[2].boolWithToken.value, yyDollar[3].boolWithToken.value)
- yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenNodePosition(*yyDollar[3].boolWithToken.token, yyDollar[6].node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[3].boolWithToken.token.Comments())
+ } else if yyDollar[2].token != nil {
+ yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[2].token, yyDollar[6].node))
+ } else if yyDollar[3].token != nil {
+ yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[3].token, yyDollar[6].node))
} else {
- yyVAL.node = node.NewParameter(yyDollar[1].node, variable, yyDollar[6].node, yyDollar[2].boolWithToken.value, yyDollar[3].boolWithToken.value)
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[4].token, yyDollar[6].node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[4].token.Comments())
}
+
+ // save comments
+ if yyDollar[2].token != nil {
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.AmpersandToken)
+ }
+ if yyDollar[3].token != nil {
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[3].token, comment.EllipsisToken)
+ }
+ yylex.(*Parser).comments.AddFromToken(variable, yyDollar[4].token, comment.VariableToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[5].token, comment.EqualToken)
}
case 218:
yyDollar = yyS[yypt-0 : yypt+1]
- //line php7/php7.y:1090
+ //line php7/php7.y:1754
{
yyVAL.node = nil
}
case 219:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php7/php7.y:1091
+ //line php7/php7.y:1756
{
yyVAL.node = yyDollar[1].node
}
case 220:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php7/php7.y:1095
+ //line php7/php7.y:1761
{
yyVAL.node = yyDollar[1].node
}
case 221:
yyDollar = yyS[yypt-2 : yypt+1]
- //line php7/php7.y:1097
+ //line php7/php7.y:1763
{
yyVAL.node = node.NewNullable(yyDollar[2].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[2].node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.QuestionMarkToken)
}
case 222:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php7/php7.y:1106
+ //line php7/php7.y:1776
{
yyVAL.node = node.NewIdentifier(yyDollar[1].token.Value)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.ArrayToken)
}
case 223:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php7/php7.y:1112
+ //line php7/php7.y:1786
{
yyVAL.node = node.NewIdentifier(yyDollar[1].token.Value)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.CallableToken)
}
case 224:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php7/php7.y:1117
+ //line php7/php7.y:1796
{
yyVAL.node = yyDollar[1].node
}
case 225:
yyDollar = yyS[yypt-0 : yypt+1]
- //line php7/php7.y:1121
+ //line php7/php7.y:1801
{
yyVAL.node = nil
}
case 226:
yyDollar = yyS[yypt-2 : yypt+1]
- //line php7/php7.y:1122
+ //line php7/php7.y:1803
{
yyVAL.node = yyDollar[2].node
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.ColonToken)
}
case 227:
yyDollar = yyS[yypt-2 : yypt+1]
- //line php7/php7.y:1126
+ //line php7/php7.y:1813
{
- yyVAL.nodesWithEndToken = &nodesWithEndToken{[]node.Node{}, yyDollar[2].token}
+ yyVAL.node = node.NewArgumentList(nil)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[2].token))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.OpenParenthesisToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.CloseParenthesisToken)
}
case 228:
yyDollar = yyS[yypt-4 : yypt+1]
- //line php7/php7.y:1127
+ //line php7/php7.y:1824
{
- yyVAL.nodesWithEndToken = &nodesWithEndToken{yyDollar[2].list, yyDollar[4].token}
+ yyVAL.node = node.NewArgumentList(yyDollar[2].list)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[4].token))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.OpenParenthesisToken)
+ if yyDollar[3].token != nil {
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[3].token, comment.CommaToken)
+ }
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[4].token, comment.CloseParenthesisToken)
}
case 229:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php7/php7.y:1131
+ //line php7/php7.y:1841
{
yyVAL.list = []node.Node{yyDollar[1].node}
}
case 230:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php7/php7.y:1132
+ //line php7/php7.y:1843
{
yyVAL.list = append(yyDollar[1].list, yyDollar[3].node)
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(lastNode(yyDollar[1].list), yyDollar[2].token, comment.CommaToken)
}
case 231:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php7/php7.y:1137
+ //line php7/php7.y:1853
{
yyVAL.node = node.NewArgument(yyDollar[1].node, false, false)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodePosition(yyDollar[1].node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node])
}
case 232:
yyDollar = yyS[yypt-2 : yypt+1]
- //line php7/php7.y:1143
+ //line php7/php7.y:1860
{
yyVAL.node = node.NewArgument(yyDollar[2].node, true, false)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[2].node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.EllipsisToken)
}
case 233:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php7/php7.y:1151
+ //line php7/php7.y:1873
{
yyVAL.list = append(yyDollar[1].list, yyDollar[3].node)
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(lastNode(yyDollar[1].list), yyDollar[2].token, comment.CommaToken)
}
case 234:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php7/php7.y:1152
+ //line php7/php7.y:1880
{
yyVAL.list = []node.Node{yyDollar[1].node}
}
case 235:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php7/php7.y:1156
+ //line php7/php7.y:1885
{
yyVAL.node = yyDollar[1].node
}
case 236:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php7/php7.y:1160
+ //line php7/php7.y:1890
{
yyVAL.list = append(yyDollar[1].list, yyDollar[3].node)
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(lastNode(yyDollar[1].list), yyDollar[2].token, comment.CommaToken)
}
case 237:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php7/php7.y:1161
+ //line php7/php7.y:1897
{
yyVAL.list = []node.Node{yyDollar[1].node}
}
case 238:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php7/php7.y:1166
+ //line php7/php7.y:1902
{
identifier := node.NewIdentifier(strings.TrimLeft(yyDollar[1].token.Value, "$"))
- yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
variable := expr.NewVariable(identifier)
- yylex.(*Parser).positions.AddPosition(variable, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
yyVAL.node = stmt.NewStaticVar(variable, nil)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
+ yylex.(*Parser).positions.AddPosition(variable, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
- yylex.(*Parser).comments.AddComments(identifier, yyDollar[1].token.Comments())
- yylex.(*Parser).comments.AddComments(variable, yyDollar[1].token.Comments())
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(variable, yyDollar[1].token, comment.VariableToken)
}
case 239:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php7/php7.y:1179
+ //line php7/php7.y:1916
{
identifier := node.NewIdentifier(strings.TrimLeft(yyDollar[1].token.Value, "$"))
- yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
variable := expr.NewVariable(identifier)
- yylex.(*Parser).positions.AddPosition(variable, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
yyVAL.node = stmt.NewStaticVar(variable, yyDollar[3].node)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
+ yylex.(*Parser).positions.AddPosition(variable, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[3].node))
- yylex.(*Parser).comments.AddComments(identifier, yyDollar[1].token.Comments())
- yylex.(*Parser).comments.AddComments(variable, yyDollar[1].token.Comments())
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(variable, yyDollar[1].token, comment.VariableToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.EqualToken)
}
case 240:
yyDollar = yyS[yypt-2 : yypt+1]
- //line php7/php7.y:1194
+ //line php7/php7.y:1934
{
yyVAL.list = append(yyDollar[1].list, yyDollar[2].node)
}
case 241:
yyDollar = yyS[yypt-0 : yypt+1]
- //line php7/php7.y:1195
+ //line php7/php7.y:1936
{
yyVAL.list = []node.Node{}
}
case 242:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php7/php7.y:1200
+ //line php7/php7.y:1941
{
yyVAL.node = stmt.NewPropertyList(yyDollar[1].list, yyDollar[2].list)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodeListTokenPosition(yyDollar[1].list, yyDollar[3].token))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).listGetFirstNodeComments(yyDollar[1].list))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[3].token, comment.SemiColonToken)
}
case 243:
yyDollar = yyS[yypt-4 : yypt+1]
- //line php7/php7.y:1206
+ //line php7/php7.y:1951
{
yyVAL.node = stmt.NewClassConstList(yyDollar[1].list, yyDollar[3].list)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewOptionalListTokensPosition(yyDollar[1].list, yyDollar[2].token, yyDollar[4].token))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).listGetFirstNodeComments(yyDollar[1].list))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.ConstToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[4].token, comment.SemiColonToken)
}
case 244:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php7/php7.y:1212
+ //line php7/php7.y:1962
{
- yyVAL.node = stmt.NewTraitUse(yyDollar[2].list, yyDollar[3].nodesWithEndToken.nodes)
- yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[3].nodesWithEndToken.endToken))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+ var adaptationList *stmt.TraitAdaptationList
+
+ switch n := yyDollar[3].node.(type) {
+ case *stmt.TraitAdaptationList:
+ adaptationList = n
+ default:
+ adaptationList = nil
+ yylex.(*Parser).comments.AddFromChildNode(yyVAL.node, yyDollar[3].node)
+ }
+
+ yyVAL.node = stmt.NewTraitUse(yyDollar[2].list, adaptationList)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[3].node))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.UseToken)
}
case 245:
yyDollar = yyS[yypt-10 : yypt+1]
- //line php7/php7.y:1218
+ //line php7/php7.y:1982
{
name := node.NewIdentifier(yyDollar[4].token.Value)
- yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[4].token))
- yyVAL.node = stmt.NewClassMethod(name, yyDollar[1].list, yyDollar[3].boolWithToken.value, yyDollar[7].list, yyDollar[9].node, yyDollar[10].nodesWithEndToken.nodes, yyDollar[5].str)
- yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewOptionalListTokensPosition(yyDollar[1].list, yyDollar[2].token, yyDollar[10].nodesWithEndToken.endToken))
+ yyVAL.node = stmt.NewClassMethod(name, yyDollar[1].list, yyDollar[3].token != nil, yyDollar[7].list, yyDollar[9].node, yyDollar[10].node, yyDollar[5].str)
- yylex.(*Parser).comments.AddComments(name, yyDollar[4].token.Comments())
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).listGetFirstNodeComments(yyDollar[1].list))
+ // save position
+ yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[4].token))
+ if yyDollar[1].list == nil {
+ yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[2].token, yyDollar[10].node))
+ } else {
+ yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodeListNodePosition(yyDollar[1].list, yyDollar[10].node))
+ }
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.FunctionToken)
+ if yyDollar[3].token != nil {
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[3].token, comment.AmpersandToken)
+ }
+ yylex.(*Parser).comments.AddFromToken(name, yyDollar[4].token, comment.IdentifierToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[6].token, comment.OpenParenthesisToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[8].token, comment.CloseParenthesisToken)
}
case 246:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php7/php7.y:1230
+ //line php7/php7.y:2007
{
yyVAL.list = []node.Node{yyDollar[1].node}
}
case 247:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php7/php7.y:1231
+ //line php7/php7.y:2009
{
yyVAL.list = append(yyDollar[1].list, yyDollar[3].node)
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(lastNode(yyDollar[1].list), yyDollar[2].token, comment.CommaToken)
}
case 248:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php7/php7.y:1235
+ //line php7/php7.y:2019
{
- yyVAL.nodesWithEndToken = &nodesWithEndToken{nil, yyDollar[1].token}
+ yyVAL.node = stmt.NewNop()
+
+ yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.SemiColonToken)
+
}
case 249:
yyDollar = yyS[yypt-2 : yypt+1]
- //line php7/php7.y:1236
+ //line php7/php7.y:2029
{
- yyVAL.nodesWithEndToken = &nodesWithEndToken{nil, yyDollar[2].token}
+ yyVAL.node = stmt.NewTraitAdaptationList(nil)
+
+ yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[2].token))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.OpenCurlyBracesToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.CloseCurlyBracesToken)
}
case 250:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php7/php7.y:1237
+ //line php7/php7.y:2039
{
- yyVAL.nodesWithEndToken = &nodesWithEndToken{yyDollar[2].list, yyDollar[3].token}
+ yyVAL.node = stmt.NewTraitAdaptationList(yyDollar[2].list)
+
+ yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[3].token))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.OpenCurlyBracesToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[3].token, comment.CloseCurlyBracesToken)
}
case 251:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php7/php7.y:1241
+ //line php7/php7.y:2052
{
yyVAL.list = []node.Node{yyDollar[1].node}
}
case 252:
yyDollar = yyS[yypt-2 : yypt+1]
- //line php7/php7.y:1242
+ //line php7/php7.y:2054
{
yyVAL.list = append(yyDollar[1].list, yyDollar[2].node)
}
case 253:
yyDollar = yyS[yypt-2 : yypt+1]
- //line php7/php7.y:1246
+ //line php7/php7.y:2059
{
yyVAL.node = yyDollar[1].node
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.SemiColonToken)
}
case 254:
yyDollar = yyS[yypt-2 : yypt+1]
- //line php7/php7.y:1247
+ //line php7/php7.y:2066
{
yyVAL.node = yyDollar[1].node
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.SemiColonToken)
}
case 255:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php7/php7.y:1252
+ //line php7/php7.y:2076
{
yyVAL.node = stmt.NewTraitUsePrecedence(yyDollar[1].node, yyDollar[3].list)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodeNodeListPosition(yyDollar[1].node, yyDollar[3].list))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.InsteadofToken)
}
case 256:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php7/php7.y:1261
+ //line php7/php7.y:2089
{
alias := node.NewIdentifier(yyDollar[3].token.Value)
- yylex.(*Parser).positions.AddPosition(alias, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[3].token))
yyVAL.node = stmt.NewTraitUseAlias(yyDollar[1].node, nil, alias)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(alias, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[3].token))
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodeTokenPosition(yyDollar[1].node, yyDollar[3].token))
- yylex.(*Parser).comments.AddComments(alias, yyDollar[3].token.Comments())
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node])
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.AsToken)
+ yylex.(*Parser).comments.AddFromToken(alias, yyDollar[3].token, comment.StringToken)
}
case 257:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php7/php7.y:1271
+ //line php7/php7.y:2102
{
alias := node.NewIdentifier(yyDollar[3].token.Value)
- yylex.(*Parser).positions.AddPosition(alias, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[3].token))
yyVAL.node = stmt.NewTraitUseAlias(yyDollar[1].node, nil, alias)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(alias, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[3].token))
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodeTokenPosition(yyDollar[1].node, yyDollar[3].token))
- yylex.(*Parser).comments.AddComments(alias, yyDollar[3].token.Comments())
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node])
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.AsToken)
+ yylex.(*Parser).comments.AddFromToken(alias, yyDollar[3].token, comment.StringToken)
}
case 258:
yyDollar = yyS[yypt-4 : yypt+1]
- //line php7/php7.y:1281
+ //line php7/php7.y:2115
{
alias := node.NewIdentifier(yyDollar[4].token.Value)
- yylex.(*Parser).positions.AddPosition(alias, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[4].token))
yyVAL.node = stmt.NewTraitUseAlias(yyDollar[1].node, yyDollar[3].node, alias)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(alias, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[4].token))
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodeTokenPosition(yyDollar[1].node, yyDollar[4].token))
- yylex.(*Parser).comments.AddComments(alias, yyDollar[4].token.Comments())
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node])
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.AsToken)
+ yylex.(*Parser).comments.AddFromToken(alias, yyDollar[4].token, comment.IdentifierToken)
}
case 259:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php7/php7.y:1291
+ //line php7/php7.y:2128
{
yyVAL.node = stmt.NewTraitUseAlias(yyDollar[1].node, yyDollar[3].node, nil)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.AsToken)
}
case 260:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php7/php7.y:1300
+ //line php7/php7.y:2141
{
name := node.NewIdentifier(yyDollar[1].token.Value)
- yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
yyVAL.node = stmt.NewTraitMethodRef(nil, name)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
- yylex.(*Parser).comments.AddComments(name, yyDollar[1].token.Comments())
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(name, yyDollar[1].token, comment.IdentifierToken)
}
case 261:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php7/php7.y:1309
+ //line php7/php7.y:2153
{
yyVAL.node = yyDollar[1].node
}
case 262:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php7/php7.y:1314
+ //line php7/php7.y:2158
{
target := node.NewIdentifier(yyDollar[3].token.Value)
- yylex.(*Parser).positions.AddPosition(target, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[3].token))
yyVAL.node = stmt.NewTraitMethodRef(yyDollar[1].node, target)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(target, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[3].token))
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodeTokenPosition(yyDollar[1].node, yyDollar[3].token))
- yylex.(*Parser).comments.AddComments(target, yyDollar[3].token.Comments())
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node])
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.PaamayimNekudotayimToken)
+ yylex.(*Parser).comments.AddFromToken(target, yyDollar[3].token, comment.IdentifierToken)
}
case 263:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php7/php7.y:1326
+ //line php7/php7.y:2174
{
- yyVAL.nodesWithEndToken = &nodesWithEndToken{nil, yyDollar[1].token}
+ yyVAL.node = stmt.NewNop()
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.SemiColonToken)
}
case 264:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php7/php7.y:1327
+ //line php7/php7.y:2184
{
- yyVAL.nodesWithEndToken = &nodesWithEndToken{yyDollar[2].list, yyDollar[3].token}
+ yyVAL.node = stmt.NewStmtList(yyDollar[2].list)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[3].token))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.OpenCurlyBracesToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[3].token, comment.CloseCurlyBracesToken)
}
case 265:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php7/php7.y:1331
+ //line php7/php7.y:2198
{
yyVAL.list = yyDollar[1].list
}
case 266:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php7/php7.y:1333
+ //line php7/php7.y:2200
{
modifier := node.NewIdentifier(yyDollar[1].token.Value)
- yylex.(*Parser).positions.AddPosition(modifier, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
yyVAL.list = []node.Node{modifier}
- yylex.(*Parser).comments.AddComments(modifier, yyDollar[1].token.Comments())
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(modifier, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(modifier, yyDollar[1].token, comment.VarToken)
}
case 267:
yyDollar = yyS[yypt-0 : yypt+1]
- //line php7/php7.y:1342
+ //line php7/php7.y:2214
{
yyVAL.list = nil
}
case 268:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php7/php7.y:1343
+ //line php7/php7.y:2216
{
yyVAL.list = yyDollar[1].list
}
case 269:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php7/php7.y:1347
+ //line php7/php7.y:2221
{
yyVAL.list = []node.Node{yyDollar[1].node}
}
case 270:
yyDollar = yyS[yypt-2 : yypt+1]
- //line php7/php7.y:1348
+ //line php7/php7.y:2223
{
yyVAL.list = append(yyDollar[1].list, yyDollar[2].node)
}
case 271:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php7/php7.y:1353
+ //line php7/php7.y:2228
{
yyVAL.node = node.NewIdentifier(yyDollar[1].token.Value)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.PublicToken)
}
case 272:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php7/php7.y:1359
+ //line php7/php7.y:2238
{
yyVAL.node = node.NewIdentifier(yyDollar[1].token.Value)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.ProtectedToken)
}
case 273:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php7/php7.y:1365
+ //line php7/php7.y:2248
{
yyVAL.node = node.NewIdentifier(yyDollar[1].token.Value)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.PrivateToken)
}
case 274:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php7/php7.y:1371
+ //line php7/php7.y:2258
{
yyVAL.node = node.NewIdentifier(yyDollar[1].token.Value)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.StaticToken)
}
case 275:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php7/php7.y:1377
+ //line php7/php7.y:2268
{
yyVAL.node = node.NewIdentifier(yyDollar[1].token.Value)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.AbstractToken)
}
case 276:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php7/php7.y:1383
+ //line php7/php7.y:2278
{
yyVAL.node = node.NewIdentifier(yyDollar[1].token.Value)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.FinalToken)
}
case 277:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php7/php7.y:1391
+ //line php7/php7.y:2291
{
yyVAL.list = append(yyDollar[1].list, yyDollar[3].node)
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(lastNode(yyDollar[1].list), yyDollar[2].token, comment.CommaToken)
}
case 278:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php7/php7.y:1392
+ //line php7/php7.y:2298
{
yyVAL.list = []node.Node{yyDollar[1].node}
}
case 279:
yyDollar = yyS[yypt-2 : yypt+1]
- //line php7/php7.y:1397
+ //line php7/php7.y:2303
{
identifier := node.NewIdentifier(strings.TrimLeft(yyDollar[1].token.Value, "$"))
- yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
variable := expr.NewVariable(identifier)
- yylex.(*Parser).positions.AddPosition(variable, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
yyVAL.node = stmt.NewProperty(variable, nil, yyDollar[2].str)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
+ yylex.(*Parser).positions.AddPosition(variable, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
- yylex.(*Parser).comments.AddComments(identifier, yyDollar[1].token.Comments())
- yylex.(*Parser).comments.AddComments(variable, yyDollar[1].token.Comments())
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(variable, yyDollar[1].token, comment.VariableToken)
}
case 280:
yyDollar = yyS[yypt-4 : yypt+1]
- //line php7/php7.y:1410
+ //line php7/php7.y:2317
{
identifier := node.NewIdentifier(strings.TrimLeft(yyDollar[1].token.Value, "$"))
- yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
variable := expr.NewVariable(identifier)
- yylex.(*Parser).positions.AddPosition(variable, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
yyVAL.node = stmt.NewProperty(variable, yyDollar[3].node, yyDollar[4].str)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
+ yylex.(*Parser).positions.AddPosition(variable, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[3].node))
- yylex.(*Parser).comments.AddComments(identifier, yyDollar[1].token.Comments())
- yylex.(*Parser).comments.AddComments(variable, yyDollar[1].token.Comments())
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(variable, yyDollar[1].token, comment.VariableToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.EqualToken)
}
case 281:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php7/php7.y:1425
+ //line php7/php7.y:2335
{
yyVAL.list = append(yyDollar[1].list, yyDollar[3].node)
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(lastNode(yyDollar[1].list), yyDollar[2].token, comment.CommaToken)
}
case 282:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php7/php7.y:1426
+ //line php7/php7.y:2342
{
yyVAL.list = []node.Node{yyDollar[1].node}
}
case 283:
yyDollar = yyS[yypt-4 : yypt+1]
- //line php7/php7.y:1431
+ //line php7/php7.y:2347
{
name := node.NewIdentifier(yyDollar[1].token.Value)
- yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
yyVAL.node = stmt.NewConstant(name, yyDollar[3].node, yyDollar[4].str)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[3].node))
- yylex.(*Parser).comments.AddComments(name, yyDollar[1].token.Comments())
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(name, yyDollar[1].token, comment.IdentifierToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.EqualToken)
}
case 284:
yyDollar = yyS[yypt-4 : yypt+1]
- //line php7/php7.y:1444
+ //line php7/php7.y:2363
{
name := node.NewIdentifier(yyDollar[1].token.Value)
- yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
yyVAL.node = stmt.NewConstant(name, yyDollar[3].node, yyDollar[4].str)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[3].node))
- yylex.(*Parser).comments.AddComments(name, yyDollar[1].token.Comments())
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(name, yyDollar[1].token, comment.StringToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.EqualToken)
}
case 285:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php7/php7.y:1456
+ //line php7/php7.y:2379
{
yyVAL.list = append(yyDollar[1].list, yyDollar[3].node)
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(lastNode(yyDollar[1].list), yyDollar[2].token, comment.CommaToken)
}
case 286:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php7/php7.y:1457
+ //line php7/php7.y:2386
{
yyVAL.list = []node.Node{yyDollar[1].node}
}
case 287:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php7/php7.y:1461
+ //line php7/php7.y:2391
{
yyVAL.node = yyDollar[1].node
}
case 288:
yyDollar = yyS[yypt-0 : yypt+1]
- //line php7/php7.y:1465
+ //line php7/php7.y:2396
{
yyVAL.list = nil
}
case 289:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php7/php7.y:1466
+ //line php7/php7.y:2398
{
yyVAL.list = yyDollar[1].list
}
case 290:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php7/php7.y:1469
+ //line php7/php7.y:2403
{
yyVAL.list = append(yyDollar[1].list, yyDollar[3].node)
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(lastNode(yyDollar[1].list), yyDollar[2].token, comment.CommaToken)
}
case 291:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php7/php7.y:1470
+ //line php7/php7.y:2410
{
yyVAL.list = []node.Node{yyDollar[1].node}
}
case 292:
yyDollar = yyS[yypt-8 : yypt+1]
- //line php7/php7.y:1475
+ //line php7/php7.y:2415
{
- if yyDollar[2].nodesWithEndToken != nil {
- yyVAL.node = stmt.NewClass(nil, nil, yyDollar[2].nodesWithEndToken.nodes, yyDollar[3].node, yyDollar[4].list, yyDollar[7].list, yyDollar[5].str)
- yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[8].token))
+ 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)
} else {
- yyVAL.node = stmt.NewClass(nil, nil, nil, yyDollar[3].node, yyDollar[4].list, yyDollar[7].list, yyDollar[5].str)
- yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[8].token))
+ yyVAL.node = stmt.NewClass(nil, nil, nil, yyDollar[3].ClassExtends, yyDollar[4].ClassImplements, yyDollar[7].list, yyDollar[5].str)
}
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+ // save position
+ yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[8].token))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.ClassToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[6].token, comment.OpenCurlyBracesToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[8].token, comment.CloseCurlyBracesToken)
}
case 293:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php7/php7.y:1490
+ //line php7/php7.y:2434
{
- if yyDollar[3].nodesWithEndToken != nil {
- yyVAL.node = expr.NewNew(yyDollar[2].node, yyDollar[3].nodesWithEndToken.nodes)
- yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[3].nodesWithEndToken.endToken))
+ if yyDollar[3].node != nil {
+ yyVAL.node = expr.NewNew(yyDollar[2].node, yyDollar[3].node.(*node.ArgumentList))
+ yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[3].node))
} else {
yyVAL.node = expr.NewNew(yyDollar[2].node, nil)
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[2].node))
}
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.NewToken)
}
case 294:
yyDollar = yyS[yypt-2 : yypt+1]
- //line php7/php7.y:1501
+ //line php7/php7.y:2447
{
yyVAL.node = expr.NewNew(yyDollar[2].node, nil)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[2].node))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.NewToken)
}
case 295:
yyDollar = yyS[yypt-6 : yypt+1]
- //line php7/php7.y:1506
+ //line php7/php7.y:2460
{
list := expr.NewList(yyDollar[3].list)
- yylex.(*Parser).positions.AddPosition(list, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[4].token))
yyVAL.node = assign.NewAssign(list, yyDollar[6].node)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(list, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[4].token))
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[6].node))
- yylex.(*Parser).comments.AddComments(list, yyDollar[1].token.Comments())
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(list, yyDollar[1].token, comment.ListToken)
+ yylex.(*Parser).comments.AddFromToken(list, yyDollar[2].token, comment.OpenParenthesisToken)
+ yylex.(*Parser).comments.AddFromToken(list, yyDollar[4].token, comment.CloseParenthesisToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[5].token, comment.EqualToken)
}
case 296:
yyDollar = yyS[yypt-5 : yypt+1]
- //line php7/php7.y:1516
+ //line php7/php7.y:2475
{
shortList := expr.NewShortList(yyDollar[2].list)
- yylex.(*Parser).positions.AddPosition(shortList, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[3].token))
yyVAL.node = assign.NewAssign(shortList, yyDollar[5].node)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(shortList, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[3].token))
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[5].node))
- yylex.(*Parser).comments.AddComments(shortList, yyDollar[1].token.Comments())
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(shortList, yyDollar[1].token, comment.OpenSquareBracket)
+ yylex.(*Parser).comments.AddFromToken(shortList, yyDollar[3].token, comment.CloseSquareBracket)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[4].token, comment.EqualToken)
}
case 297:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php7/php7.y:1526
+ //line php7/php7.y:2489
{
yyVAL.node = assign.NewAssign(yyDollar[1].node, yyDollar[3].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.EqualToken)
}
case 298:
yyDollar = yyS[yypt-4 : yypt+1]
- //line php7/php7.y:1532
+ //line php7/php7.y:2499
{
yyVAL.node = assign.NewReference(yyDollar[1].node, yyDollar[4].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[4].node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.EqualToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[3].token, comment.AmpersandToken)
}
case 299:
yyDollar = yyS[yypt-2 : yypt+1]
- //line php7/php7.y:1538
+ //line php7/php7.y:2510
{
yyVAL.node = expr.NewClone(yyDollar[2].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[2].node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.CloneToken)
}
case 300:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php7/php7.y:1544
+ //line php7/php7.y:2520
{
yyVAL.node = assign.NewPlus(yyDollar[1].node, yyDollar[3].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.PlusEqualToken)
}
case 301:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php7/php7.y:1550
+ //line php7/php7.y:2530
{
yyVAL.node = assign.NewMinus(yyDollar[1].node, yyDollar[3].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.MinusEqualToken)
}
case 302:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php7/php7.y:1556
+ //line php7/php7.y:2540
{
yyVAL.node = assign.NewMul(yyDollar[1].node, yyDollar[3].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.MulEqualToken)
}
case 303:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php7/php7.y:1562
+ //line php7/php7.y:2550
{
yyVAL.node = assign.NewPow(yyDollar[1].node, yyDollar[3].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.PowEqualToken)
}
case 304:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php7/php7.y:1568
+ //line php7/php7.y:2560
{
yyVAL.node = assign.NewDiv(yyDollar[1].node, yyDollar[3].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.DivEqualToken)
}
case 305:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php7/php7.y:1574
+ //line php7/php7.y:2570
{
yyVAL.node = assign.NewConcat(yyDollar[1].node, yyDollar[3].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.ConcatEqualToken)
}
case 306:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php7/php7.y:1580
+ //line php7/php7.y:2580
{
yyVAL.node = assign.NewMod(yyDollar[1].node, yyDollar[3].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.ModEqualToken)
}
case 307:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php7/php7.y:1586
+ //line php7/php7.y:2590
{
yyVAL.node = assign.NewBitwiseAnd(yyDollar[1].node, yyDollar[3].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.AndEqualToken)
}
case 308:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php7/php7.y:1592
+ //line php7/php7.y:2600
{
yyVAL.node = assign.NewBitwiseOr(yyDollar[1].node, yyDollar[3].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.OrEqualToken)
}
case 309:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php7/php7.y:1598
+ //line php7/php7.y:2610
{
yyVAL.node = assign.NewBitwiseXor(yyDollar[1].node, yyDollar[3].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.XorEqualToken)
}
case 310:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php7/php7.y:1604
+ //line php7/php7.y:2620
{
yyVAL.node = assign.NewShiftLeft(yyDollar[1].node, yyDollar[3].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.SlEqualToken)
}
case 311:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php7/php7.y:1610
+ //line php7/php7.y:2630
{
yyVAL.node = assign.NewShiftRight(yyDollar[1].node, yyDollar[3].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.SrEqualToken)
}
case 312:
yyDollar = yyS[yypt-2 : yypt+1]
- //line php7/php7.y:1616
+ //line php7/php7.y:2640
{
yyVAL.node = expr.NewPostInc(yyDollar[1].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodeTokenPosition(yyDollar[1].node, yyDollar[2].token))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.IncToken)
}
case 313:
yyDollar = yyS[yypt-2 : yypt+1]
- //line php7/php7.y:1622
+ //line php7/php7.y:2650
{
yyVAL.node = expr.NewPreInc(yyDollar[2].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[2].node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.IncToken)
}
case 314:
yyDollar = yyS[yypt-2 : yypt+1]
- //line php7/php7.y:1628
+ //line php7/php7.y:2660
{
yyVAL.node = expr.NewPostDec(yyDollar[1].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodeTokenPosition(yyDollar[1].node, yyDollar[2].token))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.DecToken)
}
case 315:
yyDollar = yyS[yypt-2 : yypt+1]
- //line php7/php7.y:1634
+ //line php7/php7.y:2670
{
yyVAL.node = expr.NewPreDec(yyDollar[2].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[2].node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.DecToken)
}
case 316:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php7/php7.y:1640
+ //line php7/php7.y:2680
{
yyVAL.node = binary.NewBooleanOr(yyDollar[1].node, yyDollar[3].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.BooleanOrToken)
}
case 317:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php7/php7.y:1646
+ //line php7/php7.y:2690
{
yyVAL.node = binary.NewBooleanAnd(yyDollar[1].node, yyDollar[3].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.BooleanAndToken)
}
case 318:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php7/php7.y:1652
+ //line php7/php7.y:2700
{
yyVAL.node = binary.NewLogicalOr(yyDollar[1].node, yyDollar[3].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.LogicalOrToken)
}
case 319:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php7/php7.y:1658
+ //line php7/php7.y:2710
{
yyVAL.node = binary.NewLogicalAnd(yyDollar[1].node, yyDollar[3].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.LogicalAndToken)
}
case 320:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php7/php7.y:1664
+ //line php7/php7.y:2720
{
yyVAL.node = binary.NewLogicalXor(yyDollar[1].node, yyDollar[3].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.LogicalXorToken)
}
case 321:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php7/php7.y:1670
+ //line php7/php7.y:2730
{
yyVAL.node = binary.NewBitwiseOr(yyDollar[1].node, yyDollar[3].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.VerticalBarToken)
}
case 322:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php7/php7.y:1676
+ //line php7/php7.y:2740
{
yyVAL.node = binary.NewBitwiseAnd(yyDollar[1].node, yyDollar[3].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.AmpersandToken)
}
case 323:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php7/php7.y:1682
+ //line php7/php7.y:2750
{
yyVAL.node = binary.NewBitwiseXor(yyDollar[1].node, yyDollar[3].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.CaretToken)
}
case 324:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php7/php7.y:1688
+ //line php7/php7.y:2760
{
yyVAL.node = binary.NewConcat(yyDollar[1].node, yyDollar[3].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.DotToken)
}
case 325:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php7/php7.y:1694
+ //line php7/php7.y:2770
{
yyVAL.node = binary.NewPlus(yyDollar[1].node, yyDollar[3].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.PlusToken)
}
case 326:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php7/php7.y:1700
+ //line php7/php7.y:2780
{
yyVAL.node = binary.NewMinus(yyDollar[1].node, yyDollar[3].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.MinusToken)
}
case 327:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php7/php7.y:1706
+ //line php7/php7.y:2790
{
yyVAL.node = binary.NewMul(yyDollar[1].node, yyDollar[3].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.AsteriskToken)
}
case 328:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php7/php7.y:1712
+ //line php7/php7.y:2800
{
yyVAL.node = binary.NewPow(yyDollar[1].node, yyDollar[3].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.PowToken)
}
case 329:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php7/php7.y:1718
+ //line php7/php7.y:2810
{
yyVAL.node = binary.NewDiv(yyDollar[1].node, yyDollar[3].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.SlashToken)
}
case 330:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php7/php7.y:1724
+ //line php7/php7.y:2820
{
yyVAL.node = binary.NewMod(yyDollar[1].node, yyDollar[3].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.PercentToken)
}
case 331:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php7/php7.y:1730
+ //line php7/php7.y:2830
{
yyVAL.node = binary.NewShiftLeft(yyDollar[1].node, yyDollar[3].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.SlToken)
}
case 332:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php7/php7.y:1736
+ //line php7/php7.y:2840
{
yyVAL.node = binary.NewShiftRight(yyDollar[1].node, yyDollar[3].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.SrToken)
}
case 333:
yyDollar = yyS[yypt-2 : yypt+1]
- //line php7/php7.y:1742
+ //line php7/php7.y:2850
{
yyVAL.node = expr.NewUnaryPlus(yyDollar[2].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[2].node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.PlusToken)
}
case 334:
yyDollar = yyS[yypt-2 : yypt+1]
- //line php7/php7.y:1748
+ //line php7/php7.y:2860
{
yyVAL.node = expr.NewUnaryMinus(yyDollar[2].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[2].node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.MinusToken)
}
case 335:
yyDollar = yyS[yypt-2 : yypt+1]
- //line php7/php7.y:1754
+ //line php7/php7.y:2870
{
yyVAL.node = expr.NewBooleanNot(yyDollar[2].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[2].node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.ExclamationMarkToken)
}
case 336:
yyDollar = yyS[yypt-2 : yypt+1]
- //line php7/php7.y:1760
+ //line php7/php7.y:2880
{
yyVAL.node = expr.NewBitwiseNot(yyDollar[2].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[2].node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.TildeToken)
}
case 337:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php7/php7.y:1766
+ //line php7/php7.y:2890
{
yyVAL.node = binary.NewIdentical(yyDollar[1].node, yyDollar[3].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.IsIdenticalToken)
}
case 338:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php7/php7.y:1772
+ //line php7/php7.y:2900
{
yyVAL.node = binary.NewNotIdentical(yyDollar[1].node, yyDollar[3].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.IsNotIdenticalToken)
}
case 339:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php7/php7.y:1778
+ //line php7/php7.y:2910
{
yyVAL.node = binary.NewEqual(yyDollar[1].node, yyDollar[3].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.IsEqualToken)
}
case 340:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php7/php7.y:1784
+ //line php7/php7.y:2920
{
yyVAL.node = binary.NewNotEqual(yyDollar[1].node, yyDollar[3].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.IsNotEqualToken)
}
case 341:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php7/php7.y:1790
+ //line php7/php7.y:2930
{
yyVAL.node = binary.NewSmaller(yyDollar[1].node, yyDollar[3].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.LessToken)
}
case 342:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php7/php7.y:1796
+ //line php7/php7.y:2940
{
yyVAL.node = binary.NewSmallerOrEqual(yyDollar[1].node, yyDollar[3].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.IsSmallerOrEqualToken)
}
case 343:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php7/php7.y:1802
+ //line php7/php7.y:2950
{
yyVAL.node = binary.NewGreater(yyDollar[1].node, yyDollar[3].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.GreaterToken)
}
case 344:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php7/php7.y:1808
+ //line php7/php7.y:2960
{
yyVAL.node = binary.NewGreaterOrEqual(yyDollar[1].node, yyDollar[3].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.IsGreaterOrEqualToken)
}
case 345:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php7/php7.y:1814
+ //line php7/php7.y:2970
{
yyVAL.node = binary.NewSpaceship(yyDollar[1].node, yyDollar[3].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.SpaceshipToken)
}
case 346:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php7/php7.y:1820
+ //line php7/php7.y:2980
{
yyVAL.node = expr.NewInstanceOf(yyDollar[1].node, yyDollar[3].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.InstanceofToken)
}
case 347:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php7/php7.y:1825
+ //line php7/php7.y:2990
{
yyVAL.node = yyDollar[2].node
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.OpenParenthesisToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[3].token, comment.CloseParenthesisToken)
}
case 348:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php7/php7.y:1826
+ //line php7/php7.y:2998
{
yyVAL.node = yyDollar[1].node
}
case 349:
yyDollar = yyS[yypt-5 : yypt+1]
- //line php7/php7.y:1828
+ //line php7/php7.y:3000
{
yyVAL.node = expr.NewTernary(yyDollar[1].node, yyDollar[3].node, yyDollar[5].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[5].node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.QuestionMarkToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[4].token, comment.ColonToken)
}
case 350:
yyDollar = yyS[yypt-4 : yypt+1]
- //line php7/php7.y:1834
+ //line php7/php7.y:3011
{
yyVAL.node = expr.NewTernary(yyDollar[1].node, nil, yyDollar[4].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[4].node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.QuestionMarkToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[3].token, comment.ColonToken)
}
case 351:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php7/php7.y:1840
+ //line php7/php7.y:3022
{
yyVAL.node = binary.NewCoalesce(yyDollar[1].node, yyDollar[3].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.CoalesceToken)
}
case 352:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php7/php7.y:1845
+ //line php7/php7.y:3032
{
yyVAL.node = yyDollar[1].node
}
case 353:
yyDollar = yyS[yypt-2 : yypt+1]
- //line php7/php7.y:1847
+ //line php7/php7.y:3034
{
yyVAL.node = cast.NewInt(yyDollar[2].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[2].node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.IntCastToken)
}
case 354:
yyDollar = yyS[yypt-2 : yypt+1]
- //line php7/php7.y:1853
+ //line php7/php7.y:3044
{
yyVAL.node = cast.NewDouble(yyDollar[2].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[2].node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.DoubleCastToken)
}
case 355:
yyDollar = yyS[yypt-2 : yypt+1]
- //line php7/php7.y:1859
+ //line php7/php7.y:3054
{
yyVAL.node = cast.NewString(yyDollar[2].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[2].node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.StringCastToken)
}
case 356:
yyDollar = yyS[yypt-2 : yypt+1]
- //line php7/php7.y:1865
+ //line php7/php7.y:3064
{
yyVAL.node = cast.NewArray(yyDollar[2].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[2].node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.ArrayCastToken)
}
case 357:
yyDollar = yyS[yypt-2 : yypt+1]
- //line php7/php7.y:1871
+ //line php7/php7.y:3074
{
yyVAL.node = cast.NewObject(yyDollar[2].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[2].node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.ObjectCastToken)
}
case 358:
yyDollar = yyS[yypt-2 : yypt+1]
- //line php7/php7.y:1877
+ //line php7/php7.y:3084
{
yyVAL.node = cast.NewBool(yyDollar[2].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[2].node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.BoolCastToken)
}
case 359:
yyDollar = yyS[yypt-2 : yypt+1]
- //line php7/php7.y:1883
+ //line php7/php7.y:3094
{
yyVAL.node = cast.NewUnset(yyDollar[2].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[2].node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.UnsetCastToken)
}
case 360:
yyDollar = yyS[yypt-2 : yypt+1]
- //line php7/php7.y:1889
+ //line php7/php7.y:3104
{
if strings.EqualFold(yyDollar[1].token.Value, "die") {
- yyVAL.node = expr.NewDie(yyDollar[2].node)
+ yyVAL.node = expr.NewDie(nil)
+ if yyDollar[2].node != nil {
+ yyVAL.node.(*expr.Die).Expr = yyDollar[2].node.(*expr.Exit).Expr
+ }
} else {
- yyVAL.node = expr.NewExit(yyDollar[2].node)
+ yyVAL.node = expr.NewExit(nil)
+ if yyDollar[2].node != nil {
+ yyVAL.node.(*expr.Exit).Expr = yyDollar[2].node.(*expr.Exit).Expr
+ }
+ }
+
+ // save position
+ if yyDollar[2].node == nil {
+ yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
+ } else {
+ yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[2].node))
+ }
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.ExitToken)
+
+ if yyDollar[2].node != nil {
+ yylex.(*Parser).comments.AddFromChildNode(yyVAL.node, yyDollar[2].node)
}
- yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[2].node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
}
case 361:
yyDollar = yyS[yypt-2 : yypt+1]
- //line php7/php7.y:1899
+ //line php7/php7.y:3132
{
yyVAL.node = expr.NewErrorSuppress(yyDollar[2].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[2].node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.AtToken)
}
case 362:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php7/php7.y:1904
+ //line php7/php7.y:3142
{
yyVAL.node = yyDollar[1].node
}
case 363:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php7/php7.y:1906
+ //line php7/php7.y:3144
{
yyVAL.node = expr.NewShellExec(yyDollar[2].list)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[3].token))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.BackquoteToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[3].token, comment.BackquoteToken)
}
case 364:
yyDollar = yyS[yypt-2 : yypt+1]
- //line php7/php7.y:1912
+ //line php7/php7.y:3155
{
yyVAL.node = expr.NewPrint(yyDollar[2].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[2].node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.PrintToken)
}
case 365:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php7/php7.y:1918
+ //line php7/php7.y:3165
{
yyVAL.node = expr.NewYield(nil, nil)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.YieldToken)
}
case 366:
yyDollar = yyS[yypt-2 : yypt+1]
- //line php7/php7.y:1924
+ //line php7/php7.y:3175
{
yyVAL.node = expr.NewYield(nil, yyDollar[2].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[2].node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.YieldToken)
}
case 367:
yyDollar = yyS[yypt-4 : yypt+1]
- //line php7/php7.y:1930
+ //line php7/php7.y:3185
{
yyVAL.node = expr.NewYield(yyDollar[2].node, yyDollar[4].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[4].node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.YieldToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[3].token, comment.DoubleArrowToken)
}
case 368:
yyDollar = yyS[yypt-2 : yypt+1]
- //line php7/php7.y:1936
+ //line php7/php7.y:3196
{
yyVAL.node = expr.NewYieldFrom(yyDollar[2].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[2].node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.YieldFromToken)
}
case 369:
yyDollar = yyS[yypt-11 : yypt+1]
- //line php7/php7.y:1942
+ //line php7/php7.y:3206
{
- yyVAL.node = expr.NewClosure(yyDollar[5].list, yyDollar[7].list, yyDollar[8].node, yyDollar[10].list, false, yyDollar[2].boolWithToken.value, yyDollar[3].str)
+ yyVAL.node = expr.NewClosure(yyDollar[5].list, yyDollar[7].ClosureUse, yyDollar[8].node, yyDollar[10].list, false, yyDollar[2].token != nil, yyDollar[3].str)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[11].token))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.FunctionToken)
+ if yyDollar[2].token != nil {
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.AmpersandToken)
+ }
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[4].token, comment.OpenParenthesisToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[6].token, comment.CloseParenthesisToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[9].token, comment.OpenCurlyBracesToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[11].token, comment.CloseCurlyBracesToken)
}
case 370:
yyDollar = yyS[yypt-12 : yypt+1]
- //line php7/php7.y:1949
+ //line php7/php7.y:3223
{
- yyVAL.node = expr.NewClosure(yyDollar[6].list, yyDollar[8].list, yyDollar[9].node, yyDollar[11].list, true, yyDollar[3].boolWithToken.value, yyDollar[4].str)
+ yyVAL.node = expr.NewClosure(yyDollar[6].list, yyDollar[8].ClosureUse, yyDollar[9].node, yyDollar[11].list, true, yyDollar[3].token != nil, yyDollar[4].str)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[12].token))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.StaticToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.FunctionToken)
+ if yyDollar[3].token != nil {
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[3].token, comment.AmpersandToken)
+ }
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[5].token, comment.OpenParenthesisToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[7].token, comment.CloseParenthesisToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[10].token, comment.OpenCurlyBracesToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[12].token, comment.CloseCurlyBracesToken)
}
case 371:
yyDollar = yyS[yypt-0 : yypt+1]
- //line php7/php7.y:1958
+ //line php7/php7.y:3244
{
yyVAL.str = yylex.(*Parser).PhpDocComment
yylex.(*Parser).PhpDocComment = ""
}
case 372:
yyDollar = yyS[yypt-0 : yypt+1]
- //line php7/php7.y:1962
+ //line php7/php7.y:3252
{
- yyVAL.boolWithToken = boolWithToken{false, nil}
+ yyVAL.token = nil
}
case 373:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php7/php7.y:1963
+ //line php7/php7.y:3254
{
- yyVAL.boolWithToken = boolWithToken{true, &yyDollar[1].token}
+ yyVAL.token = yyDollar[1].token
}
case 374:
yyDollar = yyS[yypt-0 : yypt+1]
- //line php7/php7.y:1967
+ //line php7/php7.y:3259
{
- yyVAL.list = []node.Node{}
+ yyVAL.ClosureUse = nil
}
case 375:
yyDollar = yyS[yypt-4 : yypt+1]
- //line php7/php7.y:1968
+ //line php7/php7.y:3261
{
- yyVAL.list = yyDollar[3].list
+ yyVAL.ClosureUse = expr.NewClosureUse(yyDollar[3].list)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(yyVAL.ClosureUse, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[4].token))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.ClosureUse, yyDollar[1].token, comment.UseToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.ClosureUse, yyDollar[2].token, comment.OpenParenthesisToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.ClosureUse, yyDollar[4].token, comment.CloseParenthesisToken)
}
case 376:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php7/php7.y:1972
+ //line php7/php7.y:3276
{
yyVAL.list = append(yyDollar[1].list, yyDollar[3].node)
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(lastNode(yyDollar[1].list), yyDollar[2].token, comment.CommaToken)
}
case 377:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php7/php7.y:1973
+ //line php7/php7.y:3283
{
yyVAL.list = []node.Node{yyDollar[1].node}
}
case 378:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php7/php7.y:1978
+ //line php7/php7.y:3288
{
identifier := node.NewIdentifier(strings.TrimLeft(yyDollar[1].token.Value, "$"))
+ yyVAL.node = expr.NewVariable(identifier)
+
+ // save position
yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
- variable := expr.NewVariable(identifier)
- yylex.(*Parser).positions.AddPosition(variable, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
- yyVAL.node = expr.NewClosureUse(variable, false)
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
- yylex.(*Parser).comments.AddComments(identifier, yyDollar[1].token.Comments())
- yylex.(*Parser).comments.AddComments(variable, yyDollar[1].token.Comments())
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.VariableToken)
}
case 379:
yyDollar = yyS[yypt-2 : yypt+1]
- //line php7/php7.y:1991
+ //line php7/php7.y:3300
{
identifier := node.NewIdentifier(strings.TrimLeft(yyDollar[2].token.Value, "$"))
- yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[2].token))
variable := expr.NewVariable(identifier)
+ yyVAL.node = expr.NewReference(variable)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[2].token))
yylex.(*Parser).positions.AddPosition(variable, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[2].token))
- yyVAL.node = expr.NewClosureUse(variable, true)
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[2].token))
- yylex.(*Parser).comments.AddComments(identifier, yyDollar[2].token.Comments())
- yylex.(*Parser).comments.AddComments(variable, yyDollar[1].token.Comments())
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.AmpersandToken)
+ yylex.(*Parser).comments.AddFromToken(variable, yyDollar[2].token, comment.VariableToken)
}
case 380:
yyDollar = yyS[yypt-2 : yypt+1]
- //line php7/php7.y:2007
+ //line php7/php7.y:3318
{
- yyVAL.node = expr.NewFunctionCall(yyDollar[1].node, yyDollar[2].nodesWithEndToken.nodes)
- yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodeTokenPosition(yyDollar[1].node, yyDollar[2].nodesWithEndToken.endToken))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node])
+ yyVAL.node = expr.NewFunctionCall(yyDollar[1].node, yyDollar[2].node.(*node.ArgumentList))
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[2].node))
}
case 381:
yyDollar = yyS[yypt-4 : yypt+1]
- //line php7/php7.y:2013
+ //line php7/php7.y:3325
{
- yyVAL.node = expr.NewStaticCall(yyDollar[1].node, yyDollar[3].node, yyDollar[4].nodesWithEndToken.nodes)
- yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodeTokenPosition(yyDollar[1].node, yyDollar[4].nodesWithEndToken.endToken))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node])
+ yyVAL.node = expr.NewStaticCall(yyDollar[1].node, yyDollar[3].node, yyDollar[4].node.(*node.ArgumentList))
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[4].node))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.PaamayimNekudotayimToken)
}
case 382:
yyDollar = yyS[yypt-4 : yypt+1]
- //line php7/php7.y:2019
+ //line php7/php7.y:3335
{
- yyVAL.node = expr.NewStaticCall(yyDollar[1].node, yyDollar[3].node, yyDollar[4].nodesWithEndToken.nodes)
- yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodeTokenPosition(yyDollar[1].node, yyDollar[4].nodesWithEndToken.endToken))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node])
+ yyVAL.node = expr.NewStaticCall(yyDollar[1].node, yyDollar[3].node, yyDollar[4].node.(*node.ArgumentList))
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[4].node))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.PaamayimNekudotayimToken)
}
case 383:
yyDollar = yyS[yypt-2 : yypt+1]
- //line php7/php7.y:2025
+ //line php7/php7.y:3345
{
- yyVAL.node = expr.NewFunctionCall(yyDollar[1].node, yyDollar[2].nodesWithEndToken.nodes)
- yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodeTokenPosition(yyDollar[1].node, yyDollar[2].nodesWithEndToken.endToken))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node])
+ yyVAL.node = expr.NewFunctionCall(yyDollar[1].node, yyDollar[2].node.(*node.ArgumentList))
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[2].node))
}
case 384:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php7/php7.y:2034
+ //line php7/php7.y:3355
{
yyVAL.node = node.NewIdentifier(yyDollar[1].token.Value)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.StaticToken)
}
case 385:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php7/php7.y:2039
+ //line php7/php7.y:3365
{
yyVAL.node = yyDollar[1].node
}
case 386:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php7/php7.y:2043
+ //line php7/php7.y:3370
{
yyVAL.node = yyDollar[1].node
}
case 387:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php7/php7.y:2044
+ //line php7/php7.y:3372
{
yyVAL.node = yyDollar[1].node
}
case 388:
yyDollar = yyS[yypt-0 : yypt+1]
- //line php7/php7.y:2048
+ //line php7/php7.y:3377
{
yyVAL.node = nil
}
case 389:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php7/php7.y:2049
+ //line php7/php7.y:3379
{
- yyVAL.node = yyDollar[2].node
+ yyVAL.node = expr.NewExit(yyDollar[2].node)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[3].token))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.OpenParenthesisToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[3].token, comment.CloseParenthesisToken)
}
case 390:
yyDollar = yyS[yypt-0 : yypt+1]
- //line php7/php7.y:2053
+ //line php7/php7.y:3393
{
yyVAL.list = []node.Node{}
}
case 391:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php7/php7.y:2054
+ //line php7/php7.y:3395
{
yyVAL.list = []node.Node{scalar.NewEncapsedStringPart(yyDollar[1].token.Value)}
}
case 392:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php7/php7.y:2055
+ //line php7/php7.y:3397
{
yyVAL.list = yyDollar[1].list
}
case 393:
yyDollar = yyS[yypt-0 : yypt+1]
- //line php7/php7.y:2059
+ //line php7/php7.y:3402
{
- yyVAL.nodesWithEndToken = nil
+ yyVAL.node = nil
}
case 394:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php7/php7.y:2060
+ //line php7/php7.y:3404
{
- yyVAL.nodesWithEndToken = yyDollar[1].nodesWithEndToken
+ yyVAL.node = yyDollar[1].node
}
case 395:
yyDollar = yyS[yypt-4 : yypt+1]
- //line php7/php7.y:2065
+ //line php7/php7.y:3409
{
yyVAL.node = expr.NewArray(yyDollar[3].list)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[4].token))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.ArrayToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.OpenParenthesisToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[4].token, comment.CloseParenthesisToken)
}
case 396:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php7/php7.y:2071
+ //line php7/php7.y:3421
{
yyVAL.node = expr.NewShortArray(yyDollar[2].list)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[3].token))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.OpenSquareBracket)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[3].token, comment.CloseSquareBracket)
}
case 397:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php7/php7.y:2077
+ //line php7/php7.y:3432
{
yyVAL.node = scalar.NewString(yyDollar[1].token.Value)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.ConstantEncapsedStringToken)
}
case 398:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php7/php7.y:2086
+ //line php7/php7.y:3445
{
yyVAL.node = scalar.NewLnumber(yyDollar[1].token.Value)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.LnumberToken)
}
case 399:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php7/php7.y:2092
+ //line php7/php7.y:3455
{
yyVAL.node = scalar.NewDnumber(yyDollar[1].token.Value)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.DnumberToken)
}
case 400:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php7/php7.y:2098
+ //line php7/php7.y:3465
{
yyVAL.node = scalar.NewMagicConstant(yyDollar[1].token.Value)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.LineToken)
}
case 401:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php7/php7.y:2104
+ //line php7/php7.y:3475
{
yyVAL.node = scalar.NewMagicConstant(yyDollar[1].token.Value)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.FileToken)
}
case 402:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php7/php7.y:2110
+ //line php7/php7.y:3485
{
yyVAL.node = scalar.NewMagicConstant(yyDollar[1].token.Value)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.DirToken)
}
case 403:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php7/php7.y:2116
+ //line php7/php7.y:3495
{
yyVAL.node = scalar.NewMagicConstant(yyDollar[1].token.Value)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.TraitCToken)
}
case 404:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php7/php7.y:2122
+ //line php7/php7.y:3505
{
yyVAL.node = scalar.NewMagicConstant(yyDollar[1].token.Value)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.MethodCToken)
}
case 405:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php7/php7.y:2128
+ //line php7/php7.y:3515
{
yyVAL.node = scalar.NewMagicConstant(yyDollar[1].token.Value)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.FuncCToken)
}
case 406:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php7/php7.y:2134
+ //line php7/php7.y:3525
{
yyVAL.node = scalar.NewMagicConstant(yyDollar[1].token.Value)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.NsCToken)
}
case 407:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php7/php7.y:2140
+ //line php7/php7.y:3535
{
yyVAL.node = scalar.NewMagicConstant(yyDollar[1].token.Value)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.ClassCToken)
}
case 408:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php7/php7.y:2146
+ //line php7/php7.y:3545
{
encapsed := scalar.NewEncapsedStringPart(yyDollar[2].token.Value)
- yylex.(*Parser).positions.AddPosition(encapsed, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[2].token))
- yylex.(*Parser).comments.AddComments(encapsed, yyDollar[2].token.Comments())
-
yyVAL.node = scalar.NewHeredoc(yyDollar[1].token.Value, []node.Node{encapsed})
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(encapsed, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[2].token))
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[3].token))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.StartHeredocToken)
}
case 409:
yyDollar = yyS[yypt-2 : yypt+1]
- //line php7/php7.y:2156
+ //line php7/php7.y:3557
{
yyVAL.node = scalar.NewHeredoc(yyDollar[1].token.Value, nil)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[2].token))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.StartHeredocToken)
}
case 410:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php7/php7.y:2162
+ //line php7/php7.y:3567
{
yyVAL.node = scalar.NewEncapsed(yyDollar[2].list)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[3].token))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.DoubleQuoteToken)
}
case 411:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php7/php7.y:2168
+ //line php7/php7.y:3577
{
yyVAL.node = scalar.NewHeredoc(yyDollar[1].token.Value, yyDollar[2].list)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[3].token))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.StartHeredocToken)
}
case 412:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php7/php7.y:2173
+ //line php7/php7.y:3587
{
yyVAL.node = yyDollar[1].node
}
case 413:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php7/php7.y:2174
+ //line php7/php7.y:3589
{
yyVAL.node = yyDollar[1].node
}
case 414:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php7/php7.y:2179
+ //line php7/php7.y:3594
{
yyVAL.node = expr.NewConstFetch(yyDollar[1].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodePosition(yyDollar[1].node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node])
}
case 415:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php7/php7.y:2185
+ //line php7/php7.y:3601
{
target := node.NewIdentifier(yyDollar[3].token.Value)
- yylex.(*Parser).positions.AddPosition(target, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[3].token))
yyVAL.node = expr.NewClassConstFetch(yyDollar[1].node, target)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(target, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[3].token))
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodeTokenPosition(yyDollar[1].node, yyDollar[3].token))
- yylex.(*Parser).comments.AddComments(target, yyDollar[3].token.Comments())
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node])
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.PaamayimNekudotayimToken)
+ yylex.(*Parser).comments.AddFromToken(target, yyDollar[3].token, comment.IdentifierToken)
}
case 416:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php7/php7.y:2195
+ //line php7/php7.y:3614
{
target := node.NewIdentifier(yyDollar[3].token.Value)
- yylex.(*Parser).positions.AddPosition(target, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[3].token))
yyVAL.node = expr.NewClassConstFetch(yyDollar[1].node, target)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(target, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[3].token))
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodeTokenPosition(yyDollar[1].node, yyDollar[3].token))
- yylex.(*Parser).comments.AddComments(target, yyDollar[3].token.Comments())
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node])
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.PaamayimNekudotayimToken)
+ yylex.(*Parser).comments.AddFromToken(target, yyDollar[3].token, comment.IdentifierToken)
}
case 417:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php7/php7.y:2207
+ //line php7/php7.y:3630
{
yyVAL.node = yyDollar[1].node
}
case 418:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php7/php7.y:2208
+ //line php7/php7.y:3632
{
yyVAL.node = yyDollar[1].node
}
case 419:
yyDollar = yyS[yypt-0 : yypt+1]
- //line php7/php7.y:2212
+ //line php7/php7.y:3637
{
yyVAL.node = nil
}
case 420:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php7/php7.y:2213
+ //line php7/php7.y:3639
{
yyVAL.node = yyDollar[1].node
}
case 421:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php7/php7.y:2217
+ //line php7/php7.y:3644
{
yyVAL.node = yyDollar[1].node
}
case 422:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php7/php7.y:2221
+ //line php7/php7.y:3649
{
yyVAL.node = yyDollar[1].node
}
case 423:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php7/php7.y:2222
+ //line php7/php7.y:3651
{
yyVAL.node = yyDollar[2].node
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.OpenParenthesisToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[3].token, comment.CloseParenthesisToken)
}
case 424:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php7/php7.y:2223
+ //line php7/php7.y:3659
{
yyVAL.node = yyDollar[1].node
}
case 425:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php7/php7.y:2227
+ //line php7/php7.y:3664
{
yyVAL.node = yyDollar[1].node
}
case 426:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php7/php7.y:2228
+ //line php7/php7.y:3666
{
yyVAL.node = yyDollar[2].node
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.OpenParenthesisToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[3].token, comment.CloseParenthesisToken)
}
case 427:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php7/php7.y:2229
+ //line php7/php7.y:3674
{
yyVAL.node = yyDollar[1].node
}
case 428:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php7/php7.y:2233
+ //line php7/php7.y:3679
{
yyVAL.node = yyDollar[1].node
}
case 429:
yyDollar = yyS[yypt-4 : yypt+1]
- //line php7/php7.y:2235
+ //line php7/php7.y:3681
{
yyVAL.node = expr.NewArrayDimFetch(yyDollar[1].node, yyDollar[3].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodeTokenPosition(yyDollar[1].node, yyDollar[4].token))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.OpenSquareBracket)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[4].token, comment.CloseSquareBracket)
}
case 430:
yyDollar = yyS[yypt-4 : yypt+1]
- //line php7/php7.y:2241
+ //line php7/php7.y:3692
{
yyVAL.node = expr.NewArrayDimFetch(yyDollar[1].node, yyDollar[3].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodeTokenPosition(yyDollar[1].node, yyDollar[4].token))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.OpenSquareBracket)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[4].token, comment.CloseSquareBracket)
}
case 431:
yyDollar = yyS[yypt-4 : yypt+1]
- //line php7/php7.y:2247
+ //line php7/php7.y:3703
{
yyVAL.node = expr.NewArrayDimFetch(yyDollar[1].node, yyDollar[3].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodeTokenPosition(yyDollar[1].node, yyDollar[4].token))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.OpenCurlyBracesToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[4].token, comment.CloseCurlyBracesToken)
}
case 432:
yyDollar = yyS[yypt-4 : yypt+1]
- //line php7/php7.y:2253
+ //line php7/php7.y:3714
{
- yyVAL.node = expr.NewMethodCall(yyDollar[1].node, yyDollar[3].node, yyDollar[4].nodesWithEndToken.nodes)
- yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodeTokenPosition(yyDollar[1].node, yyDollar[4].nodesWithEndToken.endToken))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node])
+ yyVAL.node = expr.NewMethodCall(yyDollar[1].node, yyDollar[3].node, yyDollar[4].node.(*node.ArgumentList))
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[4].node))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.ObjectOperatorToken)
}
case 433:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php7/php7.y:2258
+ //line php7/php7.y:3724
{
yyVAL.node = yyDollar[1].node
}
case 434:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php7/php7.y:2262
+ //line php7/php7.y:3729
{
yyVAL.node = yyDollar[1].node
}
case 435:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php7/php7.y:2263
+ //line php7/php7.y:3731
{
yyVAL.node = yyDollar[1].node
}
case 436:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php7/php7.y:2265
+ //line php7/php7.y:3733
{
yyVAL.node = expr.NewPropertyFetch(yyDollar[1].node, yyDollar[3].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.ObjectOperatorToken)
}
case 437:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php7/php7.y:2274
+ //line php7/php7.y:3746
{
name := node.NewIdentifier(strings.TrimLeft(yyDollar[1].token.Value, "$"))
- yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
yyVAL.node = expr.NewVariable(name)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
- yylex.(*Parser).comments.AddComments(name, yyDollar[1].token.Comments())
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.VariableToken)
}
case 438:
yyDollar = yyS[yypt-4 : yypt+1]
- //line php7/php7.y:2284
+ //line php7/php7.y:3758
{
yyVAL.node = expr.NewVariable(yyDollar[3].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[4].token))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.DollarToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.OpenCurlyBracesToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[4].token, comment.CloseCurlyBracesToken)
}
case 439:
yyDollar = yyS[yypt-2 : yypt+1]
- //line php7/php7.y:2290
+ //line php7/php7.y:3770
{
yyVAL.node = expr.NewVariable(yyDollar[2].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[2].node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.DollarToken)
}
case 440:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php7/php7.y:2299
+ //line php7/php7.y:3783
{
yyVAL.node = expr.NewStaticPropertyFetch(yyDollar[1].node, yyDollar[3].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.PaamayimNekudotayimToken)
}
case 441:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php7/php7.y:2305
+ //line php7/php7.y:3793
{
yyVAL.node = expr.NewStaticPropertyFetch(yyDollar[1].node, yyDollar[3].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.PaamayimNekudotayimToken)
}
case 442:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php7/php7.y:2313
+ //line php7/php7.y:3806
{
yyVAL.node = yyDollar[1].node
}
case 443:
yyDollar = yyS[yypt-4 : yypt+1]
- //line php7/php7.y:2315
+ //line php7/php7.y:3808
{
yyVAL.node = expr.NewArrayDimFetch(yyDollar[1].node, yyDollar[3].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodeTokenPosition(yyDollar[1].node, yyDollar[4].token))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.OpenSquareBracket)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[4].token, comment.CloseSquareBracket)
}
case 444:
yyDollar = yyS[yypt-4 : yypt+1]
- //line php7/php7.y:2321
+ //line php7/php7.y:3819
{
yyVAL.node = expr.NewArrayDimFetch(yyDollar[1].node, yyDollar[3].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodeTokenPosition(yyDollar[1].node, yyDollar[4].token))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.OpenCurlyBracesToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[4].token, comment.CloseCurlyBracesToken)
}
case 445:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php7/php7.y:2327
+ //line php7/php7.y:3830
{
yyVAL.node = expr.NewPropertyFetch(yyDollar[1].node, yyDollar[3].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.ObjectOperatorToken)
}
case 446:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php7/php7.y:2333
+ //line php7/php7.y:3840
{
yyVAL.node = expr.NewStaticPropertyFetch(yyDollar[1].node, yyDollar[3].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.PaamayimNekudotayimToken)
}
case 447:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php7/php7.y:2339
+ //line php7/php7.y:3850
{
yyVAL.node = expr.NewStaticPropertyFetch(yyDollar[1].node, yyDollar[3].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.PaamayimNekudotayimToken)
}
case 448:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php7/php7.y:2348
+ //line php7/php7.y:3863
{
yyVAL.node = node.NewIdentifier(yyDollar[1].token.Value)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.IdentifierToken)
}
case 449:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php7/php7.y:2353
+ //line php7/php7.y:3873
{
yyVAL.node = yyDollar[2].node
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.OpenCurlyBracesToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[3].token, comment.CloseCurlyBracesToken)
}
case 450:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php7/php7.y:2354
+ //line php7/php7.y:3881
{
yyVAL.node = yyDollar[1].node
}
case 451:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php7/php7.y:2359
+ //line php7/php7.y:3886
{
yyVAL.node = node.NewIdentifier(yyDollar[1].token.Value)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.StringToken)
}
case 452:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php7/php7.y:2364
+ //line php7/php7.y:3896
{
yyVAL.node = yyDollar[2].node
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.OpenCurlyBracesToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[3].token, comment.CloseCurlyBracesToken)
}
case 453:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php7/php7.y:2365
+ //line php7/php7.y:3904
{
yyVAL.node = yyDollar[1].node
}
case 454:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php7/php7.y:2370
+ //line php7/php7.y:3909
{
if yyDollar[1].list[len(yyDollar[1].list)-1] == nil {
yyVAL.list = yyDollar[1].list[:len(yyDollar[1].list)-1]
@@ -5506,327 +6792,444 @@ yydefault:
}
case 455:
yyDollar = yyS[yypt-0 : yypt+1]
- //line php7/php7.y:2380
+ //line php7/php7.y:3920
{
yyVAL.node = nil
}
case 456:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php7/php7.y:2381
+ //line php7/php7.y:3922
{
yyVAL.node = yyDollar[1].node
}
case 457:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php7/php7.y:2386
+ //line php7/php7.y:3927
{
yyVAL.list = append(yyDollar[1].list, yyDollar[3].node)
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(lastNode(yyDollar[1].list), yyDollar[2].token, comment.CommaToken)
}
case 458:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php7/php7.y:2387
+ //line php7/php7.y:3934
{
yyVAL.list = []node.Node{yyDollar[1].node}
}
case 459:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php7/php7.y:2392
+ //line php7/php7.y:3939
{
- yyVAL.node = expr.NewArrayItem(yyDollar[1].node, yyDollar[3].node, false)
+ yyVAL.node = expr.NewArrayItem(yyDollar[1].node, yyDollar[3].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.DoubleArrowToken)
}
case 460:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php7/php7.y:2398
+ //line php7/php7.y:3949
{
- yyVAL.node = expr.NewArrayItem(nil, yyDollar[1].node, false)
+ yyVAL.node = expr.NewArrayItem(nil, yyDollar[1].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodePosition(yyDollar[1].node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node])
}
case 461:
yyDollar = yyS[yypt-4 : yypt+1]
- //line php7/php7.y:2404
+ //line php7/php7.y:3956
{
- yyVAL.node = expr.NewArrayItem(yyDollar[1].node, yyDollar[4].node, true)
+ reference := expr.NewReference(yyDollar[4].node)
+ yyVAL.node = expr.NewArrayItem(yyDollar[1].node, reference)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[4].node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.DoubleArrowToken)
+ yylex.(*Parser).comments.AddFromToken(reference, yyDollar[3].token, comment.AmpersandToken)
}
case 462:
yyDollar = yyS[yypt-2 : yypt+1]
- //line php7/php7.y:2410
+ //line php7/php7.y:3968
{
- yyVAL.node = expr.NewArrayItem(nil, yyDollar[2].node, true)
+ reference := expr.NewReference(yyDollar[2].node)
+ yyVAL.node = expr.NewArrayItem(nil, reference)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[2].node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(reference, yyDollar[1].token, comment.AmpersandToken)
}
case 463:
yyDollar = yyS[yypt-6 : yypt+1]
- //line php7/php7.y:2416
+ //line php7/php7.y:3979
{
// TODO: Cannot use list() as standalone expression
list := expr.NewList(yyDollar[5].list)
+ yyVAL.node = expr.NewArrayItem(yyDollar[1].node, list)
+
+ // save position
yylex.(*Parser).positions.AddPosition(list, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[3].token, yyDollar[6].token))
- yyVAL.node = expr.NewArrayItem(yyDollar[1].node, list, false)
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodeTokenPosition(yyDollar[1].node, yyDollar[6].token))
- yylex.(*Parser).comments.AddComments(list, yyDollar[3].token.Comments())
- yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node])
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.DoubleArrowToken)
+ yylex.(*Parser).comments.AddFromToken(list, yyDollar[3].token, comment.ListToken)
+ yylex.(*Parser).comments.AddFromToken(list, yyDollar[4].token, comment.OpenParenthesisToken)
+ yylex.(*Parser).comments.AddFromToken(list, yyDollar[6].token, comment.CloseParenthesisToken)
}
case 464:
yyDollar = yyS[yypt-4 : yypt+1]
- //line php7/php7.y:2427
+ //line php7/php7.y:3995
{
// TODO: Cannot use list() as standalone expression
list := expr.NewList(yyDollar[3].list)
+ yyVAL.node = expr.NewArrayItem(nil, list)
+
+ // save position
yylex.(*Parser).positions.AddPosition(list, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[4].token))
- yyVAL.node = expr.NewArrayItem(nil, list, false)
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[4].token))
- yylex.(*Parser).comments.AddComments(list, yyDollar[1].token.Comments())
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(list, yyDollar[1].token, comment.ListToken)
+ yylex.(*Parser).comments.AddFromToken(list, yyDollar[2].token, comment.OpenParenthesisToken)
+ yylex.(*Parser).comments.AddFromToken(list, yyDollar[4].token, comment.CloseParenthesisToken)
}
case 465:
yyDollar = yyS[yypt-2 : yypt+1]
- //line php7/php7.y:2440
+ //line php7/php7.y:4013
{
yyVAL.list = append(yyDollar[1].list, yyDollar[2].node)
}
case 466:
yyDollar = yyS[yypt-2 : yypt+1]
- //line php7/php7.y:2442
+ //line php7/php7.y:4015
{
encapsed := scalar.NewEncapsedStringPart(yyDollar[2].token.Value)
- yylex.(*Parser).positions.AddPosition(encapsed, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[2].token))
yyVAL.list = append(yyDollar[1].list, encapsed)
- yylex.(*Parser).comments.AddComments(encapsed, yyDollar[2].token.Comments())
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(encapsed, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[2].token))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(encapsed, yyDollar[2].token, comment.EncapsedAndWhitespaceToken)
}
case 467:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php7/php7.y:2448
+ //line php7/php7.y:4026
{
yyVAL.list = []node.Node{yyDollar[1].node}
}
case 468:
yyDollar = yyS[yypt-2 : yypt+1]
- //line php7/php7.y:2450
+ //line php7/php7.y:4028
{
encapsed := scalar.NewEncapsedStringPart(yyDollar[1].token.Value)
- yylex.(*Parser).positions.AddPosition(encapsed, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
yyVAL.list = []node.Node{encapsed, yyDollar[2].node}
- yylex.(*Parser).comments.AddComments(encapsed, yyDollar[1].token.Comments())
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(encapsed, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(encapsed, yyDollar[1].token, comment.EncapsedAndWhitespaceToken)
}
case 469:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php7/php7.y:2460
+ //line php7/php7.y:4042
{
name := node.NewIdentifier(strings.TrimLeft(yyDollar[1].token.Value, "$"))
- yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
yyVAL.node = expr.NewVariable(name)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
- yylex.(*Parser).comments.AddComments(name, yyDollar[1].token.Comments())
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.VariableToken)
}
case 470:
yyDollar = yyS[yypt-4 : yypt+1]
- //line php7/php7.y:2470
+ //line php7/php7.y:4054
{
identifier := node.NewIdentifier(strings.TrimLeft(yyDollar[1].token.Value, "$"))
- yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
variable := expr.NewVariable(identifier)
- yylex.(*Parser).positions.AddPosition(variable, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
yyVAL.node = expr.NewArrayDimFetch(variable, yyDollar[3].node)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
+ yylex.(*Parser).positions.AddPosition(variable, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[4].token))
- yylex.(*Parser).comments.AddComments(identifier, yyDollar[1].token.Comments())
- yylex.(*Parser).comments.AddComments(variable, yyDollar[1].token.Comments())
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(variable, yyDollar[1].token, comment.VariableToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.OpenSquareBracket)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[4].token, comment.CloseSquareBracket)
}
case 471:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php7/php7.y:2483
+ //line php7/php7.y:4070
{
identifier := node.NewIdentifier(strings.TrimLeft(yyDollar[1].token.Value, "$"))
- yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
variable := expr.NewVariable(identifier)
- yylex.(*Parser).positions.AddPosition(variable, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
fetch := node.NewIdentifier(yyDollar[3].token.Value)
- yylex.(*Parser).positions.AddPosition(fetch, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[3].token))
yyVAL.node = expr.NewPropertyFetch(variable, fetch)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
+ yylex.(*Parser).positions.AddPosition(variable, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
+ yylex.(*Parser).positions.AddPosition(fetch, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[3].token))
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[3].token))
- yylex.(*Parser).comments.AddComments(identifier, yyDollar[1].token.Comments())
- yylex.(*Parser).comments.AddComments(variable, yyDollar[1].token.Comments())
- yylex.(*Parser).comments.AddComments(fetch, yyDollar[3].token.Comments())
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(variable, yyDollar[1].token, comment.VariableToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.ObjectOperatorToken)
+ yylex.(*Parser).comments.AddFromToken(fetch, yyDollar[3].token, comment.StringToken)
}
case 472:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php7/php7.y:2499
+ //line php7/php7.y:4088
{
yyVAL.node = expr.NewVariable(yyDollar[2].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[3].token))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.DollarOpenCurlyBracesToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[3].token, comment.CloseCurlyBracesToken)
}
case 473:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php7/php7.y:2505
+ //line php7/php7.y:4099
{
name := node.NewIdentifier(yyDollar[2].token.Value)
- yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[2].token))
yyVAL.node = expr.NewVariable(name)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[2].token))
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[3].token))
- yylex.(*Parser).comments.AddComments(name, yyDollar[2].token.Comments())
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.DollarOpenCurlyBracesToken)
+ yylex.(*Parser).comments.AddFromToken(name, yyDollar[2].token, comment.StringVarnameToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[3].token, comment.CloseCurlyBracesToken)
}
case 474:
yyDollar = yyS[yypt-6 : yypt+1]
- //line php7/php7.y:2515
+ //line php7/php7.y:4113
{
identifier := node.NewIdentifier(yyDollar[2].token.Value)
- yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[2].token))
variable := expr.NewVariable(identifier)
- yylex.(*Parser).positions.AddPosition(variable, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[2].token))
yyVAL.node = expr.NewArrayDimFetch(variable, yyDollar[4].node)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[2].token))
+ yylex.(*Parser).positions.AddPosition(variable, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[2].token))
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[6].token))
- yylex.(*Parser).comments.AddComments(identifier, yyDollar[2].token.Comments())
- yylex.(*Parser).comments.AddComments(variable, yyDollar[1].token.Comments())
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.DollarOpenCurlyBracesToken)
+ yylex.(*Parser).comments.AddFromToken(variable, yyDollar[2].token, comment.StringVarnameToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[3].token, comment.OpenSquareBracket)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[5].token, comment.CloseSquareBracket)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[6].token, comment.CloseCurlyBracesToken)
}
case 475:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php7/php7.y:2528
+ //line php7/php7.y:4131
{
yyVAL.node = yyDollar[2].node
}
case 476:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php7/php7.y:2532
+ //line php7/php7.y:4138
{
yyVAL.node = scalar.NewString(yyDollar[1].token.Value)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.StringToken)
}
case 477:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php7/php7.y:2538
+ //line php7/php7.y:4148
{
// TODO: add option to handle 64 bit integer
if _, err := strconv.Atoi(yyDollar[1].token.Value); err == nil {
yyVAL.node = scalar.NewLnumber(yyDollar[1].token.Value)
- yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
} else {
yyVAL.node = scalar.NewString(yyDollar[1].token.Value)
- yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
}
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.NumStringToken)
}
case 478:
yyDollar = yyS[yypt-2 : yypt+1]
- //line php7/php7.y:2550
+ //line php7/php7.y:4163
{
+ var lnumber *scalar.Lnumber
// TODO: add option to handle 64 bit integer
- if _, err := strconv.Atoi(yyDollar[2].token.Value); err == nil {
- lnumber := scalar.NewLnumber(yyDollar[2].token.Value)
- yylex.(*Parser).positions.AddPosition(lnumber, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[2].token))
- yyVAL.node = expr.NewUnaryMinus(lnumber)
- yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[2].token))
+ _, err := strconv.Atoi(yyDollar[2].token.Value)
+ isInt := err == nil
- yylex.(*Parser).comments.AddComments(lnumber, yyDollar[1].token.Comments())
+ if isInt {
+ lnumber = scalar.NewLnumber(yyDollar[2].token.Value)
+ yyVAL.node = expr.NewUnaryMinus(lnumber)
} else {
yyDollar[2].token.Value = "-" + yyDollar[2].token.Value
yyVAL.node = scalar.NewString(yyDollar[2].token.Value)
- yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[2].token))
}
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+ // save position
+ if isInt {
+ yylex.(*Parser).positions.AddPosition(lnumber, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[2].token))
+ }
+ yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[2].token))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.MinusToken)
+ if isInt {
+ yylex.(*Parser).comments.AddFromToken(lnumber, yyDollar[2].token, comment.NumStringToken)
+ } else {
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.NumStringToken)
+ }
}
case 479:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php7/php7.y:2568
+ //line php7/php7.y:4192
{
identifier := node.NewIdentifier(strings.TrimLeft(yyDollar[1].token.Value, "$"))
- yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
yyVAL.node = expr.NewVariable(identifier)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token))
- yylex.(*Parser).comments.AddComments(identifier, yyDollar[1].token.Comments())
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.VariableToken)
}
case 480:
yyDollar = yyS[yypt-5 : yypt+1]
- //line php7/php7.y:2581
+ //line php7/php7.y:4207
{
yyVAL.node = expr.NewIsset(yyDollar[3].list)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[5].token))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.IssetToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.OpenParenthesisToken)
+ if yyDollar[4].token != nil {
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[4].token, comment.CommaToken)
+ }
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[5].token, comment.CloseParenthesisToken)
}
case 481:
yyDollar = yyS[yypt-4 : yypt+1]
- //line php7/php7.y:2587
+ //line php7/php7.y:4222
{
yyVAL.node = expr.NewEmpty(yyDollar[3].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[4].token))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.EmptyToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.OpenParenthesisToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[4].token, comment.CloseParenthesisToken)
}
case 482:
yyDollar = yyS[yypt-2 : yypt+1]
- //line php7/php7.y:2593
+ //line php7/php7.y:4234
{
yyVAL.node = expr.NewInclude(yyDollar[2].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[2].node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.IncludeToken)
}
case 483:
yyDollar = yyS[yypt-2 : yypt+1]
- //line php7/php7.y:2599
+ //line php7/php7.y:4244
{
yyVAL.node = expr.NewIncludeOnce(yyDollar[2].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[2].node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.IncludeOnceToken)
}
case 484:
yyDollar = yyS[yypt-4 : yypt+1]
- //line php7/php7.y:2605
+ //line php7/php7.y:4254
{
yyVAL.node = expr.NewEval(yyDollar[3].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[4].token))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.EvalToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.OpenParenthesisToken)
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[4].token, comment.CloseParenthesisToken)
}
case 485:
yyDollar = yyS[yypt-2 : yypt+1]
- //line php7/php7.y:2611
+ //line php7/php7.y:4266
{
yyVAL.node = expr.NewRequire(yyDollar[2].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[2].node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.RequireToken)
}
case 486:
yyDollar = yyS[yypt-2 : yypt+1]
- //line php7/php7.y:2617
+ //line php7/php7.y:4276
{
yyVAL.node = expr.NewRequireOnce(yyDollar[2].node)
+
+ // save position
yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[2].node))
- yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.RequireOnceToken)
}
case 487:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php7/php7.y:2625
+ //line php7/php7.y:4289
{
yyVAL.list = []node.Node{yyDollar[1].node}
}
case 488:
yyDollar = yyS[yypt-3 : yypt+1]
- //line php7/php7.y:2626
+ //line php7/php7.y:4291
{
yyVAL.list = append(yyDollar[1].list, yyDollar[3].node)
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(lastNode(yyDollar[1].list), yyDollar[2].token, comment.CommaToken)
}
case 489:
yyDollar = yyS[yypt-1 : yypt+1]
- //line php7/php7.y:2630
+ //line php7/php7.y:4301
{
yyVAL.node = yyDollar[1].node
}
diff --git a/php7/php7.y b/php7/php7.y
index 4b7b0f9..0c7514e 100644
--- a/php7/php7.y
+++ b/php7/php7.y
@@ -5,7 +5,8 @@ import (
"strings"
"strconv"
- "github.com/z7zmey/php-parser/token"
+ "github.com/z7zmey/php-parser/comment"
+ "github.com/z7zmey/php-parser/scanner"
"github.com/z7zmey/php-parser/node"
"github.com/z7zmey/php-parser/node/scalar"
"github.com/z7zmey/php-parser/node/name"
@@ -19,14 +20,15 @@ import (
%}
%union{
- node node.Node
- token token.Token
- boolWithToken boolWithToken
- list []node.Node
- foreachVariable foreachVariable
- nodesWithEndToken *nodesWithEndToken
- str string
- altSyntaxNode altSyntaxNode
+ node node.Node
+ token *scanner.Token
+ list []node.Node
+ str string
+
+ ClassExtends *stmt.ClassExtends
+ ClassImplements *stmt.ClassImplements
+ InterfaceExtends *stmt.InterfaceExtends
+ ClosureUse *expr.ClosureUse
}
%type $unk
@@ -143,6 +145,29 @@ import (
%token T_COALESCE
%token T_SPACESHIP
%token T_NOELSE
+%token T_PLUS_EQUAL
+%token T_MINUS_EQUAL
+%token T_MUL_EQUAL
+%token T_POW_EQUAL
+%token T_DIV_EQUAL
+%token T_CONCAT_EQUAL
+%token T_MOD_EQUAL
+%token T_AND_EQUAL
+%token T_OR_EQUAL
+%token T_XOR_EQUAL
+%token T_SL_EQUAL
+%token T_SR_EQUAL
+%token T_BOOLEAN_OR
+%token T_BOOLEAN_AND
+%token T_POW
+%token T_SL
+%token T_SR
+%token T_IS_IDENTICAL
+%token T_IS_NOT_IDENTICAL
+%token T_IS_EQUAL
+%token T_IS_NOT_EQUAL
+%token T_IS_SMALLER_OR_EQUAL
+%token T_IS_GREATER_OR_EQUAL
%token '"'
%token '`'
%token '{'
@@ -161,6 +186,16 @@ import (
%token '~'
%token '@'
%token '$'
+%token ','
+%token '|'
+%token '='
+%token '^'
+%token '*'
+%token '/'
+%token '%'
+%token '<'
+%token '>'
+%token '.'
%left T_INCLUDE T_INCLUDE_ONCE T_EVAL T_REQUIRE T_REQUIRE_ONCE
%left ','
@@ -196,11 +231,13 @@ import (
%left T_ENDIF
%right T_STATIC T_ABSTRACT T_FINAL T_PRIVATE T_PROTECTED T_PUBLIC
-%type is_reference is_variadic returns_ref
+%type is_reference is_variadic returns_ref
%type reserved_non_modifiers
%type semi_reserved
%type identifier
+%type possible_comma
+%type case_separator
%type top_statement name statement function_declaration_statement
%type class_declaration_statement trait_declaration_statement
@@ -210,7 +247,7 @@ import (
%type const_decl inner_statement
%type expr optional_expr
%type declare_statement finally_statement unset_variable variable
-%type extends_from parameter optional_type argument expr_without_variable global_var
+%type parameter optional_type argument expr_without_variable global_var
%type static_var class_statement trait_adaptation trait_precedence trait_alias
%type absolute_trait_method_reference trait_method_reference property echo_expr
%type new_expr anonymous_class class_name class_name_reference simple_variable
@@ -227,37 +264,45 @@ import (
%type array_pair possible_array_pair
%type isset_variable type return_type type_expr
%type class_modifier
+%type argument_list ctor_arguments
+%type trait_adaptations
+%type switch_case_list
+%type method_body
+%type foreach_statement for_statement while_statement
+%type extends_from
+%type implements_list
+%type interface_extends_list
+%type lexical_vars
%type member_modifier
%type use_type
-%type foreach_variable
+%type foreach_variable
-%type method_body switch_case_list trait_adaptations argument_list ctor_arguments
%type encaps_list backticks_expr namespace_name catch_name_list catch_list class_const_list
%type const_list echo_expr_list for_exprs non_empty_for_exprs global_var_list
%type unprefixed_use_declarations inline_use_declarations property_list static_var_list
%type case_list trait_adaptation_list unset_variables
-%type use_declarations lexical_var_list lexical_vars isset_variables non_empty_array_pair_list
+%type use_declarations lexical_var_list isset_variables non_empty_array_pair_list
%type array_pair_list non_empty_argument_list top_statement_list
%type inner_statement_list parameter_list non_empty_parameter_list class_statement_list
-%type interface_extends_list implements_list method_modifiers variable_modifiers
+%type method_modifiers variable_modifiers
%type non_empty_member_modifiers name_list class_modifiers
%type backup_doc_comment
-%type while_statement for_statement foreach_statement
-
%%
/////////////////////////////////////////////////////////////////////////
start:
- top_statement_list
- {
- yylex.(*Parser).rootNode = stmt.NewStmtList($1)
- yylex.(*Parser).positions.AddPosition(yylex.(*Parser).rootNode, yylex.(*Parser).positionBuilder.NewNodeListPosition($1))
- }
+ top_statement_list
+ {
+ yylex.(*Parser).rootNode = node.NewRoot($1)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(yylex.(*Parser).rootNode, yylex.(*Parser).positionBuilder.NewNodeListPosition($1))
+ }
;
reserved_non_modifiers:
@@ -271,153 +316,269 @@ reserved_non_modifiers:
;
semi_reserved:
- reserved_non_modifiers {$$=$1}
- | T_STATIC {$$=$1} | T_ABSTRACT {$$=$1} | T_FINAL {$$=$1} | T_PRIVATE {$$=$1} | T_PROTECTED {$$=$1} | T_PUBLIC {$$=$1}
+ reserved_non_modifiers
+ { $$ = $1 }
+ | T_STATIC {$$=$1} | T_ABSTRACT {$$=$1} | T_FINAL {$$=$1} | T_PRIVATE {$$=$1} | T_PROTECTED {$$=$1} | T_PUBLIC {$$=$1}
;
identifier:
- T_STRING { $$ = $1 }
- | semi_reserved { $$ = $1 }
+ T_STRING
+ { $$ = $1 }
+ | semi_reserved
+ { $$ = $1 }
;
top_statement_list:
- top_statement_list top_statement
- {
- if $2 != nil {
- $$ = append($1, $2)
+ top_statement_list top_statement
+ {
+ if $2 != nil {
+ $$ = append($1, $2)
+ }
}
- }
- | /* empty */ { $$ = []node.Node{} }
+ | /* empty */
+ { $$ = []node.Node{} }
;
namespace_name:
- T_STRING
- {
- namePart := name.NewNamePart($1.Value)
- yylex.(*Parser).positions.AddPosition(namePart, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
- $$ = []node.Node{namePart}
- yylex.(*Parser).comments.AddComments(namePart, $1.Comments())
- }
+ T_STRING
+ {
+ namePart := name.NewNamePart($1.Value)
+ $$ = []node.Node{namePart}
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(namePart, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(namePart, $1, comment.StringToken)
+ }
| namespace_name T_NS_SEPARATOR T_STRING
- {
- namePart := name.NewNamePart($3.Value)
- yylex.(*Parser).positions.AddPosition(namePart, yylex.(*Parser).positionBuilder.NewTokenPosition($3))
- $$ = append($1, namePart)
- yylex.(*Parser).comments.AddComments(namePart, $3.Comments())
- }
+ {
+ namePart := name.NewNamePart($3.Value)
+ $$ = append($1, namePart)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(namePart, yylex.(*Parser).positionBuilder.NewTokenPosition($3))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(lastNode($1), $2, comment.NsSeparatorToken)
+ yylex.(*Parser).comments.AddFromToken(namePart, $3, comment.StringToken)
+ }
;
name:
- namespace_name
- {
- $$ = name.NewName($1)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodeListPosition($1))
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).listGetFirstNodeComments($1))
- }
+ namespace_name
+ {
+ $$ = name.NewName($1)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodeListPosition($1))
+ }
| T_NAMESPACE T_NS_SEPARATOR namespace_name
- {
- $$ = name.NewRelative($3)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodeListPosition($1, $3))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
- }
+ {
+ $$ = name.NewRelative($3)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodeListPosition($1, $3))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.NamespaceToken)
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.NsSeparatorToken)
+ }
| T_NS_SEPARATOR namespace_name
- {
- $$ = name.NewFullyQualified($2)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodeListPosition($1, $2))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
- }
+ {
+ $$ = name.NewFullyQualified($2)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodeListPosition($1, $2))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.NsSeparatorToken)
+ }
;
top_statement:
- error
- {
- // error
- $$ = nil
- }
- | statement { $$ = $1; }
- | function_declaration_statement { $$ = $1; }
- | class_declaration_statement { $$ = $1; }
- | trait_declaration_statement { $$ = $1; }
- | interface_declaration_statement { $$ = $1; }
- | T_HALT_COMPILER '(' ')' ';' { $$ = stmt.NewHaltCompiler() }
+ error
+ {
+ // error
+ $$ = nil
+ }
+ | statement
+ { $$ = $1; }
+ | function_declaration_statement
+ { $$ = $1; }
+ | class_declaration_statement
+ { $$ = $1; }
+ | trait_declaration_statement
+ { $$ = $1; }
+ | interface_declaration_statement
+ { $$ = $1; }
+ | T_HALT_COMPILER '(' ')' ';'
+ {
+ $$ = stmt.NewHaltCompiler()
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $4))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.HaltCompilerToken)
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.OpenParenthesisToken)
+ yylex.(*Parser).comments.AddFromToken($$, $3, comment.CloseParenthesisToken)
+ yylex.(*Parser).comments.AddFromToken($$, $4, comment.SemiColonToken)
+ }
| T_NAMESPACE namespace_name ';'
- {
- name := name.NewName($2)
- yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewNodeListPosition($2))
- $$ = stmt.NewNamespace(name, nil)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $3))
+ {
+ name := name.NewName($2)
+ $$ = stmt.NewNamespace(name, nil)
- yylex.(*Parser).comments.AddComments(name, yylex.(*Parser).listGetFirstNodeComments($2))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
- }
+ // save position
+ yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewNodeListPosition($2))
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $3))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.NamespaceToken)
+ yylex.(*Parser).comments.AddFromToken($$, $3, comment.SemiColonToken)
+ }
| T_NAMESPACE namespace_name '{' top_statement_list '}'
- {
- name := name.NewName($2)
- yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewNodeListPosition($2))
- $$ = stmt.NewNamespace(name, $4)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $5))
+ {
+ name := name.NewName($2)
+ $$ = stmt.NewNamespace(name, $4)
- yylex.(*Parser).comments.AddComments(name, yylex.(*Parser).listGetFirstNodeComments($2))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
- }
+ // save position
+ yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewNodeListPosition($2))
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $5))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.NamespaceToken)
+ yylex.(*Parser).comments.AddFromToken($$, $3, comment.OpenCurlyBracesToken)
+ yylex.(*Parser).comments.AddFromToken($$, $5, comment.CloseCurlyBracesToken)
+ }
| T_NAMESPACE '{' top_statement_list '}'
- {
- $$ = stmt.NewNamespace(nil, $3)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $4))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
- }
- | T_USE mixed_group_use_declaration ';' { $$ = $2 }
- | T_USE use_type group_use_declaration ';' { $$ = $3.(*stmt.GroupUse).SetUseType($2) }
+ {
+ $$ = stmt.NewNamespace(nil, $3)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $4))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.NamespaceToken)
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.OpenCurlyBracesToken)
+ yylex.(*Parser).comments.AddFromToken($$, $4, comment.CloseCurlyBracesToken)
+ }
+ | T_USE mixed_group_use_declaration ';'
+ {
+ $$ = $2
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $3))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.UseToken)
+ yylex.(*Parser).comments.AddFromToken($$, $3, comment.SemiColonToken)
+ }
+ | T_USE use_type group_use_declaration ';'
+ {
+ $$ = $3.(*stmt.GroupUse).SetUseType($2)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $4))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.UseToken)
+ yylex.(*Parser).comments.AddFromToken($$, $4, comment.SemiColonToken)
+ }
| T_USE use_declarations ';'
- {
- $$ = stmt.NewUseList(nil, $2)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $3))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
- }
- | T_USE use_type use_declarations ';' { $$ = stmt.NewUseList($2, $3) }
+ {
+ $$ = stmt.NewUseList(nil, $2)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $3))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.UseToken)
+ yylex.(*Parser).comments.AddFromToken($$, $3, comment.SemiColonToken)
+ }
+ | T_USE use_type use_declarations ';'
+ {
+ $$ = stmt.NewUseList($2, $3)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $4))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.UseToken)
+ yylex.(*Parser).comments.AddFromToken($$, $4, comment.SemiColonToken)
+ }
| T_CONST const_list ';'
- {
- $$ = stmt.NewConstList($2)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $3))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
- }
+ {
+ $$ = stmt.NewConstList($2)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $3))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.ConstToken)
+ yylex.(*Parser).comments.AddFromToken($$, $3, comment.SemiColonToken)
+ }
;
use_type:
- T_FUNCTION
- {
- $$ = node.NewIdentifier($1.Value)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
- }
+ T_FUNCTION
+ {
+ $$ = node.NewIdentifier($1.Value)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.FunctionToken)
+ }
| T_CONST
- {
- $$ = node.NewIdentifier($1.Value)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
- }
+ {
+ $$ = node.NewIdentifier($1.Value)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.ConstToken)
+ }
;
group_use_declaration:
namespace_name T_NS_SEPARATOR '{' unprefixed_use_declarations possible_comma '}'
{
name := name.NewName($1)
- yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewNodeListPosition($1))
$$ = stmt.NewGroupUse(nil, name, $4)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewNodeListPosition($1))
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodeListTokenPosition($1, $6))
- yylex.(*Parser).comments.AddComments(name, yylex.(*Parser).listGetFirstNodeComments($1))
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).listGetFirstNodeComments($1))
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.NsSeparatorToken)
+ yylex.(*Parser).comments.AddFromToken($$, $3, comment.OpenCurlyBracesToken)
+ if $5 != nil {
+ yylex.(*Parser).comments.AddFromToken($$, $5, comment.CommaToken)
+ }
+ yylex.(*Parser).comments.AddFromToken($$, $6, comment.CloseCurlyBracesToken)
}
| T_NS_SEPARATOR namespace_name T_NS_SEPARATOR '{' unprefixed_use_declarations possible_comma '}'
{
name := name.NewName($2)
- yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewNodeListPosition($2))
$$ = stmt.NewGroupUse(nil, name, $5)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewNodeListPosition($2))
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $7))
- yylex.(*Parser).comments.AddComments(name, yylex.(*Parser).listGetFirstNodeComments($2))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.NsSeparatorToken)
+ yylex.(*Parser).comments.AddFromToken($$, $3, comment.NsSeparatorToken)
+ yylex.(*Parser).comments.AddFromToken($$, $4, comment.OpenCurlyBracesToken)
+ if $6 != nil {
+ yylex.(*Parser).comments.AddFromToken($$, $6, comment.CommaToken)
+ }
+ yylex.(*Parser).comments.AddFromToken($$, $7, comment.CloseCurlyBracesToken)
}
;
@@ -425,247 +586,448 @@ mixed_group_use_declaration:
namespace_name T_NS_SEPARATOR '{' inline_use_declarations possible_comma '}'
{
name := name.NewName($1)
- yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewNodeListPosition($1))
$$ = stmt.NewGroupUse(nil, name, $4)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewNodeListPosition($1))
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodeListTokenPosition($1, $6))
- yylex.(*Parser).comments.AddComments(name, yylex.(*Parser).listGetFirstNodeComments($1))
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).listGetFirstNodeComments($1))
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.NsSeparatorToken)
+ yylex.(*Parser).comments.AddFromToken($$, $3, comment.OpenCurlyBracesToken)
+ if $5 != nil {
+ yylex.(*Parser).comments.AddFromToken($$, $5, comment.CommaToken)
+ }
+ yylex.(*Parser).comments.AddFromToken($$, $6, comment.CloseCurlyBracesToken)
}
| T_NS_SEPARATOR namespace_name T_NS_SEPARATOR '{' inline_use_declarations possible_comma '}'
{
name := name.NewName($2)
- yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewNodeListPosition($2))
$$ = stmt.NewGroupUse(nil, name, $5)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewNodeListPosition($2))
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $7))
- yylex.(*Parser).comments.AddComments(name, yylex.(*Parser).listGetFirstNodeComments($2))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.NsSeparatorToken)
+ yylex.(*Parser).comments.AddFromToken($$, $3, comment.NsSeparatorToken)
+ yylex.(*Parser).comments.AddFromToken($$, $4, comment.OpenCurlyBracesToken)
+ if $6 != nil {
+ yylex.(*Parser).comments.AddFromToken($$, $6, comment.CommaToken)
+ }
+ yylex.(*Parser).comments.AddFromToken($$, $7, comment.CloseCurlyBracesToken)
}
;
possible_comma:
/* empty */
+ { $$ = nil }
| ','
+ { $$ = $1 }
;
inline_use_declarations:
inline_use_declarations ',' inline_use_declaration
- { $$ = append($1, $3) }
- | inline_use_declaration { $$ = []node.Node{$1} }
+ {
+ $$ = append($1, $3)
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(lastNode($1), $2, comment.CommaToken)
+ }
+ | inline_use_declaration
+ { $$ = []node.Node{$1} }
;
unprefixed_use_declarations:
unprefixed_use_declarations ',' unprefixed_use_declaration
- { $$ = append($1, $3) }
- | unprefixed_use_declaration { $$ = []node.Node{$1} }
+ {
+ $$ = append($1, $3)
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(lastNode($1), $2, comment.CommaToken)
+ }
+ | unprefixed_use_declaration
+ { $$ = []node.Node{$1} }
;
use_declarations:
- use_declarations ',' use_declaration { $$ = append($1, $3) }
- | use_declaration { $$ = []node.Node{$1} }
+ use_declarations ',' use_declaration
+ {
+ $$ = append($1, $3)
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(lastNode($1), $2, comment.CommaToken)
+ }
+ | use_declaration
+ { $$ = []node.Node{$1} }
;
inline_use_declaration:
- unprefixed_use_declaration { $$ = $1; }
- | use_type unprefixed_use_declaration { $$ = $2.(*stmt.Use).SetUseType($1) }
+ unprefixed_use_declaration
+ { $$ = $1 }
+ | use_type unprefixed_use_declaration
+ { $$ = $2.(*stmt.Use).SetUseType($1) }
;
unprefixed_use_declaration:
- namespace_name
- {
- name := name.NewName($1)
- yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewNodeListPosition($1))
- $$ = stmt.NewUse(nil, name, nil)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodeListPosition($1))
+ namespace_name
+ {
+ name := name.NewName($1)
+ $$ = stmt.NewUse(nil, name, nil)
- yylex.(*Parser).comments.AddComments(name, yylex.(*Parser).listGetFirstNodeComments($1))
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).listGetFirstNodeComments($1))
- }
+ // save position
+ yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewNodeListPosition($1))
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodeListPosition($1))
+ }
| namespace_name T_AS T_STRING
- {
- name := name.NewName($1)
- yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewNodeListPosition($1))
- alias := node.NewIdentifier($3.Value)
- yylex.(*Parser).positions.AddPosition(alias, yylex.(*Parser).positionBuilder.NewTokenPosition($3))
- $$ = stmt.NewUse(nil, name, alias)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodeListTokenPosition($1, $3))
+ {
+ name := name.NewName($1)
+ alias := node.NewIdentifier($3.Value)
+ $$ = stmt.NewUse(nil, name, alias)
- yylex.(*Parser).comments.AddComments(name, yylex.(*Parser).listGetFirstNodeComments($1))
- yylex.(*Parser).comments.AddComments(alias, $3.Comments())
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).listGetFirstNodeComments($1))
- }
+ // save position
+ yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewNodeListPosition($1))
+ yylex.(*Parser).positions.AddPosition(alias, yylex.(*Parser).positionBuilder.NewTokenPosition($3))
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodeListTokenPosition($1, $3))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.AsToken)
+ yylex.(*Parser).comments.AddFromToken(alias, $3, comment.StringToken)
+ }
;
use_declaration:
- unprefixed_use_declaration { $$ = $1; }
- | T_NS_SEPARATOR unprefixed_use_declaration { $$ = $2; }
+ unprefixed_use_declaration
+ { $$ = $1; }
+ | T_NS_SEPARATOR unprefixed_use_declaration
+ {
+ $$ = $2;
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.NsSeparatorToken)
+ }
;
const_list:
- const_list ',' const_decl { $$ = append($1, $3) }
- | const_decl { $$ = []node.Node{$1} }
+ const_list ',' const_decl
+ {
+ $$ = append($1, $3)
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(lastNode($1), $2, comment.CommaToken)
+ }
+ | const_decl
+ { $$ = []node.Node{$1} }
;
inner_statement_list:
- inner_statement_list inner_statement
- {
- if $2 != nil {
- $$ = append($1, $2)
+ inner_statement_list inner_statement
+ {
+ if $2 != nil {
+ $$ = append($1, $2)
+ }
}
- }
- | /* empty */ { $$ = []node.Node{} }
+ | /* empty */
+ { $$ = []node.Node{} }
;
inner_statement:
- error
- {
- // error
- $$ = nil
- }
- | statement { $$ = $1; }
- | function_declaration_statement { $$ = $1; }
- | class_declaration_statement { $$ = $1; }
- | trait_declaration_statement { $$ = $1; }
- | interface_declaration_statement { $$ = $1; }
+ error
+ {
+ // error
+ $$ = nil
+ }
+ | statement
+ { $$ = $1; }
+ | function_declaration_statement
+ { $$ = $1; }
+ | class_declaration_statement
+ { $$ = $1; }
+ | trait_declaration_statement
+ { $$ = $1; }
+ | interface_declaration_statement
+ { $$ = $1; }
| T_HALT_COMPILER '(' ')' ';'
- {
- $$ = stmt.NewHaltCompiler()
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $4))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
- }
+ {
+ $$ = stmt.NewHaltCompiler()
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $4))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.HaltCompilerToken)
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.OpenParenthesisToken)
+ yylex.(*Parser).comments.AddFromToken($$, $3, comment.CloseParenthesisToken)
+ yylex.(*Parser).comments.AddFromToken($$, $4, comment.SemiColonToken)
+ }
statement:
- '{' inner_statement_list '}'
- {
- $$ = stmt.NewStmtList($2)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $3))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
- }
- | if_stmt { $$ = $1; }
- | alt_if_stmt { $$ = $1; }
+ '{' inner_statement_list '}'
+ {
+ $$ = stmt.NewStmtList($2)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $3))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.OpenCurlyBracesToken)
+ yylex.(*Parser).comments.AddFromToken($$, $3, comment.CloseCurlyBracesToken)
+ }
+ | if_stmt
+ { $$ = $1; }
+ | alt_if_stmt
+ { $$ = $1; }
| T_WHILE '(' expr ')' while_statement
- {
- if ($5.isAlt) {
- $$ = stmt.NewAltWhile($3, $5.node)
- } else {
- $$ = stmt.NewWhile($3, $5.node)
+ {
+ switch n := $5.(type) {
+ case *stmt.While :
+ n.Cond = $3
+ case *stmt.AltWhile :
+ n.Cond = $3
+ }
+
+ $$ = $5
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $5))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.WhileToken)
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.OpenParenthesisToken)
+ yylex.(*Parser).comments.AddFromToken($$, $4, comment.CloseParenthesisToken)
}
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $5.node))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
- }
| T_DO statement T_WHILE '(' expr ')' ';'
- {
- $$ = stmt.NewDo($2, $5)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $7))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
- }
+ {
+ $$ = stmt.NewDo($2, $5)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $7))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.DoToken)
+ yylex.(*Parser).comments.AddFromToken($$, $3, comment.WhileToken)
+ yylex.(*Parser).comments.AddFromToken($$, $4, comment.OpenParenthesisToken)
+ yylex.(*Parser).comments.AddFromToken($$, $6, comment.CloseParenthesisToken)
+ yylex.(*Parser).comments.AddFromToken($$, $7, comment.SemiColonToken)
+ }
| T_FOR '(' for_exprs ';' for_exprs ';' for_exprs ')' for_statement
- {
- if ($9.isAlt) {
- $$ = stmt.NewAltFor($3, $5, $7, $9.node)
- } else {
- $$ = stmt.NewFor($3, $5, $7, $9.node)
+ {
+ switch n := $9.(type) {
+ case *stmt.For :
+ n.Init = $3
+ n.Cond = $5
+ n.Loop = $7
+ case *stmt.AltFor :
+ n.Init = $3
+ n.Cond = $5
+ n.Loop = $7
+ }
+
+ $$ = $9
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $9))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.ForToken)
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.OpenParenthesisToken)
+ yylex.(*Parser).comments.AddFromToken($$, $4, comment.ForInitSemicolonToken)
+ yylex.(*Parser).comments.AddFromToken($$, $6, comment.ForCondSemicolonToken)
+ yylex.(*Parser).comments.AddFromToken($$, $8, comment.CloseParenthesisToken)
}
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $9.node))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
- }
| T_SWITCH '(' expr ')' switch_case_list
- {
- if ($5.endToken.Value == ";") {
- $$ = stmt.NewAltSwitch($3, $5.nodes)
- } else {
- $$ = stmt.NewSwitch($3, $5.nodes)
+ {
+ switch n := $5.(type) {
+ case *stmt.Switch:
+ n.Cond = $3
+ case *stmt.AltSwitch:
+ n.Cond = $3
+ default:
+ panic("unexpected node type")
+ }
+
+ $$ = $5
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $5))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.SwitchToken)
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.OpenParenthesisToken)
+ yylex.(*Parser).comments.AddFromToken($$, $4, comment.CloseParenthesisToken)
}
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $5.endToken))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
- }
| T_BREAK optional_expr ';'
- {
- $$ = stmt.NewBreak($2)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $3))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
- }
+ {
+ $$ = stmt.NewBreak($2)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $3))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.BreakToken)
+ yylex.(*Parser).comments.AddFromToken($$, $3, comment.SemiColonToken)
+ }
| T_CONTINUE optional_expr ';'
- {
- $$ = stmt.NewContinue($2)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $3))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
- }
+ {
+ $$ = stmt.NewContinue($2)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $3))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.ContinueToken)
+ yylex.(*Parser).comments.AddFromToken($$, $3, comment.SemiColonToken)
+ }
| T_RETURN optional_expr ';'
- {
- $$ = stmt.NewReturn($2)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $3))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
- }
+ {
+ $$ = stmt.NewReturn($2)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $3))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.ReturnToken)
+ yylex.(*Parser).comments.AddFromToken($$, $3, comment.SemiColonToken)
+ }
| T_GLOBAL global_var_list ';'
- {
- $$ = stmt.NewGlobal($2)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $3))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
- }
+ {
+ $$ = stmt.NewGlobal($2)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $3))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.GlobalToken)
+ yylex.(*Parser).comments.AddFromToken($$, $3, comment.SemiColonToken)
+ }
| T_STATIC static_var_list ';'
- {
- $$ = stmt.NewStatic($2)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $3))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
- }
+ {
+ $$ = stmt.NewStatic($2)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $3))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.StaticToken)
+ yylex.(*Parser).comments.AddFromToken($$, $3, comment.SemiColonToken)
+ }
| T_ECHO echo_expr_list ';'
- {
- $$ = stmt.NewEcho($2)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $3))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
- }
+ {
+ $$ = stmt.NewEcho($2)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $3))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.EchoToken)
+ yylex.(*Parser).comments.AddFromToken($$, $3, comment.SemiColonToken)
+ }
| T_INLINE_HTML
- {
- $$ = stmt.NewInlineHtml($1.Value)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
- }
+ {
+ $$ = stmt.NewInlineHtml($1.Value)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.InlineHTMLToken)
+ }
| expr ';'
- {
- $$ = stmt.NewExpression($1)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodeTokenPosition($1, $2))
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1])
- }
+ {
+ $$ = stmt.NewExpression($1)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodeTokenPosition($1, $2))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.SemiColonToken)
+ }
| T_UNSET '(' unset_variables possible_comma ')' ';'
- {
- $$ = stmt.NewUnset($3)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $6))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
- }
+ {
+ $$ = stmt.NewUnset($3)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $6))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.UnsetToken)
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.OpenParenthesisToken)
+ if $4 != nil {
+ yylex.(*Parser).comments.AddFromToken($$, $4, comment.CommaToken)
+ }
+ yylex.(*Parser).comments.AddFromToken($$, $5, comment.CloseParenthesisToken)
+ yylex.(*Parser).comments.AddFromToken($$, $6, comment.SemiColonToken)
+ }
| T_FOREACH '(' expr T_AS foreach_variable ')' foreach_statement
- {
- if ($7.isAlt) {
- $$ = stmt.NewAltForeach($3, nil, $5.node, $7.node, $5.byRef)
- } else {
- $$ = stmt.NewForeach($3, nil, $5.node, $7.node, $5.byRef)
+ {
+ switch n := $7.(type) {
+ case *stmt.Foreach :
+ n.Expr = $3
+ n.Variable = $5
+ case *stmt.AltForeach :
+ n.Expr = $3
+ n.Variable = $5
+ }
+
+ $$ = $7
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $7))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.ForeachToken)
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.OpenParenthesisToken)
+ yylex.(*Parser).comments.AddFromToken($$, $4, comment.AsToken)
+ yylex.(*Parser).comments.AddFromToken($$, $6, comment.CloseParenthesisToken)
}
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $7.node))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
- }
| T_FOREACH '(' expr T_AS variable T_DOUBLE_ARROW foreach_variable ')' foreach_statement
- {
- if ($9.isAlt) {
- $$ = stmt.NewAltForeach($3, $5, $7.node, $9.node, $7.byRef)
- } else {
- $$ = stmt.NewForeach($3, $5, $7.node, $9.node, $7.byRef)
+ {
+ switch n := $9.(type) {
+ case *stmt.Foreach :
+ n.Expr = $3
+ n.Key = $5
+ n.Variable = $7
+ case *stmt.AltForeach :
+ n.Expr = $3
+ n.Key = $5
+ n.Variable = $7
+ }
+
+ $$ = $9
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $9))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.ForeachToken)
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.OpenParenthesisToken)
+ yylex.(*Parser).comments.AddFromToken($$, $4, comment.AsToken)
+ yylex.(*Parser).comments.AddFromToken($$, $6, comment.DoubleArrowToken)
+ yylex.(*Parser).comments.AddFromToken($$, $8, comment.CloseParenthesisToken)
}
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $9.node))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
- }
| T_DECLARE '(' const_list ')' declare_statement
- {
- $$ = stmt.NewDeclare($3, $5)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $5))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
- }
+ {
+ $$ = stmt.NewDeclare($3, $5)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $5))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.DeclareToken)
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.OpenParenthesisToken)
+ yylex.(*Parser).comments.AddFromToken($$, $4, comment.CloseParenthesisToken)
+ }
| ';'
- {
- $$ = stmt.NewNop()
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
- }
+ {
+ $$ = stmt.NewNop()
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.SemiColonToken)
+ }
| T_TRY '{' inner_statement_list '}' catch_list finally_statement
{
if $6 == nil {
@@ -676,1693 +1038,2870 @@ statement:
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $6))
}
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.TryToken)
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.OpenCurlyBracesToken)
+ yylex.(*Parser).comments.AddFromToken($$, $4, comment.CloseCurlyBracesToken)
}
| T_THROW expr ';'
- {
- $$ = stmt.NewThrow($2)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $3))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
- }
+ {
+ $$ = stmt.NewThrow($2)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $3))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.ThrowToken)
+ yylex.(*Parser).comments.AddFromToken($$, $3, comment.SemiColonToken)
+ }
| T_GOTO T_STRING ';'
- {
- label := node.NewIdentifier($2.Value)
- yylex.(*Parser).positions.AddPosition(label, yylex.(*Parser).positionBuilder.NewTokenPosition($2))
- $$ = stmt.NewGoto(label)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $3))
+ {
+ label := node.NewIdentifier($2.Value)
+ $$ = stmt.NewGoto(label)
- yylex.(*Parser).comments.AddComments(label, $2.Comments())
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
- }
+ // save position
+ yylex.(*Parser).positions.AddPosition(label, yylex.(*Parser).positionBuilder.NewTokenPosition($2))
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $3))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.GotoToken)
+ yylex.(*Parser).comments.AddFromToken(label, $2, comment.StringToken)
+ yylex.(*Parser).comments.AddFromToken($$, $3, comment.SemiColonToken)
+ }
| T_STRING ':'
- {
- label := node.NewIdentifier($1.Value)
- yylex.(*Parser).positions.AddPosition(label, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
- $$ = stmt.NewLabel(label)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $2))
+ {
+ label := node.NewIdentifier($1.Value)
+ $$ = stmt.NewLabel(label)
- yylex.(*Parser).comments.AddComments(label, $1.Comments())
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
- }
+ // save position
+ yylex.(*Parser).positions.AddPosition(label, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $2))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(label, $1, comment.StringToken)
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.ColonToken)
+ }
catch_list:
- /* empty */ { $$ = []node.Node{} }
+ /* empty */
+ { $$ = []node.Node{} }
| catch_list T_CATCH '(' catch_name_list T_VARIABLE ')' '{' inner_statement_list '}'
- {
- identifier := node.NewIdentifier(strings.TrimLeft($5.Value, "$"))
- yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition($5))
- variable := expr.NewVariable(identifier)
- yylex.(*Parser).positions.AddPosition(variable, yylex.(*Parser).positionBuilder.NewTokenPosition($5))
- catch := stmt.NewCatch($4, variable, $8)
- yylex.(*Parser).positions.AddPosition(catch, yylex.(*Parser).positionBuilder.NewTokensPosition($2, $9))
- $$ = append($1, catch)
+ {
+ identifier := node.NewIdentifier(strings.TrimLeft($5.Value, "$"))
+ variable := expr.NewVariable(identifier)
+ catch := stmt.NewCatch($4, variable, $8)
+ $$ = append($1, catch)
- yylex.(*Parser).comments.AddComments(identifier, $5.Comments())
- yylex.(*Parser).comments.AddComments(variable, $5.Comments())
- yylex.(*Parser).comments.AddComments(catch, $2.Comments())
- }
+ // save position
+ yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition($5))
+ yylex.(*Parser).positions.AddPosition(variable, yylex.(*Parser).positionBuilder.NewTokenPosition($5))
+ yylex.(*Parser).positions.AddPosition(catch, yylex.(*Parser).positionBuilder.NewTokensPosition($2, $9))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(catch, $2, comment.CatchToken)
+ yylex.(*Parser).comments.AddFromToken(catch, $3, comment.OpenParenthesisToken)
+ yylex.(*Parser).comments.AddFromToken(variable, $5, comment.StringToken)
+ yylex.(*Parser).comments.AddFromToken(catch, $6, comment.CloseParenthesisToken)
+ yylex.(*Parser).comments.AddFromToken(catch, $7, comment.OpenCurlyBracesToken)
+ yylex.(*Parser).comments.AddFromToken(catch, $9, comment.CloseCurlyBracesToken)
+ }
;
catch_name_list:
- name { $$ = []node.Node{$1} }
- | catch_name_list '|' name { $$ = append($1, $3) }
+ name
+ { $$ = []node.Node{$1} }
+ | catch_name_list '|' name
+ {
+ $$ = append($1, $3)
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(lastNode($1), $2, comment.VerticalBarToken)
+ }
;
finally_statement:
- /* empty */ { $$ = nil }
+ /* empty */
+ { $$ = nil }
| T_FINALLY '{' inner_statement_list '}'
- {
- $$ = stmt.NewFinally($3)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $4))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
- }
+ {
+ $$ = stmt.NewFinally($3)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $4))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.FinallyToken)
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.OpenCurlyBracesToken)
+ yylex.(*Parser).comments.AddFromToken($$, $4, comment.CloseCurlyBracesToken)
+ }
;
unset_variables:
- unset_variable { $$ = []node.Node{$1} }
- | unset_variables ',' unset_variable { $$ = append($1, $3) }
+ unset_variable
+ { $$ = []node.Node{$1} }
+ | unset_variables ',' unset_variable
+ {
+ $$ = append($1, $3)
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(lastNode($1), $2, comment.CommaToken)
+ }
;
unset_variable:
- variable { $$ = $1 }
+ variable
+ { $$ = $1 }
;
function_declaration_statement:
- T_FUNCTION returns_ref T_STRING backup_doc_comment '(' parameter_list ')' return_type '{' inner_statement_list '}'
- {
- name := node.NewIdentifier($3.Value)
- yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewTokenPosition($3))
- $$ = stmt.NewFunction(name, $2.value, $6, $8, $10, $4)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $11))
+ T_FUNCTION returns_ref T_STRING backup_doc_comment '(' parameter_list ')' return_type '{' inner_statement_list '}'
+ {
+ name := node.NewIdentifier($3.Value)
+ $$ = stmt.NewFunction(name, $2 != nil, $6, $8, $10, $4)
- yylex.(*Parser).comments.AddComments(name, $3.Comments())
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
- }
+ // save position
+ yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewTokenPosition($3))
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $11))
+
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.FunctionToken)
+ if $2 != nil {
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.AmpersandToken)
+ }
+ yylex.(*Parser).comments.AddFromToken(name, $3, comment.StringToken)
+ yylex.(*Parser).comments.AddFromToken($$, $5, comment.OpenParenthesisToken)
+ yylex.(*Parser).comments.AddFromToken($$, $7, comment.CloseParenthesisToken)
+ yylex.(*Parser).comments.AddFromToken($$, $9, comment.OpenCurlyBracesToken)
+ yylex.(*Parser).comments.AddFromToken($$, $11, comment.CloseCurlyBracesToken)
+ }
;
is_reference:
- /* empty */ { $$ = boolWithToken{false, nil} }
- | '&' { $$ = boolWithToken{true, &$1} }
+ /* empty */
+ { $$ = nil }
+ | '&'
+ { $$ = $1 }
;
is_variadic:
- /* empty */ { $$ = boolWithToken{false, nil} }
- | T_ELLIPSIS { $$ = boolWithToken{true, &$1} }
+ /* empty */
+ { $$ = nil }
+ | T_ELLIPSIS
+ { $$ = $1 }
;
class_declaration_statement:
class_modifiers T_CLASS T_STRING extends_from implements_list backup_doc_comment '{' class_statement_list '}'
- {
- name := node.NewIdentifier($3.Value)
- yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewTokenPosition($3))
- $$ = stmt.NewClass(name, $1, nil, $4, $5, $8, $6)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewOptionalListTokensPosition($1, $2, $9))
-
- yylex.(*Parser).comments.AddComments(name, $3.Comments())
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).listGetFirstNodeComments($1))
- }
- | T_CLASS T_STRING extends_from implements_list backup_doc_comment '{' class_statement_list '}'
- {
- name := node.NewIdentifier($2.Value)
- yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewTokenPosition($2))
- $$ = stmt.NewClass(name, nil, nil, $3, $4, $7, $5)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $8))
+ {
+ name := node.NewIdentifier($3.Value)
+ $$ = stmt.NewClass(name, $1, nil, $4, $5, $8, $6)
- yylex.(*Parser).comments.AddComments(name, $2.Comments())
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
- }
+ // save position
+ yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewTokenPosition($3))
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewOptionalListTokensPosition($1, $2, $9))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.ClassToken)
+ yylex.(*Parser).comments.AddFromToken(name, $3, comment.StringToken)
+ yylex.(*Parser).comments.AddFromToken($$, $7, comment.OpenCurlyBracesToken)
+ yylex.(*Parser).comments.AddFromToken($$, $9, comment.CloseCurlyBracesToken)
+ }
+ | T_CLASS T_STRING extends_from implements_list backup_doc_comment '{' class_statement_list '}'
+ {
+ name := node.NewIdentifier($2.Value)
+ $$ = stmt.NewClass(name, nil, nil, $3, $4, $7, $5)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewTokenPosition($2))
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $8))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.ClassToken)
+ yylex.(*Parser).comments.AddFromToken(name, $2, comment.StringToken)
+ yylex.(*Parser).comments.AddFromToken($$, $6, comment.OpenCurlyBracesToken)
+ yylex.(*Parser).comments.AddFromToken($$, $8, comment.CloseCurlyBracesToken)
+ }
;
class_modifiers:
- class_modifier { $$ = []node.Node{$1} }
- | class_modifiers class_modifier { $$ = append($1, $2) }
+ class_modifier
+ { $$ = []node.Node{$1} }
+ | class_modifiers class_modifier
+ { $$ = append($1, $2) }
;
class_modifier:
- T_ABSTRACT
- {
- $$ = node.NewIdentifier($1.Value)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
- }
+ T_ABSTRACT
+ {
+ $$ = node.NewIdentifier($1.Value)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.AbstractToken)
+ }
| T_FINAL
- {
- $$ = node.NewIdentifier($1.Value)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
- }
+ {
+ $$ = node.NewIdentifier($1.Value)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.FinalToken)
+ }
;
trait_declaration_statement:
- T_TRAIT T_STRING backup_doc_comment '{' class_statement_list '}'
- {
- name := node.NewIdentifier($2.Value)
- yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewTokenPosition($2))
- $$ = stmt.NewTrait(name, $5, $3)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $6))
+ T_TRAIT T_STRING backup_doc_comment '{' class_statement_list '}'
+ {
+ name := node.NewIdentifier($2.Value)
+ $$ = stmt.NewTrait(name, $5, $3)
- yylex.(*Parser).comments.AddComments(name, $2.Comments())
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
- }
+ // save position
+ yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewTokenPosition($2))
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $6))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.TraitToken)
+ yylex.(*Parser).comments.AddFromToken(name, $2, comment.StringToken)
+ yylex.(*Parser).comments.AddFromToken($$, $4, comment.OpenCurlyBracesToken)
+ yylex.(*Parser).comments.AddFromToken($$, $6, comment.CloseCurlyBracesToken)
+ }
;
interface_declaration_statement:
- T_INTERFACE T_STRING interface_extends_list backup_doc_comment '{' class_statement_list '}'
- {
- name := node.NewIdentifier($2.Value)
- yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewTokenPosition($2))
- $$ = stmt.NewInterface(name, $3, $6, $4)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $7))
-
- yylex.(*Parser).comments.AddComments(name, $2.Comments())
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
- }
+ T_INTERFACE T_STRING interface_extends_list backup_doc_comment '{' class_statement_list '}'
+ {
+ name := node.NewIdentifier($2.Value)
+ $$ = stmt.NewInterface(name, $3, $6, $4)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewTokenPosition($2))
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $7))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.InterfaceToken)
+ yylex.(*Parser).comments.AddFromToken(name, $2, comment.StringToken)
+ yylex.(*Parser).comments.AddFromToken($$, $5, comment.OpenCurlyBracesToken)
+ yylex.(*Parser).comments.AddFromToken($$, $7, comment.CloseCurlyBracesToken)
+ }
;
extends_from:
- /* empty */ { $$ = nil }
- | T_EXTENDS name { $$ = $2; }
+ /* empty */
+ { $$ = nil }
+ | T_EXTENDS name
+ {
+ $$ = stmt.NewClassExtends($2);
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $2))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.ExtendsToken)
+ }
;
interface_extends_list:
- /* empty */ { $$ = nil }
- | T_EXTENDS name_list { $$ = $2 }
+ /* empty */
+ { $$ = nil }
+ | T_EXTENDS name_list
+ {
+ $$ = stmt.NewInterfaceExtends($2);
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodeListPosition($1, $2))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.ExtendsToken)
+ }
;
implements_list:
- /* empty */ { $$ = nil }
- | T_IMPLEMENTS name_list { $$ = $2 }
+ /* empty */
+ { $$ = nil }
+ | T_IMPLEMENTS name_list
+ {
+ $$ = stmt.NewClassImplements($2);
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodeListPosition($1, $2))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.ImplementsToken)
+ }
;
foreach_variable:
- variable { $$ = foreachVariable{$1, false} }
- | '&' variable { $$ = foreachVariable{$2, true} }
+ variable
+ {
+ $$ = $1
+ }
+ | '&' variable
+ {
+ $$ = expr.NewReference($2)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($2, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $2))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.AmpersandToken)
+ }
| T_LIST '(' array_pair_list ')'
- {
- list := expr.NewList($3)
- yylex.(*Parser).positions.AddPosition(list, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $4))
- $$ = foreachVariable{list, false}
- yylex.(*Parser).comments.AddComments(list, $1.Comments())
- }
+ {
+ $$ = expr.NewList($3)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $4))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.ListToken)
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.OpenParenthesisToken)
+ yylex.(*Parser).comments.AddFromToken($$, $4, comment.CloseParenthesisToken)
+ }
| '[' array_pair_list ']'
- {
- list := expr.NewShortList($2)
- yylex.(*Parser).positions.AddPosition(list, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $3))
- $$ = foreachVariable{list, false}
- yylex.(*Parser).comments.AddComments(list, $1.Comments())
- }
+ {
+ $$ = expr.NewShortList($2)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $3))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.OpenSquareBracket)
+ yylex.(*Parser).comments.AddFromToken($$, $3, comment.CloseSquareBracket)
+ }
;
for_statement:
statement
- { $$ = altSyntaxNode{$1, false} }
+ {
+ $$ = stmt.NewFor(nil, nil, nil, $1)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodePosition($1))
+ }
| ':' inner_statement_list T_ENDFOR ';'
{
- $$ = altSyntaxNode{stmt.NewStmtList($2), true}
- yylex.(*Parser).positions.AddPosition($$.node, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $4))
+ stmtList := stmt.NewStmtList($2)
+ $$ = stmt.NewAltFor(nil, nil, nil, stmtList)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(stmtList, yylex.(*Parser).positionBuilder.NewNodeListPosition($2))
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $4))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.ColonToken)
+ yylex.(*Parser).comments.AddFromToken($$, $3, comment.EndforToken)
+ yylex.(*Parser).comments.AddFromToken($$, $4, comment.SemiColonToken)
}
;
foreach_statement:
statement
- { $$ = altSyntaxNode{$1, false} }
+ {
+ $$ = stmt.NewForeach(nil, nil, nil, $1)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodePosition($1))
+ }
| ':' inner_statement_list T_ENDFOREACH ';'
{
- $$ = altSyntaxNode{stmt.NewStmtList($2), true}
- yylex.(*Parser).positions.AddPosition($$.node, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $4))
+ stmtList := stmt.NewStmtList($2)
+ $$ = stmt.NewAltForeach(nil, nil, nil, stmtList)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(stmtList, yylex.(*Parser).positionBuilder.NewNodeListPosition($2))
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $4))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.ColonToken)
+ yylex.(*Parser).comments.AddFromToken($$, $3, comment.EndforeachToken)
+ yylex.(*Parser).comments.AddFromToken($$, $4, comment.SemiColonToken)
}
;
declare_statement:
- statement { $$ = $1; }
+ statement
+ { $$ = $1; }
| ':' inner_statement_list T_ENDDECLARE ';'
- {
- $$ = stmt.NewStmtList($2)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $4))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
- }
+ {
+ $$ = stmt.NewStmtList($2)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $4))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.ColonToken)
+ yylex.(*Parser).comments.AddFromToken($$, $3, comment.EnddeclareToken)
+ yylex.(*Parser).comments.AddFromToken($$, $4, comment.SemiColonToken)
+ }
;
switch_case_list:
- '{' case_list '}' { $$ = &nodesWithEndToken{$2, $3} }
- | '{' ';' case_list '}' { $$ = &nodesWithEndToken{$3, $4} }
- | ':' case_list T_ENDSWITCH ';' { $$ = &nodesWithEndToken{$2, $4} }
- | ':' ';' case_list T_ENDSWITCH ';' { $$ = &nodesWithEndToken{$3, $5} }
+ '{' case_list '}'
+ {
+ caseList := stmt.NewCaseList($2)
+ $$ = stmt.NewSwitch(nil, caseList)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(caseList, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $3))
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $3))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(caseList, $1, comment.OpenCurlyBracesToken)
+ yylex.(*Parser).comments.AddFromToken(caseList, $3, comment.CloseCurlyBracesToken)
+ }
+ | '{' ';' case_list '}'
+ {
+ caseList := stmt.NewCaseList($3)
+ $$ = stmt.NewSwitch(nil, caseList)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(caseList, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $4))
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $4))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(caseList, $1, comment.OpenCurlyBracesToken)
+ yylex.(*Parser).comments.AddFromToken(caseList, $2, comment.SemiColonToken)
+ yylex.(*Parser).comments.AddFromToken(caseList, $4, comment.CloseCurlyBracesToken)
+ }
+ | ':' case_list T_ENDSWITCH ';'
+ {
+ caseList := stmt.NewCaseList($2)
+ $$ = stmt.NewAltSwitch(nil, caseList)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(caseList, yylex.(*Parser).positionBuilder.NewNodeListPosition($2))
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $4))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(caseList, $1, comment.ColonToken)
+ yylex.(*Parser).comments.AddFromToken(caseList, $3, comment.EndswitchToken)
+ yylex.(*Parser).comments.AddFromToken($$, $4, comment.SemiColonToken)
+ }
+ | ':' ';' case_list T_ENDSWITCH ';'
+ {
+
+ caseList := stmt.NewCaseList($3)
+ $$ = stmt.NewAltSwitch(nil, caseList)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(caseList, yylex.(*Parser).positionBuilder.NewNodeListPosition($3))
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $5))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(caseList, $1, comment.ColonToken)
+ yylex.(*Parser).comments.AddFromToken(caseList, $2, comment.SemiColonToken)
+ yylex.(*Parser).comments.AddFromToken(caseList, $4, comment.EndswitchToken)
+ yylex.(*Parser).comments.AddFromToken($$, $5, comment.SemiColonToken)
+ }
;
case_list:
- /* empty */ { $$ = []node.Node{} }
+ /* empty */
+ { $$ = []node.Node{} }
| case_list T_CASE expr case_separator inner_statement_list
{
_case := stmt.NewCase($3, $5)
- yylex.(*Parser).positions.AddPosition(_case, yylex.(*Parser).positionBuilder.NewTokenNodeListPosition($2, $5))
$$ = append($1, _case)
- yylex.(*Parser).comments.AddComments(_case, $2.Comments())
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(_case, yylex.(*Parser).positionBuilder.NewTokenNodeListPosition($2, $5))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(_case, $2, comment.CaseToken)
+ yylex.(*Parser).comments.AddFromToken(_case, $4, comment.CaseSeparatorToken)
}
| case_list T_DEFAULT case_separator inner_statement_list
{
_default := stmt.NewDefault($4)
- yylex.(*Parser).positions.AddPosition(_default, yylex.(*Parser).positionBuilder.NewTokenNodeListPosition($2, $4))
$$ = append($1, _default)
- yylex.(*Parser).comments.AddComments(_default, $2.Comments())
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(_default, yylex.(*Parser).positionBuilder.NewTokenNodeListPosition($2, $4))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(_default, $2, comment.DefaultToken)
+ yylex.(*Parser).comments.AddFromToken(_default, $3, comment.CaseSeparatorToken)
}
;
case_separator:
':'
+ { $$ = $1 }
| ';'
+ { $$ = $1 }
;
while_statement:
statement
- { $$ = altSyntaxNode{$1, false} }
+ {
+ $$ = stmt.NewWhile(nil, $1)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodePosition($1))
+ }
| ':' inner_statement_list T_ENDWHILE ';'
{
- $$ = altSyntaxNode{stmt.NewStmtList($2), true}
- yylex.(*Parser).positions.AddPosition($$.node, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $4))
+ stmtList := stmt.NewStmtList($2)
+ $$ = stmt.NewAltWhile(nil, stmtList)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(stmtList, yylex.(*Parser).positionBuilder.NewNodeListPosition($2))
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $4))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.ColonToken)
+ yylex.(*Parser).comments.AddFromToken($$, $3, comment.EndwhileToken)
+ yylex.(*Parser).comments.AddFromToken($$, $4, comment.SemiColonToken)
}
;
if_stmt_without_else:
- T_IF '(' expr ')' statement
- {
- $$ = stmt.NewIf($3, $5, nil, nil)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $5))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
- }
- | if_stmt_without_else T_ELSEIF '(' expr ')' statement
- {
- _elseIf := stmt.NewElseIf($4, $6)
- yylex.(*Parser).positions.AddPosition(_elseIf, yylex.(*Parser).positionBuilder.NewTokenNodePosition($2, $6))
- $$ = $1.(*stmt.If).AddElseIf(_elseIf)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $6))
+ T_IF '(' expr ')' statement
+ {
+ $$ = stmt.NewIf($3, $5, nil, nil)
- yylex.(*Parser).comments.AddComments(_elseIf, $2.Comments())
- }
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $5))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.IfToken)
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.OpenParenthesisToken)
+ yylex.(*Parser).comments.AddFromToken($$, $4, comment.CloseParenthesisToken)
+ }
+ | if_stmt_without_else T_ELSEIF '(' expr ')' statement
+ {
+ _elseIf := stmt.NewElseIf($4, $6)
+ $$ = $1.(*stmt.If).AddElseIf(_elseIf)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(_elseIf, yylex.(*Parser).positionBuilder.NewTokenNodePosition($2, $6))
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $6))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(_elseIf, $2, comment.ElseifToken)
+ yylex.(*Parser).comments.AddFromToken(_elseIf, $3, comment.OpenParenthesisToken)
+ yylex.(*Parser).comments.AddFromToken(_elseIf, $5, comment.CloseParenthesisToken)
+ }
;
if_stmt:
- if_stmt_without_else %prec T_NOELSE { $$ = $1; }
+ if_stmt_without_else %prec T_NOELSE
+ { $$ = $1; }
| if_stmt_without_else T_ELSE statement
- {
- _else := stmt.NewElse($3)
- yylex.(*Parser).positions.AddPosition(_else, yylex.(*Parser).positionBuilder.NewTokenNodePosition($2, $3))
- $$ = $1.(*stmt.If).SetElse(_else)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3))
+ {
+ _else := stmt.NewElse($3)
+ $$ = $1.(*stmt.If).SetElse(_else)
- yylex.(*Parser).comments.AddComments($$, $2.Comments())
- }
+ // save position
+ yylex.(*Parser).positions.AddPosition(_else, yylex.(*Parser).positionBuilder.NewTokenNodePosition($2, $3))
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.ElseToken)
+ }
;
alt_if_stmt_without_else:
- T_IF '(' expr ')' ':' inner_statement_list
- {
- stmts := stmt.NewStmtList($6)
- yylex.(*Parser).positions.AddPosition(stmts, yylex.(*Parser).positionBuilder.NewNodeListPosition($6))
- $$ = stmt.NewAltIf($3, stmts, nil, nil)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodeListPosition($1, $6))
+ T_IF '(' expr ')' ':' inner_statement_list
+ {
+ stmts := stmt.NewStmtList($6)
+ $$ = stmt.NewAltIf($3, stmts, nil, nil)
- yylex.(*Parser).comments.AddComments(stmts, $5.Comments())
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
- }
+ // save position
+ yylex.(*Parser).positions.AddPosition(stmts, yylex.(*Parser).positionBuilder.NewNodeListPosition($6))
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodeListPosition($1, $6))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.IfToken)
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.OpenParenthesisToken)
+ yylex.(*Parser).comments.AddFromToken($$, $4, comment.CloseParenthesisToken)
+ yylex.(*Parser).comments.AddFromToken($$, $5, comment.ColonToken)
+ }
| alt_if_stmt_without_else T_ELSEIF '(' expr ')' ':' inner_statement_list
- {
- stmts := stmt.NewStmtList($7)
- yylex.(*Parser).positions.AddPosition(stmts, yylex.(*Parser).positionBuilder.NewNodeListPosition($7))
- _elseIf := stmt.NewAltElseIf($4, stmts)
- yylex.(*Parser).positions.AddPosition(_elseIf, yylex.(*Parser).positionBuilder.NewTokenNodeListPosition($2, $7))
- $$ = $1.(*stmt.AltIf).AddElseIf(_elseIf)
+ {
+ stmts := stmt.NewStmtList($7)
+ _elseIf := stmt.NewAltElseIf($4, stmts)
+ $$ = $1.(*stmt.AltIf).AddElseIf(_elseIf)
- yylex.(*Parser).comments.AddComments(stmts, $6.Comments())
- yylex.(*Parser).comments.AddComments(_elseIf, $2.Comments())
- }
+ // save position
+ yylex.(*Parser).positions.AddPosition(stmts, yylex.(*Parser).positionBuilder.NewNodeListPosition($7))
+ yylex.(*Parser).positions.AddPosition(_elseIf, yylex.(*Parser).positionBuilder.NewTokenNodeListPosition($2, $7))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(_elseIf, $2, comment.ElseifToken)
+ yylex.(*Parser).comments.AddFromToken(_elseIf, $3, comment.OpenParenthesisToken)
+ yylex.(*Parser).comments.AddFromToken(_elseIf, $5, comment.CloseParenthesisToken)
+ yylex.(*Parser).comments.AddFromToken(_elseIf, $6, comment.ColonToken)
+ }
;
alt_if_stmt:
- alt_if_stmt_without_else T_ENDIF ';'
- {
- $$ = $1
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodeTokenPosition($1, $3))
- }
- | alt_if_stmt_without_else T_ELSE ':' inner_statement_list T_ENDIF ';'
- {
- stmts := stmt.NewStmtList($4)
- yylex.(*Parser).positions.AddPosition(stmts, yylex.(*Parser).positionBuilder.NewNodeListPosition($4))
- _else := stmt.NewAltElse(stmts)
- yylex.(*Parser).positions.AddPosition(_else, yylex.(*Parser).positionBuilder.NewTokenNodeListPosition($2, $4))
- $$ = $1.(*stmt.AltIf).SetElse(_else)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodeTokenPosition($1, $6))
+ alt_if_stmt_without_else T_ENDIF ';'
+ {
+ $$ = $1
- yylex.(*Parser).comments.AddComments(stmts, $3.Comments())
- yylex.(*Parser).comments.AddComments(_else, $2.Comments())
- }
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodeTokenPosition($1, $3))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.EndifToken)
+ yylex.(*Parser).comments.AddFromToken($$, $3, comment.SemiColonToken)
+ }
+ | alt_if_stmt_without_else T_ELSE ':' inner_statement_list T_ENDIF ';'
+ {
+ stmts := stmt.NewStmtList($4)
+ _else := stmt.NewAltElse(stmts)
+ $$ = $1.(*stmt.AltIf).SetElse(_else)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(stmts, yylex.(*Parser).positionBuilder.NewNodeListPosition($4))
+ yylex.(*Parser).positions.AddPosition(_else, yylex.(*Parser).positionBuilder.NewTokenNodeListPosition($2, $4))
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodeTokenPosition($1, $6))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(_else, $2, comment.ElseToken)
+ yylex.(*Parser).comments.AddFromToken(_else, $3, comment.ColonToken)
+ yylex.(*Parser).comments.AddFromToken($$, $5, comment.EndifToken)
+ yylex.(*Parser).comments.AddFromToken($$, $6, comment.SemiColonToken)
+ }
;
parameter_list:
- non_empty_parameter_list { $$ = $1; }
- | /* empty */ { $$ = nil }
+ non_empty_parameter_list
+ { $$ = $1; }
+ | /* empty */
+ { $$ = nil }
;
non_empty_parameter_list:
- parameter { $$ = []node.Node{$1} }
- | non_empty_parameter_list ',' parameter { $$ = append($1, $3) }
+ parameter
+ { $$ = []node.Node{$1} }
+ | non_empty_parameter_list ',' parameter
+ {
+ $$ = append($1, $3)
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(lastNode($1), $2, comment.CommaToken)
+ }
;
parameter:
- optional_type is_reference is_variadic T_VARIABLE
- {
- identifier := node.NewIdentifier(strings.TrimLeft($4.Value, "$"))
- yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition($4))
- variable := expr.NewVariable(identifier)
- yylex.(*Parser).positions.AddPosition(variable, yylex.(*Parser).positionBuilder.NewTokenPosition($4))
+ optional_type is_reference is_variadic T_VARIABLE
+ {
+ identifier := node.NewIdentifier(strings.TrimLeft($4.Value, "$"))
+ variable := expr.NewVariable(identifier)
+ $$ = node.NewParameter($1, variable, nil, $2 != nil, $3 != nil)
- yylex.(*Parser).comments.AddComments($$, $4.Comments())
- yylex.(*Parser).comments.AddComments($$, $4.Comments())
-
- if $1 != nil {
- $$ = node.NewParameter($1, variable, nil, $2.value, $3.value)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodeTokenPosition($1, $4))
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1])
- } else if $2.value == true {
- $$ = node.NewParameter($1, variable, nil, $2.value, $3.value)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition(*$2.token, $4))
- yylex.(*Parser).comments.AddComments($$, $2.token.Comments())
- } else if $3.value == true {
- $$ = node.NewParameter($1, variable, nil, $2.value, $3.value)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition(*$3.token, $4))
- yylex.(*Parser).comments.AddComments($$, $3.token.Comments())
- } else {
- $$ = node.NewParameter($1, variable, nil, $2.value, $3.value)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenPosition($4))
- yylex.(*Parser).comments.AddComments($$, $4.Comments())
+ // save position
+ yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition($4))
+ yylex.(*Parser).positions.AddPosition(variable, yylex.(*Parser).positionBuilder.NewTokenPosition($4))
+ if $1 != nil {
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodeTokenPosition($1, $4))
+ } else if $2 != nil {
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($2, $4))
+ } else if $3 != nil {
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($3, $4))
+ } else {
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenPosition($4))
+ }
+
+ // save comments
+ if $2 != nil {
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.AmpersandToken)
+ }
+ if $3 != nil {
+ yylex.(*Parser).comments.AddFromToken($$, $3, comment.EllipsisToken)
+ }
+ yylex.(*Parser).comments.AddFromToken(variable, $4, comment.VariableToken)
}
- }
| optional_type is_reference is_variadic T_VARIABLE '=' expr
- {
- identifier := node.NewIdentifier(strings.TrimLeft($4.Value, "$"))
- yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition($4))
- variable := expr.NewVariable(identifier)
- yylex.(*Parser).positions.AddPosition(variable, yylex.(*Parser).positionBuilder.NewTokenPosition($4))
+ {
+ identifier := node.NewIdentifier(strings.TrimLeft($4.Value, "$"))
+ variable := expr.NewVariable(identifier)
+ $$ = node.NewParameter($1, variable, $6, $2 != nil, $3 != nil)
- yylex.(*Parser).comments.AddComments($$, $4.Comments())
- yylex.(*Parser).comments.AddComments($$, $4.Comments())
+ // save position
+ yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition($4))
+ yylex.(*Parser).positions.AddPosition(variable, yylex.(*Parser).positionBuilder.NewTokenPosition($4))
+ if $1 != nil {
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $6))
+ } else if $2 != nil {
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($2, $6))
+ } else if $3 != nil {
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($3, $6))
+ } else {
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($4, $6))
+ }
- if $1 != nil {
- $$ = node.NewParameter($1, variable, $6, $2.value, $3.value)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $6))
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1])
- } else if $2.value == true {
- $$ = node.NewParameter($1, variable, $6, $2.value, $3.value)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition(*$2.token, $6))
- yylex.(*Parser).comments.AddComments($$, $2.token.Comments())
- } else if $3.value == true {
- $$ = node.NewParameter($1, variable, $6, $2.value, $3.value)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition(*$3.token, $6))
- yylex.(*Parser).comments.AddComments($$, $3.token.Comments())
- } else {
- $$ = node.NewParameter($1, variable, $6, $2.value, $3.value)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($4, $6))
- yylex.(*Parser).comments.AddComments($$, $4.Comments())
+ // save comments
+ if $2 != nil {
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.AmpersandToken)
+ }
+ if $3 != nil {
+ yylex.(*Parser).comments.AddFromToken($$, $3, comment.EllipsisToken)
+ }
+ yylex.(*Parser).comments.AddFromToken(variable, $4, comment.VariableToken)
+ yylex.(*Parser).comments.AddFromToken($$, $5, comment.EqualToken)
}
- }
;
optional_type:
- /* empty */ { $$ = nil }
- | type_expr { $$ = $1; }
+ /* empty */
+ { $$ = nil }
+ | type_expr
+ { $$ = $1; }
;
type_expr:
- type { $$ = $1; }
+ type
+ { $$ = $1; }
| '?' type
- {
- $$ = node.NewNullable($2)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $2))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
- }
+ {
+ $$ = node.NewNullable($2)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $2))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.QuestionMarkToken)
+ }
;
type:
- T_ARRAY
- {
- $$ = node.NewIdentifier($1.Value)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
- }
+ T_ARRAY
+ {
+ $$ = node.NewIdentifier($1.Value)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.ArrayToken)
+ }
| T_CALLABLE
- {
- $$ = node.NewIdentifier($1.Value)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
- }
- | name { $$ = $1; }
+ {
+ $$ = node.NewIdentifier($1.Value)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.CallableToken)
+ }
+ | name
+ { $$ = $1; }
;
return_type:
- /* empty */ { $$ = nil }
- | ':' type_expr { $$ = $2; }
+ /* empty */
+ { $$ = nil }
+ | ':' type_expr
+ {
+ $$ = $2;
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.ColonToken)
+ }
;
argument_list:
- '(' ')' { $$ = &nodesWithEndToken{[]node.Node{}, $2} }
- | '(' non_empty_argument_list possible_comma ')' { $$ = &nodesWithEndToken{$2, $4} }
+ '(' ')'
+ {
+ $$ = node.NewArgumentList(nil)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $2))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.OpenParenthesisToken)
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.CloseParenthesisToken)
+ }
+ | '(' non_empty_argument_list possible_comma ')'
+ {
+ $$ = node.NewArgumentList($2)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $4))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.OpenParenthesisToken)
+ if $3 != nil {
+ yylex.(*Parser).comments.AddFromToken($$, $3, comment.CommaToken)
+ }
+ yylex.(*Parser).comments.AddFromToken($$, $4, comment.CloseParenthesisToken)
+ }
;
non_empty_argument_list:
- argument { $$ = []node.Node{$1} }
- | non_empty_argument_list ',' argument { $$ = append($1, $3) }
+ argument
+ { $$ = []node.Node{$1} }
+ | non_empty_argument_list ',' argument
+ {
+ $$ = append($1, $3)
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(lastNode($1), $2, comment.CommaToken)
+ }
;
argument:
- expr
- {
- $$ = node.NewArgument($1, false, false)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodePosition($1))
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1])
- }
+ expr
+ {
+ $$ = node.NewArgument($1, false, false)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodePosition($1))
+ }
| T_ELLIPSIS expr
- {
- $$ = node.NewArgument($2, true, false)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $2))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
- }
+ {
+ $$ = node.NewArgument($2, true, false)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $2))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.EllipsisToken)
+ }
;
global_var_list:
- global_var_list ',' global_var { $$ = append($1, $3); }
- | global_var { $$ = []node.Node{$1} }
+ global_var_list ',' global_var
+ {
+ $$ = append($1, $3)
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(lastNode($1), $2, comment.CommaToken)
+ }
+ | global_var
+ { $$ = []node.Node{$1} }
;
global_var:
- simple_variable { $$ = $1 }
+ simple_variable
+ { $$ = $1 }
;
static_var_list:
- static_var_list ',' static_var { $$ = append($1, $3) }
- | static_var { $$ = []node.Node{$1} }
+ static_var_list ',' static_var
+ {
+ $$ = append($1, $3)
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(lastNode($1), $2, comment.CommaToken)
+ }
+ | static_var
+ { $$ = []node.Node{$1} }
;
static_var:
T_VARIABLE
{
identifier := node.NewIdentifier(strings.TrimLeft($1.Value, "$"))
- yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
variable := expr.NewVariable(identifier)
- yylex.(*Parser).positions.AddPosition(variable, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
$$ = stmt.NewStaticVar(variable, nil)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
+ yylex.(*Parser).positions.AddPosition(variable, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
- yylex.(*Parser).comments.AddComments(identifier, $1.Comments())
- yylex.(*Parser).comments.AddComments(variable, $1.Comments())
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(variable, $1, comment.VariableToken)
}
| T_VARIABLE '=' expr
- {
- identifier := node.NewIdentifier(strings.TrimLeft($1.Value, "$"))
- yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
- variable := expr.NewVariable(identifier)
- yylex.(*Parser).positions.AddPosition(variable, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
- $$ = stmt.NewStaticVar(variable, $3)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $3))
+ {
+ identifier := node.NewIdentifier(strings.TrimLeft($1.Value, "$"))
+ variable := expr.NewVariable(identifier)
+ $$ = stmt.NewStaticVar(variable, $3)
- yylex.(*Parser).comments.AddComments(identifier, $1.Comments())
- yylex.(*Parser).comments.AddComments(variable, $1.Comments())
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
- }
+ // save position
+ yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
+ yylex.(*Parser).positions.AddPosition(variable, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $3))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(variable, $1, comment.VariableToken)
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.EqualToken)
+ }
;
class_statement_list:
- class_statement_list class_statement { $$ = append($1, $2) }
- | /* empty */ { $$ = []node.Node{} }
+ class_statement_list class_statement
+ { $$ = append($1, $2) }
+ | /* empty */
+ { $$ = []node.Node{} }
;
class_statement:
- variable_modifiers property_list ';'
- {
- $$ = stmt.NewPropertyList($1, $2)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodeListTokenPosition($1, $3))
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).listGetFirstNodeComments($1))
- }
+ variable_modifiers property_list ';'
+ {
+ $$ = stmt.NewPropertyList($1, $2)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodeListTokenPosition($1, $3))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $3, comment.SemiColonToken)
+ }
| method_modifiers T_CONST class_const_list ';'
- {
- $$ = stmt.NewClassConstList($1, $3)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewOptionalListTokensPosition($1, $2, $4))
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).listGetFirstNodeComments($1))
- }
+ {
+ $$ = stmt.NewClassConstList($1, $3)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewOptionalListTokensPosition($1, $2, $4))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.ConstToken)
+ yylex.(*Parser).comments.AddFromToken($$, $4, comment.SemiColonToken)
+ }
| T_USE name_list trait_adaptations
- {
- $$ = stmt.NewTraitUse($2, $3.nodes)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $3.endToken))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
- }
+ {
+ var adaptationList *stmt.TraitAdaptationList
+
+ switch n := $3.(type) {
+ case *stmt.TraitAdaptationList:
+ adaptationList = n
+ default:
+ adaptationList = nil
+ yylex.(*Parser).comments.AddFromChildNode($$, $3)
+ }
+
+ $$ = stmt.NewTraitUse($2, adaptationList)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $3))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.UseToken)
+ }
| method_modifiers T_FUNCTION returns_ref identifier backup_doc_comment '(' parameter_list ')' return_type method_body
{
name := node.NewIdentifier($4.Value)
+ $$ = stmt.NewClassMethod(name, $1, $3 != nil, $7, $9, $10, $5)
+
+ // save position
yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewTokenPosition($4))
- $$ = stmt.NewClassMethod(name, $1, $3.value, $7, $9, $10.nodes, $5)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewOptionalListTokensPosition($1, $2, $10.endToken))
-
- yylex.(*Parser).comments.AddComments(name, $4.Comments())
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).listGetFirstNodeComments($1))
+ if $1 == nil {
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($2, $10))
+ } else {
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodeListNodePosition($1, $10))
+ }
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.FunctionToken)
+ if $3 != nil {
+ yylex.(*Parser).comments.AddFromToken($$, $3, comment.AmpersandToken)
+ }
+ yylex.(*Parser).comments.AddFromToken(name, $4, comment.IdentifierToken)
+ yylex.(*Parser).comments.AddFromToken($$, $6, comment.OpenParenthesisToken)
+ yylex.(*Parser).comments.AddFromToken($$, $8, comment.CloseParenthesisToken)
}
;
name_list:
- name { $$ = []node.Node{$1} }
- | name_list ',' name { $$ = append($1, $3) }
+ name
+ { $$ = []node.Node{$1} }
+ | name_list ',' name
+ {
+ $$ = append($1, $3)
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(lastNode($1), $2, comment.CommaToken)
+ }
;
trait_adaptations:
- ';' { $$ = &nodesWithEndToken{nil, $1} }
- | '{' '}' { $$ = &nodesWithEndToken{nil, $2} }
- | '{' trait_adaptation_list '}' { $$ = &nodesWithEndToken{$2, $3} }
+ ';'
+ {
+ $$ = stmt.NewNop()
+
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.SemiColonToken)
+
+ }
+ | '{' '}'
+ {
+ $$ = stmt.NewTraitAdaptationList(nil)
+
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $2))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.OpenCurlyBracesToken)
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.CloseCurlyBracesToken)
+ }
+ | '{' trait_adaptation_list '}'
+ {
+ $$ = stmt.NewTraitAdaptationList($2)
+
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $3))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.OpenCurlyBracesToken)
+ yylex.(*Parser).comments.AddFromToken($$, $3, comment.CloseCurlyBracesToken)
+ }
;
trait_adaptation_list:
- trait_adaptation { $$ = []node.Node{$1} }
- | trait_adaptation_list trait_adaptation { $$ = append($1, $2) }
+ trait_adaptation
+ { $$ = []node.Node{$1} }
+ | trait_adaptation_list trait_adaptation
+ { $$ = append($1, $2) }
;
trait_adaptation:
- trait_precedence ';' { $$ = $1; }
- | trait_alias ';' { $$ = $1; }
+ trait_precedence ';'
+ {
+ $$ = $1;
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.SemiColonToken)
+ }
+ | trait_alias ';'
+ {
+ $$ = $1;
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.SemiColonToken)
+ }
;
trait_precedence:
- absolute_trait_method_reference T_INSTEADOF name_list
- {
- $$ = stmt.NewTraitUsePrecedence($1, $3)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodeNodeListPosition($1, $3))
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1])
- }
+ absolute_trait_method_reference T_INSTEADOF name_list
+ {
+ $$ = stmt.NewTraitUsePrecedence($1, $3)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodeNodeListPosition($1, $3))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.InsteadofToken)
+ }
;
trait_alias:
- trait_method_reference T_AS T_STRING
- {
- alias := node.NewIdentifier($3.Value)
- yylex.(*Parser).positions.AddPosition(alias, yylex.(*Parser).positionBuilder.NewTokenPosition($3))
- $$ = stmt.NewTraitUseAlias($1, nil, alias)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodeTokenPosition($1, $3))
-
- yylex.(*Parser).comments.AddComments(alias, $3.Comments())
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1])
- }
+ trait_method_reference T_AS T_STRING
+ {
+ alias := node.NewIdentifier($3.Value)
+ $$ = stmt.NewTraitUseAlias($1, nil, alias)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(alias, yylex.(*Parser).positionBuilder.NewTokenPosition($3))
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodeTokenPosition($1, $3))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.AsToken)
+ yylex.(*Parser).comments.AddFromToken(alias, $3, comment.StringToken)
+ }
| trait_method_reference T_AS reserved_non_modifiers
- {
- alias := node.NewIdentifier($3.Value)
- yylex.(*Parser).positions.AddPosition(alias, yylex.(*Parser).positionBuilder.NewTokenPosition($3))
- $$ = stmt.NewTraitUseAlias($1, nil, alias)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodeTokenPosition($1, $3))
-
- yylex.(*Parser).comments.AddComments(alias, $3.Comments())
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1])
- }
+ {
+ alias := node.NewIdentifier($3.Value)
+ $$ = stmt.NewTraitUseAlias($1, nil, alias)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(alias, yylex.(*Parser).positionBuilder.NewTokenPosition($3))
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodeTokenPosition($1, $3))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.AsToken)
+ yylex.(*Parser).comments.AddFromToken(alias, $3, comment.StringToken)
+ }
| trait_method_reference T_AS member_modifier identifier
- {
- alias := node.NewIdentifier($4.Value)
- yylex.(*Parser).positions.AddPosition(alias, yylex.(*Parser).positionBuilder.NewTokenPosition($4))
- $$ = stmt.NewTraitUseAlias($1, $3, alias)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodeTokenPosition($1, $4))
-
- yylex.(*Parser).comments.AddComments(alias, $4.Comments())
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1])
- }
+ {
+ alias := node.NewIdentifier($4.Value)
+ $$ = stmt.NewTraitUseAlias($1, $3, alias)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(alias, yylex.(*Parser).positionBuilder.NewTokenPosition($4))
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodeTokenPosition($1, $4))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.AsToken)
+ yylex.(*Parser).comments.AddFromToken(alias, $4, comment.IdentifierToken)
+ }
| trait_method_reference T_AS member_modifier
- {
- $$ = stmt.NewTraitUseAlias($1, $3, nil)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3))
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1])
- }
+ {
+ $$ = stmt.NewTraitUseAlias($1, $3, nil)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.AsToken)
+ }
;
trait_method_reference:
- identifier
- {
- name := node.NewIdentifier($1.Value)
- yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
- $$ = stmt.NewTraitMethodRef(nil, name)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
-
- yylex.(*Parser).comments.AddComments(name, $1.Comments())
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
- }
- | absolute_trait_method_reference { $$ = $1; }
+ identifier
+ {
+ name := node.NewIdentifier($1.Value)
+ $$ = stmt.NewTraitMethodRef(nil, name)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(name, $1, comment.IdentifierToken)
+ }
+ | absolute_trait_method_reference
+ { $$ = $1; }
;
absolute_trait_method_reference:
- name T_PAAMAYIM_NEKUDOTAYIM identifier
- {
- target := node.NewIdentifier($3.Value)
- yylex.(*Parser).positions.AddPosition(target, yylex.(*Parser).positionBuilder.NewTokenPosition($3))
- $$ = stmt.NewTraitMethodRef($1, target)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodeTokenPosition($1, $3))
-
- yylex.(*Parser).comments.AddComments(target, $3.Comments())
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1])
- }
+ name T_PAAMAYIM_NEKUDOTAYIM identifier
+ {
+ target := node.NewIdentifier($3.Value)
+ $$ = stmt.NewTraitMethodRef($1, target)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(target, yylex.(*Parser).positionBuilder.NewTokenPosition($3))
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodeTokenPosition($1, $3))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.PaamayimNekudotayimToken)
+ yylex.(*Parser).comments.AddFromToken(target, $3, comment.IdentifierToken)
+ }
;
method_body:
- ';' /* abstract method */ { $$ = &nodesWithEndToken{nil, $1} }
- | '{' inner_statement_list '}' { $$ = &nodesWithEndToken{$2, $3} }
+ ';' /* abstract method */
+ {
+ $$ = stmt.NewNop()
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.SemiColonToken)
+ }
+ | '{' inner_statement_list '}'
+ {
+ $$ = stmt.NewStmtList($2)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $3))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.OpenCurlyBracesToken)
+ yylex.(*Parser).comments.AddFromToken($$, $3, comment.CloseCurlyBracesToken)
+ }
;
variable_modifiers:
- non_empty_member_modifiers { $$ = $1; }
+ non_empty_member_modifiers
+ { $$ = $1; }
| T_VAR
- {
- modifier := node.NewIdentifier($1.Value)
- yylex.(*Parser).positions.AddPosition(modifier, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
- $$ = []node.Node{modifier}
- yylex.(*Parser).comments.AddComments(modifier, $1.Comments())
- }
+ {
+ modifier := node.NewIdentifier($1.Value)
+ $$ = []node.Node{modifier}
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(modifier, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(modifier, $1, comment.VarToken)
+ }
;
method_modifiers:
- /* empty */ { $$ = nil }
- | non_empty_member_modifiers { $$ = $1 }
+ /* empty */
+ { $$ = nil }
+ | non_empty_member_modifiers
+ { $$ = $1 }
;
non_empty_member_modifiers:
- member_modifier { $$ = []node.Node{$1} }
- | non_empty_member_modifiers member_modifier { $$ = append($1, $2) }
+ member_modifier
+ { $$ = []node.Node{$1} }
+ | non_empty_member_modifiers member_modifier
+ { $$ = append($1, $2) }
;
member_modifier:
- T_PUBLIC
- {
- $$ = node.NewIdentifier($1.Value)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
- }
+ T_PUBLIC
+ {
+ $$ = node.NewIdentifier($1.Value)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.PublicToken)
+ }
| T_PROTECTED
- {
- $$ = node.NewIdentifier($1.Value)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
- }
+ {
+ $$ = node.NewIdentifier($1.Value)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.ProtectedToken)
+ }
| T_PRIVATE
- {
- $$ = node.NewIdentifier($1.Value)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
- }
+ {
+ $$ = node.NewIdentifier($1.Value)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.PrivateToken)
+ }
| T_STATIC
- {
- $$ = node.NewIdentifier($1.Value)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
- }
+ {
+ $$ = node.NewIdentifier($1.Value)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.StaticToken)
+ }
| T_ABSTRACT
- {
- $$ = node.NewIdentifier($1.Value)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
- }
+ {
+ $$ = node.NewIdentifier($1.Value)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.AbstractToken)
+ }
| T_FINAL
- {
- $$ = node.NewIdentifier($1.Value)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
- }
+ {
+ $$ = node.NewIdentifier($1.Value)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.FinalToken)
+ }
;
property_list:
- property_list ',' property { $$ = append($1, $3) }
- | property { $$ = []node.Node{$1} }
+ property_list ',' property
+ {
+ $$ = append($1, $3)
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(lastNode($1), $2, comment.CommaToken)
+ }
+ | property
+ { $$ = []node.Node{$1} }
;
property:
- T_VARIABLE backup_doc_comment
- {
- identifier := node.NewIdentifier(strings.TrimLeft($1.Value, "$"))
- yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
- variable := expr.NewVariable(identifier)
- yylex.(*Parser).positions.AddPosition(variable, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
- $$ = stmt.NewProperty(variable, nil, $2)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
+ T_VARIABLE backup_doc_comment
+ {
+ identifier := node.NewIdentifier(strings.TrimLeft($1.Value, "$"))
+ variable := expr.NewVariable(identifier)
+ $$ = stmt.NewProperty(variable, nil, $2)
- yylex.(*Parser).comments.AddComments(identifier, $1.Comments())
- yylex.(*Parser).comments.AddComments(variable, $1.Comments())
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
- }
+ // save position
+ yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
+ yylex.(*Parser).positions.AddPosition(variable, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(variable, $1, comment.VariableToken)
+ }
| T_VARIABLE '=' expr backup_doc_comment
- {
- identifier := node.NewIdentifier(strings.TrimLeft($1.Value, "$"))
- yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
- variable := expr.NewVariable(identifier)
- yylex.(*Parser).positions.AddPosition(variable, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
- $$ = stmt.NewProperty(variable, $3, $4)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $3))
+ {
+ identifier := node.NewIdentifier(strings.TrimLeft($1.Value, "$"))
+ variable := expr.NewVariable(identifier)
+ $$ = stmt.NewProperty(variable, $3, $4)
- yylex.(*Parser).comments.AddComments(identifier, $1.Comments())
- yylex.(*Parser).comments.AddComments(variable, $1.Comments())
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
- }
+ // save position
+ yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
+ yylex.(*Parser).positions.AddPosition(variable, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $3))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(variable, $1, comment.VariableToken)
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.EqualToken)
+ }
;
class_const_list:
- class_const_list ',' class_const_decl { $$ = append($1, $3) }
- | class_const_decl { $$ = []node.Node{$1} }
+ class_const_list ',' class_const_decl
+ {
+ $$ = append($1, $3)
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(lastNode($1), $2, comment.CommaToken)
+ }
+ | class_const_decl
+ { $$ = []node.Node{$1} }
;
class_const_decl:
- identifier '=' expr backup_doc_comment
- {
- name := node.NewIdentifier($1.Value)
- yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
- $$ = stmt.NewConstant(name, $3, $4)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $3))
+ identifier '=' expr backup_doc_comment
+ {
+ name := node.NewIdentifier($1.Value)
+ $$ = stmt.NewConstant(name, $3, $4)
- yylex.(*Parser).comments.AddComments(name, $1.Comments())
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
- }
+ // save position
+ yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $3))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(name, $1, comment.IdentifierToken)
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.EqualToken)
+ }
;
const_decl:
- T_STRING '=' expr backup_doc_comment
- {
- name := node.NewIdentifier($1.Value)
- yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
- $$ = stmt.NewConstant(name, $3, $4)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $3))
+ T_STRING '=' expr backup_doc_comment
+ {
+ name := node.NewIdentifier($1.Value)
+ $$ = stmt.NewConstant(name, $3, $4)
- yylex.(*Parser).comments.AddComments(name, $1.Comments())
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
- }
+ // save position
+ yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $3))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(name, $1, comment.StringToken)
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.EqualToken)
+ }
;
echo_expr_list:
- echo_expr_list ',' echo_expr { $$ = append($1, $3) }
- | echo_expr { $$ = []node.Node{$1} }
+ echo_expr_list ',' echo_expr
+ {
+ $$ = append($1, $3)
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(lastNode($1), $2, comment.CommaToken)
+ }
+ | echo_expr
+ { $$ = []node.Node{$1} }
;
echo_expr:
- expr { $$ = $1 }
+ expr
+ { $$ = $1 }
;
for_exprs:
- /* empty */ { $$ = nil; }
- | non_empty_for_exprs { $$ = $1; }
+ /* empty */
+ { $$ = nil; }
+ | non_empty_for_exprs
+ { $$ = $1; }
;
+
non_empty_for_exprs:
- non_empty_for_exprs ',' expr { $$ = append($1, $3) }
- | expr { $$ = []node.Node{$1} }
+ non_empty_for_exprs ',' expr
+ {
+ $$ = append($1, $3)
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(lastNode($1), $2, comment.CommaToken)
+ }
+ | expr
+ { $$ = []node.Node{$1} }
;
anonymous_class:
- T_CLASS ctor_arguments extends_from implements_list backup_doc_comment '{' class_statement_list '}'
- {
- if $2 != nil {
- $$ = stmt.NewClass(nil, nil, $2.nodes, $3, $4, $7, $5)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $8))
- } else {
- $$ = stmt.NewClass(nil, nil, nil, $3, $4, $7, $5)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $8))
- }
+ T_CLASS ctor_arguments extends_from implements_list backup_doc_comment '{' class_statement_list '}'
+ {
+ if $2 != nil {
+ $$ = stmt.NewClass(nil, nil, $2.(*node.ArgumentList), $3, $4, $7, $5)
+ } else {
+ $$ = stmt.NewClass(nil, nil, nil, $3, $4, $7, $5)
+ }
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
- }
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $8))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.ClassToken)
+ yylex.(*Parser).comments.AddFromToken($$, $6, comment.OpenCurlyBracesToken)
+ yylex.(*Parser).comments.AddFromToken($$, $8, comment.CloseCurlyBracesToken)
+ }
;
new_expr:
- T_NEW class_name_reference ctor_arguments
- {
- if $3 != nil {
- $$ = expr.NewNew($2, $3.nodes)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $3.endToken))
- } else {
- $$ = expr.NewNew($2, nil)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $2))
- }
+ T_NEW class_name_reference ctor_arguments
+ {
+ if $3 != nil {
+ $$ = expr.NewNew($2, $3.(*node.ArgumentList))
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $3))
+ } else {
+ $$ = expr.NewNew($2, nil)
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $2))
+ }
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
- }
- | T_NEW anonymous_class { $$ = expr.NewNew($2, nil) }
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.NewToken)
+ }
+ | T_NEW anonymous_class
+ {
+ $$ = expr.NewNew($2, nil)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $2))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.NewToken)
+ }
;
expr_without_variable:
- T_LIST '(' array_pair_list ')' '=' expr
- {
- list := expr.NewList($3)
- yylex.(*Parser).positions.AddPosition(list, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $4))
- $$ = assign.NewAssign(list, $6)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $6))
+ T_LIST '(' array_pair_list ')' '=' expr
+ {
+ list := expr.NewList($3)
+ $$ = assign.NewAssign(list, $6)
- yylex.(*Parser).comments.AddComments(list, $1.Comments())
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
- }
- | '[' array_pair_list ']' '=' expr
- {
- shortList := expr.NewShortList($2)
- yylex.(*Parser).positions.AddPosition(shortList, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $3))
- $$ = assign.NewAssign(shortList, $5)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $5))
+ // save position
+ yylex.(*Parser).positions.AddPosition(list, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $4))
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $6))
- yylex.(*Parser).comments.AddComments(shortList, $1.Comments())
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
- }
- | variable '=' expr
- {
- $$ = assign.NewAssign($1, $3)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3))
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1])
- }
- | variable '=' '&' expr
- {
- $$ = assign.NewReference($1, $4)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $4))
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1])
- }
- | T_CLONE expr
- {
- $$ = expr.NewClone($2)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $2))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
- }
- | variable T_PLUS_EQUAL expr
- {
- $$ = assign.NewPlus($1, $3)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3))
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1])
- }
- | variable T_MINUS_EQUAL expr
- {
- $$ = assign.NewMinus($1, $3)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3))
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1])
- }
- | variable T_MUL_EQUAL expr
- {
- $$ = assign.NewMul($1, $3)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3))
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1])
- }
- | variable T_POW_EQUAL expr
- {
- $$ = assign.NewPow($1, $3)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3))
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1])
- }
- | variable T_DIV_EQUAL expr
- {
- $$ = assign.NewDiv($1, $3)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3))
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1])
- }
- | variable T_CONCAT_EQUAL expr
- {
- $$ = assign.NewConcat($1, $3)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3))
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1])
- }
- | variable T_MOD_EQUAL expr
- {
- $$ = assign.NewMod($1, $3)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3))
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1])
- }
- | variable T_AND_EQUAL expr
- {
- $$ = assign.NewBitwiseAnd($1, $3)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3))
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1])
- }
- | variable T_OR_EQUAL expr
- {
- $$ = assign.NewBitwiseOr($1, $3)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3))
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1])
- }
- | variable T_XOR_EQUAL expr
- {
- $$ = assign.NewBitwiseXor($1, $3)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3))
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1])
- }
- | variable T_SL_EQUAL expr
- {
- $$ = assign.NewShiftLeft($1, $3)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3))
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1])
- }
- | variable T_SR_EQUAL expr
- {
- $$ = assign.NewShiftRight($1, $3)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3))
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1])
- }
- | variable T_INC
- {
- $$ = expr.NewPostInc($1)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodeTokenPosition($1, $2))
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1])
- }
- | T_INC variable
- {
- $$ = expr.NewPreInc($2)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $2))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
- }
- | variable T_DEC
- {
- $$ = expr.NewPostDec($1)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodeTokenPosition($1, $2))
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1])
- }
- | T_DEC variable
- {
- $$ = expr.NewPreDec($2)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $2))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
- }
- | expr T_BOOLEAN_OR expr
- {
- $$ = binary.NewBooleanOr($1, $3)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3))
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1])
- }
- | expr T_BOOLEAN_AND expr
- {
- $$ = binary.NewBooleanAnd($1, $3)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3))
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1])
- }
- | expr T_LOGICAL_OR expr
- {
- $$ = binary.NewLogicalOr($1, $3)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3))
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1])
- }
- | expr T_LOGICAL_AND expr
- {
- $$ = binary.NewLogicalAnd($1, $3)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3))
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1])
- }
- | expr T_LOGICAL_XOR expr
- {
- $$ = binary.NewLogicalXor($1, $3)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3))
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1])
- }
- | expr '|' expr
- {
- $$ = binary.NewBitwiseOr($1, $3)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3))
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1])
- }
- | expr '&' expr
- {
- $$ = binary.NewBitwiseAnd($1, $3)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3))
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1])
- }
- | expr '^' expr
- {
- $$ = binary.NewBitwiseXor($1, $3)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3))
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1])
- }
- | expr '.' expr
- {
- $$ = binary.NewConcat($1, $3)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3))
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1])
- }
- | expr '+' expr
- {
- $$ = binary.NewPlus($1, $3)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3))
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1])
- }
- | expr '-' expr
- {
- $$ = binary.NewMinus($1, $3)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3))
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1])
- }
- | expr '*' expr
- {
- $$ = binary.NewMul($1, $3)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3))
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1])
- }
- | expr T_POW expr
- {
- $$ = binary.NewPow($1, $3)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3))
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1])
- }
- | expr '/' expr
- {
- $$ = binary.NewDiv($1, $3)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3))
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1])
- }
- | expr '%' expr
- {
- $$ = binary.NewMod($1, $3)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3))
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1])
- }
- | expr T_SL expr
- {
- $$ = binary.NewShiftLeft($1, $3)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3))
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1])
- }
- | expr T_SR expr
- {
- $$ = binary.NewShiftRight($1, $3)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3))
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1])
- }
- | '+' expr %prec T_INC
- {
- $$ = expr.NewUnaryPlus($2)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $2))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
- }
- | '-' expr %prec T_INC
- {
- $$ = expr.NewUnaryMinus($2)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $2))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
- }
- | '!' expr
- {
- $$ = expr.NewBooleanNot($2)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $2))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
- }
- | '~' expr
- {
- $$ = expr.NewBitwiseNot($2)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $2))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
- }
- | expr T_IS_IDENTICAL expr
- {
- $$ = binary.NewIdentical($1, $3)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3))
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1])
- }
- | expr T_IS_NOT_IDENTICAL expr
- {
- $$ = binary.NewNotIdentical($1, $3)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3))
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1])
- }
- | expr T_IS_EQUAL expr
- {
- $$ = binary.NewEqual($1, $3)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3))
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1])
- }
- | expr T_IS_NOT_EQUAL expr
- {
- $$ = binary.NewNotEqual($1, $3)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3))
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1])
- }
- | expr '<' expr
- {
- $$ = binary.NewSmaller($1, $3)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3))
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1])
- }
- | expr T_IS_SMALLER_OR_EQUAL expr
- {
- $$ = binary.NewSmallerOrEqual($1, $3)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3))
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1])
- }
- | expr '>' expr
- {
- $$ = binary.NewGreater($1, $3)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3))
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1])
- }
- | expr T_IS_GREATER_OR_EQUAL expr
- {
- $$ = binary.NewGreaterOrEqual($1, $3)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3))
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1])
- }
- | expr T_SPACESHIP expr
- {
- $$ = binary.NewSpaceship($1, $3)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3))
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1])
- }
- | expr T_INSTANCEOF class_name_reference
- {
- $$ = expr.NewInstanceOf($1, $3)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3))
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1])
- }
- | '(' expr ')' { $$ = $2; }
- | new_expr { $$ = $1; }
- | expr '?' expr ':' expr
- {
- $$ = expr.NewTernary($1, $3, $5)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $5))
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1])
- }
- | expr '?' ':' expr
- {
- $$ = expr.NewTernary($1, nil, $4)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $4))
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1])
- }
- | expr T_COALESCE expr
- {
- $$ = binary.NewCoalesce($1, $3)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3))
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1])
- }
- | internal_functions_in_yacc { $$ = $1}
- | T_INT_CAST expr
- {
- $$ = cast.NewInt($2)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $2))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
- }
- | T_DOUBLE_CAST expr
- {
- $$ = cast.NewDouble($2)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $2))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
- }
- | T_STRING_CAST expr
- {
- $$ = cast.NewString($2)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $2))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
- }
- | T_ARRAY_CAST expr
- {
- $$ = cast.NewArray($2)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $2))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
- }
- | T_OBJECT_CAST expr
- {
- $$ = cast.NewObject($2)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $2))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
- }
- | T_BOOL_CAST expr
- {
- $$ = cast.NewBool($2)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $2))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
- }
- | T_UNSET_CAST expr
- {
- $$ = cast.NewUnset($2)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $2))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
- }
- | T_EXIT exit_expr
- {
- if (strings.EqualFold($1.Value, "die")) {
- $$ = expr.NewDie($2)
- } else {
- $$ = expr.NewExit($2)
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(list, $1, comment.ListToken)
+ yylex.(*Parser).comments.AddFromToken(list, $2, comment.OpenParenthesisToken)
+ yylex.(*Parser).comments.AddFromToken(list, $4, comment.CloseParenthesisToken)
+ yylex.(*Parser).comments.AddFromToken($$, $5, comment.EqualToken)
+ }
+ | '[' array_pair_list ']' '=' expr
+ {
+ shortList := expr.NewShortList($2)
+ $$ = assign.NewAssign(shortList, $5)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(shortList, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $3))
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $5))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(shortList, $1, comment.OpenSquareBracket)
+ yylex.(*Parser).comments.AddFromToken(shortList, $3, comment.CloseSquareBracket)
+ yylex.(*Parser).comments.AddFromToken($$, $4, comment.EqualToken)
+ }
+ | variable '=' expr
+ {
+ $$ = assign.NewAssign($1, $3)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.EqualToken)
+ }
+ | variable '=' '&' expr
+ {
+ $$ = assign.NewReference($1, $4)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $4))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.EqualToken)
+ yylex.(*Parser).comments.AddFromToken($$, $3, comment.AmpersandToken)
+ }
+ | T_CLONE expr
+ {
+ $$ = expr.NewClone($2)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $2))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.CloneToken)
+ }
+ | variable T_PLUS_EQUAL expr
+ {
+ $$ = assign.NewPlus($1, $3)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.PlusEqualToken)
+ }
+ | variable T_MINUS_EQUAL expr
+ {
+ $$ = assign.NewMinus($1, $3)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.MinusEqualToken)
+ }
+ | variable T_MUL_EQUAL expr
+ {
+ $$ = assign.NewMul($1, $3)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.MulEqualToken)
+ }
+ | variable T_POW_EQUAL expr
+ {
+ $$ = assign.NewPow($1, $3)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.PowEqualToken)
+ }
+ | variable T_DIV_EQUAL expr
+ {
+ $$ = assign.NewDiv($1, $3)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.DivEqualToken)
+ }
+ | variable T_CONCAT_EQUAL expr
+ {
+ $$ = assign.NewConcat($1, $3)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.ConcatEqualToken)
+ }
+ | variable T_MOD_EQUAL expr
+ {
+ $$ = assign.NewMod($1, $3)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.ModEqualToken)
+ }
+ | variable T_AND_EQUAL expr
+ {
+ $$ = assign.NewBitwiseAnd($1, $3)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.AndEqualToken)
+ }
+ | variable T_OR_EQUAL expr
+ {
+ $$ = assign.NewBitwiseOr($1, $3)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.OrEqualToken)
+ }
+ | variable T_XOR_EQUAL expr
+ {
+ $$ = assign.NewBitwiseXor($1, $3)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.XorEqualToken)
+ }
+ | variable T_SL_EQUAL expr
+ {
+ $$ = assign.NewShiftLeft($1, $3)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.SlEqualToken)
+ }
+ | variable T_SR_EQUAL expr
+ {
+ $$ = assign.NewShiftRight($1, $3)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.SrEqualToken)
+ }
+ | variable T_INC
+ {
+ $$ = expr.NewPostInc($1)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodeTokenPosition($1, $2))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.IncToken)
+ }
+ | T_INC variable
+ {
+ $$ = expr.NewPreInc($2)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $2))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.IncToken)
+ }
+ | variable T_DEC
+ {
+ $$ = expr.NewPostDec($1)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodeTokenPosition($1, $2))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.DecToken)
+ }
+ | T_DEC variable
+ {
+ $$ = expr.NewPreDec($2)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $2))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.DecToken)
+ }
+ | expr T_BOOLEAN_OR expr
+ {
+ $$ = binary.NewBooleanOr($1, $3)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.BooleanOrToken)
+ }
+ | expr T_BOOLEAN_AND expr
+ {
+ $$ = binary.NewBooleanAnd($1, $3)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.BooleanAndToken)
+ }
+ | expr T_LOGICAL_OR expr
+ {
+ $$ = binary.NewLogicalOr($1, $3)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.LogicalOrToken)
+ }
+ | expr T_LOGICAL_AND expr
+ {
+ $$ = binary.NewLogicalAnd($1, $3)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.LogicalAndToken)
+ }
+ | expr T_LOGICAL_XOR expr
+ {
+ $$ = binary.NewLogicalXor($1, $3)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.LogicalXorToken)
+ }
+ | expr '|' expr
+ {
+ $$ = binary.NewBitwiseOr($1, $3)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.VerticalBarToken)
+ }
+ | expr '&' expr
+ {
+ $$ = binary.NewBitwiseAnd($1, $3)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.AmpersandToken)
+ }
+ | expr '^' expr
+ {
+ $$ = binary.NewBitwiseXor($1, $3)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.CaretToken)
+ }
+ | expr '.' expr
+ {
+ $$ = binary.NewConcat($1, $3)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.DotToken)
+ }
+ | expr '+' expr
+ {
+ $$ = binary.NewPlus($1, $3)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.PlusToken)
+ }
+ | expr '-' expr
+ {
+ $$ = binary.NewMinus($1, $3)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.MinusToken)
+ }
+ | expr '*' expr
+ {
+ $$ = binary.NewMul($1, $3)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.AsteriskToken)
+ }
+ | expr T_POW expr
+ {
+ $$ = binary.NewPow($1, $3)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.PowToken)
+ }
+ | expr '/' expr
+ {
+ $$ = binary.NewDiv($1, $3)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.SlashToken)
+ }
+ | expr '%' expr
+ {
+ $$ = binary.NewMod($1, $3)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.PercentToken)
+ }
+ | expr T_SL expr
+ {
+ $$ = binary.NewShiftLeft($1, $3)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.SlToken)
+ }
+ | expr T_SR expr
+ {
+ $$ = binary.NewShiftRight($1, $3)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.SrToken)
+ }
+ | '+' expr %prec T_INC
+ {
+ $$ = expr.NewUnaryPlus($2)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $2))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.PlusToken)
+ }
+ | '-' expr %prec T_INC
+ {
+ $$ = expr.NewUnaryMinus($2)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $2))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.MinusToken)
+ }
+ | '!' expr
+ {
+ $$ = expr.NewBooleanNot($2)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $2))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.ExclamationMarkToken)
+ }
+ | '~' expr
+ {
+ $$ = expr.NewBitwiseNot($2)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $2))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.TildeToken)
+ }
+ | expr T_IS_IDENTICAL expr
+ {
+ $$ = binary.NewIdentical($1, $3)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.IsIdenticalToken)
+ }
+ | expr T_IS_NOT_IDENTICAL expr
+ {
+ $$ = binary.NewNotIdentical($1, $3)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.IsNotIdenticalToken)
+ }
+ | expr T_IS_EQUAL expr
+ {
+ $$ = binary.NewEqual($1, $3)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.IsEqualToken)
+ }
+ | expr T_IS_NOT_EQUAL expr
+ {
+ $$ = binary.NewNotEqual($1, $3)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.IsNotEqualToken)
+ }
+ | expr '<' expr
+ {
+ $$ = binary.NewSmaller($1, $3)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.LessToken)
+ }
+ | expr T_IS_SMALLER_OR_EQUAL expr
+ {
+ $$ = binary.NewSmallerOrEqual($1, $3)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.IsSmallerOrEqualToken)
+ }
+ | expr '>' expr
+ {
+ $$ = binary.NewGreater($1, $3)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.GreaterToken)
+ }
+ | expr T_IS_GREATER_OR_EQUAL expr
+ {
+ $$ = binary.NewGreaterOrEqual($1, $3)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.IsGreaterOrEqualToken)
+ }
+ | expr T_SPACESHIP expr
+ {
+ $$ = binary.NewSpaceship($1, $3)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.SpaceshipToken)
+ }
+ | expr T_INSTANCEOF class_name_reference
+ {
+ $$ = expr.NewInstanceOf($1, $3)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.InstanceofToken)
+ }
+ | '(' expr ')'
+ {
+ $$ = $2;
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.OpenParenthesisToken)
+ yylex.(*Parser).comments.AddFromToken($$, $3, comment.CloseParenthesisToken)
+ }
+ | new_expr
+ { $$ = $1; }
+ | expr '?' expr ':' expr
+ {
+ $$ = expr.NewTernary($1, $3, $5)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $5))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.QuestionMarkToken)
+ yylex.(*Parser).comments.AddFromToken($$, $4, comment.ColonToken)
+ }
+ | expr '?' ':' expr
+ {
+ $$ = expr.NewTernary($1, nil, $4)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $4))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.QuestionMarkToken)
+ yylex.(*Parser).comments.AddFromToken($$, $3, comment.ColonToken)
+ }
+ | expr T_COALESCE expr
+ {
+ $$ = binary.NewCoalesce($1, $3)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.CoalesceToken)
+ }
+ | internal_functions_in_yacc
+ { $$ = $1}
+ | T_INT_CAST expr
+ {
+ $$ = cast.NewInt($2)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $2))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.IntCastToken)
+ }
+ | T_DOUBLE_CAST expr
+ {
+ $$ = cast.NewDouble($2)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $2))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.DoubleCastToken)
+ }
+ | T_STRING_CAST expr
+ {
+ $$ = cast.NewString($2)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $2))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.StringCastToken)
+ }
+ | T_ARRAY_CAST expr
+ {
+ $$ = cast.NewArray($2)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $2))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.ArrayCastToken)
+ }
+ | T_OBJECT_CAST expr
+ {
+ $$ = cast.NewObject($2)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $2))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.ObjectCastToken)
+ }
+ | T_BOOL_CAST expr
+ {
+ $$ = cast.NewBool($2)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $2))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.BoolCastToken)
+ }
+ | T_UNSET_CAST expr
+ {
+ $$ = cast.NewUnset($2)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $2))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.UnsetCastToken)
+ }
+ | T_EXIT exit_expr
+ {
+ if (strings.EqualFold($1.Value, "die")) {
+ $$ = expr.NewDie(nil)
+ if $2 != nil {
+ $$.(*expr.Die).Expr = $2.(*expr.Exit).Expr
+ }
+ } else {
+ $$ = expr.NewExit(nil)
+ if $2 != nil {
+ $$.(*expr.Exit).Expr = $2.(*expr.Exit).Expr
+ }
+ }
+
+ // save position
+ if $2 == nil {
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
+ } else {
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $2))
+ }
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.ExitToken)
+
+ if $2 != nil {
+ yylex.(*Parser).comments.AddFromChildNode($$, $2)
+ }
}
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $2))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
- }
| '@' expr
- {
- $$ = expr.NewErrorSuppress($2)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $2))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
- }
- | scalar { $$ = $1; }
+ {
+ $$ = expr.NewErrorSuppress($2)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $2))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.AtToken)
+ }
+ | scalar
+ { $$ = $1; }
| '`' backticks_expr '`'
- {
- $$ = expr.NewShellExec($2)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $3))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
- }
+ {
+ $$ = expr.NewShellExec($2)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $3))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.BackquoteToken)
+ yylex.(*Parser).comments.AddFromToken($$, $3, comment.BackquoteToken)
+ }
| T_PRINT expr
- {
- $$ = expr.NewPrint($2)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $2))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
- }
+ {
+ $$ = expr.NewPrint($2)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $2))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.PrintToken)
+ }
| T_YIELD
- {
- $$ = expr.NewYield(nil, nil)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
- }
+ {
+ $$ = expr.NewYield(nil, nil)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.YieldToken)
+ }
| T_YIELD expr
- {
- $$ = expr.NewYield(nil, $2)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $2))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
- }
+ {
+ $$ = expr.NewYield(nil, $2)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $2))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.YieldToken)
+ }
| T_YIELD expr T_DOUBLE_ARROW expr
- {
- $$ = expr.NewYield($2, $4)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $4))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
- }
+ {
+ $$ = expr.NewYield($2, $4)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $4))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.YieldToken)
+ yylex.(*Parser).comments.AddFromToken($$, $3, comment.DoubleArrowToken)
+ }
| T_YIELD_FROM expr
- {
- $$ = expr.NewYieldFrom($2)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $2))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
- }
+ {
+ $$ = expr.NewYieldFrom($2)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $2))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.YieldFromToken)
+ }
| T_FUNCTION returns_ref backup_doc_comment '(' parameter_list ')' lexical_vars return_type '{' inner_statement_list '}'
{
- $$ = expr.NewClosure($5, $7, $8, $10, false, $2.value, $3)
+ $$ = expr.NewClosure($5, $7, $8, $10, false, $2 != nil, $3)
+
+ // save position
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $11))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.FunctionToken)
+ if $2 != nil {
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.AmpersandToken)
+ }
+ yylex.(*Parser).comments.AddFromToken($$, $4, comment.OpenParenthesisToken)
+ yylex.(*Parser).comments.AddFromToken($$, $6, comment.CloseParenthesisToken)
+ yylex.(*Parser).comments.AddFromToken($$, $9, comment.OpenCurlyBracesToken)
+ yylex.(*Parser).comments.AddFromToken($$, $11, comment.CloseCurlyBracesToken)
}
| T_STATIC T_FUNCTION returns_ref backup_doc_comment '(' parameter_list ')' lexical_vars return_type '{' inner_statement_list '}'
{
- $$ = expr.NewClosure($6, $8, $9, $11, true, $3.value, $4)
+ $$ = expr.NewClosure($6, $8, $9, $11, true, $3 != nil, $4)
+
+ // save position
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $12))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.StaticToken)
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.FunctionToken)
+ if $3 != nil {
+ yylex.(*Parser).comments.AddFromToken($$, $3, comment.AmpersandToken)
+ }
+ yylex.(*Parser).comments.AddFromToken($$, $5, comment.OpenParenthesisToken)
+ yylex.(*Parser).comments.AddFromToken($$, $7, comment.CloseParenthesisToken)
+ yylex.(*Parser).comments.AddFromToken($$, $10, comment.OpenCurlyBracesToken)
+ yylex.(*Parser).comments.AddFromToken($$, $12, comment.CloseCurlyBracesToken)
}
;
backup_doc_comment:
- /* empty */ { $$ = yylex.(*Parser).PhpDocComment; yylex.(*Parser).PhpDocComment = "" }
+ /* empty */
+ {
+ $$ = yylex.(*Parser).PhpDocComment
+ yylex.(*Parser).PhpDocComment = ""
+ }
;
returns_ref:
- /* empty */ { $$ = boolWithToken{false, nil} }
- | '&' { $$ = boolWithToken{true, &$1} }
+ /* empty */
+ { $$ = nil }
+ | '&'
+ { $$ = $1 }
;
lexical_vars:
- /* empty */ { $$ = []node.Node{} }
- | T_USE '(' lexical_var_list ')' { $$ = $3; }
+ /* empty */
+ { $$ = nil }
+ | T_USE '(' lexical_var_list ')'
+ {
+ $$ = expr.NewClosureUse($3)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $4))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.UseToken)
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.OpenParenthesisToken)
+ yylex.(*Parser).comments.AddFromToken($$, $4, comment.CloseParenthesisToken)
+ }
;
lexical_var_list:
- lexical_var_list ',' lexical_var { $$ = append($1, $3) }
- | lexical_var { $$ = []node.Node{$1} }
+ lexical_var_list ',' lexical_var
+ {
+ $$ = append($1, $3)
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(lastNode($1), $2, comment.CommaToken)
+ }
+ | lexical_var
+ { $$ = []node.Node{$1} }
;
lexical_var:
T_VARIABLE
- {
- identifier := node.NewIdentifier(strings.TrimLeft($1.Value, "$"))
- yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
- variable := expr.NewVariable(identifier)
- yylex.(*Parser).positions.AddPosition(variable, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
- $$ = expr.NewClosureUse(variable, false)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
+ {
+ identifier := node.NewIdentifier(strings.TrimLeft($1.Value, "$"))
+ $$ = expr.NewVariable(identifier)
- yylex.(*Parser).comments.AddComments(identifier, $1.Comments())
- yylex.(*Parser).comments.AddComments(variable, $1.Comments())
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
- }
+ // save position
+ yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.VariableToken)
+ }
| '&' T_VARIABLE
- {
- identifier := node.NewIdentifier(strings.TrimLeft($2.Value, "$"))
- yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition($2))
- variable := expr.NewVariable(identifier)
- yylex.(*Parser).positions.AddPosition(variable, yylex.(*Parser).positionBuilder.NewTokenPosition($2))
- $$ = expr.NewClosureUse(variable, true)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $2))
+ {
+ identifier := node.NewIdentifier(strings.TrimLeft($2.Value, "$"))
+ variable := expr.NewVariable(identifier)
+ $$ = expr.NewReference(variable)
- yylex.(*Parser).comments.AddComments(identifier, $2.Comments())
- yylex.(*Parser).comments.AddComments(variable, $1.Comments())
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
- }
+ // save position
+ yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition($2))
+ yylex.(*Parser).positions.AddPosition(variable, yylex.(*Parser).positionBuilder.NewTokenPosition($2))
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $2))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.AmpersandToken)
+ yylex.(*Parser).comments.AddFromToken(variable, $2, comment.VariableToken)
+ }
;
function_call:
- name argument_list
- {
- $$ = expr.NewFunctionCall($1, $2.nodes)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodeTokenPosition($1, $2.endToken))
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1])
- }
+ name argument_list
+ {
+ $$ = expr.NewFunctionCall($1, $2.(*node.ArgumentList))
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $2))
+ }
| class_name T_PAAMAYIM_NEKUDOTAYIM member_name argument_list
- {
- $$ = expr.NewStaticCall($1, $3, $4.nodes)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodeTokenPosition($1, $4.endToken))
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1])
- }
+ {
+ $$ = expr.NewStaticCall($1, $3, $4.(*node.ArgumentList))
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $4))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.PaamayimNekudotayimToken)
+ }
| variable_class_name T_PAAMAYIM_NEKUDOTAYIM member_name argument_list
- {
- $$ = expr.NewStaticCall($1, $3, $4.nodes)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodeTokenPosition($1, $4.endToken))
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1])
- }
+ {
+ $$ = expr.NewStaticCall($1, $3, $4.(*node.ArgumentList))
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $4))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.PaamayimNekudotayimToken)
+ }
| callable_expr argument_list
- {
- $$ = expr.NewFunctionCall($1, $2.nodes)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodeTokenPosition($1, $2.endToken))
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1])
- }
+ {
+ $$ = expr.NewFunctionCall($1, $2.(*node.ArgumentList))
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $2))
+ }
;
class_name:
- T_STATIC
- {
- $$ = node.NewIdentifier($1.Value)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
- }
- | name { $$ = $1; }
+ T_STATIC
+ {
+ $$ = node.NewIdentifier($1.Value)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.StaticToken)
+ }
+ | name
+ { $$ = $1; }
;
class_name_reference:
- class_name { $$ = $1; }
- | new_variable { $$ = $1; }
+ class_name
+ { $$ = $1; }
+ | new_variable
+ { $$ = $1; }
;
exit_expr:
- /* empty */ { $$ = nil }
- | '(' optional_expr ')' { $$ = $2; }
+ /* empty */
+ { $$ = nil }
+ | '(' optional_expr ')'
+ {
+ $$ = expr.NewExit($2);
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $3))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.OpenParenthesisToken)
+ yylex.(*Parser).comments.AddFromToken($$, $3, comment.CloseParenthesisToken)
+ }
;
backticks_expr:
- /* empty */ { $$ = []node.Node{} }
- | T_ENCAPSED_AND_WHITESPACE { $$ = []node.Node{scalar.NewEncapsedStringPart($1.Value)} }
- | encaps_list { $$ = $1; }
+ /* empty */
+ { $$ = []node.Node{} }
+ | T_ENCAPSED_AND_WHITESPACE
+ { $$ = []node.Node{scalar.NewEncapsedStringPart($1.Value)} }
+ | encaps_list
+ { $$ = $1; }
;
ctor_arguments:
- /* empty */ { $$ = nil }
- | argument_list { $$ = $1 }
+ /* empty */
+ { $$ = nil }
+ | argument_list
+ { $$ = $1 }
;
dereferencable_scalar:
T_ARRAY '(' array_pair_list ')'
- {
- $$ = expr.NewArray($3)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $4))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
- }
+ {
+ $$ = expr.NewArray($3)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $4))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.ArrayToken)
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.OpenParenthesisToken)
+ yylex.(*Parser).comments.AddFromToken($$, $4, comment.CloseParenthesisToken)
+ }
| '[' array_pair_list ']'
- {
- $$ = expr.NewShortArray($2)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $3))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
- }
+ {
+ $$ = expr.NewShortArray($2)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $3))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.OpenSquareBracket)
+ yylex.(*Parser).comments.AddFromToken($$, $3, comment.CloseSquareBracket)
+ }
| T_CONSTANT_ENCAPSED_STRING
- {
- $$ = scalar.NewString($1.Value)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
- }
+ {
+ $$ = scalar.NewString($1.Value)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.ConstantEncapsedStringToken)
+ }
;
scalar:
- T_LNUMBER
- {
- $$ = scalar.NewLnumber($1.Value)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
- }
- | T_DNUMBER
- {
- $$ = scalar.NewDnumber($1.Value)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
- }
- | T_LINE
- {
- $$ = scalar.NewMagicConstant($1.Value)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
- }
- | T_FILE
- {
- $$ = scalar.NewMagicConstant($1.Value)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
- }
- | T_DIR
- {
- $$ = scalar.NewMagicConstant($1.Value)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
- }
- | T_TRAIT_C
- {
- $$ = scalar.NewMagicConstant($1.Value)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
- }
- | T_METHOD_C
- {
- $$ = scalar.NewMagicConstant($1.Value)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
- }
- | T_FUNC_C
- {
- $$ = scalar.NewMagicConstant($1.Value)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
- }
- | T_NS_C
- {
- $$ = scalar.NewMagicConstant($1.Value)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
- }
- | T_CLASS_C
- {
- $$ = scalar.NewMagicConstant($1.Value)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
- }
- | T_START_HEREDOC T_ENCAPSED_AND_WHITESPACE T_END_HEREDOC
- {
- encapsed := scalar.NewEncapsedStringPart($2.Value)
- yylex.(*Parser).positions.AddPosition(encapsed, yylex.(*Parser).positionBuilder.NewTokenPosition($2))
- yylex.(*Parser).comments.AddComments(encapsed, $2.Comments())
+ T_LNUMBER
+ {
+ $$ = scalar.NewLnumber($1.Value)
- $$ = scalar.NewHeredoc($1.Value, []node.Node{encapsed})
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $3))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
- }
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.LnumberToken)
+ }
+ | T_DNUMBER
+ {
+ $$ = scalar.NewDnumber($1.Value)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.DnumberToken)
+ }
+ | T_LINE
+ {
+ $$ = scalar.NewMagicConstant($1.Value)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.LineToken)
+ }
+ | T_FILE
+ {
+ $$ = scalar.NewMagicConstant($1.Value)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.FileToken)
+ }
+ | T_DIR
+ {
+ $$ = scalar.NewMagicConstant($1.Value)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.DirToken)
+ }
+ | T_TRAIT_C
+ {
+ $$ = scalar.NewMagicConstant($1.Value)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.TraitCToken)
+ }
+ | T_METHOD_C
+ {
+ $$ = scalar.NewMagicConstant($1.Value)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.MethodCToken)
+ }
+ | T_FUNC_C
+ {
+ $$ = scalar.NewMagicConstant($1.Value)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.FuncCToken)
+ }
+ | T_NS_C
+ {
+ $$ = scalar.NewMagicConstant($1.Value)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.NsCToken)
+ }
+ | T_CLASS_C
+ {
+ $$ = scalar.NewMagicConstant($1.Value)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.ClassCToken)
+ }
+ | T_START_HEREDOC T_ENCAPSED_AND_WHITESPACE T_END_HEREDOC
+ {
+ encapsed := scalar.NewEncapsedStringPart($2.Value)
+ $$ = scalar.NewHeredoc($1.Value, []node.Node{encapsed})
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(encapsed, yylex.(*Parser).positionBuilder.NewTokenPosition($2))
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $3))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.StartHeredocToken)
+ }
| T_START_HEREDOC T_END_HEREDOC
- {
- $$ = scalar.NewHeredoc($1.Value, nil)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $2))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
- }
+ {
+ $$ = scalar.NewHeredoc($1.Value, nil)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $2))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.StartHeredocToken)
+ }
| '"' encaps_list '"'
- {
- $$ = scalar.NewEncapsed($2)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $3))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
- }
+ {
+ $$ = scalar.NewEncapsed($2)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $3))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.DoubleQuoteToken)
+ }
| T_START_HEREDOC encaps_list T_END_HEREDOC
- {
- $$ = scalar.NewHeredoc($1.Value, $2)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $3))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
- }
- | dereferencable_scalar { $$ = $1; }
- | constant { $$ = $1; }
+ {
+ $$ = scalar.NewHeredoc($1.Value, $2)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $3))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.StartHeredocToken)
+ }
+ | dereferencable_scalar
+ { $$ = $1; }
+ | constant
+ { $$ = $1; }
;
constant:
- name
- {
- $$ = expr.NewConstFetch($1)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodePosition($1))
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1])
- }
+ name
+ {
+ $$ = expr.NewConstFetch($1)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodePosition($1))
+ }
| class_name T_PAAMAYIM_NEKUDOTAYIM identifier
- {
- target := node.NewIdentifier($3.Value)
- yylex.(*Parser).positions.AddPosition(target, yylex.(*Parser).positionBuilder.NewTokenPosition($3))
- $$ = expr.NewClassConstFetch($1, target)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodeTokenPosition($1, $3))
+ {
+ target := node.NewIdentifier($3.Value)
+ $$ = expr.NewClassConstFetch($1, target)
- yylex.(*Parser).comments.AddComments(target, $3.Comments())
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1])
- }
+ // save position
+ yylex.(*Parser).positions.AddPosition(target, yylex.(*Parser).positionBuilder.NewTokenPosition($3))
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodeTokenPosition($1, $3))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.PaamayimNekudotayimToken)
+ yylex.(*Parser).comments.AddFromToken(target, $3, comment.IdentifierToken)
+ }
| variable_class_name T_PAAMAYIM_NEKUDOTAYIM identifier
- {
- target := node.NewIdentifier($3.Value)
- yylex.(*Parser).positions.AddPosition(target, yylex.(*Parser).positionBuilder.NewTokenPosition($3))
- $$ = expr.NewClassConstFetch($1, target)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodeTokenPosition($1, $3))
+ {
+ target := node.NewIdentifier($3.Value)
+ $$ = expr.NewClassConstFetch($1, target)
- yylex.(*Parser).comments.AddComments(target, $3.Comments())
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1])
- }
+ // save position
+ yylex.(*Parser).positions.AddPosition(target, yylex.(*Parser).positionBuilder.NewTokenPosition($3))
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodeTokenPosition($1, $3))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.PaamayimNekudotayimToken)
+ yylex.(*Parser).comments.AddFromToken(target, $3, comment.IdentifierToken)
+ }
;
expr:
- variable { $$ = $1; }
- | expr_without_variable { $$ = $1; }
+ variable
+ { $$ = $1; }
+ | expr_without_variable
+ { $$ = $1; }
;
optional_expr:
- /* empty */ { $$ = nil }
- | expr { $$ = $1; }
+ /* empty */
+ { $$ = nil }
+ | expr
+ { $$ = $1; }
;
variable_class_name:
- dereferencable { $$ = $1; }
+ dereferencable
+ { $$ = $1; }
;
dereferencable:
- variable { $$ = $1; }
- | '(' expr ')' { $$ = $2; }
- | dereferencable_scalar { $$ = $1; }
+ variable
+ { $$ = $1; }
+ | '(' expr ')'
+ {
+ $$ = $2;
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.OpenParenthesisToken)
+ yylex.(*Parser).comments.AddFromToken($$, $3, comment.CloseParenthesisToken)
+ }
+ | dereferencable_scalar
+ { $$ = $1; }
;
callable_expr:
- callable_variable { $$ = $1; }
- | '(' expr ')' { $$ = $2; }
- | dereferencable_scalar { $$ = $1; }
+ callable_variable
+ { $$ = $1; }
+ | '(' expr ')'
+ {
+ $$ = $2;
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.OpenParenthesisToken)
+ yylex.(*Parser).comments.AddFromToken($$, $3, comment.CloseParenthesisToken)
+ }
+ | dereferencable_scalar
+ { $$ = $1; }
;
callable_variable:
- simple_variable { $$ = $1; }
+ simple_variable
+ { $$ = $1; }
| dereferencable '[' optional_expr ']'
- {
- $$ = expr.NewArrayDimFetch($1, $3)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodeTokenPosition($1, $4))
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1])
- }
+ {
+ $$ = expr.NewArrayDimFetch($1, $3)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodeTokenPosition($1, $4))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.OpenSquareBracket)
+ yylex.(*Parser).comments.AddFromToken($$, $4, comment.CloseSquareBracket)
+ }
| constant '[' optional_expr ']'
- {
- $$ = expr.NewArrayDimFetch($1, $3)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodeTokenPosition($1, $4))
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1])
- }
+ {
+ $$ = expr.NewArrayDimFetch($1, $3)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodeTokenPosition($1, $4))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.OpenSquareBracket)
+ yylex.(*Parser).comments.AddFromToken($$, $4, comment.CloseSquareBracket)
+ }
| dereferencable '{' expr '}'
- {
- $$ = expr.NewArrayDimFetch($1, $3)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodeTokenPosition($1, $4))
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1])
- }
+ {
+ $$ = expr.NewArrayDimFetch($1, $3)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodeTokenPosition($1, $4))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.OpenCurlyBracesToken)
+ yylex.(*Parser).comments.AddFromToken($$, $4, comment.CloseCurlyBracesToken)
+ }
| dereferencable T_OBJECT_OPERATOR property_name argument_list
- {
- $$ = expr.NewMethodCall($1, $3, $4.nodes)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodeTokenPosition($1, $4.endToken))
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1])
- }
- | function_call { $$ = $1; }
+ {
+ $$ = expr.NewMethodCall($1, $3, $4.(*node.ArgumentList))
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $4))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.ObjectOperatorToken)
+ }
+ | function_call
+ { $$ = $1; }
;
variable:
- callable_variable { $$ = $1; }
- | static_member { $$ = $1; }
+ callable_variable
+ { $$ = $1; }
+ | static_member
+ { $$ = $1; }
| dereferencable T_OBJECT_OPERATOR property_name
- {
- $$ = expr.NewPropertyFetch($1, $3)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3))
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1])
- }
+ {
+ $$ = expr.NewPropertyFetch($1, $3)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.ObjectOperatorToken)
+ }
;
simple_variable:
- T_VARIABLE
- {
- name := node.NewIdentifier(strings.TrimLeft($1.Value, "$"))
- yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
- $$ = expr.NewVariable(name)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
-
- yylex.(*Parser).comments.AddComments(name, $1.Comments())
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
- }
+ T_VARIABLE
+ {
+ name := node.NewIdentifier(strings.TrimLeft($1.Value, "$"))
+ $$ = expr.NewVariable(name)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.VariableToken)
+ }
| '$' '{' expr '}'
- {
- $$ = expr.NewVariable($3)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $4))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
- }
+ {
+ $$ = expr.NewVariable($3)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $4))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.DollarToken)
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.OpenCurlyBracesToken)
+ yylex.(*Parser).comments.AddFromToken($$, $4, comment.CloseCurlyBracesToken)
+ }
| '$' simple_variable
- {
- $$ = expr.NewVariable($2)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $2))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
- }
+ {
+ $$ = expr.NewVariable($2)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $2))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.DollarToken)
+ }
;
static_member:
- class_name T_PAAMAYIM_NEKUDOTAYIM simple_variable
- {
- $$ = expr.NewStaticPropertyFetch($1, $3)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3))
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1])
- }
+ class_name T_PAAMAYIM_NEKUDOTAYIM simple_variable
+ {
+ $$ = expr.NewStaticPropertyFetch($1, $3)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.PaamayimNekudotayimToken)
+ }
| variable_class_name T_PAAMAYIM_NEKUDOTAYIM simple_variable
- {
- $$ = expr.NewStaticPropertyFetch($1, $3)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3))
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1])
- }
+ {
+ $$ = expr.NewStaticPropertyFetch($1, $3)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.PaamayimNekudotayimToken)
+ }
;
new_variable:
- simple_variable { $$ = $1 }
+ simple_variable
+ { $$ = $1 }
| new_variable '[' optional_expr ']'
- {
- $$ = expr.NewArrayDimFetch($1, $3)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodeTokenPosition($1, $4))
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1])
- }
+ {
+ $$ = expr.NewArrayDimFetch($1, $3)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodeTokenPosition($1, $4))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.OpenSquareBracket)
+ yylex.(*Parser).comments.AddFromToken($$, $4, comment.CloseSquareBracket)
+ }
| new_variable '{' expr '}'
- {
- $$ = expr.NewArrayDimFetch($1, $3)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodeTokenPosition($1, $4))
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1])
- }
+ {
+ $$ = expr.NewArrayDimFetch($1, $3)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodeTokenPosition($1, $4))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.OpenCurlyBracesToken)
+ yylex.(*Parser).comments.AddFromToken($$, $4, comment.CloseCurlyBracesToken)
+ }
| new_variable T_OBJECT_OPERATOR property_name
- {
- $$ = expr.NewPropertyFetch($1, $3)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3))
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1])
- }
+ {
+ $$ = expr.NewPropertyFetch($1, $3)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.ObjectOperatorToken)
+ }
| class_name T_PAAMAYIM_NEKUDOTAYIM simple_variable
{
$$ = expr.NewStaticPropertyFetch($1, $3)
+
+ // save position
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3))
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.PaamayimNekudotayimToken)
}
| new_variable T_PAAMAYIM_NEKUDOTAYIM simple_variable
{
$$ = expr.NewStaticPropertyFetch($1, $3)
+
+ // save position
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3))
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1])
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.PaamayimNekudotayimToken)
}
;
member_name:
- identifier
- {
- $$ = node.NewIdentifier($1.Value)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
- }
- | '{' expr '}' { $$ = $2; }
- | simple_variable { $$ = $1 }
+ identifier
+ {
+ $$ = node.NewIdentifier($1.Value)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.IdentifierToken)
+ }
+ | '{' expr '}'
+ {
+ $$ = $2;
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.OpenCurlyBracesToken)
+ yylex.(*Parser).comments.AddFromToken($$, $3, comment.CloseCurlyBracesToken)
+ }
+ | simple_variable
+ { $$ = $1 }
;
property_name:
- T_STRING
- {
- $$ = node.NewIdentifier($1.Value)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
- }
- | '{' expr '}' { $$ = $2; }
- | simple_variable { $$ = $1 }
+ T_STRING
+ {
+ $$ = node.NewIdentifier($1.Value)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.StringToken)
+ }
+ | '{' expr '}'
+ {
+ $$ = $2;
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.OpenCurlyBracesToken)
+ yylex.(*Parser).comments.AddFromToken($$, $3, comment.CloseCurlyBracesToken)
+ }
+ | simple_variable
+ { $$ = $1 }
;
array_pair_list:
@@ -2377,279 +3916,391 @@ array_pair_list:
;
possible_array_pair:
- /* empty */ { $$ = nil }
- | array_pair { $$ = $1; }
+ /* empty */
+ { $$ = nil }
+ | array_pair
+ { $$ = $1; }
;
non_empty_array_pair_list:
non_empty_array_pair_list ',' possible_array_pair
- { $$ = append($1, $3) }
- | possible_array_pair { $$ = []node.Node{$1} }
+ {
+ $$ = append($1, $3)
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(lastNode($1), $2, comment.CommaToken)
+ }
+ | possible_array_pair
+ { $$ = []node.Node{$1} }
;
array_pair:
- expr T_DOUBLE_ARROW expr
- {
- $$ = expr.NewArrayItem($1, $3, false)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3))
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1])
- }
+ expr T_DOUBLE_ARROW expr
+ {
+ $$ = expr.NewArrayItem($1, $3)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.DoubleArrowToken)
+ }
| expr
- {
- $$ = expr.NewArrayItem(nil, $1, false)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodePosition($1))
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1])
- }
+ {
+ $$ = expr.NewArrayItem(nil, $1)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodePosition($1))
+ }
| expr T_DOUBLE_ARROW '&' variable
- {
- $$ = expr.NewArrayItem($1, $4, true)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $4))
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1])
- }
+ {
+ reference := expr.NewReference($4)
+ $$ = expr.NewArrayItem($1, reference)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $4))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.DoubleArrowToken)
+ yylex.(*Parser).comments.AddFromToken(reference, $3, comment.AmpersandToken)
+ }
| '&' variable
- {
- $$ = expr.NewArrayItem(nil, $2, true)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $2))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
- }
+ {
+ reference := expr.NewReference($2)
+ $$ = expr.NewArrayItem(nil, reference)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $2))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(reference, $1, comment.AmpersandToken)
+ }
| expr T_DOUBLE_ARROW T_LIST '(' array_pair_list ')'
{
// TODO: Cannot use list() as standalone expression
list := expr.NewList($5)
+ $$ = expr.NewArrayItem($1, list)
+
+ // save position
yylex.(*Parser).positions.AddPosition(list, yylex.(*Parser).positionBuilder.NewTokensPosition($3, $6))
- $$ = expr.NewArrayItem($1, list, false)
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodeTokenPosition($1, $6))
- yylex.(*Parser).comments.AddComments(list, $3.Comments())
- yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1])
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.DoubleArrowToken)
+ yylex.(*Parser).comments.AddFromToken(list, $3, comment.ListToken)
+ yylex.(*Parser).comments.AddFromToken(list, $4, comment.OpenParenthesisToken)
+ yylex.(*Parser).comments.AddFromToken(list, $6, comment.CloseParenthesisToken)
}
| T_LIST '(' array_pair_list ')'
{
// TODO: Cannot use list() as standalone expression
list := expr.NewList($3)
+ $$ = expr.NewArrayItem(nil, list)
+
+ // save position
yylex.(*Parser).positions.AddPosition(list, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $4))
- $$ = expr.NewArrayItem(nil, list, false)
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $4))
- yylex.(*Parser).comments.AddComments(list, $1.Comments())
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(list, $1, comment.ListToken)
+ yylex.(*Parser).comments.AddFromToken(list, $2, comment.OpenParenthesisToken)
+ yylex.(*Parser).comments.AddFromToken(list, $4, comment.CloseParenthesisToken)
}
;
encaps_list:
- encaps_list encaps_var { $$ = append($1, $2) }
+ encaps_list encaps_var
+ { $$ = append($1, $2) }
| encaps_list T_ENCAPSED_AND_WHITESPACE
- {
- encapsed := scalar.NewEncapsedStringPart($2.Value)
- yylex.(*Parser).positions.AddPosition(encapsed, yylex.(*Parser).positionBuilder.NewTokenPosition($2))
- $$ = append($1, encapsed)
- yylex.(*Parser).comments.AddComments(encapsed, $2.Comments())
- }
- | encaps_var { $$ = []node.Node{$1} }
+ {
+ encapsed := scalar.NewEncapsedStringPart($2.Value)
+ $$ = append($1, encapsed)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(encapsed, yylex.(*Parser).positionBuilder.NewTokenPosition($2))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(encapsed, $2, comment.EncapsedAndWhitespaceToken)
+ }
+ | encaps_var
+ { $$ = []node.Node{$1} }
| T_ENCAPSED_AND_WHITESPACE encaps_var
- {
- encapsed := scalar.NewEncapsedStringPart($1.Value)
- yylex.(*Parser).positions.AddPosition(encapsed, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
- $$ = []node.Node{encapsed, $2}
- yylex.(*Parser).comments.AddComments(encapsed, $1.Comments())
- }
+ {
+ encapsed := scalar.NewEncapsedStringPart($1.Value)
+ $$ = []node.Node{encapsed, $2}
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(encapsed, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(encapsed, $1, comment.EncapsedAndWhitespaceToken)
+ }
;
encaps_var:
- T_VARIABLE
- {
- name := node.NewIdentifier(strings.TrimLeft($1.Value, "$"))
- yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
- $$ = expr.NewVariable(name)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
+ T_VARIABLE
+ {
+ name := node.NewIdentifier(strings.TrimLeft($1.Value, "$"))
+ $$ = expr.NewVariable(name)
- yylex.(*Parser).comments.AddComments(name, $1.Comments())
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
- }
+ // save position
+ yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.VariableToken)
+ }
| T_VARIABLE '[' encaps_var_offset ']'
- {
- identifier := node.NewIdentifier(strings.TrimLeft($1.Value, "$"))
- yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
- variable := expr.NewVariable(identifier)
- yylex.(*Parser).positions.AddPosition(variable, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
- $$ = expr.NewArrayDimFetch(variable, $3)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $4))
+ {
+ identifier := node.NewIdentifier(strings.TrimLeft($1.Value, "$"))
+ variable := expr.NewVariable(identifier)
+ $$ = expr.NewArrayDimFetch(variable, $3)
- yylex.(*Parser).comments.AddComments(identifier, $1.Comments())
- yylex.(*Parser).comments.AddComments(variable, $1.Comments())
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
- }
+ // save position
+ yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
+ yylex.(*Parser).positions.AddPosition(variable, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $4))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(variable, $1, comment.VariableToken)
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.OpenSquareBracket)
+ yylex.(*Parser).comments.AddFromToken($$, $4, comment.CloseSquareBracket)
+ }
| T_VARIABLE T_OBJECT_OPERATOR T_STRING
- {
- identifier := node.NewIdentifier(strings.TrimLeft($1.Value, "$"))
- yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
- variable := expr.NewVariable(identifier)
- yylex.(*Parser).positions.AddPosition(variable, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
- fetch := node.NewIdentifier($3.Value)
- yylex.(*Parser).positions.AddPosition(fetch, yylex.(*Parser).positionBuilder.NewTokenPosition($3))
- $$ = expr.NewPropertyFetch(variable, fetch)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $3))
-
- yylex.(*Parser).comments.AddComments(identifier, $1.Comments())
- yylex.(*Parser).comments.AddComments(variable, $1.Comments())
- yylex.(*Parser).comments.AddComments(fetch, $3.Comments())
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
- }
+ {
+ identifier := node.NewIdentifier(strings.TrimLeft($1.Value, "$"))
+ variable := expr.NewVariable(identifier)
+ fetch := node.NewIdentifier($3.Value)
+ $$ = expr.NewPropertyFetch(variable, fetch)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
+ yylex.(*Parser).positions.AddPosition(variable, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
+ yylex.(*Parser).positions.AddPosition(fetch, yylex.(*Parser).positionBuilder.NewTokenPosition($3))
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $3))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(variable, $1, comment.VariableToken)
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.ObjectOperatorToken)
+ yylex.(*Parser).comments.AddFromToken(fetch, $3, comment.StringToken)
+ }
| T_DOLLAR_OPEN_CURLY_BRACES expr '}'
- {
- $$ = expr.NewVariable($2)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $3))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
- }
+ {
+ $$ = expr.NewVariable($2)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $3))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.DollarOpenCurlyBracesToken)
+ yylex.(*Parser).comments.AddFromToken($$, $3, comment.CloseCurlyBracesToken)
+ }
| T_DOLLAR_OPEN_CURLY_BRACES T_STRING_VARNAME '}'
- {
- name := node.NewIdentifier($2.Value)
- yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewTokenPosition($2))
- $$ = expr.NewVariable(name)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $3))
+ {
+ name := node.NewIdentifier($2.Value)
+ $$ = expr.NewVariable(name)
- yylex.(*Parser).comments.AddComments(name, $2.Comments())
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
- }
+ // save position
+ yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewTokenPosition($2))
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $3))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.DollarOpenCurlyBracesToken)
+ yylex.(*Parser).comments.AddFromToken(name, $2, comment.StringVarnameToken)
+ yylex.(*Parser).comments.AddFromToken($$, $3, comment.CloseCurlyBracesToken)
+ }
| T_DOLLAR_OPEN_CURLY_BRACES T_STRING_VARNAME '[' expr ']' '}'
- {
- identifier := node.NewIdentifier($2.Value)
- yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition($2))
- variable := expr.NewVariable(identifier)
- yylex.(*Parser).positions.AddPosition(variable, yylex.(*Parser).positionBuilder.NewTokenPosition($2))
- $$ = expr.NewArrayDimFetch(variable, $4)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $6))
+ {
+ identifier := node.NewIdentifier($2.Value)
+ variable := expr.NewVariable(identifier)
+ $$ = expr.NewArrayDimFetch(variable, $4)
+ // save position
+ yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition($2))
+ yylex.(*Parser).positions.AddPosition(variable, yylex.(*Parser).positionBuilder.NewTokenPosition($2))
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $6))
- yylex.(*Parser).comments.AddComments(identifier, $2.Comments())
- yylex.(*Parser).comments.AddComments(variable, $1.Comments())
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
- }
- | T_CURLY_OPEN variable '}' { $$ = $2; }
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.DollarOpenCurlyBracesToken)
+ yylex.(*Parser).comments.AddFromToken(variable, $2, comment.StringVarnameToken)
+ yylex.(*Parser).comments.AddFromToken($$, $3, comment.OpenSquareBracket)
+ yylex.(*Parser).comments.AddFromToken($$, $5, comment.CloseSquareBracket)
+ yylex.(*Parser).comments.AddFromToken($$, $6, comment.CloseCurlyBracesToken)
+ }
+ | T_CURLY_OPEN variable '}'
+ {
+ $$ = $2;
+ }
;
+
encaps_var_offset:
- T_STRING
- {
- $$ = scalar.NewString($1.Value)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
- }
- | T_NUM_STRING
- {
- // TODO: add option to handle 64 bit integer
- if _, err := strconv.Atoi($1.Value); err == nil {
- $$ = scalar.NewLnumber($1.Value)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
- } else {
+ T_STRING
+ {
$$ = scalar.NewString($1.Value)
+
+ // save position
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.StringToken)
+ }
+ | T_NUM_STRING
+ {
+ // TODO: add option to handle 64 bit integer
+ if _, err := strconv.Atoi($1.Value); err == nil {
+ $$ = scalar.NewLnumber($1.Value)
+ } else {
+ $$ = scalar.NewString($1.Value)
+ }
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.NumStringToken)
}
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
- }
| '-' T_NUM_STRING
- {
- // TODO: add option to handle 64 bit integer
- if _, err := strconv.Atoi($2.Value); err == nil {
- lnumber := scalar.NewLnumber($2.Value)
- yylex.(*Parser).positions.AddPosition(lnumber, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $2))
- $$ = expr.NewUnaryMinus(lnumber)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $2))
-
- yylex.(*Parser).comments.AddComments(lnumber, $1.Comments())
- } else {
- $2.Value = "-"+$2.Value
- $$ = scalar.NewString($2.Value)
+ {
+ var lnumber *scalar.Lnumber
+ // TODO: add option to handle 64 bit integer
+ _, err := strconv.Atoi($2.Value);
+ isInt := err == nil
+
+ if isInt {
+ lnumber = scalar.NewLnumber($2.Value)
+ $$ = expr.NewUnaryMinus(lnumber)
+ } else {
+ $2.Value = "-"+$2.Value
+ $$ = scalar.NewString($2.Value)
+ }
+
+ // save position
+ if isInt {
+ yylex.(*Parser).positions.AddPosition(lnumber, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $2))
+ }
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $2))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.MinusToken)
+ if isInt {
+ yylex.(*Parser).comments.AddFromToken(lnumber, $2, comment.NumStringToken)
+ } else {
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.NumStringToken)
+ }
}
-
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
- }
| T_VARIABLE
- {
- identifier := node.NewIdentifier(strings.TrimLeft($1.Value, "$"))
- yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
- $$ = expr.NewVariable(identifier)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
+ {
+ identifier := node.NewIdentifier(strings.TrimLeft($1.Value, "$"))
+ $$ = expr.NewVariable(identifier)
- yylex.(*Parser).comments.AddComments(identifier, $1.Comments())
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
- }
+ // save position
+ yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenPosition($1))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.VariableToken)
+ }
;
internal_functions_in_yacc:
- T_ISSET '(' isset_variables possible_comma ')'
- {
- $$ = expr.NewIsset($3)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $5))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
- }
+ T_ISSET '(' isset_variables possible_comma ')'
+ {
+ $$ = expr.NewIsset($3)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $5))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.IssetToken)
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.OpenParenthesisToken)
+ if $4 != nil {
+ yylex.(*Parser).comments.AddFromToken($$, $4, comment.CommaToken)
+ }
+ yylex.(*Parser).comments.AddFromToken($$, $5, comment.CloseParenthesisToken)
+ }
| T_EMPTY '(' expr ')'
- {
- $$ = expr.NewEmpty($3)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $4))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
- }
+ {
+ $$ = expr.NewEmpty($3)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $4))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.EmptyToken)
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.OpenParenthesisToken)
+ yylex.(*Parser).comments.AddFromToken($$, $4, comment.CloseParenthesisToken)
+ }
| T_INCLUDE expr
- {
- $$ = expr.NewInclude($2)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $2))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
- }
+ {
+ $$ = expr.NewInclude($2)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $2))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.IncludeToken)
+ }
| T_INCLUDE_ONCE expr
- {
- $$ = expr.NewIncludeOnce($2)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $2))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
- }
+ {
+ $$ = expr.NewIncludeOnce($2)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $2))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.IncludeOnceToken)
+ }
| T_EVAL '(' expr ')'
- {
- $$ = expr.NewEval($3)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $4))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
- }
+ {
+ $$ = expr.NewEval($3)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $4))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.EvalToken)
+ yylex.(*Parser).comments.AddFromToken($$, $2, comment.OpenParenthesisToken)
+ yylex.(*Parser).comments.AddFromToken($$, $4, comment.CloseParenthesisToken)
+ }
| T_REQUIRE expr
- {
- $$ = expr.NewRequire($2)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $2))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
- }
+ {
+ $$ = expr.NewRequire($2)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $2))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.RequireToken)
+ }
| T_REQUIRE_ONCE expr
- {
- $$ = expr.NewRequireOnce($2)
- yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $2))
- yylex.(*Parser).comments.AddComments($$, $1.Comments())
- }
+ {
+ $$ = expr.NewRequireOnce($2)
+
+ // save position
+ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $2))
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken($$, $1, comment.RequireOnceToken)
+ }
;
isset_variables:
- isset_variable { $$ = []node.Node{$1} }
- | isset_variables ',' isset_variable { $$ = append($1, $3) }
+ isset_variable
+ { $$ = []node.Node{$1} }
+ | isset_variables ',' isset_variable
+ {
+ $$ = append($1, $3)
+
+ // save comments
+ yylex.(*Parser).comments.AddFromToken(lastNode($1), $2, comment.CommaToken)
+ }
;
isset_variable:
- expr { $$ = $1 }
+ expr
+ { $$ = $1 }
;
/////////////////////////////////////////////////////////////////////////
%%
-
-type foreachVariable struct {
- node node.Node
- byRef bool
-}
-
-type nodesWithEndToken struct {
- nodes []node.Node
- endToken token.Token
-}
-
-type boolWithToken struct {
- value bool
- token *token.Token
-}
-
-type altSyntaxNode struct {
- node node.Node
- isAlt bool
-}
\ No newline at end of file
diff --git a/php7/php7_test.go b/php7/php7_test.go
index 3b3c49c..b466d4e 100644
--- a/php7/php7_test.go
+++ b/php7/php7_test.go
@@ -397,23 +397,27 @@ func TestPhp7(t *testing.T) {
},
}
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Expression{
Expr: &expr.FunctionCall{
Function: &name.Name{Parts: []node.Node{&name.NamePart{Value: "foo"}}},
- Arguments: []node.Node{
- &node.Argument{Variadic: false, Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}}},
- &node.Argument{Variadic: true, Expr: &expr.Variable{VarName: &node.Identifier{Value: "b"}}},
+ ArgumentList: &node.ArgumentList{
+ Arguments: []node.Node{
+ &node.Argument{Variadic: false, Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}}},
+ &node.Argument{Variadic: true, Expr: &expr.Variable{VarName: &node.Identifier{Value: "b"}}},
+ },
},
},
},
&stmt.Expression{
Expr: &expr.FunctionCall{
Function: &expr.Variable{VarName: &node.Identifier{Value: "foo"}},
- Arguments: []node.Node{
- &node.Argument{Variadic: false, Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}}},
- &node.Argument{Variadic: true, Expr: &expr.Variable{VarName: &node.Identifier{Value: "b"}}},
+ ArgumentList: &node.ArgumentList{
+ Arguments: []node.Node{
+ &node.Argument{Variadic: false, Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}}},
+ &node.Argument{Variadic: true, Expr: &expr.Variable{VarName: &node.Identifier{Value: "b"}}},
+ },
},
},
},
@@ -421,9 +425,11 @@ func TestPhp7(t *testing.T) {
Expr: &expr.MethodCall{
Variable: &expr.Variable{VarName: &node.Identifier{Value: "foo"}},
Method: &node.Identifier{Value: "bar"},
- Arguments: []node.Node{
- &node.Argument{Variadic: false, Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}}},
- &node.Argument{Variadic: true, Expr: &expr.Variable{VarName: &node.Identifier{Value: "b"}}},
+ ArgumentList: &node.ArgumentList{
+ Arguments: []node.Node{
+ &node.Argument{Variadic: false, Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}}},
+ &node.Argument{Variadic: true, Expr: &expr.Variable{VarName: &node.Identifier{Value: "b"}}},
+ },
},
},
},
@@ -431,9 +437,11 @@ func TestPhp7(t *testing.T) {
Expr: &expr.StaticCall{
Class: &name.Name{Parts: []node.Node{&name.NamePart{Value: "foo"}}},
Call: &node.Identifier{Value: "bar"},
- Arguments: []node.Node{
- &node.Argument{Variadic: false, Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}}},
- &node.Argument{Variadic: true, Expr: &expr.Variable{VarName: &node.Identifier{Value: "b"}}},
+ ArgumentList: &node.ArgumentList{
+ Arguments: []node.Node{
+ &node.Argument{Variadic: false, Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}}},
+ &node.Argument{Variadic: true, Expr: &expr.Variable{VarName: &node.Identifier{Value: "b"}}},
+ },
},
},
},
@@ -441,18 +449,22 @@ func TestPhp7(t *testing.T) {
Expr: &expr.StaticCall{
Class: &expr.Variable{VarName: &node.Identifier{Value: "foo"}},
Call: &node.Identifier{Value: "bar"},
- Arguments: []node.Node{
- &node.Argument{Variadic: false, Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}}},
- &node.Argument{Variadic: true, Expr: &expr.Variable{VarName: &node.Identifier{Value: "b"}}},
+ ArgumentList: &node.ArgumentList{
+ Arguments: []node.Node{
+ &node.Argument{Variadic: false, Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}}},
+ &node.Argument{Variadic: true, Expr: &expr.Variable{VarName: &node.Identifier{Value: "b"}}},
+ },
},
},
},
&stmt.Expression{
Expr: &expr.New{
Class: &name.Name{Parts: []node.Node{&name.NamePart{Value: "foo"}}},
- Arguments: []node.Node{
- &node.Argument{Variadic: false, Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}}},
- &node.Argument{Variadic: true, Expr: &expr.Variable{VarName: &node.Identifier{Value: "b"}}},
+ ArgumentList: &node.ArgumentList{
+ Arguments: []node.Node{
+ &node.Argument{Variadic: false, Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}}},
+ &node.Argument{Variadic: true, Expr: &expr.Variable{VarName: &node.Identifier{Value: "b"}}},
+ },
},
},
},
@@ -460,9 +472,11 @@ func TestPhp7(t *testing.T) {
Expr: &expr.New{
Class: &stmt.Class{
PhpDocComment: "/** anonymous class */",
- Args: []node.Node{
- &node.Argument{Variadic: false, Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}}},
- &node.Argument{Variadic: true, Expr: &expr.Variable{VarName: &node.Identifier{Value: "b"}}},
+ ArgumentList: &node.ArgumentList{
+ Arguments: []node.Node{
+ &node.Argument{Variadic: false, Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}}},
+ &node.Argument{Variadic: true, Expr: &expr.Variable{VarName: &node.Identifier{Value: "b"}}},
+ },
},
Stmts: []node.Node{},
},
@@ -535,14 +549,15 @@ func TestPhp7(t *testing.T) {
MethodName: &node.Identifier{Value: "foo"},
Modifiers: []node.Node{&node.Identifier{Value: "public"}},
Params: expectedParams,
- Stmts: []node.Node{},
+ Stmt: &stmt.StmtList{
+ Stmts: []node.Node{},
+ },
},
},
},
&stmt.Expression{
Expr: &expr.Closure{
Params: expectedParams,
- Uses: []node.Node{},
Stmts: []node.Node{},
},
},
@@ -550,7 +565,6 @@ func TestPhp7(t *testing.T) {
Expr: &expr.Closure{
Static: true,
Params: expectedParams,
- Uses: []node.Node{},
Stmts: []node.Node{},
},
},
@@ -730,9 +744,10 @@ func TestPhp7(t *testing.T) {
Parts: []node.Node{
&scalar.EncapsedStringPart{Value: "test "},
&expr.MethodCall{
- Variable: &expr.Variable{VarName: &node.Identifier{Value: "foo"}},
- Method: &node.Identifier{Value: "bar"},
- Arguments: []node.Node{},
+ Variable: &expr.Variable{VarName: &node.Identifier{Value: "foo"}},
+ Method: &node.Identifier{Value: "bar"},
+
+ ArgumentList: &node.ArgumentList{},
},
},
},
@@ -851,7 +866,9 @@ func TestPhp7(t *testing.T) {
&stmt.ClassMethod{
PhpDocComment: "",
MethodName: &node.Identifier{Value: "bar"},
- Stmts: []node.Node{},
+ Stmt: &stmt.StmtList{
+ Stmts: []node.Node{},
+ },
},
},
},
@@ -866,7 +883,9 @@ func TestPhp7(t *testing.T) {
&node.Identifier{Value: "public"},
&node.Identifier{Value: "static"},
},
- Stmts: []node.Node{},
+ Stmt: &stmt.StmtList{
+ Stmts: []node.Node{},
+ },
},
},
},
@@ -886,7 +905,9 @@ func TestPhp7(t *testing.T) {
&name.NamePart{Value: "void"},
},
},
- Stmts: []node.Node{},
+ Stmt: &stmt.StmtList{
+ Stmts: []node.Node{},
+ },
},
},
},
@@ -902,20 +923,8 @@ func TestPhp7(t *testing.T) {
Modifiers: []node.Node{
&node.Identifier{Value: "final"},
},
- Extends: &name.Name{
- Parts: []node.Node{
- &name.NamePart{Value: "bar"},
- },
- },
- Stmts: []node.Node{},
- },
- &stmt.Class{
- ClassName: &node.Identifier{Value: "foo"},
- Modifiers: []node.Node{
- &node.Identifier{Value: "final"},
- },
- Implements: []node.Node{
- &name.Name{
+ Extends: &stmt.ClassExtends{
+ ClassName: &name.Name{
Parts: []node.Node{
&name.NamePart{Value: "bar"},
},
@@ -928,15 +937,33 @@ func TestPhp7(t *testing.T) {
Modifiers: []node.Node{
&node.Identifier{Value: "final"},
},
- Implements: []node.Node{
- &name.Name{
- Parts: []node.Node{
- &name.NamePart{Value: "bar"},
+ Implements: &stmt.ClassImplements{
+ InterfaceNames: []node.Node{
+ &name.Name{
+ Parts: []node.Node{
+ &name.NamePart{Value: "bar"},
+ },
},
},
- &name.Name{
- Parts: []node.Node{
- &name.NamePart{Value: "baz"},
+ },
+ Stmts: []node.Node{},
+ },
+ &stmt.Class{
+ ClassName: &node.Identifier{Value: "foo"},
+ Modifiers: []node.Node{
+ &node.Identifier{Value: "final"},
+ },
+ Implements: &stmt.ClassImplements{
+ InterfaceNames: []node.Node{
+ &name.Name{
+ Parts: []node.Node{
+ &name.NamePart{Value: "bar"},
+ },
+ },
+ &name.Name{
+ Parts: []node.Node{
+ &name.NamePart{Value: "baz"},
+ },
},
},
},
@@ -945,21 +972,26 @@ func TestPhp7(t *testing.T) {
&stmt.Expression{
Expr: &expr.New{
Class: &stmt.Class{
- Args: []node.Node{},
- Extends: &name.Name{
- Parts: []node.Node{
- &name.NamePart{Value: "foo"},
- },
- },
- Implements: []node.Node{
- &name.Name{
+
+ ArgumentList: &node.ArgumentList{},
+ Extends: &stmt.ClassExtends{
+ ClassName: &name.Name{
Parts: []node.Node{
- &name.NamePart{Value: "bar"},
+ &name.NamePart{Value: "foo"},
},
},
- &name.Name{
- Parts: []node.Node{
- &name.NamePart{Value: "baz"},
+ },
+ Implements: &stmt.ClassImplements{
+ InterfaceNames: []node.Node{
+ &name.Name{
+ Parts: []node.Node{
+ &name.NamePart{Value: "bar"},
+ },
+ },
+ &name.Name{
+ Parts: []node.Node{
+ &name.NamePart{Value: "baz"},
+ },
},
},
},
@@ -1121,35 +1153,32 @@ func TestPhp7(t *testing.T) {
Stmt: &stmt.StmtList{Stmts: []node.Node{}},
},
&stmt.Foreach{
- ByRef: true,
- Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
- Key: &expr.Variable{VarName: &node.Identifier{Value: "k"}},
- Variable: &expr.Variable{VarName: &node.Identifier{Value: "v"}},
- Stmt: &stmt.StmtList{Stmts: []node.Node{}},
+ Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
+ Key: &expr.Variable{VarName: &node.Identifier{Value: "k"}},
+ Variable: &expr.Reference{
+ Variable: &expr.Variable{VarName: &node.Identifier{Value: "v"}},
+ },
+ Stmt: &stmt.StmtList{Stmts: []node.Node{}},
},
&stmt.Foreach{
- ByRef: false,
- Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
- Key: &expr.Variable{VarName: &node.Identifier{Value: "k"}},
+ Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
+ Key: &expr.Variable{VarName: &node.Identifier{Value: "k"}},
Variable: &expr.List{
Items: []node.Node{
&expr.ArrayItem{
- ByRef: false,
- Val: &expr.Variable{VarName: &node.Identifier{Value: "v"}},
+ Val: &expr.Variable{VarName: &node.Identifier{Value: "v"}},
},
},
},
Stmt: &stmt.StmtList{Stmts: []node.Node{}},
},
&stmt.Foreach{
- ByRef: false,
- Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
- Key: &expr.Variable{VarName: &node.Identifier{Value: "k"}},
+ Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
+ Key: &expr.Variable{VarName: &node.Identifier{Value: "k"}},
Variable: &expr.ShortList{
Items: []node.Node{
&expr.ArrayItem{
- ByRef: false,
- Val: &expr.Variable{VarName: &node.Identifier{Value: "v"}},
+ Val: &expr.Variable{VarName: &node.Identifier{Value: "v"}},
},
},
},
@@ -1270,10 +1299,12 @@ func TestPhp7(t *testing.T) {
&stmt.Interface{
PhpDocComment: "",
InterfaceName: &node.Identifier{Value: "Foo"},
- Extends: []node.Node{
- &name.Name{
- Parts: []node.Node{
- &name.NamePart{Value: "Bar"},
+ Extends: &stmt.InterfaceExtends{
+ InterfaceNames: []node.Node{
+ &name.Name{
+ Parts: []node.Node{
+ &name.NamePart{Value: "Bar"},
+ },
},
},
},
@@ -1282,15 +1313,17 @@ func TestPhp7(t *testing.T) {
&stmt.Interface{
PhpDocComment: "",
InterfaceName: &node.Identifier{Value: "Foo"},
- Extends: []node.Node{
- &name.Name{
- Parts: []node.Node{
- &name.NamePart{Value: "Bar"},
+ Extends: &stmt.InterfaceExtends{
+ InterfaceNames: []node.Node{
+ &name.Name{
+ Parts: []node.Node{
+ &name.NamePart{Value: "Bar"},
+ },
},
- },
- &name.Name{
- Parts: []node.Node{
- &name.NamePart{Value: "Baz"},
+ &name.Name{
+ Parts: []node.Node{
+ &name.NamePart{Value: "Baz"},
+ },
},
},
},
@@ -1365,63 +1398,71 @@ func TestPhp7(t *testing.T) {
},
&stmt.AltSwitch{
Cond: &scalar.Lnumber{Value: "1"},
- Cases: []node.Node{
- &stmt.Case{
- Cond: &scalar.Lnumber{Value: "1"},
- Stmts: []node.Node{},
- },
- &stmt.Default{
- Stmts: []node.Node{},
- },
- &stmt.Case{
- Cond: &scalar.Lnumber{Value: "2"},
- Stmts: []node.Node{},
+ CaseList: &stmt.CaseList{
+ Cases: []node.Node{
+ &stmt.Case{
+ Cond: &scalar.Lnumber{Value: "1"},
+ Stmts: []node.Node{},
+ },
+ &stmt.Default{
+ Stmts: []node.Node{},
+ },
+ &stmt.Case{
+ Cond: &scalar.Lnumber{Value: "2"},
+ Stmts: []node.Node{},
+ },
},
},
},
&stmt.AltSwitch{
Cond: &scalar.Lnumber{Value: "1"},
- Cases: []node.Node{
- &stmt.Case{
- Cond: &scalar.Lnumber{Value: "1"},
- Stmts: []node.Node{},
- },
- &stmt.Case{
- Cond: &scalar.Lnumber{Value: "2"},
- Stmts: []node.Node{},
- },
- },
- },
- &stmt.Switch{
- Cond: &scalar.Lnumber{Value: "1"},
- Cases: []node.Node{
- &stmt.Case{
- Cond: &scalar.Lnumber{Value: "1"},
- Stmts: []node.Node{
- &stmt.Break{},
+ CaseList: &stmt.CaseList{
+ Cases: []node.Node{
+ &stmt.Case{
+ Cond: &scalar.Lnumber{Value: "1"},
+ Stmts: []node.Node{},
},
- },
- &stmt.Case{
- Cond: &scalar.Lnumber{Value: "2"},
- Stmts: []node.Node{
- &stmt.Break{},
+ &stmt.Case{
+ Cond: &scalar.Lnumber{Value: "2"},
+ Stmts: []node.Node{},
},
},
},
},
&stmt.Switch{
Cond: &scalar.Lnumber{Value: "1"},
- Cases: []node.Node{
- &stmt.Case{
- Cond: &scalar.Lnumber{Value: "1"},
- Stmts: []node.Node{
- &stmt.Break{},
+ CaseList: &stmt.CaseList{
+ Cases: []node.Node{
+ &stmt.Case{
+ Cond: &scalar.Lnumber{Value: "1"},
+ Stmts: []node.Node{
+ &stmt.Break{},
+ },
+ },
+ &stmt.Case{
+ Cond: &scalar.Lnumber{Value: "2"},
+ Stmts: []node.Node{
+ &stmt.Break{},
+ },
},
},
- &stmt.Case{
- Cond: &scalar.Lnumber{Value: "2"},
- Stmts: []node.Node{
- &stmt.Break{},
+ },
+ },
+ &stmt.Switch{
+ Cond: &scalar.Lnumber{Value: "1"},
+ CaseList: &stmt.CaseList{
+ Cases: []node.Node{
+ &stmt.Case{
+ Cond: &scalar.Lnumber{Value: "1"},
+ Stmts: []node.Node{
+ &stmt.Break{},
+ },
+ },
+ &stmt.Case{
+ Cond: &scalar.Lnumber{Value: "2"},
+ Stmts: []node.Node{
+ &stmt.Break{},
+ },
},
},
},
@@ -1466,6 +1507,7 @@ func TestPhp7(t *testing.T) {
},
},
},
+ TraitAdaptationList: &stmt.TraitAdaptationList{},
},
},
},
@@ -1486,12 +1528,14 @@ func TestPhp7(t *testing.T) {
},
},
},
- Adaptations: []node.Node{
- &stmt.TraitUseAlias{
- Ref: &stmt.TraitMethodRef{
- Method: &node.Identifier{Value: "one"},
+ TraitAdaptationList: &stmt.TraitAdaptationList{
+ Adaptations: []node.Node{
+ &stmt.TraitUseAlias{
+ Ref: &stmt.TraitMethodRef{
+ Method: &node.Identifier{Value: "one"},
+ },
+ Alias: &node.Identifier{Value: "include"},
},
- Alias: &node.Identifier{Value: "include"},
},
},
},
@@ -1514,12 +1558,14 @@ func TestPhp7(t *testing.T) {
},
},
},
- Adaptations: []node.Node{
- &stmt.TraitUseAlias{
- Ref: &stmt.TraitMethodRef{
- Method: &node.Identifier{Value: "one"},
+ TraitAdaptationList: &stmt.TraitAdaptationList{
+ Adaptations: []node.Node{
+ &stmt.TraitUseAlias{
+ Ref: &stmt.TraitMethodRef{
+ Method: &node.Identifier{Value: "one"},
+ },
+ Modifier: &node.Identifier{Value: "public"},
},
- Modifier: &node.Identifier{Value: "public"},
},
},
},
@@ -1542,13 +1588,15 @@ func TestPhp7(t *testing.T) {
},
},
},
- Adaptations: []node.Node{
- &stmt.TraitUseAlias{
- Ref: &stmt.TraitMethodRef{
- Method: &node.Identifier{Value: "one"},
+ TraitAdaptationList: &stmt.TraitAdaptationList{
+ Adaptations: []node.Node{
+ &stmt.TraitUseAlias{
+ Ref: &stmt.TraitMethodRef{
+ Method: &node.Identifier{Value: "one"},
+ },
+ Modifier: &node.Identifier{Value: "public"},
+ Alias: &node.Identifier{Value: "two"},
},
- Modifier: &node.Identifier{Value: "public"},
- Alias: &node.Identifier{Value: "two"},
},
},
},
@@ -1571,39 +1619,41 @@ func TestPhp7(t *testing.T) {
},
},
},
- Adaptations: []node.Node{
- &stmt.TraitUsePrecedence{
- Ref: &stmt.TraitMethodRef{
- Trait: &name.Name{
- Parts: []node.Node{
- &name.NamePart{Value: "Bar"},
+ TraitAdaptationList: &stmt.TraitAdaptationList{
+ Adaptations: []node.Node{
+ &stmt.TraitUsePrecedence{
+ Ref: &stmt.TraitMethodRef{
+ Trait: &name.Name{
+ Parts: []node.Node{
+ &name.NamePart{Value: "Bar"},
+ },
},
+ Method: &node.Identifier{Value: "one"},
},
- Method: &node.Identifier{Value: "one"},
- },
- Insteadof: []node.Node{
- &name.Name{
- Parts: []node.Node{
- &name.NamePart{Value: "Baz"},
+ Insteadof: []node.Node{
+ &name.Name{
+ Parts: []node.Node{
+ &name.NamePart{Value: "Baz"},
+ },
},
- },
- &name.Name{
- Parts: []node.Node{
- &name.NamePart{Value: "Quux"},
+ &name.Name{
+ Parts: []node.Node{
+ &name.NamePart{Value: "Quux"},
+ },
},
},
},
- },
- &stmt.TraitUseAlias{
- Ref: &stmt.TraitMethodRef{
- Trait: &name.Name{
- Parts: []node.Node{
- &name.NamePart{Value: "Baz"},
+ &stmt.TraitUseAlias{
+ Ref: &stmt.TraitMethodRef{
+ Trait: &name.Name{
+ Parts: []node.Node{
+ &name.NamePart{Value: "Baz"},
+ },
},
+ Method: &node.Identifier{Value: "one"},
},
- Method: &node.Identifier{Value: "one"},
+ Alias: &node.Identifier{Value: "two"},
},
- Alias: &node.Identifier{Value: "two"},
},
},
},
@@ -2007,8 +2057,7 @@ func TestPhp7(t *testing.T) {
Expr: &expr.Array{
Items: []node.Node{
&expr.ArrayItem{
- ByRef: false,
- Val: &scalar.Lnumber{Value: "1"},
+ Val: &scalar.Lnumber{Value: "1"},
},
},
},
@@ -2017,13 +2066,11 @@ func TestPhp7(t *testing.T) {
Expr: &expr.Array{
Items: []node.Node{
&expr.ArrayItem{
- ByRef: false,
- Key: &scalar.Lnumber{Value: "1"},
- Val: &scalar.Lnumber{Value: "1"},
+ Key: &scalar.Lnumber{Value: "1"},
+ Val: &scalar.Lnumber{Value: "1"},
},
&expr.ArrayItem{
- ByRef: true,
- Val: &expr.Variable{VarName: &node.Identifier{Value: "b"}},
+ Val: &expr.Reference{Variable: &expr.Variable{VarName: &node.Identifier{Value: "b"}}},
},
},
},
@@ -2069,7 +2116,6 @@ func TestPhp7(t *testing.T) {
ReturnsRef: false,
Static: false,
PhpDocComment: "",
- Uses: []node.Node{},
Stmts: []node.Node{},
},
},
@@ -2090,14 +2136,10 @@ func TestPhp7(t *testing.T) {
Variable: &expr.Variable{VarName: &node.Identifier{Value: "b"}},
},
},
- Uses: []node.Node{
- &expr.ClosureUse{
- ByRef: false,
- Variable: &expr.Variable{VarName: &node.Identifier{Value: "c"}},
- },
- &expr.ClosureUse{
- ByRef: true,
- Variable: &expr.Variable{VarName: &node.Identifier{Value: "d"}},
+ ClosureUse: &expr.ClosureUse{
+ Uses: []node.Node{
+ &expr.Variable{VarName: &node.Identifier{Value: "c"}},
+ &expr.Reference{Variable: &expr.Variable{VarName: &node.Identifier{Value: "d"}}},
},
},
Stmts: []node.Node{},
@@ -2108,7 +2150,6 @@ func TestPhp7(t *testing.T) {
ReturnsRef: false,
Static: false,
PhpDocComment: "",
- Uses: []node.Node{},
ReturnType: &name.Name{
Parts: []node.Node{&name.NamePart{Value: "void"}},
},
@@ -2168,7 +2209,8 @@ func TestPhp7(t *testing.T) {
&name.NamePart{Value: "foo"},
},
},
- Arguments: []node.Node{},
+
+ ArgumentList: &node.ArgumentList{},
},
},
&stmt.Expression{
@@ -2178,7 +2220,8 @@ func TestPhp7(t *testing.T) {
&name.NamePart{Value: "foo"},
},
},
- Arguments: []node.Node{},
+
+ ArgumentList: &node.ArgumentList{},
},
},
&stmt.Expression{
@@ -2188,13 +2231,15 @@ func TestPhp7(t *testing.T) {
&name.NamePart{Value: "foo"},
},
},
- Arguments: []node.Node{},
+
+ ArgumentList: &node.ArgumentList{},
},
},
&stmt.Expression{
Expr: &expr.FunctionCall{
- Function: &expr.Variable{VarName: &node.Identifier{Value: "foo"}},
- Arguments: []node.Node{},
+ Function: &expr.Variable{VarName: &node.Identifier{Value: "foo"}},
+
+ ArgumentList: &node.ArgumentList{},
},
},
&stmt.Expression{
@@ -2280,8 +2325,7 @@ func TestPhp7(t *testing.T) {
Variable: &expr.List{
Items: []node.Node{
&expr.ArrayItem{
- ByRef: false,
- Val: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
+ Val: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
},
},
},
@@ -2293,7 +2337,6 @@ func TestPhp7(t *testing.T) {
Variable: &expr.List{
Items: []node.Node{
&expr.ArrayItem{
- ByRef: false,
Val: &expr.ArrayDimFetch{
Variable: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
},
@@ -2308,12 +2351,10 @@ func TestPhp7(t *testing.T) {
Variable: &expr.List{
Items: []node.Node{
&expr.ArrayItem{
- ByRef: false,
Val: &expr.List{
Items: []node.Node{
&expr.ArrayItem{
- ByRef: false,
- Val: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
+ Val: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
},
},
},
@@ -2325,9 +2366,10 @@ func TestPhp7(t *testing.T) {
},
&stmt.Expression{
Expr: &expr.MethodCall{
- Variable: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
- Method: &node.Identifier{Value: "foo"},
- Arguments: []node.Node{},
+ Variable: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
+ Method: &node.Identifier{Value: "foo"},
+
+ ArgumentList: &node.ArgumentList{},
},
},
&stmt.Expression{
@@ -2337,7 +2379,8 @@ func TestPhp7(t *testing.T) {
&name.NamePart{Value: "Foo"},
},
},
- Arguments: []node.Node{},
+
+ ArgumentList: &node.ArgumentList{},
},
},
&stmt.Expression{
@@ -2347,7 +2390,8 @@ func TestPhp7(t *testing.T) {
&name.NamePart{Value: "Foo"},
},
},
- Arguments: []node.Node{},
+
+ ArgumentList: &node.ArgumentList{},
},
},
&stmt.Expression{
@@ -2357,16 +2401,20 @@ func TestPhp7(t *testing.T) {
&name.NamePart{Value: "Foo"},
},
},
- Arguments: []node.Node{},
+
+ ArgumentList: &node.ArgumentList{},
},
},
&stmt.Expression{
Expr: &expr.New{
Class: &stmt.Class{
PhpDocComment: "",
- Args: []node.Node{
- &node.Argument{Variadic: false, Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}}},
- &node.Argument{Variadic: true, Expr: &expr.Variable{VarName: &node.Identifier{Value: "b"}}},
+
+ ArgumentList: &node.ArgumentList{
+ Arguments: []node.Node{
+ &node.Argument{Variadic: false, Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}}},
+ &node.Argument{Variadic: true, Expr: &expr.Variable{VarName: &node.Identifier{Value: "b"}}},
+ },
},
Stmts: []node.Node{},
},
@@ -2412,8 +2460,7 @@ func TestPhp7(t *testing.T) {
Expr: &expr.ShortArray{
Items: []node.Node{
&expr.ArrayItem{
- ByRef: false,
- Val: &scalar.Lnumber{Value: "1"},
+ Val: &scalar.Lnumber{Value: "1"},
},
},
},
@@ -2422,13 +2469,11 @@ func TestPhp7(t *testing.T) {
Expr: &expr.ShortArray{
Items: []node.Node{
&expr.ArrayItem{
- ByRef: false,
- Key: &scalar.Lnumber{Value: "1"},
- Val: &scalar.Lnumber{Value: "1"},
+ Key: &scalar.Lnumber{Value: "1"},
+ Val: &scalar.Lnumber{Value: "1"},
},
&expr.ArrayItem{
- ByRef: true,
- Val: &expr.Variable{VarName: &node.Identifier{Value: "b"}},
+ Val: &expr.Reference{Variable: &expr.Variable{VarName: &node.Identifier{Value: "b"}}},
},
},
},
@@ -2438,8 +2483,7 @@ func TestPhp7(t *testing.T) {
Variable: &expr.ShortList{
Items: []node.Node{
&expr.ArrayItem{
- ByRef: false,
- Val: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
+ Val: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
},
},
},
@@ -2451,7 +2495,6 @@ func TestPhp7(t *testing.T) {
Variable: &expr.ShortList{
Items: []node.Node{
&expr.ArrayItem{
- ByRef: false,
Val: &expr.ArrayDimFetch{
Variable: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
},
@@ -2466,12 +2509,10 @@ func TestPhp7(t *testing.T) {
Variable: &expr.ShortList{
Items: []node.Node{
&expr.ArrayItem{
- ByRef: false,
Val: &expr.List{
Items: []node.Node{
&expr.ArrayItem{
- ByRef: false,
- Val: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
+ Val: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
},
},
},
@@ -2488,8 +2529,9 @@ func TestPhp7(t *testing.T) {
&name.NamePart{Value: "Foo"},
},
},
- Call: &node.Identifier{Value: "bar"},
- Arguments: []node.Node{},
+ Call: &node.Identifier{Value: "bar"},
+
+ ArgumentList: &node.ArgumentList{},
},
},
&stmt.Expression{
@@ -2499,8 +2541,9 @@ func TestPhp7(t *testing.T) {
&name.NamePart{Value: "Foo"},
},
},
- Call: &node.Identifier{Value: "bar"},
- Arguments: []node.Node{},
+ Call: &node.Identifier{Value: "bar"},
+
+ ArgumentList: &node.ArgumentList{},
},
},
&stmt.Expression{
@@ -2510,8 +2553,9 @@ func TestPhp7(t *testing.T) {
&name.NamePart{Value: "Foo"},
},
},
- Call: &node.Identifier{Value: "bar"},
- Arguments: []node.Node{},
+ Call: &node.Identifier{Value: "bar"},
+
+ ArgumentList: &node.ArgumentList{},
},
},
&stmt.Expression{
@@ -2919,7 +2963,9 @@ func TestPhp7(t *testing.T) {
&stmt.ClassMethod{
MethodName: &node.Identifier{Value: "class"},
Modifiers: []node.Node{&node.Identifier{Value: "public"}},
- Stmts: []node.Node{},
+ Stmt: &stmt.StmtList{
+ Stmts: []node.Node{},
+ },
},
},
},
@@ -2931,7 +2977,8 @@ func TestPhp7(t *testing.T) {
&name.NamePart{Value: "bar"},
},
},
- Arguments: []node.Node{},
+
+ ArgumentList: &node.ArgumentList{},
},
},
&stmt.Function{
@@ -3024,6 +3071,7 @@ func TestPhp7(t *testing.T) {
&node.Identifier{Value: "protected"},
&node.Identifier{Value: "static"},
},
+ Stmt: &stmt.Nop{},
},
&stmt.ClassMethod{
MethodName: &node.Identifier{Value: "baz"},
@@ -3031,7 +3079,9 @@ func TestPhp7(t *testing.T) {
&node.Identifier{Value: "final"},
&node.Identifier{Value: "private"},
},
- Stmts: []node.Node{},
+ Stmt: &stmt.StmtList{
+ Stmts: []node.Node{},
+ },
},
},
},
@@ -3048,7 +3098,8 @@ func TestPhp7(t *testing.T) {
Function: &expr.New{
Class: &name.Name{Parts: []node.Node{&name.NamePart{Value: "Foo"}}},
},
- Arguments: []node.Node{},
+
+ ArgumentList: &node.ArgumentList{},
},
},
&stmt.Expression{
@@ -3057,14 +3108,14 @@ func TestPhp7(t *testing.T) {
Variable: &expr.ShortArray{
Items: []node.Node{
&expr.ArrayItem{
- ByRef: false,
- Val: &expr.Variable{VarName: &node.Identifier{Value: "foo"}},
+ Val: &expr.Variable{VarName: &node.Identifier{Value: "foo"}},
},
},
},
Dim: &scalar.Lnumber{Value: "0"},
},
- Arguments: []node.Node{},
+
+ ArgumentList: &node.ArgumentList{},
},
},
&stmt.Expression{
@@ -3075,13 +3126,15 @@ func TestPhp7(t *testing.T) {
},
Dim: &scalar.Lnumber{Value: "1"},
},
- Arguments: []node.Node{},
+
+ ArgumentList: &node.ArgumentList{},
},
},
&stmt.Expression{
Expr: &expr.FunctionCall{
- Function: &scalar.String{Value: "\"foo\""},
- Arguments: []node.Node{},
+ Function: &scalar.String{Value: "\"foo\""},
+
+ ArgumentList: &node.ArgumentList{},
},
},
&stmt.Expression{
@@ -3090,29 +3143,31 @@ func TestPhp7(t *testing.T) {
Variable: &expr.ShortArray{
Items: []node.Node{
&expr.ArrayItem{
- ByRef: false,
- Val: &scalar.Lnumber{Value: "1"},
+ Val: &scalar.Lnumber{Value: "1"},
},
},
},
Dim: &expr.Variable{VarName: &node.Identifier{Value: "foo"}},
},
- Arguments: []node.Node{},
+
+ ArgumentList: &node.ArgumentList{},
},
},
&stmt.Expression{
Expr: &expr.Variable{
VarName: &expr.FunctionCall{
- Function: &name.Name{Parts: []node.Node{&name.NamePart{Value: "foo"}}},
- Arguments: []node.Node{},
+ Function: &name.Name{Parts: []node.Node{&name.NamePart{Value: "foo"}}},
+
+ ArgumentList: &node.ArgumentList{},
},
},
},
&stmt.Expression{
Expr: &expr.StaticCall{
- Class: &name.Name{Parts: []node.Node{&name.NamePart{Value: "Foo"}}},
- Call: &expr.Variable{VarName: &node.Identifier{Value: "bar"}},
- Arguments: []node.Node{},
+ Class: &name.Name{Parts: []node.Node{&name.NamePart{Value: "Foo"}}},
+ Call: &expr.Variable{VarName: &node.Identifier{Value: "bar"}},
+
+ ArgumentList: &node.ArgumentList{},
},
},
&stmt.Expression{
@@ -3122,7 +3177,8 @@ func TestPhp7(t *testing.T) {
Variable: &expr.Variable{VarName: &node.Identifier{Value: "bar"}},
Dim: &scalar.Lnumber{Value: "0"},
},
- Arguments: []node.Node{},
+
+ ArgumentList: &node.ArgumentList{},
},
},
&stmt.Expression{
@@ -3144,18 +3200,15 @@ func TestPhp7(t *testing.T) {
Expr: &expr.ShortArray{
Items: []node.Node{
&expr.ArrayItem{
- ByRef: true,
- Key: &scalar.Lnumber{Value: "1"},
- Val: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
+ Key: &scalar.Lnumber{Value: "1"},
+ Val: &expr.Reference{Variable: &expr.Variable{VarName: &node.Identifier{Value: "a"}}},
},
&expr.ArrayItem{
- ByRef: false,
- Key: &scalar.Lnumber{Value: "2"},
+ Key: &scalar.Lnumber{Value: "2"},
Val: &expr.List{
Items: []node.Node{
&expr.ArrayItem{
- ByRef: false,
- Val: &expr.Variable{VarName: &node.Identifier{Value: "b"}},
+ Val: &expr.Variable{VarName: &node.Identifier{Value: "b"}},
},
},
},
@@ -3185,7 +3238,7 @@ func TestPhp5Strings(t *testing.T) {
';
`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Expression{
Expr: &scalar.String{Value: "\"test\""},
@@ -3229,7 +3282,7 @@ CAD;
CAD;
`
- expected := &stmt.StmtList{
+ expected := &node.Root{
Stmts: []node.Node{
&stmt.Expression{
Expr: &scalar.Heredoc{
diff --git a/position/builder.go b/position/builder.go
deleted file mode 100644
index 2c2f990..0000000
--- a/position/builder.go
+++ /dev/null
@@ -1,198 +0,0 @@
-package position
-
-import (
- "github.com/z7zmey/php-parser/node"
- "github.com/z7zmey/php-parser/token"
-)
-
-// Builder provide functions to constuct positions
-type Builder struct {
- Positions *Positions
-}
-
-type startPos struct {
- startLine int
- startPos int
-}
-
-type endPos struct {
- endLine int
- endPos int
-}
-
-func (b *Builder) getListStartPos(l []node.Node) startPos {
- if l == nil {
- return startPos{-1, -1}
- }
-
- if len(l) == 0 {
- return startPos{-1, -1}
- }
-
- return b.getNodeStartPos(l[0])
-}
-
-func (b *Builder) getNodeStartPos(n node.Node) startPos {
- sl := -1
- sp := -1
-
- if n == nil {
- return startPos{-1, -1}
- }
-
- p := (*b.Positions)[n]
- if p != nil {
- sl = p.StartLine
- sp = p.StartPos
- }
-
- return startPos{sl, sp}
-}
-
-func (b *Builder) getListEndPos(l []node.Node) endPos {
- if l == nil {
- return endPos{-1, -1}
- }
-
- if len(l) == 0 {
- return endPos{-1, -1}
- }
-
- return b.getNodeEndPos(l[len(l)-1])
-}
-
-func (b *Builder) getNodeEndPos(n node.Node) endPos {
- el := -1
- ep := -1
-
- if n == nil {
- return endPos{-1, -1}
- }
-
- p := (*b.Positions)[n]
- if p != nil {
- el = p.EndLine
- ep = p.EndPos
- }
-
- return endPos{el, ep}
-}
-
-// NewNodeListPosition returns new Position
-func (b *Builder) NewNodeListPosition(list []node.Node) *Position {
- return &Position{
- b.getListStartPos(list).startLine,
- b.getListEndPos(list).endLine,
- b.getListStartPos(list).startPos,
- b.getListEndPos(list).endPos,
- }
-}
-
-// NewNodePosition returns new Position
-func (b *Builder) NewNodePosition(n node.Node) *Position {
- return &Position{
- b.getNodeStartPos(n).startLine,
- b.getNodeEndPos(n).endLine,
- b.getNodeStartPos(n).startPos,
- b.getNodeEndPos(n).endPos,
- }
-}
-
-// NewTokenPosition returns new Position
-func (b *Builder) NewTokenPosition(t token.Token) *Position {
- return &Position{
- t.StartLine,
- t.EndLine,
- t.StartPos,
- t.EndPos,
- }
-}
-
-// NewTokensPosition returns new Position
-func (b *Builder) NewTokensPosition(startToken token.Token, endToken token.Token) *Position {
- return &Position{
- startToken.StartLine,
- endToken.EndLine,
- startToken.StartPos,
- endToken.EndPos,
- }
-}
-
-// NewTokenNodePosition returns new Position
-func (b *Builder) NewTokenNodePosition(t token.Token, n node.Node) *Position {
- return &Position{
- t.StartLine,
- b.getNodeEndPos(n).endLine,
- t.StartPos,
- b.getNodeEndPos(n).endPos,
- }
-}
-
-// NewNodeTokenPosition returns new Position
-func (b *Builder) NewNodeTokenPosition(n node.Node, t token.Token) *Position {
- return &Position{
- b.getNodeStartPos(n).startLine,
- t.EndLine,
- b.getNodeStartPos(n).startPos,
- t.EndPos,
- }
-}
-
-// NewNodesPosition returns new Position
-func (b *Builder) NewNodesPosition(startNode node.Node, endNode node.Node) *Position {
- return &Position{
- b.getNodeStartPos(startNode).startLine,
- b.getNodeEndPos(endNode).endLine,
- b.getNodeStartPos(startNode).startPos,
- b.getNodeEndPos(endNode).endPos,
- }
-}
-
-// NewNodeListTokenPosition returns new Position
-func (b *Builder) NewNodeListTokenPosition(list []node.Node, t token.Token) *Position {
- return &Position{
- b.getListStartPos(list).startLine,
- t.EndLine,
- b.getListStartPos(list).startPos,
- t.EndPos,
- }
-}
-
-// NewTokenNodeListPosition returns new Position
-func (b *Builder) NewTokenNodeListPosition(t token.Token, list []node.Node) *Position {
- return &Position{
- t.StartLine,
- b.getListEndPos(list).endLine,
- t.StartPos,
- b.getListEndPos(list).endPos,
- }
-}
-
-// NewNodeNodeListPosition returns new Position
-func (b *Builder) NewNodeNodeListPosition(n node.Node, list []node.Node) *Position {
- return &Position{
- b.getNodeStartPos(n).startLine,
- b.getListEndPos(list).endLine,
- b.getNodeStartPos(n).startPos,
- b.getListEndPos(list).endPos,
- }
-}
-
-// NewOptionalListTokensPosition returns new Position
-func (b *Builder) NewOptionalListTokensPosition(list []node.Node, t token.Token, endToken token.Token) *Position {
- if list == nil {
- return &Position{
- t.StartLine,
- endToken.EndLine,
- t.StartPos,
- endToken.EndPos,
- }
- }
-
- return &Position{
- b.getListStartPos(list).startLine,
- endToken.EndLine,
- b.getListStartPos(list).startPos,
- endToken.EndPos,
- }
-}
diff --git a/position/position.go b/position/position.go
index f619e7b..d4099cd 100644
--- a/position/position.go
+++ b/position/position.go
@@ -2,8 +2,6 @@ package position
import (
"fmt"
-
- "github.com/z7zmey/php-parser/node"
)
// Position represents node position
@@ -14,14 +12,16 @@ type Position struct {
EndPos int
}
+// NewPosition Position constructor
+func NewPosition(StartLine int, EndLine int, StartPos int, EndPos int) *Position {
+ return &Position{
+ StartLine: StartLine,
+ EndLine: EndLine,
+ StartPos: StartPos,
+ EndPos: EndPos,
+ }
+}
+
func (p Position) String() string {
return fmt.Sprintf("Pos{Line: %d-%d Pos: %d-%d}", p.StartLine, p.EndLine, p.StartPos, p.EndPos)
}
-
-// Positions a collection of positions attached to nodes
-type Positions map[node.Node]*Position
-
-// AddPosition attaches a position to a node
-func (p Positions) AddPosition(node node.Node, position *Position) {
- p[node] = position
-}
diff --git a/position/position_test.go b/position/position_test.go
index 933e3f7..0e322b6 100644
--- a/position/position_test.go
+++ b/position/position_test.go
@@ -3,377 +3,17 @@ package position_test
import (
"testing"
- "github.com/z7zmey/php-parser/node"
"github.com/z7zmey/php-parser/position"
-
- "github.com/z7zmey/php-parser/token"
)
-func TestNewTokenPosition(t *testing.T) {
- builder := position.Builder{}
+func TestPrintPosition(t *testing.T) {
+ pos := position.NewPosition(1, 1, 2, 5)
- tkn := token.NewToken(`foo`, 1, 1, 0, 3)
+ expected := "Pos{Line: 1-1 Pos: 2-5}"
- pos := builder.NewTokenPosition(tkn)
+ actual := pos.String()
- if pos.String() != `Pos{Line: 1-1 Pos: 0-3}` {
- t.Errorf("token value is not equal\n")
- }
-}
-
-func TestNewTokensPosition(t *testing.T) {
- builder := position.Builder{}
-
- token1 := token.NewToken(`foo`, 1, 1, 0, 3)
- token2 := token.NewToken(`foo`, 2, 2, 4, 6)
-
- pos := builder.NewTokensPosition(token1, token2)
-
- if pos.String() != `Pos{Line: 1-2 Pos: 0-6}` {
- t.Errorf("token value is not equal\n")
- }
-}
-
-func TestNewNodePosition(t *testing.T) {
- n := node.NewIdentifier("test node")
-
- p := &position.Positions{}
- p.AddPosition(n, &position.Position{
- StartLine: 1,
- EndLine: 1,
- StartPos: 0,
- EndPos: 3,
- })
-
- builder := position.Builder{
- Positions: p,
- }
-
- pos := builder.NewNodePosition(n)
-
- if pos.String() != `Pos{Line: 1-1 Pos: 0-3}` {
- t.Errorf("token value is not equal\n")
- }
-}
-
-func TestNewTokenNodePosition(t *testing.T) {
- tkn := token.NewToken(`foo`, 1, 1, 0, 3)
- n := node.NewIdentifier("test node")
-
- p := &position.Positions{}
- p.AddPosition(n, &position.Position{
- StartLine: 2,
- EndLine: 2,
- StartPos: 4,
- EndPos: 12,
- })
-
- builder := position.Builder{
- Positions: p,
- }
-
- pos := builder.NewTokenNodePosition(tkn, n)
-
- if pos.String() != `Pos{Line: 1-2 Pos: 0-12}` {
- t.Errorf("token value is not equal\n")
- }
-}
-
-func TestNewNodeTokenPosition(t *testing.T) {
- n := node.NewIdentifier("test node")
- tkn := token.NewToken(`foo`, 2, 2, 10, 12)
-
- p := &position.Positions{}
- p.AddPosition(n, &position.Position{
- StartLine: 1,
- EndLine: 1,
- StartPos: 0,
- EndPos: 9,
- })
-
- builder := position.Builder{
- Positions: p,
- }
-
- pos := builder.NewNodeTokenPosition(n, tkn)
-
- if pos.String() != `Pos{Line: 1-2 Pos: 0-12}` {
- t.Errorf("token value is not equal\n")
- }
-}
-
-func TestNewNodeListPosition(t *testing.T) {
- n1 := node.NewIdentifier("test node")
- n2 := node.NewIdentifier("test node")
-
- builder := position.Builder{
- Positions: &position.Positions{
- n1: &position.Position{
- StartLine: 1,
- EndLine: 1,
- StartPos: 0,
- EndPos: 9,
- },
- n2: &position.Position{
- StartLine: 2,
- EndLine: 2,
- StartPos: 10,
- EndPos: 19,
- },
- },
- }
-
- pos := builder.NewNodeListPosition([]node.Node{n1, n2})
-
- if pos.String() != `Pos{Line: 1-2 Pos: 0-19}` {
- t.Errorf("token value is not equal\n")
- }
-}
-
-func TestNewNodesPosition(t *testing.T) {
- n1 := node.NewIdentifier("test node")
- n2 := node.NewIdentifier("test node")
-
- builder := position.Builder{
- Positions: &position.Positions{
- n1: &position.Position{
- StartLine: 1,
- EndLine: 1,
- StartPos: 0,
- EndPos: 9,
- },
- n2: &position.Position{
- StartLine: 2,
- EndLine: 2,
- StartPos: 10,
- EndPos: 19,
- },
- },
- }
-
- pos := builder.NewNodesPosition(n1, n2)
-
- if pos.String() != `Pos{Line: 1-2 Pos: 0-19}` {
- t.Errorf("token value is not equal\n")
- }
-}
-
-func TestNewNodeListTokenPosition(t *testing.T) {
- n1 := node.NewIdentifier("test node")
- n2 := node.NewIdentifier("test node")
- tkn := token.NewToken(`foo`, 3, 3, 20, 22)
-
- builder := position.Builder{
- Positions: &position.Positions{
- n1: &position.Position{
- StartLine: 1,
- EndLine: 1,
- StartPos: 0,
- EndPos: 9,
- },
- n2: &position.Position{
- StartLine: 2,
- EndLine: 2,
- StartPos: 10,
- EndPos: 19,
- },
- },
- }
-
- pos := builder.NewNodeListTokenPosition([]node.Node{n1, n2}, tkn)
-
- if pos.String() != `Pos{Line: 1-3 Pos: 0-22}` {
- t.Errorf("token value is not equal\n")
- }
-}
-
-func TestNewTokenNodeListPosition(t *testing.T) {
- tkn := token.NewToken(`foo`, 1, 1, 0, 2)
- n1 := node.NewIdentifier("test node")
- n2 := node.NewIdentifier("test node")
-
- builder := position.Builder{
- Positions: &position.Positions{
- n1: &position.Position{
- StartLine: 2,
- EndLine: 2,
- StartPos: 3,
- EndPos: 10,
- },
- n2: &position.Position{
- StartLine: 3,
- EndLine: 3,
- StartPos: 11,
- EndPos: 20,
- },
- },
- }
-
- pos := builder.NewTokenNodeListPosition(tkn, []node.Node{n1, n2})
-
- if pos.String() != `Pos{Line: 1-3 Pos: 0-20}` {
- t.Errorf("token value is not equal\n")
- }
-}
-
-func TestNewNodeNodeListPosition(t *testing.T) {
- n1 := node.NewIdentifier("test node")
- n2 := node.NewIdentifier("test node")
- n3 := node.NewIdentifier("test node")
-
- builder := position.Builder{
- Positions: &position.Positions{
- n1: &position.Position{
- StartLine: 1,
- EndLine: 1,
- StartPos: 0,
- EndPos: 8,
- },
- n2: &position.Position{
- StartLine: 2,
- EndLine: 2,
- StartPos: 9,
- EndPos: 17,
- },
- n3: &position.Position{
- StartLine: 3,
- EndLine: 3,
- StartPos: 18,
- EndPos: 26,
- },
- },
- }
-
- pos := builder.NewNodeNodeListPosition(n1, []node.Node{n2, n3})
-
- if pos.String() != `Pos{Line: 1-3 Pos: 0-26}` {
- t.Errorf("token value is not equal\n")
- }
-}
-
-func TestNewOptionalListTokensPosition(t *testing.T) {
- builder := position.Builder{}
-
- token1 := token.NewToken(`foo`, 1, 1, 0, 3)
- token2 := token.NewToken(`foo`, 2, 2, 4, 6)
-
- pos := builder.NewOptionalListTokensPosition(nil, token1, token2)
-
- if pos.String() != `Pos{Line: 1-2 Pos: 0-6}` {
- t.Errorf("token value is not equal\n")
- }
-}
-
-func TestNewOptionalListTokensPosition2(t *testing.T) {
- n1 := node.NewIdentifier("test node")
- n2 := node.NewIdentifier("test node")
- n3 := node.NewIdentifier("test node")
-
- builder := position.Builder{
- Positions: &position.Positions{
- n1: &position.Position{
- StartLine: 1,
- EndLine: 1,
- StartPos: 0,
- EndPos: 8,
- },
- n2: &position.Position{
- StartLine: 2,
- EndLine: 2,
- StartPos: 9,
- EndPos: 17,
- },
- n3: &position.Position{
- StartLine: 3,
- EndLine: 3,
- StartPos: 18,
- EndPos: 26,
- },
- },
- }
-
- token1 := token.NewToken(`foo`, 4, 4, 27, 29)
- token2 := token.NewToken(`foo`, 5, 5, 30, 32)
-
- pos := builder.NewOptionalListTokensPosition([]node.Node{n2, n3}, token1, token2)
-
- if pos.String() != `Pos{Line: 2-5 Pos: 9-32}` {
- t.Errorf("token value is not equal\n")
- }
-}
-
-func TestNilNodePos(t *testing.T) {
- builder := position.Builder{}
-
- pos := builder.NewNodesPosition(nil, nil)
-
- if pos.String() != `Pos{Line: -1--1 Pos: -1--1}` {
- t.Errorf("token value is not equal\n")
- }
-}
-
-func TestNilNodeListPos(t *testing.T) {
- n1 := node.NewIdentifier("test node")
-
- builder := position.Builder{
- Positions: &position.Positions{
- n1: &position.Position{
- StartLine: 1,
- EndLine: 1,
- StartPos: 0,
- EndPos: 8,
- },
- },
- }
-
- pos := builder.NewNodeNodeListPosition(n1, nil)
-
- if pos.String() != `Pos{Line: 1--1 Pos: 0--1}` {
- t.Errorf("token value is not equal\n")
- }
-}
-
-func TestNilNodeListTokenPos(t *testing.T) {
- token1 := token.NewToken(`foo`, 1, 1, 0, 3)
-
- builder := position.Builder{}
-
- pos := builder.NewNodeListTokenPosition(nil, token1)
-
- if pos.String() != `Pos{Line: -1-1 Pos: -1-3}` {
- t.Errorf("token value is not equal\n")
- }
-}
-
-func TestEmptyNodeListPos(t *testing.T) {
- n1 := node.NewIdentifier("test node")
-
- builder := position.Builder{
- Positions: &position.Positions{
- n1: &position.Position{
- StartLine: 1,
- EndLine: 1,
- StartPos: 0,
- EndPos: 8,
- },
- },
- }
-
- pos := builder.NewNodeNodeListPosition(n1, []node.Node{})
-
- if pos.String() != `Pos{Line: 1--1 Pos: 0--1}` {
- t.Errorf("token value is not equal\n")
- }
-}
-
-func TestEmptyNodeListTokenPos(t *testing.T) {
- token1 := token.NewToken(`foo`, 1, 1, 0, 3)
-
- builder := position.Builder{}
-
- pos := builder.NewNodeListTokenPosition([]node.Node{}, token1)
-
- if pos.String() != `Pos{Line: -1-1 Pos: -1-3}` {
- t.Errorf("token value is not equal\n")
+ if expected != actual {
+ t.Errorf("expected and actual are not equal\n")
}
}
diff --git a/printer/printer.go b/printer/printer.go
index 231c855..f1a40e1 100644
--- a/printer/printer.go
+++ b/printer/printer.go
@@ -30,27 +30,6 @@ func NewPrinter(w io.Writer, indentStr string) *Printer {
}
}
-func (p *Printer) PrintFile(n *stmt.StmtList) {
- if len(n.Stmts) > 0 {
- firstStmt := n.Stmts[0]
- n.Stmts = n.Stmts[1:]
-
- switch fs := firstStmt.(type) {
- case *stmt.InlineHtml:
- io.WriteString(p.w, fs.Value)
- io.WriteString(p.w, " 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, " ")
}
- if nn.ByRef {
- io.WriteString(p.w, "&")
- }
-
p.Print(nn.Val)
}
@@ -1005,11 +1007,9 @@ func (p *Printer) printExprClone(n node.Node) {
func (p *Printer) printExprClosureUse(n node.Node) {
nn := n.(*expr.ClosureUse)
- if nn.ByRef {
- io.WriteString(p.w, "&")
- }
-
- p.Print(nn.Variable)
+ io.WriteString(p.w, "use (")
+ p.joinPrint(", ", nn.Uses)
+ io.WriteString(p.w, ")")
}
func (p *Printer) printExprClosure(n node.Node) {
@@ -1029,10 +1029,9 @@ func (p *Printer) printExprClosure(n node.Node) {
p.joinPrint(", ", nn.Params)
io.WriteString(p.w, ")")
- if nn.Uses != nil {
- io.WriteString(p.w, " use (")
- p.joinPrint(", ", nn.Uses)
- io.WriteString(p.w, ")")
+ if nn.ClosureUse != nil {
+ io.WriteString(p.w, " ")
+ p.Print(nn.ClosureUse)
}
if nn.ReturnType != nil {
@@ -1097,7 +1096,7 @@ func (p *Printer) printExprFunctionCall(n node.Node) {
p.Print(nn.Function)
io.WriteString(p.w, "(")
- p.joinPrint(", ", nn.Arguments)
+ p.joinPrint(", ", nn.ArgumentList.Arguments)
io.WriteString(p.w, ")")
}
@@ -1146,7 +1145,7 @@ func (p *Printer) printExprMethodCall(n node.Node) {
io.WriteString(p.w, "->")
p.Print(nn.Method)
io.WriteString(p.w, "(")
- p.joinPrint(", ", nn.Arguments)
+ p.joinPrint(", ", nn.ArgumentList.Arguments)
io.WriteString(p.w, ")")
}
@@ -1156,9 +1155,9 @@ func (p *Printer) printExprNew(n node.Node) {
io.WriteString(p.w, "new ")
p.Print(nn.Class)
- if nn.Arguments != nil {
+ if nn.ArgumentList != nil {
io.WriteString(p.w, "(")
- p.joinPrint(", ", nn.Arguments)
+ p.joinPrint(", ", nn.ArgumentList.Arguments)
io.WriteString(p.w, ")")
}
}
@@ -1207,6 +1206,13 @@ func (p *Printer) printExprPropertyFetch(n node.Node) {
p.Print(nn.Property)
}
+func (p *Printer) printExprReference(n node.Node) {
+ nn := n.(*expr.Reference)
+
+ io.WriteString(p.w, "&")
+ p.Print(nn.Variable)
+}
+
func (p *Printer) printExprRequire(n node.Node) {
nn := n.(*expr.Require)
@@ -1254,7 +1260,7 @@ func (p *Printer) printExprStaticCall(n node.Node) {
io.WriteString(p.w, "::")
p.Print(nn.Call)
io.WriteString(p.w, "(")
- p.joinPrint(", ", nn.Arguments)
+ p.joinPrint(", ", nn.ArgumentList.Arguments)
io.WriteString(p.w, ")")
}
@@ -1378,10 +1384,6 @@ func (p *Printer) printStmtAltForeach(n node.Node) {
io.WriteString(p.w, " => ")
}
- if nn.ByRef {
- io.WriteString(p.w, "&")
- }
-
p.Print(nn.Variable)
io.WriteString(p.w, ") :\n")
@@ -1428,7 +1430,7 @@ func (p *Printer) printStmtAltSwitch(n node.Node) {
p.Print(nn.Cond)
io.WriteString(p.w, ") :\n")
- s := nn.Cases
+ s := nn.CaseList.Cases
p.printNodes(s)
io.WriteString(p.w, "\n")
@@ -1513,13 +1515,18 @@ func (p *Printer) printStmtClassMethod(n node.Node) {
p.Print(nn.ReturnType)
}
- 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, "}")
+ 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 *Printer) printStmtClass(n node.Node) {
@@ -1536,20 +1543,20 @@ func (p *Printer) printStmtClass(n node.Node) {
p.Print(nn.ClassName)
}
- if nn.Args != nil {
+ if nn.ArgumentList != nil {
io.WriteString(p.w, "(")
- p.joinPrint(", ", nn.Args)
+ p.joinPrint(", ", nn.ArgumentList.Arguments)
io.WriteString(p.w, ")")
}
if nn.Extends != nil {
io.WriteString(p.w, " extends ")
- p.Print(nn.Extends)
+ p.Print(nn.Extends.ClassName)
}
if nn.Implements != nil {
io.WriteString(p.w, " implements ")
- p.joinPrint(", ", nn.Implements)
+ p.joinPrint(", ", nn.Implements.InterfaceNames)
}
io.WriteString(p.w, "\n")
@@ -1760,9 +1767,6 @@ func (p *Printer) printStmtForeach(n node.Node) {
io.WriteString(p.w, " => ")
}
- if nn.ByRef {
- io.WriteString(p.w, "&")
- }
p.Print(nn.Variable)
io.WriteString(p.w, ")")
@@ -1901,7 +1905,7 @@ func (p *Printer) printStmtInterface(n node.Node) {
if nn.Extends != nil {
io.WriteString(p.w, " extends ")
- p.joinPrint(", ", nn.Extends)
+ p.joinPrint(", ", nn.Extends.InterfaceNames)
}
io.WriteString(p.w, "\n")
@@ -2009,7 +2013,7 @@ func (p *Printer) printStmtSwitch(n node.Node) {
io.WriteString(p.w, ")")
io.WriteString(p.w, " {\n")
- p.printNodes(nn.Cases)
+ p.printNodes(nn.CaseList.Cases)
io.WriteString(p.w, "\n")
p.printIndent()
io.WriteString(p.w, "}")
@@ -2066,9 +2070,10 @@ func (p *Printer) printStmtTraitUse(n node.Node) {
io.WriteString(p.w, "use ")
p.joinPrint(", ", nn.Traits)
- if nn.Adaptations != nil {
+ if nn.TraitAdaptationList != nil {
+ adaptations := nn.TraitAdaptationList.Adaptations
io.WriteString(p.w, " {\n")
- p.printNodes(nn.Adaptations)
+ p.printNodes(adaptations)
io.WriteString(p.w, "\n")
p.printIndent()
io.WriteString(p.w, "}")
diff --git a/printer/printer_test.go b/printer/printer_test.go
index 38d3c54..e99f2bc 100644
--- a/printer/printer_test.go
+++ b/printer/printer_test.go
@@ -19,7 +19,7 @@ func TestPrintFile(t *testing.T) {
o := bytes.NewBufferString("")
p := printer.NewPrinter(o, "\t")
- p.PrintFile(&stmt.StmtList{
+ p.Print(&node.Root{
Stmts: []node.Node{
&stmt.Namespace{
NamespaceName: &name.Name{
@@ -35,19 +35,23 @@ func TestPrintFile(t *testing.T) {
&name.NamePart{Value: "Bar"},
},
},
- Extends: &name.Name{
- Parts: []node.Node{
- &name.NamePart{Value: "Baz"},
+ Extends: &stmt.ClassExtends{
+ ClassName: &name.Name{
+ Parts: []node.Node{
+ &name.NamePart{Value: "Baz"},
+ },
},
},
Stmts: []node.Node{
&stmt.ClassMethod{
Modifiers: []node.Node{&node.Identifier{Value: "public"}},
MethodName: &node.Identifier{Value: "greet"},
- Stmts: []node.Node{
- &stmt.Echo{
- Exprs: []node.Node{
- &scalar.String{Value: "'Hello world'"},
+ Stmt: &stmt.StmtList{
+ Stmts: []node.Node{
+ &stmt.Echo{
+ Exprs: []node.Node{
+ &scalar.String{Value: "'Hello world'"},
+ },
},
},
},
@@ -78,7 +82,7 @@ func TestPrintFileInlineHtml(t *testing.T) {
o := bytes.NewBufferString("")
p := printer.NewPrinter(o, " ")
- p.PrintFile(&stmt.StmtList{
+ p.Print(&node.Root{
Stmts: []node.Node{
&stmt.InlineHtml{Value: "HTML
"},
&stmt.Expression{
@@ -1241,9 +1245,8 @@ func TestPrintExprArrayItemWithKey(t *testing.T) {
p := printer.NewPrinter(o, " ")
p.Print(&expr.ArrayItem{
- ByRef: false,
- Key: &scalar.String{Value: "'Hello'"},
- Val: &expr.Variable{VarName: &node.Identifier{Value: "world"}},
+ Key: &scalar.String{Value: "'Hello'"},
+ Val: &expr.Variable{VarName: &node.Identifier{Value: "world"}},
})
expected := `'Hello' => $world`
@@ -1259,8 +1262,7 @@ func TestPrintExprArrayItem(t *testing.T) {
p := printer.NewPrinter(o, " ")
p.Print(&expr.ArrayItem{
- ByRef: true,
- Val: &expr.Variable{VarName: &node.Identifier{Value: "world"}},
+ Val: &expr.Reference{Variable: &expr.Variable{VarName: &node.Identifier{Value: "world"}}},
})
expected := `&$world`
@@ -1278,18 +1280,15 @@ func TestPrintExprArray(t *testing.T) {
p.Print(&expr.Array{
Items: []node.Node{
&expr.ArrayItem{
- ByRef: false,
- Key: &scalar.String{Value: "'Hello'"},
- Val: &expr.Variable{VarName: &node.Identifier{Value: "world"}},
+ Key: &scalar.String{Value: "'Hello'"},
+ Val: &expr.Variable{VarName: &node.Identifier{Value: "world"}},
},
&expr.ArrayItem{
- ByRef: true,
- Key: &scalar.Lnumber{Value: "2"},
- Val: &expr.Variable{VarName: &node.Identifier{Value: "var"}},
+ Key: &scalar.Lnumber{Value: "2"},
+ Val: &expr.Reference{Variable: &expr.Variable{VarName: &node.Identifier{Value: "var"}}},
},
&expr.ArrayItem{
- ByRef: false,
- Val: &expr.Variable{VarName: &node.Identifier{Value: "var"}},
+ Val: &expr.Variable{VarName: &node.Identifier{Value: "var"}},
},
},
})
@@ -1372,11 +1371,13 @@ func TestPrintExprClosureUse(t *testing.T) {
p := printer.NewPrinter(o, " ")
p.Print(&expr.ClosureUse{
- ByRef: true,
- Variable: &expr.Variable{VarName: &node.Identifier{Value: "var"}},
+ Uses: []node.Node{
+ &expr.Reference{Variable: &expr.Variable{VarName: &node.Identifier{Value: "foo"}}},
+ &expr.Variable{VarName: &node.Identifier{Value: "bar"}},
+ },
})
- expected := `&$var`
+ expected := `use (&$foo, $bar)`
actual := o.String()
if expected != actual {
@@ -1400,14 +1401,10 @@ func TestPrintExprClosure(t *testing.T) {
Variable: &expr.Variable{VarName: &node.Identifier{Value: "var"}},
},
},
- Uses: []node.Node{
- &expr.ClosureUse{
- ByRef: true,
- Variable: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
- },
- &expr.ClosureUse{
- ByRef: false,
- Variable: &expr.Variable{VarName: &node.Identifier{Value: "b"}},
+ ClosureUse: &expr.ClosureUse{
+ Uses: []node.Node{
+ &expr.Reference{Variable: &expr.Variable{VarName: &node.Identifier{Value: "a"}}},
+ &expr.Variable{VarName: &node.Identifier{Value: "b"}},
},
},
ReturnType: &name.FullyQualified{Parts: []node.Node{&name.NamePart{Value: "Foo"}}},
@@ -1522,17 +1519,19 @@ func TestPrintFunctionCall(t *testing.T) {
p := printer.NewPrinter(o, " ")
p.Print(&expr.FunctionCall{
Function: &expr.Variable{VarName: &node.Identifier{Value: "var"}},
- Arguments: []node.Node{
- &node.Argument{
- IsReference: true,
- Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
- },
- &node.Argument{
- Variadic: true,
- Expr: &expr.Variable{VarName: &node.Identifier{Value: "b"}},
- },
- &node.Argument{
- Expr: &expr.Variable{VarName: &node.Identifier{Value: "c"}},
+ ArgumentList: &node.ArgumentList{
+ Arguments: []node.Node{
+ &node.Argument{
+ IsReference: true,
+ Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
+ },
+ &node.Argument{
+ Variadic: true,
+ Expr: &expr.Variable{VarName: &node.Identifier{Value: "b"}},
+ },
+ &node.Argument{
+ Expr: &expr.Variable{VarName: &node.Identifier{Value: "c"}},
+ },
},
},
})
@@ -1648,12 +1647,14 @@ func TestPrintMethodCall(t *testing.T) {
p.Print(&expr.MethodCall{
Variable: &expr.Variable{VarName: &node.Identifier{Value: "foo"}},
Method: &node.Identifier{Value: "bar"},
- Arguments: []node.Node{
- &node.Argument{
- Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
- },
- &node.Argument{
- Expr: &expr.Variable{VarName: &node.Identifier{Value: "b"}},
+ ArgumentList: &node.ArgumentList{
+ Arguments: []node.Node{
+ &node.Argument{
+ Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
+ },
+ &node.Argument{
+ Expr: &expr.Variable{VarName: &node.Identifier{Value: "b"}},
+ },
},
},
})
@@ -1672,12 +1673,14 @@ func TestPrintNew(t *testing.T) {
p := printer.NewPrinter(o, " ")
p.Print(&expr.New{
Class: &name.Name{Parts: []node.Node{&name.NamePart{Value: "Foo"}}},
- Arguments: []node.Node{
- &node.Argument{
- Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
- },
- &node.Argument{
- Expr: &expr.Variable{VarName: &node.Identifier{Value: "b"}},
+ ArgumentList: &node.ArgumentList{
+ Arguments: []node.Node{
+ &node.Argument{
+ Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
+ },
+ &node.Argument{
+ Expr: &expr.Variable{VarName: &node.Identifier{Value: "b"}},
+ },
},
},
})
@@ -1785,6 +1788,22 @@ func TestPrintPropertyFetch(t *testing.T) {
}
}
+func TestPrintExprReference(t *testing.T) {
+ o := bytes.NewBufferString("")
+
+ p := printer.NewPrinter(o, " ")
+ p.Print(&expr.Reference{
+ Variable: &expr.Variable{VarName: &node.Identifier{Value: "foo"}},
+ })
+
+ expected := `&$foo`
+ actual := o.String()
+
+ if expected != actual {
+ t.Errorf("\nexpected: %s\ngot: %s\n", expected, actual)
+ }
+}
+
func TestPrintRequire(t *testing.T) {
o := bytes.NewBufferString("")
@@ -1844,9 +1863,8 @@ func TestPrintExprShortArray(t *testing.T) {
Val: &expr.Variable{VarName: &node.Identifier{Value: "world"}},
},
&expr.ArrayItem{
- ByRef: true,
- Key: &scalar.Lnumber{Value: "2"},
- Val: &expr.Variable{VarName: &node.Identifier{Value: "var"}},
+ Key: &scalar.Lnumber{Value: "2"},
+ Val: &expr.Reference{Variable: &expr.Variable{VarName: &node.Identifier{Value: "var"}}},
},
&expr.ArrayItem{
Val: &expr.Variable{VarName: &node.Identifier{Value: "var"}},
@@ -1901,12 +1919,14 @@ func TestPrintStaticCall(t *testing.T) {
p.Print(&expr.StaticCall{
Class: &node.Identifier{Value: "Foo"},
Call: &node.Identifier{Value: "bar"},
- Arguments: []node.Node{
- &node.Argument{
- Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
- },
- &node.Argument{
- Expr: &expr.Variable{VarName: &node.Identifier{Value: "b"}},
+ ArgumentList: &node.ArgumentList{
+ Arguments: []node.Node{
+ &node.Argument{
+ Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
+ },
+ &node.Argument{
+ Expr: &expr.Variable{VarName: &node.Identifier{Value: "b"}},
+ },
},
},
})
@@ -2188,10 +2208,9 @@ func TestPrintAltForeach(t *testing.T) {
p.Print(&stmt.Namespace{
Stmts: []node.Node{
&stmt.AltForeach{
- ByRef: true,
Expr: &expr.Variable{VarName: &node.Identifier{Value: "var"}},
Key: &expr.Variable{VarName: &node.Identifier{Value: "key"}},
- Variable: &expr.Variable{VarName: &node.Identifier{Value: "val"}},
+ Variable: &expr.Reference{Variable: &expr.Variable{VarName: &node.Identifier{Value: "val"}}},
Stmt: &stmt.StmtList{
Stmts: []node.Node{
&stmt.Expression{Expr: &expr.Variable{VarName: &node.Identifier{Value: "d"}}},
@@ -2276,17 +2295,19 @@ func TestPrintStmtAltSwitch(t *testing.T) {
Stmts: []node.Node{
&stmt.AltSwitch{
Cond: &expr.Variable{VarName: &node.Identifier{Value: "var"}},
- Cases: []node.Node{
- &stmt.Case{
- Cond: &scalar.String{Value: "'a'"},
- Stmts: []node.Node{
- &stmt.Expression{Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}}},
+ CaseList: &stmt.CaseList{
+ Cases: []node.Node{
+ &stmt.Case{
+ Cond: &scalar.String{Value: "'a'"},
+ Stmts: []node.Node{
+ &stmt.Expression{Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}}},
+ },
},
- },
- &stmt.Case{
- Cond: &scalar.String{Value: "'b'"},
- Stmts: []node.Node{
- &stmt.Expression{Expr: &expr.Variable{VarName: &node.Identifier{Value: "b"}}},
+ &stmt.Case{
+ Cond: &scalar.String{Value: "'b'"},
+ Stmts: []node.Node{
+ &stmt.Expression{Expr: &expr.Variable{VarName: &node.Identifier{Value: "b"}}},
+ },
},
},
},
@@ -2443,8 +2464,10 @@ func TestPrintStmtClassMethod(t *testing.T) {
},
},
ReturnType: &name.Name{Parts: []node.Node{&name.NamePart{Value: "void"}}},
- Stmts: []node.Node{
- &stmt.Expression{Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}}},
+ Stmt: &stmt.StmtList{
+ Stmts: []node.Node{
+ &stmt.Expression{Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}}},
+ },
},
})
@@ -2468,10 +2491,14 @@ func TestPrintStmtClass(t *testing.T) {
&stmt.Class{
Modifiers: []node.Node{&node.Identifier{Value: "abstract"}},
ClassName: &node.Identifier{Value: "Foo"},
- Extends: &name.Name{Parts: []node.Node{&name.NamePart{Value: "Bar"}}},
- Implements: []node.Node{
- &name.Name{Parts: []node.Node{&name.NamePart{Value: "Baz"}}},
- &name.Name{Parts: []node.Node{&name.NamePart{Value: "Quuz"}}},
+ Extends: &stmt.ClassExtends{
+ ClassName: &name.Name{Parts: []node.Node{&name.NamePart{Value: "Bar"}}},
+ },
+ Implements: &stmt.ClassImplements{
+ InterfaceNames: []node.Node{
+ &name.Name{Parts: []node.Node{&name.NamePart{Value: "Baz"}}},
+ &name.Name{Parts: []node.Node{&name.NamePart{Value: "Quuz"}}},
+ },
},
Stmts: []node.Node{
&stmt.ClassConstList{
@@ -2509,18 +2536,24 @@ func TestPrintStmtAnonymousClass(t *testing.T) {
Stmts: []node.Node{
&stmt.Class{
Modifiers: []node.Node{&node.Identifier{Value: "abstract"}},
- Args: []node.Node{
- &node.Argument{
- Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
- },
- &node.Argument{
- Expr: &expr.Variable{VarName: &node.Identifier{Value: "b"}},
+ ArgumentList: &node.ArgumentList{
+ Arguments: []node.Node{
+ &node.Argument{
+ Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
+ },
+ &node.Argument{
+ Expr: &expr.Variable{VarName: &node.Identifier{Value: "b"}},
+ },
},
},
- Extends: &name.Name{Parts: []node.Node{&name.NamePart{Value: "Bar"}}},
- Implements: []node.Node{
- &name.Name{Parts: []node.Node{&name.NamePart{Value: "Baz"}}},
- &name.Name{Parts: []node.Node{&name.NamePart{Value: "Quuz"}}},
+ Extends: &stmt.ClassExtends{
+ ClassName: &name.Name{Parts: []node.Node{&name.NamePart{Value: "Bar"}}},
+ },
+ Implements: &stmt.ClassImplements{
+ InterfaceNames: []node.Node{
+ &name.Name{Parts: []node.Node{&name.NamePart{Value: "Baz"}}},
+ &name.Name{Parts: []node.Node{&name.NamePart{Value: "Quuz"}}},
+ },
},
Stmts: []node.Node{
&stmt.ClassConstList{
@@ -3115,10 +3148,9 @@ func TestPrintStmtForeachNop(t *testing.T) {
p := printer.NewPrinter(o, " ")
p.Print(&stmt.Foreach{
- ByRef: true,
Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
Key: &expr.Variable{VarName: &node.Identifier{Value: "k"}},
- Variable: &expr.Variable{VarName: &node.Identifier{Value: "v"}},
+ Variable: &expr.Reference{Variable: &expr.Variable{VarName: &node.Identifier{Value: "v"}}},
Stmt: &stmt.Nop{},
})
@@ -3366,17 +3398,21 @@ func TestPrintInterface(t *testing.T) {
Stmts: []node.Node{
&stmt.Interface{
InterfaceName: &name.Name{Parts: []node.Node{&name.NamePart{Value: "Foo"}}},
- Extends: []node.Node{
- &name.Name{Parts: []node.Node{&name.NamePart{Value: "Bar"}}},
- &name.Name{Parts: []node.Node{&name.NamePart{Value: "Baz"}}},
+ Extends: &stmt.InterfaceExtends{
+ InterfaceNames: []node.Node{
+ &name.Name{Parts: []node.Node{&name.NamePart{Value: "Bar"}}},
+ &name.Name{Parts: []node.Node{&name.NamePart{Value: "Baz"}}},
+ },
},
Stmts: []node.Node{
&stmt.ClassMethod{
Modifiers: []node.Node{&node.Identifier{Value: "public"}},
MethodName: &node.Identifier{Value: "foo"},
Params: []node.Node{},
- Stmts: []node.Node{
- &stmt.Expression{Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}}},
+ Stmt: &stmt.StmtList{
+ Stmts: []node.Node{
+ &stmt.Expression{Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}}},
+ },
},
},
},
@@ -3639,17 +3675,19 @@ func TestPrintStmtSwitch(t *testing.T) {
Stmts: []node.Node{
&stmt.Switch{
Cond: &expr.Variable{VarName: &node.Identifier{Value: "var"}},
- Cases: []node.Node{
- &stmt.Case{
- Cond: &scalar.String{Value: "'a'"},
- Stmts: []node.Node{
- &stmt.Expression{Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}}},
+ CaseList: &stmt.CaseList{
+ Cases: []node.Node{
+ &stmt.Case{
+ Cond: &scalar.String{Value: "'a'"},
+ Stmts: []node.Node{
+ &stmt.Expression{Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}}},
+ },
},
- },
- &stmt.Case{
- Cond: &scalar.String{Value: "'b'"},
- Stmts: []node.Node{
- &stmt.Expression{Expr: &expr.Variable{VarName: &node.Identifier{Value: "b"}}},
+ &stmt.Case{
+ Cond: &scalar.String{Value: "'b'"},
+ Stmts: []node.Node{
+ &stmt.Expression{Expr: &expr.Variable{VarName: &node.Identifier{Value: "b"}}},
+ },
},
},
},
@@ -3779,13 +3817,15 @@ func TestPrintStmtTraitAdaptations(t *testing.T) {
&name.Name{Parts: []node.Node{&name.NamePart{Value: "Foo"}}},
&name.Name{Parts: []node.Node{&name.NamePart{Value: "Bar"}}},
},
- Adaptations: []node.Node{
- &stmt.TraitUseAlias{
- Ref: &stmt.TraitMethodRef{
- Trait: &name.Name{Parts: []node.Node{&name.NamePart{Value: "Foo"}}},
- Method: &node.Identifier{Value: "a"},
+ TraitAdaptationList: &stmt.TraitAdaptationList{
+ Adaptations: []node.Node{
+ &stmt.TraitUseAlias{
+ Ref: &stmt.TraitMethodRef{
+ Trait: &name.Name{Parts: []node.Node{&name.NamePart{Value: "Foo"}}},
+ Method: &node.Identifier{Value: "a"},
+ },
+ Alias: &node.Identifier{Value: "b"},
},
- Alias: &node.Identifier{Value: "b"},
},
},
},
@@ -3817,8 +3857,10 @@ func TestPrintTrait(t *testing.T) {
Modifiers: []node.Node{&node.Identifier{Value: "public"}},
MethodName: &node.Identifier{Value: "foo"},
Params: []node.Node{},
- Stmts: []node.Node{
- &stmt.Expression{Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}}},
+ Stmt: &stmt.StmtList{
+ Stmts: []node.Node{
+ &stmt.Expression{Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}}},
+ },
},
},
},
diff --git a/scanner/lexer.go b/scanner/lexer.go
index e50a7df..12b48ce 100644
--- a/scanner/lexer.go
+++ b/scanner/lexer.go
@@ -8,9 +8,10 @@ import (
"io"
"unicode"
+ "github.com/z7zmey/php-parser/position"
+
"github.com/cznic/golex/lex"
"github.com/z7zmey/php-parser/comment"
- t "github.com/z7zmey/php-parser/token"
)
// Allocate Character classes anywhere in [0x80, 0xFF].
@@ -369,32 +370,32 @@ const T_MINUS_EQUAL = 57460
// T_MUL_EQUAL token
const T_MUL_EQUAL = 57461
+// T_POW_EQUAL token
+const T_POW_EQUAL = 57462
+
// T_DIV_EQUAL token
-const T_DIV_EQUAL = 57462
+const T_DIV_EQUAL = 57463
// T_CONCAT_EQUAL token
-const T_CONCAT_EQUAL = 57463
+const T_CONCAT_EQUAL = 57464
// T_MOD_EQUAL token
-const T_MOD_EQUAL = 57464
+const T_MOD_EQUAL = 57465
// T_AND_EQUAL token
-const T_AND_EQUAL = 57465
+const T_AND_EQUAL = 57466
// T_OR_EQUAL token
-const T_OR_EQUAL = 57466
+const T_OR_EQUAL = 57467
// T_XOR_EQUAL token
-const T_XOR_EQUAL = 57467
+const T_XOR_EQUAL = 57468
// T_SL_EQUAL token
-const T_SL_EQUAL = 57468
+const T_SL_EQUAL = 57469
// T_SR_EQUAL token
-const T_SR_EQUAL = 57469
-
-// T_POW_EQUAL token
-const T_POW_EQUAL = 57470
+const T_SR_EQUAL = 57470
// T_BOOLEAN_OR token
const T_BOOLEAN_OR = 57471
@@ -402,36 +403,36 @@ const T_BOOLEAN_OR = 57471
// T_BOOLEAN_AND token
const T_BOOLEAN_AND = 57472
-// T_IS_EQUAL token
-const T_IS_EQUAL = 57473
-
-// T_IS_NOT_EQUAL token
-const T_IS_NOT_EQUAL = 57474
-
-// T_IS_IDENTICAL token
-const T_IS_IDENTICAL = 57475
-
-// T_IS_NOT_IDENTICAL token
-const T_IS_NOT_IDENTICAL = 57476
-
-// T_IS_SMALLER_OR_EQUAL token
-const T_IS_SMALLER_OR_EQUAL = 57477
-
-// T_IS_GREATER_OR_EQUAL token
-const T_IS_GREATER_OR_EQUAL = 57478
+// T_POW token
+const T_POW = 57473
// T_SL token
-const T_SL = 57479
+const T_SL = 57474
// T_SR token
-const T_SR = 57480
+const T_SR = 57475
-// T_POW token
-const T_POW = 57481
+// T_IS_IDENTICAL token
+const T_IS_IDENTICAL = 57476
+
+// T_IS_NOT_IDENTICAL token
+const T_IS_NOT_IDENTICAL = 57477
+
+// T_IS_EQUAL token
+const T_IS_EQUAL = 57478
+
+// T_IS_NOT_EQUAL token
+const T_IS_NOT_EQUAL = 57479
+
+// T_IS_SMALLER_OR_EQUAL token
+const T_IS_SMALLER_OR_EQUAL = 57480
+
+// T_IS_GREATER_OR_EQUAL token
+const T_IS_GREATER_OR_EQUAL = 57481
// Lval parsers yySymType must implement this interface
type Lval interface {
- Token(tkn t.Token)
+ Token(tkn *Token)
}
// Lexer php lexer
@@ -439,7 +440,7 @@ type Lexer struct {
*lex.Lexer
StateStack []int
PhpDocComment string
- Comments []comment.Comment
+ Comments []*comment.Comment
heredocLabel string
tokenBytesBuf *bytes.Buffer
}
@@ -511,19 +512,32 @@ func (l *Lexer) getCurrentState() int {
return l.StateStack[len(l.StateStack)-1]
}
-func (l *Lexer) newToken(chars []lex.Char) t.Token {
+func (l *Lexer) createToken(chars []lex.Char) *Token {
firstChar := chars[0]
lastChar := chars[len(chars)-1]
- startLine := l.File.Line(firstChar.Pos())
- endLine := l.File.Line(lastChar.Pos())
- startPos := int(firstChar.Pos())
- endPos := int(lastChar.Pos())
+ pos := position.NewPosition(
+ l.File.Line(firstChar.Pos()),
+ l.File.Line(lastChar.Pos()),
+ int(firstChar.Pos()),
+ int(lastChar.Pos()),
+ )
- return t.NewToken(l.tokenString(chars), startLine, endLine, startPos, endPos).SetComments(l.Comments)
+ return NewToken(l.tokenString(chars), pos).SetComments(l.Comments)
}
-func (l *Lexer) addComment(c comment.Comment) {
+func (l *Lexer) addComment(chars []lex.Char) {
+ firstChar := chars[0]
+ lastChar := chars[len(chars)-1]
+
+ pos := position.NewPosition(
+ l.File.Line(firstChar.Pos()),
+ l.File.Line(lastChar.Pos()),
+ int(firstChar.Pos()),
+ int(lastChar.Pos()),
+ )
+
+ c := comment.NewComment(l.tokenString(chars), pos)
l.Comments = append(l.Comments, c)
}
diff --git a/scanner/scanner.go b/scanner/scanner.go
index 725a303..96b28aa 100644
--- a/scanner/scanner.go
+++ b/scanner/scanner.go
@@ -11,7 +11,6 @@ package scanner
import (
"fmt"
"github.com/cznic/golex/lex"
- "github.com/z7zmey/php-parser/comment"
)
const (
@@ -7529,10 +7528,8 @@ yystate602:
}
yyrule1: // [ \t\n\r]+
- {
- lval.Token(l.newToken(l.Token()))
- goto yystate0
- }
+
+ goto yystate0
yyrule2: // .
{
@@ -7553,50 +7550,46 @@ yyrule2: // .
}
c = l.Next()
}
- lval.Token(l.newToken(tb))
+ lval.Token(l.createToken(tb))
return T_INLINE_HTML
}
yyrule3: // \<\?php([ \t]|{NEW_LINE})
{
l.begin(PHP)
- lval.Token(l.newToken(l.Token())) // return T_OPEN_TAG;
goto yystate0
}
yyrule4: // \<\?
{
l.begin(PHP)
- lval.Token(l.newToken(l.Token())) // return T_OPEN_TAG;
goto yystate0
}
yyrule5: // \<\?=
{
l.begin(PHP)
- lval.Token(l.newToken(l.Token()))
+ lval.Token(l.createToken(l.Token()))
return T_ECHO
goto yystate0
}
yyrule6: // [ \t\n\r]+
- {
- lval.Token(l.newToken(l.Token())) // return T_WHITESPACE
- goto yystate0
- }
+
+ goto yystate0
yyrule7: // [;][ \t\n\r]*\?\>{NEW_LINE}?
{
l.begin(INITIAL)
- lval.Token(l.newToken(l.Token()))
+ lval.Token(l.createToken(l.Token()))
return Rune2Class(';')
goto yystate0
}
yyrule8: // \?\>{NEW_LINE}?
{
l.begin(INITIAL)
- lval.Token(l.newToken(l.Token()))
+ lval.Token(l.createToken(l.Token()))
return Rune2Class(';')
goto yystate0
}
yyrule9: // {DNUM}|{EXPONENT_DNUM}
{
- lval.Token(l.newToken(l.Token()))
+ lval.Token(l.createToken(l.Token()))
return T_DNUMBER
goto yystate0
}
@@ -7618,10 +7611,10 @@ yyrule10: // {BNUM}
}
}
if len(tb)-i < 64 {
- lval.Token(l.newToken(l.Token()))
+ lval.Token(l.createToken(l.Token()))
return T_LNUMBER
} else {
- lval.Token(l.newToken(l.Token()))
+ lval.Token(l.createToken(l.Token()))
return T_DNUMBER
}
goto yystate0
@@ -7630,10 +7623,10 @@ yyrule11: // {LNUM}
{
if len(l.Token()) < 20 {
- lval.Token(l.newToken(l.Token()))
+ lval.Token(l.createToken(l.Token()))
return T_LNUMBER
} else {
- lval.Token(l.newToken(l.Token()))
+ lval.Token(l.createToken(l.Token()))
return T_DNUMBER
}
goto yystate0
@@ -7657,704 +7650,701 @@ yyrule12: // {HNUM}
}
length := len(tb) - i
if length < 16 || (length == 16 && tb[i].Rune <= '7') {
- lval.Token(l.newToken(l.Token()))
+ lval.Token(l.createToken(l.Token()))
return T_LNUMBER
} else {
- lval.Token(l.newToken(l.Token()))
+ lval.Token(l.createToken(l.Token()))
return T_DNUMBER
}
goto yystate0
}
yyrule13: // abstract
{
- lval.Token(l.newToken(l.Token()))
+ lval.Token(l.createToken(l.Token()))
return T_ABSTRACT
goto yystate0
}
yyrule14: // array
{
- lval.Token(l.newToken(l.Token()))
+ lval.Token(l.createToken(l.Token()))
return T_ARRAY
goto yystate0
}
yyrule15: // as
{
- lval.Token(l.newToken(l.Token()))
+ lval.Token(l.createToken(l.Token()))
return T_AS
goto yystate0
}
yyrule16: // break
{
- lval.Token(l.newToken(l.Token()))
+ lval.Token(l.createToken(l.Token()))
return T_BREAK
goto yystate0
}
yyrule17: // callable
{
- lval.Token(l.newToken(l.Token()))
+ lval.Token(l.createToken(l.Token()))
return T_CALLABLE
goto yystate0
}
yyrule18: // case
{
- lval.Token(l.newToken(l.Token()))
+ lval.Token(l.createToken(l.Token()))
return T_CASE
goto yystate0
}
yyrule19: // catch
{
- lval.Token(l.newToken(l.Token()))
+ lval.Token(l.createToken(l.Token()))
return T_CATCH
goto yystate0
}
yyrule20: // class
{
- lval.Token(l.newToken(l.Token()))
+ lval.Token(l.createToken(l.Token()))
return T_CLASS
goto yystate0
}
yyrule21: // clone
{
- lval.Token(l.newToken(l.Token()))
+ lval.Token(l.createToken(l.Token()))
return T_CLONE
goto yystate0
}
yyrule22: // const
{
- lval.Token(l.newToken(l.Token()))
+ lval.Token(l.createToken(l.Token()))
return T_CONST
goto yystate0
}
yyrule23: // continue
{
- lval.Token(l.newToken(l.Token()))
+ lval.Token(l.createToken(l.Token()))
return T_CONTINUE
goto yystate0
}
yyrule24: // declare
{
- lval.Token(l.newToken(l.Token()))
+ lval.Token(l.createToken(l.Token()))
return T_DECLARE
goto yystate0
}
yyrule25: // default
{
- lval.Token(l.newToken(l.Token()))
+ lval.Token(l.createToken(l.Token()))
return T_DEFAULT
goto yystate0
}
yyrule26: // do
{
- lval.Token(l.newToken(l.Token()))
+ lval.Token(l.createToken(l.Token()))
return T_DO
goto yystate0
}
yyrule27: // echo
{
- lval.Token(l.newToken(l.Token()))
+ lval.Token(l.createToken(l.Token()))
return T_ECHO
goto yystate0
}
yyrule28: // else
{
- lval.Token(l.newToken(l.Token()))
+ lval.Token(l.createToken(l.Token()))
return T_ELSE
goto yystate0
}
yyrule29: // elseif
{
- lval.Token(l.newToken(l.Token()))
+ lval.Token(l.createToken(l.Token()))
return T_ELSEIF
goto yystate0
}
yyrule30: // empty
{
- lval.Token(l.newToken(l.Token()))
+ lval.Token(l.createToken(l.Token()))
return T_EMPTY
goto yystate0
}
yyrule31: // enddeclare
{
- lval.Token(l.newToken(l.Token()))
+ lval.Token(l.createToken(l.Token()))
return T_ENDDECLARE
goto yystate0
}
yyrule32: // endfor
{
- lval.Token(l.newToken(l.Token()))
+ lval.Token(l.createToken(l.Token()))
return T_ENDFOR
goto yystate0
}
yyrule33: // endforeach
{
- lval.Token(l.newToken(l.Token()))
+ lval.Token(l.createToken(l.Token()))
return T_ENDFOREACH
goto yystate0
}
yyrule34: // endif
{
- lval.Token(l.newToken(l.Token()))
+ lval.Token(l.createToken(l.Token()))
return T_ENDIF
goto yystate0
}
yyrule35: // endswitch
{
- lval.Token(l.newToken(l.Token()))
+ lval.Token(l.createToken(l.Token()))
return T_ENDSWITCH
goto yystate0
}
yyrule36: // endwhile
{
- lval.Token(l.newToken(l.Token()))
+ lval.Token(l.createToken(l.Token()))
return T_ENDWHILE
goto yystate0
}
yyrule37: // eval
{
- lval.Token(l.newToken(l.Token()))
+ lval.Token(l.createToken(l.Token()))
return T_EVAL
goto yystate0
}
yyrule38: // exit|die
{
- lval.Token(l.newToken(l.Token()))
+ lval.Token(l.createToken(l.Token()))
return T_EXIT
goto yystate0
}
yyrule39: // extends
{
- lval.Token(l.newToken(l.Token()))
+ lval.Token(l.createToken(l.Token()))
return T_EXTENDS
goto yystate0
}
yyrule40: // final
{
- lval.Token(l.newToken(l.Token()))
+ lval.Token(l.createToken(l.Token()))
return T_FINAL
goto yystate0
}
yyrule41: // finally
{
- lval.Token(l.newToken(l.Token()))
+ lval.Token(l.createToken(l.Token()))
return T_FINALLY
goto yystate0
}
yyrule42: // for
{
- lval.Token(l.newToken(l.Token()))
+ lval.Token(l.createToken(l.Token()))
return T_FOR
goto yystate0
}
yyrule43: // foreach
{
- lval.Token(l.newToken(l.Token()))
+ lval.Token(l.createToken(l.Token()))
return T_FOREACH
goto yystate0
}
yyrule44: // function|cfunction
{
- lval.Token(l.newToken(l.Token()))
+ lval.Token(l.createToken(l.Token()))
return T_FUNCTION
goto yystate0
}
yyrule45: // global
{
- lval.Token(l.newToken(l.Token()))
+ lval.Token(l.createToken(l.Token()))
return T_GLOBAL
goto yystate0
}
yyrule46: // goto
{
- lval.Token(l.newToken(l.Token()))
+ lval.Token(l.createToken(l.Token()))
return T_GOTO
goto yystate0
}
yyrule47: // if
{
- lval.Token(l.newToken(l.Token()))
+ lval.Token(l.createToken(l.Token()))
return T_IF
goto yystate0
}
yyrule48: // isset
{
- lval.Token(l.newToken(l.Token()))
+ lval.Token(l.createToken(l.Token()))
return T_ISSET
goto yystate0
}
yyrule49: // implements
{
- lval.Token(l.newToken(l.Token()))
+ lval.Token(l.createToken(l.Token()))
return T_IMPLEMENTS
goto yystate0
}
yyrule50: // instanceof
{
- lval.Token(l.newToken(l.Token()))
+ lval.Token(l.createToken(l.Token()))
return T_INSTANCEOF
goto yystate0
}
yyrule51: // insteadof
{
- lval.Token(l.newToken(l.Token()))
+ lval.Token(l.createToken(l.Token()))
return T_INSTEADOF
goto yystate0
}
yyrule52: // interface
{
- lval.Token(l.newToken(l.Token()))
+ lval.Token(l.createToken(l.Token()))
return T_INTERFACE
goto yystate0
}
yyrule53: // list
{
- lval.Token(l.newToken(l.Token()))
+ lval.Token(l.createToken(l.Token()))
return T_LIST
goto yystate0
}
yyrule54: // namespace
{
- lval.Token(l.newToken(l.Token()))
+ lval.Token(l.createToken(l.Token()))
return T_NAMESPACE
goto yystate0
}
yyrule55: // private
{
- lval.Token(l.newToken(l.Token()))
+ lval.Token(l.createToken(l.Token()))
return T_PRIVATE
goto yystate0
}
yyrule56: // public
{
- lval.Token(l.newToken(l.Token()))
+ lval.Token(l.createToken(l.Token()))
return T_PUBLIC
goto yystate0
}
yyrule57: // print
{
- lval.Token(l.newToken(l.Token()))
+ lval.Token(l.createToken(l.Token()))
return T_PRINT
goto yystate0
}
yyrule58: // protected
{
- lval.Token(l.newToken(l.Token()))
+ lval.Token(l.createToken(l.Token()))
return T_PROTECTED
goto yystate0
}
yyrule59: // return
{
- lval.Token(l.newToken(l.Token()))
+ lval.Token(l.createToken(l.Token()))
return T_RETURN
goto yystate0
}
yyrule60: // static
{
- lval.Token(l.newToken(l.Token()))
+ lval.Token(l.createToken(l.Token()))
return T_STATIC
goto yystate0
}
yyrule61: // switch
{
- lval.Token(l.newToken(l.Token()))
+ lval.Token(l.createToken(l.Token()))
return T_SWITCH
goto yystate0
}
yyrule62: // throw
{
- lval.Token(l.newToken(l.Token()))
+ lval.Token(l.createToken(l.Token()))
return T_THROW
goto yystate0
}
yyrule63: // trait
{
- lval.Token(l.newToken(l.Token()))
+ lval.Token(l.createToken(l.Token()))
return T_TRAIT
goto yystate0
}
yyrule64: // try
{
- lval.Token(l.newToken(l.Token()))
+ lval.Token(l.createToken(l.Token()))
return T_TRY
goto yystate0
}
yyrule65: // unset
{
- lval.Token(l.newToken(l.Token()))
+ lval.Token(l.createToken(l.Token()))
return T_UNSET
goto yystate0
}
yyrule66: // use
{
- lval.Token(l.newToken(l.Token()))
+ lval.Token(l.createToken(l.Token()))
return T_USE
goto yystate0
}
yyrule67: // var
{
- lval.Token(l.newToken(l.Token()))
+ lval.Token(l.createToken(l.Token()))
return T_VAR
goto yystate0
}
yyrule68: // while
{
- lval.Token(l.newToken(l.Token()))
+ lval.Token(l.createToken(l.Token()))
return T_WHILE
goto yystate0
}
yyrule69: // yield[ \t\n\r]+from[^a-zA-Z0-9_\x80-\xff]
{
- lval.Token(l.newToken(l.Token()))
+ lval.Token(l.createToken(l.Token()))
return T_YIELD_FROM
goto yystate0
}
yyrule70: // yield
{
- lval.Token(l.newToken(l.Token()))
+ lval.Token(l.createToken(l.Token()))
return T_YIELD
goto yystate0
}
yyrule71: // include
{
- lval.Token(l.newToken(l.Token()))
+ lval.Token(l.createToken(l.Token()))
return T_INCLUDE
goto yystate0
}
yyrule72: // include_once
{
- lval.Token(l.newToken(l.Token()))
+ lval.Token(l.createToken(l.Token()))
return T_INCLUDE_ONCE
goto yystate0
}
yyrule73: // require
{
- lval.Token(l.newToken(l.Token()))
+ lval.Token(l.createToken(l.Token()))
return T_REQUIRE
goto yystate0
}
yyrule74: // require_once
{
- lval.Token(l.newToken(l.Token()))
+ lval.Token(l.createToken(l.Token()))
return T_REQUIRE_ONCE
goto yystate0
}
yyrule75: // __CLASS__
{
- lval.Token(l.newToken(l.Token()))
+ lval.Token(l.createToken(l.Token()))
return T_CLASS_C
goto yystate0
}
yyrule76: // __DIR__
{
- lval.Token(l.newToken(l.Token()))
+ lval.Token(l.createToken(l.Token()))
return T_DIR
goto yystate0
}
yyrule77: // __FILE__
{
- lval.Token(l.newToken(l.Token()))
+ lval.Token(l.createToken(l.Token()))
return T_FILE
goto yystate0
}
yyrule78: // __FUNCTION__
{
- lval.Token(l.newToken(l.Token()))
+ lval.Token(l.createToken(l.Token()))
return T_FUNC_C
goto yystate0
}
yyrule79: // __LINE__
{
- lval.Token(l.newToken(l.Token()))
+ lval.Token(l.createToken(l.Token()))
return T_LINE
goto yystate0
}
yyrule80: // __NAMESPACE__
{
- lval.Token(l.newToken(l.Token()))
+ lval.Token(l.createToken(l.Token()))
return T_NS_C
goto yystate0
}
yyrule81: // __METHOD__
{
- lval.Token(l.newToken(l.Token()))
+ lval.Token(l.createToken(l.Token()))
return T_METHOD_C
goto yystate0
}
yyrule82: // __TRAIT__
{
- lval.Token(l.newToken(l.Token()))
+ lval.Token(l.createToken(l.Token()))
return T_TRAIT_C
goto yystate0
}
yyrule83: // __halt_compiler
{
- lval.Token(l.newToken(l.Token()))
+ lval.Token(l.createToken(l.Token()))
return T_HALT_COMPILER
goto yystate0
}
yyrule84: // \([ \t]*array[ \t]*\)
{
- lval.Token(l.newToken(l.Token()))
+ lval.Token(l.createToken(l.Token()))
return T_ARRAY_CAST
goto yystate0
}
yyrule85: // \([ \t]*(bool|boolean)[ \t]*\)
{
- lval.Token(l.newToken(l.Token()))
+ lval.Token(l.createToken(l.Token()))
return T_BOOL_CAST
goto yystate0
}
yyrule86: // \([ \t]*(real|double|float)[ \t]*\)
{
- lval.Token(l.newToken(l.Token()))
+ lval.Token(l.createToken(l.Token()))
return T_DOUBLE_CAST
goto yystate0
}
yyrule87: // \([ \t]*(int|integer)[ \t]*\)
{
- lval.Token(l.newToken(l.Token()))
+ lval.Token(l.createToken(l.Token()))
return T_INT_CAST
goto yystate0
}
yyrule88: // \([ \t]*object[ \t]*\)
{
- lval.Token(l.newToken(l.Token()))
+ lval.Token(l.createToken(l.Token()))
return T_OBJECT_CAST
goto yystate0
}
yyrule89: // \([ \t]*(string|binary)[ \t]*\)
{
- lval.Token(l.newToken(l.Token()))
+ lval.Token(l.createToken(l.Token()))
return T_STRING_CAST
goto yystate0
}
yyrule90: // \([ \t]*unset[ \t]*\)
{
- lval.Token(l.newToken(l.Token()))
+ lval.Token(l.createToken(l.Token()))
return T_UNSET_CAST
goto yystate0
}
yyrule91: // new
{
- lval.Token(l.newToken(l.Token()))
+ lval.Token(l.createToken(l.Token()))
return T_NEW
goto yystate0
}
yyrule92: // and
{
- lval.Token(l.newToken(l.Token()))
+ lval.Token(l.createToken(l.Token()))
return T_LOGICAL_AND
goto yystate0
}
yyrule93: // or
{
- lval.Token(l.newToken(l.Token()))
+ lval.Token(l.createToken(l.Token()))
return T_LOGICAL_OR
goto yystate0
}
yyrule94: // xor
{
- lval.Token(l.newToken(l.Token()))
+ lval.Token(l.createToken(l.Token()))
return T_LOGICAL_XOR
goto yystate0
}
yyrule95: // \\
{
- lval.Token(l.newToken(l.Token()))
+ lval.Token(l.createToken(l.Token()))
return T_NS_SEPARATOR
goto yystate0
}
yyrule96: // \.\.\.
{
- lval.Token(l.newToken(l.Token()))
+ lval.Token(l.createToken(l.Token()))
return T_ELLIPSIS
goto yystate0
}
yyrule97: // ::
{
- lval.Token(l.newToken(l.Token()))
+ lval.Token(l.createToken(l.Token()))
return T_PAAMAYIM_NEKUDOTAYIM // T_DOUBLE_COLON
goto yystate0
}
yyrule98: // &&
{
- lval.Token(l.newToken(l.Token()))
+ lval.Token(l.createToken(l.Token()))
return T_BOOLEAN_AND
goto yystate0
}
yyrule99: // \|\|
{
- lval.Token(l.newToken(l.Token()))
+ lval.Token(l.createToken(l.Token()))
return T_BOOLEAN_OR
goto yystate0
}
yyrule100: // &=
{
- lval.Token(l.newToken(l.Token()))
+ lval.Token(l.createToken(l.Token()))
return T_AND_EQUAL
goto yystate0
}
yyrule101: // \|=
{
- lval.Token(l.newToken(l.Token()))
+ lval.Token(l.createToken(l.Token()))
return T_OR_EQUAL
goto yystate0
}
yyrule102: // \.=
{
- lval.Token(l.newToken(l.Token()))
+ lval.Token(l.createToken(l.Token()))
return T_CONCAT_EQUAL
goto yystate0
}
yyrule103: // \*=
{
- lval.Token(l.newToken(l.Token()))
+ lval.Token(l.createToken(l.Token()))
return T_MUL_EQUAL
goto yystate0
}
yyrule104: // \*\*=
{
- lval.Token(l.newToken(l.Token()))
+ lval.Token(l.createToken(l.Token()))
return T_POW_EQUAL
goto yystate0
}
yyrule105: // [/]=
{
- lval.Token(l.newToken(l.Token()))
+ lval.Token(l.createToken(l.Token()))
return T_DIV_EQUAL
goto yystate0
}
yyrule106: // \+=
{
- lval.Token(l.newToken(l.Token()))
+ lval.Token(l.createToken(l.Token()))
return T_PLUS_EQUAL
goto yystate0
}
yyrule107: // -=
{
- lval.Token(l.newToken(l.Token()))
+ lval.Token(l.createToken(l.Token()))
return T_MINUS_EQUAL
goto yystate0
}
yyrule108: // \^=
{
- lval.Token(l.newToken(l.Token()))
+ lval.Token(l.createToken(l.Token()))
return T_XOR_EQUAL
goto yystate0
}
yyrule109: // %=
{
- lval.Token(l.newToken(l.Token()))
+ lval.Token(l.createToken(l.Token()))
return T_MOD_EQUAL
goto yystate0
}
yyrule110: // --
{
- lval.Token(l.newToken(l.Token()))
+ lval.Token(l.createToken(l.Token()))
return T_DEC
goto yystate0
}
yyrule111: // \+\+
{
- lval.Token(l.newToken(l.Token()))
+ lval.Token(l.createToken(l.Token()))
return T_INC
goto yystate0
}
yyrule112: // =>
{
- lval.Token(l.newToken(l.Token()))
+ lval.Token(l.createToken(l.Token()))
return T_DOUBLE_ARROW
goto yystate0
}
yyrule113: // \<=\>
{
- lval.Token(l.newToken(l.Token()))
+ lval.Token(l.createToken(l.Token()))
return T_SPACESHIP
goto yystate0
}
yyrule114: // \!=|\<\>
{
- lval.Token(l.newToken(l.Token()))
+ lval.Token(l.createToken(l.Token()))
return T_IS_NOT_EQUAL
goto yystate0
}
yyrule115: // \!==
{
- lval.Token(l.newToken(l.Token()))
+ lval.Token(l.createToken(l.Token()))
return T_IS_NOT_IDENTICAL
goto yystate0
}
yyrule116: // ==
{
- lval.Token(l.newToken(l.Token()))
+ lval.Token(l.createToken(l.Token()))
return T_IS_EQUAL
goto yystate0
}
yyrule117: // ===
{
- lval.Token(l.newToken(l.Token()))
+ lval.Token(l.createToken(l.Token()))
return T_IS_IDENTICAL
goto yystate0
}
yyrule118: // \<\<=
{
- lval.Token(l.newToken(l.Token()))
+ lval.Token(l.createToken(l.Token()))
return T_SL_EQUAL
goto yystate0
}
yyrule119: // \>\>=
{
- lval.Token(l.newToken(l.Token()))
+ lval.Token(l.createToken(l.Token()))
return T_SR_EQUAL
goto yystate0
}
yyrule120: // \>=
{
- lval.Token(l.newToken(l.Token()))
+ lval.Token(l.createToken(l.Token()))
return T_IS_GREATER_OR_EQUAL
goto yystate0
}
yyrule121: // \<=
{
- lval.Token(l.newToken(l.Token()))
+ lval.Token(l.createToken(l.Token()))
return T_IS_SMALLER_OR_EQUAL
goto yystate0
}
yyrule122: // \*\*
{
- lval.Token(l.newToken(l.Token()))
+ lval.Token(l.createToken(l.Token()))
return T_POW
goto yystate0
}
yyrule123: // \<\<
{
- lval.Token(l.newToken(l.Token()))
+ lval.Token(l.createToken(l.Token()))
return T_SL
goto yystate0
}
yyrule124: // \>\>
{
- lval.Token(l.newToken(l.Token()))
+ lval.Token(l.createToken(l.Token()))
return T_SR
goto yystate0
}
yyrule125: // \?\?
{
- lval.Token(l.newToken(l.Token()))
+ lval.Token(l.createToken(l.Token()))
return T_COALESCE
goto yystate0
}
yyrule126: // (#|[/][/])
{
- tb := []rune{}
- for _, chr := range l.Token() {
- tb = append(tb, chr.Rune)
- }
+ tb := l.Token()
for {
if c == -1 {
break
}
- tb = append(tb, rune(c))
+ tb = append(tb, l.Last)
switch c {
case '\r':
c = l.Next()
@@ -8377,7 +8367,7 @@ yyrule126: // (#|[/][/])
}
break
}
- l.addComment(comment.NewPlainComment(string(tb)))
+ l.addComment(tb)
goto yystate0
}
yyrule127: // ([/][*])|([/][*][*])
@@ -8399,72 +8389,67 @@ yyrule127: // ([/][*])|([/][*][*])
}
c = l.Next()
}
- lval.Token(l.newToken(l.Token()))
if is_doc_comment {
l.PhpDocComment = string(l.TokenBytes(nil))
- l.addComment(comment.NewDocComment(string(l.TokenBytes(nil))))
- // return T_DOC_COMMENT
+ l.addComment(l.Token())
} else {
- l.addComment(comment.NewPlainComment(string(l.TokenBytes(nil))))
- // return T_COMMENT
+ l.addComment(l.Token())
}
goto yystate0
}
yyrule128: // {OPERATORS}
{
- lval.Token(l.newToken(l.Token()))
+ lval.Token(l.createToken(l.Token()))
return Rune2Class(rune(l.TokenBytes(nil)[0]))
goto yystate0
}
yyrule129: // \{
{
l.pushState(PHP)
- lval.Token(l.newToken(l.Token()))
+ lval.Token(l.createToken(l.Token()))
return Rune2Class(rune(l.TokenBytes(nil)[0]))
goto yystate0
}
yyrule130: // \}
{
l.popState()
- lval.Token(l.newToken(l.Token()))
+ lval.Token(l.createToken(l.Token()))
return Rune2Class(rune(l.TokenBytes(nil)[0]))
l.PhpDocComment = ""
goto yystate0
}
yyrule131: // \${VAR_NAME}
{
- lval.Token(l.newToken(l.Token()))
+ lval.Token(l.createToken(l.Token()))
return T_VARIABLE
goto yystate0
}
yyrule132: // {VAR_NAME}
{
- lval.Token(l.newToken(l.Token()))
+ lval.Token(l.createToken(l.Token()))
return T_STRING
goto yystate0
}
yyrule133: // ->
{
l.begin(PROPERTY)
- lval.Token(l.newToken(l.Token()))
+ lval.Token(l.createToken(l.Token()))
return T_OBJECT_OPERATOR
goto yystate0
}
yyrule134: // [ \t\n\r]+
- {
- lval.Token(l.newToken(l.Token())) // return T_WHITESPACE;
- goto yystate0
- }
+
+ goto yystate0
yyrule135: // ->
{
- lval.Token(l.newToken(l.Token()))
+ lval.Token(l.createToken(l.Token()))
return T_OBJECT_OPERATOR
goto yystate0
}
yyrule136: // {VAR_NAME}
{
l.begin(PHP)
- lval.Token(l.newToken(l.Token()))
+ lval.Token(l.createToken(l.Token()))
return T_STRING
goto yystate0
}
@@ -8476,21 +8461,21 @@ yyrule137: // .
}
yyrule138: // [\']([^\\\']*([\\].)*)*[\']
{
- lval.Token(l.newToken(l.Token()))
+ lval.Token(l.createToken(l.Token()))
return T_CONSTANT_ENCAPSED_STRING
goto yystate0
}
yyrule139: // `
{
l.begin(BACKQUOTE)
- lval.Token(l.newToken(l.Token()))
+ lval.Token(l.createToken(l.Token()))
return Rune2Class(rune(l.TokenBytes(nil)[0]))
goto yystate0
}
yyrule140: // `
{
l.begin(PHP)
- lval.Token(l.newToken(l.Token()))
+ lval.Token(l.createToken(l.Token()))
return Rune2Class(rune(l.TokenBytes(nil)[0]))
goto yystate0
}
@@ -8548,7 +8533,7 @@ yyrule141: // [b]?\<\<\<[ \t]*({VAR_NAME}|([']{VAR_NAME}['])|(["]{VAR_NAME}["]))
}
}
l.ungetChars(ungetCnt)
- lval.Token(l.newToken(heredocToken))
+ lval.Token(l.createToken(heredocToken))
return T_START_HEREDOC
}
yyrule142: // .|[ \t\n\r]
@@ -8579,20 +8564,20 @@ yyrule142: // .|[ \t\n\r]
}
c = l.Next()
}
- lval.Token(l.newToken(tb))
+ lval.Token(l.createToken(tb))
return T_ENCAPSED_AND_WHITESPACE
}
yyrule143: // {VAR_NAME}\;
{
l.begin(PHP)
- lval.Token(l.newToken(l.ungetChars(1)))
+ lval.Token(l.createToken(l.ungetChars(1)))
return T_END_HEREDOC
goto yystate0
}
yyrule144: // {VAR_NAME}
{
l.begin(PHP)
- lval.Token(l.newToken(l.Token()))
+ lval.Token(l.createToken(l.Token()))
return T_END_HEREDOC
goto yystate0
}
@@ -8609,7 +8594,7 @@ yyrule145: // [b]?[\"]
l.ungetChars(len(l.Token()) - cnt)
chars := l.Token()[:cnt]
l.pushState(STRING)
- lval.Token(l.newToken(chars))
+ lval.Token(l.createToken(chars))
return Rune2Class('"')
}
F:
@@ -8620,7 +8605,7 @@ yyrule145: // [b]?[\"]
switch c {
case '"':
c = l.Next()
- lval.Token(l.newToken(l.Token()))
+ lval.Token(l.createToken(l.Token()))
return T_CONSTANT_ENCAPSED_STRING
break F
@@ -8649,13 +8634,13 @@ yyrule145: // [b]?[\"]
yyrule146: // \"
{
l.popState()
- lval.Token(l.newToken(l.Token()))
+ lval.Token(l.createToken(l.Token()))
return Rune2Class(l.Token()[0].Rune)
goto yystate0
}
yyrule147: // \{\$
{
- lval.Token(l.newToken(l.ungetChars(1)))
+ lval.Token(l.createToken(l.ungetChars(1)))
l.pushState(PHP)
return T_CURLY_OPEN
goto yystate0
@@ -8663,7 +8648,7 @@ yyrule147: // \{\$
yyrule148: // \$\{
{
l.pushState(STRING_VAR_NAME)
- lval.Token(l.newToken(l.Token()))
+ lval.Token(l.createToken(l.Token()))
return T_DOLLAR_OPEN_CURLY_BRACES
goto yystate0
}
@@ -8683,13 +8668,13 @@ yyrule150: // .|[ \t\n\r]
case '$':
if c == '{' || isValidFirstVarNameRune(rune(c)) {
l.ungetChars(1)
- lval.Token(l.newToken(tb[:len(tb)-1]))
+ lval.Token(l.createToken(tb[:len(tb)-1]))
return T_ENCAPSED_AND_WHITESPACE
}
case '{':
if rune(c) == '$' {
l.ungetChars(1)
- lval.Token(l.newToken(tb[:len(tb)-1]))
+ lval.Token(l.createToken(tb[:len(tb)-1]))
return T_ENCAPSED_AND_WHITESPACE
}
case '\\':
@@ -8698,7 +8683,7 @@ yyrule150: // .|[ \t\n\r]
c = l.Next()
}
if rune(c) == '"' {
- lval.Token(l.newToken(l.Token()))
+ lval.Token(l.createToken(l.Token()))
return T_ENCAPSED_AND_WHITESPACE
}
currentChar = l.Last
@@ -8720,13 +8705,13 @@ yyrule151: // .|[ \t\n\r]
case '$':
if c == '{' || isValidFirstVarNameRune(rune(c)) {
l.ungetChars(1)
- lval.Token(l.newToken(tb[:len(tb)-1]))
+ lval.Token(l.createToken(tb[:len(tb)-1]))
return T_ENCAPSED_AND_WHITESPACE
}
case '{':
if rune(c) == '$' {
l.ungetChars(1)
- lval.Token(l.newToken(tb[:len(tb)-1]))
+ lval.Token(l.createToken(tb[:len(tb)-1]))
return T_ENCAPSED_AND_WHITESPACE
}
case '\\':
@@ -8735,7 +8720,7 @@ yyrule151: // .|[ \t\n\r]
c = l.Next()
}
if rune(c) == '`' {
- lval.Token(l.newToken(l.Token()))
+ lval.Token(l.createToken(l.Token()))
return T_ENCAPSED_AND_WHITESPACE
}
currentChar = l.Last
@@ -8771,13 +8756,13 @@ yyrule152: // .|[ \t\n\r]
if l.heredocLabel+";" == string(searchLabel) {
l.begin(HEREDOC_END)
tb = l.ungetChars(len(l.heredocLabel) + 1 + nls)
- lval.Token(l.newToken(tb))
+ lval.Token(l.createToken(tb))
return T_ENCAPSED_AND_WHITESPACE
}
if l.heredocLabel == string(searchLabel) {
l.begin(HEREDOC_END)
tb = l.ungetChars(len(l.heredocLabel) + nls)
- lval.Token(l.newToken(tb))
+ lval.Token(l.createToken(tb))
return T_ENCAPSED_AND_WHITESPACE
}
@@ -8787,7 +8772,7 @@ yyrule152: // .|[ \t\n\r]
c = l.Next()
if rune(c) == '{' || isValidFirstVarNameRune(rune(c)) {
tb = l.ungetChars(1)
- lval.Token(l.newToken(tb))
+ lval.Token(l.createToken(tb))
return T_ENCAPSED_AND_WHITESPACE
}
l.ungetChars(0)
@@ -8796,7 +8781,7 @@ yyrule152: // .|[ \t\n\r]
c = l.Next()
if rune(c) == '$' {
tb = l.ungetChars(1)
- lval.Token(l.newToken(tb))
+ lval.Token(l.createToken(tb))
return T_ENCAPSED_AND_WHITESPACE
}
l.ungetChars(0)
@@ -8815,27 +8800,27 @@ yyrule152: // .|[ \t\n\r]
}
yyrule153: // \${VAR_NAME}
{
- lval.Token(l.newToken(l.Token()))
+ lval.Token(l.createToken(l.Token()))
return T_VARIABLE
goto yystate0
}
yyrule154: // ->{VAR_NAME}
{
- lval.Token(l.newToken(l.ungetChars(len(l.Token()) - 2)))
+ lval.Token(l.createToken(l.ungetChars(len(l.Token()) - 2)))
return T_OBJECT_OPERATOR
goto yystate0
}
yyrule155: // {VAR_NAME}
{
l.popState()
- lval.Token(l.newToken(l.Token()))
+ lval.Token(l.createToken(l.Token()))
return T_STRING
goto yystate0
}
yyrule156: // \[
{
l.pushState(STRING_VAR_INDEX)
- lval.Token(l.newToken(l.Token()))
+ lval.Token(l.createToken(l.Token()))
return Rune2Class(rune(l.TokenBytes(nil)[0]))
goto yystate0
}
@@ -8847,19 +8832,19 @@ yyrule157: // .|[ \t\n\r]
}
yyrule158: // {LNUM}|{HNUM}|{BNUM}
{
- lval.Token(l.newToken(l.Token()))
+ lval.Token(l.createToken(l.Token()))
return T_NUM_STRING
goto yystate0
}
yyrule159: // \${VAR_NAME}
{
- lval.Token(l.newToken(l.Token()))
+ lval.Token(l.createToken(l.Token()))
return T_VARIABLE
goto yystate0
}
yyrule160: // {VAR_NAME}
{
- lval.Token(l.newToken(l.Token()))
+ lval.Token(l.createToken(l.Token()))
return T_STRING
goto yystate0
}
@@ -8867,7 +8852,7 @@ yyrule161: // \]
{
l.popState()
l.popState()
- lval.Token(l.newToken(l.Token()))
+ lval.Token(l.createToken(l.Token()))
return Rune2Class(rune(l.TokenBytes(nil)[0]))
goto yystate0
}
@@ -8875,19 +8860,19 @@ yyrule162: // [ \n\r\t\\'#]
{
l.popState()
l.popState()
- lval.Token(l.newToken(l.Token()))
+ lval.Token(l.createToken(l.Token()))
return T_ENCAPSED_AND_WHITESPACE
goto yystate0
}
yyrule163: // {OPERATORS}
{
- lval.Token(l.newToken(l.Token()))
+ lval.Token(l.createToken(l.Token()))
return Rune2Class(rune(l.TokenBytes(nil)[0]))
goto yystate0
}
yyrule164: // .
{
- lval.Token(l.newToken(l.Token()))
+ lval.Token(l.createToken(l.Token()))
return Rune2Class(rune(l.TokenBytes(nil)[0]))
goto yystate0
}
@@ -8895,7 +8880,7 @@ yyrule165: // {VAR_NAME}[\[\}]
{
l.popState()
l.pushState(PHP)
- lval.Token(l.newToken(l.ungetChars(1)))
+ lval.Token(l.createToken(l.ungetChars(1)))
return T_STRING_VARNAME
goto yystate0
}
diff --git a/scanner/scanner.l b/scanner/scanner.l
index d107bb7..6e4f95f 100644
--- a/scanner/scanner.l
+++ b/scanner/scanner.l
@@ -10,7 +10,6 @@ package scanner
import (
"fmt"
"github.com/cznic/golex/lex"
- "github.com/z7zmey/php-parser/comment"
)
const (
@@ -58,7 +57,7 @@ NEW_LINE (\r|\n|\r\n)
%%
c = l.Rule0()
-[ \t\n\r]+ lval.Token(l.newToken(l.Token()));
+[ \t\n\r]+
.
tb := []lex.Char{}
@@ -82,18 +81,18 @@ NEW_LINE (\r|\n|\r\n)
c = l.Next()
}
- lval.Token(l.newToken(tb))
+ lval.Token(l.createToken(tb))
return T_INLINE_HTML
-\<\?php([ \t]|{NEW_LINE}) l.begin(PHP);lval.Token(l.newToken(l.Token()));// return T_OPEN_TAG;
-\<\? l.begin(PHP);lval.Token(l.newToken(l.Token()));// return T_OPEN_TAG;
-\<\?= l.begin(PHP);lval.Token(l.newToken(l.Token())); return T_ECHO;
+\<\?php([ \t]|{NEW_LINE}) l.begin(PHP);
+\<\? l.begin(PHP);
+\<\?= l.begin(PHP);lval.Token(l.createToken(l.Token())); return T_ECHO;
-[ \t\n\r]+ lval.Token(l.newToken(l.Token()));// return T_WHITESPACE
-[;][ \t\n\r]*\?\>{NEW_LINE}? l.begin(INITIAL);lval.Token(l.newToken(l.Token())); return Rune2Class(';');
-\?\>{NEW_LINE}? l.begin(INITIAL);lval.Token(l.newToken(l.Token())); return Rune2Class(';');
+[ \t\n\r]+
+[;][ \t\n\r]*\?\>{NEW_LINE}? l.begin(INITIAL);lval.Token(l.createToken(l.Token())); return Rune2Class(';');
+\?\>{NEW_LINE}? l.begin(INITIAL);lval.Token(l.createToken(l.Token())); return Rune2Class(';');
-{DNUM}|{EXPONENT_DNUM} lval.Token(l.newToken(l.Token())); return T_DNUMBER
+{DNUM}|{EXPONENT_DNUM} lval.Token(l.createToken(l.Token())); return T_DNUMBER
{BNUM}
tb := l.Token()
i:=2
@@ -107,15 +106,15 @@ NEW_LINE (\r|\n|\r\n)
}
}
if len(tb) - i < 64 {
- lval.Token(l.newToken(l.Token())); return T_LNUMBER
+ lval.Token(l.createToken(l.Token())); return T_LNUMBER
} else {
- lval.Token(l.newToken(l.Token())); return T_DNUMBER
+ lval.Token(l.createToken(l.Token())); return T_DNUMBER
}
{LNUM}
if len(l.Token()) < 20 {
- lval.Token(l.newToken(l.Token())); return T_LNUMBER
+ lval.Token(l.createToken(l.Token())); return T_LNUMBER
} else {
- lval.Token(l.newToken(l.Token())); return T_DNUMBER
+ lval.Token(l.createToken(l.Token())); return T_DNUMBER
}
{HNUM}
tb := l.Token()
@@ -131,137 +130,133 @@ NEW_LINE (\r|\n|\r\n)
}
length := len(tb) - i
if length < 16 || (length == 16 && tb[i].Rune <= '7') {
- lval.Token(l.newToken(l.Token())); return T_LNUMBER
+ lval.Token(l.createToken(l.Token())); return T_LNUMBER
} else {
- lval.Token(l.newToken(l.Token())); return T_DNUMBER
+ lval.Token(l.createToken(l.Token())); return T_DNUMBER
}
-abstract lval.Token(l.newToken(l.Token())); return T_ABSTRACT
-array lval.Token(l.newToken(l.Token())); return T_ARRAY
-as lval.Token(l.newToken(l.Token())); return T_AS
-break lval.Token(l.newToken(l.Token())); return T_BREAK
-callable lval.Token(l.newToken(l.Token())); return T_CALLABLE
-case lval.Token(l.newToken(l.Token())); return T_CASE
-catch lval.Token(l.newToken(l.Token())); return T_CATCH
-class lval.Token(l.newToken(l.Token())); return T_CLASS
-clone lval.Token(l.newToken(l.Token())); return T_CLONE
-const lval.Token(l.newToken(l.Token())); return T_CONST
-continue lval.Token(l.newToken(l.Token())); return T_CONTINUE
-declare lval.Token(l.newToken(l.Token())); return T_DECLARE
-default lval.Token(l.newToken(l.Token())); return T_DEFAULT
-do lval.Token(l.newToken(l.Token())); return T_DO
-echo lval.Token(l.newToken(l.Token())); return T_ECHO
-else lval.Token(l.newToken(l.Token())); return T_ELSE
-elseif lval.Token(l.newToken(l.Token())); return T_ELSEIF
-empty lval.Token(l.newToken(l.Token())); return T_EMPTY
-enddeclare lval.Token(l.newToken(l.Token())); return T_ENDDECLARE
-endfor lval.Token(l.newToken(l.Token())); return T_ENDFOR
-endforeach lval.Token(l.newToken(l.Token())); return T_ENDFOREACH
-endif lval.Token(l.newToken(l.Token())); return T_ENDIF
-endswitch lval.Token(l.newToken(l.Token())); return T_ENDSWITCH
-endwhile lval.Token(l.newToken(l.Token())); return T_ENDWHILE
-eval lval.Token(l.newToken(l.Token())); return T_EVAL
-exit|die lval.Token(l.newToken(l.Token())); return T_EXIT
-extends lval.Token(l.newToken(l.Token())); return T_EXTENDS
-final lval.Token(l.newToken(l.Token())); return T_FINAL
-finally lval.Token(l.newToken(l.Token())); return T_FINALLY
-for lval.Token(l.newToken(l.Token())); return T_FOR
-foreach lval.Token(l.newToken(l.Token())); return T_FOREACH
-function|cfunction lval.Token(l.newToken(l.Token())); return T_FUNCTION
-global lval.Token(l.newToken(l.Token())); return T_GLOBAL
-goto lval.Token(l.newToken(l.Token())); return T_GOTO
-if lval.Token(l.newToken(l.Token())); return T_IF
-isset lval.Token(l.newToken(l.Token())); return T_ISSET
-implements lval.Token(l.newToken(l.Token())); return T_IMPLEMENTS
-instanceof lval.Token(l.newToken(l.Token())); return T_INSTANCEOF
-insteadof lval.Token(l.newToken(l.Token())); return T_INSTEADOF
-interface lval.Token(l.newToken(l.Token())); return T_INTERFACE
-list lval.Token(l.newToken(l.Token())); return T_LIST
-namespace lval.Token(l.newToken(l.Token())); return T_NAMESPACE
-private lval.Token(l.newToken(l.Token())); return T_PRIVATE
-public lval.Token(l.newToken(l.Token())); return T_PUBLIC
-print lval.Token(l.newToken(l.Token())); return T_PRINT
-protected lval.Token(l.newToken(l.Token())); return T_PROTECTED
-return lval.Token(l.newToken(l.Token())); return T_RETURN
-static lval.Token(l.newToken(l.Token())); return T_STATIC
-switch lval.Token(l.newToken(l.Token())); return T_SWITCH
-throw lval.Token(l.newToken(l.Token())); return T_THROW
-trait lval.Token(l.newToken(l.Token())); return T_TRAIT
-try lval.Token(l.newToken(l.Token())); return T_TRY
-unset lval.Token(l.newToken(l.Token())); return T_UNSET
-use lval.Token(l.newToken(l.Token())); return T_USE
-var lval.Token(l.newToken(l.Token())); return T_VAR
-while lval.Token(l.newToken(l.Token())); return T_WHILE
-yield[ \t\n\r]+from[^a-zA-Z0-9_\x80-\xff] lval.Token(l.newToken(l.Token())); return T_YIELD_FROM
-yield lval.Token(l.newToken(l.Token())); return T_YIELD
-include lval.Token(l.newToken(l.Token())); return T_INCLUDE
-