diff --git a/internal/php5/node.go b/internal/php5/node.go deleted file mode 100644 index e0963fa..0000000 --- a/internal/php5/node.go +++ /dev/null @@ -1,85 +0,0 @@ -package php5 - -import ( - "github.com/VKCOM/php-parser/pkg/ast" - "github.com/VKCOM/php-parser/pkg/position" - "github.com/VKCOM/php-parser/pkg/token" -) - -type ParserBrackets struct { - Position *position.Position - OpenBracketTkn *token.Token - Child ast.Vertex - CloseBracketTkn *token.Token -} - -func (n *ParserBrackets) Accept(v ast.Visitor) { - // do nothing -} - -func (n *ParserBrackets) GetPosition() *position.Position { - return n.Position -} - -type ParserSeparatedList struct { - Position *position.Position - Items []ast.Vertex - SeparatorTkns []*token.Token -} - -func (n *ParserSeparatedList) Accept(v ast.Visitor) { - // do nothing -} - -func (n *ParserSeparatedList) GetPosition() *position.Position { - return n.Position -} - -// TraitAdaptationList node -type TraitAdaptationList struct { - Position *position.Position - OpenCurlyBracketTkn *token.Token - Adaptations []ast.Vertex - CloseCurlyBracketTkn *token.Token -} - -func (n *TraitAdaptationList) Accept(v ast.Visitor) { - // do nothing -} - -func (n *TraitAdaptationList) GetPosition() *position.Position { - return n.Position -} - -// ArgumentList node -type ArgumentList struct { - Position *position.Position - OpenParenthesisTkn *token.Token - Arguments []ast.Vertex - SeparatorTkns []*token.Token - CloseParenthesisTkn *token.Token -} - -func (n *ArgumentList) Accept(v ast.Visitor) { - // do nothing -} - -func (n *ArgumentList) GetPosition() *position.Position { - return n.Position -} - -// TraitMethodRef node -type TraitMethodRef struct { - Position *position.Position - Trait ast.Vertex - DoubleColonTkn *token.Token - Method ast.Vertex -} - -func (n *TraitMethodRef) Accept(v ast.Visitor) { - // do nothing -} - -func (n *TraitMethodRef) GetPosition() *position.Position { - return n.Position -} diff --git a/internal/php5/parser.go b/internal/php5/parser.go deleted file mode 100644 index 8fd6578..0000000 --- a/internal/php5/parser.go +++ /dev/null @@ -1,66 +0,0 @@ -package php5 - -import ( - "github.com/VKCOM/php-parser/internal/position" - "github.com/VKCOM/php-parser/internal/scanner" - "github.com/VKCOM/php-parser/pkg/ast" - "github.com/VKCOM/php-parser/pkg/conf" - "github.com/VKCOM/php-parser/pkg/errors" - "github.com/VKCOM/php-parser/pkg/token" -) - -// Parser structure -type Parser struct { - Lexer *scanner.Lexer - currentToken *token.Token - rootNode ast.Vertex - errHandlerFunc func(*errors.Error) - builder *position.Builder -} - -// NewParser creates and returns new Parser -func NewParser(lexer *scanner.Lexer, config conf.Config) *Parser { - return &Parser{ - Lexer: lexer, - errHandlerFunc: config.ErrorHandlerFunc, - builder: position.NewBuilder(), - } -} - -// Lex proxy to scanner Lex -func (p *Parser) Lex(lval *yySymType) int { - t := p.Lexer.Lex() - - p.currentToken = t - lval.token = t - - return int(t.ID) -} - -func (p *Parser) Error(msg string) { - if p.errHandlerFunc == nil { - return - } - - p.errHandlerFunc(errors.NewError(msg, p.currentToken.Position)) -} - -// Parse the php7 Parser entrypoint -func (p *Parser) Parse() int { - p.rootNode = nil - return yyParse(p) -} - -// GetRootNode returns root node -func (p *Parser) GetRootNode() ast.Vertex { - return p.rootNode -} - -// helpers - -func lastNode(nn []ast.Vertex) ast.Vertex { - if len(nn) == 0 { - return nil - } - return nn[len(nn)-1] -} diff --git a/internal/php5/parser_test.go b/internal/php5/parser_test.go deleted file mode 100644 index dbab6a2..0000000 --- a/internal/php5/parser_test.go +++ /dev/null @@ -1,50781 +0,0 @@ -package php5_test - -import ( - "testing" - - "gotest.tools/assert" - - "github.com/VKCOM/php-parser/internal/php5" - "github.com/VKCOM/php-parser/internal/scanner" - "github.com/VKCOM/php-parser/pkg/ast" - "github.com/VKCOM/php-parser/pkg/conf" - "github.com/VKCOM/php-parser/pkg/errors" - "github.com/VKCOM/php-parser/pkg/position" - "github.com/VKCOM/php-parser/pkg/token" - "github.com/VKCOM/php-parser/pkg/version" -) - -func TestIdentifier(t *testing.T) { - src := `bar($a, ...$b); - foo::bar($a, ...$b); - $foo::bar($a, ...$b); - new foo($a, ...$b);` - - expected := &ast.Root{ - Position: &position.Position{ - StartLine: 2, - EndLine: 7, - StartPos: 5, - EndPos: 132, - }, - Stmts: []ast.Vertex{ - &ast.StmtExpression{ - Position: &position.Position{ - StartLine: 2, - EndLine: 2, - StartPos: 5, - EndPos: 20, - }, - Expr: &ast.ExprFunctionCall{ - Position: &position.Position{ - StartLine: 2, - EndLine: 2, - StartPos: 5, - EndPos: 19, - }, - Function: &ast.Name{ - Position: &position.Position{ - StartLine: 2, - EndLine: 2, - StartPos: 5, - EndPos: 8, - }, - Parts: []ast.Vertex{ - &ast.NamePart{ - Position: &position.Position{ - StartLine: 2, - EndLine: 2, - StartPos: 5, - EndPos: 8, - }, - StringTkn: &token.Token{ - ID: token.T_STRING, - Value: []byte("foo"), - Position: &position.Position{ - StartLine: 2, - EndLine: 2, - StartPos: 5, - EndPos: 8, - }, - FreeFloating: []*token.Token{ - { - ID: token.T_OPEN_TAG, - Value: []byte(""), - Position: &position.Position{ - StartLine: 4, - EndLine: 4, - StartPos: 46, - EndPos: 48, - }, - }, - Method: &ast.Identifier{ - Position: &position.Position{ - StartLine: 4, - EndLine: 4, - StartPos: 48, - EndPos: 51, - }, - IdentifierTkn: &token.Token{ - ID: token.T_STRING, - Value: []byte("bar"), - Position: &position.Position{ - StartLine: 4, - EndLine: 4, - StartPos: 48, - EndPos: 51, - }, - }, - Value: []byte("bar"), - }, - OpenParenthesisTkn: &token.Token{ - ID: token.ID(40), - Value: []byte("("), - Position: &position.Position{ - StartLine: 4, - EndLine: 4, - StartPos: 51, - EndPos: 52, - }, - }, - Args: []ast.Vertex{ - &ast.Argument{ - Position: &position.Position{ - StartLine: 4, - EndLine: 4, - StartPos: 52, - EndPos: 54, - }, - Expr: &ast.ExprVariable{ - Position: &position.Position{ - StartLine: 4, - EndLine: 4, - StartPos: 52, - EndPos: 54, - }, - Name: &ast.Identifier{ - Position: &position.Position{ - StartLine: 4, - EndLine: 4, - StartPos: 52, - EndPos: 54, - }, - IdentifierTkn: &token.Token{ - ID: token.T_VARIABLE, - Value: []byte("$a"), - Position: &position.Position{ - StartLine: 4, - EndLine: 4, - StartPos: 52, - EndPos: 54, - }, - }, - Value: []byte("$a"), - }, - }, - }, - &ast.Argument{ - Position: &position.Position{ - StartLine: 4, - EndLine: 4, - StartPos: 56, - EndPos: 61, - }, - VariadicTkn: &token.Token{ - ID: token.T_ELLIPSIS, - Value: []byte("..."), - Position: &position.Position{ - StartLine: 4, - EndLine: 4, - StartPos: 56, - EndPos: 59, - }, - FreeFloating: []*token.Token{ - { - ID: token.T_WHITESPACE, - Value: []byte(" "), - Position: &position.Position{ - StartLine: 4, - EndLine: 4, - StartPos: 55, - EndPos: 56, - }, - }, - }, - }, - Expr: &ast.ExprVariable{ - Position: &position.Position{ - StartLine: 4, - EndLine: 4, - StartPos: 59, - EndPos: 61, - }, - Name: &ast.Identifier{ - Position: &position.Position{ - StartLine: 4, - EndLine: 4, - StartPos: 59, - EndPos: 61, - }, - IdentifierTkn: &token.Token{ - ID: token.T_VARIABLE, - Value: []byte("$b"), - Position: &position.Position{ - StartLine: 4, - EndLine: 4, - StartPos: 59, - EndPos: 61, - }, - }, - Value: []byte("$b"), - }, - }, - }, - }, - SeparatorTkns: []*token.Token{ - { - ID: token.ID(44), - Value: []byte(","), - Position: &position.Position{ - StartLine: 4, - EndLine: 4, - StartPos: 54, - EndPos: 55, - }, - }, - }, - CloseParenthesisTkn: &token.Token{ - ID: token.ID(41), - Value: []byte(")"), - Position: &position.Position{ - StartLine: 4, - EndLine: 4, - StartPos: 61, - EndPos: 62, - }, - }, - }, - SemiColonTkn: &token.Token{ - ID: token.ID(59), - Value: []byte(";"), - Position: &position.Position{ - StartLine: 4, - EndLine: 4, - StartPos: 62, - EndPos: 63, - }, - }, - }, - &ast.StmtExpression{ - Position: &position.Position{ - StartLine: 5, - EndLine: 5, - StartPos: 66, - EndPos: 86, - }, - Expr: &ast.ExprStaticCall{ - Position: &position.Position{ - StartLine: 5, - EndLine: 5, - StartPos: 66, - EndPos: 85, - }, - Class: &ast.Name{ - Position: &position.Position{ - StartLine: 5, - EndLine: 5, - StartPos: 66, - EndPos: 69, - }, - Parts: []ast.Vertex{ - &ast.NamePart{ - Position: &position.Position{ - StartLine: 5, - EndLine: 5, - StartPos: 66, - EndPos: 69, - }, - StringTkn: &token.Token{ - ID: token.T_STRING, - Value: []byte("foo"), - Position: &position.Position{ - StartLine: 5, - EndLine: 5, - StartPos: 66, - EndPos: 69, - }, - FreeFloating: []*token.Token{ - { - ID: token.T_WHITESPACE, - Value: []byte("\n\t\t"), - Position: &position.Position{ - StartLine: 4, - EndLine: 5, - StartPos: 63, - EndPos: 66, - }, - }, - }, - }, - Value: []byte("foo"), - }, - }, - }, - DoubleColonTkn: &token.Token{ - ID: token.T_PAAMAYIM_NEKUDOTAYIM, - Value: []byte("::"), - Position: &position.Position{ - StartLine: 5, - EndLine: 5, - StartPos: 69, - EndPos: 71, - }, - }, - Call: &ast.Identifier{ - Position: &position.Position{ - StartLine: 5, - EndLine: 5, - StartPos: 71, - EndPos: 74, - }, - IdentifierTkn: &token.Token{ - ID: token.T_STRING, - Value: []byte("bar"), - Position: &position.Position{ - StartLine: 5, - EndLine: 5, - StartPos: 71, - EndPos: 74, - }, - }, - Value: []byte("bar"), - }, - OpenParenthesisTkn: &token.Token{ - ID: token.ID(40), - Value: []byte("("), - Position: &position.Position{ - StartLine: 5, - EndLine: 5, - StartPos: 74, - EndPos: 75, - }, - }, - Args: []ast.Vertex{ - &ast.Argument{ - Position: &position.Position{ - StartLine: 5, - EndLine: 5, - StartPos: 75, - EndPos: 77, - }, - Expr: &ast.ExprVariable{ - Position: &position.Position{ - StartLine: 5, - EndLine: 5, - StartPos: 75, - EndPos: 77, - }, - Name: &ast.Identifier{ - Position: &position.Position{ - StartLine: 5, - EndLine: 5, - StartPos: 75, - EndPos: 77, - }, - IdentifierTkn: &token.Token{ - ID: token.T_VARIABLE, - Value: []byte("$a"), - Position: &position.Position{ - StartLine: 5, - EndLine: 5, - StartPos: 75, - EndPos: 77, - }, - }, - Value: []byte("$a"), - }, - }, - }, - &ast.Argument{ - Position: &position.Position{ - StartLine: 5, - EndLine: 5, - StartPos: 79, - EndPos: 84, - }, - VariadicTkn: &token.Token{ - ID: token.T_ELLIPSIS, - Value: []byte("..."), - Position: &position.Position{ - StartLine: 5, - EndLine: 5, - StartPos: 79, - EndPos: 82, - }, - FreeFloating: []*token.Token{ - { - ID: token.T_WHITESPACE, - Value: []byte(" "), - Position: &position.Position{ - StartLine: 5, - EndLine: 5, - StartPos: 78, - EndPos: 79, - }, - }, - }, - }, - Expr: &ast.ExprVariable{ - Position: &position.Position{ - StartLine: 5, - EndLine: 5, - StartPos: 82, - EndPos: 84, - }, - Name: &ast.Identifier{ - Position: &position.Position{ - StartLine: 5, - EndLine: 5, - StartPos: 82, - EndPos: 84, - }, - IdentifierTkn: &token.Token{ - ID: token.T_VARIABLE, - Value: []byte("$b"), - Position: &position.Position{ - StartLine: 5, - EndLine: 5, - StartPos: 82, - EndPos: 84, - }, - }, - Value: []byte("$b"), - }, - }, - }, - }, - SeparatorTkns: []*token.Token{ - { - ID: token.ID(44), - Value: []byte(","), - Position: &position.Position{ - StartLine: 5, - EndLine: 5, - StartPos: 77, - EndPos: 78, - }, - }, - }, - CloseParenthesisTkn: &token.Token{ - ID: token.ID(41), - Value: []byte(")"), - Position: &position.Position{ - StartLine: 5, - EndLine: 5, - StartPos: 84, - EndPos: 85, - }, - }, - }, - SemiColonTkn: &token.Token{ - ID: token.ID(59), - Value: []byte(";"), - Position: &position.Position{ - StartLine: 5, - EndLine: 5, - StartPos: 85, - EndPos: 86, - }, - }, - }, - &ast.StmtExpression{ - Position: &position.Position{ - StartLine: 6, - EndLine: 6, - StartPos: 89, - EndPos: 110, - }, - Expr: &ast.ExprStaticCall{ - Position: &position.Position{ - StartLine: 6, - EndLine: 6, - StartPos: 89, - EndPos: 109, - }, - Class: &ast.ExprVariable{ - Position: &position.Position{ - StartLine: 6, - EndLine: 6, - StartPos: 89, - EndPos: 93, - }, - Name: &ast.Identifier{ - Position: &position.Position{ - StartLine: 6, - EndLine: 6, - StartPos: 89, - EndPos: 93, - }, - IdentifierTkn: &token.Token{ - ID: token.T_VARIABLE, - Value: []byte("$foo"), - Position: &position.Position{ - StartLine: 6, - EndLine: 6, - StartPos: 89, - EndPos: 93, - }, - FreeFloating: []*token.Token{ - { - ID: token.T_WHITESPACE, - Value: []byte("\n\t\t"), - Position: &position.Position{ - StartLine: 5, - EndLine: 6, - StartPos: 86, - EndPos: 89, - }, - }, - }, - }, - Value: []byte("$foo"), - }, - }, - DoubleColonTkn: &token.Token{ - ID: token.T_PAAMAYIM_NEKUDOTAYIM, - Value: []byte("::"), - Position: &position.Position{ - StartLine: 6, - EndLine: 6, - StartPos: 93, - EndPos: 95, - }, - }, - Call: &ast.Identifier{ - Position: &position.Position{ - StartLine: 6, - EndLine: 6, - StartPos: 95, - EndPos: 98, - }, - IdentifierTkn: &token.Token{ - ID: token.T_STRING, - Value: []byte("bar"), - Position: &position.Position{ - StartLine: 6, - EndLine: 6, - StartPos: 95, - EndPos: 98, - }, - }, - Value: []byte("bar"), - }, - OpenParenthesisTkn: &token.Token{ - ID: token.ID(40), - Value: []byte("("), - Position: &position.Position{ - StartLine: 6, - EndLine: 6, - StartPos: 98, - EndPos: 99, - }, - }, - Args: []ast.Vertex{ - &ast.Argument{ - Position: &position.Position{ - StartLine: 6, - EndLine: 6, - StartPos: 99, - EndPos: 101, - }, - Expr: &ast.ExprVariable{ - Position: &position.Position{ - StartLine: 6, - EndLine: 6, - StartPos: 99, - EndPos: 101, - }, - Name: &ast.Identifier{ - Position: &position.Position{ - StartLine: 6, - EndLine: 6, - StartPos: 99, - EndPos: 101, - }, - IdentifierTkn: &token.Token{ - ID: token.T_VARIABLE, - Value: []byte("$a"), - Position: &position.Position{ - StartLine: 6, - EndLine: 6, - StartPos: 99, - EndPos: 101, - }, - }, - Value: []byte("$a"), - }, - }, - }, - &ast.Argument{ - Position: &position.Position{ - StartLine: 6, - EndLine: 6, - StartPos: 103, - EndPos: 108, - }, - VariadicTkn: &token.Token{ - ID: token.T_ELLIPSIS, - Value: []byte("..."), - Position: &position.Position{ - StartLine: 6, - EndLine: 6, - StartPos: 103, - EndPos: 106, - }, - FreeFloating: []*token.Token{ - { - ID: token.T_WHITESPACE, - Value: []byte(" "), - Position: &position.Position{ - StartLine: 6, - EndLine: 6, - StartPos: 102, - EndPos: 103, - }, - }, - }, - }, - Expr: &ast.ExprVariable{ - Position: &position.Position{ - StartLine: 6, - EndLine: 6, - StartPos: 106, - EndPos: 108, - }, - Name: &ast.Identifier{ - Position: &position.Position{ - StartLine: 6, - EndLine: 6, - StartPos: 106, - EndPos: 108, - }, - IdentifierTkn: &token.Token{ - ID: token.T_VARIABLE, - Value: []byte("$b"), - Position: &position.Position{ - StartLine: 6, - EndLine: 6, - StartPos: 106, - EndPos: 108, - }, - }, - Value: []byte("$b"), - }, - }, - }, - }, - SeparatorTkns: []*token.Token{ - { - ID: token.ID(44), - Value: []byte(","), - Position: &position.Position{ - StartLine: 6, - EndLine: 6, - StartPos: 101, - EndPos: 102, - }, - }, - }, - CloseParenthesisTkn: &token.Token{ - ID: token.ID(41), - Value: []byte(")"), - Position: &position.Position{ - StartLine: 6, - EndLine: 6, - StartPos: 108, - EndPos: 109, - }, - }, - }, - SemiColonTkn: &token.Token{ - ID: token.ID(59), - Value: []byte(";"), - Position: &position.Position{ - StartLine: 6, - EndLine: 6, - StartPos: 109, - EndPos: 110, - }, - }, - }, - &ast.StmtExpression{ - Position: &position.Position{ - StartLine: 7, - EndLine: 7, - StartPos: 113, - EndPos: 132, - }, - Expr: &ast.ExprNew{ - Position: &position.Position{ - StartLine: 7, - EndLine: 7, - StartPos: 113, - EndPos: 131, - }, - NewTkn: &token.Token{ - ID: token.T_NEW, - Value: []byte("new"), - Position: &position.Position{ - StartLine: 7, - EndLine: 7, - StartPos: 113, - EndPos: 116, - }, - FreeFloating: []*token.Token{ - { - ID: token.T_WHITESPACE, - Value: []byte("\n\t\t"), - Position: &position.Position{ - StartLine: 6, - EndLine: 7, - StartPos: 110, - EndPos: 113, - }, - }, - }, - }, - Class: &ast.Name{ - Position: &position.Position{ - StartLine: 7, - EndLine: 7, - StartPos: 117, - EndPos: 120, - }, - Parts: []ast.Vertex{ - &ast.NamePart{ - Position: &position.Position{ - StartLine: 7, - EndLine: 7, - StartPos: 117, - EndPos: 120, - }, - StringTkn: &token.Token{ - ID: token.T_STRING, - Value: []byte("foo"), - Position: &position.Position{ - StartLine: 7, - EndLine: 7, - StartPos: 117, - EndPos: 120, - }, - FreeFloating: []*token.Token{ - { - ID: token.T_WHITESPACE, - Value: []byte(" "), - Position: &position.Position{ - StartLine: 7, - EndLine: 7, - StartPos: 116, - EndPos: 117, - }, - }, - }, - }, - Value: []byte("foo"), - }, - }, - }, - OpenParenthesisTkn: &token.Token{ - ID: token.ID(40), - Value: []byte("("), - Position: &position.Position{ - StartLine: 7, - EndLine: 7, - StartPos: 120, - EndPos: 121, - }, - }, - Args: []ast.Vertex{ - &ast.Argument{ - Position: &position.Position{ - StartLine: 7, - EndLine: 7, - StartPos: 121, - EndPos: 123, - }, - Expr: &ast.ExprVariable{ - Position: &position.Position{ - StartLine: 7, - EndLine: 7, - StartPos: 121, - EndPos: 123, - }, - Name: &ast.Identifier{ - Position: &position.Position{ - StartLine: 7, - EndLine: 7, - StartPos: 121, - EndPos: 123, - }, - IdentifierTkn: &token.Token{ - ID: token.T_VARIABLE, - Value: []byte("$a"), - Position: &position.Position{ - StartLine: 7, - EndLine: 7, - StartPos: 121, - EndPos: 123, - }, - }, - Value: []byte("$a"), - }, - }, - }, - &ast.Argument{ - Position: &position.Position{ - StartLine: 7, - EndLine: 7, - StartPos: 125, - EndPos: 130, - }, - VariadicTkn: &token.Token{ - ID: token.T_ELLIPSIS, - Value: []byte("..."), - Position: &position.Position{ - StartLine: 7, - EndLine: 7, - StartPos: 125, - EndPos: 128, - }, - FreeFloating: []*token.Token{ - { - ID: token.T_WHITESPACE, - Value: []byte(" "), - Position: &position.Position{ - StartLine: 7, - EndLine: 7, - StartPos: 124, - EndPos: 125, - }, - }, - }, - }, - Expr: &ast.ExprVariable{ - Position: &position.Position{ - StartLine: 7, - EndLine: 7, - StartPos: 128, - EndPos: 130, - }, - Name: &ast.Identifier{ - Position: &position.Position{ - StartLine: 7, - EndLine: 7, - StartPos: 128, - EndPos: 130, - }, - IdentifierTkn: &token.Token{ - ID: token.T_VARIABLE, - Value: []byte("$b"), - Position: &position.Position{ - StartLine: 7, - EndLine: 7, - StartPos: 128, - EndPos: 130, - }, - }, - Value: []byte("$b"), - }, - }, - }, - }, - SeparatorTkns: []*token.Token{ - { - ID: token.ID(44), - Value: []byte(","), - Position: &position.Position{ - StartLine: 7, - EndLine: 7, - StartPos: 123, - EndPos: 124, - }, - }, - }, - CloseParenthesisTkn: &token.Token{ - ID: token.ID(41), - Value: []byte(")"), - Position: &position.Position{ - StartLine: 7, - EndLine: 7, - StartPos: 130, - EndPos: 131, - }, - }, - }, - SemiColonTkn: &token.Token{ - ID: token.ID(59), - Value: []byte(";"), - Position: &position.Position{ - StartLine: 7, - EndLine: 7, - StartPos: 131, - EndPos: 132, - }, - }, - }, - }, - EndTkn: &token.Token{}, - } - - config := conf.Config{ - Version: &version.Version{ - Major: 5, - Minor: 6, - }, - } - lexer := scanner.NewLexer([]byte(src), config) - php5parser := php5.NewParser(lexer, config) - php5parser.Parse() - actual := php5parser.GetRootNode() - assert.DeepEqual(t, expected, actual) -} - -func TestPhp5ParameterNode(t *testing.T) { - src := `bar()";` - - expected := &ast.Root{ - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 3, - EndPos: 22, - }, - Stmts: []ast.Vertex{ - &ast.StmtExpression{ - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 3, - EndPos: 22, - }, - Expr: &ast.ScalarEncapsed{ - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 3, - EndPos: 21, - }, - OpenQuoteTkn: &token.Token{ - ID: token.ID(34), - Value: []byte("\""), - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 3, - EndPos: 4, - }, - FreeFloating: []*token.Token{ - { - ID: token.T_OPEN_TAG, - Value: []byte(""), - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 13, - EndPos: 15, - }, - }, - Prop: &ast.Identifier{ - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 15, - EndPos: 18, - }, - IdentifierTkn: &token.Token{ - ID: token.T_STRING, - Value: []byte("bar"), - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 15, - EndPos: 18, - }, - }, - Value: []byte("bar"), - }, - }, - &ast.ScalarEncapsedStringPart{ - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 18, - EndPos: 20, - }, - EncapsedStrTkn: &token.Token{ - ID: token.T_ENCAPSED_AND_WHITESPACE, - Value: []byte("()"), - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 18, - EndPos: 20, - }, - }, - Value: []byte("()"), - }, - }, - CloseQuoteTkn: &token.Token{ - ID: token.ID(34), - Value: []byte("\""), - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 20, - EndPos: 21, - }, - }, - }, - SemiColonTkn: &token.Token{ - ID: token.ID(59), - Value: []byte(";"), - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 21, - EndPos: 22, - }, - }, - }, - }, - EndTkn: &token.Token{}, - } - - config := conf.Config{ - Version: &version.Version{ - Major: 5, - Minor: 6, - }, - } - lexer := scanner.NewLexer([]byte(src), config) - php5parser := php5.NewParser(lexer, config) - php5parser.Parse() - actual := php5parser.GetRootNode() - assert.DeepEqual(t, expected, actual) -} - -func TestScalarEncapsed_DollarOpenCurlyBraces(t *testing.T) { - src := `bar()}";` - - expected := &ast.Root{ - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 3, - EndPos: 24, - }, - Stmts: []ast.Vertex{ - &ast.StmtExpression{ - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 3, - EndPos: 24, - }, - Expr: &ast.ScalarEncapsed{ - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 3, - EndPos: 23, - }, - OpenQuoteTkn: &token.Token{ - ID: token.ID(34), - Value: []byte("\""), - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 3, - EndPos: 4, - }, - FreeFloating: []*token.Token{ - { - ID: token.T_OPEN_TAG, - Value: []byte(""), - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 14, - EndPos: 16, - }, - }, - Method: &ast.Identifier{ - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 16, - EndPos: 19, - }, - IdentifierTkn: &token.Token{ - ID: token.T_STRING, - Value: []byte("bar"), - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 16, - EndPos: 19, - }, - }, - Value: []byte("bar"), - }, - OpenParenthesisTkn: &token.Token{ - ID: token.ID(40), - Value: []byte("("), - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 19, - EndPos: 20, - }, - }, - CloseParenthesisTkn: &token.Token{ - ID: token.ID(41), - Value: []byte(")"), - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 20, - EndPos: 21, - }, - }, - }, - CloseCurlyBracketTkn: &token.Token{ - ID: token.ID(125), - Value: []byte("}"), - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 21, - EndPos: 22, - }, - }, - }, - }, - CloseQuoteTkn: &token.Token{ - ID: token.ID(34), - Value: []byte("\""), - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 22, - EndPos: 23, - }, - }, - }, - SemiColonTkn: &token.Token{ - ID: token.ID(59), - Value: []byte(";"), - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 23, - EndPos: 24, - }, - }, - }, - }, - EndTkn: &token.Token{}, - } - - config := conf.Config{ - Version: &version.Version{ - Major: 5, - Minor: 6, - }, - } - lexer := scanner.NewLexer([]byte(src), config) - php5parser := php5.NewParser(lexer, config) - php5parser.Parse() - actual := php5parser.GetRootNode() - assert.DeepEqual(t, expected, actual) -} - -func TestScalarHeredoc_HeredocSimpleLabel(t *testing.T) { - src := ` $v) {}` - - expected := &ast.Root{ - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 3, - EndPos: 30, - }, - Stmts: []ast.Vertex{ - &ast.StmtForeach{ - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 3, - EndPos: 30, - }, - ForeachTkn: &token.Token{ - ID: token.T_FOREACH, - Value: []byte("foreach"), - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 3, - EndPos: 10, - }, - FreeFloating: []*token.Token{ - { - ID: token.T_OPEN_TAG, - Value: []byte(""), - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 21, - EndPos: 23, - }, - FreeFloating: []*token.Token{ - { - ID: token.T_WHITESPACE, - Value: []byte(" "), - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 20, - EndPos: 21, - }, - }, - }, - }, - Var: &ast.ExprVariable{ - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 24, - EndPos: 26, - }, - Name: &ast.Identifier{ - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 24, - EndPos: 26, - }, - IdentifierTkn: &token.Token{ - ID: token.T_VARIABLE, - Value: []byte("$v"), - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 24, - EndPos: 26, - }, - FreeFloating: []*token.Token{ - { - ID: token.T_WHITESPACE, - Value: []byte(" "), - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 23, - EndPos: 24, - }, - }, - }, - }, - Value: []byte("$v"), - }, - }, - CloseParenthesisTkn: &token.Token{ - ID: token.ID(41), - Value: []byte(")"), - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 26, - EndPos: 27, - }, - }, - Stmt: &ast.StmtStmtList{ - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 28, - EndPos: 30, - }, - OpenCurlyBracketTkn: &token.Token{ - ID: token.ID(123), - Value: []byte("{"), - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 28, - EndPos: 29, - }, - FreeFloating: []*token.Token{ - { - ID: token.T_WHITESPACE, - Value: []byte(" "), - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 27, - EndPos: 28, - }, - }, - }, - }, - Stmts: []ast.Vertex{}, - CloseCurlyBracketTkn: &token.Token{ - ID: token.ID(125), - Value: []byte("}"), - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 29, - EndPos: 30, - }, - }, - }, - }, - }, - EndTkn: &token.Token{}, - } - - config := conf.Config{ - Version: &version.Version{ - Major: 5, - Minor: 6, - }, - } - lexer := scanner.NewLexer([]byte(src), config) - php5parser := php5.NewParser(lexer, config) - php5parser.Parse() - actual := php5parser.GetRootNode() - assert.DeepEqual(t, expected, actual) -} - -func TestStmtForeach_ExprWithKey(t *testing.T) { - src := ` $v) {}` - - expected := &ast.Root{ - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 3, - EndPos: 30, - }, - Stmts: []ast.Vertex{ - &ast.StmtForeach{ - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 3, - EndPos: 30, - }, - ForeachTkn: &token.Token{ - ID: token.T_FOREACH, - Value: []byte("foreach"), - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 3, - EndPos: 10, - }, - FreeFloating: []*token.Token{ - { - ID: token.T_OPEN_TAG, - Value: []byte(""), - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 21, - EndPos: 23, - }, - FreeFloating: []*token.Token{ - { - ID: token.T_WHITESPACE, - Value: []byte(" "), - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 20, - EndPos: 21, - }, - }, - }, - }, - Var: &ast.ExprVariable{ - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 24, - EndPos: 26, - }, - Name: &ast.Identifier{ - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 24, - EndPos: 26, - }, - IdentifierTkn: &token.Token{ - ID: token.T_VARIABLE, - Value: []byte("$v"), - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 24, - EndPos: 26, - }, - FreeFloating: []*token.Token{ - { - ID: token.T_WHITESPACE, - Value: []byte(" "), - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 23, - EndPos: 24, - }, - }, - }, - }, - Value: []byte("$v"), - }, - }, - CloseParenthesisTkn: &token.Token{ - ID: token.ID(41), - Value: []byte(")"), - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 26, - EndPos: 27, - }, - }, - Stmt: &ast.StmtStmtList{ - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 28, - EndPos: 30, - }, - OpenCurlyBracketTkn: &token.Token{ - ID: token.ID(123), - Value: []byte("{"), - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 28, - EndPos: 29, - }, - FreeFloating: []*token.Token{ - { - ID: token.T_WHITESPACE, - Value: []byte(" "), - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 27, - EndPos: 28, - }, - }, - }, - }, - Stmts: []ast.Vertex{}, - CloseCurlyBracketTkn: &token.Token{ - ID: token.ID(125), - Value: []byte("}"), - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 29, - EndPos: 30, - }, - }, - }, - }, - }, - EndTkn: &token.Token{}, - } - - config := conf.Config{ - Version: &version.Version{ - Major: 5, - Minor: 6, - }, - } - lexer := scanner.NewLexer([]byte(src), config) - php5parser := php5.NewParser(lexer, config) - php5parser.Parse() - actual := php5parser.GetRootNode() - assert.DeepEqual(t, expected, actual) -} - -func TestStmtForeach_WithRef(t *testing.T) { - src := ` &$v) {}` - - expected := &ast.Root{ - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 3, - EndPos: 31, - }, - Stmts: []ast.Vertex{ - &ast.StmtForeach{ - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 3, - EndPos: 31, - }, - ForeachTkn: &token.Token{ - ID: token.T_FOREACH, - Value: []byte("foreach"), - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 3, - EndPos: 10, - }, - FreeFloating: []*token.Token{ - { - ID: token.T_OPEN_TAG, - Value: []byte(""), - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 21, - EndPos: 23, - }, - FreeFloating: []*token.Token{ - { - ID: token.T_WHITESPACE, - Value: []byte(" "), - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 20, - EndPos: 21, - }, - }, - }, - }, - AmpersandTkn: &token.Token{ - ID: token.ID(38), - Value: []byte("&"), - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 24, - EndPos: 25, - }, - FreeFloating: []*token.Token{ - { - ID: token.T_WHITESPACE, - Value: []byte(" "), - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 23, - EndPos: 24, - }, - }, - }, - }, - Var: &ast.ExprVariable{ - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 25, - EndPos: 27, - }, - Name: &ast.Identifier{ - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 25, - EndPos: 27, - }, - IdentifierTkn: &token.Token{ - ID: token.T_VARIABLE, - Value: []byte("$v"), - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 25, - EndPos: 27, - }, - }, - Value: []byte("$v"), - }, - }, - CloseParenthesisTkn: &token.Token{ - ID: token.ID(41), - Value: []byte(")"), - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 27, - EndPos: 28, - }, - }, - Stmt: &ast.StmtStmtList{ - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 29, - EndPos: 31, - }, - OpenCurlyBracketTkn: &token.Token{ - ID: token.ID(123), - Value: []byte("{"), - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 29, - EndPos: 30, - }, - FreeFloating: []*token.Token{ - { - ID: token.T_WHITESPACE, - Value: []byte(" "), - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 28, - EndPos: 29, - }, - }, - }, - }, - Stmts: []ast.Vertex{}, - CloseCurlyBracketTkn: &token.Token{ - ID: token.ID(125), - Value: []byte("}"), - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 30, - EndPos: 31, - }, - }, - }, - }, - }, - EndTkn: &token.Token{}, - } - - config := conf.Config{ - Version: &version.Version{ - Major: 5, - Minor: 6, - }, - } - lexer := scanner.NewLexer([]byte(src), config) - php5parser := php5.NewParser(lexer, config) - php5parser.Parse() - actual := php5parser.GetRootNode() - assert.DeepEqual(t, expected, actual) -} - -func TestStmtForeach_WithList(t *testing.T) { - src := ` list($v)) {}` - - expected := &ast.Root{ - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 3, - EndPos: 36, - }, - Stmts: []ast.Vertex{ - &ast.StmtForeach{ - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 3, - EndPos: 36, - }, - ForeachTkn: &token.Token{ - ID: token.T_FOREACH, - Value: []byte("foreach"), - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 3, - EndPos: 10, - }, - FreeFloating: []*token.Token{ - { - ID: token.T_OPEN_TAG, - Value: []byte(""), - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 21, - EndPos: 23, - }, - FreeFloating: []*token.Token{ - { - ID: token.T_WHITESPACE, - Value: []byte(" "), - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 20, - EndPos: 21, - }, - }, - }, - }, - Var: &ast.ExprList{ - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 24, - EndPos: 32, - }, - ListTkn: &token.Token{ - ID: token.T_LIST, - Value: []byte("list"), - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 24, - EndPos: 28, - }, - FreeFloating: []*token.Token{ - { - ID: token.T_WHITESPACE, - Value: []byte(" "), - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 23, - EndPos: 24, - }, - }, - }, - }, - OpenBracketTkn: &token.Token{ - ID: token.ID(40), - Value: []byte("("), - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 28, - EndPos: 29, - }, - }, - Items: []ast.Vertex{ - &ast.ExprArrayItem{ - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 29, - EndPos: 31, - }, - Val: &ast.ExprVariable{ - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 29, - EndPos: 31, - }, - Name: &ast.Identifier{ - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 29, - EndPos: 31, - }, - IdentifierTkn: &token.Token{ - ID: token.T_VARIABLE, - Value: []byte("$v"), - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 29, - EndPos: 31, - }, - }, - Value: []byte("$v"), - }, - }, - }, - }, - CloseBracketTkn: &token.Token{ - ID: token.ID(41), - Value: []byte(")"), - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 31, - EndPos: 32, - }, - }, - }, - CloseParenthesisTkn: &token.Token{ - ID: token.ID(41), - Value: []byte(")"), - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 32, - EndPos: 33, - }, - }, - Stmt: &ast.StmtStmtList{ - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 34, - EndPos: 36, - }, - OpenCurlyBracketTkn: &token.Token{ - ID: token.ID(123), - Value: []byte("{"), - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 34, - EndPos: 35, - }, - FreeFloating: []*token.Token{ - { - ID: token.T_WHITESPACE, - Value: []byte(" "), - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 33, - EndPos: 34, - }, - }, - }, - }, - Stmts: []ast.Vertex{}, - CloseCurlyBracketTkn: &token.Token{ - ID: token.ID(125), - Value: []byte("}"), - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 35, - EndPos: 36, - }, - }, - }, - }, - }, - EndTkn: &token.Token{}, - } - - config := conf.Config{ - Version: &version.Version{ - Major: 5, - Minor: 6, - }, - } - lexer := scanner.NewLexer([]byte(src), config) - php5parser := php5.NewParser(lexer, config) - php5parser.Parse() - actual := php5parser.GetRootNode() - assert.DeepEqual(t, expected, actual) -} - -func TestStmtFunction(t *testing.T) { - src := `
` - - expected := &ast.Root{ - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 3, - EndPos: 17, - }, - Stmts: []ast.Vertex{ - &ast.StmtNop{ - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 3, - EndPos: 5, - }, - SemiColonTkn: &token.Token{ - ID: token.ID(59), - Value: []byte("?>"), - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 3, - EndPos: 5, - }, - FreeFloating: []*token.Token{ - { - ID: token.T_OPEN_TAG, - Value: []byte(""), - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 5, - EndPos: 17, - }, - }, - Value: []byte("
"), - }, - }, - EndTkn: &token.Token{}, - } - - config := conf.Config{ - Version: &version.Version{ - Major: 5, - Minor: 6, - }, - } - lexer := scanner.NewLexer([]byte(src), config) - php5parser := php5.NewParser(lexer, config) - php5parser.Parse() - actual := php5parser.GetRootNode() - assert.DeepEqual(t, expected, actual) -} - -func TestStmtInterface(t *testing.T) { - src := `1, &$b,);` - - expected := &ast.Root{ - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 3, - EndPos: 21, - }, - Stmts: []ast.Vertex{ - &ast.StmtExpression{ - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 3, - EndPos: 21, - }, - Expr: &ast.ExprArray{ - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 3, - EndPos: 20, - }, - ArrayTkn: &token.Token{ - ID: token.T_ARRAY, - Value: []byte("array"), - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 3, - EndPos: 8, - }, - FreeFloating: []*token.Token{ - { - ID: token.T_OPEN_TAG, - Value: []byte(""), - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 10, - EndPos: 12, - }, - }, - Val: &ast.ScalarLnumber{ - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 12, - EndPos: 13, - }, - NumberTkn: &token.Token{ - ID: token.T_LNUMBER, - Value: []byte("1"), - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 12, - EndPos: 13, - }, - }, - Value: []byte("1"), - }, - }, - &ast.ExprArrayItem{ - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 15, - EndPos: 18, - }, - AmpersandTkn: &token.Token{ - ID: token.ID(38), - Value: []byte("&"), - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 15, - EndPos: 16, - }, - FreeFloating: []*token.Token{ - { - ID: token.T_WHITESPACE, - Value: []byte(" "), - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 14, - EndPos: 15, - }, - }, - }, - }, - Val: &ast.ExprVariable{ - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 16, - EndPos: 18, - }, - Name: &ast.Identifier{ - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 16, - EndPos: 18, - }, - IdentifierTkn: &token.Token{ - ID: token.T_VARIABLE, - Value: []byte("$b"), - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 16, - EndPos: 18, - }, - }, - Value: []byte("$b"), - }, - }, - }, - &ast.ExprArrayItem{}, - }, - SeparatorTkns: []*token.Token{ - { - ID: token.ID(44), - Value: []byte(","), - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 13, - EndPos: 14, - }, - }, - { - ID: token.ID(44), - Value: []byte(","), - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 18, - EndPos: 19, - }, - }, - }, - CloseBracketTkn: &token.Token{ - ID: token.ID(41), - Value: []byte(")"), - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 19, - EndPos: 20, - }, - }, - }, - SemiColonTkn: &token.Token{ - ID: token.ID(59), - Value: []byte(";"), - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 20, - EndPos: 21, - }, - }, - }, - }, - EndTkn: &token.Token{}, - } - - config := conf.Config{ - Version: &version.Version{ - Major: 5, - Minor: 6, - }, - } - lexer := scanner.NewLexer([]byte(src), config) - php5parser := php5.NewParser(lexer, config) - php5parser.Parse() - actual := php5parser.GetRootNode() - assert.DeepEqual(t, expected, actual) -} - -func TestExprBitwiseNot(t *testing.T) { - src := `foo();` - - expected := &ast.Root{ - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 3, - EndPos: 13, - }, - Stmts: []ast.Vertex{ - &ast.StmtExpression{ - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 3, - EndPos: 13, - }, - Expr: &ast.ExprMethodCall{ - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 3, - EndPos: 12, - }, - Var: &ast.ExprVariable{ - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 3, - EndPos: 5, - }, - Name: &ast.Identifier{ - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 3, - EndPos: 5, - }, - IdentifierTkn: &token.Token{ - ID: token.T_VARIABLE, - Value: []byte("$a"), - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 3, - EndPos: 5, - }, - FreeFloating: []*token.Token{ - { - ID: token.T_OPEN_TAG, - Value: []byte(""), - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 5, - EndPos: 7, - }, - }, - Method: &ast.Identifier{ - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 7, - EndPos: 10, - }, - IdentifierTkn: &token.Token{ - ID: token.T_STRING, - Value: []byte("foo"), - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 7, - EndPos: 10, - }, - }, - Value: []byte("foo"), - }, - OpenParenthesisTkn: &token.Token{ - ID: token.ID(40), - Value: []byte("("), - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 10, - EndPos: 11, - }, - }, - CloseParenthesisTkn: &token.Token{ - ID: token.ID(41), - Value: []byte(")"), - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 11, - EndPos: 12, - }, - }, - }, - SemiColonTkn: &token.Token{ - ID: token.ID(59), - Value: []byte(";"), - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 12, - EndPos: 13, - }, - }, - }, - }, - EndTkn: &token.Token{}, - } - - config := conf.Config{ - Version: &version.Version{ - Major: 5, - Minor: 6, - }, - } - lexer := scanner.NewLexer([]byte(src), config) - php5parser := php5.NewParser(lexer, config) - php5parser.Parse() - actual := php5parser.GetRootNode() - assert.DeepEqual(t, expected, actual) -} - -func TestExprNew(t *testing.T) { - src := `b["c"]()->d["e"]();` - -func TestExprPropertyFetch(t *testing.T) { - src := `foo;` - - expected := &ast.Root{ - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 3, - EndPos: 11, - }, - Stmts: []ast.Vertex{ - &ast.StmtExpression{ - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 3, - EndPos: 11, - }, - Expr: &ast.ExprPropertyFetch{ - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 3, - EndPos: 10, - }, - Var: &ast.ExprVariable{ - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 3, - EndPos: 5, - }, - Name: &ast.Identifier{ - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 3, - EndPos: 5, - }, - IdentifierTkn: &token.Token{ - ID: token.T_VARIABLE, - Value: []byte("$a"), - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 3, - EndPos: 5, - }, - FreeFloating: []*token.Token{ - { - ID: token.T_OPEN_TAG, - Value: []byte(""), - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 5, - EndPos: 7, - }, - }, - Prop: &ast.Identifier{ - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 7, - EndPos: 10, - }, - IdentifierTkn: &token.Token{ - ID: token.T_STRING, - Value: []byte("foo"), - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 7, - EndPos: 10, - }, - }, - Value: []byte("foo"), - }, - }, - SemiColonTkn: &token.Token{ - ID: token.ID(59), - Value: []byte(";"), - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 10, - EndPos: 11, - }, - }, - }, - }, - EndTkn: &token.Token{}, - } - - config := conf.Config{ - Version: &version.Version{ - Major: 5, - Minor: 6, - }, - } - lexer := scanner.NewLexer([]byte(src), config) - php5parser := php5.NewParser(lexer, config) - php5parser.Parse() - actual := php5parser.GetRootNode() - assert.DeepEqual(t, expected, actual) -} - -func TestExprShellExec(t *testing.T) { - src := "1, &$b,];` - - expected := &ast.Root{ - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 3, - EndPos: 16, - }, - Stmts: []ast.Vertex{ - &ast.StmtExpression{ - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 3, - EndPos: 16, - }, - Expr: &ast.ExprArray{ - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 3, - EndPos: 15, - }, - OpenBracketTkn: &token.Token{ - ID: token.ID(91), - Value: []byte("["), - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 3, - EndPos: 4, - }, - FreeFloating: []*token.Token{ - { - ID: token.T_OPEN_TAG, - Value: []byte(""), - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 5, - EndPos: 7, - }, - }, - Val: &ast.ScalarLnumber{ - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 7, - EndPos: 8, - }, - NumberTkn: &token.Token{ - ID: token.T_LNUMBER, - Value: []byte("1"), - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 7, - EndPos: 8, - }, - }, - Value: []byte("1"), - }, - }, - &ast.ExprArrayItem{ - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 10, - EndPos: 13, - }, - AmpersandTkn: &token.Token{ - ID: token.ID(38), - Value: []byte("&"), - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 10, - EndPos: 11, - }, - FreeFloating: []*token.Token{ - { - ID: token.T_WHITESPACE, - Value: []byte(" "), - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 9, - EndPos: 10, - }, - }, - }, - }, - Val: &ast.ExprVariable{ - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 11, - EndPos: 13, - }, - Name: &ast.Identifier{ - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 11, - EndPos: 13, - }, - IdentifierTkn: &token.Token{ - ID: token.T_VARIABLE, - Value: []byte("$b"), - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 11, - EndPos: 13, - }, - }, - Value: []byte("$b"), - }, - }, - }, - &ast.ExprArrayItem{}, - }, - SeparatorTkns: []*token.Token{ - { - ID: token.ID(44), - Value: []byte(","), - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 8, - EndPos: 9, - }, - }, - { - ID: token.ID(44), - Value: []byte(","), - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 13, - EndPos: 14, - }, - }, - }, - CloseBracketTkn: &token.Token{ - ID: token.ID(93), - Value: []byte("]"), - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 14, - EndPos: 15, - }, - }, - }, - SemiColonTkn: &token.Token{ - ID: token.ID(59), - Value: []byte(";"), - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 15, - EndPos: 16, - }, - }, - }, - }, - EndTkn: &token.Token{}, - } - - config := conf.Config{ - Version: &version.Version{ - Major: 5, - Minor: 6, - }, - } - lexer := scanner.NewLexer([]byte(src), config) - php5parser := php5.NewParser(lexer, config) - php5parser.Parse() - actual := php5parser.GetRootNode() - assert.DeepEqual(t, expected, actual) -} - -func TestExprStaticCall(t *testing.T) { - src := ` $b;` - - expected := &ast.Root{ - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 3, - EndPos: 18, - }, - Stmts: []ast.Vertex{ - &ast.StmtExpression{ - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 3, - EndPos: 18, - }, - Expr: &ast.ExprYield{ - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 3, - EndPos: 17, - }, - YieldTkn: &token.Token{ - ID: token.T_YIELD, - Value: []byte("yield"), - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 3, - EndPos: 8, - }, - FreeFloating: []*token.Token{ - { - ID: token.T_OPEN_TAG, - Value: []byte(""), - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 12, - EndPos: 14, - }, - FreeFloating: []*token.Token{ - { - ID: token.T_WHITESPACE, - Value: []byte(" "), - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 11, - EndPos: 12, - }, - }, - }, - }, - Val: &ast.ExprVariable{ - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 15, - EndPos: 17, - }, - Name: &ast.Identifier{ - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 15, - EndPos: 17, - }, - IdentifierTkn: &token.Token{ - ID: token.T_VARIABLE, - Value: []byte("$b"), - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 15, - EndPos: 17, - }, - FreeFloating: []*token.Token{ - { - ID: token.T_WHITESPACE, - Value: []byte(" "), - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 14, - EndPos: 15, - }, - }, - }, - }, - Value: []byte("$b"), - }, - }, - }, - SemiColonTkn: &token.Token{ - ID: token.ID(59), - Value: []byte(";"), - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 17, - EndPos: 18, - }, - }, - }, - }, - EndTkn: &token.Token{}, - } - - config := conf.Config{ - Version: &version.Version{ - Major: 5, - Minor: 6, - }, - } - lexer := scanner.NewLexer([]byte(src), config) - php5parser := php5.NewParser(lexer, config) - php5parser.Parse() - actual := php5parser.GetRootNode() - assert.DeepEqual(t, expected, actual) -} - -func TestExprYield_Expr(t *testing.T) { - src := ` 1;` - - expected := &ast.Root{ - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 3, - EndPos: 17, - }, - Stmts: []ast.Vertex{ - &ast.StmtExpression{ - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 3, - EndPos: 17, - }, - Expr: &ast.ExprYield{ - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 3, - EndPos: 16, - }, - YieldTkn: &token.Token{ - ID: token.T_YIELD, - Value: []byte("yield"), - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 3, - EndPos: 8, - }, - FreeFloating: []*token.Token{ - { - ID: token.T_OPEN_TAG, - Value: []byte(""), - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 12, - EndPos: 14, - }, - FreeFloating: []*token.Token{ - { - ID: token.T_WHITESPACE, - Value: []byte(" "), - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 11, - EndPos: 12, - }, - }, - }, - }, - Val: &ast.ScalarLnumber{ - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 15, - EndPos: 16, - }, - NumberTkn: &token.Token{ - ID: token.T_LNUMBER, - Value: []byte("1"), - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 15, - EndPos: 16, - }, - FreeFloating: []*token.Token{ - { - ID: token.T_WHITESPACE, - Value: []byte(" "), - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 14, - EndPos: 15, - }, - }, - }, - }, - Value: []byte("1"), - }, - }, - SemiColonTkn: &token.Token{ - ID: token.ID(59), - Value: []byte(";"), - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 16, - EndPos: 17, - }, - }, - }, - }, - EndTkn: &token.Token{}, - } - - config := conf.Config{ - Version: &version.Version{ - Major: 5, - Minor: 6, - }, - } - lexer := scanner.NewLexer([]byte(src), config) - php5parser := php5.NewParser(lexer, config) - php5parser.Parse() - actual := php5parser.GetRootNode() - assert.DeepEqual(t, expected, actual) -} - -// expr assign - -func TestExprAssign(t *testing.T) { - src := `>= $b;` - - expected := &ast.Root{ - Position: &position.Position{ - StartLine: 2, - EndLine: 17, - StartPos: 5, - EndPos: 210, - }, - Stmts: []ast.Vertex{ - &ast.StmtExpression{ - Position: &position.Position{ - StartLine: 2, - EndLine: 2, - StartPos: 5, - EndPos: 13, - }, - Expr: &ast.ExprAssign{ - Position: &position.Position{ - StartLine: 2, - EndLine: 2, - StartPos: 5, - EndPos: 12, - }, - Var: &ast.ExprVariable{ - Position: &position.Position{ - StartLine: 2, - EndLine: 2, - StartPos: 5, - EndPos: 7, - }, - Name: &ast.Identifier{ - Position: &position.Position{ - StartLine: 2, - EndLine: 2, - StartPos: 5, - EndPos: 7, - }, - IdentifierTkn: &token.Token{ - ID: token.T_VARIABLE, - Value: []byte("$a"), - Position: &position.Position{ - StartLine: 2, - EndLine: 2, - StartPos: 5, - EndPos: 7, - }, - FreeFloating: []*token.Token{ - { - ID: token.T_OPEN_TAG, - Value: []byte(">="), - Position: &position.Position{ - StartLine: 17, - EndLine: 17, - StartPos: 203, - EndPos: 206, - }, - FreeFloating: []*token.Token{ - { - ID: token.T_WHITESPACE, - Value: []byte(" "), - Position: &position.Position{ - StartLine: 17, - EndLine: 17, - StartPos: 202, - EndPos: 203, - }, - }, - }, - }, - Expr: &ast.ExprVariable{ - Position: &position.Position{ - StartLine: 17, - EndLine: 17, - StartPos: 207, - EndPos: 209, - }, - Name: &ast.Identifier{ - Position: &position.Position{ - StartLine: 17, - EndLine: 17, - StartPos: 207, - EndPos: 209, - }, - IdentifierTkn: &token.Token{ - ID: token.T_VARIABLE, - Value: []byte("$b"), - Position: &position.Position{ - StartLine: 17, - EndLine: 17, - StartPos: 207, - EndPos: 209, - }, - FreeFloating: []*token.Token{ - { - ID: token.T_WHITESPACE, - Value: []byte(" "), - Position: &position.Position{ - StartLine: 17, - EndLine: 17, - StartPos: 206, - EndPos: 207, - }, - }, - }, - }, - Value: []byte("$b"), - }, - }, - }, - SemiColonTkn: &token.Token{ - ID: token.ID(59), - Value: []byte(";"), - Position: &position.Position{ - StartLine: 17, - EndLine: 17, - StartPos: 209, - EndPos: 210, - }, - }, - }, - }, - EndTkn: &token.Token{}, - } - - config := conf.Config{ - Version: &version.Version{ - Major: 5, - Minor: 6, - }, - } - lexer := scanner.NewLexer([]byte(src), config) - php5parser := php5.NewParser(lexer, config) - php5parser.Parse() - actual := php5parser.GetRootNode() - assert.DeepEqual(t, expected, actual) -} - -// expr binary - -func TestExprBinary_BitwiseAnd(t *testing.T) { - src := `= $b; - $a > $b; - $a === $b; - $a and $b; - $a or $b; - $a xor $b; - $a - $b; - $a % $b; - $a * $b; - $a != $b; - $a !== $b; - $a + $b; - $a ** $b; - $a << $b; - $a >> $b; - $a <= $b; - $a < $b;` - - expected := &ast.Root{ - Position: &position.Position{ - StartLine: 2, - EndLine: 26, - StartPos: 5, - EndPos: 295, - }, - Stmts: []ast.Vertex{ - &ast.StmtExpression{ - Position: &position.Position{ - StartLine: 2, - EndLine: 2, - StartPos: 5, - EndPos: 13, - }, - Expr: &ast.ExprBinaryBitwiseAnd{ - Position: &position.Position{ - StartLine: 2, - EndLine: 2, - StartPos: 5, - EndPos: 12, - }, - Left: &ast.ExprVariable{ - Position: &position.Position{ - StartLine: 2, - EndLine: 2, - StartPos: 5, - EndPos: 7, - }, - Name: &ast.Identifier{ - Position: &position.Position{ - StartLine: 2, - EndLine: 2, - StartPos: 5, - EndPos: 7, - }, - IdentifierTkn: &token.Token{ - ID: token.T_VARIABLE, - Value: []byte("$a"), - Position: &position.Position{ - StartLine: 2, - EndLine: 2, - StartPos: 5, - EndPos: 7, - }, - FreeFloating: []*token.Token{ - { - ID: token.T_OPEN_TAG, - Value: []byte("="), - Position: &position.Position{ - StartLine: 10, - EndLine: 10, - StartPos: 99, - EndPos: 101, - }, - FreeFloating: []*token.Token{ - { - ID: token.T_WHITESPACE, - Value: []byte(" "), - Position: &position.Position{ - StartLine: 10, - EndLine: 10, - StartPos: 98, - EndPos: 99, - }, - }, - }, - }, - Right: &ast.ExprVariable{ - Position: &position.Position{ - StartLine: 10, - EndLine: 10, - StartPos: 102, - EndPos: 104, - }, - Name: &ast.Identifier{ - Position: &position.Position{ - StartLine: 10, - EndLine: 10, - StartPos: 102, - EndPos: 104, - }, - IdentifierTkn: &token.Token{ - ID: token.T_VARIABLE, - Value: []byte("$b"), - Position: &position.Position{ - StartLine: 10, - EndLine: 10, - StartPos: 102, - EndPos: 104, - }, - FreeFloating: []*token.Token{ - { - ID: token.T_WHITESPACE, - Value: []byte(" "), - Position: &position.Position{ - StartLine: 10, - EndLine: 10, - StartPos: 101, - EndPos: 102, - }, - }, - }, - }, - Value: []byte("$b"), - }, - }, - }, - SemiColonTkn: &token.Token{ - ID: token.ID(59), - Value: []byte(";"), - Position: &position.Position{ - StartLine: 10, - EndLine: 10, - StartPos: 104, - EndPos: 105, - }, - }, - }, - &ast.StmtExpression{ - Position: &position.Position{ - StartLine: 11, - EndLine: 11, - StartPos: 108, - EndPos: 116, - }, - Expr: &ast.ExprBinaryGreater{ - Position: &position.Position{ - StartLine: 11, - EndLine: 11, - StartPos: 108, - EndPos: 115, - }, - Left: &ast.ExprVariable{ - Position: &position.Position{ - StartLine: 11, - EndLine: 11, - StartPos: 108, - EndPos: 110, - }, - Name: &ast.Identifier{ - Position: &position.Position{ - StartLine: 11, - EndLine: 11, - StartPos: 108, - EndPos: 110, - }, - IdentifierTkn: &token.Token{ - ID: token.T_VARIABLE, - Value: []byte("$a"), - Position: &position.Position{ - StartLine: 11, - EndLine: 11, - StartPos: 108, - EndPos: 110, - }, - FreeFloating: []*token.Token{ - { - ID: token.T_WHITESPACE, - Value: []byte("\n\t\t"), - Position: &position.Position{ - StartLine: 10, - EndLine: 11, - StartPos: 105, - EndPos: 108, - }, - }, - }, - }, - Value: []byte("$a"), - }, - }, - OpTkn: &token.Token{ - ID: token.ID(62), - Value: []byte(">"), - Position: &position.Position{ - StartLine: 11, - EndLine: 11, - StartPos: 111, - EndPos: 112, - }, - FreeFloating: []*token.Token{ - { - ID: token.T_WHITESPACE, - Value: []byte(" "), - Position: &position.Position{ - StartLine: 11, - EndLine: 11, - StartPos: 110, - EndPos: 111, - }, - }, - }, - }, - Right: &ast.ExprVariable{ - Position: &position.Position{ - StartLine: 11, - EndLine: 11, - StartPos: 113, - EndPos: 115, - }, - Name: &ast.Identifier{ - Position: &position.Position{ - StartLine: 11, - EndLine: 11, - StartPos: 113, - EndPos: 115, - }, - IdentifierTkn: &token.Token{ - ID: token.T_VARIABLE, - Value: []byte("$b"), - Position: &position.Position{ - StartLine: 11, - EndLine: 11, - StartPos: 113, - EndPos: 115, - }, - FreeFloating: []*token.Token{ - { - ID: token.T_WHITESPACE, - Value: []byte(" "), - Position: &position.Position{ - StartLine: 11, - EndLine: 11, - StartPos: 112, - EndPos: 113, - }, - }, - }, - }, - Value: []byte("$b"), - }, - }, - }, - SemiColonTkn: &token.Token{ - ID: token.ID(59), - Value: []byte(";"), - Position: &position.Position{ - StartLine: 11, - EndLine: 11, - StartPos: 115, - EndPos: 116, - }, - }, - }, - &ast.StmtExpression{ - Position: &position.Position{ - StartLine: 12, - EndLine: 12, - StartPos: 119, - EndPos: 129, - }, - Expr: &ast.ExprBinaryIdentical{ - Position: &position.Position{ - StartLine: 12, - EndLine: 12, - StartPos: 119, - EndPos: 128, - }, - Left: &ast.ExprVariable{ - Position: &position.Position{ - StartLine: 12, - EndLine: 12, - StartPos: 119, - EndPos: 121, - }, - Name: &ast.Identifier{ - Position: &position.Position{ - StartLine: 12, - EndLine: 12, - StartPos: 119, - EndPos: 121, - }, - IdentifierTkn: &token.Token{ - ID: token.T_VARIABLE, - Value: []byte("$a"), - Position: &position.Position{ - StartLine: 12, - EndLine: 12, - StartPos: 119, - EndPos: 121, - }, - FreeFloating: []*token.Token{ - { - ID: token.T_WHITESPACE, - Value: []byte("\n\t\t"), - Position: &position.Position{ - StartLine: 11, - EndLine: 12, - StartPos: 116, - EndPos: 119, - }, - }, - }, - }, - Value: []byte("$a"), - }, - }, - OpTkn: &token.Token{ - ID: token.T_IS_IDENTICAL, - Value: []byte("==="), - Position: &position.Position{ - StartLine: 12, - EndLine: 12, - StartPos: 122, - EndPos: 125, - }, - FreeFloating: []*token.Token{ - { - ID: token.T_WHITESPACE, - Value: []byte(" "), - Position: &position.Position{ - StartLine: 12, - EndLine: 12, - StartPos: 121, - EndPos: 122, - }, - }, - }, - }, - Right: &ast.ExprVariable{ - Position: &position.Position{ - StartLine: 12, - EndLine: 12, - StartPos: 126, - EndPos: 128, - }, - Name: &ast.Identifier{ - Position: &position.Position{ - StartLine: 12, - EndLine: 12, - StartPos: 126, - EndPos: 128, - }, - IdentifierTkn: &token.Token{ - ID: token.T_VARIABLE, - Value: []byte("$b"), - Position: &position.Position{ - StartLine: 12, - EndLine: 12, - StartPos: 126, - EndPos: 128, - }, - FreeFloating: []*token.Token{ - { - ID: token.T_WHITESPACE, - Value: []byte(" "), - Position: &position.Position{ - StartLine: 12, - EndLine: 12, - StartPos: 125, - EndPos: 126, - }, - }, - }, - }, - Value: []byte("$b"), - }, - }, - }, - SemiColonTkn: &token.Token{ - ID: token.ID(59), - Value: []byte(";"), - Position: &position.Position{ - StartLine: 12, - EndLine: 12, - StartPos: 128, - EndPos: 129, - }, - }, - }, - &ast.StmtExpression{ - Position: &position.Position{ - StartLine: 13, - EndLine: 13, - StartPos: 132, - EndPos: 142, - }, - Expr: &ast.ExprBinaryLogicalAnd{ - Position: &position.Position{ - StartLine: 13, - EndLine: 13, - StartPos: 132, - EndPos: 141, - }, - Left: &ast.ExprVariable{ - Position: &position.Position{ - StartLine: 13, - EndLine: 13, - StartPos: 132, - EndPos: 134, - }, - Name: &ast.Identifier{ - Position: &position.Position{ - StartLine: 13, - EndLine: 13, - StartPos: 132, - EndPos: 134, - }, - IdentifierTkn: &token.Token{ - ID: token.T_VARIABLE, - Value: []byte("$a"), - Position: &position.Position{ - StartLine: 13, - EndLine: 13, - StartPos: 132, - EndPos: 134, - }, - FreeFloating: []*token.Token{ - { - ID: token.T_WHITESPACE, - Value: []byte("\n\t\t"), - Position: &position.Position{ - StartLine: 12, - EndLine: 13, - StartPos: 129, - EndPos: 132, - }, - }, - }, - }, - Value: []byte("$a"), - }, - }, - OpTkn: &token.Token{ - ID: token.T_LOGICAL_AND, - Value: []byte("and"), - Position: &position.Position{ - StartLine: 13, - EndLine: 13, - StartPos: 135, - EndPos: 138, - }, - FreeFloating: []*token.Token{ - { - ID: token.T_WHITESPACE, - Value: []byte(" "), - Position: &position.Position{ - StartLine: 13, - EndLine: 13, - StartPos: 134, - EndPos: 135, - }, - }, - }, - }, - Right: &ast.ExprVariable{ - Position: &position.Position{ - StartLine: 13, - EndLine: 13, - StartPos: 139, - EndPos: 141, - }, - Name: &ast.Identifier{ - Position: &position.Position{ - StartLine: 13, - EndLine: 13, - StartPos: 139, - EndPos: 141, - }, - IdentifierTkn: &token.Token{ - ID: token.T_VARIABLE, - Value: []byte("$b"), - Position: &position.Position{ - StartLine: 13, - EndLine: 13, - StartPos: 139, - EndPos: 141, - }, - FreeFloating: []*token.Token{ - { - ID: token.T_WHITESPACE, - Value: []byte(" "), - Position: &position.Position{ - StartLine: 13, - EndLine: 13, - StartPos: 138, - EndPos: 139, - }, - }, - }, - }, - Value: []byte("$b"), - }, - }, - }, - SemiColonTkn: &token.Token{ - ID: token.ID(59), - Value: []byte(";"), - Position: &position.Position{ - StartLine: 13, - EndLine: 13, - StartPos: 141, - EndPos: 142, - }, - }, - }, - &ast.StmtExpression{ - Position: &position.Position{ - StartLine: 14, - EndLine: 14, - StartPos: 145, - EndPos: 154, - }, - Expr: &ast.ExprBinaryLogicalOr{ - Position: &position.Position{ - StartLine: 14, - EndLine: 14, - StartPos: 145, - EndPos: 153, - }, - Left: &ast.ExprVariable{ - Position: &position.Position{ - StartLine: 14, - EndLine: 14, - StartPos: 145, - EndPos: 147, - }, - Name: &ast.Identifier{ - Position: &position.Position{ - StartLine: 14, - EndLine: 14, - StartPos: 145, - EndPos: 147, - }, - IdentifierTkn: &token.Token{ - ID: token.T_VARIABLE, - Value: []byte("$a"), - Position: &position.Position{ - StartLine: 14, - EndLine: 14, - StartPos: 145, - EndPos: 147, - }, - FreeFloating: []*token.Token{ - { - ID: token.T_WHITESPACE, - Value: []byte("\n\t\t"), - Position: &position.Position{ - StartLine: 13, - EndLine: 14, - StartPos: 142, - EndPos: 145, - }, - }, - }, - }, - Value: []byte("$a"), - }, - }, - OpTkn: &token.Token{ - ID: token.T_LOGICAL_OR, - Value: []byte("or"), - Position: &position.Position{ - StartLine: 14, - EndLine: 14, - StartPos: 148, - EndPos: 150, - }, - FreeFloating: []*token.Token{ - { - ID: token.T_WHITESPACE, - Value: []byte(" "), - Position: &position.Position{ - StartLine: 14, - EndLine: 14, - StartPos: 147, - EndPos: 148, - }, - }, - }, - }, - Right: &ast.ExprVariable{ - Position: &position.Position{ - StartLine: 14, - EndLine: 14, - StartPos: 151, - EndPos: 153, - }, - Name: &ast.Identifier{ - Position: &position.Position{ - StartLine: 14, - EndLine: 14, - StartPos: 151, - EndPos: 153, - }, - IdentifierTkn: &token.Token{ - ID: token.T_VARIABLE, - Value: []byte("$b"), - Position: &position.Position{ - StartLine: 14, - EndLine: 14, - StartPos: 151, - EndPos: 153, - }, - FreeFloating: []*token.Token{ - { - ID: token.T_WHITESPACE, - Value: []byte(" "), - Position: &position.Position{ - StartLine: 14, - EndLine: 14, - StartPos: 150, - EndPos: 151, - }, - }, - }, - }, - Value: []byte("$b"), - }, - }, - }, - SemiColonTkn: &token.Token{ - ID: token.ID(59), - Value: []byte(";"), - Position: &position.Position{ - StartLine: 14, - EndLine: 14, - StartPos: 153, - EndPos: 154, - }, - }, - }, - &ast.StmtExpression{ - Position: &position.Position{ - StartLine: 15, - EndLine: 15, - StartPos: 157, - EndPos: 167, - }, - Expr: &ast.ExprBinaryLogicalXor{ - Position: &position.Position{ - StartLine: 15, - EndLine: 15, - StartPos: 157, - EndPos: 166, - }, - Left: &ast.ExprVariable{ - Position: &position.Position{ - StartLine: 15, - EndLine: 15, - StartPos: 157, - EndPos: 159, - }, - Name: &ast.Identifier{ - Position: &position.Position{ - StartLine: 15, - EndLine: 15, - StartPos: 157, - EndPos: 159, - }, - IdentifierTkn: &token.Token{ - ID: token.T_VARIABLE, - Value: []byte("$a"), - Position: &position.Position{ - StartLine: 15, - EndLine: 15, - StartPos: 157, - EndPos: 159, - }, - FreeFloating: []*token.Token{ - { - ID: token.T_WHITESPACE, - Value: []byte("\n\t\t"), - Position: &position.Position{ - StartLine: 14, - EndLine: 15, - StartPos: 154, - EndPos: 157, - }, - }, - }, - }, - Value: []byte("$a"), - }, - }, - OpTkn: &token.Token{ - ID: token.T_LOGICAL_XOR, - Value: []byte("xor"), - Position: &position.Position{ - StartLine: 15, - EndLine: 15, - StartPos: 160, - EndPos: 163, - }, - FreeFloating: []*token.Token{ - { - ID: token.T_WHITESPACE, - Value: []byte(" "), - Position: &position.Position{ - StartLine: 15, - EndLine: 15, - StartPos: 159, - EndPos: 160, - }, - }, - }, - }, - Right: &ast.ExprVariable{ - Position: &position.Position{ - StartLine: 15, - EndLine: 15, - StartPos: 164, - EndPos: 166, - }, - Name: &ast.Identifier{ - Position: &position.Position{ - StartLine: 15, - EndLine: 15, - StartPos: 164, - EndPos: 166, - }, - IdentifierTkn: &token.Token{ - ID: token.T_VARIABLE, - Value: []byte("$b"), - Position: &position.Position{ - StartLine: 15, - EndLine: 15, - StartPos: 164, - EndPos: 166, - }, - FreeFloating: []*token.Token{ - { - ID: token.T_WHITESPACE, - Value: []byte(" "), - Position: &position.Position{ - StartLine: 15, - EndLine: 15, - StartPos: 163, - EndPos: 164, - }, - }, - }, - }, - Value: []byte("$b"), - }, - }, - }, - SemiColonTkn: &token.Token{ - ID: token.ID(59), - Value: []byte(";"), - Position: &position.Position{ - StartLine: 15, - EndLine: 15, - StartPos: 166, - EndPos: 167, - }, - }, - }, - &ast.StmtExpression{ - Position: &position.Position{ - StartLine: 16, - EndLine: 16, - StartPos: 170, - EndPos: 178, - }, - Expr: &ast.ExprBinaryMinus{ - Position: &position.Position{ - StartLine: 16, - EndLine: 16, - StartPos: 170, - EndPos: 177, - }, - Left: &ast.ExprVariable{ - Position: &position.Position{ - StartLine: 16, - EndLine: 16, - StartPos: 170, - EndPos: 172, - }, - Name: &ast.Identifier{ - Position: &position.Position{ - StartLine: 16, - EndLine: 16, - StartPos: 170, - EndPos: 172, - }, - IdentifierTkn: &token.Token{ - ID: token.T_VARIABLE, - Value: []byte("$a"), - Position: &position.Position{ - StartLine: 16, - EndLine: 16, - StartPos: 170, - EndPos: 172, - }, - FreeFloating: []*token.Token{ - { - ID: token.T_WHITESPACE, - Value: []byte("\n\t\t"), - Position: &position.Position{ - StartLine: 15, - EndLine: 16, - StartPos: 167, - EndPos: 170, - }, - }, - }, - }, - Value: []byte("$a"), - }, - }, - OpTkn: &token.Token{ - ID: token.ID(45), - Value: []byte("-"), - Position: &position.Position{ - StartLine: 16, - EndLine: 16, - StartPos: 173, - EndPos: 174, - }, - FreeFloating: []*token.Token{ - { - ID: token.T_WHITESPACE, - Value: []byte(" "), - Position: &position.Position{ - StartLine: 16, - EndLine: 16, - StartPos: 172, - EndPos: 173, - }, - }, - }, - }, - Right: &ast.ExprVariable{ - Position: &position.Position{ - StartLine: 16, - EndLine: 16, - StartPos: 175, - EndPos: 177, - }, - Name: &ast.Identifier{ - Position: &position.Position{ - StartLine: 16, - EndLine: 16, - StartPos: 175, - EndPos: 177, - }, - IdentifierTkn: &token.Token{ - ID: token.T_VARIABLE, - Value: []byte("$b"), - Position: &position.Position{ - StartLine: 16, - EndLine: 16, - StartPos: 175, - EndPos: 177, - }, - FreeFloating: []*token.Token{ - { - ID: token.T_WHITESPACE, - Value: []byte(" "), - Position: &position.Position{ - StartLine: 16, - EndLine: 16, - StartPos: 174, - EndPos: 175, - }, - }, - }, - }, - Value: []byte("$b"), - }, - }, - }, - SemiColonTkn: &token.Token{ - ID: token.ID(59), - Value: []byte(";"), - Position: &position.Position{ - StartLine: 16, - EndLine: 16, - StartPos: 177, - EndPos: 178, - }, - }, - }, - &ast.StmtExpression{ - Position: &position.Position{ - StartLine: 17, - EndLine: 17, - StartPos: 181, - EndPos: 189, - }, - Expr: &ast.ExprBinaryMod{ - Position: &position.Position{ - StartLine: 17, - EndLine: 17, - StartPos: 181, - EndPos: 188, - }, - Left: &ast.ExprVariable{ - Position: &position.Position{ - StartLine: 17, - EndLine: 17, - StartPos: 181, - EndPos: 183, - }, - Name: &ast.Identifier{ - Position: &position.Position{ - StartLine: 17, - EndLine: 17, - StartPos: 181, - EndPos: 183, - }, - IdentifierTkn: &token.Token{ - ID: token.T_VARIABLE, - Value: []byte("$a"), - Position: &position.Position{ - StartLine: 17, - EndLine: 17, - StartPos: 181, - EndPos: 183, - }, - FreeFloating: []*token.Token{ - { - ID: token.T_WHITESPACE, - Value: []byte("\n\t\t"), - Position: &position.Position{ - StartLine: 16, - EndLine: 17, - StartPos: 178, - EndPos: 181, - }, - }, - }, - }, - Value: []byte("$a"), - }, - }, - OpTkn: &token.Token{ - ID: token.ID(37), - Value: []byte("%"), - Position: &position.Position{ - StartLine: 17, - EndLine: 17, - StartPos: 184, - EndPos: 185, - }, - FreeFloating: []*token.Token{ - { - ID: token.T_WHITESPACE, - Value: []byte(" "), - Position: &position.Position{ - StartLine: 17, - EndLine: 17, - StartPos: 183, - EndPos: 184, - }, - }, - }, - }, - Right: &ast.ExprVariable{ - Position: &position.Position{ - StartLine: 17, - EndLine: 17, - StartPos: 186, - EndPos: 188, - }, - Name: &ast.Identifier{ - Position: &position.Position{ - StartLine: 17, - EndLine: 17, - StartPos: 186, - EndPos: 188, - }, - IdentifierTkn: &token.Token{ - ID: token.T_VARIABLE, - Value: []byte("$b"), - Position: &position.Position{ - StartLine: 17, - EndLine: 17, - StartPos: 186, - EndPos: 188, - }, - FreeFloating: []*token.Token{ - { - ID: token.T_WHITESPACE, - Value: []byte(" "), - Position: &position.Position{ - StartLine: 17, - EndLine: 17, - StartPos: 185, - EndPos: 186, - }, - }, - }, - }, - Value: []byte("$b"), - }, - }, - }, - SemiColonTkn: &token.Token{ - ID: token.ID(59), - Value: []byte(";"), - Position: &position.Position{ - StartLine: 17, - EndLine: 17, - StartPos: 188, - EndPos: 189, - }, - }, - }, - &ast.StmtExpression{ - Position: &position.Position{ - StartLine: 18, - EndLine: 18, - StartPos: 192, - EndPos: 200, - }, - Expr: &ast.ExprBinaryMul{ - Position: &position.Position{ - StartLine: 18, - EndLine: 18, - StartPos: 192, - EndPos: 199, - }, - Left: &ast.ExprVariable{ - Position: &position.Position{ - StartLine: 18, - EndLine: 18, - StartPos: 192, - EndPos: 194, - }, - Name: &ast.Identifier{ - Position: &position.Position{ - StartLine: 18, - EndLine: 18, - StartPos: 192, - EndPos: 194, - }, - IdentifierTkn: &token.Token{ - ID: token.T_VARIABLE, - Value: []byte("$a"), - Position: &position.Position{ - StartLine: 18, - EndLine: 18, - StartPos: 192, - EndPos: 194, - }, - FreeFloating: []*token.Token{ - { - ID: token.T_WHITESPACE, - Value: []byte("\n\t\t"), - Position: &position.Position{ - StartLine: 17, - EndLine: 18, - StartPos: 189, - EndPos: 192, - }, - }, - }, - }, - Value: []byte("$a"), - }, - }, - OpTkn: &token.Token{ - ID: token.ID(42), - Value: []byte("*"), - Position: &position.Position{ - StartLine: 18, - EndLine: 18, - StartPos: 195, - EndPos: 196, - }, - FreeFloating: []*token.Token{ - { - ID: token.T_WHITESPACE, - Value: []byte(" "), - Position: &position.Position{ - StartLine: 18, - EndLine: 18, - StartPos: 194, - EndPos: 195, - }, - }, - }, - }, - Right: &ast.ExprVariable{ - Position: &position.Position{ - StartLine: 18, - EndLine: 18, - StartPos: 197, - EndPos: 199, - }, - Name: &ast.Identifier{ - Position: &position.Position{ - StartLine: 18, - EndLine: 18, - StartPos: 197, - EndPos: 199, - }, - IdentifierTkn: &token.Token{ - ID: token.T_VARIABLE, - Value: []byte("$b"), - Position: &position.Position{ - StartLine: 18, - EndLine: 18, - StartPos: 197, - EndPos: 199, - }, - FreeFloating: []*token.Token{ - { - ID: token.T_WHITESPACE, - Value: []byte(" "), - Position: &position.Position{ - StartLine: 18, - EndLine: 18, - StartPos: 196, - EndPos: 197, - }, - }, - }, - }, - Value: []byte("$b"), - }, - }, - }, - SemiColonTkn: &token.Token{ - ID: token.ID(59), - Value: []byte(";"), - Position: &position.Position{ - StartLine: 18, - EndLine: 18, - StartPos: 199, - EndPos: 200, - }, - }, - }, - &ast.StmtExpression{ - Position: &position.Position{ - StartLine: 19, - EndLine: 19, - StartPos: 203, - EndPos: 212, - }, - Expr: &ast.ExprBinaryNotEqual{ - Position: &position.Position{ - StartLine: 19, - EndLine: 19, - StartPos: 203, - EndPos: 211, - }, - Left: &ast.ExprVariable{ - Position: &position.Position{ - StartLine: 19, - EndLine: 19, - StartPos: 203, - EndPos: 205, - }, - Name: &ast.Identifier{ - Position: &position.Position{ - StartLine: 19, - EndLine: 19, - StartPos: 203, - EndPos: 205, - }, - IdentifierTkn: &token.Token{ - ID: token.T_VARIABLE, - Value: []byte("$a"), - Position: &position.Position{ - StartLine: 19, - EndLine: 19, - StartPos: 203, - EndPos: 205, - }, - FreeFloating: []*token.Token{ - { - ID: token.T_WHITESPACE, - Value: []byte("\n\t\t"), - Position: &position.Position{ - StartLine: 18, - EndLine: 19, - StartPos: 200, - EndPos: 203, - }, - }, - }, - }, - Value: []byte("$a"), - }, - }, - OpTkn: &token.Token{ - ID: token.T_IS_NOT_EQUAL, - Value: []byte("!="), - Position: &position.Position{ - StartLine: 19, - EndLine: 19, - StartPos: 206, - EndPos: 208, - }, - FreeFloating: []*token.Token{ - { - ID: token.T_WHITESPACE, - Value: []byte(" "), - Position: &position.Position{ - StartLine: 19, - EndLine: 19, - StartPos: 205, - EndPos: 206, - }, - }, - }, - }, - Right: &ast.ExprVariable{ - Position: &position.Position{ - StartLine: 19, - EndLine: 19, - StartPos: 209, - EndPos: 211, - }, - Name: &ast.Identifier{ - Position: &position.Position{ - StartLine: 19, - EndLine: 19, - StartPos: 209, - EndPos: 211, - }, - IdentifierTkn: &token.Token{ - ID: token.T_VARIABLE, - Value: []byte("$b"), - Position: &position.Position{ - StartLine: 19, - EndLine: 19, - StartPos: 209, - EndPos: 211, - }, - FreeFloating: []*token.Token{ - { - ID: token.T_WHITESPACE, - Value: []byte(" "), - Position: &position.Position{ - StartLine: 19, - EndLine: 19, - StartPos: 208, - EndPos: 209, - }, - }, - }, - }, - Value: []byte("$b"), - }, - }, - }, - SemiColonTkn: &token.Token{ - ID: token.ID(59), - Value: []byte(";"), - Position: &position.Position{ - StartLine: 19, - EndLine: 19, - StartPos: 211, - EndPos: 212, - }, - }, - }, - &ast.StmtExpression{ - Position: &position.Position{ - StartLine: 20, - EndLine: 20, - StartPos: 215, - EndPos: 225, - }, - Expr: &ast.ExprBinaryNotIdentical{ - Position: &position.Position{ - StartLine: 20, - EndLine: 20, - StartPos: 215, - EndPos: 224, - }, - Left: &ast.ExprVariable{ - Position: &position.Position{ - StartLine: 20, - EndLine: 20, - StartPos: 215, - EndPos: 217, - }, - Name: &ast.Identifier{ - Position: &position.Position{ - StartLine: 20, - EndLine: 20, - StartPos: 215, - EndPos: 217, - }, - IdentifierTkn: &token.Token{ - ID: token.T_VARIABLE, - Value: []byte("$a"), - Position: &position.Position{ - StartLine: 20, - EndLine: 20, - StartPos: 215, - EndPos: 217, - }, - FreeFloating: []*token.Token{ - { - ID: token.T_WHITESPACE, - Value: []byte("\n\t\t"), - Position: &position.Position{ - StartLine: 19, - EndLine: 20, - StartPos: 212, - EndPos: 215, - }, - }, - }, - }, - Value: []byte("$a"), - }, - }, - OpTkn: &token.Token{ - ID: token.T_IS_NOT_IDENTICAL, - Value: []byte("!=="), - Position: &position.Position{ - StartLine: 20, - EndLine: 20, - StartPos: 218, - EndPos: 221, - }, - FreeFloating: []*token.Token{ - { - ID: token.T_WHITESPACE, - Value: []byte(" "), - Position: &position.Position{ - StartLine: 20, - EndLine: 20, - StartPos: 217, - EndPos: 218, - }, - }, - }, - }, - Right: &ast.ExprVariable{ - Position: &position.Position{ - StartLine: 20, - EndLine: 20, - StartPos: 222, - EndPos: 224, - }, - Name: &ast.Identifier{ - Position: &position.Position{ - StartLine: 20, - EndLine: 20, - StartPos: 222, - EndPos: 224, - }, - IdentifierTkn: &token.Token{ - ID: token.T_VARIABLE, - Value: []byte("$b"), - Position: &position.Position{ - StartLine: 20, - EndLine: 20, - StartPos: 222, - EndPos: 224, - }, - FreeFloating: []*token.Token{ - { - ID: token.T_WHITESPACE, - Value: []byte(" "), - Position: &position.Position{ - StartLine: 20, - EndLine: 20, - StartPos: 221, - EndPos: 222, - }, - }, - }, - }, - Value: []byte("$b"), - }, - }, - }, - SemiColonTkn: &token.Token{ - ID: token.ID(59), - Value: []byte(";"), - Position: &position.Position{ - StartLine: 20, - EndLine: 20, - StartPos: 224, - EndPos: 225, - }, - }, - }, - &ast.StmtExpression{ - Position: &position.Position{ - StartLine: 21, - EndLine: 21, - StartPos: 228, - EndPos: 236, - }, - Expr: &ast.ExprBinaryPlus{ - Position: &position.Position{ - StartLine: 21, - EndLine: 21, - StartPos: 228, - EndPos: 235, - }, - Left: &ast.ExprVariable{ - Position: &position.Position{ - StartLine: 21, - EndLine: 21, - StartPos: 228, - EndPos: 230, - }, - Name: &ast.Identifier{ - Position: &position.Position{ - StartLine: 21, - EndLine: 21, - StartPos: 228, - EndPos: 230, - }, - IdentifierTkn: &token.Token{ - ID: token.T_VARIABLE, - Value: []byte("$a"), - Position: &position.Position{ - StartLine: 21, - EndLine: 21, - StartPos: 228, - EndPos: 230, - }, - FreeFloating: []*token.Token{ - { - ID: token.T_WHITESPACE, - Value: []byte("\n\t\t"), - Position: &position.Position{ - StartLine: 20, - EndLine: 21, - StartPos: 225, - EndPos: 228, - }, - }, - }, - }, - Value: []byte("$a"), - }, - }, - OpTkn: &token.Token{ - ID: token.ID(43), - Value: []byte("+"), - Position: &position.Position{ - StartLine: 21, - EndLine: 21, - StartPos: 231, - EndPos: 232, - }, - FreeFloating: []*token.Token{ - { - ID: token.T_WHITESPACE, - Value: []byte(" "), - Position: &position.Position{ - StartLine: 21, - EndLine: 21, - StartPos: 230, - EndPos: 231, - }, - }, - }, - }, - Right: &ast.ExprVariable{ - Position: &position.Position{ - StartLine: 21, - EndLine: 21, - StartPos: 233, - EndPos: 235, - }, - Name: &ast.Identifier{ - Position: &position.Position{ - StartLine: 21, - EndLine: 21, - StartPos: 233, - EndPos: 235, - }, - IdentifierTkn: &token.Token{ - ID: token.T_VARIABLE, - Value: []byte("$b"), - Position: &position.Position{ - StartLine: 21, - EndLine: 21, - StartPos: 233, - EndPos: 235, - }, - FreeFloating: []*token.Token{ - { - ID: token.T_WHITESPACE, - Value: []byte(" "), - Position: &position.Position{ - StartLine: 21, - EndLine: 21, - StartPos: 232, - EndPos: 233, - }, - }, - }, - }, - Value: []byte("$b"), - }, - }, - }, - SemiColonTkn: &token.Token{ - ID: token.ID(59), - Value: []byte(";"), - Position: &position.Position{ - StartLine: 21, - EndLine: 21, - StartPos: 235, - EndPos: 236, - }, - }, - }, - &ast.StmtExpression{ - Position: &position.Position{ - StartLine: 22, - EndLine: 22, - StartPos: 239, - EndPos: 248, - }, - Expr: &ast.ExprBinaryPow{ - Position: &position.Position{ - StartLine: 22, - EndLine: 22, - StartPos: 239, - EndPos: 247, - }, - Left: &ast.ExprVariable{ - Position: &position.Position{ - StartLine: 22, - EndLine: 22, - StartPos: 239, - EndPos: 241, - }, - Name: &ast.Identifier{ - Position: &position.Position{ - StartLine: 22, - EndLine: 22, - StartPos: 239, - EndPos: 241, - }, - IdentifierTkn: &token.Token{ - ID: token.T_VARIABLE, - Value: []byte("$a"), - Position: &position.Position{ - StartLine: 22, - EndLine: 22, - StartPos: 239, - EndPos: 241, - }, - FreeFloating: []*token.Token{ - { - ID: token.T_WHITESPACE, - Value: []byte("\n\t\t"), - Position: &position.Position{ - StartLine: 21, - EndLine: 22, - StartPos: 236, - EndPos: 239, - }, - }, - }, - }, - Value: []byte("$a"), - }, - }, - OpTkn: &token.Token{ - ID: token.T_POW, - Value: []byte("**"), - Position: &position.Position{ - StartLine: 22, - EndLine: 22, - StartPos: 242, - EndPos: 244, - }, - FreeFloating: []*token.Token{ - { - ID: token.T_WHITESPACE, - Value: []byte(" "), - Position: &position.Position{ - StartLine: 22, - EndLine: 22, - StartPos: 241, - EndPos: 242, - }, - }, - }, - }, - Right: &ast.ExprVariable{ - Position: &position.Position{ - StartLine: 22, - EndLine: 22, - StartPos: 245, - EndPos: 247, - }, - Name: &ast.Identifier{ - Position: &position.Position{ - StartLine: 22, - EndLine: 22, - StartPos: 245, - EndPos: 247, - }, - IdentifierTkn: &token.Token{ - ID: token.T_VARIABLE, - Value: []byte("$b"), - Position: &position.Position{ - StartLine: 22, - EndLine: 22, - StartPos: 245, - EndPos: 247, - }, - FreeFloating: []*token.Token{ - { - ID: token.T_WHITESPACE, - Value: []byte(" "), - Position: &position.Position{ - StartLine: 22, - EndLine: 22, - StartPos: 244, - EndPos: 245, - }, - }, - }, - }, - Value: []byte("$b"), - }, - }, - }, - SemiColonTkn: &token.Token{ - ID: token.ID(59), - Value: []byte(";"), - Position: &position.Position{ - StartLine: 22, - EndLine: 22, - StartPos: 247, - EndPos: 248, - }, - }, - }, - &ast.StmtExpression{ - Position: &position.Position{ - StartLine: 23, - EndLine: 23, - StartPos: 251, - EndPos: 260, - }, - Expr: &ast.ExprBinaryShiftLeft{ - Position: &position.Position{ - StartLine: 23, - EndLine: 23, - StartPos: 251, - EndPos: 259, - }, - Left: &ast.ExprVariable{ - Position: &position.Position{ - StartLine: 23, - EndLine: 23, - StartPos: 251, - EndPos: 253, - }, - Name: &ast.Identifier{ - Position: &position.Position{ - StartLine: 23, - EndLine: 23, - StartPos: 251, - EndPos: 253, - }, - IdentifierTkn: &token.Token{ - ID: token.T_VARIABLE, - Value: []byte("$a"), - Position: &position.Position{ - StartLine: 23, - EndLine: 23, - StartPos: 251, - EndPos: 253, - }, - FreeFloating: []*token.Token{ - { - ID: token.T_WHITESPACE, - Value: []byte("\n\t\t"), - Position: &position.Position{ - StartLine: 22, - EndLine: 23, - StartPos: 248, - EndPos: 251, - }, - }, - }, - }, - Value: []byte("$a"), - }, - }, - OpTkn: &token.Token{ - ID: token.T_SL, - Value: []byte("<<"), - Position: &position.Position{ - StartLine: 23, - EndLine: 23, - StartPos: 254, - EndPos: 256, - }, - FreeFloating: []*token.Token{ - { - ID: token.T_WHITESPACE, - Value: []byte(" "), - Position: &position.Position{ - StartLine: 23, - EndLine: 23, - StartPos: 253, - EndPos: 254, - }, - }, - }, - }, - Right: &ast.ExprVariable{ - Position: &position.Position{ - StartLine: 23, - EndLine: 23, - StartPos: 257, - EndPos: 259, - }, - Name: &ast.Identifier{ - Position: &position.Position{ - StartLine: 23, - EndLine: 23, - StartPos: 257, - EndPos: 259, - }, - IdentifierTkn: &token.Token{ - ID: token.T_VARIABLE, - Value: []byte("$b"), - Position: &position.Position{ - StartLine: 23, - EndLine: 23, - StartPos: 257, - EndPos: 259, - }, - FreeFloating: []*token.Token{ - { - ID: token.T_WHITESPACE, - Value: []byte(" "), - Position: &position.Position{ - StartLine: 23, - EndLine: 23, - StartPos: 256, - EndPos: 257, - }, - }, - }, - }, - Value: []byte("$b"), - }, - }, - }, - SemiColonTkn: &token.Token{ - ID: token.ID(59), - Value: []byte(";"), - Position: &position.Position{ - StartLine: 23, - EndLine: 23, - StartPos: 259, - EndPos: 260, - }, - }, - }, - &ast.StmtExpression{ - Position: &position.Position{ - StartLine: 24, - EndLine: 24, - StartPos: 263, - EndPos: 272, - }, - Expr: &ast.ExprBinaryShiftRight{ - Position: &position.Position{ - StartLine: 24, - EndLine: 24, - StartPos: 263, - EndPos: 271, - }, - Left: &ast.ExprVariable{ - Position: &position.Position{ - StartLine: 24, - EndLine: 24, - StartPos: 263, - EndPos: 265, - }, - Name: &ast.Identifier{ - Position: &position.Position{ - StartLine: 24, - EndLine: 24, - StartPos: 263, - EndPos: 265, - }, - IdentifierTkn: &token.Token{ - ID: token.T_VARIABLE, - Value: []byte("$a"), - Position: &position.Position{ - StartLine: 24, - EndLine: 24, - StartPos: 263, - EndPos: 265, - }, - FreeFloating: []*token.Token{ - { - ID: token.T_WHITESPACE, - Value: []byte("\n\t\t"), - Position: &position.Position{ - StartLine: 23, - EndLine: 24, - StartPos: 260, - EndPos: 263, - }, - }, - }, - }, - Value: []byte("$a"), - }, - }, - OpTkn: &token.Token{ - ID: token.T_SR, - Value: []byte(">>"), - Position: &position.Position{ - StartLine: 24, - EndLine: 24, - StartPos: 266, - EndPos: 268, - }, - FreeFloating: []*token.Token{ - { - ID: token.T_WHITESPACE, - Value: []byte(" "), - Position: &position.Position{ - StartLine: 24, - EndLine: 24, - StartPos: 265, - EndPos: 266, - }, - }, - }, - }, - Right: &ast.ExprVariable{ - Position: &position.Position{ - StartLine: 24, - EndLine: 24, - StartPos: 269, - EndPos: 271, - }, - Name: &ast.Identifier{ - Position: &position.Position{ - StartLine: 24, - EndLine: 24, - StartPos: 269, - EndPos: 271, - }, - IdentifierTkn: &token.Token{ - ID: token.T_VARIABLE, - Value: []byte("$b"), - Position: &position.Position{ - StartLine: 24, - EndLine: 24, - StartPos: 269, - EndPos: 271, - }, - FreeFloating: []*token.Token{ - { - ID: token.T_WHITESPACE, - Value: []byte(" "), - Position: &position.Position{ - StartLine: 24, - EndLine: 24, - StartPos: 268, - EndPos: 269, - }, - }, - }, - }, - Value: []byte("$b"), - }, - }, - }, - SemiColonTkn: &token.Token{ - ID: token.ID(59), - Value: []byte(";"), - Position: &position.Position{ - StartLine: 24, - EndLine: 24, - StartPos: 271, - EndPos: 272, - }, - }, - }, - &ast.StmtExpression{ - Position: &position.Position{ - StartLine: 25, - EndLine: 25, - StartPos: 275, - EndPos: 284, - }, - Expr: &ast.ExprBinarySmallerOrEqual{ - Position: &position.Position{ - StartLine: 25, - EndLine: 25, - StartPos: 275, - EndPos: 283, - }, - Left: &ast.ExprVariable{ - Position: &position.Position{ - StartLine: 25, - EndLine: 25, - StartPos: 275, - EndPos: 277, - }, - Name: &ast.Identifier{ - Position: &position.Position{ - StartLine: 25, - EndLine: 25, - StartPos: 275, - EndPos: 277, - }, - IdentifierTkn: &token.Token{ - ID: token.T_VARIABLE, - Value: []byte("$a"), - Position: &position.Position{ - StartLine: 25, - EndLine: 25, - StartPos: 275, - EndPos: 277, - }, - FreeFloating: []*token.Token{ - { - ID: token.T_WHITESPACE, - Value: []byte("\n\t\t"), - Position: &position.Position{ - StartLine: 24, - EndLine: 25, - StartPos: 272, - EndPos: 275, - }, - }, - }, - }, - Value: []byte("$a"), - }, - }, - OpTkn: &token.Token{ - ID: token.T_IS_SMALLER_OR_EQUAL, - Value: []byte("<="), - Position: &position.Position{ - StartLine: 25, - EndLine: 25, - StartPos: 278, - EndPos: 280, - }, - FreeFloating: []*token.Token{ - { - ID: token.T_WHITESPACE, - Value: []byte(" "), - Position: &position.Position{ - StartLine: 25, - EndLine: 25, - StartPos: 277, - EndPos: 278, - }, - }, - }, - }, - Right: &ast.ExprVariable{ - Position: &position.Position{ - StartLine: 25, - EndLine: 25, - StartPos: 281, - EndPos: 283, - }, - Name: &ast.Identifier{ - Position: &position.Position{ - StartLine: 25, - EndLine: 25, - StartPos: 281, - EndPos: 283, - }, - IdentifierTkn: &token.Token{ - ID: token.T_VARIABLE, - Value: []byte("$b"), - Position: &position.Position{ - StartLine: 25, - EndLine: 25, - StartPos: 281, - EndPos: 283, - }, - FreeFloating: []*token.Token{ - { - ID: token.T_WHITESPACE, - Value: []byte(" "), - Position: &position.Position{ - StartLine: 25, - EndLine: 25, - StartPos: 280, - EndPos: 281, - }, - }, - }, - }, - Value: []byte("$b"), - }, - }, - }, - SemiColonTkn: &token.Token{ - ID: token.ID(59), - Value: []byte(";"), - Position: &position.Position{ - StartLine: 25, - EndLine: 25, - StartPos: 283, - EndPos: 284, - }, - }, - }, - &ast.StmtExpression{ - Position: &position.Position{ - StartLine: 26, - EndLine: 26, - StartPos: 287, - EndPos: 295, - }, - Expr: &ast.ExprBinarySmaller{ - Position: &position.Position{ - StartLine: 26, - EndLine: 26, - StartPos: 287, - EndPos: 294, - }, - Left: &ast.ExprVariable{ - Position: &position.Position{ - StartLine: 26, - EndLine: 26, - StartPos: 287, - EndPos: 289, - }, - Name: &ast.Identifier{ - Position: &position.Position{ - StartLine: 26, - EndLine: 26, - StartPos: 287, - EndPos: 289, - }, - IdentifierTkn: &token.Token{ - ID: token.T_VARIABLE, - Value: []byte("$a"), - Position: &position.Position{ - StartLine: 26, - EndLine: 26, - StartPos: 287, - EndPos: 289, - }, - FreeFloating: []*token.Token{ - { - ID: token.T_WHITESPACE, - Value: []byte("\n\t\t"), - Position: &position.Position{ - StartLine: 25, - EndLine: 26, - StartPos: 284, - EndPos: 287, - }, - }, - }, - }, - Value: []byte("$a"), - }, - }, - OpTkn: &token.Token{ - ID: token.ID(60), - Value: []byte("<"), - Position: &position.Position{ - StartLine: 26, - EndLine: 26, - StartPos: 290, - EndPos: 291, - }, - FreeFloating: []*token.Token{ - { - ID: token.T_WHITESPACE, - Value: []byte(" "), - Position: &position.Position{ - StartLine: 26, - EndLine: 26, - StartPos: 289, - EndPos: 290, - }, - }, - }, - }, - Right: &ast.ExprVariable{ - Position: &position.Position{ - StartLine: 26, - EndLine: 26, - StartPos: 292, - EndPos: 294, - }, - Name: &ast.Identifier{ - Position: &position.Position{ - StartLine: 26, - EndLine: 26, - StartPos: 292, - EndPos: 294, - }, - IdentifierTkn: &token.Token{ - ID: token.T_VARIABLE, - Value: []byte("$b"), - Position: &position.Position{ - StartLine: 26, - EndLine: 26, - StartPos: 292, - EndPos: 294, - }, - FreeFloating: []*token.Token{ - { - ID: token.T_WHITESPACE, - Value: []byte(" "), - Position: &position.Position{ - StartLine: 26, - EndLine: 26, - StartPos: 291, - EndPos: 292, - }, - }, - }, - }, - Value: []byte("$b"), - }, - }, - }, - SemiColonTkn: &token.Token{ - ID: token.ID(59), - Value: []byte(";"), - Position: &position.Position{ - StartLine: 26, - EndLine: 26, - StartPos: 294, - EndPos: 295, - }, - }, - }, - }, - EndTkn: &token.Token{}, - } - - config := conf.Config{ - Version: &version.Version{ - Major: 5, - Minor: 6, - }, - } - lexer := scanner.NewLexer([]byte(src), config) - php5parser := php5.NewParser(lexer, config) - php5parser.Parse() - actual := php5parser.GetRootNode() - assert.DeepEqual(t, expected, actual) -} - -// expr cast - -func TestExprCast_Array(t *testing.T) { - src := `'", - "'.'", -} -var yyStatenames = [...]string{} - -const yyEofCode = 1 -const yyErrCode = 2 -const yyInitialStackSize = 16 - -// line internal/php5/php5.y:5698 - -// line yacctab:1 -var yyExca = [...]int{ - -1, 1, - 1, -1, - -2, 0, - -1, 2, - 1, 1, - -2, 0, - -1, 51, - 105, 435, - 106, 435, - -2, 433, - -1, 102, - 79, 332, - -2, 411, - -1, 114, - 79, 451, - 148, 447, - -2, 457, - -1, 154, - 105, 435, - 106, 435, - -2, 433, - -1, 204, - 146, 306, - 149, 306, - -2, 430, - -1, 205, - 105, 435, - 106, 435, - 146, 307, - 149, 307, - -2, 433, - -1, 271, - 79, 451, - -2, 457, - -1, 298, - 79, 334, - -2, 413, - -1, 302, - 148, 448, - -2, 458, - -1, 311, - 79, 333, - -2, 412, - -1, 378, - 136, 0, - 137, 0, - 138, 0, - 139, 0, - -2, 274, - -1, 379, - 136, 0, - 137, 0, - 138, 0, - 139, 0, - -2, 275, - -1, 380, - 136, 0, - 137, 0, - 138, 0, - 139, 0, - -2, 276, - -1, 381, - 136, 0, - 137, 0, - 138, 0, - 139, 0, - -2, 277, - -1, 382, - 140, 0, - 141, 0, - 167, 0, - 168, 0, - -2, 278, - -1, 383, - 140, 0, - 141, 0, - 167, 0, - 168, 0, - -2, 279, - -1, 384, - 140, 0, - 141, 0, - 167, 0, - 168, 0, - -2, 280, - -1, 385, - 140, 0, - 141, 0, - 167, 0, - 168, 0, - -2, 281, - -1, 392, - 105, 435, - 106, 435, - -2, 433, - -1, 400, - 149, 142, - -2, 147, - -1, 462, - 105, 435, - 106, 435, - 149, 515, - 160, 515, - -2, 433, - -1, 463, - 149, 516, - 160, 516, - -2, 430, - -1, 464, - 105, 435, - 106, 435, - -2, 433, - -1, 486, - 149, 156, - 160, 156, - -2, 430, - -1, 487, - 105, 435, - 106, 435, - 149, 157, - 160, 157, - -2, 433, - -1, 493, - 148, 472, - -2, 517, - -1, 499, - 148, 472, - -2, 518, - -1, 521, - 79, 332, - -2, 369, - -1, 539, - 94, 135, - 95, 135, - 96, 135, - -2, 0, - -1, 551, - 149, 142, - -2, 147, - -1, 564, - 149, 142, - -2, 147, - -1, 581, - 146, 308, - 149, 308, - -2, 430, - -1, 582, - 105, 435, - 106, 435, - 146, 309, - 149, 309, - -2, 433, - -1, 682, - 79, 334, - -2, 371, - -1, 780, - 136, 0, - 137, 0, - 138, 0, - 139, 0, - -2, 397, - -1, 781, - 136, 0, - 137, 0, - 138, 0, - 139, 0, - -2, 398, - -1, 782, - 136, 0, - 137, 0, - 138, 0, - 139, 0, - -2, 399, - -1, 783, - 136, 0, - 137, 0, - 138, 0, - 139, 0, - -2, 400, - -1, 784, - 140, 0, - 141, 0, - 167, 0, - 168, 0, - -2, 401, - -1, 785, - 140, 0, - 141, 0, - 167, 0, - 168, 0, - -2, 402, - -1, 786, - 140, 0, - 141, 0, - 167, 0, - 168, 0, - -2, 403, - -1, 787, - 140, 0, - 141, 0, - 167, 0, - 168, 0, - -2, 404, - -1, 790, - 79, 333, - -2, 370, - -1, 840, - 37, 201, - -2, 198, - -1, 880, - 31, 128, - 32, 128, - 33, 128, - 145, 128, - -2, 0, - -1, 915, - 96, 140, - -2, 0, - -1, 917, - 31, 127, - 32, 127, - 33, 127, - 145, 127, - -2, 0, - -1, 944, - 94, 136, - 95, 136, - 96, 136, - -2, 0, - -1, 972, - 29, 189, - -2, 4, - -1, 981, - 149, 142, - -2, 147, - -1, 998, - 146, 193, - -2, 195, -} - -const yyPrivate = 57344 - -const yyLast = 8973 - -var yyAct = [...]int{ - - 102, 571, 1007, 565, 420, 966, 844, 715, 808, 607, - 123, 131, 919, 200, 827, 735, 567, 684, 452, 594, - 461, 816, 474, 592, 61, 579, 421, 319, 390, 142, - 340, 98, 39, 315, 517, 264, 114, 444, 447, 2, - 130, 289, 329, 138, 140, 5, 331, 145, 485, 7, - 158, 330, 544, 658, 6, 979, 228, 228, 162, 477, - 960, 192, 938, 141, 493, 935, 121, 942, 26, 941, - 654, 932, 44, 822, 738, 710, 562, 516, 450, 358, - 121, 267, 954, 940, 657, 659, 660, 325, 658, 664, - 665, 432, 933, 955, 898, 678, 679, 251, 153, 43, - 922, 1003, 854, 179, 298, 654, 934, 494, 899, 656, - 655, 586, 270, 586, 633, 204, 619, 271, 736, 657, - 659, 660, 676, 677, 666, 634, 311, 620, 794, 316, - 320, 258, 241, 323, 178, 180, 181, 585, 658, 664, - 665, 672, 673, 674, 675, 678, 679, 729, 586, 510, - 543, 560, 302, 475, 121, 654, 339, 201, 662, 656, - 655, 228, 561, 511, 310, 121, 556, 39, 118, 657, - 659, 660, 676, 677, 666, 908, 357, 557, 506, 162, - 359, 333, 115, 336, 159, 1019, 907, 977, 355, 658, - 664, 665, 507, 267, 360, 228, 930, 905, 451, 499, - 51, 121, 356, 192, 350, 312, 654, 595, 241, 1002, - 656, 655, 451, 120, 862, 658, 133, 104, 351, 313, - 657, 659, 660, 228, 270, 666, 154, 120, 386, 271, - 134, 425, 654, 301, 126, 856, 121, 792, 126, 300, - 121, 746, 192, 205, 640, 179, 182, 183, 184, 185, - 186, 187, 189, 191, 632, 631, 227, 227, 625, 624, - 352, 597, 228, 272, 604, 173, 177, 176, 393, 605, - 456, 596, 595, 231, 231, 174, 178, 180, 181, 188, - 190, 175, 473, 612, 179, 182, 183, 750, 718, 611, - 440, 749, 951, 228, 294, 126, 293, 121, 265, 741, - 448, 120, 287, 916, 229, 177, 176, 230, 229, 458, - 281, 230, 303, 254, 131, 178, 180, 181, 509, 241, - 175, 253, 513, 233, 914, 886, 521, 233, 978, 883, - 472, 160, 871, 451, 826, 815, 448, 931, 491, 728, - 39, 448, 295, 497, 694, 423, 434, 463, 120, 502, - 635, 626, 430, 5, 505, 428, 307, 7, 126, 521, - 121, 354, 6, 541, 593, 229, 484, 1014, 230, 981, - 486, 399, 126, 467, 121, 272, 1000, 893, 231, 471, - 877, 717, 439, 120, 233, 479, 480, 120, 436, 437, - 139, 137, 495, 552, 297, 391, 392, 825, 546, 819, - 683, 572, 548, 572, 577, 572, 580, 297, 228, 587, - 265, 564, 231, 551, 437, 436, 436, 658, 437, 810, - 809, 990, 400, 422, 537, 588, 39, 344, 229, 288, - 345, 230, 446, 135, 654, 278, 295, 275, 656, 655, - 231, 192, 229, 274, 120, 230, 449, 233, 657, 659, - 660, 250, 222, 666, 584, 126, 616, 121, 196, 195, - 194, 233, 443, 448, 448, 491, 497, 144, 492, 122, - 1011, 985, 1010, 498, 984, 462, 464, 924, 581, 231, - 704, 705, 449, 179, 913, 881, 613, 449, 812, 228, - 806, 448, 353, 478, 448, 617, 448, 309, 487, 308, - 805, 704, 705, 799, 177, 176, 713, 120, 316, 400, - 231, 700, 320, 547, 178, 180, 181, 521, 545, 175, - 542, 120, 501, 398, 682, 268, 521, 348, 269, 156, - 982, 906, 39, 521, 521, 521, 521, 521, 606, 649, - 1020, 646, 976, 531, 233, 5, 918, 892, 636, 7, - 891, 653, 572, 889, 6, 711, 733, 126, 228, 228, - 228, 578, 306, 521, 197, 572, 435, 719, 727, 39, - 39, 179, 875, 701, 831, 732, 531, 572, 580, 988, - 192, 651, 730, 224, 225, 267, 714, 228, 228, 396, - 803, 804, 740, 811, 295, 492, 498, 724, 706, 731, - 708, 681, 734, 721, 120, 455, 582, 424, 583, 449, - 449, 125, 743, 739, 703, 742, 270, 696, 697, 257, - 737, 271, 179, 615, 688, 231, 446, 126, 618, 228, - 125, 228, 448, 745, 459, 295, 454, 449, 648, 427, - 449, 755, 449, 210, 211, 212, 213, 214, 215, 216, - 217, 218, 219, 220, 221, 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, 521, 790, 759, 521, 744, 426, 209, 757, 478, - 758, 124, 295, 463, 848, 849, 850, 847, 846, 845, - 321, 791, 304, 751, 259, 299, 231, 486, 793, 438, - 126, 521, 282, 286, 469, 817, 865, 595, 228, 515, - 126, 800, 62, 687, 126, 512, 539, 508, 126, 540, - 572, 322, 832, 457, 531, 263, 576, 572, 851, 404, - 801, 820, 972, 531, 402, 814, 829, 208, 259, 833, - 531, 531, 531, 531, 531, 857, 852, 207, 391, 716, - 716, 986, 743, 824, 446, 126, 828, 272, 859, 260, - 261, 569, 570, 295, 796, 231, 231, 231, 449, 295, - 531, 295, 285, 317, 1008, 295, 239, 422, 422, 521, - 573, 726, 128, 574, 129, 521, 521, 132, 573, 45, - 842, 574, 265, 987, 231, 231, 843, 163, 559, 841, - 54, 338, 573, 260, 261, 574, 879, 797, 228, 1018, - 228, 462, 992, 521, 885, 884, 572, 890, 876, 478, - 882, 478, 45, 855, 468, 487, 958, 878, 132, 956, - 926, 860, 861, 874, 572, 904, 231, 901, 231, 897, - 894, 39, 813, 704, 705, 259, 599, 888, 601, 600, - 848, 849, 850, 847, 846, 845, 226, 234, 228, 900, - 550, 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, 531, 923, - 1004, 531, 448, 909, 999, 961, 895, 707, 704, 705, - 39, 259, 936, 521, 937, 902, 438, 126, 818, 469, - 260, 261, 761, 1, 760, 259, 920, 910, 531, 920, - 284, 723, 259, 652, 650, 231, 521, 438, 647, 521, - 91, 572, 963, 572, 971, 39, 602, 39, 514, 481, - 395, 324, 203, 202, 199, 39, 136, 39, 39, 946, - 748, 521, 754, 864, 445, 609, 572, 971, 589, 590, - 959, 983, 591, 962, 39, 470, 260, 261, 39, 39, - 521, 259, 572, 255, 840, 994, 283, 572, 996, 285, - 260, 261, 965, 964, 998, 980, 839, 260, 261, 836, - 1006, 1005, 725, 39, 572, 1012, 531, 698, 538, 1013, - 403, 318, 531, 531, 993, 572, 1016, 518, 716, 314, - 422, 39, 658, 664, 665, 672, 673, 674, 675, 678, - 679, 127, 575, 259, 446, 231, 31, 231, 256, 654, - 531, 903, 296, 656, 655, 39, 260, 261, 449, 401, - 341, 39, 460, 657, 659, 660, 676, 677, 666, 335, - 147, 151, 155, 945, 685, 995, 165, 1009, 478, 929, - 483, 343, 290, 394, 198, 389, 939, 896, 164, 206, - 157, 161, 528, 608, 997, 231, 970, 969, 531, 968, - 223, 967, 838, 837, 235, 236, 237, 238, 260, 261, - 240, 835, 242, 243, 244, 245, 246, 247, 248, 40, - 252, 568, 15, 14, 821, 262, 823, 566, 720, 802, - 276, 277, 695, 279, 280, 11, 249, 75, 76, 116, - 531, 266, 64, 89, 291, 598, 671, 670, 658, 664, - 665, 672, 673, 674, 675, 678, 679, 90, 520, 101, - 74, 12, 326, 531, 100, 654, 531, 680, 662, 656, - 655, 305, 99, 79, 119, 526, 661, 3, 663, 657, - 659, 660, 676, 677, 666, 830, 240, 41, 531, 117, - 842, 342, 0, 0, 0, 0, 843, 0, 0, 841, - 0, 0, 0, 0, 0, 0, 0, 531, 0, 0, - 880, 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, 0, 232, 232, 0, 0, 0, - 848, 849, 850, 847, 846, 845, 406, 408, 409, 410, - 411, 412, 413, 414, 415, 416, 417, 418, 419, 0, - 273, 0, 0, 0, 0, 0, 519, 0, 0, 915, - 0, 917, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 925, 0, 927, 928, 0, 834, 240, 0, 0, - 433, 433, 0, 0, 0, 0, 0, 441, 0, 519, - 0, 0, 0, 0, 0, 0, 944, 453, 0, 0, - 948, 155, 465, 949, 0, 466, 0, 0, 433, 0, - 0, 0, 0, 0, 433, 291, 0, 0, 0, 0, - 433, 433, 0, 0, 155, 0, 0, 433, 496, 973, - 232, 490, 0, 500, 670, 658, 664, 665, 672, 673, - 674, 675, 678, 679, 504, 0, 0, 0, 0, 0, - 0, 0, 654, 0, 0, 662, 656, 655, 991, 0, - 0, 0, 273, 661, 232, 663, 657, 659, 660, 676, - 677, 666, 0, 669, 667, 668, 0, 0, 0, 0, - 549, 0, 0, 0, 0, 0, 0, 553, 0, 0, - 0, 0, 232, 1015, 0, 0, 0, 0, 0, 0, - 0, 0, 1021, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 555, 671, 670, 658, 664, - 665, 672, 673, 674, 675, 678, 679, 0, 0, 0, - 0, 232, 155, 0, 0, 654, 868, 680, 662, 656, - 655, 0, 0, 0, 0, 0, 661, 519, 663, 657, - 659, 660, 676, 677, 666, 0, 519, 0, 490, 0, - 0, 0, 232, 519, 519, 519, 519, 519, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 610, 614, 658, - 664, 665, 672, 673, 674, 675, 678, 679, 0, 0, - 0, 0, 0, 519, 0, 0, 654, 0, 0, 662, - 656, 655, 627, 629, 0, 0, 0, 661, 0, 663, - 657, 659, 660, 676, 677, 666, 637, 0, 0, 0, - 0, 0, 0, 0, 638, 639, 0, 0, 0, 0, - 642, 643, 0, 686, 0, 0, 0, 0, 0, 0, - 689, 690, 691, 692, 693, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 342, - 702, 0, 0, 0, 0, 0, 0, 232, 0, 0, - 0, 712, 0, 0, 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, 519, - 519, 519, 0, 0, 519, 0, 0, 0, 0, 0, - 433, 504, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 747, 0, 0, 0, 0, 0, 433, 752, - 0, 519, 0, 0, 0, 0, 0, 155, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 232, 170, - 192, 155, 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, 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, 519, - 0, 193, 173, 177, 176, 519, 519, 232, 232, 232, - 172, 807, 174, 178, 180, 181, 188, 190, 175, 0, - 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, - 220, 221, 0, 519, 273, 0, 232, 232, 0, 0, - 0, 169, 171, 170, 192, 853, 0, 0, 433, 0, - 453, 621, 0, 0, 0, 0, 433, 433, 610, 0, - 0, 0, 0, 866, 209, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 869, 0, 232, 0, - 232, 519, 872, 873, 167, 168, 179, 182, 183, 184, - 185, 186, 187, 189, 191, 0, 0, 0, 0, 810, - 809, 0, 0, 0, 0, 193, 173, 177, 176, 0, - 0, 0, 0, 342, 172, 0, 174, 178, 180, 181, - 188, 190, 175, 519, 0, 0, 0, 0, 0, 0, - 658, 664, 665, 672, 673, 674, 675, 678, 679, 0, - 0, 0, 0, 0, 0, 0, 519, 654, 0, 519, - 662, 656, 655, 0, 0, 0, 0, 0, 911, 0, - 663, 657, 659, 660, 676, 677, 666, 232, 0, 0, - 0, 519, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 519, 0, 0, 0, 0, 0, 0, 0, 0, 4, - 943, 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, 558, 16, 25, 36, 957, - 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, 232, 0, 232, - 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, 232, 0, 0, - 0, 0, 0, 0, 210, 211, 212, 213, 214, 215, - 216, 217, 218, 219, 220, 221, 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, 209, 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, 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, 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, 0, 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, - 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, - 220, 221, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 92, 77, 17, 349, 35, - 0, 63, 0, 97, 0, 0, 0, 58, 57, 59, - 60, 73, 120, 328, 209, 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, - 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, 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, 33, 0, 34, 0, 0, 22, - 0, 0, 0, 23, 24, 38, 45, 0, 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, - 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, 0, 34, 0, 0, 22, 0, 0, - 0, 23, 24, 38, 45, 0, 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, 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, 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, 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, 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, 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, - 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, 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, 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, - 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, 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, 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, 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, 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, 887, 0, 22, 0, 0, 0, 23, 24, 38, - 45, 0, 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, 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, 699, 21, 0, 33, 0, 34, 0, - 0, 22, 0, 0, 0, 23, 24, 38, 45, 0, - 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, 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, 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, - 0, 92, 77, 17, 563, 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, 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, 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, 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, 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, - 0, 22, 0, 0, 0, 23, 24, 38, 45, 0, - 0, 25, 36, 0, 0, 37, 0, 0, 27, 0, - 32, 81, 82, 192, 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, 179, 182, 183, 78, 42, - 28, 0, 189, 191, 0, 0, 55, 56, 0, 65, - 66, 67, 68, 69, 70, 71, 177, 176, 0, 0, - 0, 0, 0, 0, 0, 0, 178, 180, 181, 188, - 190, 175, 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, 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, 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, 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, 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, 34, 0, 0, 22, - 0, 0, 0, 23, 24, 38, 45, 0, 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, - 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, 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, 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, - 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, 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, 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, - 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, 92, 77, 0, 0, 0, - 0, 63, 482, 97, 45, 0, 488, 58, 57, 59, - 60, 73, 120, 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, 148, 149, 0, 0, 0, - 0, 0, 55, 56, 0, 65, 66, 67, 68, 69, - 70, 71, 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, 92, - 77, 0, 0, 0, 0, 63, 45, 97, 0, 0, - 488, 58, 57, 59, 60, 73, 120, 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, 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, - 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, 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, 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, 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, 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, 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, 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, 83, 84, 72, 0, 105, - 106, 126, 88, 121, 0, 0, 0, 0, 0, 95, - 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, - 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, - 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, 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, 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, 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, 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, 912, 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, 669, 667, 668, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 92, 77, 0, - 0, 0, 0, 63, 0, 97, 0, 0, 0, 58, - 57, 59, 60, 73, 120, 671, 670, 658, 664, 665, - 672, 673, 674, 675, 678, 679, 669, 667, 668, 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, 169, 171, 170, 192, 671, - 670, 658, 664, 665, 672, 673, 674, 675, 678, 679, - 0, 0, 0, 0, 0, 870, 0, 0, 654, 0, - 680, 662, 656, 655, 0, 0, 0, 0, 0, 661, - 0, 663, 657, 659, 660, 676, 677, 666, 167, 168, - 179, 182, 183, 184, 185, 186, 187, 189, 191, 0, - 0, 0, 863, 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, 669, 667, 668, 0, 167, 168, 179, 182, - 183, 184, 185, 186, 187, 189, 191, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 858, 193, 173, 177, - 176, 795, 0, 0, 0, 0, 172, 0, 174, 178, - 180, 181, 188, 190, 175, 671, 670, 658, 664, 665, - 672, 673, 674, 675, 678, 679, 0, 0, 0, 0, - 669, 667, 668, 798, 654, 0, 680, 662, 656, 655, - 756, 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, 169, - 171, 170, 192, 671, 670, 658, 664, 665, 672, 673, - 674, 675, 678, 679, 0, 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, 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, 169, 171, 170, 192, 167, 168, 179, 182, - 183, 184, 185, 186, 187, 189, 191, 0, 0, 0, - 753, 0, 0, 0, 0, 0, 0, 193, 173, 177, - 176, 0, 0, 0, 0, 0, 172, 0, 174, 178, - 180, 181, 188, 190, 175, 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, 169, - 171, 170, 192, 167, 168, 179, 182, 183, 184, 185, - 186, 187, 189, 191, 0, 0, 0, 644, 0, 0, - 0, 0, 0, 0, 193, 173, 177, 176, 0, 0, - 0, 0, 0, 172, 0, 174, 178, 180, 181, 188, - 190, 175, 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, 169, 171, 170, 192, - 167, 168, 179, 182, 183, 184, 185, 186, 187, 189, - 191, 0, 0, 0, 0, 0, 0, 0, 623, 0, - 0, 193, 173, 177, 176, 0, 0, 0, 0, 0, - 172, 0, 174, 178, 180, 181, 188, 190, 175, 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, 169, - 171, 170, 192, 167, 168, 179, 182, 183, 184, 185, - 186, 187, 189, 191, 0, 0, 0, 603, 0, 0, - 0, 0, 0, 0, 193, 173, 177, 176, 0, 0, - 476, 0, 0, 172, 0, 174, 178, 180, 181, 188, - 190, 175, 167, 168, 179, 182, 183, 184, 185, 186, - 187, 189, 191, 0, 0, 0, 0, 0, 554, 169, - 171, 170, 192, 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, 169, 171, - 170, 192, 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, 167, 168, 179, 182, 183, 184, 185, 186, 187, - 189, 191, 405, 0, 0, 0, 0, 0, 0, 429, - 0, 0, 193, 173, 177, 176, 0, 0, 0, 0, - 0, 172, 0, 174, 178, 180, 181, 188, 190, 175, - 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, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 169, 171, 170, 192, 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, 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, 169, 171, 170, 192, 167, 168, 179, - 182, 183, 184, 185, 186, 187, 189, 191, 0, 0, - 0, 0, 347, 0, 0, 0, 0, 0, 193, 173, - 177, 176, 0, 0, 0, 0, 0, 172, 0, 174, - 178, 180, 181, 188, 190, 175, 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, 169, 171, 170, 192, - 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, 167, - 168, 179, 182, 183, 184, 185, 186, 187, 189, 191, - 669, 667, 668, 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, - 667, 668, 0, 671, 670, 658, 664, 665, 672, 673, - 674, 675, 678, 679, 0, 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, 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, 668, 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, 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, 0, 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, 0, 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, 192, 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, 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, 0, 0, 0, 178, 180, 181, 188, 190, 175, - 105, 106, 126, 0, 0, 0, 0, 0, 0, 0, - 529, 0, 0, 0, 179, 182, 183, 184, 185, 186, - 187, 189, 191, 105, 106, 126, 0, 0, 0, 0, - 0, 0, 0, 529, 0, 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, 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, 2243, -1000, -1000, -1000, -1000, -1000, 321, 547, - 755, 70, -1000, 286, -1000, -1000, 946, -1000, 242, 242, - 5391, 319, 242, 6739, 6627, 6515, 383, 172, 795, 6851, - -1000, 8139, 312, 311, 310, -1000, 420, 6851, 944, 4, - 943, 942, 6851, -1000, -1000, -1000, -1000, 704, -1000, 694, - -1000, 525, 304, 6851, 478, 224, 224, 6851, 6851, 6851, - 6851, -1000, -1000, 7075, -1000, 6851, 6851, 6851, 6851, 6851, - 6851, 6851, 303, 6851, -1000, 171, 163, 1021, 6851, 677, - 445, 295, 289, 6851, 6851, 287, 6851, 6851, -1000, 160, - -1000, -1000, 969, 913, -1000, 152, 281, 6065, -1000, 146, - 144, -1000, 259, 907, 626, -1000, -1000, -1000, -1000, -1000, - -1000, -1000, -1000, -1000, 89, 153, -1000, 623, 246, -1000, - 418, -1000, 207, 353, -1000, 907, -1000, 59, 700, 617, - -1000, 702, 907, -1000, 941, -1000, -75, 4297, 5235, 7075, - 5079, 790, 4, 528, 6851, 283, -1000, 8085, -1000, 762, - -1000, 8046, -1000, 381, 2242, 8178, -1000, 58, -1000, -1000, - 348, 42, 4, -83, 34, 8178, -1000, 6851, 6851, 6851, - 6851, 6851, 6851, 6851, 6851, 6851, 6851, 6851, 6851, 6851, - 6851, 6851, 6851, 6851, 6851, 6851, 6851, 6851, 6851, 6851, - 6851, 6851, 445, 6403, 224, 6851, 940, -1000, 7992, 377, - 361, -1000, 688, 683, -1000, 525, 7953, -1000, -1000, 6291, - 6851, 6851, 6851, 6851, 6851, 6851, 6851, 6851, 6851, 6851, - 6851, 6851, 285, -1000, -1000, -1000, -1000, -1000, 259, 524, - 907, 607, 560, -1000, -1000, 438, 438, 489, 438, 206, - 7870, 203, 438, 438, 438, 438, 438, 438, 438, -1000, - 6177, -1000, 438, 6851, 6851, 423, 736, 920, -1000, 232, - 6963, 224, 8414, 68, 246, 557, -1000, 511, 522, 907, - 675, 89, 153, 555, 6851, 6851, 8178, 8178, 6851, 8178, - 8178, 6851, 692, 736, 843, -1000, 899, 6851, 6065, 131, - -7, 7831, 224, 6851, 6851, 939, -1000, 5503, 259, 54, - 6851, 6851, 89, 418, 189, -1000, 6851, 376, -1000, -1000, - 2085, 259, -1000, 714, 32, -1000, 698, 907, 3, -1000, - 696, 907, 938, 690, -85, 8815, -1000, -1000, -1000, -1000, - -1000, -1000, 276, -1000, -1000, -1000, -1000, -1000, 242, 274, - 374, -10, 8178, -1000, 372, 367, -1000, -1000, -1000, -1000, - -1000, 172, -1000, 6851, -1000, -1000, 858, 265, 8815, -1000, - 6851, 8542, 8593, 8324, 8414, 1579, 112, 8681, 8630, -30, - -30, -30, 489, 438, 489, 489, 350, 350, 4572, 4572, - 4572, 4572, 151, 151, 151, 151, -1000, 7771, 6851, 17, - -1000, -1000, 1936, 779, 2, -86, 4139, -1000, -1000, 263, - 710, 679, 718, 417, 718, 6851, 8414, 362, 8414, 8414, - 8414, 8414, 8414, 8414, 8414, 8414, 8414, 8414, 8414, 8414, - -12, -1000, -1000, 261, 907, 259, 68, 68, 214, -1000, - -1000, -1000, 120, 8178, 110, -1000, -1000, -1000, -1000, 846, - 936, 7732, 119, 393, 246, 139, -1000, -1000, 89, 153, - -1000, 6851, -1000, -1000, 142, 907, 511, 68, 89, 142, - -33, -1000, 525, -1000, 1632, 7678, 7639, 108, -1000, -1000, - -1000, 107, 202, -1000, -1000, 5953, 5841, -1000, -1000, 104, - 103, -1000, -1000, -35, 201, -1000, -1000, 525, 224, 6851, - -1000, 246, 246, -1000, -1000, 93, 7581, 246, 246, -1000, - 7542, -1000, 1927, -1000, -1000, -1000, -1000, 700, 928, 609, - -1000, 617, 924, 552, -1000, 923, 8815, -1000, 8232, -1000, - -1000, 511, 518, 907, 252, 8815, -1000, -1000, -1000, -1000, - 706, 545, 8815, 8815, 8815, 8815, 8815, 195, 523, 4455, - 3981, 365, 6851, 6851, 469, -1000, 876, -1000, -1000, 7484, - -87, 710, -1000, 8178, 6851, 8504, 360, 224, 228, 228, - 4923, 921, 8815, 749, 710, 190, -13, -1000, 4, -1000, - -1000, -1000, 511, 516, 907, 412, 718, -1000, -1000, -42, - -1000, -1000, 525, -1000, 445, -88, 285, 285, 259, -1000, - -1000, 149, 659, 6851, -1000, 68, -1000, -1000, 90, -1000, - -1000, -1000, -1000, -1000, -1000, 6851, -1000, -1000, 141, 137, - -1000, 6851, 6851, 89, 7445, -1000, 511, -1000, -1000, -1000, - 6851, -1000, -1000, -1000, -1000, -1000, -1000, 7391, 224, 8178, - 224, -1000, -1000, -1000, 5617, -1000, -1000, 8178, -1000, -1000, - -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, 914, -1000, - -1000, 912, -1000, -1000, 8815, 8815, 8815, 8815, 8815, 8815, - 8815, 8815, 8815, 8815, 8815, 8815, 8815, 8815, 8815, 8815, - 8815, 8815, 8815, 8815, 8815, 8815, 8815, 8815, 8815, 8815, - 8792, 907, 511, 8815, 86, -32, 7352, 638, 764, 82, - 82, -80, -80, 7294, 357, -1000, 242, 5391, 496, 354, - -1000, 344, 8178, -1000, 6851, 273, 448, 342, 821, -1000, - 8815, 186, 8504, -1000, -1000, 656, -1000, 224, 251, 656, - -1000, -1000, -1000, -89, -1000, 720, 249, 185, 721, 710, - 490, 907, 511, -1000, -42, 1141, 718, 246, 6851, -1000, - -47, 6851, 659, -1000, 84, 246, -1000, 7255, 659, 6851, - 6851, 63, 7197, -1000, 658, -1000, 5729, -1000, -1000, -1000, - -1000, -1000, 1295, -80, -80, 82, 82, 82, 82, 1727, - 889, 5, 284, 284, -80, 8363, 1005, 8271, 1356, 1212, - -45, -45, -45, -45, 56, 56, 56, 56, 8815, 7158, - 511, 183, -1000, -1000, 8815, 8815, -1000, -1000, -1000, -1000, - 5391, -1000, 476, 242, 233, -1000, 6851, 1683, -1000, -1000, - -1000, -1000, -1000, 339, -1000, 721, 180, 228, -1000, 285, - 176, 3823, 8815, -1000, 409, 718, 406, 403, 229, -1000, - 838, -1000, 511, 761, -1000, -1000, 837, -52, -1000, 762, - 595, -1000, 905, 718, -1000, -1000, -1000, -1000, -1000, -1000, - -1000, -1000, -1000, 8414, -1000, 46, -1000, -1000, 386, -1000, - 35, 24, -1000, -1000, -1000, 68, 8178, 224, -1000, 8453, - 8815, -1000, 7104, 8232, -1000, 338, 177, -1000, 154, -1000, - 4455, -1000, 402, 4767, -1000, -49, 4767, 331, -1000, -1000, - 828, -1000, -1000, 184, -91, -1000, -54, -97, -1000, 902, - 4, -1000, -100, -77, -1000, -1000, -1000, -1000, -1000, -1000, - -1000, 8453, 8815, -1000, -1000, 4455, 4611, 4455, -1000, -1000, - -1000, -1000, -1000, -1000, -1000, 3665, 143, 3507, 3349, -67, - -1000, 827, 6851, -1000, 824, 8815, -102, 895, 8815, -1000, - 718, -1000, 732, 8232, 4455, -1000, -1000, -1000, 3191, 3033, - -1000, 398, -1000, -1000, -1000, 175, -1000, 8178, -107, -1000, - 8815, 221, -1000, -1000, 385, 732, -1000, 328, 325, 715, - 774, 500, -1000, 2875, -1000, 275, -1000, -1000, 810, 8815, - -1000, 710, -1000, -1000, -1000, -1000, 718, 595, 894, 230, - -1000, 2717, -1000, -1000, 60, -59, -1000, 890, -1000, -1000, - -1000, 742, 326, 718, -1000, -1000, 742, -1000, 219, -1000, - -1000, -1000, -1000, -1000, 718, 2559, 807, -1000, 36, 396, - -1000, 2401, -1000, -} -var yyPgo = [...]int{ - - 0, 29, 1177, 22, 8, 13, 1175, 1167, 40, 33, - 27, 940, 1165, 1164, 36, 217, 1179, 91, 1036, 72, - 99, 59, 810, 200, 1163, 31, 1162, 1154, 1152, 42, - 1151, 50, 34, 1150, 1149, 1148, 1147, 131, 1135, 1133, - 20, 1132, 26, 38, 168, 1131, 722, 35, 1129, 1, - 1128, 1127, 24, 1126, 68, 51, 46, 1125, 1122, 1119, - 28, 1118, 3, 1117, 1116, 2, 1113, 1112, 1111, 16, - 1109, 1101, 1093, 1092, 48, 5, 1091, 1089, 1087, 1086, - 1084, 6, 1083, 1017, 1082, 1081, 1080, 18, 1042, 1078, - 1077, 1076, 1075, 1073, 1072, 41, 1071, 1070, 4, 1069, - 1067, 1065, 17, 1064, 12, 1063, 1059, 1052, 7, 21, - 30, 1050, 1049, 25, 1041, 0, 1032, 1031, 1019, 1011, - 1010, 14, 39, 391, 619, 1008, 1007, 52, 1002, 1001, - 1000, 15, 999, 996, 993, 992, 984, 983, 972, 969, - 23, 968, 19, 9, 965, 37, 964, 963, 962, 960, - 182, 923, -} -var yyR1 = [...]int{ - - 0, 151, 122, 122, 115, 115, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 117, 117, - 8, 8, 8, 8, 118, 118, 9, 9, 9, 9, - 119, 119, 10, 10, 10, 10, 57, 57, 123, 123, - 28, 28, 28, 28, 28, 29, 29, 30, 30, 30, - 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, - 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, - 30, 30, 30, 30, 30, 128, 128, 64, 64, 129, - 129, 130, 130, 65, 92, 92, 60, 55, 56, 5, - 5, 6, 6, 66, 67, 67, 70, 70, 70, 70, - 112, 112, 2, 120, 120, 116, 116, 113, 113, 109, - 109, 108, 108, 108, 105, 105, 104, 104, 61, 61, - 93, 93, 96, 96, 96, 96, 127, 127, 127, 4, - 4, 106, 106, 125, 125, 126, 126, 58, 58, 59, - 59, 62, 62, 63, 63, 69, 69, 68, 68, 68, - 68, 88, 88, 88, 97, 97, 74, 74, 74, 74, - 86, 86, 31, 31, 31, 85, 85, 85, 85, 131, - 131, 71, 71, 71, 71, 73, 114, 114, 91, 91, - 134, 134, 135, 135, 75, 75, 76, 101, 101, 79, - 79, 78, 77, 77, 80, 80, 100, 100, 132, 132, - 133, 133, 136, 136, 81, 81, 81, 81, 81, 81, - 90, 90, 90, 90, 72, 72, 89, 89, 110, 110, - 111, 111, 140, 140, 138, 138, 139, 139, 139, 141, - 141, 46, 19, 19, 19, 19, 19, 19, 19, 19, - 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, - 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, - 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, - 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, - 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, - 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, - 19, 19, 19, 19, 19, 19, 54, 54, 54, 54, - 51, 51, 51, 51, 50, 50, 1, 121, 121, 99, - 99, 99, 99, 27, 27, 27, 27, 27, 27, 27, - 27, 15, 15, 15, 15, 49, 49, 49, 47, 47, - 45, 45, 148, 148, 147, 53, 53, 53, 137, 137, - 137, 87, 87, 11, 11, 11, 11, 11, 11, 11, - 11, 11, 11, 11, 11, 12, 32, 83, 83, 83, - 83, 83, 83, 83, 83, 83, 83, 84, 84, 84, - 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, - 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, - 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, - 39, 39, 39, 39, 33, 33, 33, 33, 33, 33, - 33, 102, 102, 3, 3, 103, 103, 103, 103, 18, - 18, 52, 52, 20, 21, 22, 23, 23, 149, 149, - 142, 144, 144, 82, 143, 143, 143, 44, 44, 48, - 48, 16, 26, 26, 24, 24, 24, 25, 25, 25, - 14, 14, 14, 13, 13, 17, 17, 145, 145, 146, - 146, 146, 43, 43, 150, 150, 98, 98, 42, 42, - 42, 95, 95, 94, 94, 94, 94, 94, 94, 94, - 94, 124, 124, 124, 124, 37, 37, 37, 37, 37, - 37, 37, 38, 38, 38, 41, 41, 41, 41, 41, - 41, 41, 41, 107, 107, 40, 40, 34, 34, 35, - 36, -} -var yyR2 = [...]int{ - - 0, 1, 2, 0, 1, 3, 1, 1, 1, 1, - 4, 3, 5, 4, 3, 4, 4, 2, 3, 1, - 1, 3, 2, 4, 3, 1, 1, 3, 2, 4, - 3, 1, 1, 3, 2, 4, 5, 4, 2, 0, - 1, 1, 1, 1, 4, 1, 2, 3, 5, 8, - 3, 5, 9, 3, 2, 3, 2, 3, 2, 3, - 3, 2, 3, 3, 3, 1, 2, 5, 8, 8, - 5, 1, 6, 3, 3, 0, 9, 0, 4, 1, - 0, 1, 2, 8, 1, 3, 1, 1, 1, 0, - 1, 0, 1, 9, 7, 6, 1, 2, 1, 2, - 0, 2, 1, 0, 2, 0, 2, 1, 3, 0, - 2, 1, 2, 4, 1, 4, 1, 4, 1, 4, - 3, 5, 3, 4, 4, 5, 0, 5, 4, 1, - 1, 1, 4, 0, 4, 0, 5, 0, 2, 0, - 3, 1, 0, 1, 3, 4, 6, 0, 1, 1, - 1, 2, 3, 3, 1, 3, 1, 1, 2, 2, - 3, 1, 1, 2, 4, 3, 5, 1, 3, 2, - 0, 3, 2, 1, 8, 3, 1, 3, 1, 3, - 0, 1, 1, 2, 2, 2, 3, 1, 3, 1, - 1, 3, 4, 3, 0, 1, 1, 3, 1, 1, - 0, 1, 1, 2, 1, 1, 1, 1, 1, 1, - 3, 5, 1, 3, 5, 4, 3, 1, 0, 1, - 3, 1, 2, 1, 4, 3, 2, 1, 1, 0, - 1, 3, 6, 3, 4, 6, 2, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, - 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, - 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 1, 1, 4, 5, 4, 1, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, - 1, 3, 2, 1, 9, 10, 2, 2, 4, 4, - 4, 4, 4, 4, 4, 3, 1, 0, 4, 3, - 4, 1, 2, 2, 4, 3, 4, 4, 4, 4, - 2, 1, 1, 3, 2, 1, 3, 2, 1, 1, - 4, 1, 2, 0, 2, 0, 2, 1, 0, 1, - 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 3, 2, 3, 1, 1, 1, 1, - 3, 2, 4, 3, 1, 1, 1, 4, 3, 3, - 3, 3, 3, 3, 2, 2, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 4, 5, 2, 2, 3, - 1, 1, 3, 2, 1, 1, 1, 1, 3, 3, - 1, 0, 2, 0, 1, 5, 3, 3, 1, 1, - 1, 3, 3, 1, 1, 1, 5, 1, 2, 0, - 3, 4, 4, 1, 1, 1, 0, 1, 2, 3, - 3, 1, 4, 4, 1, 1, 1, 1, 2, 1, - 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, 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, -151, -122, -7, 2, -29, -55, -56, 52, 80, - 45, -57, -30, 10, -66, -67, 39, 144, 7, 21, - 20, 23, 30, 34, 35, 40, -54, 47, 99, 19, - 14, -18, 49, 25, 27, 146, 41, 44, 36, -1, - -70, -2, 98, -20, -19, 37, 53, 100, 54, 101, - 55, -23, 60, 93, -22, 105, 106, 155, 154, 156, - 157, -52, -46, 148, -41, 108, 109, 110, 111, 112, - 113, 114, 6, 158, -33, -51, -50, 143, 97, -24, - 92, 50, 51, 4, 5, 85, 86, 87, 11, -39, - -36, -11, 142, 75, 63, 18, 61, 150, -25, -26, - -27, -34, -115, 83, -15, 8, 9, 67, 68, 82, - 64, 65, 66, 81, -14, -150, -48, -16, -44, -13, - 159, 12, 148, -115, 144, 83, 10, -117, 37, 39, - -8, -115, 83, 146, 160, 147, 10, -123, -52, 148, - -52, -29, -1, 80, 148, -52, 146, -18, 98, 99, - 146, -18, 146, -19, -23, -18, 146, -86, -31, 12, - 159, -85, -1, 12, -89, -18, 146, 131, 132, 88, - 90, 89, 161, 153, 163, 169, 155, 154, 164, 133, - 165, 166, 134, 135, 136, 137, 138, 139, 167, 140, - 168, 141, 91, 152, 148, 148, 148, 144, -18, 10, - -5, 153, 10, 10, -19, -23, -18, 53, 53, 162, - 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, - 128, 129, 148, -18, 105, 106, -22, -23, -115, 80, - 83, -15, -16, 99, -22, -18, -18, -18, -18, -46, - -18, -54, -18, -18, -18, -18, -18, -18, -18, -53, - 148, -52, -18, 150, 150, -137, 17, -124, -37, 12, - 77, 78, -18, 58, -47, -15, -45, -115, 80, 83, - -25, -14, -150, -16, 148, 148, -18, -18, 148, -18, - -18, 150, -124, 17, 17, 76, -124, 150, 148, -95, - -94, -18, 153, 150, 150, 83, -88, 148, -115, 79, - 150, 144, -14, 159, 79, -88, 144, 149, 146, 144, - -122, -115, 146, 160, -118, -9, -115, 83, -119, -10, - -115, 83, 29, -115, 10, 162, -28, 145, 2, -29, - -55, -56, 52, -29, 147, -106, -29, 147, 21, -5, - -110, -111, -18, -96, 144, 147, 146, 146, 146, 146, - 146, 160, -20, 144, -23, 146, 160, -5, 162, 146, - 160, -18, -18, -18, -18, -18, -18, -18, -18, -18, - -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, - -18, -18, -18, -18, -18, -18, -47, -18, 147, -92, - -60, -23, -23, -19, -93, 10, -123, 146, 146, 10, - 148, -112, 56, -120, 56, 59, -18, 153, -18, -18, - -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, - -98, -42, -23, 60, 83, -115, 79, 79, 149, 149, - 149, 149, -17, -18, -17, 143, -37, -37, 17, 150, - 58, -18, 11, -23, -145, -146, -44, -43, -14, -150, - 10, 144, -87, -88, 79, 83, -115, 58, -14, 79, - -107, -40, -23, -19, -23, -18, -18, -17, 142, 76, - 76, -17, -95, 151, -3, 160, 59, -21, -23, -17, - -17, 10, 149, -97, -54, -74, -19, -23, 153, 84, - -88, -43, -44, 10, 53, -17, -18, -43, -44, 10, - -18, 146, -122, 145, -88, -8, 146, 160, 29, -115, - 146, 160, 29, -115, 10, 29, 162, -32, -83, -11, - -35, -115, 80, 83, 61, 150, -12, 63, -84, 18, - 75, -15, 156, 157, 155, 154, 148, 148, -125, -123, - -123, -52, 146, 160, -127, 146, -127, 146, -31, -18, - 12, 148, -32, -18, 147, -18, 149, 160, 29, 29, - 149, 160, 162, 145, 148, -62, -63, -69, -68, 61, - 62, -49, -115, 80, 83, -116, 57, -49, 144, -113, - -49, -19, -23, -23, 92, 149, 160, 148, -115, -141, - -139, -138, -140, 150, -142, 58, 151, 151, -38, 10, - 13, 12, 10, 145, 145, 150, 145, -143, -82, -144, - -88, 150, 144, -14, -18, -44, -115, -145, -44, 149, - 160, 149, 149, 149, 151, 151, 149, -18, 153, -18, - 153, 151, 151, 149, 160, 149, -21, -18, -88, -88, - 151, 145, -88, -88, 145, 145, -9, 10, 29, -10, - 10, 29, 10, -32, 150, 155, 154, 164, 133, 165, - 166, 161, 153, 163, 134, 135, 169, 89, 90, 88, - 132, 131, 136, 137, 138, 139, 167, 168, 140, 141, - 152, 83, -115, 148, -102, -103, -83, 17, 79, -83, - -83, -83, -83, -83, 149, -58, 94, 95, -126, 22, - 146, -110, -18, 145, 32, 33, -127, 31, -127, 145, - 162, -62, -18, 146, -60, -108, -23, 153, 60, -108, - -61, -29, 147, 10, -32, -128, 42, -62, 149, 160, - -5, 83, -115, 144, -113, -131, 160, -47, 162, -42, - -98, 150, -140, -142, -17, -145, 151, -18, -149, 150, - 150, -17, -18, 145, -148, -40, 59, -21, -21, -74, - 10, 10, -83, -83, -83, -83, -83, -83, -83, -83, - -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, - -83, -83, -83, -83, -83, -83, -83, -83, 147, -83, - -115, -102, 151, -3, 160, 59, 10, 53, 149, 146, - -52, -29, -59, 94, 95, 146, 146, -18, -4, 147, - 146, 145, 146, 31, -32, 149, -109, 59, -23, 148, - -109, -123, 162, -64, 43, 148, 149, -121, 45, -69, - -6, 84, -115, -131, 145, -71, -132, -72, -73, -133, - -136, 48, 39, 45, -81, 104, 103, 102, 99, 100, - 101, -49, -87, -18, 149, -17, 151, -143, 151, -142, - -17, -17, 151, 145, -147, 58, -18, 153, 151, -83, - 147, 149, -83, -83, -29, 96, -52, 147, -110, -4, - -123, 146, -121, 149, -108, -98, 149, 28, -32, 144, - -49, 144, 144, 148, 12, 145, -90, 12, 146, 160, - -1, -81, 10, -114, -49, 151, 145, 151, 151, -145, - -21, -83, 59, 146, 147, -123, 149, -123, 144, -104, - -29, 147, 149, -104, 146, -123, 12, -123, -123, -99, - 12, 153, 162, 146, 160, 162, 10, -5, 162, -91, - 160, 146, 144, -83, -123, -105, -29, 147, -123, -123, - 145, 149, 145, 145, 149, 160, 12, -18, 12, -32, - 162, 10, -32, -49, -134, -135, -75, -76, -77, -78, - -79, -49, 10, -123, 145, 26, 144, 12, 153, 162, - -32, 148, 145, -75, 146, 146, 46, 29, 79, 24, - 146, -123, 12, -32, -62, -101, -49, -80, -81, 10, - 146, 145, 149, 160, 10, -129, -130, -65, 42, -100, - 146, 144, -49, -65, 148, -123, -49, 145, 12, 149, - 144, -123, 145, -} -var yyDef = [...]int{ - - 3, -2, -2, 2, 6, 7, 8, 9, 0, 0, - 0, 0, 45, 4, 87, 88, 0, 39, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 331, 0, - 65, 0, 0, 0, 0, 71, 0, 0, 0, 89, - 0, 0, 303, 429, 430, 316, 96, 0, 98, 0, - 102, -2, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 283, 284, 0, 288, 0, 0, 0, 0, 0, - 0, 0, 345, 0, 298, 299, 300, 348, 0, 437, - 0, 0, 0, 0, 0, 0, 0, 0, 414, 415, - 416, 417, 0, 0, 420, 355, 0, 481, 454, 455, - 456, 410, -2, 0, 0, 353, 354, 356, 357, 358, - 359, 360, 361, 362, -2, 0, 459, 0, 0, 462, - 474, 463, 0, 0, 3, 0, 4, 0, 0, 0, - 19, 20, 0, 17, 0, 46, 0, 0, 0, 0, - 0, 0, 89, 0, 218, 0, 54, 0, 303, 331, - 56, 0, 58, 430, -2, 0, 61, 0, 161, 162, - 0, 0, 89, 167, 0, 217, 66, 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, 39, 0, 0, - 0, 90, 100, 103, -2, -2, 0, 97, 99, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 480, 236, 249, 251, 250, 435, 332, 0, - 0, 0, 0, 331, 252, 270, 271, 272, 273, 284, - 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, 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, - 32, 0, 0, 22, 0, 0, 38, 47, 40, 41, - 42, 43, 0, 133, 39, 50, 131, 39, 0, 0, - 0, 219, 221, 53, 126, 126, 55, 57, 59, 60, - 62, 0, 163, 0, 433, 63, 0, 0, 0, 64, - 0, 253, 254, 255, 256, 257, 258, 259, 260, 261, - 262, 263, 264, 265, 266, 267, 268, 269, -2, -2, - -2, -2, -2, -2, -2, -2, 282, 0, 0, 0, - 84, 86, -2, 430, 0, 0, 0, 73, 74, 0, - -2, 105, 0, 0, 0, 0, 233, 0, 237, 238, - 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, - 0, 477, 478, 0, 0, 334, 0, 0, 229, 431, - 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, 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, 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, - 0, 0, 0, 0, 0, 0, 0, 0, 137, -2, - 0, 0, 218, 0, 0, 126, 0, 126, 160, 0, - 165, -2, 168, 216, 0, 287, 0, 0, 0, 0, - 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, 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, 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, 156, 142, 3, 159, 166, 153, 3, - 148, 149, 164, 155, 160, 154, 169, 165, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, 147, 146, - 167, 162, 168, 152, 158, 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, 150, 3, 151, 163, 3, 143, 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, 144, 161, 145, 157, -} -var yyTok2 = [...]int{ - - 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, - 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, - 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, - 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, - 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, - 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, - 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, - 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, - 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, 117, 118, 119, 120, 121, - 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, - 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, -} -var yyTok3 = [...]int{ - 0, -} - -var yyErrorMessages = [...]struct { - state int - token int - msg string -}{} - -// line yaccpar:1 - -/* parser for yacc output */ - -var ( - yyDebug = 0 - yyErrorVerbose = true -) - -type yyLexer interface { - Lex(lval *yySymType) int - Error(s string) -} - -type yyParser interface { - Parse(yyLexer) int - Lookahead() int -} - -type yyParserImpl struct { - lval yySymType - stack [yyInitialStackSize]yySymType - char int -} - -func (p *yyParserImpl) Lookahead() int { - return p.char -} - -func yyNewParser() yyParser { - return &yyParserImpl{} -} - -const yyFlag = -1000 - -func yyTokname(c int) string { - if c >= 1 && c-1 < len(yyToknames) { - if yyToknames[c-1] != "" { - return yyToknames[c-1] - } - } - return __yyfmt__.Sprintf("tok-%v", c) -} - -func yyStatname(s int) string { - if s >= 0 && s < len(yyStatenames) { - if yyStatenames[s] != "" { - return yyStatenames[s] - } - } - return __yyfmt__.Sprintf("state-%v", s) -} - -func yyErrorMessage(state, lookAhead int) string { - const TOKSTART = 4 - - if !yyErrorVerbose { - return "syntax error" - } - - for _, e := range yyErrorMessages { - if e.state == state && e.token == lookAhead { - return "syntax error: " + e.msg - } - } - - res := "syntax error: unexpected " + yyTokname(lookAhead) - - // To match Bison, suggest at most four expected tokens. - expected := make([]int, 0, 4) - - // Look for shiftable tokens. - base := yyPact[state] - for tok := TOKSTART; tok-1 < len(yyToknames); tok++ { - if n := base + tok; n >= 0 && n < yyLast && yyChk[yyAct[n]] == tok { - if len(expected) == cap(expected) { - return res - } - expected = append(expected, tok) - } - } - - if yyDef[state] == -2 { - i := 0 - for yyExca[i] != -1 || yyExca[i+1] != state { - i += 2 - } - - // Look for tokens that we accept or reduce. - for i += 2; yyExca[i] >= 0; i += 2 { - tok := yyExca[i] - if tok < TOKSTART || yyExca[i+1] == 0 { - continue - } - if len(expected) == cap(expected) { - return res - } - expected = append(expected, tok) - } - - // If the default action is to accept or reduce, give up. - if yyExca[i+1] != 0 { - return res - } - } - - for i, tok := range expected { - if i == 0 { - res += ", expecting " - } else { - res += " or " - } - res += yyTokname(tok) - } - return res -} - -func yylex1(lex yyLexer, lval *yySymType) (char, token int) { - token = 0 - char = lex.Lex(lval) - if char <= 0 { - token = yyTok1[0] - goto out - } - if char < len(yyTok1) { - token = yyTok1[char] - goto out - } - if char >= yyPrivate { - if char < yyPrivate+len(yyTok2) { - token = yyTok2[char-yyPrivate] - goto out - } - } - for i := 0; i < len(yyTok3); i += 2 { - token = yyTok3[i+0] - if token == char { - token = yyTok3[i+1] - goto out - } - } - -out: - if token == 0 { - token = yyTok2[1] /* unknown char */ - } - if yyDebug >= 3 { - __yyfmt__.Printf("lex %s(%d)\n", yyTokname(token), uint(char)) - } - return char, token -} - -func yyParse(yylex yyLexer) int { - return yyNewParser().Parse(yylex) -} - -func (yyrcvr *yyParserImpl) Parse(yylex yyLexer) int { - var yyn int - var yyVAL yySymType - var yyDollar []yySymType - _ = yyDollar // silence set and not used - yyS := yyrcvr.stack[:] - - Nerrs := 0 /* number of errors */ - Errflag := 0 /* error recovery flag */ - yystate := 0 - yyrcvr.char = -1 - yytoken := -1 // yyrcvr.char translated into internal numbering - defer func() { - // Make sure we report no lookahead when not parsing. - yystate = -1 - yyrcvr.char = -1 - yytoken = -1 - }() - yyp := -1 - goto yystack - -ret0: - return 0 - -ret1: - return 1 - -yystack: - /* put a state and value onto the stack */ - if yyDebug >= 4 { - __yyfmt__.Printf("char %v in %v\n", yyTokname(yytoken), yyStatname(yystate)) - } - - yyp++ - if yyp >= len(yyS) { - nyys := make([]yySymType, len(yyS)*2) - copy(nyys, yyS) - yyS = nyys - } - yyS[yyp] = yyVAL - yyS[yyp].yys = yystate - -yynewstate: - yyn = yyPact[yystate] - if yyn <= yyFlag { - goto yydefault /* simple state */ - } - if yyrcvr.char < 0 { - yyrcvr.char, yytoken = yylex1(yylex, &yyrcvr.lval) - } - yyn += yytoken - if yyn < 0 || yyn >= yyLast { - goto yydefault - } - yyn = yyAct[yyn] - if yyChk[yyn] == yytoken { /* valid shift */ - yyrcvr.char = -1 - yytoken = -1 - yyVAL = yyrcvr.lval - yystate = yyn - if Errflag > 0 { - Errflag-- - } - goto yystack - } - -yydefault: - /* default state action */ - yyn = yyDef[yystate] - if yyn == -2 { - if yyrcvr.char < 0 { - yyrcvr.char, yytoken = yylex1(yylex, &yyrcvr.lval) - } - - /* look through exception table */ - xi := 0 - for { - if yyExca[xi+0] == -1 && yyExca[xi+1] == yystate { - break - } - xi += 2 - } - for xi += 2; ; xi += 2 { - yyn = yyExca[xi+0] - if yyn < 0 || yyn == yytoken { - break - } - } - yyn = yyExca[xi+1] - if yyn < 0 { - goto ret0 - } - } - if yyn == 0 { - /* error ... attempt to resume parsing */ - switch Errflag { - case 0: /* brand new error */ - yylex.Error(yyErrorMessage(yystate, yytoken)) - Nerrs++ - if yyDebug >= 1 { - __yyfmt__.Printf("%s", yyStatname(yystate)) - __yyfmt__.Printf(" saw %s\n", yyTokname(yytoken)) - } - fallthrough - - case 1, 2: /* incompletely recovered error ... try again */ - Errflag = 3 - - /* find a state where "error" is a legal shift action */ - for yyp >= 0 { - yyn = yyPact[yyS[yyp].yys] + yyErrCode - if yyn >= 0 && yyn < yyLast { - yystate = yyAct[yyn] /* simulate a shift of "error" */ - if yyChk[yystate] == yyErrCode { - goto yystack - } - } - - /* the current p has no shift on "error", pop stack */ - if yyDebug >= 2 { - __yyfmt__.Printf("error recovery pops state %d\n", yyS[yyp].yys) - } - yyp-- - } - /* there is no state on the stack with an error shift ... abort */ - goto ret1 - - case 3: /* no shift yet; clobber input char */ - if yyDebug >= 2 { - __yyfmt__.Printf("error recovery discards %s\n", yyTokname(yytoken)) - } - if yytoken == yyEofCode { - goto ret1 - } - yyrcvr.char = -1 - yytoken = -1 - goto yynewstate /* try again in the same state */ - } - } - - /* reduction by production yyn */ - if yyDebug >= 2 { - __yyfmt__.Printf("reduce %v in:\n\t%v\n", yyn, yyStatname(yystate)) - } - - yynt := yyn - yypt := yyp - _ = yypt // guard against "declared and not used" - - yyp -= yyR2[yyn] - // yyp is now the index of $0. Perform the default action. Iff the - // reduced production is ε, $1 is possibly out of range. - if yyp+1 >= len(yyS) { - nyys := make([]yySymType, len(yyS)*2) - copy(nyys, yyS) - yyS = nyys - } - yyVAL = yyS[yyp+1] - - /* consult goto table to find next state */ - yyn = yyR1[yyn] - yyg := yyPgo[yyn] - yyj := yyg + yyS[yyp].yys + 1 - - if yyj >= yyLast { - yystate = yyAct[yyg] - } else { - yystate = yyAct[yyj] - if yyChk[yystate] != -yyn { - yystate = yyAct[yyg] - } - } - // dummy call; replaced with literal code - switch yynt { - - case 1: - yyDollar = yyS[yypt-1 : yypt+1] - // line internal/php5/php5.y:267 - { - yylex.(*Parser).currentToken.Value = nil - - yylex.(*Parser).rootNode = &ast.Root{ - Position: yylex.(*Parser).builder.NewNodeListPosition(yyDollar[1].list), - Stmts: yyDollar[1].list, - EndTkn: yylex.(*Parser).currentToken, - } - } - case 2: - yyDollar = yyS[yypt-2 : yypt+1] - // line internal/php5/php5.y:280 - { - if yyDollar[2].node != nil { - yyVAL.list = append(yyDollar[1].list, yyDollar[2].node) - } - } - case 3: - yyDollar = yyS[yypt-0 : yypt+1] - // line internal/php5/php5.y:286 - { - yyVAL.list = []ast.Vertex{} - } - case 4: - yyDollar = yyS[yypt-1 : yypt+1] - // line internal/php5/php5.y:293 - { - yyVAL.node = &ParserSeparatedList{ - Items: []ast.Vertex{ - &ast.NamePart{ - Position: yylex.(*Parser).builder.NewTokenPosition(yyDollar[1].token), - StringTkn: yyDollar[1].token, - Value: yyDollar[1].token.Value, - }, - }, - } - } - case 5: - yyDollar = yyS[yypt-3 : yypt+1] - // line internal/php5/php5.y:305 - { - part := &ast.NamePart{ - Position: yylex.(*Parser).builder.NewTokenPosition(yyDollar[3].token), - StringTkn: yyDollar[3].token, - Value: yyDollar[3].token.Value, - } - - yyDollar[1].node.(*ParserSeparatedList).SeparatorTkns = append(yyDollar[1].node.(*ParserSeparatedList).SeparatorTkns, yyDollar[2].token) - yyDollar[1].node.(*ParserSeparatedList).Items = append(yyDollar[1].node.(*ParserSeparatedList).Items, part) - - yyVAL.node = yyDollar[1].node - } - case 6: - yyDollar = yyS[yypt-1 : yypt+1] - // line internal/php5/php5.y:321 - { - // error - yyVAL.node = nil - } - case 7: - yyDollar = yyS[yypt-1 : yypt+1] - // line internal/php5/php5.y:326 - { - yyVAL.node = yyDollar[1].node - } - case 8: - yyDollar = yyS[yypt-1 : yypt+1] - // line internal/php5/php5.y:330 - { - yyVAL.node = yyDollar[1].node - } - case 9: - yyDollar = yyS[yypt-1 : yypt+1] - // line internal/php5/php5.y:334 - { - yyVAL.node = yyDollar[1].node - } - case 10: - yyDollar = yyS[yypt-4 : yypt+1] - // line internal/php5/php5.y:338 - { - yyVAL.node = &ast.StmtHaltCompiler{ - Position: yylex.(*Parser).builder.NewTokensPosition(yyDollar[1].token, yyDollar[4].token), - HaltCompilerTkn: yyDollar[1].token, - OpenParenthesisTkn: yyDollar[2].token, - CloseParenthesisTkn: yyDollar[3].token, - SemiColonTkn: yyDollar[4].token, - } - } - case 11: - yyDollar = yyS[yypt-3 : yypt+1] - // line internal/php5/php5.y:348 - { - yyVAL.node = &ast.StmtNamespace{ - Position: yylex.(*Parser).builder.NewTokensPosition(yyDollar[1].token, yyDollar[3].token), - NsTkn: yyDollar[1].token, - Name: &ast.Name{ - Position: yylex.(*Parser).builder.NewNodeListPosition(yyDollar[2].node.(*ParserSeparatedList).Items), - Parts: yyDollar[2].node.(*ParserSeparatedList).Items, - SeparatorTkns: yyDollar[2].node.(*ParserSeparatedList).SeparatorTkns, - }, - SemiColonTkn: yyDollar[3].token, - } - } - case 12: - yyDollar = yyS[yypt-5 : yypt+1] - // line internal/php5/php5.y:361 - { - yyVAL.node = &ast.StmtNamespace{ - Position: yylex.(*Parser).builder.NewTokensPosition(yyDollar[1].token, yyDollar[5].token), - NsTkn: yyDollar[1].token, - Name: &ast.Name{ - Position: yylex.(*Parser).builder.NewNodeListPosition(yyDollar[2].node.(*ParserSeparatedList).Items), - Parts: yyDollar[2].node.(*ParserSeparatedList).Items, - SeparatorTkns: yyDollar[2].node.(*ParserSeparatedList).SeparatorTkns, - }, - OpenCurlyBracketTkn: yyDollar[3].token, - Stmts: yyDollar[4].list, - CloseCurlyBracketTkn: yyDollar[5].token, - } - } - case 13: - yyDollar = yyS[yypt-4 : yypt+1] - // line internal/php5/php5.y:376 - { - yyVAL.node = &ast.StmtNamespace{ - Position: yylex.(*Parser).builder.NewTokensPosition(yyDollar[1].token, yyDollar[4].token), - NsTkn: yyDollar[1].token, - OpenCurlyBracketTkn: yyDollar[2].token, - Stmts: yyDollar[3].list, - CloseCurlyBracketTkn: yyDollar[4].token, - } - } - case 14: - yyDollar = yyS[yypt-3 : yypt+1] - // line internal/php5/php5.y:386 - { - yyVAL.node = &ast.StmtUseList{ - Position: yylex.(*Parser).builder.NewTokensPosition(yyDollar[1].token, yyDollar[3].token), - UseTkn: yyDollar[1].token, - Uses: yyDollar[2].node.(*ParserSeparatedList).Items, - SeparatorTkns: yyDollar[2].node.(*ParserSeparatedList).SeparatorTkns, - SemiColonTkn: yyDollar[3].token, - } - } - case 15: - yyDollar = yyS[yypt-4 : yypt+1] - // line internal/php5/php5.y:396 - { - yyVAL.node = &ast.StmtUseList{ - Position: yylex.(*Parser).builder.NewTokensPosition(yyDollar[1].token, yyDollar[4].token), - UseTkn: yyDollar[1].token, - Type: &ast.Identifier{ - Position: yylex.(*Parser).builder.NewTokenPosition(yyDollar[2].token), - IdentifierTkn: yyDollar[2].token, - Value: yyDollar[2].token.Value, - }, - Uses: yyDollar[3].node.(*ParserSeparatedList).Items, - SeparatorTkns: yyDollar[3].node.(*ParserSeparatedList).SeparatorTkns, - SemiColonTkn: yyDollar[4].token, - } - } - case 16: - yyDollar = yyS[yypt-4 : yypt+1] - // line internal/php5/php5.y:411 - { - yyVAL.node = &ast.StmtUseList{ - Position: yylex.(*Parser).builder.NewTokensPosition(yyDollar[1].token, yyDollar[4].token), - UseTkn: yyDollar[1].token, - Type: &ast.Identifier{ - Position: yylex.(*Parser).builder.NewTokenPosition(yyDollar[2].token), - IdentifierTkn: yyDollar[2].token, - Value: yyDollar[2].token.Value, - }, - Uses: yyDollar[3].node.(*ParserSeparatedList).Items, - SeparatorTkns: yyDollar[3].node.(*ParserSeparatedList).SeparatorTkns, - SemiColonTkn: yyDollar[4].token, - } - } - case 17: - yyDollar = yyS[yypt-2 : yypt+1] - // line internal/php5/php5.y:426 - { - yyDollar[1].node.(*ast.StmtConstList).SemiColonTkn = yyDollar[2].token - yyDollar[1].node.(*ast.StmtConstList).Position = yylex.(*Parser).builder.NewNodeTokenPosition(yyDollar[1].node, yyDollar[2].token) - yyVAL.node = yyDollar[1].node - } - case 18: - yyDollar = yyS[yypt-3 : yypt+1] - // line internal/php5/php5.y:435 - { - yyDollar[1].node.(*ParserSeparatedList).SeparatorTkns = append(yyDollar[1].node.(*ParserSeparatedList).SeparatorTkns, yyDollar[2].token) - yyDollar[1].node.(*ParserSeparatedList).Items = append(yyDollar[1].node.(*ParserSeparatedList).Items, yyDollar[3].node) - - yyVAL.node = yyDollar[1].node - } - case 19: - yyDollar = yyS[yypt-1 : yypt+1] - // line internal/php5/php5.y:442 - { - yyVAL.node = &ParserSeparatedList{ - Items: []ast.Vertex{yyDollar[1].node}, - } - } - case 20: - yyDollar = yyS[yypt-1 : yypt+1] - // line internal/php5/php5.y:451 - { - yyVAL.node = &ast.StmtUse{ - Position: yylex.(*Parser).builder.NewNodeListPosition(yyDollar[1].node.(*ParserSeparatedList).Items), - Use: &ast.Name{ - Position: yylex.(*Parser).builder.NewNodeListPosition(yyDollar[1].node.(*ParserSeparatedList).Items), - Parts: yyDollar[1].node.(*ParserSeparatedList).Items, - SeparatorTkns: yyDollar[1].node.(*ParserSeparatedList).SeparatorTkns, - }, - } - } - case 21: - yyDollar = yyS[yypt-3 : yypt+1] - // line internal/php5/php5.y:462 - { - yyVAL.node = &ast.StmtUse{ - Position: yylex.(*Parser).builder.NewNodeListTokenPosition(yyDollar[1].node.(*ParserSeparatedList).Items, yyDollar[3].token), - Use: &ast.Name{ - Position: yylex.(*Parser).builder.NewNodeListPosition(yyDollar[1].node.(*ParserSeparatedList).Items), - Parts: yyDollar[1].node.(*ParserSeparatedList).Items, - SeparatorTkns: yyDollar[1].node.(*ParserSeparatedList).SeparatorTkns, - }, - AsTkn: yyDollar[2].token, - Alias: &ast.Identifier{ - Position: yylex.(*Parser).builder.NewTokenPosition(yyDollar[3].token), - IdentifierTkn: yyDollar[3].token, - Value: yyDollar[3].token.Value, - }, - } - } - case 22: - yyDollar = yyS[yypt-2 : yypt+1] - // line internal/php5/php5.y:479 - { - yyVAL.node = &ast.StmtUse{ - Position: yylex.(*Parser).builder.NewTokenNodeListPosition(yyDollar[1].token, yyDollar[2].node.(*ParserSeparatedList).Items), - NsSeparatorTkn: yyDollar[1].token, - Use: &ast.Name{ - Position: yylex.(*Parser).builder.NewNodeListPosition(yyDollar[2].node.(*ParserSeparatedList).Items), - Parts: yyDollar[2].node.(*ParserSeparatedList).Items, - SeparatorTkns: yyDollar[2].node.(*ParserSeparatedList).SeparatorTkns, - }, - } - } - case 23: - yyDollar = yyS[yypt-4 : yypt+1] - // line internal/php5/php5.y:491 - { - yyVAL.node = &ast.StmtUse{ - Position: yylex.(*Parser).builder.NewTokensPosition(yyDollar[1].token, yyDollar[4].token), - NsSeparatorTkn: yyDollar[1].token, - Use: &ast.Name{ - Position: yylex.(*Parser).builder.NewNodeListPosition(yyDollar[2].node.(*ParserSeparatedList).Items), - Parts: yyDollar[2].node.(*ParserSeparatedList).Items, - SeparatorTkns: yyDollar[2].node.(*ParserSeparatedList).SeparatorTkns, - }, - AsTkn: yyDollar[3].token, - Alias: &ast.Identifier{ - Position: yylex.(*Parser).builder.NewTokenPosition(yyDollar[4].token), - IdentifierTkn: yyDollar[4].token, - Value: yyDollar[4].token.Value, - }, - } - } - case 24: - yyDollar = yyS[yypt-3 : yypt+1] - // line internal/php5/php5.y:512 - { - yyDollar[1].node.(*ParserSeparatedList).SeparatorTkns = append(yyDollar[1].node.(*ParserSeparatedList).SeparatorTkns, yyDollar[2].token) - yyDollar[1].node.(*ParserSeparatedList).Items = append(yyDollar[1].node.(*ParserSeparatedList).Items, yyDollar[3].node) - - yyVAL.node = yyDollar[1].node - } - case 25: - yyDollar = yyS[yypt-1 : yypt+1] - // line internal/php5/php5.y:519 - { - yyVAL.node = &ParserSeparatedList{ - Items: []ast.Vertex{yyDollar[1].node}, - } - } - case 26: - yyDollar = yyS[yypt-1 : yypt+1] - // line internal/php5/php5.y:528 - { - yyVAL.node = &ast.StmtUse{ - Position: yylex.(*Parser).builder.NewNodeListPosition(yyDollar[1].node.(*ParserSeparatedList).Items), - Use: &ast.Name{ - Position: yylex.(*Parser).builder.NewNodeListPosition(yyDollar[1].node.(*ParserSeparatedList).Items), - Parts: yyDollar[1].node.(*ParserSeparatedList).Items, - SeparatorTkns: yyDollar[1].node.(*ParserSeparatedList).SeparatorTkns, - }, - } - } - case 27: - yyDollar = yyS[yypt-3 : yypt+1] - // line internal/php5/php5.y:539 - { - yyVAL.node = &ast.StmtUse{ - Position: yylex.(*Parser).builder.NewNodeListTokenPosition(yyDollar[1].node.(*ParserSeparatedList).Items, yyDollar[3].token), - Use: &ast.Name{ - Position: yylex.(*Parser).builder.NewNodeListPosition(yyDollar[1].node.(*ParserSeparatedList).Items), - Parts: yyDollar[1].node.(*ParserSeparatedList).Items, - SeparatorTkns: yyDollar[1].node.(*ParserSeparatedList).SeparatorTkns, - }, - AsTkn: yyDollar[2].token, - Alias: &ast.Identifier{ - Position: yylex.(*Parser).builder.NewTokenPosition(yyDollar[3].token), - IdentifierTkn: yyDollar[3].token, - Value: yyDollar[3].token.Value, - }, - } - } - case 28: - yyDollar = yyS[yypt-2 : yypt+1] - // line internal/php5/php5.y:556 - { - yyVAL.node = &ast.StmtUse{ - Position: yylex.(*Parser).builder.NewTokenNodeListPosition(yyDollar[1].token, yyDollar[2].node.(*ParserSeparatedList).Items), - NsSeparatorTkn: yyDollar[1].token, - Use: &ast.Name{ - Position: yylex.(*Parser).builder.NewNodeListPosition(yyDollar[2].node.(*ParserSeparatedList).Items), - Parts: yyDollar[2].node.(*ParserSeparatedList).Items, - SeparatorTkns: yyDollar[2].node.(*ParserSeparatedList).SeparatorTkns, - }, - } - } - case 29: - yyDollar = yyS[yypt-4 : yypt+1] - // line internal/php5/php5.y:568 - { - yyVAL.node = &ast.StmtUse{ - Position: yylex.(*Parser).builder.NewTokensPosition(yyDollar[1].token, yyDollar[4].token), - NsSeparatorTkn: yyDollar[1].token, - Use: &ast.Name{ - Position: yylex.(*Parser).builder.NewNodeListPosition(yyDollar[2].node.(*ParserSeparatedList).Items), - Parts: yyDollar[2].node.(*ParserSeparatedList).Items, - SeparatorTkns: yyDollar[2].node.(*ParserSeparatedList).SeparatorTkns, - }, - AsTkn: yyDollar[3].token, - Alias: &ast.Identifier{ - Position: yylex.(*Parser).builder.NewTokenPosition(yyDollar[4].token), - IdentifierTkn: yyDollar[4].token, - Value: yyDollar[4].token.Value, - }, - } - } - case 30: - yyDollar = yyS[yypt-3 : yypt+1] - // line internal/php5/php5.y:589 - { - yyDollar[1].node.(*ParserSeparatedList).SeparatorTkns = append(yyDollar[1].node.(*ParserSeparatedList).SeparatorTkns, yyDollar[2].token) - yyDollar[1].node.(*ParserSeparatedList).Items = append(yyDollar[1].node.(*ParserSeparatedList).Items, yyDollar[3].node) - - yyVAL.node = yyDollar[1].node - } - case 31: - yyDollar = yyS[yypt-1 : yypt+1] - // line internal/php5/php5.y:596 - { - yyVAL.node = &ParserSeparatedList{ - Items: []ast.Vertex{yyDollar[1].node}, - } - } - case 32: - yyDollar = yyS[yypt-1 : yypt+1] - // line internal/php5/php5.y:605 - { - yyVAL.node = &ast.StmtUse{ - Position: yylex.(*Parser).builder.NewNodeListPosition(yyDollar[1].node.(*ParserSeparatedList).Items), - Use: &ast.Name{ - Position: yylex.(*Parser).builder.NewNodeListPosition(yyDollar[1].node.(*ParserSeparatedList).Items), - Parts: yyDollar[1].node.(*ParserSeparatedList).Items, - SeparatorTkns: yyDollar[1].node.(*ParserSeparatedList).SeparatorTkns, - }, - } - } - case 33: - yyDollar = yyS[yypt-3 : yypt+1] - // line internal/php5/php5.y:616 - { - yyVAL.node = &ast.StmtUse{ - Position: yylex.(*Parser).builder.NewNodeListTokenPosition(yyDollar[1].node.(*ParserSeparatedList).Items, yyDollar[3].token), - Use: &ast.Name{ - Position: yylex.(*Parser).builder.NewNodeListPosition(yyDollar[1].node.(*ParserSeparatedList).Items), - Parts: yyDollar[1].node.(*ParserSeparatedList).Items, - SeparatorTkns: yyDollar[1].node.(*ParserSeparatedList).SeparatorTkns, - }, - AsTkn: yyDollar[2].token, - Alias: &ast.Identifier{ - Position: yylex.(*Parser).builder.NewTokenPosition(yyDollar[3].token), - IdentifierTkn: yyDollar[3].token, - Value: yyDollar[3].token.Value, - }, - } - } - case 34: - yyDollar = yyS[yypt-2 : yypt+1] - // line internal/php5/php5.y:633 - { - yyVAL.node = &ast.StmtUse{ - Position: yylex.(*Parser).builder.NewTokenNodeListPosition(yyDollar[1].token, yyDollar[2].node.(*ParserSeparatedList).Items), - NsSeparatorTkn: yyDollar[1].token, - Use: &ast.Name{ - Position: yylex.(*Parser).builder.NewNodeListPosition(yyDollar[2].node.(*ParserSeparatedList).Items), - Parts: yyDollar[2].node.(*ParserSeparatedList).Items, - SeparatorTkns: yyDollar[2].node.(*ParserSeparatedList).SeparatorTkns, - }, - } - } - case 35: - yyDollar = yyS[yypt-4 : yypt+1] - // line internal/php5/php5.y:645 - { - yyVAL.node = &ast.StmtUse{ - Position: yylex.(*Parser).builder.NewTokensPosition(yyDollar[1].token, yyDollar[4].token), - NsSeparatorTkn: yyDollar[1].token, - Use: &ast.Name{ - Position: yylex.(*Parser).builder.NewNodeListPosition(yyDollar[2].node.(*ParserSeparatedList).Items), - Parts: yyDollar[2].node.(*ParserSeparatedList).Items, - SeparatorTkns: yyDollar[2].node.(*ParserSeparatedList).SeparatorTkns, - }, - AsTkn: yyDollar[3].token, - Alias: &ast.Identifier{ - Position: yylex.(*Parser).builder.NewTokenPosition(yyDollar[4].token), - IdentifierTkn: yyDollar[4].token, - Value: yyDollar[4].token.Value, - }, - } - } - case 36: - yyDollar = yyS[yypt-5 : yypt+1] - // line internal/php5/php5.y:666 - { - constList := yyDollar[1].node.(*ast.StmtConstList) - constList.Position = yylex.(*Parser).builder.NewNodesPosition(yyDollar[1].node, yyDollar[5].node) - constList.SeparatorTkns = append(constList.SeparatorTkns, yyDollar[2].token) - constList.Consts = append(constList.Consts, &ast.StmtConstant{ - Position: yylex.(*Parser).builder.NewTokenNodePosition(yyDollar[3].token, yyDollar[5].node), - Name: &ast.Identifier{ - Position: yylex.(*Parser).builder.NewTokenPosition(yyDollar[3].token), - IdentifierTkn: yyDollar[3].token, - Value: yyDollar[3].token.Value, - }, - EqualTkn: yyDollar[4].token, - Expr: yyDollar[5].node, - }) - - yyVAL.node = yyDollar[1].node - } - case 37: - yyDollar = yyS[yypt-4 : yypt+1] - // line internal/php5/php5.y:684 - { - yyVAL.node = &ast.StmtConstList{ - Position: yylex.(*Parser).builder.NewTokenNodePosition(yyDollar[1].token, yyDollar[4].node), - ConstTkn: yyDollar[1].token, - Consts: []ast.Vertex{ - &ast.StmtConstant{ - Position: yylex.(*Parser).builder.NewTokenNodePosition(yyDollar[2].token, yyDollar[4].node), - Name: &ast.Identifier{ - Position: yylex.(*Parser).builder.NewTokenPosition(yyDollar[2].token), - IdentifierTkn: yyDollar[2].token, - Value: yyDollar[2].token.Value, - }, - EqualTkn: yyDollar[3].token, - Expr: yyDollar[4].node, - }, - }, - } - } - case 38: - yyDollar = yyS[yypt-2 : yypt+1] - // line internal/php5/php5.y:706 - { - if yyDollar[2].node != nil { - yyVAL.list = append(yyDollar[1].list, yyDollar[2].node) - } - } - case 39: - yyDollar = yyS[yypt-0 : yypt+1] - // line internal/php5/php5.y:712 - { - yyVAL.list = []ast.Vertex{} - } - case 40: - yyDollar = yyS[yypt-1 : yypt+1] - // line internal/php5/php5.y:720 - { - // error - yyVAL.node = nil - } - case 41: - yyDollar = yyS[yypt-1 : yypt+1] - // line internal/php5/php5.y:725 - { - yyVAL.node = yyDollar[1].node - } - case 42: - yyDollar = yyS[yypt-1 : yypt+1] - // line internal/php5/php5.y:729 - { - yyVAL.node = yyDollar[1].node - } - case 43: - yyDollar = yyS[yypt-1 : yypt+1] - // line internal/php5/php5.y:733 - { - yyVAL.node = yyDollar[1].node - } - case 44: - yyDollar = yyS[yypt-4 : yypt+1] - // line internal/php5/php5.y:737 - { - yyVAL.node = &ast.StmtHaltCompiler{ - Position: yylex.(*Parser).builder.NewTokensPosition(yyDollar[1].token, yyDollar[4].token), - HaltCompilerTkn: yyDollar[1].token, - OpenParenthesisTkn: yyDollar[2].token, - CloseParenthesisTkn: yyDollar[3].token, - SemiColonTkn: yyDollar[4].token, - } - } - case 45: - yyDollar = yyS[yypt-1 : yypt+1] - // line internal/php5/php5.y:751 - { - yyVAL.node = yyDollar[1].node - } - case 46: - yyDollar = yyS[yypt-2 : yypt+1] - // line internal/php5/php5.y:755 - { - yyVAL.node = &ast.StmtLabel{ - Position: yylex.(*Parser).builder.NewTokensPosition(yyDollar[1].token, yyDollar[2].token), - Name: &ast.Identifier{ - Position: yylex.(*Parser).builder.NewTokenPosition(yyDollar[1].token), - IdentifierTkn: yyDollar[1].token, - Value: yyDollar[1].token.Value, - }, - ColonTkn: yyDollar[2].token, - } - } - case 47: - yyDollar = yyS[yypt-3 : yypt+1] - // line internal/php5/php5.y:770 - { - yyVAL.node = &ast.StmtStmtList{ - Position: yylex.(*Parser).builder.NewTokensPosition(yyDollar[1].token, yyDollar[3].token), - OpenCurlyBracketTkn: yyDollar[1].token, - Stmts: yyDollar[2].list, - CloseCurlyBracketTkn: yyDollar[3].token, - } - } - case 48: - yyDollar = yyS[yypt-5 : yypt+1] - // line internal/php5/php5.y:779 - { - pos := yylex.(*Parser).builder.NewTokenNodePosition(yyDollar[1].token, yyDollar[3].node) - if yyDollar[5].node != nil { - pos = yylex.(*Parser).builder.NewTokenNodePosition(yyDollar[1].token, yyDollar[5].node) - } else if len(yyDollar[4].list) > 0 { - pos = yylex.(*Parser).builder.NewTokenNodeListPosition(yyDollar[1].token, yyDollar[4].list) - } - - yyVAL.node = &ast.StmtIf{ - Position: pos, - IfTkn: yyDollar[1].token, - OpenParenthesisTkn: yyDollar[2].node.(*ast.ExprBrackets).OpenParenthesisTkn, - Cond: yyDollar[2].node.(*ast.ExprBrackets).Expr, - CloseParenthesisTkn: yyDollar[2].node.(*ast.ExprBrackets).CloseParenthesisTkn, - Stmt: yyDollar[3].node, - ElseIf: yyDollar[4].list, - Else: yyDollar[5].node, - } - } - case 49: - yyDollar = yyS[yypt-8 : yypt+1] - // line internal/php5/php5.y:799 - { - yyVAL.node = &ast.StmtIf{ - Position: yylex.(*Parser).builder.NewTokensPosition(yyDollar[1].token, yyDollar[8].token), - IfTkn: yyDollar[1].token, - OpenParenthesisTkn: yyDollar[2].node.(*ast.ExprBrackets).OpenParenthesisTkn, - Cond: yyDollar[2].node.(*ast.ExprBrackets).Expr, - CloseParenthesisTkn: yyDollar[2].node.(*ast.ExprBrackets).CloseParenthesisTkn, - ColonTkn: yyDollar[3].token, - Stmt: &ast.StmtStmtList{ - Position: yylex.(*Parser).builder.NewNodeListPosition(yyDollar[4].list), - Stmts: yyDollar[4].list, - }, - ElseIf: yyDollar[5].list, - Else: yyDollar[6].node, - EndIfTkn: yyDollar[7].token, - SemiColonTkn: yyDollar[8].token, - } - } - case 50: - yyDollar = yyS[yypt-3 : yypt+1] - // line internal/php5/php5.y:818 - { - yyDollar[3].node.(*ast.StmtWhile).WhileTkn = yyDollar[1].token - yyDollar[3].node.(*ast.StmtWhile).OpenParenthesisTkn = yyDollar[2].node.(*ast.ExprBrackets).OpenParenthesisTkn - yyDollar[3].node.(*ast.StmtWhile).Cond = yyDollar[2].node.(*ast.ExprBrackets).Expr - yyDollar[3].node.(*ast.StmtWhile).CloseParenthesisTkn = yyDollar[2].node.(*ast.ExprBrackets).CloseParenthesisTkn - yyDollar[3].node.(*ast.StmtWhile).Position = yylex.(*Parser).builder.NewTokenNodePosition(yyDollar[1].token, yyDollar[3].node) - - yyVAL.node = yyDollar[3].node - } - case 51: - yyDollar = yyS[yypt-5 : yypt+1] - // line internal/php5/php5.y:828 - { - yyVAL.node = &ast.StmtDo{ - Position: yylex.(*Parser).builder.NewTokensPosition(yyDollar[1].token, yyDollar[5].token), - DoTkn: yyDollar[1].token, - Stmt: yyDollar[2].node, - WhileTkn: yyDollar[3].token, - OpenParenthesisTkn: yyDollar[4].node.(*ast.ExprBrackets).OpenParenthesisTkn, - Cond: yyDollar[4].node.(*ast.ExprBrackets).Expr, - CloseParenthesisTkn: yyDollar[4].node.(*ast.ExprBrackets).CloseParenthesisTkn, - SemiColonTkn: yyDollar[5].token, - } - } - case 52: - yyDollar = yyS[yypt-9 : yypt+1] - // line internal/php5/php5.y:841 - { - yyDollar[9].node.(*ast.StmtFor).ForTkn = yyDollar[1].token - yyDollar[9].node.(*ast.StmtFor).OpenParenthesisTkn = yyDollar[2].token - yyDollar[9].node.(*ast.StmtFor).Init = yyDollar[3].node.(*ParserSeparatedList).Items - yyDollar[9].node.(*ast.StmtFor).InitSeparatorTkns = yyDollar[3].node.(*ParserSeparatedList).SeparatorTkns - yyDollar[9].node.(*ast.StmtFor).InitSemiColonTkn = yyDollar[4].token - yyDollar[9].node.(*ast.StmtFor).Cond = yyDollar[5].node.(*ParserSeparatedList).Items - yyDollar[9].node.(*ast.StmtFor).CondSeparatorTkns = yyDollar[5].node.(*ParserSeparatedList).SeparatorTkns - yyDollar[9].node.(*ast.StmtFor).CondSemiColonTkn = yyDollar[6].token - yyDollar[9].node.(*ast.StmtFor).Loop = yyDollar[7].node.(*ParserSeparatedList).Items - yyDollar[9].node.(*ast.StmtFor).LoopSeparatorTkns = yyDollar[7].node.(*ParserSeparatedList).SeparatorTkns - yyDollar[9].node.(*ast.StmtFor).CloseParenthesisTkn = yyDollar[8].token - yyDollar[9].node.(*ast.StmtFor).Position = yylex.(*Parser).builder.NewTokenNodePosition(yyDollar[1].token, yyDollar[9].node) - - yyVAL.node = yyDollar[9].node - } - case 53: - yyDollar = yyS[yypt-3 : yypt+1] - // line internal/php5/php5.y:858 - { - yyDollar[3].node.(*ast.StmtSwitch).SwitchTkn = yyDollar[1].token - yyDollar[3].node.(*ast.StmtSwitch).OpenParenthesisTkn = yyDollar[2].node.(*ast.ExprBrackets).OpenParenthesisTkn - yyDollar[3].node.(*ast.StmtSwitch).Cond = yyDollar[2].node.(*ast.ExprBrackets).Expr - yyDollar[3].node.(*ast.StmtSwitch).CloseParenthesisTkn = yyDollar[2].node.(*ast.ExprBrackets).CloseParenthesisTkn - yyDollar[3].node.(*ast.StmtSwitch).Position = yylex.(*Parser).builder.NewTokenNodePosition(yyDollar[1].token, yyDollar[3].node) - - yyVAL.node = yyDollar[3].node - } - case 54: - yyDollar = yyS[yypt-2 : yypt+1] - // line internal/php5/php5.y:868 - { - yyVAL.node = &ast.StmtBreak{ - Position: yylex.(*Parser).builder.NewTokensPosition(yyDollar[1].token, yyDollar[2].token), - BreakTkn: yyDollar[1].token, - SemiColonTkn: yyDollar[2].token, - } - } - case 55: - yyDollar = yyS[yypt-3 : yypt+1] - // line internal/php5/php5.y:876 - { - yyVAL.node = &ast.StmtBreak{ - Position: yylex.(*Parser).builder.NewTokensPosition(yyDollar[1].token, yyDollar[3].token), - BreakTkn: yyDollar[1].token, - Expr: yyDollar[2].node, - SemiColonTkn: yyDollar[3].token, - } - } - case 56: - yyDollar = yyS[yypt-2 : yypt+1] - // line internal/php5/php5.y:885 - { - yyVAL.node = &ast.StmtContinue{ - Position: yylex.(*Parser).builder.NewTokensPosition(yyDollar[1].token, yyDollar[2].token), - ContinueTkn: yyDollar[1].token, - SemiColonTkn: yyDollar[2].token, - } - } - case 57: - yyDollar = yyS[yypt-3 : yypt+1] - // line internal/php5/php5.y:893 - { - yyVAL.node = &ast.StmtContinue{ - Position: yylex.(*Parser).builder.NewTokensPosition(yyDollar[1].token, yyDollar[3].token), - ContinueTkn: yyDollar[1].token, - Expr: yyDollar[2].node, - SemiColonTkn: yyDollar[3].token, - } - } - case 58: - yyDollar = yyS[yypt-2 : yypt+1] - // line internal/php5/php5.y:902 - { - yyVAL.node = &ast.StmtReturn{ - Position: yylex.(*Parser).builder.NewTokensPosition(yyDollar[1].token, yyDollar[2].token), - ReturnTkn: yyDollar[1].token, - SemiColonTkn: yyDollar[2].token, - } - } - case 59: - yyDollar = yyS[yypt-3 : yypt+1] - // line internal/php5/php5.y:910 - { - yyVAL.node = &ast.StmtReturn{ - Position: yylex.(*Parser).builder.NewTokensPosition(yyDollar[1].token, yyDollar[3].token), - ReturnTkn: yyDollar[1].token, - Expr: yyDollar[2].node, - SemiColonTkn: yyDollar[3].token, - } - } - case 60: - yyDollar = yyS[yypt-3 : yypt+1] - // line internal/php5/php5.y:919 - { - yyVAL.node = &ast.StmtReturn{ - Position: yylex.(*Parser).builder.NewTokensPosition(yyDollar[1].token, yyDollar[3].token), - ReturnTkn: yyDollar[1].token, - Expr: yyDollar[2].node, - SemiColonTkn: yyDollar[3].token, - } - } - case 61: - yyDollar = yyS[yypt-2 : yypt+1] - // line internal/php5/php5.y:928 - { - yyVAL.node = &ast.StmtExpression{ - Position: yylex.(*Parser).builder.NewNodeTokenPosition(yyDollar[1].node, yyDollar[2].token), - Expr: yyDollar[1].node, - SemiColonTkn: yyDollar[2].token, - } - } - case 62: - yyDollar = yyS[yypt-3 : yypt+1] - // line internal/php5/php5.y:936 - { - yyDollar[2].node.(*ast.StmtGlobal).GlobalTkn = yyDollar[1].token - yyDollar[2].node.(*ast.StmtGlobal).SemiColonTkn = yyDollar[3].token - yyDollar[2].node.(*ast.StmtGlobal).Position = yylex.(*Parser).builder.NewTokensPosition(yyDollar[1].token, yyDollar[3].token) - - yyVAL.node = yyDollar[2].node - } - case 63: - yyDollar = yyS[yypt-3 : yypt+1] - // line internal/php5/php5.y:944 - { - yyDollar[2].node.(*ast.StmtStatic).StaticTkn = yyDollar[1].token - yyDollar[2].node.(*ast.StmtStatic).SemiColonTkn = yyDollar[3].token - yyDollar[2].node.(*ast.StmtStatic).Position = yylex.(*Parser).builder.NewTokensPosition(yyDollar[1].token, yyDollar[3].token) - - yyVAL.node = yyDollar[2].node - } - case 64: - yyDollar = yyS[yypt-3 : yypt+1] - // line internal/php5/php5.y:952 - { - yyDollar[2].node.(*ast.StmtEcho).EchoTkn = yyDollar[1].token - yyDollar[2].node.(*ast.StmtEcho).SemiColonTkn = yyDollar[3].token - yyDollar[2].node.(*ast.StmtEcho).Position = yylex.(*Parser).builder.NewTokensPosition(yyDollar[1].token, yyDollar[3].token) - - yyVAL.node = yyDollar[2].node - } - case 65: - yyDollar = yyS[yypt-1 : yypt+1] - // line internal/php5/php5.y:960 - { - yyVAL.node = &ast.StmtInlineHtml{ - Position: yylex.(*Parser).builder.NewTokenPosition(yyDollar[1].token), - InlineHtmlTkn: yyDollar[1].token, - Value: yyDollar[1].token.Value, - } - } - case 66: - yyDollar = yyS[yypt-2 : yypt+1] - // line internal/php5/php5.y:968 - { - yyVAL.node = &ast.StmtExpression{ - Position: yylex.(*Parser).builder.NewNodeTokenPosition(yyDollar[1].node, yyDollar[2].token), - Expr: yyDollar[1].node, - SemiColonTkn: yyDollar[2].token, - } - } - case 67: - yyDollar = yyS[yypt-5 : yypt+1] - // line internal/php5/php5.y:976 - { - yyDollar[3].node.(*ast.StmtUnset).UnsetTkn = yyDollar[1].token - yyDollar[3].node.(*ast.StmtUnset).OpenParenthesisTkn = yyDollar[2].token - yyDollar[3].node.(*ast.StmtUnset).CloseParenthesisTkn = yyDollar[4].token - yyDollar[3].node.(*ast.StmtUnset).SemiColonTkn = yyDollar[5].token - yyDollar[3].node.(*ast.StmtUnset).Position = yylex.(*Parser).builder.NewTokensPosition(yyDollar[1].token, yyDollar[5].token) - - yyVAL.node = yyDollar[3].node - } - case 68: - yyDollar = yyS[yypt-8 : yypt+1] - // line internal/php5/php5.y:986 - { - foreach := yyDollar[8].node.(*ast.StmtForeach) - - foreach.Position = yylex.(*Parser).builder.NewTokenNodePosition(yyDollar[1].token, yyDollar[8].node) - foreach.ForeachTkn = yyDollar[1].token - foreach.OpenParenthesisTkn = yyDollar[2].token - foreach.Expr = yyDollar[3].node - foreach.AsTkn = yyDollar[4].token - foreach.Var = yyDollar[5].node - foreach.CloseParenthesisTkn = yyDollar[7].token - - if yyDollar[6].node != nil { - foreach.Key = foreach.Var - foreach.DoubleArrowTkn = yyDollar[6].node.(*ast.StmtForeach).DoubleArrowTkn - foreach.Var = yyDollar[6].node.(*ast.StmtForeach).Var - } - - if val, ok := foreach.Key.(*ast.StmtForeach); ok { - yylex.(*Parser).errHandlerFunc(errors.NewError("Key element cannot be a reference", val.AmpersandTkn.Position)) - foreach.Key = val.Var - } - - if val, ok := foreach.Var.(*ast.StmtForeach); ok { - foreach.AmpersandTkn = val.AmpersandTkn - foreach.Var = val.Var - } - - yyVAL.node = foreach - } - case 69: - yyDollar = yyS[yypt-8 : yypt+1] - // line internal/php5/php5.y:1016 - { - foreach := yyDollar[8].node.(*ast.StmtForeach) - - foreach.Position = yylex.(*Parser).builder.NewTokenNodePosition(yyDollar[1].token, yyDollar[8].node) - foreach.ForeachTkn = yyDollar[1].token - foreach.OpenParenthesisTkn = yyDollar[2].token - foreach.Expr = yyDollar[3].node - foreach.AsTkn = yyDollar[4].token - foreach.Var = yyDollar[5].node - foreach.CloseParenthesisTkn = yyDollar[7].token - - if yyDollar[6].node != nil { - foreach.Key = foreach.Var - foreach.DoubleArrowTkn = yyDollar[6].node.(*ast.StmtForeach).DoubleArrowTkn - foreach.Var = yyDollar[6].node.(*ast.StmtForeach).Var - } - - if val, ok := foreach.Key.(*ast.StmtForeach); ok { - yylex.(*Parser).errHandlerFunc(errors.NewError("Key element cannot be a reference", val.AmpersandTkn.Position)) - foreach.Key = val.Var - } - - if val, ok := foreach.Var.(*ast.StmtForeach); ok { - foreach.AmpersandTkn = val.AmpersandTkn - foreach.Var = val.Var - } - - yyVAL.node = foreach - } - case 70: - yyDollar = yyS[yypt-5 : yypt+1] - // line internal/php5/php5.y:1046 - { - yyDollar[5].node.(*ast.StmtDeclare).DeclareTkn = yyDollar[1].token - yyDollar[5].node.(*ast.StmtDeclare).OpenParenthesisTkn = yyDollar[2].token - yyDollar[5].node.(*ast.StmtDeclare).Consts = yyDollar[3].node.(*ParserSeparatedList).Items - yyDollar[5].node.(*ast.StmtDeclare).SeparatorTkns = yyDollar[3].node.(*ParserSeparatedList).SeparatorTkns - yyDollar[5].node.(*ast.StmtDeclare).CloseParenthesisTkn = yyDollar[4].token - yyDollar[5].node.(*ast.StmtDeclare).Position = yylex.(*Parser).builder.NewTokenNodePosition(yyDollar[1].token, yyDollar[5].node) - - yyVAL.node = yyDollar[5].node - } - case 71: - yyDollar = yyS[yypt-1 : yypt+1] - // line internal/php5/php5.y:1057 - { - yyVAL.node = &ast.StmtNop{ - Position: yylex.(*Parser).builder.NewTokenPosition(yyDollar[1].token), - SemiColonTkn: yyDollar[1].token, - } - } - case 72: - yyDollar = yyS[yypt-6 : yypt+1] - // line internal/php5/php5.y:1064 - { - pos := yylex.(*Parser).builder.NewTokenNodeListPosition(yyDollar[1].token, yyDollar[5].list) - if yyDollar[6].node != nil { - pos = yylex.(*Parser).builder.NewTokenNodePosition(yyDollar[1].token, yyDollar[6].node) - } - - yyVAL.node = &ast.StmtTry{ - Position: pos, - TryTkn: yyDollar[1].token, - OpenCurlyBracketTkn: yyDollar[2].token, - Stmts: yyDollar[3].list, - CloseCurlyBracketTkn: yyDollar[4].token, - Catches: yyDollar[5].list, - Finally: yyDollar[6].node, - } - } - case 73: - yyDollar = yyS[yypt-3 : yypt+1] - // line internal/php5/php5.y:1081 - { - yyVAL.node = &ast.StmtThrow{ - Position: yylex.(*Parser).builder.NewTokensPosition(yyDollar[1].token, yyDollar[3].token), - ThrowTkn: yyDollar[1].token, - Expr: yyDollar[2].node, - SemiColonTkn: yyDollar[3].token, - } - } - case 74: - yyDollar = yyS[yypt-3 : yypt+1] - // line internal/php5/php5.y:1090 - { - yyVAL.node = &ast.StmtGoto{ - Position: yylex.(*Parser).builder.NewTokensPosition(yyDollar[1].token, yyDollar[3].token), - GotoTkn: yyDollar[1].token, - Label: &ast.Identifier{ - Position: yylex.(*Parser).builder.NewTokenPosition(yyDollar[1].token), - IdentifierTkn: yyDollar[2].token, - Value: yyDollar[2].token.Value, - }, - SemiColonTkn: yyDollar[3].token, - } - } - case 75: - yyDollar = yyS[yypt-0 : yypt+1] - // line internal/php5/php5.y:1106 - { - yyVAL.list = []ast.Vertex{} - } - case 76: - yyDollar = yyS[yypt-9 : yypt+1] - // line internal/php5/php5.y:1110 - { - catch := &ast.StmtCatch{ - Position: yylex.(*Parser).builder.NewTokensPosition(yyDollar[1].token, yyDollar[8].token), - CatchTkn: yyDollar[1].token, - OpenParenthesisTkn: yyDollar[2].token, - Types: []ast.Vertex{yyDollar[3].node}, - Var: &ast.ExprVariable{ - Position: yylex.(*Parser).builder.NewTokenPosition(yyDollar[4].token), - Name: &ast.Identifier{ - Position: yylex.(*Parser).builder.NewTokenPosition(yyDollar[4].token), - IdentifierTkn: yyDollar[4].token, - Value: yyDollar[4].token.Value, - }, - }, - CloseParenthesisTkn: yyDollar[5].token, - OpenCurlyBracketTkn: yyDollar[6].token, - Stmts: yyDollar[7].list, - CloseCurlyBracketTkn: yyDollar[8].token, - } - yyVAL.list = append([]ast.Vertex{catch}, yyDollar[9].list...) - } - case 77: - yyDollar = yyS[yypt-0 : yypt+1] - // line internal/php5/php5.y:1135 - { - yyVAL.node = nil - } - case 78: - yyDollar = yyS[yypt-4 : yypt+1] - // line internal/php5/php5.y:1139 - { - yyVAL.node = &ast.StmtFinally{ - Position: yylex.(*Parser).builder.NewTokensPosition(yyDollar[1].token, yyDollar[4].token), - FinallyTkn: yyDollar[1].token, - OpenCurlyBracketTkn: yyDollar[2].token, - Stmts: yyDollar[3].list, - CloseCurlyBracketTkn: yyDollar[4].token, - } - } - case 79: - yyDollar = yyS[yypt-1 : yypt+1] - // line internal/php5/php5.y:1152 - { - yyVAL.list = yyDollar[1].list - } - case 80: - yyDollar = yyS[yypt-0 : yypt+1] - // line internal/php5/php5.y:1156 - { - yyVAL.list = []ast.Vertex{} - } - case 81: - yyDollar = yyS[yypt-1 : yypt+1] - // line internal/php5/php5.y:1163 - { - yyVAL.list = []ast.Vertex{yyDollar[1].node} - } - case 82: - yyDollar = yyS[yypt-2 : yypt+1] - // line internal/php5/php5.y:1167 - { - yyVAL.list = append(yyDollar[1].list, yyDollar[2].node) - } - case 83: - yyDollar = yyS[yypt-8 : yypt+1] - // line internal/php5/php5.y:1174 - { - yyVAL.node = &ast.StmtCatch{ - Position: yylex.(*Parser).builder.NewTokensPosition(yyDollar[1].token, yyDollar[8].token), - CatchTkn: yyDollar[1].token, - OpenParenthesisTkn: yyDollar[2].token, - Types: []ast.Vertex{yyDollar[3].node}, - Var: &ast.ExprVariable{ - Position: yylex.(*Parser).builder.NewTokenPosition(yyDollar[4].token), - Name: &ast.Identifier{ - Position: yylex.(*Parser).builder.NewTokenPosition(yyDollar[4].token), - IdentifierTkn: yyDollar[4].token, - Value: yyDollar[4].token.Value, - }, - }, - CloseParenthesisTkn: yyDollar[5].token, - OpenCurlyBracketTkn: yyDollar[6].token, - Stmts: yyDollar[7].list, - CloseCurlyBracketTkn: yyDollar[8].token, - } - } - case 84: - yyDollar = yyS[yypt-1 : yypt+1] - // line internal/php5/php5.y:1198 - { - yyVAL.node = &ast.StmtUnset{ - Vars: []ast.Vertex{yyDollar[1].node}, - } - } - case 85: - yyDollar = yyS[yypt-3 : yypt+1] - // line internal/php5/php5.y:1204 - { - yyDollar[1].node.(*ast.StmtUnset).Vars = append(yyDollar[1].node.(*ast.StmtUnset).Vars, yyDollar[3].node) - yyDollar[1].node.(*ast.StmtUnset).SeparatorTkns = append(yyDollar[1].node.(*ast.StmtUnset).SeparatorTkns, yyDollar[2].token) - - yyVAL.node = yyDollar[1].node - } - case 86: - yyDollar = yyS[yypt-1 : yypt+1] - // line internal/php5/php5.y:1214 - { - yyVAL.node = yyDollar[1].node - } - case 87: - yyDollar = yyS[yypt-1 : yypt+1] - // line internal/php5/php5.y:1221 - { - yyVAL.node = yyDollar[1].node - } - case 88: - yyDollar = yyS[yypt-1 : yypt+1] - // line internal/php5/php5.y:1228 - { - yyVAL.node = yyDollar[1].node - } - case 89: - yyDollar = yyS[yypt-0 : yypt+1] - // line internal/php5/php5.y:1235 - { - yyVAL.token = nil - } - case 90: - yyDollar = yyS[yypt-1 : yypt+1] - // line internal/php5/php5.y:1239 - { - yyVAL.token = yyDollar[1].token - } - case 91: - yyDollar = yyS[yypt-0 : yypt+1] - // line internal/php5/php5.y:1246 - { - yyVAL.token = nil - } - case 92: - yyDollar = yyS[yypt-1 : yypt+1] - // line internal/php5/php5.y:1250 - { - yyVAL.token = yyDollar[1].token - } - case 93: - yyDollar = yyS[yypt-9 : yypt+1] - // line internal/php5/php5.y:1257 - { - yyVAL.node = &ast.StmtFunction{ - Position: yylex.(*Parser).builder.NewTokensPosition(yyDollar[1].token, yyDollar[9].token), - FunctionTkn: yyDollar[1].token, - AmpersandTkn: yyDollar[2].token, - Name: &ast.Identifier{ - Position: yylex.(*Parser).builder.NewTokenPosition(yyDollar[3].token), - IdentifierTkn: yyDollar[3].token, - Value: yyDollar[3].token.Value, - }, - OpenParenthesisTkn: yyDollar[4].token, - Params: yyDollar[5].node.(*ParserSeparatedList).Items, - SeparatorTkns: yyDollar[5].node.(*ParserSeparatedList).SeparatorTkns, - CloseParenthesisTkn: yyDollar[6].token, - OpenCurlyBracketTkn: yyDollar[7].token, - Stmts: yyDollar[8].list, - CloseCurlyBracketTkn: yyDollar[9].token, - } - } - case 94: - yyDollar = yyS[yypt-7 : yypt+1] - // line internal/php5/php5.y:1280 - { - switch n := yyDollar[1].node.(type) { - case *ast.StmtClass: - className := &ast.Identifier{ - Position: yylex.(*Parser).builder.NewTokenPosition(yyDollar[2].token), - IdentifierTkn: yyDollar[2].token, - Value: yyDollar[2].token.Value, - } - - n.Position = yylex.(*Parser).builder.NewNodeTokenPosition(yyDollar[1].node, yyDollar[7].token) - n.Name = className - n.OpenCurlyBracketTkn = yyDollar[5].token - n.Stmts = yyDollar[6].list - n.CloseCurlyBracketTkn = yyDollar[7].token - - if yyDollar[3].node != nil { - n.ExtendsTkn = yyDollar[3].node.(*ast.StmtClass).ExtendsTkn - n.Extends = yyDollar[3].node.(*ast.StmtClass).Extends - } - - if yyDollar[4].node != nil { - n.ImplementsTkn = yyDollar[4].node.(*ast.StmtClass).ImplementsTkn - n.Implements = yyDollar[4].node.(*ast.StmtClass).Implements - n.ImplementsSeparatorTkns = yyDollar[4].node.(*ast.StmtClass).ImplementsSeparatorTkns - } - case *ast.StmtTrait: - traitName := &ast.Identifier{ - Position: yylex.(*Parser).builder.NewTokenPosition(yyDollar[2].token), - IdentifierTkn: yyDollar[2].token, - Value: yyDollar[2].token.Value, - } - - n.Position = yylex.(*Parser).builder.NewNodeTokenPosition(yyDollar[1].node, yyDollar[7].token) - n.Name = traitName - n.OpenCurlyBracketTkn = yyDollar[5].token - n.Stmts = yyDollar[6].list - n.CloseCurlyBracketTkn = yyDollar[7].token - - if yyDollar[3].node != nil { - yylex.(*Parser).errHandlerFunc(errors.NewError("A trait cannot extend a class. Traits can only be composed from other traits with the 'use' keyword", yyDollar[3].node.(*ast.StmtClass).Position)) - } - - if yyDollar[4].node != nil { - yylex.(*Parser).errHandlerFunc(errors.NewError("A trait cannot implement an interface", yyDollar[4].node.(*ast.StmtClass).Position)) - } - } - - yyVAL.node = yyDollar[1].node - } - case 95: - yyDollar = yyS[yypt-6 : yypt+1] - // line internal/php5/php5.y:1330 - { - iface := &ast.StmtInterface{ - Position: yylex.(*Parser).builder.NewTokensPosition(yyDollar[1].token, yyDollar[6].token), - InterfaceTkn: yyDollar[1].token, - Name: &ast.Identifier{ - Position: yylex.(*Parser).builder.NewTokenPosition(yyDollar[2].token), - IdentifierTkn: yyDollar[2].token, - Value: yyDollar[2].token.Value, - }, - OpenCurlyBracketTkn: yyDollar[4].token, - Stmts: yyDollar[5].list, - CloseCurlyBracketTkn: yyDollar[6].token, - } - - if yyDollar[3].node != nil { - iface.ExtendsTkn = yyDollar[3].node.(*ast.StmtInterface).ExtendsTkn - iface.Extends = yyDollar[3].node.(*ast.StmtInterface).Extends - iface.ExtendsSeparatorTkns = yyDollar[3].node.(*ast.StmtInterface).ExtendsSeparatorTkns - } - - yyVAL.node = iface - } - case 96: - yyDollar = yyS[yypt-1 : yypt+1] - // line internal/php5/php5.y:1357 - { - yyVAL.node = &ast.StmtClass{ - Position: yylex.(*Parser).builder.NewTokenPosition(yyDollar[1].token), - ClassTkn: yyDollar[1].token, - } - } - case 97: - yyDollar = yyS[yypt-2 : yypt+1] - // line internal/php5/php5.y:1364 - { - yyVAL.node = &ast.StmtClass{ - Position: yylex.(*Parser).builder.NewTokensPosition(yyDollar[1].token, yyDollar[2].token), - Modifiers: []ast.Vertex{ - &ast.Identifier{ - Position: yylex.(*Parser).builder.NewTokenPosition(yyDollar[1].token), - IdentifierTkn: yyDollar[1].token, - Value: yyDollar[1].token.Value, - }, - }, - ClassTkn: yyDollar[2].token, - } - } - case 98: - yyDollar = yyS[yypt-1 : yypt+1] - // line internal/php5/php5.y:1378 - { - yyVAL.node = &ast.StmtTrait{ - Position: yylex.(*Parser).builder.NewTokenPosition(yyDollar[1].token), - TraitTkn: yyDollar[1].token, - } - } - case 99: - yyDollar = yyS[yypt-2 : yypt+1] - // line internal/php5/php5.y:1385 - { - yyVAL.node = &ast.StmtClass{ - Position: yylex.(*Parser).builder.NewTokensPosition(yyDollar[1].token, yyDollar[2].token), - Modifiers: []ast.Vertex{ - &ast.Identifier{ - Position: yylex.(*Parser).builder.NewTokenPosition(yyDollar[1].token), - IdentifierTkn: yyDollar[1].token, - Value: yyDollar[1].token.Value, - }, - }, - ClassTkn: yyDollar[2].token, - } - } - case 100: - yyDollar = yyS[yypt-0 : yypt+1] - // line internal/php5/php5.y:1402 - { - yyVAL.node = nil - } - case 101: - yyDollar = yyS[yypt-2 : yypt+1] - // line internal/php5/php5.y:1406 - { - yyVAL.node = &ast.StmtClass{ - Position: yylex.(*Parser).builder.NewTokenNodePosition(yyDollar[1].token, yyDollar[2].node), - ExtendsTkn: yyDollar[1].token, - Extends: yyDollar[2].node, - } - } - case 102: - yyDollar = yyS[yypt-1 : yypt+1] - // line internal/php5/php5.y:1417 - { - yyVAL.token = yyDollar[1].token - } - case 103: - yyDollar = yyS[yypt-0 : yypt+1] - // line internal/php5/php5.y:1424 - { - yyVAL.node = nil - } - case 104: - yyDollar = yyS[yypt-2 : yypt+1] - // line internal/php5/php5.y:1428 - { - yyVAL.node = &ast.StmtInterface{ - Position: yylex.(*Parser).builder.NewTokenNodeListPosition(yyDollar[1].token, yyDollar[2].node.(*ParserSeparatedList).Items), - ExtendsTkn: yyDollar[1].token, - Extends: yyDollar[2].node.(*ParserSeparatedList).Items, - ExtendsSeparatorTkns: yyDollar[2].node.(*ParserSeparatedList).SeparatorTkns, - } - } - case 105: - yyDollar = yyS[yypt-0 : yypt+1] - // line internal/php5/php5.y:1440 - { - yyVAL.node = nil - } - case 106: - yyDollar = yyS[yypt-2 : yypt+1] - // line internal/php5/php5.y:1444 - { - yyVAL.node = &ast.StmtClass{ - Position: yylex.(*Parser).builder.NewTokenNodeListPosition(yyDollar[1].token, yyDollar[2].node.(*ParserSeparatedList).Items), - ImplementsTkn: yyDollar[1].token, - Implements: yyDollar[2].node.(*ParserSeparatedList).Items, - ImplementsSeparatorTkns: yyDollar[2].node.(*ParserSeparatedList).SeparatorTkns, - } - } - case 107: - yyDollar = yyS[yypt-1 : yypt+1] - // line internal/php5/php5.y:1456 - { - yyVAL.node = &ParserSeparatedList{ - Items: []ast.Vertex{yyDollar[1].node}, - } - } - case 108: - yyDollar = yyS[yypt-3 : yypt+1] - // line internal/php5/php5.y:1462 - { - yyDollar[1].node.(*ParserSeparatedList).SeparatorTkns = append(yyDollar[1].node.(*ParserSeparatedList).SeparatorTkns, yyDollar[2].token) - yyDollar[1].node.(*ParserSeparatedList).Items = append(yyDollar[1].node.(*ParserSeparatedList).Items, yyDollar[3].node) - - yyVAL.node = yyDollar[1].node - } - case 109: - yyDollar = yyS[yypt-0 : yypt+1] - // line internal/php5/php5.y:1472 - { - yyVAL.node = nil - } - case 110: - yyDollar = yyS[yypt-2 : yypt+1] - // line internal/php5/php5.y:1476 - { - yyVAL.node = &ast.StmtForeach{ - DoubleArrowTkn: yyDollar[1].token, - Var: yyDollar[2].node, - } - } - case 111: - yyDollar = yyS[yypt-1 : yypt+1] - // line internal/php5/php5.y:1486 - { - yyVAL.node = yyDollar[1].node - } - case 112: - yyDollar = yyS[yypt-2 : yypt+1] - // line internal/php5/php5.y:1490 - { - yyVAL.node = &ast.StmtForeach{ - Position: yylex.(*Parser).builder.NewTokenNodePosition(yyDollar[1].token, yyDollar[2].node), - AmpersandTkn: yyDollar[1].token, - Var: yyDollar[2].node, - } - } - case 113: - yyDollar = yyS[yypt-4 : yypt+1] - // line internal/php5/php5.y:1498 - { - pairList := yyDollar[3].node.(*ParserSeparatedList) - fistPair := pairList.Items[0].(*ast.ExprArrayItem) - - if fistPair.Key == nil && fistPair.Val == nil && len(pairList.Items) == 1 { - pairList.Items = nil - } - - yyVAL.node = &ast.ExprList{ - Position: yylex.(*Parser).builder.NewTokensPosition(yyDollar[1].token, yyDollar[4].token), - ListTkn: yyDollar[1].token, - OpenBracketTkn: yyDollar[2].token, - Items: yyDollar[3].node.(*ParserSeparatedList).Items, - SeparatorTkns: yyDollar[3].node.(*ParserSeparatedList).SeparatorTkns, - CloseBracketTkn: yyDollar[4].token, - } - } - case 114: - yyDollar = yyS[yypt-1 : yypt+1] - // line internal/php5/php5.y:1519 - { - yyVAL.node = &ast.StmtFor{ - Position: yylex.(*Parser).builder.NewNodePosition(yyDollar[1].node), - Stmt: yyDollar[1].node, - } - } - case 115: - yyDollar = yyS[yypt-4 : yypt+1] - // line internal/php5/php5.y:1526 - { - yyVAL.node = &ast.StmtFor{ - Position: yylex.(*Parser).builder.NewTokensPosition(yyDollar[1].token, yyDollar[4].token), - ColonTkn: yyDollar[1].token, - Stmt: &ast.StmtStmtList{ - Position: yylex.(*Parser).builder.NewNodeListPosition(yyDollar[2].list), - Stmts: yyDollar[2].list, - }, - EndForTkn: yyDollar[3].token, - SemiColonTkn: yyDollar[4].token, - } - } - case 116: - yyDollar = yyS[yypt-1 : yypt+1] - // line internal/php5/php5.y:1542 - { - yyVAL.node = &ast.StmtForeach{ - Position: yylex.(*Parser).builder.NewNodePosition(yyDollar[1].node), - Stmt: yyDollar[1].node, - } - } - case 117: - yyDollar = yyS[yypt-4 : yypt+1] - // line internal/php5/php5.y:1549 - { - yyVAL.node = &ast.StmtForeach{ - Position: yylex.(*Parser).builder.NewTokensPosition(yyDollar[1].token, yyDollar[4].token), - ColonTkn: yyDollar[1].token, - Stmt: &ast.StmtStmtList{ - Position: yylex.(*Parser).builder.NewNodeListPosition(yyDollar[2].list), - Stmts: yyDollar[2].list, - }, - EndForeachTkn: yyDollar[3].token, - SemiColonTkn: yyDollar[4].token, - } - } - case 118: - yyDollar = yyS[yypt-1 : yypt+1] - // line internal/php5/php5.y:1566 - { - yyVAL.node = &ast.StmtDeclare{ - Position: yylex.(*Parser).builder.NewNodePosition(yyDollar[1].node), - Stmt: yyDollar[1].node, - } - } - case 119: - yyDollar = yyS[yypt-4 : yypt+1] - // line internal/php5/php5.y:1573 - { - yyVAL.node = &ast.StmtDeclare{ - Position: yylex.(*Parser).builder.NewTokensPosition(yyDollar[1].token, yyDollar[4].token), - ColonTkn: yyDollar[1].token, - Stmt: &ast.StmtStmtList{ - Position: yylex.(*Parser).builder.NewNodeListPosition(yyDollar[2].list), - Stmts: yyDollar[2].list, - }, - EndDeclareTkn: yyDollar[3].token, - SemiColonTkn: yyDollar[4].token, - } - } - case 120: - yyDollar = yyS[yypt-3 : yypt+1] - // line internal/php5/php5.y:1590 - { - yyVAL.node = &ParserSeparatedList{ - Items: []ast.Vertex{ - &ast.StmtConstant{ - Position: yylex.(*Parser).builder.NewTokenNodePosition(yyDollar[1].token, yyDollar[3].node), - Name: &ast.Identifier{ - Position: yylex.(*Parser).builder.NewTokenPosition(yyDollar[1].token), - IdentifierTkn: yyDollar[1].token, - Value: yyDollar[1].token.Value, - }, - EqualTkn: yyDollar[2].token, - Expr: yyDollar[3].node, - }, - }, - } - } - case 121: - yyDollar = yyS[yypt-5 : yypt+1] - // line internal/php5/php5.y:1607 - { - yyDollar[1].node.(*ParserSeparatedList).SeparatorTkns = append(yyDollar[1].node.(*ParserSeparatedList).SeparatorTkns, yyDollar[2].token) - yyDollar[1].node.(*ParserSeparatedList).Items = append( - yyDollar[1].node.(*ParserSeparatedList).Items, - &ast.StmtConstant{ - Position: yylex.(*Parser).builder.NewTokenNodePosition(yyDollar[3].token, yyDollar[5].node), - Name: &ast.Identifier{ - Position: yylex.(*Parser).builder.NewTokenPosition(yyDollar[3].token), - IdentifierTkn: yyDollar[3].token, - Value: yyDollar[3].token.Value, - }, - EqualTkn: yyDollar[4].token, - Expr: yyDollar[5].node, - }, - ) - - yyVAL.node = yyDollar[1].node - } - case 122: - yyDollar = yyS[yypt-3 : yypt+1] - // line internal/php5/php5.y:1630 - { - yyVAL.node = &ast.StmtSwitch{ - Position: yylex.(*Parser).builder.NewTokensPosition(yyDollar[1].token, yyDollar[3].token), - OpenCurlyBracketTkn: yyDollar[1].token, - Cases: yyDollar[2].list, - CloseCurlyBracketTkn: yyDollar[3].token, - } - } - case 123: - yyDollar = yyS[yypt-4 : yypt+1] - // line internal/php5/php5.y:1639 - { - yyVAL.node = &ast.StmtSwitch{ - Position: yylex.(*Parser).builder.NewTokensPosition(yyDollar[1].token, yyDollar[4].token), - OpenCurlyBracketTkn: yyDollar[1].token, - CaseSeparatorTkn: yyDollar[2].token, - Cases: yyDollar[3].list, - CloseCurlyBracketTkn: yyDollar[4].token, - } - } - case 124: - yyDollar = yyS[yypt-4 : yypt+1] - // line internal/php5/php5.y:1649 - { - yyVAL.node = &ast.StmtSwitch{ - Position: yylex.(*Parser).builder.NewTokensPosition(yyDollar[1].token, yyDollar[4].token), - ColonTkn: yyDollar[1].token, - Cases: yyDollar[2].list, - EndSwitchTkn: yyDollar[3].token, - SemiColonTkn: yyDollar[4].token, - } - } - case 125: - yyDollar = yyS[yypt-5 : yypt+1] - // line internal/php5/php5.y:1659 - { - yyVAL.node = &ast.StmtSwitch{ - Position: yylex.(*Parser).builder.NewTokensPosition(yyDollar[1].token, yyDollar[5].token), - ColonTkn: yyDollar[1].token, - CaseSeparatorTkn: yyDollar[2].token, - Cases: yyDollar[3].list, - EndSwitchTkn: yyDollar[4].token, - SemiColonTkn: yyDollar[5].token, - } - } - case 126: - yyDollar = yyS[yypt-0 : yypt+1] - // line internal/php5/php5.y:1674 - { - yyVAL.list = nil - } - case 127: - yyDollar = yyS[yypt-5 : yypt+1] - // line internal/php5/php5.y:1678 - { - yyVAL.list = append(yyDollar[1].list, &ast.StmtCase{ - Position: yylex.(*Parser).builder.NewTokenNodeListPosition(yyDollar[2].token, yyDollar[5].list), - CaseTkn: yyDollar[2].token, - Cond: yyDollar[3].node, - CaseSeparatorTkn: yyDollar[4].token, - Stmts: yyDollar[5].list, - }) - } - case 128: - yyDollar = yyS[yypt-4 : yypt+1] - // line internal/php5/php5.y:1688 - { - yyVAL.list = append(yyDollar[1].list, &ast.StmtDefault{ - Position: yylex.(*Parser).builder.NewTokenNodeListPosition(yyDollar[2].token, yyDollar[4].list), - DefaultTkn: yyDollar[2].token, - CaseSeparatorTkn: yyDollar[3].token, - Stmts: yyDollar[4].list, - }) - } - case 129: - yyDollar = yyS[yypt-1 : yypt+1] - // line internal/php5/php5.y:1701 - { - yyVAL.token = yyDollar[1].token - } - case 130: - yyDollar = yyS[yypt-1 : yypt+1] - // line internal/php5/php5.y:1705 - { - yyVAL.token = yyDollar[1].token - } - case 131: - yyDollar = yyS[yypt-1 : yypt+1] - // line internal/php5/php5.y:1713 - { - yyVAL.node = &ast.StmtWhile{ - Position: yylex.(*Parser).builder.NewNodePosition(yyDollar[1].node), - Stmt: yyDollar[1].node, - } - } - case 132: - yyDollar = yyS[yypt-4 : yypt+1] - // line internal/php5/php5.y:1720 - { - yyVAL.node = &ast.StmtWhile{ - Position: yylex.(*Parser).builder.NewTokensPosition(yyDollar[1].token, yyDollar[4].token), - ColonTkn: yyDollar[1].token, - Stmt: &ast.StmtStmtList{ - Position: yylex.(*Parser).builder.NewNodeListPosition(yyDollar[2].list), - Stmts: yyDollar[2].list, - }, - EndWhileTkn: yyDollar[3].token, - SemiColonTkn: yyDollar[4].token, - } - } - case 133: - yyDollar = yyS[yypt-0 : yypt+1] - // line internal/php5/php5.y:1738 - { - yyVAL.list = nil - } - case 134: - yyDollar = yyS[yypt-4 : yypt+1] - // line internal/php5/php5.y:1742 - { - yyVAL.list = append(yyDollar[1].list, &ast.StmtElseIf{ - Position: yylex.(*Parser).builder.NewTokenNodePosition(yyDollar[2].token, yyDollar[4].node), - ElseIfTkn: yyDollar[2].token, - OpenParenthesisTkn: yyDollar[3].node.(*ast.ExprBrackets).OpenParenthesisTkn, - Cond: yyDollar[3].node.(*ast.ExprBrackets).Expr, - CloseParenthesisTkn: yyDollar[3].node.(*ast.ExprBrackets).CloseParenthesisTkn, - Stmt: yyDollar[4].node, - }) - } - case 135: - yyDollar = yyS[yypt-0 : yypt+1] - // line internal/php5/php5.y:1757 - { - yyVAL.list = nil - } - case 136: - yyDollar = yyS[yypt-5 : yypt+1] - // line internal/php5/php5.y:1761 - { - yyVAL.list = append(yyDollar[1].list, &ast.StmtElseIf{ - Position: yylex.(*Parser).builder.NewTokenNodeListPosition(yyDollar[2].token, yyDollar[5].list), - ElseIfTkn: yyDollar[2].token, - OpenParenthesisTkn: yyDollar[3].node.(*ast.ExprBrackets).OpenParenthesisTkn, - Cond: yyDollar[3].node.(*ast.ExprBrackets).Expr, - CloseParenthesisTkn: yyDollar[3].node.(*ast.ExprBrackets).CloseParenthesisTkn, - ColonTkn: yyDollar[4].token, - Stmt: &ast.StmtStmtList{ - Position: yylex.(*Parser).builder.NewNodeListPosition(yyDollar[5].list), - Stmts: yyDollar[5].list, - }, - }) - } - case 137: - yyDollar = yyS[yypt-0 : yypt+1] - // line internal/php5/php5.y:1780 - { - yyVAL.node = nil - } - case 138: - yyDollar = yyS[yypt-2 : yypt+1] - // line internal/php5/php5.y:1784 - { - yyVAL.node = &ast.StmtElse{ - Position: yylex.(*Parser).builder.NewTokenNodePosition(yyDollar[1].token, yyDollar[2].node), - ElseTkn: yyDollar[1].token, - Stmt: yyDollar[2].node, - } - } - case 139: - yyDollar = yyS[yypt-0 : yypt+1] - // line internal/php5/php5.y:1796 - { - yyVAL.node = nil - } - case 140: - yyDollar = yyS[yypt-3 : yypt+1] - // line internal/php5/php5.y:1800 - { - yyVAL.node = &ast.StmtElse{ - Position: yylex.(*Parser).builder.NewTokenNodeListPosition(yyDollar[1].token, yyDollar[3].list), - ElseTkn: yyDollar[1].token, - ColonTkn: yyDollar[2].token, - Stmt: &ast.StmtStmtList{ - Position: yylex.(*Parser).builder.NewNodeListPosition(yyDollar[3].list), - Stmts: yyDollar[3].list, - }, - } - } - case 141: - yyDollar = yyS[yypt-1 : yypt+1] - // line internal/php5/php5.y:1816 - { - yyVAL.node = yyDollar[1].node - } - case 142: - yyDollar = yyS[yypt-0 : yypt+1] - // line internal/php5/php5.y:1820 - { - yyVAL.node = &ParserSeparatedList{} - } - case 143: - yyDollar = yyS[yypt-1 : yypt+1] - // line internal/php5/php5.y:1827 - { - yyVAL.node = &ParserSeparatedList{ - Items: []ast.Vertex{yyDollar[1].node}, - } - } - case 144: - yyDollar = yyS[yypt-3 : yypt+1] - // line internal/php5/php5.y:1833 - { - yyDollar[1].node.(*ParserSeparatedList).SeparatorTkns = append(yyDollar[1].node.(*ParserSeparatedList).SeparatorTkns, yyDollar[2].token) - yyDollar[1].node.(*ParserSeparatedList).Items = append(yyDollar[1].node.(*ParserSeparatedList).Items, yyDollar[3].node) - - yyVAL.node = yyDollar[1].node - } - case 145: - yyDollar = yyS[yypt-4 : yypt+1] - // line internal/php5/php5.y:1843 - { - pos := yylex.(*Parser).builder.NewTokenPosition(yyDollar[4].token) - if yyDollar[1].node != nil { - pos = yylex.(*Parser).builder.NewNodeTokenPosition(yyDollar[1].node, yyDollar[4].token) - } else if yyDollar[2].token != nil { - pos = yylex.(*Parser).builder.NewTokensPosition(yyDollar[2].token, yyDollar[4].token) - } else if yyDollar[3].token != nil { - pos = yylex.(*Parser).builder.NewTokensPosition(yyDollar[3].token, yyDollar[4].token) - } - - yyVAL.node = &ast.Parameter{ - Position: pos, - Type: yyDollar[1].node, - AmpersandTkn: yyDollar[2].token, - VariadicTkn: yyDollar[3].token, - Var: &ast.ExprVariable{ - Position: yylex.(*Parser).builder.NewTokenPosition(yyDollar[4].token), - Name: &ast.Identifier{ - Position: yylex.(*Parser).builder.NewTokenPosition(yyDollar[4].token), - IdentifierTkn: yyDollar[4].token, - Value: yyDollar[4].token.Value, - }, - }, - } - } - case 146: - yyDollar = yyS[yypt-6 : yypt+1] - // line internal/php5/php5.y:1869 - { - pos := yylex.(*Parser).builder.NewTokenNodePosition(yyDollar[4].token, yyDollar[6].node) - if yyDollar[1].node != nil { - pos = yylex.(*Parser).builder.NewNodesPosition(yyDollar[1].node, yyDollar[6].node) - } else if yyDollar[2].token != nil { - pos = yylex.(*Parser).builder.NewTokenNodePosition(yyDollar[2].token, yyDollar[6].node) - } else if yyDollar[3].token != nil { - pos = yylex.(*Parser).builder.NewTokenNodePosition(yyDollar[3].token, yyDollar[6].node) - } - - yyVAL.node = &ast.Parameter{ - Position: pos, - Type: yyDollar[1].node, - AmpersandTkn: yyDollar[2].token, - VariadicTkn: yyDollar[3].token, - Var: &ast.ExprVariable{ - Position: yylex.(*Parser).builder.NewTokenPosition(yyDollar[4].token), - Name: &ast.Identifier{ - Position: yylex.(*Parser).builder.NewTokenPosition(yyDollar[4].token), - IdentifierTkn: yyDollar[4].token, - Value: yyDollar[4].token.Value, - }, - }, - EqualTkn: yyDollar[5].token, - DefaultValue: yyDollar[6].node, - } - } - case 147: - yyDollar = yyS[yypt-0 : yypt+1] - // line internal/php5/php5.y:1901 - { - yyVAL.node = nil - } - case 148: - yyDollar = yyS[yypt-1 : yypt+1] - // line internal/php5/php5.y:1905 - { - yyVAL.node = &ast.Identifier{ - Position: yylex.(*Parser).builder.NewTokenPosition(yyDollar[1].token), - IdentifierTkn: yyDollar[1].token, - Value: yyDollar[1].token.Value, - } - } - case 149: - yyDollar = yyS[yypt-1 : yypt+1] - // line internal/php5/php5.y:1913 - { - yyVAL.node = &ast.Identifier{ - Position: yylex.(*Parser).builder.NewTokenPosition(yyDollar[1].token), - IdentifierTkn: yyDollar[1].token, - Value: yyDollar[1].token.Value, - } - } - case 150: - yyDollar = yyS[yypt-1 : yypt+1] - // line internal/php5/php5.y:1921 - { - yyVAL.node = yyDollar[1].node - } - case 151: - yyDollar = yyS[yypt-2 : yypt+1] - // line internal/php5/php5.y:1929 - { - yyVAL.node = &ArgumentList{ - Position: yylex.(*Parser).builder.NewTokensPosition(yyDollar[1].token, yyDollar[2].token), - OpenParenthesisTkn: yyDollar[1].token, - CloseParenthesisTkn: yyDollar[2].token, - } - } - case 152: - yyDollar = yyS[yypt-3 : yypt+1] - // line internal/php5/php5.y:1937 - { - argumentList := yyDollar[2].node.(*ArgumentList) - argumentList.Position = yylex.(*Parser).builder.NewTokensPosition(yyDollar[1].token, yyDollar[3].token) - argumentList.OpenParenthesisTkn = yyDollar[1].token - argumentList.CloseParenthesisTkn = yyDollar[3].token - - yyVAL.node = argumentList - } - case 153: - yyDollar = yyS[yypt-3 : yypt+1] - // line internal/php5/php5.y:1946 - { - yyVAL.node = &ArgumentList{ - Position: yylex.(*Parser).builder.NewTokensPosition(yyDollar[1].token, yyDollar[3].token), - OpenParenthesisTkn: yyDollar[1].token, - Arguments: []ast.Vertex{ - &ast.Argument{ - Position: yylex.(*Parser).builder.NewNodePosition(yyDollar[2].node), - Expr: yyDollar[2].node, - }, - }, - CloseParenthesisTkn: yyDollar[3].token, - } - } - case 154: - yyDollar = yyS[yypt-1 : yypt+1] - // line internal/php5/php5.y:1964 - { - yyVAL.node = &ArgumentList{ - Arguments: []ast.Vertex{yyDollar[1].node}, - } - } - case 155: - yyDollar = yyS[yypt-3 : yypt+1] - // line internal/php5/php5.y:1970 - { - yyDollar[1].node.(*ArgumentList).SeparatorTkns = append(yyDollar[1].node.(*ArgumentList).SeparatorTkns, yyDollar[2].token) - yyDollar[1].node.(*ArgumentList).Arguments = append(yyDollar[1].node.(*ArgumentList).Arguments, yyDollar[3].node) - - yyVAL.node = yyDollar[1].node - } - case 156: - yyDollar = yyS[yypt-1 : yypt+1] - // line internal/php5/php5.y:1980 - { - yyVAL.node = &ast.Argument{ - Position: yylex.(*Parser).builder.NewNodePosition(yyDollar[1].node), - Expr: yyDollar[1].node, - } - } - case 157: - yyDollar = yyS[yypt-1 : yypt+1] - // line internal/php5/php5.y:1987 - { - yyVAL.node = &ast.Argument{ - Position: yylex.(*Parser).builder.NewNodePosition(yyDollar[1].node), - Expr: yyDollar[1].node, - } - } - case 158: - yyDollar = yyS[yypt-2 : yypt+1] - // line internal/php5/php5.y:1994 - { - yyVAL.node = &ast.Argument{ - Position: yylex.(*Parser).builder.NewTokenNodePosition(yyDollar[1].token, yyDollar[2].node), - AmpersandTkn: yyDollar[1].token, - Expr: yyDollar[2].node, - } - } - case 159: - yyDollar = yyS[yypt-2 : yypt+1] - // line internal/php5/php5.y:2002 - { - yyVAL.node = &ast.Argument{ - Position: yylex.(*Parser).builder.NewTokenNodePosition(yyDollar[1].token, yyDollar[2].node), - VariadicTkn: yyDollar[1].token, - Expr: yyDollar[2].node, - } - } - case 160: - yyDollar = yyS[yypt-3 : yypt+1] - // line internal/php5/php5.y:2013 - { - yyDollar[1].node.(*ast.StmtGlobal).Vars = append(yyDollar[1].node.(*ast.StmtGlobal).Vars, yyDollar[3].node) - yyDollar[1].node.(*ast.StmtGlobal).SeparatorTkns = append(yyDollar[1].node.(*ast.StmtGlobal).SeparatorTkns, yyDollar[2].token) - - yyVAL.node = yyDollar[1].node - } - case 161: - yyDollar = yyS[yypt-1 : yypt+1] - // line internal/php5/php5.y:2020 - { - yyVAL.node = &ast.StmtGlobal{ - Vars: []ast.Vertex{yyDollar[1].node}, - } - } - case 162: - yyDollar = yyS[yypt-1 : yypt+1] - // line internal/php5/php5.y:2030 - { - yyVAL.node = &ast.ExprVariable{ - Position: yylex.(*Parser).builder.NewTokenPosition(yyDollar[1].token), - Name: &ast.Identifier{ - Position: yylex.(*Parser).builder.NewTokenPosition(yyDollar[1].token), - IdentifierTkn: yyDollar[1].token, - Value: yyDollar[1].token.Value, - }, - } - } - case 163: - yyDollar = yyS[yypt-2 : yypt+1] - // line internal/php5/php5.y:2041 - { - yyVAL.node = &ast.ExprVariable{ - Position: yylex.(*Parser).builder.NewTokenNodePosition(yyDollar[1].token, yyDollar[2].node), - DollarTkn: yyDollar[1].token, - Name: yyDollar[2].node, - } - } - case 164: - yyDollar = yyS[yypt-4 : yypt+1] - // line internal/php5/php5.y:2049 - { - yyVAL.node = &ast.ExprVariable{ - Position: yylex.(*Parser).builder.NewTokensPosition(yyDollar[1].token, yyDollar[4].token), - DollarTkn: yyDollar[1].token, - OpenCurlyBracketTkn: yyDollar[2].token, - Name: yyDollar[3].node, - CloseCurlyBracketTkn: yyDollar[4].token, - } - } - case 165: - yyDollar = yyS[yypt-3 : yypt+1] - // line internal/php5/php5.y:2063 - { - yyDollar[1].node.(*ast.StmtStatic).Vars = append(yyDollar[1].node.(*ast.StmtStatic).Vars, &ast.StmtStaticVar{ - Position: yylex.(*Parser).builder.NewTokenPosition(yyDollar[3].token), - Var: &ast.ExprVariable{ - Position: yylex.(*Parser).builder.NewTokenPosition(yyDollar[3].token), - Name: &ast.Identifier{ - Position: yylex.(*Parser).builder.NewTokenPosition(yyDollar[3].token), - IdentifierTkn: yyDollar[3].token, - Value: yyDollar[3].token.Value, - }, - }, - }) - yyDollar[1].node.(*ast.StmtStatic).SeparatorTkns = append(yyDollar[1].node.(*ast.StmtStatic).SeparatorTkns, yyDollar[2].token) - - yyVAL.node = yyDollar[1].node - } - case 166: - yyDollar = yyS[yypt-5 : yypt+1] - // line internal/php5/php5.y:2080 - { - yyDollar[1].node.(*ast.StmtStatic).Vars = append(yyDollar[1].node.(*ast.StmtStatic).Vars, &ast.StmtStaticVar{ - Position: yylex.(*Parser).builder.NewTokenNodePosition(yyDollar[3].token, yyDollar[5].node), - Var: &ast.ExprVariable{ - Position: yylex.(*Parser).builder.NewTokenPosition(yyDollar[3].token), - Name: &ast.Identifier{ - Position: yylex.(*Parser).builder.NewTokenPosition(yyDollar[3].token), - IdentifierTkn: yyDollar[3].token, - Value: yyDollar[3].token.Value, - }, - }, - EqualTkn: yyDollar[4].token, - Expr: yyDollar[5].node, - }) - yyDollar[1].node.(*ast.StmtStatic).SeparatorTkns = append(yyDollar[1].node.(*ast.StmtStatic).SeparatorTkns, yyDollar[2].token) - - yyVAL.node = yyDollar[1].node - } - case 167: - yyDollar = yyS[yypt-1 : yypt+1] - // line internal/php5/php5.y:2099 - { - yyVAL.node = &ast.StmtStatic{ - Vars: []ast.Vertex{ - &ast.StmtStaticVar{ - Position: yylex.(*Parser).builder.NewTokenPosition(yyDollar[1].token), - Var: &ast.ExprVariable{ - Position: yylex.(*Parser).builder.NewTokenPosition(yyDollar[1].token), - Name: &ast.Identifier{ - Position: yylex.(*Parser).builder.NewTokenPosition(yyDollar[1].token), - IdentifierTkn: yyDollar[1].token, - Value: yyDollar[1].token.Value, - }, - }, - }, - }, - } - } - case 168: - yyDollar = yyS[yypt-3 : yypt+1] - // line internal/php5/php5.y:2117 - { - yyVAL.node = &ast.StmtStatic{ - Vars: []ast.Vertex{ - &ast.StmtStaticVar{ - Position: yylex.(*Parser).builder.NewTokenNodePosition(yyDollar[1].token, yyDollar[3].node), - Var: &ast.ExprVariable{ - Position: yylex.(*Parser).builder.NewTokenPosition(yyDollar[1].token), - Name: &ast.Identifier{ - Position: yylex.(*Parser).builder.NewTokenPosition(yyDollar[1].token), - IdentifierTkn: yyDollar[1].token, - Value: yyDollar[1].token.Value, - }, - }, - EqualTkn: yyDollar[2].token, - Expr: yyDollar[3].node, - }, - }, - } - } - case 169: - yyDollar = yyS[yypt-2 : yypt+1] - // line internal/php5/php5.y:2141 - { - yyVAL.list = append(yyDollar[1].list, yyDollar[2].node) - } - case 170: - yyDollar = yyS[yypt-0 : yypt+1] - // line internal/php5/php5.y:2145 - { - yyVAL.list = []ast.Vertex{} - } - case 171: - yyDollar = yyS[yypt-3 : yypt+1] - // line internal/php5/php5.y:2153 - { - yyVAL.node = &ast.StmtPropertyList{ - Position: yylex.(*Parser).builder.NewNodeListTokenPosition(yyDollar[1].list, yyDollar[3].token), - Modifiers: yyDollar[1].list, - Props: yyDollar[2].node.(*ParserSeparatedList).Items, - SeparatorTkns: yyDollar[2].node.(*ParserSeparatedList).SeparatorTkns, - SemiColonTkn: yyDollar[3].token, - } - } - case 172: - yyDollar = yyS[yypt-2 : yypt+1] - // line internal/php5/php5.y:2163 - { - yyDollar[1].node.(*ast.StmtClassConstList).SemiColonTkn = yyDollar[2].token - yyDollar[1].node.(*ast.StmtClassConstList).Position = yylex.(*Parser).builder.NewNodeTokenPosition(yyDollar[1].node, yyDollar[2].token) - yyVAL.node = yyDollar[1].node - } - case 173: - yyDollar = yyS[yypt-1 : yypt+1] - // line internal/php5/php5.y:2169 - { - yyVAL.node = yyDollar[1].node - } - case 174: - yyDollar = yyS[yypt-8 : yypt+1] - // line internal/php5/php5.y:2173 - { - pos := yylex.(*Parser).builder.NewTokenNodePosition(yyDollar[2].token, yyDollar[8].node) - if yyDollar[1].list != nil { - pos = yylex.(*Parser).builder.NewNodeListNodePosition(yyDollar[1].list, yyDollar[8].node) - } - - yyVAL.node = &ast.StmtClassMethod{ - Position: pos, - Modifiers: yyDollar[1].list, - FunctionTkn: yyDollar[2].token, - AmpersandTkn: yyDollar[3].token, - Name: &ast.Identifier{ - Position: yylex.(*Parser).builder.NewTokenPosition(yyDollar[4].token), - IdentifierTkn: yyDollar[4].token, - Value: yyDollar[4].token.Value, - }, - OpenParenthesisTkn: yyDollar[5].token, - Params: yyDollar[6].node.(*ParserSeparatedList).Items, - SeparatorTkns: yyDollar[6].node.(*ParserSeparatedList).SeparatorTkns, - CloseParenthesisTkn: yyDollar[7].token, - Stmt: yyDollar[8].node, - } - } - case 175: - yyDollar = yyS[yypt-3 : yypt+1] - // line internal/php5/php5.y:2200 - { - traitUse := &ast.StmtTraitUse{ - Position: yylex.(*Parser).builder.NewTokenNodePosition(yyDollar[1].token, yyDollar[3].node), - UseTkn: yyDollar[1].token, - Traits: yyDollar[2].node.(*ParserSeparatedList).Items, - SeparatorTkns: yyDollar[2].node.(*ParserSeparatedList).SeparatorTkns, - } - - switch n := yyDollar[3].node.(type) { - case *TraitAdaptationList: - traitUse.OpenCurlyBracketTkn = n.OpenCurlyBracketTkn - traitUse.Adaptations = n.Adaptations - traitUse.CloseCurlyBracketTkn = n.CloseCurlyBracketTkn - case *ast.StmtNop: - traitUse.SemiColonTkn = n.SemiColonTkn - } - - yyVAL.node = traitUse - } - case 176: - yyDollar = yyS[yypt-1 : yypt+1] - // line internal/php5/php5.y:2223 - { - yyVAL.node = &ParserSeparatedList{ - Items: []ast.Vertex{yyDollar[1].node}, - } - } - case 177: - yyDollar = yyS[yypt-3 : yypt+1] - // line internal/php5/php5.y:2229 - { - yyDollar[1].node.(*ParserSeparatedList).SeparatorTkns = append(yyDollar[1].node.(*ParserSeparatedList).SeparatorTkns, yyDollar[2].token) - yyDollar[1].node.(*ParserSeparatedList).Items = append(yyDollar[1].node.(*ParserSeparatedList).Items, yyDollar[3].node) - - yyVAL.node = yyDollar[1].node - } - case 178: - yyDollar = yyS[yypt-1 : yypt+1] - // line internal/php5/php5.y:2239 - { - yyVAL.node = &ast.StmtNop{ - Position: yylex.(*Parser).builder.NewTokenPosition(yyDollar[1].token), - SemiColonTkn: yyDollar[1].token, - } - } - case 179: - yyDollar = yyS[yypt-3 : yypt+1] - // line internal/php5/php5.y:2246 - { - yyVAL.node = &TraitAdaptationList{ - Position: yylex.(*Parser).builder.NewTokensPosition(yyDollar[1].token, yyDollar[3].token), - OpenCurlyBracketTkn: yyDollar[1].token, - Adaptations: yyDollar[2].list, - CloseCurlyBracketTkn: yyDollar[3].token, - } - } - case 180: - yyDollar = yyS[yypt-0 : yypt+1] - // line internal/php5/php5.y:2258 - { - yyVAL.list = nil - } - case 181: - yyDollar = yyS[yypt-1 : yypt+1] - // line internal/php5/php5.y:2262 - { - yyVAL.list = yyDollar[1].list - } - case 182: - yyDollar = yyS[yypt-1 : yypt+1] - // line internal/php5/php5.y:2269 - { - yyVAL.list = []ast.Vertex{yyDollar[1].node} - } - case 183: - yyDollar = yyS[yypt-2 : yypt+1] - // line internal/php5/php5.y:2273 - { - yyVAL.list = append(yyDollar[1].list, yyDollar[2].node) - } - case 184: - yyDollar = yyS[yypt-2 : yypt+1] - // line internal/php5/php5.y:2280 - { - yyDollar[1].node.(*ast.StmtTraitUsePrecedence).SemiColonTkn = yyDollar[2].token - - yyVAL.node = yyDollar[1].node - } - case 185: - yyDollar = yyS[yypt-2 : yypt+1] - // line internal/php5/php5.y:2286 - { - yyDollar[1].node.(*ast.StmtTraitUseAlias).SemiColonTkn = yyDollar[2].token - - yyVAL.node = yyDollar[1].node - } - case 186: - yyDollar = yyS[yypt-3 : yypt+1] - // line internal/php5/php5.y:2295 - { - yyVAL.node = &ast.StmtTraitUsePrecedence{ - Position: yylex.(*Parser).builder.NewNodeNodeListPosition(yyDollar[1].node, yyDollar[3].node.(*ParserSeparatedList).Items), - Trait: yyDollar[1].node.(*TraitMethodRef).Trait, - DoubleColonTkn: yyDollar[1].node.(*TraitMethodRef).DoubleColonTkn, - Method: yyDollar[1].node.(*TraitMethodRef).Method, - InsteadofTkn: yyDollar[2].token, - Insteadof: yyDollar[3].node.(*ParserSeparatedList).Items, - SeparatorTkns: yyDollar[3].node.(*ParserSeparatedList).SeparatorTkns, - } - } - case 187: - yyDollar = yyS[yypt-1 : yypt+1] - // line internal/php5/php5.y:2310 - { - yyVAL.node = &ParserSeparatedList{ - Items: []ast.Vertex{yyDollar[1].node}, - } - } - case 188: - yyDollar = yyS[yypt-3 : yypt+1] - // line internal/php5/php5.y:2316 - { - yyDollar[1].node.(*ParserSeparatedList).SeparatorTkns = append(yyDollar[1].node.(*ParserSeparatedList).SeparatorTkns, yyDollar[2].token) - yyDollar[1].node.(*ParserSeparatedList).Items = append(yyDollar[1].node.(*ParserSeparatedList).Items, yyDollar[3].node) - - yyVAL.node = yyDollar[1].node - } - case 189: - yyDollar = yyS[yypt-1 : yypt+1] - // line internal/php5/php5.y:2326 - { - yyVAL.node = &TraitMethodRef{ - Position: yylex.(*Parser).builder.NewTokenPosition(yyDollar[1].token), - Method: &ast.Identifier{ - Position: yylex.(*Parser).builder.NewTokenPosition(yyDollar[1].token), - IdentifierTkn: yyDollar[1].token, - Value: yyDollar[1].token.Value, - }, - } - } - case 190: - yyDollar = yyS[yypt-1 : yypt+1] - // line internal/php5/php5.y:2337 - { - yyVAL.node = yyDollar[1].node - } - case 191: - yyDollar = yyS[yypt-3 : yypt+1] - // line internal/php5/php5.y:2344 - { - yyVAL.node = &TraitMethodRef{ - Position: yylex.(*Parser).builder.NewNodeTokenPosition(yyDollar[1].node, yyDollar[3].token), - Trait: yyDollar[1].node, - DoubleColonTkn: yyDollar[2].token, - Method: &ast.Identifier{ - Position: yylex.(*Parser).builder.NewTokenPosition(yyDollar[3].token), - IdentifierTkn: yyDollar[3].token, - Value: yyDollar[3].token.Value, - }, - } - } - case 192: - yyDollar = yyS[yypt-4 : yypt+1] - // line internal/php5/php5.y:2360 - { - yyVAL.node = &ast.StmtTraitUseAlias{ - Position: yylex.(*Parser).builder.NewNodeTokenPosition(yyDollar[1].node, yyDollar[4].token), - Trait: yyDollar[1].node.(*TraitMethodRef).Trait, - DoubleColonTkn: yyDollar[1].node.(*TraitMethodRef).DoubleColonTkn, - Method: yyDollar[1].node.(*TraitMethodRef).Method, - AsTkn: yyDollar[2].token, - Modifier: yyDollar[3].node, - Alias: &ast.Identifier{ - Position: yylex.(*Parser).builder.NewTokenPosition(yyDollar[4].token), - IdentifierTkn: yyDollar[4].token, - Value: yyDollar[4].token.Value, - }, - } - } - case 193: - yyDollar = yyS[yypt-3 : yypt+1] - // line internal/php5/php5.y:2376 - { - yyVAL.node = &ast.StmtTraitUseAlias{ - Position: yylex.(*Parser).builder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node), - Trait: yyDollar[1].node.(*TraitMethodRef).Trait, - DoubleColonTkn: yyDollar[1].node.(*TraitMethodRef).DoubleColonTkn, - Method: yyDollar[1].node.(*TraitMethodRef).Method, - AsTkn: yyDollar[2].token, - Modifier: yyDollar[3].node, - } - } - case 194: - yyDollar = yyS[yypt-0 : yypt+1] - // line internal/php5/php5.y:2390 - { - yyVAL.node = nil - } - case 195: - yyDollar = yyS[yypt-1 : yypt+1] - // line internal/php5/php5.y:2394 - { - yyVAL.node = yyDollar[1].node - } - case 196: - yyDollar = yyS[yypt-1 : yypt+1] - // line internal/php5/php5.y:2401 - { - yyVAL.node = &ast.StmtNop{ - Position: yylex.(*Parser).builder.NewTokenPosition(yyDollar[1].token), - SemiColonTkn: yyDollar[1].token, - } - } - case 197: - yyDollar = yyS[yypt-3 : yypt+1] - // line internal/php5/php5.y:2408 - { - yyVAL.node = &ast.StmtStmtList{ - Position: yylex.(*Parser).builder.NewTokensPosition(yyDollar[1].token, yyDollar[3].token), - OpenCurlyBracketTkn: yyDollar[1].token, - Stmts: yyDollar[2].list, - CloseCurlyBracketTkn: yyDollar[3].token, - } - } - case 198: - yyDollar = yyS[yypt-1 : yypt+1] - // line internal/php5/php5.y:2420 - { - yyVAL.list = yyDollar[1].list - } - case 199: - yyDollar = yyS[yypt-1 : yypt+1] - // line internal/php5/php5.y:2424 - { - yyVAL.list = []ast.Vertex{ - &ast.Identifier{ - Position: yylex.(*Parser).builder.NewTokenPosition(yyDollar[1].token), - IdentifierTkn: yyDollar[1].token, - Value: yyDollar[1].token.Value, - }, - } - } - case 200: - yyDollar = yyS[yypt-0 : yypt+1] - // line internal/php5/php5.y:2437 - { - yyVAL.list = nil - } - case 201: - yyDollar = yyS[yypt-1 : yypt+1] - // line internal/php5/php5.y:2441 - { - yyVAL.list = yyDollar[1].list - } - case 202: - yyDollar = yyS[yypt-1 : yypt+1] - // line internal/php5/php5.y:2448 - { - yyVAL.list = []ast.Vertex{yyDollar[1].node} - } - case 203: - yyDollar = yyS[yypt-2 : yypt+1] - // line internal/php5/php5.y:2452 - { - yyVAL.list = append(yyDollar[1].list, yyDollar[2].node) - } - case 204: - yyDollar = yyS[yypt-1 : yypt+1] - // line internal/php5/php5.y:2459 - { - yyVAL.node = &ast.Identifier{ - Position: yylex.(*Parser).builder.NewTokenPosition(yyDollar[1].token), - IdentifierTkn: yyDollar[1].token, - Value: yyDollar[1].token.Value, - } - } - case 205: - yyDollar = yyS[yypt-1 : yypt+1] - // line internal/php5/php5.y:2467 - { - yyVAL.node = &ast.Identifier{ - Position: yylex.(*Parser).builder.NewTokenPosition(yyDollar[1].token), - IdentifierTkn: yyDollar[1].token, - Value: yyDollar[1].token.Value, - } - } - case 206: - yyDollar = yyS[yypt-1 : yypt+1] - // line internal/php5/php5.y:2475 - { - yyVAL.node = &ast.Identifier{ - Position: yylex.(*Parser).builder.NewTokenPosition(yyDollar[1].token), - IdentifierTkn: yyDollar[1].token, - Value: yyDollar[1].token.Value, - } - } - case 207: - yyDollar = yyS[yypt-1 : yypt+1] - // line internal/php5/php5.y:2483 - { - yyVAL.node = &ast.Identifier{ - Position: yylex.(*Parser).builder.NewTokenPosition(yyDollar[1].token), - IdentifierTkn: yyDollar[1].token, - Value: yyDollar[1].token.Value, - } - } - case 208: - yyDollar = yyS[yypt-1 : yypt+1] - // line internal/php5/php5.y:2491 - { - yyVAL.node = &ast.Identifier{ - Position: yylex.(*Parser).builder.NewTokenPosition(yyDollar[1].token), - IdentifierTkn: yyDollar[1].token, - Value: yyDollar[1].token.Value, - } - } - case 209: - yyDollar = yyS[yypt-1 : yypt+1] - // line internal/php5/php5.y:2499 - { - yyVAL.node = &ast.Identifier{ - Position: yylex.(*Parser).builder.NewTokenPosition(yyDollar[1].token), - IdentifierTkn: yyDollar[1].token, - Value: yyDollar[1].token.Value, - } - } - case 210: - yyDollar = yyS[yypt-3 : yypt+1] - // line internal/php5/php5.y:2510 - { - item := &ast.StmtProperty{ - Position: yylex.(*Parser).builder.NewTokenPosition(yyDollar[3].token), - Var: &ast.ExprVariable{ - Position: yylex.(*Parser).builder.NewTokenPosition(yyDollar[3].token), - Name: &ast.Identifier{ - Position: yylex.(*Parser).builder.NewTokenPosition(yyDollar[3].token), - IdentifierTkn: yyDollar[3].token, - Value: yyDollar[3].token.Value, - }, - }, - } - - yyDollar[1].node.(*ParserSeparatedList).SeparatorTkns = append(yyDollar[1].node.(*ParserSeparatedList).SeparatorTkns, yyDollar[2].token) - yyDollar[1].node.(*ParserSeparatedList).Items = append(yyDollar[1].node.(*ParserSeparatedList).Items, item) - - yyVAL.node = yyDollar[1].node - } - case 211: - yyDollar = yyS[yypt-5 : yypt+1] - // line internal/php5/php5.y:2529 - { - item := &ast.StmtProperty{ - Position: yylex.(*Parser).builder.NewTokenNodePosition(yyDollar[3].token, yyDollar[5].node), - Var: &ast.ExprVariable{ - Position: yylex.(*Parser).builder.NewTokenPosition(yyDollar[3].token), - Name: &ast.Identifier{ - Position: yylex.(*Parser).builder.NewTokenPosition(yyDollar[3].token), - IdentifierTkn: yyDollar[3].token, - Value: yyDollar[3].token.Value, - }, - }, - EqualTkn: yyDollar[4].token, - Expr: yyDollar[5].node, - } - - yyDollar[1].node.(*ParserSeparatedList).SeparatorTkns = append(yyDollar[1].node.(*ParserSeparatedList).SeparatorTkns, yyDollar[2].token) - yyDollar[1].node.(*ParserSeparatedList).Items = append(yyDollar[1].node.(*ParserSeparatedList).Items, item) - - yyVAL.node = yyDollar[1].node - } - case 212: - yyDollar = yyS[yypt-1 : yypt+1] - // line internal/php5/php5.y:2550 - { - yyVAL.node = &ParserSeparatedList{ - Items: []ast.Vertex{ - &ast.StmtProperty{ - Position: yylex.(*Parser).builder.NewTokenPosition(yyDollar[1].token), - Var: &ast.ExprVariable{ - Position: yylex.(*Parser).builder.NewTokenPosition(yyDollar[1].token), - Name: &ast.Identifier{ - Position: yylex.(*Parser).builder.NewTokenPosition(yyDollar[1].token), - IdentifierTkn: yyDollar[1].token, - Value: yyDollar[1].token.Value, - }, - }, - Expr: nil, - }, - }, - } - } - case 213: - yyDollar = yyS[yypt-3 : yypt+1] - // line internal/php5/php5.y:2569 - { - yyVAL.node = &ParserSeparatedList{ - Items: []ast.Vertex{ - &ast.StmtProperty{ - Position: yylex.(*Parser).builder.NewTokenNodePosition(yyDollar[1].token, yyDollar[3].node), - Var: &ast.ExprVariable{ - Position: yylex.(*Parser).builder.NewTokenPosition(yyDollar[1].token), - Name: &ast.Identifier{ - Position: yylex.(*Parser).builder.NewTokenPosition(yyDollar[1].token), - IdentifierTkn: yyDollar[1].token, - Value: yyDollar[1].token.Value, - }, - }, - EqualTkn: yyDollar[2].token, - Expr: yyDollar[3].node, - }, - }, - } - } - case 214: - yyDollar = yyS[yypt-5 : yypt+1] - // line internal/php5/php5.y:2592 - { - constList := yyDollar[1].node.(*ast.StmtClassConstList) - constList.Position = yylex.(*Parser).builder.NewNodesPosition(yyDollar[1].node, yyDollar[5].node) - constList.SeparatorTkns = append(constList.SeparatorTkns, yyDollar[2].token) - constList.Consts = append(constList.Consts, &ast.StmtConstant{ - Position: yylex.(*Parser).builder.NewTokenNodePosition(yyDollar[3].token, yyDollar[5].node), - Name: &ast.Identifier{ - Position: yylex.(*Parser).builder.NewTokenPosition(yyDollar[3].token), - IdentifierTkn: yyDollar[3].token, - Value: yyDollar[3].token.Value, - }, - EqualTkn: yyDollar[4].token, - Expr: yyDollar[5].node, - }) - - yyVAL.node = yyDollar[1].node - } - case 215: - yyDollar = yyS[yypt-4 : yypt+1] - // line internal/php5/php5.y:2610 - { - yyVAL.node = &ast.StmtClassConstList{ - Position: yylex.(*Parser).builder.NewTokenNodePosition(yyDollar[1].token, yyDollar[4].node), - ConstTkn: yyDollar[1].token, - Consts: []ast.Vertex{ - &ast.StmtConstant{ - Position: yylex.(*Parser).builder.NewTokenNodePosition(yyDollar[2].token, yyDollar[4].node), - Name: &ast.Identifier{ - Position: yylex.(*Parser).builder.NewTokenPosition(yyDollar[2].token), - IdentifierTkn: yyDollar[2].token, - Value: yyDollar[2].token.Value, - }, - EqualTkn: yyDollar[3].token, - Expr: yyDollar[4].node, - }, - }, - } - } - case 216: - yyDollar = yyS[yypt-3 : yypt+1] - // line internal/php5/php5.y:2632 - { - yyDollar[1].node.(*ast.StmtEcho).Exprs = append(yyDollar[1].node.(*ast.StmtEcho).Exprs, yyDollar[3].node) - yyDollar[1].node.(*ast.StmtEcho).SeparatorTkns = append(yyDollar[1].node.(*ast.StmtEcho).SeparatorTkns, yyDollar[2].token) - - yyVAL.node = yyDollar[1].node - } - case 217: - yyDollar = yyS[yypt-1 : yypt+1] - // line internal/php5/php5.y:2639 - { - yyVAL.node = &ast.StmtEcho{ - Exprs: []ast.Vertex{yyDollar[1].node}, - } - } - case 218: - yyDollar = yyS[yypt-0 : yypt+1] - // line internal/php5/php5.y:2649 - { - yyVAL.node = &ParserSeparatedList{} - } - case 219: - yyDollar = yyS[yypt-1 : yypt+1] - // line internal/php5/php5.y:2653 - { - yyVAL.node = yyDollar[1].node - } - case 220: - yyDollar = yyS[yypt-3 : yypt+1] - // line internal/php5/php5.y:2660 - { - yyDollar[1].node.(*ParserSeparatedList).SeparatorTkns = append(yyDollar[1].node.(*ParserSeparatedList).SeparatorTkns, yyDollar[2].token) - yyDollar[1].node.(*ParserSeparatedList).Items = append(yyDollar[1].node.(*ParserSeparatedList).Items, yyDollar[3].node) - - yyVAL.node = yyDollar[1].node - } - case 221: - yyDollar = yyS[yypt-1 : yypt+1] - // line internal/php5/php5.y:2667 - { - yyVAL.node = &ParserSeparatedList{ - Items: []ast.Vertex{yyDollar[1].node}, - } - } - case 222: - yyDollar = yyS[yypt-2 : yypt+1] - // line internal/php5/php5.y:2676 - { - yyVAL.list = append(yyDollar[1].list, yyDollar[2].list...) - } - case 223: - yyDollar = yyS[yypt-1 : yypt+1] - // line internal/php5/php5.y:2680 - { - yyVAL.list = yyDollar[1].list - } - case 224: - yyDollar = yyS[yypt-4 : yypt+1] - // line internal/php5/php5.y:2687 - { - fetch := &ast.ExprArrayDimFetch{ - Position: yylex.(*Parser).builder.NewTokensPosition(yyDollar[2].token, yyDollar[4].token), - Var: nil, - OpenBracketTkn: yyDollar[2].token, - Dim: yyDollar[3].node, - CloseBracketTkn: yyDollar[4].token, - } - - yyVAL.list = append(yyDollar[1].list, fetch) - } - case 225: - yyDollar = yyS[yypt-3 : yypt+1] - // line internal/php5/php5.y:2699 - { - fetch := &ast.ExprArrayDimFetch{ - Position: yylex.(*Parser).builder.NewTokensPosition(yyDollar[1].token, yyDollar[3].token), - Var: nil, - OpenBracketTkn: yyDollar[1].token, - Dim: yyDollar[2].node, - CloseBracketTkn: yyDollar[3].token, - } - - yyVAL.list = []ast.Vertex{fetch} - } - case 226: - yyDollar = yyS[yypt-2 : yypt+1] - // line internal/php5/php5.y:2714 - { - yyVAL.list = append(yyDollar[1].list, yyDollar[2].list...) - } - case 227: - yyDollar = yyS[yypt-1 : yypt+1] - // line internal/php5/php5.y:2718 - { - yyVAL.list = yyDollar[1].list - } - case 228: - yyDollar = yyS[yypt-1 : yypt+1] - // line internal/php5/php5.y:2722 - { - yyVAL.list = yyDollar[1].list - } - case 229: - yyDollar = yyS[yypt-0 : yypt+1] - // line internal/php5/php5.y:2729 - { - yyVAL.list = nil - } - case 230: - yyDollar = yyS[yypt-1 : yypt+1] - // line internal/php5/php5.y:2733 - { - yyVAL.list = yyDollar[1].list - } - case 231: - yyDollar = yyS[yypt-3 : yypt+1] - // line internal/php5/php5.y:2740 - { - if yyDollar[3].node != nil { - yyVAL.node = &ast.ExprNew{ - Position: yylex.(*Parser).builder.NewTokenNodePosition(yyDollar[1].token, yyDollar[3].node), - NewTkn: yyDollar[1].token, - Class: yyDollar[2].node, - OpenParenthesisTkn: yyDollar[3].node.(*ArgumentList).OpenParenthesisTkn, - Args: yyDollar[3].node.(*ArgumentList).Arguments, - SeparatorTkns: yyDollar[3].node.(*ArgumentList).SeparatorTkns, - CloseParenthesisTkn: yyDollar[3].node.(*ArgumentList).CloseParenthesisTkn, - } - } else { - yyVAL.node = &ast.ExprNew{ - Position: yylex.(*Parser).builder.NewTokenNodePosition(yyDollar[1].token, yyDollar[2].node), - NewTkn: yyDollar[1].token, - Class: yyDollar[2].node, - } - } - } - case 232: - yyDollar = yyS[yypt-6 : yypt+1] - // line internal/php5/php5.y:2763 - { - yyVAL.node = &ast.ExprAssign{ - Position: yylex.(*Parser).builder.NewTokenNodePosition(yyDollar[1].token, yyDollar[6].node), - Var: &ast.ExprList{ - Position: yylex.(*Parser).builder.NewTokensPosition(yyDollar[1].token, yyDollar[4].token), - ListTkn: yyDollar[1].token, - OpenBracketTkn: yyDollar[2].token, - Items: yyDollar[3].node.(*ParserSeparatedList).Items, - SeparatorTkns: yyDollar[3].node.(*ParserSeparatedList).SeparatorTkns, - CloseBracketTkn: yyDollar[4].token, - }, - EqualTkn: yyDollar[5].token, - Expr: yyDollar[6].node, - } - } - case 233: - yyDollar = yyS[yypt-3 : yypt+1] - // line internal/php5/php5.y:2779 - { - yyVAL.node = &ast.ExprAssign{ - Position: yylex.(*Parser).builder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node), - Var: yyDollar[1].node, - EqualTkn: yyDollar[2].token, - Expr: yyDollar[3].node, - } - } - case 234: - yyDollar = yyS[yypt-4 : yypt+1] - // line internal/php5/php5.y:2788 - { - yyVAL.node = &ast.ExprAssignReference{ - Position: yylex.(*Parser).builder.NewNodesPosition(yyDollar[1].node, yyDollar[4].node), - Var: yyDollar[1].node, - EqualTkn: yyDollar[2].token, - AmpersandTkn: yyDollar[3].token, - Expr: yyDollar[4].node, - } - } - case 235: - yyDollar = yyS[yypt-6 : yypt+1] - // line internal/php5/php5.y:2798 - { - var _new *ast.ExprNew - if yyDollar[6].node != nil { - _new = &ast.ExprNew{ - Position: yylex.(*Parser).builder.NewTokenNodePosition(yyDollar[4].token, yyDollar[6].node), - NewTkn: yyDollar[4].token, - Class: yyDollar[5].node, - OpenParenthesisTkn: yyDollar[6].node.(*ArgumentList).OpenParenthesisTkn, - Args: yyDollar[6].node.(*ArgumentList).Arguments, - SeparatorTkns: yyDollar[6].node.(*ArgumentList).SeparatorTkns, - CloseParenthesisTkn: yyDollar[6].node.(*ArgumentList).CloseParenthesisTkn, - } - } else { - _new = &ast.ExprNew{ - Position: yylex.(*Parser).builder.NewTokenNodePosition(yyDollar[4].token, yyDollar[5].node), - NewTkn: yyDollar[4].token, - Class: yyDollar[5].node, - } - } - - yyVAL.node = &ast.ExprAssignReference{ - Position: yylex.(*Parser).builder.NewNodesPosition(yyDollar[1].node, _new), - Var: yyDollar[1].node, - EqualTkn: yyDollar[2].token, - AmpersandTkn: yyDollar[3].token, - Expr: _new, - } - } - case 236: - yyDollar = yyS[yypt-2 : yypt+1] - // line internal/php5/php5.y:2827 - { - yyVAL.node = &ast.ExprClone{ - Position: yylex.(*Parser).builder.NewTokenNodePosition(yyDollar[1].token, yyDollar[2].node), - CloneTkn: yyDollar[1].token, - Expr: yyDollar[2].node, - } - } - case 237: - yyDollar = yyS[yypt-3 : yypt+1] - // line internal/php5/php5.y:2835 - { - yyVAL.node = &ast.ExprAssignPlus{ - Position: yylex.(*Parser).builder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node), - Var: yyDollar[1].node, - EqualTkn: yyDollar[2].token, - Expr: yyDollar[3].node, - } - } - case 238: - yyDollar = yyS[yypt-3 : yypt+1] - // line internal/php5/php5.y:2844 - { - yyVAL.node = &ast.ExprAssignMinus{ - Position: yylex.(*Parser).builder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node), - Var: yyDollar[1].node, - EqualTkn: yyDollar[2].token, - Expr: yyDollar[3].node, - } - } - case 239: - yyDollar = yyS[yypt-3 : yypt+1] - // line internal/php5/php5.y:2853 - { - yyVAL.node = &ast.ExprAssignMul{ - Position: yylex.(*Parser).builder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node), - Var: yyDollar[1].node, - EqualTkn: yyDollar[2].token, - Expr: yyDollar[3].node, - } - } - case 240: - yyDollar = yyS[yypt-3 : yypt+1] - // line internal/php5/php5.y:2862 - { - yyVAL.node = &ast.ExprAssignPow{ - Position: yylex.(*Parser).builder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node), - Var: yyDollar[1].node, - EqualTkn: yyDollar[2].token, - Expr: yyDollar[3].node, - } - } - case 241: - yyDollar = yyS[yypt-3 : yypt+1] - // line internal/php5/php5.y:2871 - { - yyVAL.node = &ast.ExprAssignDiv{ - Position: yylex.(*Parser).builder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node), - Var: yyDollar[1].node, - EqualTkn: yyDollar[2].token, - Expr: yyDollar[3].node, - } - } - case 242: - yyDollar = yyS[yypt-3 : yypt+1] - // line internal/php5/php5.y:2880 - { - yyVAL.node = &ast.ExprAssignConcat{ - Position: yylex.(*Parser).builder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node), - Var: yyDollar[1].node, - EqualTkn: yyDollar[2].token, - Expr: yyDollar[3].node, - } - } - case 243: - yyDollar = yyS[yypt-3 : yypt+1] - // line internal/php5/php5.y:2889 - { - yyVAL.node = &ast.ExprAssignMod{ - Position: yylex.(*Parser).builder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node), - Var: yyDollar[1].node, - EqualTkn: yyDollar[2].token, - Expr: yyDollar[3].node, - } - } - case 244: - yyDollar = yyS[yypt-3 : yypt+1] - // line internal/php5/php5.y:2898 - { - yyVAL.node = &ast.ExprAssignBitwiseAnd{ - Position: yylex.(*Parser).builder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node), - Var: yyDollar[1].node, - EqualTkn: yyDollar[2].token, - Expr: yyDollar[3].node, - } - } - case 245: - yyDollar = yyS[yypt-3 : yypt+1] - // line internal/php5/php5.y:2907 - { - yyVAL.node = &ast.ExprAssignBitwiseOr{ - Position: yylex.(*Parser).builder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node), - Var: yyDollar[1].node, - EqualTkn: yyDollar[2].token, - Expr: yyDollar[3].node, - } - } - case 246: - yyDollar = yyS[yypt-3 : yypt+1] - // line internal/php5/php5.y:2916 - { - yyVAL.node = &ast.ExprAssignBitwiseXor{ - Position: yylex.(*Parser).builder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node), - Var: yyDollar[1].node, - EqualTkn: yyDollar[2].token, - Expr: yyDollar[3].node, - } - } - case 247: - yyDollar = yyS[yypt-3 : yypt+1] - // line internal/php5/php5.y:2925 - { - yyVAL.node = &ast.ExprAssignShiftLeft{ - Position: yylex.(*Parser).builder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node), - Var: yyDollar[1].node, - EqualTkn: yyDollar[2].token, - Expr: yyDollar[3].node, - } - } - case 248: - yyDollar = yyS[yypt-3 : yypt+1] - // line internal/php5/php5.y:2934 - { - yyVAL.node = &ast.ExprAssignShiftRight{ - Position: yylex.(*Parser).builder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node), - Var: yyDollar[1].node, - EqualTkn: yyDollar[2].token, - Expr: yyDollar[3].node, - } - } - case 249: - yyDollar = yyS[yypt-2 : yypt+1] - // line internal/php5/php5.y:2943 - { - yyVAL.node = &ast.ExprPostInc{ - Position: yylex.(*Parser).builder.NewNodeTokenPosition(yyDollar[1].node, yyDollar[2].token), - Var: yyDollar[1].node, - IncTkn: yyDollar[2].token, - } - } - case 250: - yyDollar = yyS[yypt-2 : yypt+1] - // line internal/php5/php5.y:2951 - { - yyVAL.node = &ast.ExprPreInc{ - Position: yylex.(*Parser).builder.NewTokenNodePosition(yyDollar[1].token, yyDollar[2].node), - IncTkn: yyDollar[1].token, - Var: yyDollar[2].node, - } - } - case 251: - yyDollar = yyS[yypt-2 : yypt+1] - // line internal/php5/php5.y:2959 - { - yyVAL.node = &ast.ExprPostDec{ - Position: yylex.(*Parser).builder.NewNodeTokenPosition(yyDollar[1].node, yyDollar[2].token), - Var: yyDollar[1].node, - DecTkn: yyDollar[2].token, - } - } - case 252: - yyDollar = yyS[yypt-2 : yypt+1] - // line internal/php5/php5.y:2967 - { - yyVAL.node = &ast.ExprPreDec{ - Position: yylex.(*Parser).builder.NewTokenNodePosition(yyDollar[1].token, yyDollar[2].node), - DecTkn: yyDollar[1].token, - Var: yyDollar[2].node, - } - } - case 253: - yyDollar = yyS[yypt-3 : yypt+1] - // line internal/php5/php5.y:2975 - { - yyVAL.node = &ast.ExprBinaryBooleanOr{ - Position: yylex.(*Parser).builder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node), - Left: yyDollar[1].node, - OpTkn: yyDollar[2].token, - Right: yyDollar[3].node, - } - } - case 254: - yyDollar = yyS[yypt-3 : yypt+1] - // line internal/php5/php5.y:2984 - { - yyVAL.node = &ast.ExprBinaryBooleanAnd{ - Position: yylex.(*Parser).builder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node), - Left: yyDollar[1].node, - OpTkn: yyDollar[2].token, - Right: yyDollar[3].node, - } - } - case 255: - yyDollar = yyS[yypt-3 : yypt+1] - // line internal/php5/php5.y:2993 - { - yyVAL.node = &ast.ExprBinaryLogicalOr{ - Position: yylex.(*Parser).builder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node), - Left: yyDollar[1].node, - OpTkn: yyDollar[2].token, - Right: yyDollar[3].node, - } - } - case 256: - yyDollar = yyS[yypt-3 : yypt+1] - // line internal/php5/php5.y:3002 - { - yyVAL.node = &ast.ExprBinaryLogicalAnd{ - Position: yylex.(*Parser).builder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node), - Left: yyDollar[1].node, - OpTkn: yyDollar[2].token, - Right: yyDollar[3].node, - } - } - case 257: - yyDollar = yyS[yypt-3 : yypt+1] - // line internal/php5/php5.y:3011 - { - yyVAL.node = &ast.ExprBinaryLogicalXor{ - Position: yylex.(*Parser).builder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node), - Left: yyDollar[1].node, - OpTkn: yyDollar[2].token, - Right: yyDollar[3].node, - } - } - case 258: - yyDollar = yyS[yypt-3 : yypt+1] - // line internal/php5/php5.y:3020 - { - yyVAL.node = &ast.ExprBinaryBitwiseOr{ - Position: yylex.(*Parser).builder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node), - Left: yyDollar[1].node, - OpTkn: yyDollar[2].token, - Right: yyDollar[3].node, - } - } - case 259: - yyDollar = yyS[yypt-3 : yypt+1] - // line internal/php5/php5.y:3029 - { - yyVAL.node = &ast.ExprBinaryBitwiseAnd{ - Position: yylex.(*Parser).builder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node), - Left: yyDollar[1].node, - OpTkn: yyDollar[2].token, - Right: yyDollar[3].node, - } - } - case 260: - yyDollar = yyS[yypt-3 : yypt+1] - // line internal/php5/php5.y:3038 - { - yyVAL.node = &ast.ExprBinaryBitwiseXor{ - Position: yylex.(*Parser).builder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node), - Left: yyDollar[1].node, - OpTkn: yyDollar[2].token, - Right: yyDollar[3].node, - } - } - case 261: - yyDollar = yyS[yypt-3 : yypt+1] - // line internal/php5/php5.y:3047 - { - yyVAL.node = &ast.ExprBinaryConcat{ - Position: yylex.(*Parser).builder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node), - Left: yyDollar[1].node, - OpTkn: yyDollar[2].token, - Right: yyDollar[3].node, - } - } - case 262: - yyDollar = yyS[yypt-3 : yypt+1] - // line internal/php5/php5.y:3056 - { - yyVAL.node = &ast.ExprBinaryPlus{ - Position: yylex.(*Parser).builder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node), - Left: yyDollar[1].node, - OpTkn: yyDollar[2].token, - Right: yyDollar[3].node, - } - } - case 263: - yyDollar = yyS[yypt-3 : yypt+1] - // line internal/php5/php5.y:3065 - { - yyVAL.node = &ast.ExprBinaryMinus{ - Position: yylex.(*Parser).builder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node), - Left: yyDollar[1].node, - OpTkn: yyDollar[2].token, - Right: yyDollar[3].node, - } - } - case 264: - yyDollar = yyS[yypt-3 : yypt+1] - // line internal/php5/php5.y:3074 - { - yyVAL.node = &ast.ExprBinaryMul{ - Position: yylex.(*Parser).builder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node), - Left: yyDollar[1].node, - OpTkn: yyDollar[2].token, - Right: yyDollar[3].node, - } - } - case 265: - yyDollar = yyS[yypt-3 : yypt+1] - // line internal/php5/php5.y:3083 - { - yyVAL.node = &ast.ExprBinaryPow{ - Position: yylex.(*Parser).builder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node), - Left: yyDollar[1].node, - OpTkn: yyDollar[2].token, - Right: yyDollar[3].node, - } - } - case 266: - yyDollar = yyS[yypt-3 : yypt+1] - // line internal/php5/php5.y:3092 - { - yyVAL.node = &ast.ExprBinaryDiv{ - Position: yylex.(*Parser).builder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node), - Left: yyDollar[1].node, - OpTkn: yyDollar[2].token, - Right: yyDollar[3].node, - } - } - case 267: - yyDollar = yyS[yypt-3 : yypt+1] - // line internal/php5/php5.y:3101 - { - yyVAL.node = &ast.ExprBinaryMod{ - Position: yylex.(*Parser).builder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node), - Left: yyDollar[1].node, - OpTkn: yyDollar[2].token, - Right: yyDollar[3].node, - } - } - case 268: - yyDollar = yyS[yypt-3 : yypt+1] - // line internal/php5/php5.y:3110 - { - yyVAL.node = &ast.ExprBinaryShiftLeft{ - Position: yylex.(*Parser).builder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node), - Left: yyDollar[1].node, - OpTkn: yyDollar[2].token, - Right: yyDollar[3].node, - } - } - case 269: - yyDollar = yyS[yypt-3 : yypt+1] - // line internal/php5/php5.y:3119 - { - yyVAL.node = &ast.ExprBinaryShiftRight{ - Position: yylex.(*Parser).builder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node), - Left: yyDollar[1].node, - OpTkn: yyDollar[2].token, - Right: yyDollar[3].node, - } - } - case 270: - yyDollar = yyS[yypt-2 : yypt+1] - // line internal/php5/php5.y:3128 - { - yyVAL.node = &ast.ExprUnaryPlus{ - Position: yylex.(*Parser).builder.NewTokenNodePosition(yyDollar[1].token, yyDollar[2].node), - PlusTkn: yyDollar[1].token, - Expr: yyDollar[2].node, - } - } - case 271: - yyDollar = yyS[yypt-2 : yypt+1] - // line internal/php5/php5.y:3136 - { - yyVAL.node = &ast.ExprUnaryMinus{ - Position: yylex.(*Parser).builder.NewTokenNodePosition(yyDollar[1].token, yyDollar[2].node), - MinusTkn: yyDollar[1].token, - Expr: yyDollar[2].node, - } - } - case 272: - yyDollar = yyS[yypt-2 : yypt+1] - // line internal/php5/php5.y:3144 - { - yyVAL.node = &ast.ExprBooleanNot{ - Position: yylex.(*Parser).builder.NewTokenNodePosition(yyDollar[1].token, yyDollar[2].node), - ExclamationTkn: yyDollar[1].token, - Expr: yyDollar[2].node, - } - } - case 273: - yyDollar = yyS[yypt-2 : yypt+1] - // line internal/php5/php5.y:3152 - { - yyVAL.node = &ast.ExprBitwiseNot{ - Position: yylex.(*Parser).builder.NewTokenNodePosition(yyDollar[1].token, yyDollar[2].node), - TildaTkn: yyDollar[1].token, - Expr: yyDollar[2].node, - } - } - case 274: - yyDollar = yyS[yypt-3 : yypt+1] - // line internal/php5/php5.y:3160 - { - yyVAL.node = &ast.ExprBinaryIdentical{ - Position: yylex.(*Parser).builder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node), - Left: yyDollar[1].node, - OpTkn: yyDollar[2].token, - Right: yyDollar[3].node, - } - } - case 275: - yyDollar = yyS[yypt-3 : yypt+1] - // line internal/php5/php5.y:3169 - { - yyVAL.node = &ast.ExprBinaryNotIdentical{ - Position: yylex.(*Parser).builder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node), - Left: yyDollar[1].node, - OpTkn: yyDollar[2].token, - Right: yyDollar[3].node, - } - } - case 276: - yyDollar = yyS[yypt-3 : yypt+1] - // line internal/php5/php5.y:3178 - { - yyVAL.node = &ast.ExprBinaryEqual{ - Position: yylex.(*Parser).builder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node), - Left: yyDollar[1].node, - OpTkn: yyDollar[2].token, - Right: yyDollar[3].node, - } - } - case 277: - yyDollar = yyS[yypt-3 : yypt+1] - // line internal/php5/php5.y:3187 - { - yyVAL.node = &ast.ExprBinaryNotEqual{ - Position: yylex.(*Parser).builder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node), - Left: yyDollar[1].node, - OpTkn: yyDollar[2].token, - Right: yyDollar[3].node, - } - } - case 278: - yyDollar = yyS[yypt-3 : yypt+1] - // line internal/php5/php5.y:3196 - { - yyVAL.node = &ast.ExprBinarySmaller{ - Position: yylex.(*Parser).builder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node), - Left: yyDollar[1].node, - OpTkn: yyDollar[2].token, - Right: yyDollar[3].node, - } - } - case 279: - yyDollar = yyS[yypt-3 : yypt+1] - // line internal/php5/php5.y:3205 - { - yyVAL.node = &ast.ExprBinarySmallerOrEqual{ - Position: yylex.(*Parser).builder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node), - Left: yyDollar[1].node, - OpTkn: yyDollar[2].token, - Right: yyDollar[3].node, - } - } - case 280: - yyDollar = yyS[yypt-3 : yypt+1] - // line internal/php5/php5.y:3214 - { - yyVAL.node = &ast.ExprBinaryGreater{ - Position: yylex.(*Parser).builder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node), - Left: yyDollar[1].node, - OpTkn: yyDollar[2].token, - Right: yyDollar[3].node, - } - } - case 281: - yyDollar = yyS[yypt-3 : yypt+1] - // line internal/php5/php5.y:3223 - { - yyVAL.node = &ast.ExprBinaryGreaterOrEqual{ - Position: yylex.(*Parser).builder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node), - Left: yyDollar[1].node, - OpTkn: yyDollar[2].token, - Right: yyDollar[3].node, - } - } - case 282: - yyDollar = yyS[yypt-3 : yypt+1] - // line internal/php5/php5.y:3232 - { - yyVAL.node = &ast.ExprInstanceOf{ - Position: yylex.(*Parser).builder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node), - Expr: yyDollar[1].node, - InstanceOfTkn: yyDollar[2].token, - Class: yyDollar[3].node, - } - } - case 283: - yyDollar = yyS[yypt-1 : yypt+1] - // line internal/php5/php5.y:3241 - { - yyVAL.node = yyDollar[1].node - } - case 284: - yyDollar = yyS[yypt-1 : yypt+1] - // line internal/php5/php5.y:3245 - { - yyVAL.node = yyDollar[1].node - } - case 285: - yyDollar = yyS[yypt-4 : yypt+1] - // line internal/php5/php5.y:3249 - { - yyVAL.node = &ast.ExprBrackets{ - Position: yylex.(*Parser).builder.NewTokensPosition(yyDollar[1].token, yyDollar[3].token), - OpenParenthesisTkn: yyDollar[1].token, - Expr: yyDollar[2].node, - CloseParenthesisTkn: yyDollar[3].token, - } - - for _, n := range yyDollar[4].list { - switch nn := n.(type) { - case *ast.ExprFunctionCall: - nn.Function = yyVAL.node - nn.Position = yylex.(*Parser).builder.NewNodesPosition(yyVAL.node, nn) - yyVAL.node = nn - - case *ast.ExprArrayDimFetch: - nn.Var = yyVAL.node - nn.Position = yylex.(*Parser).builder.NewNodesPosition(yyVAL.node, nn) - yyVAL.node = nn - - case *ast.ExprPropertyFetch: - nn.Var = yyVAL.node - nn.Position = yylex.(*Parser).builder.NewNodesPosition(yyVAL.node, nn) - yyVAL.node = nn - - case *ast.ExprMethodCall: - nn.Var = yyVAL.node - nn.Position = yylex.(*Parser).builder.NewNodesPosition(yyVAL.node, nn) - yyVAL.node = nn - } - } - } - case 286: - yyDollar = yyS[yypt-5 : yypt+1] - // line internal/php5/php5.y:3282 - { - yyVAL.node = &ast.ExprTernary{ - Position: yylex.(*Parser).builder.NewNodesPosition(yyDollar[1].node, yyDollar[5].node), - Cond: yyDollar[1].node, - QuestionTkn: yyDollar[2].token, - IfTrue: yyDollar[3].node, - ColonTkn: yyDollar[4].token, - IfFalse: yyDollar[5].node, - } - } - case 287: - yyDollar = yyS[yypt-4 : yypt+1] - // line internal/php5/php5.y:3293 - { - yyVAL.node = &ast.ExprTernary{ - Position: yylex.(*Parser).builder.NewNodesPosition(yyDollar[1].node, yyDollar[4].node), - Cond: yyDollar[1].node, - QuestionTkn: yyDollar[2].token, - ColonTkn: yyDollar[3].token, - IfFalse: yyDollar[4].node, - } - } - case 288: - yyDollar = yyS[yypt-1 : yypt+1] - // line internal/php5/php5.y:3303 - { - yyVAL.node = yyDollar[1].node - } - case 289: - yyDollar = yyS[yypt-2 : yypt+1] - // line internal/php5/php5.y:3307 - { - yyVAL.node = &ast.ExprCastInt{ - Position: yylex.(*Parser).builder.NewTokenNodePosition(yyDollar[1].token, yyDollar[2].node), - CastTkn: yyDollar[1].token, - Expr: yyDollar[2].node, - } - } - case 290: - yyDollar = yyS[yypt-2 : yypt+1] - // line internal/php5/php5.y:3315 - { - yyVAL.node = &ast.ExprCastDouble{ - Position: yylex.(*Parser).builder.NewTokenNodePosition(yyDollar[1].token, yyDollar[2].node), - CastTkn: yyDollar[1].token, - Expr: yyDollar[2].node, - } - } - case 291: - yyDollar = yyS[yypt-2 : yypt+1] - // line internal/php5/php5.y:3323 - { - yyVAL.node = &ast.ExprCastString{ - Position: yylex.(*Parser).builder.NewTokenNodePosition(yyDollar[1].token, yyDollar[2].node), - CastTkn: yyDollar[1].token, - Expr: yyDollar[2].node, - } - } - case 292: - yyDollar = yyS[yypt-2 : yypt+1] - // line internal/php5/php5.y:3331 - { - yyVAL.node = &ast.ExprCastArray{ - Position: yylex.(*Parser).builder.NewTokenNodePosition(yyDollar[1].token, yyDollar[2].node), - CastTkn: yyDollar[1].token, - Expr: yyDollar[2].node, - } - } - case 293: - yyDollar = yyS[yypt-2 : yypt+1] - // line internal/php5/php5.y:3339 - { - yyVAL.node = &ast.ExprCastObject{ - Position: yylex.(*Parser).builder.NewTokenNodePosition(yyDollar[1].token, yyDollar[2].node), - CastTkn: yyDollar[1].token, - Expr: yyDollar[2].node, - } - } - case 294: - yyDollar = yyS[yypt-2 : yypt+1] - // line internal/php5/php5.y:3347 - { - yyVAL.node = &ast.ExprCastBool{ - Position: yylex.(*Parser).builder.NewTokenNodePosition(yyDollar[1].token, yyDollar[2].node), - CastTkn: yyDollar[1].token, - Expr: yyDollar[2].node, - } - } - case 295: - yyDollar = yyS[yypt-2 : yypt+1] - // line internal/php5/php5.y:3355 - { - yyVAL.node = &ast.ExprCastUnset{ - Position: yylex.(*Parser).builder.NewTokenNodePosition(yyDollar[1].token, yyDollar[2].node), - CastTkn: yyDollar[1].token, - Expr: yyDollar[2].node, - } - } - case 296: - yyDollar = yyS[yypt-2 : yypt+1] - // line internal/php5/php5.y:3363 - { - exit := &ast.ExprExit{ - ExitTkn: yyDollar[1].token, - } - - if yyDollar[2].node == nil { - exit.Position = yylex.(*Parser).builder.NewTokenPosition(yyDollar[1].token) - } else { - exit.Position = yylex.(*Parser).builder.NewTokenNodePosition(yyDollar[1].token, yyDollar[2].node) - exit.OpenParenthesisTkn = yyDollar[2].node.(*ast.ExprBrackets).OpenParenthesisTkn - exit.Expr = yyDollar[2].node.(*ast.ExprBrackets).Expr - exit.CloseParenthesisTkn = yyDollar[2].node.(*ast.ExprBrackets).CloseParenthesisTkn - } - - yyVAL.node = exit - } - case 297: - yyDollar = yyS[yypt-2 : yypt+1] - // line internal/php5/php5.y:3380 - { - yyVAL.node = &ast.ExprErrorSuppress{ - Position: yylex.(*Parser).builder.NewTokenNodePosition(yyDollar[1].token, yyDollar[2].node), - AtTkn: yyDollar[1].token, - Expr: yyDollar[2].node, - } - } - case 298: - yyDollar = yyS[yypt-1 : yypt+1] - // line internal/php5/php5.y:3388 - { - yyVAL.node = yyDollar[1].node - } - case 299: - yyDollar = yyS[yypt-1 : yypt+1] - // line internal/php5/php5.y:3392 - { - yyVAL.node = yyDollar[1].node - } - case 300: - yyDollar = yyS[yypt-1 : yypt+1] - // line internal/php5/php5.y:3396 - { - yyVAL.node = yyDollar[1].node - } - case 301: - yyDollar = yyS[yypt-3 : yypt+1] - // line internal/php5/php5.y:3400 - { - yyVAL.node = &ast.ExprShellExec{ - Position: yylex.(*Parser).builder.NewTokensPosition(yyDollar[1].token, yyDollar[3].token), - OpenBacktickTkn: yyDollar[1].token, - Parts: yyDollar[2].list, - CloseBacktickTkn: yyDollar[3].token, - } - } - case 302: - yyDollar = yyS[yypt-2 : yypt+1] - // line internal/php5/php5.y:3409 - { - yyVAL.node = &ast.ExprPrint{ - Position: yylex.(*Parser).builder.NewTokenNodePosition(yyDollar[1].token, yyDollar[2].node), - PrintTkn: yyDollar[1].token, - Expr: yyDollar[2].node, - } - } - case 303: - yyDollar = yyS[yypt-1 : yypt+1] - // line internal/php5/php5.y:3417 - { - yyVAL.node = &ast.ExprYield{ - Position: yylex.(*Parser).builder.NewTokenPosition(yyDollar[1].token), - YieldTkn: yyDollar[1].token, - } - } - case 304: - yyDollar = yyS[yypt-9 : yypt+1] - // line internal/php5/php5.y:3424 - { - closure := yyDollar[6].node.(*ast.ExprClosure) - - closure.Position = yylex.(*Parser).builder.NewTokensPosition(yyDollar[1].token, yyDollar[9].token) - closure.FunctionTkn = yyDollar[1].token - closure.AmpersandTkn = yyDollar[2].token - closure.OpenParenthesisTkn = yyDollar[3].token - closure.Params = yyDollar[4].node.(*ParserSeparatedList).Items - closure.SeparatorTkns = yyDollar[4].node.(*ParserSeparatedList).SeparatorTkns - closure.CloseParenthesisTkn = yyDollar[5].token - closure.OpenCurlyBracketTkn = yyDollar[7].token - closure.Stmts = yyDollar[8].list - closure.CloseCurlyBracketTkn = yyDollar[9].token - - yyVAL.node = closure - } - case 305: - yyDollar = yyS[yypt-10 : yypt+1] - // line internal/php5/php5.y:3441 - { - closure := yyDollar[7].node.(*ast.ExprClosure) - - closure.Position = yylex.(*Parser).builder.NewTokensPosition(yyDollar[1].token, yyDollar[10].token) - closure.StaticTkn = yyDollar[1].token - closure.FunctionTkn = yyDollar[2].token - closure.AmpersandTkn = yyDollar[3].token - closure.OpenParenthesisTkn = yyDollar[4].token - closure.Params = yyDollar[5].node.(*ParserSeparatedList).Items - closure.SeparatorTkns = yyDollar[5].node.(*ParserSeparatedList).SeparatorTkns - closure.CloseParenthesisTkn = yyDollar[6].token - closure.OpenCurlyBracketTkn = yyDollar[8].token - closure.Stmts = yyDollar[9].list - closure.CloseCurlyBracketTkn = yyDollar[10].token - - yyVAL.node = closure - } - case 306: - yyDollar = yyS[yypt-2 : yypt+1] - // line internal/php5/php5.y:3462 - { - yyVAL.node = &ast.ExprYield{ - Position: yylex.(*Parser).builder.NewTokenNodePosition(yyDollar[1].token, yyDollar[2].node), - YieldTkn: yyDollar[1].token, - Val: yyDollar[2].node, - } - } - case 307: - yyDollar = yyS[yypt-2 : yypt+1] - // line internal/php5/php5.y:3470 - { - yyVAL.node = &ast.ExprYield{ - Position: yylex.(*Parser).builder.NewTokenNodePosition(yyDollar[1].token, yyDollar[2].node), - YieldTkn: yyDollar[1].token, - Val: yyDollar[2].node, - } - } - case 308: - yyDollar = yyS[yypt-4 : yypt+1] - // line internal/php5/php5.y:3478 - { - yyVAL.node = &ast.ExprYield{ - Position: yylex.(*Parser).builder.NewTokenNodePosition(yyDollar[1].token, yyDollar[4].node), - YieldTkn: yyDollar[1].token, - Key: yyDollar[2].node, - DoubleArrowTkn: yyDollar[3].token, - Val: yyDollar[4].node, - } - } - case 309: - yyDollar = yyS[yypt-4 : yypt+1] - // line internal/php5/php5.y:3488 - { - yyVAL.node = &ast.ExprYield{ - Position: yylex.(*Parser).builder.NewTokenNodePosition(yyDollar[1].token, yyDollar[4].node), - YieldTkn: yyDollar[1].token, - Key: yyDollar[2].node, - DoubleArrowTkn: yyDollar[3].token, - Val: yyDollar[4].node, - } - } - case 310: - yyDollar = yyS[yypt-4 : yypt+1] - // line internal/php5/php5.y:3501 - { - yyVAL.node = &ast.ExprArrayDimFetch{ - Position: yylex.(*Parser).builder.NewNodeTokenPosition(yyDollar[1].node, yyDollar[4].token), - Var: yyDollar[1].node, - OpenBracketTkn: yyDollar[2].token, - Dim: yyDollar[3].node, - CloseBracketTkn: yyDollar[4].token, - } - } - case 311: - yyDollar = yyS[yypt-4 : yypt+1] - // line internal/php5/php5.y:3511 - { - yyVAL.node = &ast.ExprArrayDimFetch{ - Position: yylex.(*Parser).builder.NewNodeTokenPosition(yyDollar[1].node, yyDollar[4].token), - Var: yyDollar[1].node, - OpenBracketTkn: yyDollar[2].token, - Dim: yyDollar[3].node, - CloseBracketTkn: yyDollar[4].token, - } - } - case 312: - yyDollar = yyS[yypt-4 : yypt+1] - // line internal/php5/php5.y:3521 - { - yyVAL.node = &ast.ExprArrayDimFetch{ - Position: yylex.(*Parser).builder.NewTokensPosition(yyDollar[1].token, yyDollar[4].token), - Var: &ast.ScalarString{ - Position: yylex.(*Parser).builder.NewTokenPosition(yyDollar[1].token), - StringTkn: yyDollar[1].token, - Value: yyDollar[1].token.Value, - }, - OpenBracketTkn: yyDollar[2].token, - Dim: yyDollar[3].node, - CloseBracketTkn: yyDollar[4].token, - } - } - case 313: - yyDollar = yyS[yypt-4 : yypt+1] - // line internal/php5/php5.y:3535 - { - yyVAL.node = &ast.ExprArrayDimFetch{ - Position: yylex.(*Parser).builder.NewNodeTokenPosition(yyDollar[1].node, yyDollar[4].token), - Var: yyDollar[1].node, - OpenBracketTkn: yyDollar[2].token, - Dim: yyDollar[3].node, - CloseBracketTkn: yyDollar[4].token, - } - } - case 314: - yyDollar = yyS[yypt-4 : yypt+1] - // line internal/php5/php5.y:3548 - { - yyVAL.node = &ast.ExprArray{ - Position: yylex.(*Parser).builder.NewTokensPosition(yyDollar[1].token, yyDollar[4].token), - ArrayTkn: yyDollar[1].token, - OpenBracketTkn: yyDollar[2].token, - Items: yyDollar[3].node.(*ParserSeparatedList).Items, - SeparatorTkns: yyDollar[3].node.(*ParserSeparatedList).SeparatorTkns, - CloseBracketTkn: yyDollar[4].token, - } - } - case 315: - yyDollar = yyS[yypt-3 : yypt+1] - // line internal/php5/php5.y:3559 - { - yyVAL.node = &ast.ExprArray{ - Position: yylex.(*Parser).builder.NewTokensPosition(yyDollar[1].token, yyDollar[3].token), - OpenBracketTkn: yyDollar[1].token, - Items: yyDollar[2].node.(*ParserSeparatedList).Items, - SeparatorTkns: yyDollar[2].node.(*ParserSeparatedList).SeparatorTkns, - CloseBracketTkn: yyDollar[3].token, - } - } - case 316: - yyDollar = yyS[yypt-1 : yypt+1] - // line internal/php5/php5.y:3572 - { - yyVAL.token = yyDollar[1].token - } - case 317: - yyDollar = yyS[yypt-0 : yypt+1] - // line internal/php5/php5.y:3579 - { - yyVAL.node = &ast.ExprClosure{} - } - case 318: - yyDollar = yyS[yypt-4 : yypt+1] - // line internal/php5/php5.y:3583 - { - yyVAL.node = &ast.ExprClosure{ - UseTkn: yyDollar[1].token, - UseOpenParenthesisTkn: yyDollar[2].token, - Uses: yyDollar[3].node.(*ParserSeparatedList).Items, - UseSeparatorTkns: yyDollar[3].node.(*ParserSeparatedList).SeparatorTkns, - UseCloseParenthesisTkn: yyDollar[4].token, - } - } - case 319: - yyDollar = yyS[yypt-3 : yypt+1] - // line internal/php5/php5.y:3596 - { - variable := &ast.ExprClosureUse{ - Position: yylex.(*Parser).builder.NewTokenPosition(yyDollar[3].token), - Var: &ast.ExprVariable{ - Position: yylex.(*Parser).builder.NewTokenPosition(yyDollar[3].token), - Name: &ast.Identifier{ - Position: yylex.(*Parser).builder.NewTokenPosition(yyDollar[3].token), - IdentifierTkn: yyDollar[3].token, - Value: yyDollar[3].token.Value, - }, - }, - } - - yyDollar[1].node.(*ParserSeparatedList).SeparatorTkns = append(yyDollar[1].node.(*ParserSeparatedList).SeparatorTkns, yyDollar[2].token) - yyDollar[1].node.(*ParserSeparatedList).Items = append(yyDollar[1].node.(*ParserSeparatedList).Items, variable) - - yyVAL.node = yyDollar[1].node - } - case 320: - yyDollar = yyS[yypt-4 : yypt+1] - // line internal/php5/php5.y:3615 - { - variable := &ast.ExprClosureUse{ - Position: yylex.(*Parser).builder.NewTokensPosition(yyDollar[3].token, yyDollar[4].token), - AmpersandTkn: yyDollar[3].token, - Var: &ast.ExprVariable{ - Position: yylex.(*Parser).builder.NewTokenPosition(yyDollar[4].token), - Name: &ast.Identifier{ - Position: yylex.(*Parser).builder.NewTokenPosition(yyDollar[4].token), - IdentifierTkn: yyDollar[4].token, - Value: yyDollar[4].token.Value, - }, - }, - } - - yyDollar[1].node.(*ParserSeparatedList).SeparatorTkns = append(yyDollar[1].node.(*ParserSeparatedList).SeparatorTkns, yyDollar[2].token) - yyDollar[1].node.(*ParserSeparatedList).Items = append(yyDollar[1].node.(*ParserSeparatedList).Items, variable) - - yyVAL.node = yyDollar[1].node - } - case 321: - yyDollar = yyS[yypt-1 : yypt+1] - // line internal/php5/php5.y:3635 - { - variable := &ast.ExprClosureUse{ - Position: yylex.(*Parser).builder.NewTokenPosition(yyDollar[1].token), - Var: &ast.ExprVariable{ - Position: yylex.(*Parser).builder.NewTokenPosition(yyDollar[1].token), - Name: &ast.Identifier{ - Position: yylex.(*Parser).builder.NewTokenPosition(yyDollar[1].token), - IdentifierTkn: yyDollar[1].token, - Value: yyDollar[1].token.Value, - }, - }, - } - - yyVAL.node = &ParserSeparatedList{ - Items: []ast.Vertex{variable}, - } - } - case 322: - yyDollar = yyS[yypt-2 : yypt+1] - // line internal/php5/php5.y:3653 - { - variable := &ast.ExprClosureUse{ - Position: yylex.(*Parser).builder.NewTokensPosition(yyDollar[1].token, yyDollar[2].token), - AmpersandTkn: yyDollar[1].token, - Var: &ast.ExprVariable{ - Position: yylex.(*Parser).builder.NewTokenPosition(yyDollar[2].token), - Name: &ast.Identifier{ - Position: yylex.(*Parser).builder.NewTokenPosition(yyDollar[2].token), - IdentifierTkn: yyDollar[2].token, - Value: yyDollar[2].token.Value, - }, - }, - } - - yyVAL.node = &ParserSeparatedList{ - Items: []ast.Vertex{variable}, - } - } - case 323: - yyDollar = yyS[yypt-2 : yypt+1] - // line internal/php5/php5.y:3675 - { - yyVAL.node = &ast.ExprFunctionCall{ - Position: yylex.(*Parser).builder.NewNodeListNodePosition(yyDollar[1].node.(*ParserSeparatedList).Items, yyDollar[2].node), - Function: &ast.Name{ - Position: yylex.(*Parser).builder.NewNodeListPosition(yyDollar[1].node.(*ParserSeparatedList).Items), - Parts: yyDollar[1].node.(*ParserSeparatedList).Items, - SeparatorTkns: yyDollar[1].node.(*ParserSeparatedList).SeparatorTkns, - }, - OpenParenthesisTkn: yyDollar[2].node.(*ArgumentList).OpenParenthesisTkn, - Args: yyDollar[2].node.(*ArgumentList).Arguments, - SeparatorTkns: yyDollar[2].node.(*ArgumentList).SeparatorTkns, - CloseParenthesisTkn: yyDollar[2].node.(*ArgumentList).CloseParenthesisTkn, - } - } - case 324: - yyDollar = yyS[yypt-4 : yypt+1] - // line internal/php5/php5.y:3690 - { - yyVAL.node = &ast.ExprFunctionCall{ - Position: yylex.(*Parser).builder.NewTokenNodePosition(yyDollar[1].token, yyDollar[4].node), - Function: &ast.NameRelative{ - Position: yylex.(*Parser).builder.NewTokenNodeListPosition(yyDollar[1].token, yyDollar[3].node.(*ParserSeparatedList).Items), - NsTkn: yyDollar[1].token, - NsSeparatorTkn: yyDollar[2].token, - Parts: yyDollar[3].node.(*ParserSeparatedList).Items, - SeparatorTkns: yyDollar[3].node.(*ParserSeparatedList).SeparatorTkns, - }, - OpenParenthesisTkn: yyDollar[4].node.(*ArgumentList).OpenParenthesisTkn, - Args: yyDollar[4].node.(*ArgumentList).Arguments, - SeparatorTkns: yyDollar[4].node.(*ArgumentList).SeparatorTkns, - CloseParenthesisTkn: yyDollar[4].node.(*ArgumentList).CloseParenthesisTkn, - } - } - case 325: - yyDollar = yyS[yypt-3 : yypt+1] - // line internal/php5/php5.y:3707 - { - yyVAL.node = &ast.ExprFunctionCall{ - Position: yylex.(*Parser).builder.NewTokenNodePosition(yyDollar[1].token, yyDollar[3].node), - Function: &ast.NameFullyQualified{ - Position: yylex.(*Parser).builder.NewTokenNodeListPosition(yyDollar[1].token, yyDollar[2].node.(*ParserSeparatedList).Items), - NsSeparatorTkn: yyDollar[1].token, - Parts: yyDollar[2].node.(*ParserSeparatedList).Items, - SeparatorTkns: yyDollar[2].node.(*ParserSeparatedList).SeparatorTkns, - }, - OpenParenthesisTkn: yyDollar[3].node.(*ArgumentList).OpenParenthesisTkn, - Args: yyDollar[3].node.(*ArgumentList).Arguments, - SeparatorTkns: yyDollar[3].node.(*ArgumentList).SeparatorTkns, - CloseParenthesisTkn: yyDollar[3].node.(*ArgumentList).CloseParenthesisTkn, - } - } - case 326: - yyDollar = yyS[yypt-4 : yypt+1] - // line internal/php5/php5.y:3723 - { - staticCall := &ast.ExprStaticCall{ - Position: yylex.(*Parser).builder.NewNodesPosition(yyDollar[1].node, yyDollar[4].node), - Class: yyDollar[1].node, - DoubleColonTkn: yyDollar[2].token, - Call: yyDollar[3].node, - OpenParenthesisTkn: yyDollar[4].node.(*ArgumentList).OpenParenthesisTkn, - Args: yyDollar[4].node.(*ArgumentList).Arguments, - SeparatorTkns: yyDollar[4].node.(*ArgumentList).SeparatorTkns, - CloseParenthesisTkn: yyDollar[4].node.(*ArgumentList).CloseParenthesisTkn, - } - - if brackets, ok := yyDollar[3].node.(*ParserBrackets); ok { - staticCall.OpenCurlyBracketTkn = brackets.OpenBracketTkn - staticCall.Call = brackets.Child - staticCall.CloseCurlyBracketTkn = brackets.CloseBracketTkn - } - - yyVAL.node = staticCall - } - case 327: - yyDollar = yyS[yypt-4 : yypt+1] - // line internal/php5/php5.y:3744 - { - yyVAL.node = &ast.ExprStaticCall{ - Position: yylex.(*Parser).builder.NewNodesPosition(yyDollar[1].node, yyDollar[4].node), - Class: yyDollar[1].node, - DoubleColonTkn: yyDollar[2].token, - Call: yyDollar[3].node, - OpenParenthesisTkn: yyDollar[4].node.(*ArgumentList).OpenParenthesisTkn, - Args: yyDollar[4].node.(*ArgumentList).Arguments, - SeparatorTkns: yyDollar[4].node.(*ArgumentList).SeparatorTkns, - CloseParenthesisTkn: yyDollar[4].node.(*ArgumentList).CloseParenthesisTkn, - } - } - case 328: - yyDollar = yyS[yypt-4 : yypt+1] - // line internal/php5/php5.y:3757 - { - staticCall := &ast.ExprStaticCall{ - Position: yylex.(*Parser).builder.NewNodesPosition(yyDollar[1].node, yyDollar[4].node), - Class: yyDollar[1].node, - DoubleColonTkn: yyDollar[2].token, - Call: yyDollar[3].node, - OpenParenthesisTkn: yyDollar[4].node.(*ArgumentList).OpenParenthesisTkn, - Args: yyDollar[4].node.(*ArgumentList).Arguments, - SeparatorTkns: yyDollar[4].node.(*ArgumentList).SeparatorTkns, - CloseParenthesisTkn: yyDollar[4].node.(*ArgumentList).CloseParenthesisTkn, - } - - if brackets, ok := yyDollar[3].node.(*ParserBrackets); ok { - staticCall.OpenCurlyBracketTkn = brackets.OpenBracketTkn - staticCall.Call = brackets.Child - staticCall.CloseCurlyBracketTkn = brackets.CloseBracketTkn - } - - yyVAL.node = staticCall - } - case 329: - yyDollar = yyS[yypt-4 : yypt+1] - // line internal/php5/php5.y:3778 - { - yyVAL.node = &ast.ExprStaticCall{ - Position: yylex.(*Parser).builder.NewNodesPosition(yyDollar[1].node, yyDollar[4].node), - Class: yyDollar[1].node, - DoubleColonTkn: yyDollar[2].token, - Call: yyDollar[3].node, - OpenParenthesisTkn: yyDollar[4].node.(*ArgumentList).OpenParenthesisTkn, - Args: yyDollar[4].node.(*ArgumentList).Arguments, - SeparatorTkns: yyDollar[4].node.(*ArgumentList).SeparatorTkns, - CloseParenthesisTkn: yyDollar[4].node.(*ArgumentList).CloseParenthesisTkn, - } - } - case 330: - yyDollar = yyS[yypt-2 : yypt+1] - // line internal/php5/php5.y:3791 - { - yyVAL.node = &ast.ExprFunctionCall{ - Position: yylex.(*Parser).builder.NewNodesPosition(yyDollar[1].node, yyDollar[2].node), - Function: yyDollar[1].node, - OpenParenthesisTkn: yyDollar[2].node.(*ArgumentList).OpenParenthesisTkn, - Args: yyDollar[2].node.(*ArgumentList).Arguments, - SeparatorTkns: yyDollar[2].node.(*ArgumentList).SeparatorTkns, - CloseParenthesisTkn: yyDollar[2].node.(*ArgumentList).CloseParenthesisTkn, - } - } - case 331: - yyDollar = yyS[yypt-1 : yypt+1] - // line internal/php5/php5.y:3805 - { - yyVAL.node = &ast.Identifier{ - Position: yylex.(*Parser).builder.NewTokenPosition(yyDollar[1].token), - IdentifierTkn: yyDollar[1].token, - Value: yyDollar[1].token.Value, - } - } - case 332: - yyDollar = yyS[yypt-1 : yypt+1] - // line internal/php5/php5.y:3813 - { - yyVAL.node = &ast.Name{ - Position: yylex.(*Parser).builder.NewNodeListPosition(yyDollar[1].node.(*ParserSeparatedList).Items), - Parts: yyDollar[1].node.(*ParserSeparatedList).Items, - SeparatorTkns: yyDollar[1].node.(*ParserSeparatedList).SeparatorTkns, - } - } - case 333: - yyDollar = yyS[yypt-3 : yypt+1] - // line internal/php5/php5.y:3821 - { - yyVAL.node = &ast.NameRelative{ - Position: yylex.(*Parser).builder.NewTokenNodeListPosition(yyDollar[1].token, yyDollar[3].node.(*ParserSeparatedList).Items), - NsTkn: yyDollar[1].token, - NsSeparatorTkn: yyDollar[2].token, - Parts: yyDollar[3].node.(*ParserSeparatedList).Items, - SeparatorTkns: yyDollar[3].node.(*ParserSeparatedList).SeparatorTkns, - } - } - case 334: - yyDollar = yyS[yypt-2 : yypt+1] - // line internal/php5/php5.y:3831 - { - yyVAL.node = &ast.NameFullyQualified{ - Position: yylex.(*Parser).builder.NewTokenNodeListPosition(yyDollar[1].token, yyDollar[2].node.(*ParserSeparatedList).Items), - NsSeparatorTkn: yyDollar[1].token, - Parts: yyDollar[2].node.(*ParserSeparatedList).Items, - SeparatorTkns: yyDollar[2].node.(*ParserSeparatedList).SeparatorTkns, - } - } - case 335: - yyDollar = yyS[yypt-1 : yypt+1] - // line internal/php5/php5.y:3843 - { - yyVAL.node = &ast.Name{ - Position: yylex.(*Parser).builder.NewNodeListPosition(yyDollar[1].node.(*ParserSeparatedList).Items), - Parts: yyDollar[1].node.(*ParserSeparatedList).Items, - SeparatorTkns: yyDollar[1].node.(*ParserSeparatedList).SeparatorTkns, - } - } - case 336: - yyDollar = yyS[yypt-3 : yypt+1] - // line internal/php5/php5.y:3851 - { - yyVAL.node = &ast.NameRelative{ - Position: yylex.(*Parser).builder.NewTokenNodeListPosition(yyDollar[1].token, yyDollar[3].node.(*ParserSeparatedList).Items), - NsTkn: yyDollar[1].token, - NsSeparatorTkn: yyDollar[2].token, - Parts: yyDollar[3].node.(*ParserSeparatedList).Items, - SeparatorTkns: yyDollar[3].node.(*ParserSeparatedList).SeparatorTkns, - } - } - case 337: - yyDollar = yyS[yypt-2 : yypt+1] - // line internal/php5/php5.y:3861 - { - yyVAL.node = &ast.NameFullyQualified{ - Position: yylex.(*Parser).builder.NewTokenNodeListPosition(yyDollar[1].token, yyDollar[2].node.(*ParserSeparatedList).Items), - NsSeparatorTkn: yyDollar[1].token, - Parts: yyDollar[2].node.(*ParserSeparatedList).Items, - SeparatorTkns: yyDollar[2].node.(*ParserSeparatedList).SeparatorTkns, - } - } - case 338: - yyDollar = yyS[yypt-1 : yypt+1] - // line internal/php5/php5.y:3873 - { - yyVAL.node = yyDollar[1].node - } - case 339: - yyDollar = yyS[yypt-1 : yypt+1] - // line internal/php5/php5.y:3877 - { - yyVAL.node = yyDollar[1].node - } - case 340: - yyDollar = yyS[yypt-4 : yypt+1] - // line internal/php5/php5.y:3884 - { - yyVAL.node = yyDollar[1].node - - yyDollar[3].list[0].(*ast.ExprPropertyFetch).ObjectOperatorTkn = yyDollar[2].token - - for _, n := range yyDollar[3].list { - switch nn := n.(type) { - case *ast.ExprArrayDimFetch: - nn.Var = yyVAL.node - *yyVAL.node.GetPosition() = *yylex.(*Parser).builder.NewNodesPosition(yyVAL.node, nn) - yyVAL.node = nn - - case *ast.ExprPropertyFetch: - nn.Var = yyVAL.node - *yyVAL.node.GetPosition() = *yylex.(*Parser).builder.NewNodesPosition(yyVAL.node, nn) - yyVAL.node = nn - } - } - - for _, n := range yyDollar[4].list { - switch nn := n.(type) { - case *ast.ExprArrayDimFetch: - nn.Var = yyVAL.node - *yyVAL.node.GetPosition() = *yylex.(*Parser).builder.NewNodesPosition(yyVAL.node, nn) - yyVAL.node = nn - - case *ast.ExprPropertyFetch: - nn.Var = yyVAL.node - *yyVAL.node.GetPosition() = *yylex.(*Parser).builder.NewNodesPosition(yyVAL.node, nn) - yyVAL.node = nn - } - } - } - case 341: - yyDollar = yyS[yypt-1 : yypt+1] - // line internal/php5/php5.y:3918 - { - yyVAL.node = yyDollar[1].node - } - case 342: - yyDollar = yyS[yypt-2 : yypt+1] - // line internal/php5/php5.y:3926 - { - yyVAL.list = append(yyDollar[1].list, yyDollar[2].list...) - } - case 343: - yyDollar = yyS[yypt-0 : yypt+1] - // line internal/php5/php5.y:3930 - { - yyVAL.list = []ast.Vertex{} - } - case 344: - yyDollar = yyS[yypt-2 : yypt+1] - // line internal/php5/php5.y:3938 - { - yyDollar[2].list[0].(*ast.ExprPropertyFetch).ObjectOperatorTkn = yyDollar[1].token - - yyVAL.list = yyDollar[2].list - } - case 345: - yyDollar = yyS[yypt-0 : yypt+1] - // line internal/php5/php5.y:3947 - { - yyVAL.node = nil - } - case 346: - yyDollar = yyS[yypt-2 : yypt+1] - // line internal/php5/php5.y:3951 - { - yyVAL.node = &ast.ExprBrackets{ - Position: yylex.(*Parser).builder.NewTokensPosition(yyDollar[1].token, yyDollar[2].token), - OpenParenthesisTkn: yyDollar[1].token, - CloseParenthesisTkn: yyDollar[2].token, - } - } - case 347: - yyDollar = yyS[yypt-1 : yypt+1] - // line internal/php5/php5.y:3959 - { - yyVAL.node = yyDollar[1].node - } - case 348: - yyDollar = yyS[yypt-0 : yypt+1] - // line internal/php5/php5.y:3966 - { - yyVAL.list = []ast.Vertex{} - } - case 349: - yyDollar = yyS[yypt-1 : yypt+1] - // line internal/php5/php5.y:3970 - { - yyVAL.list = []ast.Vertex{ - &ast.ScalarEncapsedStringPart{ - Position: yylex.(*Parser).builder.NewTokenPosition(yyDollar[1].token), - EncapsedStrTkn: yyDollar[1].token, - Value: yyDollar[1].token.Value, - }, - } - } - case 350: - yyDollar = yyS[yypt-1 : yypt+1] - // line internal/php5/php5.y:3980 - { - yyVAL.list = yyDollar[1].list - } - case 351: - yyDollar = yyS[yypt-0 : yypt+1] - // line internal/php5/php5.y:3987 - { - yyVAL.node = nil - } - case 352: - yyDollar = yyS[yypt-1 : yypt+1] - // line internal/php5/php5.y:3991 - { - yyVAL.node = yyDollar[1].node - } - case 353: - yyDollar = yyS[yypt-1 : yypt+1] - // line internal/php5/php5.y:3998 - { - yyVAL.node = &ast.ScalarLnumber{ - Position: yylex.(*Parser).builder.NewTokenPosition(yyDollar[1].token), - NumberTkn: yyDollar[1].token, - Value: yyDollar[1].token.Value, - } - } - case 354: - yyDollar = yyS[yypt-1 : yypt+1] - // line internal/php5/php5.y:4006 - { - yyVAL.node = &ast.ScalarDnumber{ - Position: yylex.(*Parser).builder.NewTokenPosition(yyDollar[1].token), - NumberTkn: yyDollar[1].token, - Value: yyDollar[1].token.Value, - } - } - case 355: - yyDollar = yyS[yypt-1 : yypt+1] - // line internal/php5/php5.y:4014 - { - yyVAL.node = &ast.ScalarString{ - Position: yylex.(*Parser).builder.NewTokenPosition(yyDollar[1].token), - StringTkn: yyDollar[1].token, - Value: yyDollar[1].token.Value, - } - } - case 356: - yyDollar = yyS[yypt-1 : yypt+1] - // line internal/php5/php5.y:4022 - { - yyVAL.node = &ast.ScalarMagicConstant{ - Position: yylex.(*Parser).builder.NewTokenPosition(yyDollar[1].token), - MagicConstTkn: yyDollar[1].token, - Value: yyDollar[1].token.Value, - } - } - case 357: - yyDollar = yyS[yypt-1 : yypt+1] - // line internal/php5/php5.y:4030 - { - yyVAL.node = &ast.ScalarMagicConstant{ - Position: yylex.(*Parser).builder.NewTokenPosition(yyDollar[1].token), - MagicConstTkn: yyDollar[1].token, - Value: yyDollar[1].token.Value, - } - } - case 358: - yyDollar = yyS[yypt-1 : yypt+1] - // line internal/php5/php5.y:4038 - { - yyVAL.node = &ast.ScalarMagicConstant{ - Position: yylex.(*Parser).builder.NewTokenPosition(yyDollar[1].token), - MagicConstTkn: yyDollar[1].token, - Value: yyDollar[1].token.Value, - } - } - case 359: - yyDollar = yyS[yypt-1 : yypt+1] - // line internal/php5/php5.y:4046 - { - yyVAL.node = &ast.ScalarMagicConstant{ - Position: yylex.(*Parser).builder.NewTokenPosition(yyDollar[1].token), - MagicConstTkn: yyDollar[1].token, - Value: yyDollar[1].token.Value, - } - } - case 360: - yyDollar = yyS[yypt-1 : yypt+1] - // line internal/php5/php5.y:4054 - { - yyVAL.node = &ast.ScalarMagicConstant{ - Position: yylex.(*Parser).builder.NewTokenPosition(yyDollar[1].token), - MagicConstTkn: yyDollar[1].token, - Value: yyDollar[1].token.Value, - } - } - case 361: - yyDollar = yyS[yypt-1 : yypt+1] - // line internal/php5/php5.y:4062 - { - yyVAL.node = &ast.ScalarMagicConstant{ - Position: yylex.(*Parser).builder.NewTokenPosition(yyDollar[1].token), - MagicConstTkn: yyDollar[1].token, - Value: yyDollar[1].token.Value, - } - } - case 362: - yyDollar = yyS[yypt-1 : yypt+1] - // line internal/php5/php5.y:4070 - { - yyVAL.node = &ast.ScalarMagicConstant{ - Position: yylex.(*Parser).builder.NewTokenPosition(yyDollar[1].token), - MagicConstTkn: yyDollar[1].token, - Value: yyDollar[1].token.Value, - } - } - case 363: - yyDollar = yyS[yypt-3 : yypt+1] - // line internal/php5/php5.y:4078 - { - yyVAL.node = &ast.ScalarHeredoc{ - Position: yylex.(*Parser).builder.NewTokensPosition(yyDollar[1].token, yyDollar[3].token), - OpenHeredocTkn: yyDollar[1].token, - Parts: []ast.Vertex{ - &ast.ScalarEncapsedStringPart{ - Position: yylex.(*Parser).builder.NewTokenPosition(yyDollar[2].token), - EncapsedStrTkn: yyDollar[2].token, - Value: yyDollar[2].token.Value, - }, - }, - CloseHeredocTkn: yyDollar[3].token, - } - } - case 364: - yyDollar = yyS[yypt-2 : yypt+1] - // line internal/php5/php5.y:4093 - { - yyVAL.node = &ast.ScalarHeredoc{ - Position: yylex.(*Parser).builder.NewTokensPosition(yyDollar[1].token, yyDollar[2].token), - OpenHeredocTkn: yyDollar[1].token, - CloseHeredocTkn: yyDollar[2].token, - } - } - case 365: - yyDollar = yyS[yypt-3 : yypt+1] - // line internal/php5/php5.y:4104 - { - yyVAL.node = &ast.ExprClassConstFetch{ - Position: yylex.(*Parser).builder.NewNodeTokenPosition(yyDollar[1].node, yyDollar[3].token), - Class: yyDollar[1].node, - DoubleColonTkn: yyDollar[2].token, - Const: &ast.Identifier{ - Position: yylex.(*Parser).builder.NewTokenPosition(yyDollar[3].token), - IdentifierTkn: yyDollar[3].token, - Value: yyDollar[3].token.Value, - }, - } - } - case 366: - yyDollar = yyS[yypt-1 : yypt+1] - // line internal/php5/php5.y:4120 - { - yyVAL.node = yyDollar[1].node - } - case 367: - yyDollar = yyS[yypt-1 : yypt+1] - // line internal/php5/php5.y:4127 - { - yyVAL.node = yyDollar[1].node - } - case 368: - yyDollar = yyS[yypt-1 : yypt+1] - // line internal/php5/php5.y:4131 - { - yyVAL.node = yyDollar[1].node - } - case 369: - yyDollar = yyS[yypt-1 : yypt+1] - // line internal/php5/php5.y:4135 - { - yyVAL.node = &ast.ExprConstFetch{ - Position: yylex.(*Parser).builder.NewNodeListPosition(yyDollar[1].node.(*ParserSeparatedList).Items), - Const: &ast.Name{ - Position: yylex.(*Parser).builder.NewNodeListPosition(yyDollar[1].node.(*ParserSeparatedList).Items), - Parts: yyDollar[1].node.(*ParserSeparatedList).Items, - SeparatorTkns: yyDollar[1].node.(*ParserSeparatedList).SeparatorTkns, - }, - } - } - case 370: - yyDollar = yyS[yypt-3 : yypt+1] - // line internal/php5/php5.y:4146 - { - yyVAL.node = &ast.ExprConstFetch{ - Position: yylex.(*Parser).builder.NewTokenNodeListPosition(yyDollar[1].token, yyDollar[3].node.(*ParserSeparatedList).Items), - Const: &ast.NameRelative{ - Position: yylex.(*Parser).builder.NewTokenNodeListPosition(yyDollar[1].token, yyDollar[3].node.(*ParserSeparatedList).Items), - NsTkn: yyDollar[1].token, - NsSeparatorTkn: yyDollar[2].token, - Parts: yyDollar[3].node.(*ParserSeparatedList).Items, - SeparatorTkns: yyDollar[3].node.(*ParserSeparatedList).SeparatorTkns, - }, - } - } - case 371: - yyDollar = yyS[yypt-2 : yypt+1] - // line internal/php5/php5.y:4159 - { - yyVAL.node = &ast.ExprConstFetch{ - Position: yylex.(*Parser).builder.NewTokenNodeListPosition(yyDollar[1].token, yyDollar[2].node.(*ParserSeparatedList).Items), - Const: &ast.NameFullyQualified{ - Position: yylex.(*Parser).builder.NewTokenNodeListPosition(yyDollar[1].token, yyDollar[2].node.(*ParserSeparatedList).Items), - NsSeparatorTkn: yyDollar[1].token, - Parts: yyDollar[2].node.(*ParserSeparatedList).Items, - SeparatorTkns: yyDollar[2].node.(*ParserSeparatedList).SeparatorTkns, - }, - } - } - case 372: - yyDollar = yyS[yypt-4 : yypt+1] - // line internal/php5/php5.y:4171 - { - yyVAL.node = &ast.ExprArray{ - Position: yylex.(*Parser).builder.NewTokensPosition(yyDollar[1].token, yyDollar[4].token), - ArrayTkn: yyDollar[1].token, - OpenBracketTkn: yyDollar[2].token, - Items: yyDollar[3].node.(*ParserSeparatedList).Items, - SeparatorTkns: yyDollar[3].node.(*ParserSeparatedList).SeparatorTkns, - CloseBracketTkn: yyDollar[4].token, - } - } - case 373: - yyDollar = yyS[yypt-3 : yypt+1] - // line internal/php5/php5.y:4182 - { - yyVAL.node = &ast.ExprArray{ - Position: yylex.(*Parser).builder.NewTokensPosition(yyDollar[1].token, yyDollar[3].token), - OpenBracketTkn: yyDollar[1].token, - Items: yyDollar[2].node.(*ParserSeparatedList).Items, - SeparatorTkns: yyDollar[2].node.(*ParserSeparatedList).SeparatorTkns, - CloseBracketTkn: yyDollar[3].token, - } - } - case 374: - yyDollar = yyS[yypt-1 : yypt+1] - // line internal/php5/php5.y:4192 - { - yyVAL.node = yyDollar[1].node - } - case 375: - yyDollar = yyS[yypt-1 : yypt+1] - // line internal/php5/php5.y:4196 - { - yyVAL.node = &ast.ScalarMagicConstant{ - Position: yylex.(*Parser).builder.NewTokenPosition(yyDollar[1].token), - MagicConstTkn: yyDollar[1].token, - Value: yyDollar[1].token.Value, - } - } - case 376: - yyDollar = yyS[yypt-1 : yypt+1] - // line internal/php5/php5.y:4204 - { - yyVAL.node = yyDollar[1].node - } - case 377: - yyDollar = yyS[yypt-4 : yypt+1] - // line internal/php5/php5.y:4211 - { - yyVAL.node = &ast.ExprArrayDimFetch{ - Position: yylex.(*Parser).builder.NewNodeTokenPosition(yyDollar[1].node, yyDollar[4].token), - Var: yyDollar[1].node, - OpenBracketTkn: yyDollar[2].token, - Dim: yyDollar[3].node, - CloseBracketTkn: yyDollar[4].token, - } - } - case 378: - yyDollar = yyS[yypt-3 : yypt+1] - // line internal/php5/php5.y:4221 - { - yyVAL.node = &ast.ExprBinaryPlus{ - Position: yylex.(*Parser).builder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node), - Left: yyDollar[1].node, - OpTkn: yyDollar[2].token, - Right: yyDollar[3].node, - } - } - case 379: - yyDollar = yyS[yypt-3 : yypt+1] - // line internal/php5/php5.y:4230 - { - yyVAL.node = &ast.ExprBinaryMinus{ - Position: yylex.(*Parser).builder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node), - Left: yyDollar[1].node, - OpTkn: yyDollar[2].token, - Right: yyDollar[3].node, - } - } - case 380: - yyDollar = yyS[yypt-3 : yypt+1] - // line internal/php5/php5.y:4239 - { - yyVAL.node = &ast.ExprBinaryMul{ - Position: yylex.(*Parser).builder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node), - Left: yyDollar[1].node, - OpTkn: yyDollar[2].token, - Right: yyDollar[3].node, - } - } - case 381: - yyDollar = yyS[yypt-3 : yypt+1] - // line internal/php5/php5.y:4248 - { - yyVAL.node = &ast.ExprBinaryPow{ - Position: yylex.(*Parser).builder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node), - Left: yyDollar[1].node, - OpTkn: yyDollar[2].token, - Right: yyDollar[3].node, - } - } - case 382: - yyDollar = yyS[yypt-3 : yypt+1] - // line internal/php5/php5.y:4257 - { - yyVAL.node = &ast.ExprBinaryDiv{ - Position: yylex.(*Parser).builder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node), - Left: yyDollar[1].node, - OpTkn: yyDollar[2].token, - Right: yyDollar[3].node, - } - } - case 383: - yyDollar = yyS[yypt-3 : yypt+1] - // line internal/php5/php5.y:4266 - { - yyVAL.node = &ast.ExprBinaryMod{ - Position: yylex.(*Parser).builder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node), - Left: yyDollar[1].node, - OpTkn: yyDollar[2].token, - Right: yyDollar[3].node, - } - } - case 384: - yyDollar = yyS[yypt-2 : yypt+1] - // line internal/php5/php5.y:4275 - { - yyVAL.node = &ast.ExprBooleanNot{ - Position: yylex.(*Parser).builder.NewTokenNodePosition(yyDollar[1].token, yyDollar[2].node), - ExclamationTkn: yyDollar[1].token, - Expr: yyDollar[2].node, - } - } - case 385: - yyDollar = yyS[yypt-2 : yypt+1] - // line internal/php5/php5.y:4283 - { - yyVAL.node = &ast.ExprBitwiseNot{ - Position: yylex.(*Parser).builder.NewTokenNodePosition(yyDollar[1].token, yyDollar[2].node), - TildaTkn: yyDollar[1].token, - Expr: yyDollar[2].node, - } - } - case 386: - yyDollar = yyS[yypt-3 : yypt+1] - // line internal/php5/php5.y:4291 - { - yyVAL.node = &ast.ExprBinaryBitwiseOr{ - Position: yylex.(*Parser).builder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node), - Left: yyDollar[1].node, - OpTkn: yyDollar[2].token, - Right: yyDollar[3].node, - } - } - case 387: - yyDollar = yyS[yypt-3 : yypt+1] - // line internal/php5/php5.y:4300 - { - yyVAL.node = &ast.ExprBinaryBitwiseAnd{ - Position: yylex.(*Parser).builder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node), - Left: yyDollar[1].node, - OpTkn: yyDollar[2].token, - Right: yyDollar[3].node, - } - } - case 388: - yyDollar = yyS[yypt-3 : yypt+1] - // line internal/php5/php5.y:4309 - { - yyVAL.node = &ast.ExprBinaryBitwiseXor{ - Position: yylex.(*Parser).builder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node), - Left: yyDollar[1].node, - OpTkn: yyDollar[2].token, - Right: yyDollar[3].node, - } - } - case 389: - yyDollar = yyS[yypt-3 : yypt+1] - // line internal/php5/php5.y:4318 - { - yyVAL.node = &ast.ExprBinaryShiftLeft{ - Position: yylex.(*Parser).builder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node), - Left: yyDollar[1].node, - OpTkn: yyDollar[2].token, - Right: yyDollar[3].node, - } - } - case 390: - yyDollar = yyS[yypt-3 : yypt+1] - // line internal/php5/php5.y:4327 - { - yyVAL.node = &ast.ExprBinaryShiftRight{ - Position: yylex.(*Parser).builder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node), - Left: yyDollar[1].node, - OpTkn: yyDollar[2].token, - Right: yyDollar[3].node, - } - } - case 391: - yyDollar = yyS[yypt-3 : yypt+1] - // line internal/php5/php5.y:4336 - { - yyVAL.node = &ast.ExprBinaryConcat{ - Position: yylex.(*Parser).builder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node), - Left: yyDollar[1].node, - OpTkn: yyDollar[2].token, - Right: yyDollar[3].node, - } - } - case 392: - yyDollar = yyS[yypt-3 : yypt+1] - // line internal/php5/php5.y:4345 - { - yyVAL.node = &ast.ExprBinaryLogicalXor{ - Position: yylex.(*Parser).builder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node), - Left: yyDollar[1].node, - OpTkn: yyDollar[2].token, - Right: yyDollar[3].node, - } - } - case 393: - yyDollar = yyS[yypt-3 : yypt+1] - // line internal/php5/php5.y:4354 - { - yyVAL.node = &ast.ExprBinaryLogicalAnd{ - Position: yylex.(*Parser).builder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node), - Left: yyDollar[1].node, - OpTkn: yyDollar[2].token, - Right: yyDollar[3].node, - } - } - case 394: - yyDollar = yyS[yypt-3 : yypt+1] - // line internal/php5/php5.y:4363 - { - yyVAL.node = &ast.ExprBinaryLogicalOr{ - Position: yylex.(*Parser).builder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node), - Left: yyDollar[1].node, - OpTkn: yyDollar[2].token, - Right: yyDollar[3].node, - } - } - case 395: - yyDollar = yyS[yypt-3 : yypt+1] - // line internal/php5/php5.y:4372 - { - yyVAL.node = &ast.ExprBinaryBooleanAnd{ - Position: yylex.(*Parser).builder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node), - Left: yyDollar[1].node, - OpTkn: yyDollar[2].token, - Right: yyDollar[3].node, - } - } - case 396: - yyDollar = yyS[yypt-3 : yypt+1] - // line internal/php5/php5.y:4381 - { - yyVAL.node = &ast.ExprBinaryBooleanOr{ - Position: yylex.(*Parser).builder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node), - Left: yyDollar[1].node, - OpTkn: yyDollar[2].token, - Right: yyDollar[3].node, - } - } - case 397: - yyDollar = yyS[yypt-3 : yypt+1] - // line internal/php5/php5.y:4390 - { - yyVAL.node = &ast.ExprBinaryIdentical{ - Position: yylex.(*Parser).builder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node), - Left: yyDollar[1].node, - OpTkn: yyDollar[2].token, - Right: yyDollar[3].node, - } - } - case 398: - yyDollar = yyS[yypt-3 : yypt+1] - // line internal/php5/php5.y:4399 - { - yyVAL.node = &ast.ExprBinaryNotIdentical{ - Position: yylex.(*Parser).builder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node), - Left: yyDollar[1].node, - OpTkn: yyDollar[2].token, - Right: yyDollar[3].node, - } - } - case 399: - yyDollar = yyS[yypt-3 : yypt+1] - // line internal/php5/php5.y:4408 - { - yyVAL.node = &ast.ExprBinaryEqual{ - Position: yylex.(*Parser).builder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node), - Left: yyDollar[1].node, - OpTkn: yyDollar[2].token, - Right: yyDollar[3].node, - } - } - case 400: - yyDollar = yyS[yypt-3 : yypt+1] - // line internal/php5/php5.y:4417 - { - yyVAL.node = &ast.ExprBinaryNotEqual{ - Position: yylex.(*Parser).builder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node), - Left: yyDollar[1].node, - OpTkn: yyDollar[2].token, - Right: yyDollar[3].node, - } - } - case 401: - yyDollar = yyS[yypt-3 : yypt+1] - // line internal/php5/php5.y:4426 - { - yyVAL.node = &ast.ExprBinarySmaller{ - Position: yylex.(*Parser).builder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node), - Left: yyDollar[1].node, - OpTkn: yyDollar[2].token, - Right: yyDollar[3].node, - } - } - case 402: - yyDollar = yyS[yypt-3 : yypt+1] - // line internal/php5/php5.y:4435 - { - yyVAL.node = &ast.ExprBinaryGreater{ - Position: yylex.(*Parser).builder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node), - Left: yyDollar[1].node, - OpTkn: yyDollar[2].token, - Right: yyDollar[3].node, - } - } - case 403: - yyDollar = yyS[yypt-3 : yypt+1] - // line internal/php5/php5.y:4444 - { - yyVAL.node = &ast.ExprBinarySmallerOrEqual{ - Position: yylex.(*Parser).builder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node), - Left: yyDollar[1].node, - OpTkn: yyDollar[2].token, - Right: yyDollar[3].node, - } - } - case 404: - yyDollar = yyS[yypt-3 : yypt+1] - // line internal/php5/php5.y:4453 - { - yyVAL.node = &ast.ExprBinaryGreaterOrEqual{ - Position: yylex.(*Parser).builder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node), - Left: yyDollar[1].node, - OpTkn: yyDollar[2].token, - Right: yyDollar[3].node, - } - } - case 405: - yyDollar = yyS[yypt-4 : yypt+1] - // line internal/php5/php5.y:4462 - { - yyVAL.node = &ast.ExprTernary{ - Position: yylex.(*Parser).builder.NewNodesPosition(yyDollar[1].node, yyDollar[4].node), - Cond: yyDollar[1].node, - QuestionTkn: yyDollar[2].token, - ColonTkn: yyDollar[3].token, - IfFalse: yyDollar[4].node, - } - } - case 406: - yyDollar = yyS[yypt-5 : yypt+1] - // line internal/php5/php5.y:4472 - { - yyVAL.node = &ast.ExprTernary{ - Position: yylex.(*Parser).builder.NewNodesPosition(yyDollar[1].node, yyDollar[5].node), - Cond: yyDollar[1].node, - QuestionTkn: yyDollar[2].token, - IfTrue: yyDollar[3].node, - ColonTkn: yyDollar[4].token, - IfFalse: yyDollar[5].node, - } - } - case 407: - yyDollar = yyS[yypt-2 : yypt+1] - // line internal/php5/php5.y:4483 - { - yyVAL.node = &ast.ExprUnaryPlus{ - Position: yylex.(*Parser).builder.NewTokenNodePosition(yyDollar[1].token, yyDollar[2].node), - PlusTkn: yyDollar[1].token, - Expr: yyDollar[2].node, - } - } - case 408: - yyDollar = yyS[yypt-2 : yypt+1] - // line internal/php5/php5.y:4491 - { - yyVAL.node = &ast.ExprUnaryMinus{ - Position: yylex.(*Parser).builder.NewTokenNodePosition(yyDollar[1].token, yyDollar[2].node), - MinusTkn: yyDollar[1].token, - Expr: yyDollar[2].node, - } - } - case 409: - yyDollar = yyS[yypt-3 : yypt+1] - // line internal/php5/php5.y:4499 - { - yyVAL.node = &ast.ExprBrackets{ - Position: yylex.(*Parser).builder.NewTokensPosition(yyDollar[1].token, yyDollar[3].token), - OpenParenthesisTkn: yyDollar[1].token, - Expr: yyDollar[2].node, - CloseParenthesisTkn: yyDollar[3].token, - } - } - case 410: - yyDollar = yyS[yypt-1 : yypt+1] - // line internal/php5/php5.y:4511 - { - yyVAL.node = yyDollar[1].node - } - case 411: - yyDollar = yyS[yypt-1 : yypt+1] - // line internal/php5/php5.y:4515 - { - yyVAL.node = &ast.ExprConstFetch{ - Position: yylex.(*Parser).builder.NewNodeListPosition(yyDollar[1].node.(*ParserSeparatedList).Items), - Const: &ast.Name{ - Position: yylex.(*Parser).builder.NewNodeListPosition(yyDollar[1].node.(*ParserSeparatedList).Items), - Parts: yyDollar[1].node.(*ParserSeparatedList).Items, - SeparatorTkns: yyDollar[1].node.(*ParserSeparatedList).SeparatorTkns, - }, - } - } - case 412: - yyDollar = yyS[yypt-3 : yypt+1] - // line internal/php5/php5.y:4526 - { - yyVAL.node = &ast.ExprConstFetch{ - Position: yylex.(*Parser).builder.NewTokenNodeListPosition(yyDollar[1].token, yyDollar[3].node.(*ParserSeparatedList).Items), - Const: &ast.NameRelative{ - Position: yylex.(*Parser).builder.NewTokenNodeListPosition(yyDollar[1].token, yyDollar[3].node.(*ParserSeparatedList).Items), - NsTkn: yyDollar[1].token, - NsSeparatorTkn: yyDollar[2].token, - Parts: yyDollar[3].node.(*ParserSeparatedList).Items, - SeparatorTkns: yyDollar[3].node.(*ParserSeparatedList).SeparatorTkns, - }, - } - } - case 413: - yyDollar = yyS[yypt-2 : yypt+1] - // line internal/php5/php5.y:4539 - { - yyVAL.node = &ast.ExprConstFetch{ - Position: yylex.(*Parser).builder.NewTokenNodeListPosition(yyDollar[1].token, yyDollar[2].node.(*ParserSeparatedList).Items), - Const: &ast.NameFullyQualified{ - Position: yylex.(*Parser).builder.NewTokenNodeListPosition(yyDollar[1].token, yyDollar[2].node.(*ParserSeparatedList).Items), - NsSeparatorTkn: yyDollar[1].token, - Parts: yyDollar[2].node.(*ParserSeparatedList).Items, - SeparatorTkns: yyDollar[2].node.(*ParserSeparatedList).SeparatorTkns, - }, - } - } - case 414: - yyDollar = yyS[yypt-1 : yypt+1] - // line internal/php5/php5.y:4554 - { - yyVAL.node = &ast.ExprVariable{ - Position: yylex.(*Parser).builder.NewTokenPosition(yyDollar[1].token), - Name: &ast.Identifier{ - Position: yylex.(*Parser).builder.NewTokenPosition(yyDollar[1].token), - IdentifierTkn: yyDollar[1].token, - Value: yyDollar[1].token.Value, - }, - } - } - case 415: - yyDollar = yyS[yypt-1 : yypt+1] - // line internal/php5/php5.y:4565 - { - yyVAL.node = yyDollar[1].node - } - case 416: - yyDollar = yyS[yypt-1 : yypt+1] - // line internal/php5/php5.y:4569 - { - yyVAL.node = yyDollar[1].node - } - case 417: - yyDollar = yyS[yypt-1 : yypt+1] - // line internal/php5/php5.y:4573 - { - yyVAL.node = yyDollar[1].node - } - case 418: - yyDollar = yyS[yypt-3 : yypt+1] - // line internal/php5/php5.y:4577 - { - yyVAL.node = &ast.ScalarEncapsed{ - Position: yylex.(*Parser).builder.NewTokensPosition(yyDollar[1].token, yyDollar[3].token), - OpenQuoteTkn: yyDollar[1].token, - Parts: yyDollar[2].list, - CloseQuoteTkn: yyDollar[3].token, - } - } - case 419: - yyDollar = yyS[yypt-3 : yypt+1] - // line internal/php5/php5.y:4586 - { - yyVAL.node = &ast.ScalarHeredoc{ - Position: yylex.(*Parser).builder.NewTokensPosition(yyDollar[1].token, yyDollar[3].token), - OpenHeredocTkn: yyDollar[1].token, - Parts: yyDollar[2].list, - CloseHeredocTkn: yyDollar[3].token, - } - } - case 420: - yyDollar = yyS[yypt-1 : yypt+1] - // line internal/php5/php5.y:4595 - { - yyVAL.node = &ast.ScalarMagicConstant{ - Position: yylex.(*Parser).builder.NewTokenPosition(yyDollar[1].token), - MagicConstTkn: yyDollar[1].token, - Value: yyDollar[1].token.Value, - } - } - case 421: - yyDollar = yyS[yypt-0 : yypt+1] - // line internal/php5/php5.y:4606 - { - yyVAL.node = &ParserSeparatedList{} - } - case 422: - yyDollar = yyS[yypt-2 : yypt+1] - // line internal/php5/php5.y:4610 - { - if yyDollar[2].token != nil { - yyDollar[1].node.(*ParserSeparatedList).SeparatorTkns = append(yyDollar[1].node.(*ParserSeparatedList).SeparatorTkns, yyDollar[2].token) - yyDollar[1].node.(*ParserSeparatedList).Items = append(yyDollar[1].node.(*ParserSeparatedList).Items, &ast.ExprArrayItem{}) - } - - yyVAL.node = yyDollar[1].node - } - case 423: - yyDollar = yyS[yypt-0 : yypt+1] - // line internal/php5/php5.y:4622 - { - yyVAL.token = nil - } - case 424: - yyDollar = yyS[yypt-1 : yypt+1] - // line internal/php5/php5.y:4626 - { - yyVAL.token = yyDollar[1].token - } - case 425: - yyDollar = yyS[yypt-5 : yypt+1] - // line internal/php5/php5.y:4633 - { - arrayItem := &ast.ExprArrayItem{ - Position: yylex.(*Parser).builder.NewNodesPosition(yyDollar[3].node, yyDollar[5].node), - Key: yyDollar[3].node, - DoubleArrowTkn: yyDollar[4].token, - Val: yyDollar[5].node, - } - - yyDollar[1].node.(*ParserSeparatedList).SeparatorTkns = append(yyDollar[1].node.(*ParserSeparatedList).SeparatorTkns, yyDollar[2].token) - yyDollar[1].node.(*ParserSeparatedList).Items = append(yyDollar[1].node.(*ParserSeparatedList).Items, arrayItem) - - yyVAL.node = yyDollar[1].node - } - case 426: - yyDollar = yyS[yypt-3 : yypt+1] - // line internal/php5/php5.y:4647 - { - arrayItem := &ast.ExprArrayItem{ - Position: yylex.(*Parser).builder.NewNodePosition(yyDollar[3].node), - Val: yyDollar[3].node, - } - - yyDollar[1].node.(*ParserSeparatedList).SeparatorTkns = append(yyDollar[1].node.(*ParserSeparatedList).SeparatorTkns, yyDollar[2].token) - yyDollar[1].node.(*ParserSeparatedList).Items = append(yyDollar[1].node.(*ParserSeparatedList).Items, arrayItem) - - yyVAL.node = yyDollar[1].node - } - case 427: - yyDollar = yyS[yypt-3 : yypt+1] - // line internal/php5/php5.y:4659 - { - yyVAL.node = &ParserSeparatedList{ - Items: []ast.Vertex{ - &ast.ExprArrayItem{ - Position: yylex.(*Parser).builder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node), - Key: yyDollar[1].node, - DoubleArrowTkn: yyDollar[2].token, - Val: yyDollar[3].node, - }, - }, - } - } - case 428: - yyDollar = yyS[yypt-1 : yypt+1] - // line internal/php5/php5.y:4672 - { - yyVAL.node = &ParserSeparatedList{ - Items: []ast.Vertex{ - &ast.ExprArrayItem{ - Position: yylex.(*Parser).builder.NewNodePosition(yyDollar[1].node), - Val: yyDollar[1].node, - }, - }, - } - } - case 429: - yyDollar = yyS[yypt-1 : yypt+1] - // line internal/php5/php5.y:4686 - { - yyVAL.node = yyDollar[1].node - } - case 430: - yyDollar = yyS[yypt-1 : yypt+1] - // line internal/php5/php5.y:4690 - { - yyVAL.node = yyDollar[1].node - } - case 431: - yyDollar = yyS[yypt-3 : yypt+1] - // line internal/php5/php5.y:4697 - { - yyVAL.node = &ast.ExprBrackets{ - Position: yylex.(*Parser).builder.NewTokensPosition(yyDollar[1].token, yyDollar[3].token), - OpenParenthesisTkn: yyDollar[1].token, - Expr: yyDollar[2].node, - CloseParenthesisTkn: yyDollar[3].token, - } - } - case 432: - yyDollar = yyS[yypt-3 : yypt+1] - // line internal/php5/php5.y:4706 - { - yyVAL.node = &ast.ExprBrackets{ - Position: yylex.(*Parser).builder.NewTokensPosition(yyDollar[1].token, yyDollar[3].token), - OpenParenthesisTkn: yyDollar[1].token, - Expr: yyDollar[2].node, - CloseParenthesisTkn: yyDollar[3].token, - } - } - case 433: - yyDollar = yyS[yypt-1 : yypt+1] - // line internal/php5/php5.y:4719 - { - yyVAL.node = yyDollar[1].node - } - case 434: - yyDollar = yyS[yypt-1 : yypt+1] - // line internal/php5/php5.y:4727 - { - yyVAL.node = yyDollar[1].node - } - case 435: - yyDollar = yyS[yypt-1 : yypt+1] - // line internal/php5/php5.y:4734 - { - yyVAL.node = yyDollar[1].node - } - case 436: - yyDollar = yyS[yypt-5 : yypt+1] - // line internal/php5/php5.y:4741 - { - yyVAL.node = yyDollar[1].node - - yyDollar[3].list[0].(*ast.ExprPropertyFetch).ObjectOperatorTkn = yyDollar[2].token - - if yyDollar[4].list != nil { - last := yyDollar[3].list[len(yyDollar[3].list)-1] - switch l := last.(type) { - case *ast.ExprArrayDimFetch: - mc := yyDollar[4].list[0].(*ast.ExprMethodCall) - yyDollar[3].list = append(yyDollar[3].list, &ast.ExprFunctionCall{ - Position: yylex.(*Parser).builder.NewNodePosition(mc), - OpenParenthesisTkn: mc.OpenParenthesisTkn, - Args: mc.Args, - SeparatorTkns: mc.SeparatorTkns, - CloseParenthesisTkn: mc.CloseParenthesisTkn, - }, - ) - yyDollar[3].list = append(yyDollar[3].list, yyDollar[4].list[1:len(yyDollar[4].list)]...) - case *ast.ExprPropertyFetch: - yyDollar[4].list[0].(*ast.ExprMethodCall).OpenCurlyBracketTkn = l.OpenCurlyBracketTkn - yyDollar[4].list[0].(*ast.ExprMethodCall).Method = l.Prop - yyDollar[4].list[0].(*ast.ExprMethodCall).CloseCurlyBracketTkn = l.CloseCurlyBracketTkn - yyDollar[4].list[0].(*ast.ExprMethodCall).ObjectOperatorTkn = l.ObjectOperatorTkn - yyDollar[3].list = append(yyDollar[3].list[:len(yyDollar[3].list)-1], yyDollar[4].list...) - } - } - - for _, n := range yyDollar[3].list { - switch nn := n.(type) { - case *ast.ExprFunctionCall: - nn.Function = yyVAL.node - nn.Position = yylex.(*Parser).builder.NewNodesPosition(yyVAL.node, nn) - yyVAL.node = nn - - case *ast.ExprArrayDimFetch: - nn.Var = yyVAL.node - nn.Position = yylex.(*Parser).builder.NewNodesPosition(yyVAL.node, nn) - yyVAL.node = nn - - case *ast.ExprPropertyFetch: - nn.Var = yyVAL.node - nn.Position = yylex.(*Parser).builder.NewNodesPosition(yyVAL.node, nn) - yyVAL.node = nn - - case *ast.ExprMethodCall: - nn.Var = yyVAL.node - nn.Position = yylex.(*Parser).builder.NewNodesPosition(yyVAL.node, nn) - yyVAL.node = nn - } - } - - for _, n := range yyDollar[5].list { - switch nn := n.(type) { - case *ast.ExprFunctionCall: - nn.Function = yyVAL.node - nn.Position = yylex.(*Parser).builder.NewNodesPosition(yyVAL.node, nn) - yyVAL.node = nn - - case *ast.ExprArrayDimFetch: - nn.Var = yyVAL.node - nn.Position = yylex.(*Parser).builder.NewNodesPosition(yyVAL.node, nn) - yyVAL.node = nn - - case *ast.ExprPropertyFetch: - nn.Var = yyVAL.node - nn.Position = yylex.(*Parser).builder.NewNodesPosition(yyVAL.node, nn) - yyVAL.node = nn - - case *ast.ExprMethodCall: - nn.Var = yyVAL.node - nn.Position = yylex.(*Parser).builder.NewNodesPosition(yyVAL.node, nn) - yyVAL.node = nn - } - } - } - case 437: - yyDollar = yyS[yypt-1 : yypt+1] - // line internal/php5/php5.y:4818 - { - yyVAL.node = yyDollar[1].node - } - case 438: - yyDollar = yyS[yypt-2 : yypt+1] - // line internal/php5/php5.y:4825 - { - yyVAL.list = append(yyDollar[1].list, yyDollar[2].list...) - } - case 439: - yyDollar = yyS[yypt-0 : yypt+1] - // line internal/php5/php5.y:4829 - { - yyVAL.list = []ast.Vertex{} - } - case 440: - yyDollar = yyS[yypt-3 : yypt+1] - // line internal/php5/php5.y:4837 - { - yyDollar[2].list[0].(*ast.ExprPropertyFetch).ObjectOperatorTkn = yyDollar[1].token - - if yyDollar[3].list != nil { - last := yyDollar[2].list[len(yyDollar[2].list)-1] - switch l := last.(type) { - case *ast.ExprArrayDimFetch: - mc := yyDollar[3].list[0].(*ast.ExprMethodCall) - yyDollar[2].list = append(yyDollar[2].list, &ast.ExprFunctionCall{ - Position: yylex.(*Parser).builder.NewNodePosition(mc), - OpenParenthesisTkn: mc.OpenParenthesisTkn, - Args: mc.Args, - SeparatorTkns: mc.SeparatorTkns, - CloseParenthesisTkn: mc.OpenParenthesisTkn, - }, - ) - yyDollar[2].list = append(yyDollar[2].list, yyDollar[3].list[1:len(yyDollar[3].list)]...) - case *ast.ExprPropertyFetch: - yyDollar[3].list[0].(*ast.ExprMethodCall).OpenCurlyBracketTkn = l.OpenCurlyBracketTkn - yyDollar[3].list[0].(*ast.ExprMethodCall).Method = l.Prop - yyDollar[3].list[0].(*ast.ExprMethodCall).CloseCurlyBracketTkn = l.CloseCurlyBracketTkn - yyDollar[3].list[0].(*ast.ExprMethodCall).ObjectOperatorTkn = l.ObjectOperatorTkn - yyDollar[2].list = append(yyDollar[2].list[:len(yyDollar[2].list)-1], yyDollar[3].list...) - } - } - - yyVAL.list = yyDollar[2].list - } - case 441: - yyDollar = yyS[yypt-4 : yypt+1] - // line internal/php5/php5.y:4869 - { - fetch := &ast.ExprArrayDimFetch{ - Position: yylex.(*Parser).builder.NewTokensPosition(yyDollar[2].token, yyDollar[4].token), - Var: nil, - OpenBracketTkn: yyDollar[2].token, - Dim: yyDollar[3].node, - CloseBracketTkn: yyDollar[4].token, - } - - yyVAL.list = append(yyDollar[1].list, fetch) - } - case 442: - yyDollar = yyS[yypt-4 : yypt+1] - // line internal/php5/php5.y:4881 - { - fetch := &ast.ExprArrayDimFetch{ - Position: yylex.(*Parser).builder.NewTokensPosition(yyDollar[2].token, yyDollar[4].token), - Var: nil, - OpenBracketTkn: yyDollar[2].token, - Dim: yyDollar[3].node, - CloseBracketTkn: yyDollar[4].token, - } - - yyVAL.list = []ast.Vertex{yyDollar[1].node, fetch} - } - case 443: - yyDollar = yyS[yypt-1 : yypt+1] - // line internal/php5/php5.y:4896 - { - yyVAL.node = &ast.ExprMethodCall{ - Position: yylex.(*Parser).builder.NewNodePosition(yyDollar[1].node), - OpenParenthesisTkn: yyDollar[1].node.(*ArgumentList).OpenParenthesisTkn, - Args: yyDollar[1].node.(*ArgumentList).Arguments, - SeparatorTkns: yyDollar[1].node.(*ArgumentList).SeparatorTkns, - CloseParenthesisTkn: yyDollar[1].node.(*ArgumentList).CloseParenthesisTkn, - } - } - case 444: - yyDollar = yyS[yypt-1 : yypt+1] - // line internal/php5/php5.y:4909 - { - yyVAL.list = []ast.Vertex{yyDollar[1].node} - } - case 445: - yyDollar = yyS[yypt-1 : yypt+1] - // line internal/php5/php5.y:4913 - { - yyVAL.list = yyDollar[1].list - } - case 446: - yyDollar = yyS[yypt-0 : yypt+1] - // line internal/php5/php5.y:4917 - { - yyVAL.list = nil - } - case 447: - yyDollar = yyS[yypt-1 : yypt+1] - // line internal/php5/php5.y:4924 - { - yyVAL.node = yyDollar[1].node - } - case 448: - yyDollar = yyS[yypt-2 : yypt+1] - // line internal/php5/php5.y:4928 - { - for i := len(yyDollar[1].list) - 1; i >= 0; i-- { - yyDollar[1].list[i].(*ast.ExprVariable).Name = yyDollar[2].node - yyDollar[1].list[i].(*ast.ExprVariable).Position = yylex.(*Parser).builder.NewNodesPosition(yyDollar[1].list[i], yyDollar[2].node) - yyDollar[2].node = yyDollar[1].list[i] - } - - yyVAL.node = yyDollar[1].list[0] - } - case 449: - yyDollar = yyS[yypt-3 : yypt+1] - // line internal/php5/php5.y:4941 - { - yyVAL.node = &ast.ExprStaticPropertyFetch{ - Position: yylex.(*Parser).builder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node), - Class: yyDollar[1].node, - DoubleColonTkn: yyDollar[2].token, - Prop: yyDollar[3].node, - } - } - case 450: - yyDollar = yyS[yypt-3 : yypt+1] - // line internal/php5/php5.y:4950 - { - yyVAL.node = &ast.ExprStaticPropertyFetch{ - Position: yylex.(*Parser).builder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node), - Class: yyDollar[1].node, - DoubleColonTkn: yyDollar[2].token, - Prop: yyDollar[3].node, - } - } - case 451: - yyDollar = yyS[yypt-1 : yypt+1] - // line internal/php5/php5.y:4962 - { - yyVAL.node = yyDollar[1].node - } - case 452: - yyDollar = yyS[yypt-4 : yypt+1] - // line internal/php5/php5.y:4969 - { - yyVAL.node = &ast.ExprArrayDimFetch{ - Position: yylex.(*Parser).builder.NewNodeTokenPosition(yyDollar[1].node, yyDollar[4].token), - Var: yyDollar[1].node, - OpenBracketTkn: yyDollar[2].token, - Dim: yyDollar[3].node, - CloseBracketTkn: yyDollar[4].token, - } - } - case 453: - yyDollar = yyS[yypt-4 : yypt+1] - // line internal/php5/php5.y:4979 - { - yyVAL.node = &ast.ExprArrayDimFetch{ - Position: yylex.(*Parser).builder.NewNodeTokenPosition(yyDollar[1].node, yyDollar[4].token), - Var: yyDollar[1].node, - OpenBracketTkn: yyDollar[2].token, - Dim: yyDollar[3].node, - CloseBracketTkn: yyDollar[4].token, - } - } - case 454: - yyDollar = yyS[yypt-1 : yypt+1] - // line internal/php5/php5.y:4992 - { - yyVAL.node = yyDollar[1].node - } - case 455: - yyDollar = yyS[yypt-1 : yypt+1] - // line internal/php5/php5.y:4996 - { - yyVAL.node = yyDollar[1].node - } - case 456: - yyDollar = yyS[yypt-1 : yypt+1] - // line internal/php5/php5.y:5000 - { - yyVAL.node = yyDollar[1].node - } - case 457: - yyDollar = yyS[yypt-1 : yypt+1] - // line internal/php5/php5.y:5008 - { - yyVAL.node = yyDollar[1].node - } - case 458: - yyDollar = yyS[yypt-2 : yypt+1] - // line internal/php5/php5.y:5012 - { - for i := len(yyDollar[1].list) - 1; i >= 0; i-- { - yyDollar[1].list[i].(*ast.ExprVariable).Name = yyDollar[2].node - yyDollar[1].list[i].(*ast.ExprVariable).Position = yylex.(*Parser).builder.NewNodesPosition(yyDollar[1].list[i], yyDollar[2].node) - yyDollar[2].node = yyDollar[1].list[i] - } - - yyVAL.node = yyDollar[1].list[0] - } - case 459: - yyDollar = yyS[yypt-1 : yypt+1] - // line internal/php5/php5.y:5022 - { - yyVAL.node = yyDollar[1].node - } - case 460: - yyDollar = yyS[yypt-4 : yypt+1] - // line internal/php5/php5.y:5029 - { - yyVAL.node = &ast.ExprArrayDimFetch{ - Position: yylex.(*Parser).builder.NewNodeTokenPosition(yyDollar[1].node, yyDollar[4].token), - Var: yyDollar[1].node, - OpenBracketTkn: yyDollar[2].token, - Dim: yyDollar[3].node, - CloseBracketTkn: yyDollar[4].token, - } - } - case 461: - yyDollar = yyS[yypt-4 : yypt+1] - // line internal/php5/php5.y:5039 - { - yyVAL.node = &ast.ExprArrayDimFetch{ - Position: yylex.(*Parser).builder.NewNodeTokenPosition(yyDollar[1].node, yyDollar[4].token), - Var: yyDollar[1].node, - OpenBracketTkn: yyDollar[2].token, - Dim: yyDollar[3].node, - CloseBracketTkn: yyDollar[4].token, - } - } - case 462: - yyDollar = yyS[yypt-1 : yypt+1] - // line internal/php5/php5.y:5049 - { - yyVAL.node = yyDollar[1].node - } - case 463: - yyDollar = yyS[yypt-1 : yypt+1] - // line internal/php5/php5.y:5057 - { - yyVAL.node = &ast.ExprVariable{ - Position: yylex.(*Parser).builder.NewTokenPosition(yyDollar[1].token), - Name: &ast.Identifier{ - Position: yylex.(*Parser).builder.NewTokenPosition(yyDollar[1].token), - IdentifierTkn: yyDollar[1].token, - Value: yyDollar[1].token.Value, - }, - } - } - case 464: - yyDollar = yyS[yypt-4 : yypt+1] - // line internal/php5/php5.y:5068 - { - yyVAL.node = &ast.ExprVariable{ - Position: yylex.(*Parser).builder.NewTokensPosition(yyDollar[1].token, yyDollar[4].token), - DollarTkn: yyDollar[1].token, - OpenCurlyBracketTkn: yyDollar[2].token, - Name: yyDollar[3].node, - CloseCurlyBracketTkn: yyDollar[4].token, - } - } - case 465: - yyDollar = yyS[yypt-0 : yypt+1] - // line internal/php5/php5.y:5081 - { - yyVAL.node = nil - } - case 466: - yyDollar = yyS[yypt-1 : yypt+1] - // line internal/php5/php5.y:5085 - { - yyVAL.node = yyDollar[1].node - } - case 467: - yyDollar = yyS[yypt-1 : yypt+1] - // line internal/php5/php5.y:5093 - { - yyVAL.list = yyDollar[1].list - } - case 468: - yyDollar = yyS[yypt-1 : yypt+1] - // line internal/php5/php5.y:5097 - { - yyVAL.list = []ast.Vertex{ - &ast.ExprPropertyFetch{ - Position: yylex.(*Parser).builder.NewNodePosition(yyDollar[1].node), - Prop: yyDollar[1].node, - }, - } - } - case 469: - yyDollar = yyS[yypt-4 : yypt+1] - // line internal/php5/php5.y:5109 - { - fetch := &ast.ExprArrayDimFetch{ - Position: yylex.(*Parser).builder.NewTokensPosition(yyDollar[2].token, yyDollar[4].token), - Var: nil, - OpenBracketTkn: yyDollar[2].token, - Dim: yyDollar[3].node, - CloseBracketTkn: yyDollar[4].token, - } - - yyVAL.list = append(yyDollar[1].list, fetch) - } - case 470: - yyDollar = yyS[yypt-4 : yypt+1] - // line internal/php5/php5.y:5121 - { - fetch := &ast.ExprArrayDimFetch{ - Position: yylex.(*Parser).builder.NewTokensPosition(yyDollar[2].token, yyDollar[4].token), - Var: nil, - OpenBracketTkn: yyDollar[2].token, - Dim: yyDollar[3].node, - CloseBracketTkn: yyDollar[4].token, - } - - yyVAL.list = append(yyDollar[1].list, fetch) - } - case 471: - yyDollar = yyS[yypt-1 : yypt+1] - // line internal/php5/php5.y:5133 - { - property := &ast.ExprPropertyFetch{ - Position: yylex.(*Parser).builder.NewNodePosition(yyDollar[1].node), - Prop: yyDollar[1].node, - } - - if brackets, ok := yyDollar[1].node.(*ParserBrackets); ok { - property.OpenCurlyBracketTkn = brackets.OpenBracketTkn - property.Prop = brackets.Child - property.CloseCurlyBracketTkn = brackets.CloseBracketTkn - } - - yyVAL.list = []ast.Vertex{property} - } - case 472: - yyDollar = yyS[yypt-1 : yypt+1] - // line internal/php5/php5.y:5151 - { - yyVAL.node = &ast.Identifier{ - Position: yylex.(*Parser).builder.NewTokenPosition(yyDollar[1].token), - IdentifierTkn: yyDollar[1].token, - Value: yyDollar[1].token.Value, - } - } - case 473: - yyDollar = yyS[yypt-3 : yypt+1] - // line internal/php5/php5.y:5159 - { - yyVAL.node = &ParserBrackets{ - Position: yylex.(*Parser).builder.NewTokensPosition(yyDollar[1].token, yyDollar[3].token), - OpenBracketTkn: yyDollar[1].token, - Child: yyDollar[2].node, - CloseBracketTkn: yyDollar[3].token, - } - } - case 474: - yyDollar = yyS[yypt-1 : yypt+1] - // line internal/php5/php5.y:5171 - { - yyVAL.list = []ast.Vertex{ - &ast.ExprVariable{ - Position: yylex.(*Parser).builder.NewTokenPosition(yyDollar[1].token), - DollarTkn: yyDollar[1].token, - }, - } - } - case 475: - yyDollar = yyS[yypt-2 : yypt+1] - // line internal/php5/php5.y:5180 - { - yyVAL.list = append(yyDollar[1].list, &ast.ExprVariable{ - Position: yylex.(*Parser).builder.NewTokenPosition(yyDollar[2].token), - DollarTkn: yyDollar[2].token, - }) - } - case 476: - yyDollar = yyS[yypt-3 : yypt+1] - // line internal/php5/php5.y:5190 - { - yyDollar[1].node.(*ParserSeparatedList).SeparatorTkns = append(yyDollar[1].node.(*ParserSeparatedList).SeparatorTkns, yyDollar[2].token) - yyDollar[1].node.(*ParserSeparatedList).Items = append(yyDollar[1].node.(*ParserSeparatedList).Items, yyDollar[3].node) - - yyVAL.node = yyDollar[1].node - } - case 477: - yyDollar = yyS[yypt-1 : yypt+1] - // line internal/php5/php5.y:5197 - { - yyVAL.node = &ParserSeparatedList{ - Items: []ast.Vertex{yyDollar[1].node}, - } - } - case 478: - yyDollar = yyS[yypt-1 : yypt+1] - // line internal/php5/php5.y:5207 - { - yyVAL.node = &ast.ExprArrayItem{ - Position: yylex.(*Parser).builder.NewNodePosition(yyDollar[1].node), - Val: yyDollar[1].node, - } - } - case 479: - yyDollar = yyS[yypt-4 : yypt+1] - // line internal/php5/php5.y:5214 - { - pairList := yyDollar[3].node.(*ParserSeparatedList) - fistPair := pairList.Items[0].(*ast.ExprArrayItem) - - if fistPair.Key == nil && fistPair.Val == nil && len(pairList.Items) == 1 { - pairList.Items = nil - } - - yyVAL.node = &ast.ExprArrayItem{ - Position: yylex.(*Parser).builder.NewTokensPosition(yyDollar[1].token, yyDollar[4].token), - Val: &ast.ExprList{ - Position: yylex.(*Parser).builder.NewTokensPosition(yyDollar[1].token, yyDollar[4].token), - ListTkn: yyDollar[1].token, - OpenBracketTkn: yyDollar[2].token, - Items: yyDollar[3].node.(*ParserSeparatedList).Items, - SeparatorTkns: yyDollar[3].node.(*ParserSeparatedList).SeparatorTkns, - CloseBracketTkn: yyDollar[4].token, - }, - } - } - case 480: - yyDollar = yyS[yypt-0 : yypt+1] - // line internal/php5/php5.y:5235 - { - yyVAL.node = &ast.ExprArrayItem{} - } - case 481: - yyDollar = yyS[yypt-0 : yypt+1] - // line internal/php5/php5.y:5243 - { - yyVAL.node = &ParserSeparatedList{} - } - case 482: - yyDollar = yyS[yypt-2 : yypt+1] - // line internal/php5/php5.y:5247 - { - if yyDollar[2].token != nil { - yyDollar[1].node.(*ParserSeparatedList).SeparatorTkns = append(yyDollar[1].node.(*ParserSeparatedList).SeparatorTkns, yyDollar[2].token) - yyDollar[1].node.(*ParserSeparatedList).Items = append(yyDollar[1].node.(*ParserSeparatedList).Items, &ast.ExprArrayItem{}) - } - - yyVAL.node = yyDollar[1].node - } - case 483: - yyDollar = yyS[yypt-5 : yypt+1] - // line internal/php5/php5.y:5259 - { - arrayItem := &ast.ExprArrayItem{ - Position: yylex.(*Parser).builder.NewNodesPosition(yyDollar[3].node, yyDollar[5].node), - Key: yyDollar[3].node, - DoubleArrowTkn: yyDollar[4].token, - Val: yyDollar[5].node, - } - - yyDollar[1].node.(*ParserSeparatedList).SeparatorTkns = append(yyDollar[1].node.(*ParserSeparatedList).SeparatorTkns, yyDollar[2].token) - yyDollar[1].node.(*ParserSeparatedList).Items = append(yyDollar[1].node.(*ParserSeparatedList).Items, arrayItem) - - yyVAL.node = yyDollar[1].node - } - case 484: - yyDollar = yyS[yypt-3 : yypt+1] - // line internal/php5/php5.y:5273 - { - arrayItem := &ast.ExprArrayItem{ - Position: yylex.(*Parser).builder.NewNodePosition(yyDollar[3].node), - Val: yyDollar[3].node, - } - - yyDollar[1].node.(*ParserSeparatedList).SeparatorTkns = append(yyDollar[1].node.(*ParserSeparatedList).SeparatorTkns, yyDollar[2].token) - yyDollar[1].node.(*ParserSeparatedList).Items = append(yyDollar[1].node.(*ParserSeparatedList).Items, arrayItem) - - yyVAL.node = yyDollar[1].node - } - case 485: - yyDollar = yyS[yypt-3 : yypt+1] - // line internal/php5/php5.y:5285 - { - yyVAL.node = &ParserSeparatedList{ - Items: []ast.Vertex{ - &ast.ExprArrayItem{ - Position: yylex.(*Parser).builder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node), - Key: yyDollar[1].node, - DoubleArrowTkn: yyDollar[2].token, - Val: yyDollar[3].node, - }, - }, - } - } - case 486: - yyDollar = yyS[yypt-1 : yypt+1] - // line internal/php5/php5.y:5298 - { - yyVAL.node = &ParserSeparatedList{ - Items: []ast.Vertex{ - &ast.ExprArrayItem{ - Position: yylex.(*Parser).builder.NewNodePosition(yyDollar[1].node), - Val: yyDollar[1].node, - }, - }, - } - } - case 487: - yyDollar = yyS[yypt-6 : yypt+1] - // line internal/php5/php5.y:5309 - { - arrayItem := &ast.ExprArrayItem{ - Position: yylex.(*Parser).builder.NewNodesPosition(yyDollar[3].node, yyDollar[6].node), - Key: yyDollar[3].node, - DoubleArrowTkn: yyDollar[4].token, - AmpersandTkn: yyDollar[5].token, - Val: yyDollar[6].node, - } - - yyDollar[1].node.(*ParserSeparatedList).SeparatorTkns = append(yyDollar[1].node.(*ParserSeparatedList).SeparatorTkns, yyDollar[2].token) - yyDollar[1].node.(*ParserSeparatedList).Items = append(yyDollar[1].node.(*ParserSeparatedList).Items, arrayItem) - - yyVAL.node = yyDollar[1].node - } - case 488: - yyDollar = yyS[yypt-4 : yypt+1] - // line internal/php5/php5.y:5324 - { - arrayItem := &ast.ExprArrayItem{ - Position: yylex.(*Parser).builder.NewTokenNodePosition(yyDollar[3].token, yyDollar[4].node), - AmpersandTkn: yyDollar[3].token, - Val: yyDollar[4].node, - } - - yyDollar[1].node.(*ParserSeparatedList).SeparatorTkns = append(yyDollar[1].node.(*ParserSeparatedList).SeparatorTkns, yyDollar[2].token) - yyDollar[1].node.(*ParserSeparatedList).Items = append(yyDollar[1].node.(*ParserSeparatedList).Items, arrayItem) - - yyVAL.node = yyDollar[1].node - } - case 489: - yyDollar = yyS[yypt-4 : yypt+1] - // line internal/php5/php5.y:5337 - { - yyVAL.node = &ParserSeparatedList{ - Items: []ast.Vertex{ - &ast.ExprArrayItem{ - Position: yylex.(*Parser).builder.NewNodesPosition(yyDollar[1].node, yyDollar[4].node), - Key: yyDollar[1].node, - DoubleArrowTkn: yyDollar[2].token, - AmpersandTkn: yyDollar[3].token, - Val: yyDollar[4].node, - }, - }, - } - } - case 490: - yyDollar = yyS[yypt-2 : yypt+1] - // line internal/php5/php5.y:5351 - { - yyVAL.node = &ParserSeparatedList{ - Items: []ast.Vertex{ - &ast.ExprArrayItem{ - Position: yylex.(*Parser).builder.NewTokenNodePosition(yyDollar[1].token, yyDollar[2].node), - AmpersandTkn: yyDollar[1].token, - Val: yyDollar[2].node, - }, - }, - } - } - case 491: - yyDollar = yyS[yypt-2 : yypt+1] - // line internal/php5/php5.y:5366 - { - yyVAL.list = append(yyDollar[1].list, yyDollar[2].node) - } - case 492: - yyDollar = yyS[yypt-2 : yypt+1] - // line internal/php5/php5.y:5370 - { - yyVAL.list = append( - yyDollar[1].list, - &ast.ScalarEncapsedStringPart{ - Position: yylex.(*Parser).builder.NewTokenPosition(yyDollar[2].token), - EncapsedStrTkn: yyDollar[2].token, - Value: yyDollar[2].token.Value, - }, - ) - } - case 493: - yyDollar = yyS[yypt-1 : yypt+1] - // line internal/php5/php5.y:5381 - { - yyVAL.list = []ast.Vertex{yyDollar[1].node} - } - case 494: - yyDollar = yyS[yypt-2 : yypt+1] - // line internal/php5/php5.y:5385 - { - yyVAL.list = []ast.Vertex{ - &ast.ScalarEncapsedStringPart{ - Position: yylex.(*Parser).builder.NewTokenPosition(yyDollar[1].token), - EncapsedStrTkn: yyDollar[1].token, - Value: yyDollar[1].token.Value, - }, - yyDollar[2].node, - } - } - case 495: - yyDollar = yyS[yypt-1 : yypt+1] - // line internal/php5/php5.y:5399 - { - yyVAL.node = &ast.ExprVariable{ - Position: yylex.(*Parser).builder.NewTokenPosition(yyDollar[1].token), - Name: &ast.Identifier{ - Position: yylex.(*Parser).builder.NewTokenPosition(yyDollar[1].token), - IdentifierTkn: yyDollar[1].token, - Value: yyDollar[1].token.Value, - }, - } - } - case 496: - yyDollar = yyS[yypt-4 : yypt+1] - // line internal/php5/php5.y:5410 - { - yyVAL.node = &ast.ExprArrayDimFetch{ - Position: yylex.(*Parser).builder.NewTokensPosition(yyDollar[1].token, yyDollar[4].token), - Var: &ast.ExprVariable{ - Position: yylex.(*Parser).builder.NewTokenPosition(yyDollar[1].token), - Name: &ast.Identifier{ - Position: yylex.(*Parser).builder.NewTokenPosition(yyDollar[1].token), - IdentifierTkn: yyDollar[1].token, - Value: yyDollar[1].token.Value, - }, - }, - OpenBracketTkn: yyDollar[2].token, - Dim: yyDollar[3].node, - CloseBracketTkn: yyDollar[4].token, - } - } - case 497: - yyDollar = yyS[yypt-3 : yypt+1] - // line internal/php5/php5.y:5427 - { - yyVAL.node = &ast.ExprPropertyFetch{ - Position: yylex.(*Parser).builder.NewTokensPosition(yyDollar[1].token, yyDollar[3].token), - Var: &ast.ExprVariable{ - Position: yylex.(*Parser).builder.NewTokenPosition(yyDollar[1].token), - Name: &ast.Identifier{ - Position: yylex.(*Parser).builder.NewTokenPosition(yyDollar[1].token), - IdentifierTkn: yyDollar[1].token, - Value: yyDollar[1].token.Value, - }, - }, - ObjectOperatorTkn: yyDollar[2].token, - Prop: &ast.Identifier{ - Position: yylex.(*Parser).builder.NewTokenPosition(yyDollar[3].token), - IdentifierTkn: yyDollar[3].token, - Value: yyDollar[3].token.Value, - }, - } - } - case 498: - yyDollar = yyS[yypt-3 : yypt+1] - // line internal/php5/php5.y:5447 - { - yyVAL.node = &ast.ScalarEncapsedStringVar{ - Position: yylex.(*Parser).builder.NewTokensPosition(yyDollar[1].token, yyDollar[3].token), - DollarOpenCurlyBracketTkn: yyDollar[1].token, - Name: yyDollar[2].node, - CloseCurlyBracketTkn: yyDollar[3].token, - } - } - case 499: - yyDollar = yyS[yypt-3 : yypt+1] - // line internal/php5/php5.y:5456 - { - yyVAL.node = &ast.ScalarEncapsedStringVar{ - Position: yylex.(*Parser).builder.NewTokensPosition(yyDollar[1].token, yyDollar[3].token), - DollarOpenCurlyBracketTkn: yyDollar[1].token, - Name: &ast.Identifier{ - Position: yylex.(*Parser).builder.NewTokenPosition(yyDollar[2].token), - IdentifierTkn: yyDollar[2].token, - Value: yyDollar[2].token.Value, - }, - CloseCurlyBracketTkn: yyDollar[3].token, - } - } - case 500: - yyDollar = yyS[yypt-6 : yypt+1] - // line internal/php5/php5.y:5469 - { - yyVAL.node = &ast.ScalarEncapsedStringVar{ - Position: yylex.(*Parser).builder.NewTokensPosition(yyDollar[1].token, yyDollar[3].token), - DollarOpenCurlyBracketTkn: yyDollar[1].token, - Name: &ast.Identifier{ - Position: yylex.(*Parser).builder.NewTokenPosition(yyDollar[2].token), - IdentifierTkn: yyDollar[2].token, - Value: yyDollar[2].token.Value, - }, - OpenSquareBracketTkn: yyDollar[3].token, - Dim: yyDollar[4].node, - CloseSquareBracketTkn: yyDollar[5].token, - CloseCurlyBracketTkn: yyDollar[6].token, - } - } - case 501: - yyDollar = yyS[yypt-3 : yypt+1] - // line internal/php5/php5.y:5485 - { - yyVAL.node = &ast.ScalarEncapsedStringBrackets{ - Position: yylex.(*Parser).builder.NewTokensPosition(yyDollar[1].token, yyDollar[3].token), - OpenCurlyBracketTkn: yyDollar[1].token, - Var: yyDollar[2].node, - CloseCurlyBracketTkn: yyDollar[3].token, - } - } - case 502: - yyDollar = yyS[yypt-1 : yypt+1] - // line internal/php5/php5.y:5497 - { - yyVAL.node = &ast.ScalarString{ - Position: yylex.(*Parser).builder.NewTokenPosition(yyDollar[1].token), - StringTkn: yyDollar[1].token, - Value: yyDollar[1].token.Value, - } - } - case 503: - yyDollar = yyS[yypt-1 : yypt+1] - // line internal/php5/php5.y:5505 - { - // TODO: add option to handle 64 bit integer - if _, err := strconv.Atoi(string(yyDollar[1].token.Value)); err == nil { - yyVAL.node = &ast.ScalarLnumber{ - Position: yylex.(*Parser).builder.NewTokenPosition(yyDollar[1].token), - NumberTkn: yyDollar[1].token, - Value: yyDollar[1].token.Value, - } - } else { - yyVAL.node = &ast.ScalarString{ - Position: yylex.(*Parser).builder.NewTokenPosition(yyDollar[1].token), - StringTkn: yyDollar[1].token, - Value: yyDollar[1].token.Value, - } - } - } - case 504: - yyDollar = yyS[yypt-1 : yypt+1] - // line internal/php5/php5.y:5522 - { - yyVAL.node = &ast.ExprVariable{ - Position: yylex.(*Parser).builder.NewTokenPosition(yyDollar[1].token), - Name: &ast.Identifier{ - Position: yylex.(*Parser).builder.NewTokenPosition(yyDollar[1].token), - IdentifierTkn: yyDollar[1].token, - Value: yyDollar[1].token.Value, - }, - } - } - case 505: - yyDollar = yyS[yypt-4 : yypt+1] - // line internal/php5/php5.y:5536 - { - yyVAL.node = &ast.ExprIsset{ - Position: yylex.(*Parser).builder.NewTokensPosition(yyDollar[1].token, yyDollar[4].token), - IssetTkn: yyDollar[1].token, - OpenParenthesisTkn: yyDollar[2].token, - Vars: yyDollar[3].node.(*ParserSeparatedList).Items, - SeparatorTkns: yyDollar[3].node.(*ParserSeparatedList).SeparatorTkns, - CloseParenthesisTkn: yyDollar[4].token, - } - } - case 506: - yyDollar = yyS[yypt-4 : yypt+1] - // line internal/php5/php5.y:5547 - { - yyVAL.node = &ast.ExprEmpty{ - Position: yylex.(*Parser).builder.NewTokensPosition(yyDollar[1].token, yyDollar[4].token), - EmptyTkn: yyDollar[1].token, - OpenParenthesisTkn: yyDollar[2].token, - Expr: yyDollar[3].node, - CloseParenthesisTkn: yyDollar[4].token, - } - } - case 507: - yyDollar = yyS[yypt-4 : yypt+1] - // line internal/php5/php5.y:5557 - { - yyVAL.node = &ast.ExprEmpty{ - Position: yylex.(*Parser).builder.NewTokensPosition(yyDollar[1].token, yyDollar[4].token), - EmptyTkn: yyDollar[1].token, - OpenParenthesisTkn: yyDollar[2].token, - Expr: yyDollar[3].node, - CloseParenthesisTkn: yyDollar[4].token, - } - } - case 508: - yyDollar = yyS[yypt-2 : yypt+1] - // line internal/php5/php5.y:5567 - { - yyVAL.node = &ast.ExprInclude{ - Position: yylex.(*Parser).builder.NewTokenNodePosition(yyDollar[1].token, yyDollar[2].node), - IncludeTkn: yyDollar[1].token, - Expr: yyDollar[2].node, - } - } - case 509: - yyDollar = yyS[yypt-2 : yypt+1] - // line internal/php5/php5.y:5575 - { - yyVAL.node = &ast.ExprIncludeOnce{ - Position: yylex.(*Parser).builder.NewTokenNodePosition(yyDollar[1].token, yyDollar[2].node), - IncludeOnceTkn: yyDollar[1].token, - Expr: yyDollar[2].node, - } - } - case 510: - yyDollar = yyS[yypt-4 : yypt+1] - // line internal/php5/php5.y:5583 - { - yyVAL.node = &ast.ExprEval{ - Position: yylex.(*Parser).builder.NewTokensPosition(yyDollar[1].token, yyDollar[4].token), - EvalTkn: yyDollar[1].token, - OpenParenthesisTkn: yyDollar[2].token, - Expr: yyDollar[3].node, - CloseParenthesisTkn: yyDollar[4].token, - } - } - case 511: - yyDollar = yyS[yypt-2 : yypt+1] - // line internal/php5/php5.y:5593 - { - yyVAL.node = &ast.ExprRequire{ - Position: yylex.(*Parser).builder.NewTokenNodePosition(yyDollar[1].token, yyDollar[2].node), - RequireTkn: yyDollar[1].token, - Expr: yyDollar[2].node, - } - } - case 512: - yyDollar = yyS[yypt-2 : yypt+1] - // line internal/php5/php5.y:5601 - { - yyVAL.node = &ast.ExprRequireOnce{ - Position: yylex.(*Parser).builder.NewTokenNodePosition(yyDollar[1].token, yyDollar[2].node), - RequireOnceTkn: yyDollar[1].token, - Expr: yyDollar[2].node, - } - } - case 513: - yyDollar = yyS[yypt-1 : yypt+1] - // line internal/php5/php5.y:5612 - { - yyVAL.node = &ParserSeparatedList{ - Items: []ast.Vertex{yyDollar[1].node}, - } - } - case 514: - yyDollar = yyS[yypt-3 : yypt+1] - // line internal/php5/php5.y:5618 - { - yyDollar[1].node.(*ParserSeparatedList).SeparatorTkns = append(yyDollar[1].node.(*ParserSeparatedList).SeparatorTkns, yyDollar[2].token) - yyDollar[1].node.(*ParserSeparatedList).Items = append(yyDollar[1].node.(*ParserSeparatedList).Items, yyDollar[3].node) - - yyVAL.node = yyDollar[1].node - } - case 515: - yyDollar = yyS[yypt-1 : yypt+1] - // line internal/php5/php5.y:5628 - { - yyVAL.node = yyDollar[1].node - } - case 516: - yyDollar = yyS[yypt-1 : yypt+1] - // line internal/php5/php5.y:5632 - { - yyVAL.node = yyDollar[1].node - } - case 517: - yyDollar = yyS[yypt-3 : yypt+1] - // line internal/php5/php5.y:5639 - { - yyVAL.node = &ast.ExprClassConstFetch{ - Position: yylex.(*Parser).builder.NewNodeTokenPosition(yyDollar[1].node, yyDollar[3].token), - Class: yyDollar[1].node, - DoubleColonTkn: yyDollar[2].token, - Const: &ast.Identifier{ - Position: yylex.(*Parser).builder.NewTokenPosition(yyDollar[3].token), - IdentifierTkn: yyDollar[3].token, - Value: yyDollar[3].token.Value, - }, - } - } - case 518: - yyDollar = yyS[yypt-3 : yypt+1] - // line internal/php5/php5.y:5652 - { - yyVAL.node = &ast.ExprClassConstFetch{ - Position: yylex.(*Parser).builder.NewNodeTokenPosition(yyDollar[1].node, yyDollar[3].token), - Class: yyDollar[1].node, - DoubleColonTkn: yyDollar[2].token, - Const: &ast.Identifier{ - Position: yylex.(*Parser).builder.NewTokenPosition(yyDollar[3].token), - IdentifierTkn: yyDollar[3].token, - Value: yyDollar[3].token.Value, - }, - } - } - case 519: - yyDollar = yyS[yypt-3 : yypt+1] - // line internal/php5/php5.y:5668 - { - yyVAL.node = &ast.ExprClassConstFetch{ - Position: yylex.(*Parser).builder.NewNodeTokenPosition(yyDollar[1].node, yyDollar[3].token), - Class: yyDollar[1].node, - DoubleColonTkn: yyDollar[2].token, - Const: &ast.Identifier{ - Position: yylex.(*Parser).builder.NewTokenPosition(yyDollar[3].token), - IdentifierTkn: yyDollar[3].token, - Value: yyDollar[3].token.Value, - }, - } - } - case 520: - yyDollar = yyS[yypt-3 : yypt+1] - // line internal/php5/php5.y:5684 - { - yyVAL.node = &ast.ExprClassConstFetch{ - Position: yylex.(*Parser).builder.NewNodeTokenPosition(yyDollar[1].node, yyDollar[3].token), - Class: yyDollar[1].node, - DoubleColonTkn: yyDollar[2].token, - Const: &ast.Identifier{ - Position: yylex.(*Parser).builder.NewTokenPosition(yyDollar[3].token), - IdentifierTkn: yyDollar[3].token, - Value: yyDollar[3].token.Value, - }, - } - } - } - goto yystack /* stack new state and value */ -} diff --git a/internal/php5/php5.y b/internal/php5/php5.y deleted file mode 100644 index 980f50a..0000000 --- a/internal/php5/php5.y +++ /dev/null @@ -1,5698 +0,0 @@ -%{ -package php5 - -import ( - "strconv" - - "github.com/VKCOM/php-parser/pkg/ast" - "github.com/VKCOM/php-parser/pkg/errors" - "github.com/VKCOM/php-parser/pkg/token" -) - -%} - -%union{ - node ast.Vertex - token *token.Token - list []ast.Vertex -} - -%token T_INCLUDE -%token T_INCLUDE_ONCE -%token T_EXIT -%token T_IF -%token T_LNUMBER -%token T_DNUMBER -%token T_STRING -%token T_STRING_VARNAME -%token T_VARIABLE -%token T_NUM_STRING -%token T_INLINE_HTML -%token T_CHARACTER -%token T_BAD_CHARACTER -%token T_ENCAPSED_AND_WHITESPACE -%token T_CONSTANT_ENCAPSED_STRING -%token T_ECHO -%token T_DO -%token T_WHILE -%token T_ENDWHILE -%token T_FOR -%token T_ENDFOR -%token T_FOREACH -%token T_ENDFOREACH -%token T_DECLARE -%token T_ENDDECLARE -%token T_AS -%token T_SWITCH -%token T_ENDSWITCH -%token T_CASE -%token T_DEFAULT -%token T_BREAK -%token T_CONTINUE -%token T_GOTO -%token T_FUNCTION -%token T_FN -%token T_CONST -%token T_RETURN -%token T_TRY -%token T_CATCH -%token T_FINALLY -%token T_THROW -%token T_USE -%token T_INSTEADOF -%token T_GLOBAL -%token T_VAR -%token T_UNSET -%token T_ISSET -%token T_EMPTY -%token T_HALT_COMPILER -%token T_CLASS -%token T_TRAIT -%token T_INTERFACE -%token T_EXTENDS -%token T_IMPLEMENTS -%token T_OBJECT_OPERATOR -%token T_DOUBLE_ARROW -%token T_LIST -%token T_ARRAY -%token T_CALLABLE -%token T_CLASS_C -%token T_TRAIT_C -%token T_METHOD_C -%token T_FUNC_C -%token T_LINE -%token T_FILE -%token T_COMMENT -%token T_DOC_COMMENT -%token T_OPEN_TAG -%token T_OPEN_TAG_WITH_ECHO -%token T_CLOSE_TAG -%token T_WHITESPACE -%token T_START_HEREDOC -%token T_END_HEREDOC -%token T_DOLLAR_OPEN_CURLY_BRACES -%token T_CURLY_OPEN -%token T_PAAMAYIM_NEKUDOTAYIM -%token T_NAMESPACE -%token T_NS_C -%token T_DIR -%token T_NS_SEPARATOR -%token T_ELLIPSIS -%token T_EVAL -%token T_REQUIRE -%token T_REQUIRE_ONCE -%token T_LOGICAL_OR -%token T_LOGICAL_XOR -%token T_LOGICAL_AND -%token T_INSTANCEOF -%token T_NEW -%token T_CLONE -%token T_ELSEIF -%token T_ELSE -%token T_ENDIF -%token T_PRINT -%token T_YIELD -%token T_STATIC -%token T_ABSTRACT -%token T_FINAL -%token T_PRIVATE -%token T_PROTECTED -%token T_PUBLIC -%token T_INC -%token T_DEC -%token T_YIELD_FROM -%token T_INT_CAST -%token T_DOUBLE_CAST -%token T_STRING_CAST -%token T_ARRAY_CAST -%token T_OBJECT_CAST -%token T_BOOL_CAST -%token T_UNSET_CAST -%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_COALESCE_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 '{' -%token '}' -%token ';' -%token ':' -%token '(' -%token ')' -%token '[' -%token ']' -%token '?' -%token '&' -%token '-' -%token '+' -%token '!' -%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 ',' -%left T_LOGICAL_OR -%left T_LOGICAL_XOR -%left T_LOGICAL_AND -%right T_PRINT -%right T_YIELD -%left '=' 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 -%left '?' ':' -%left T_BOOLEAN_OR -%left T_BOOLEAN_AND -%left '|' -%left '^' -%left '&' -%nonassoc T_IS_EQUAL T_IS_NOT_EQUAL T_IS_IDENTICAL T_IS_NOT_IDENTICAL -%nonassoc '<' T_IS_SMALLER_OR_EQUAL '>' T_IS_GREATER_OR_EQUAL -%left T_SL T_SR -%left '+' '-' '.' -%left '*' '/' '%' -%right '!' -%nonassoc T_INSTANCEOF -%right '~' T_INC T_DEC T_INT_CAST T_DOUBLE_CAST T_STRING_CAST T_ARRAY_CAST T_OBJECT_CAST T_BOOL_CAST T_UNSET_CAST '@' -%right T_POW -%right '[' -%nonassoc T_NEW T_CLONE -%left T_ELSEIF -%left T_ELSE -%left T_ENDIF -%right T_STATIC T_ABSTRACT T_FINAL T_PRIVATE T_PROTECTED T_PUBLIC - -%type function interface_entry -%type possible_comma -%type case_separator -%type is_reference is_variadic - -%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 -%type dim_offset expr expr_without_variable r_variable w_variable rw_variable variable base_variable_with_function_calls -%type base_variable array_function_dereference function_call inner_statement statement unticked_statement -%type statement global_var static_scalar scalar class_constant static_class_name_scalar class_name_scalar -%type encaps_var encaps_var encaps_var_offset general_constant isset_variable internal_functions_in_yacc assignment_list_element -%type variable_name variable_without_objects dynamic_class_name_reference new_expr class_name_reference static_member -%type function_call fully_qualified_class_name combined_scalar combined_scalar_offset general_constant parenthesis_expr -%type exit_expr yield_expr function_declaration_statement class_declaration_statement constant_declaration -%type else_single new_else_single unset_variable declare_statement parameter_list non_empty_parameter_list -%type finally_statement additional_catch unticked_function_declaration_statement unticked_class_declaration_statement -%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 static_var_list global_var_list -%type ctor_arguments function_call_parameter_list echo_expr_list class_variable_declaration -%type trait_adaptations unset_variables declare_list non_empty_array_pair_list array_pair_list -%type switch_case_list non_empty_function_call_parameter_list assignment_list lexical_var_list -%type method_body trait_reference_list static_array_pair_list non_empty_static_array_pair_list -%type foreach_statement for_statement while_statement isset_variables -%type foreach_variable foreach_optional_arg for_expr non_empty_for_expr -%type extends_from interface_list trait_list namespace_name -%type implements_list use_declarations use_function_declarations use_const_declarations -%type interface_extends_list -%type lexical_vars - -%type top_statement_list -%type inner_statement_list encaps_list -%type elseif_list new_elseif_list -%type case_list catch_statement additional_catches -%type non_empty_additional_catches class_statement_list -%type class_statement_list variable_modifiers method_modifiers -%type trait_adaptation_list non_empty_trait_adaptation_list -%type non_empty_member_modifiers backticks_expr - -%type chaining_dereference chaining_instance_call chaining_method_or_property instance_call variable_property -%type method_or_not array_method_dereference object_property object_dim_list dynamic_class_name_variable_property -%type dynamic_class_name_variable_properties variable_properties - -%type simple_indirect_reference - -%% - -start: - top_statement_list - { - yylex.(*Parser).currentToken.Value = nil - - yylex.(*Parser).rootNode = &ast.Root{ - Position: yylex.(*Parser).builder.NewNodeListPosition($1), - Stmts: $1, - EndTkn: yylex.(*Parser).currentToken, - } - } -; - -top_statement_list: - top_statement_list top_statement - { - if $2 != nil { - $$ = append($1, $2) - } - } - | /* empty */ - { - $$ = []ast.Vertex{} - } -; - -namespace_name: - T_STRING - { - $$ = &ParserSeparatedList{ - Items: []ast.Vertex{ - &ast.NamePart{ - Position: yylex.(*Parser).builder.NewTokenPosition($1), - StringTkn: $1, - Value: $1.Value, - }, - }, - } - } - | namespace_name T_NS_SEPARATOR T_STRING - { - part := &ast.NamePart{ - Position: yylex.(*Parser).builder.NewTokenPosition($3), - StringTkn: $3, - Value: $3.Value, - } - - $1.(*ParserSeparatedList).SeparatorTkns = append($1.(*ParserSeparatedList).SeparatorTkns, $2) - $1.(*ParserSeparatedList).Items = append($1.(*ParserSeparatedList).Items, part) - - $$ = $1 - } -; - -top_statement: - error - { - // error - $$ = nil - } - | statement - { - $$ = $1 - } - | function_declaration_statement - { - $$ = $1 - } - | class_declaration_statement - { - $$ = $1 - } - | T_HALT_COMPILER '(' ')' ';' - { - $$ = &ast.StmtHaltCompiler{ - Position: yylex.(*Parser).builder.NewTokensPosition($1, $4), - HaltCompilerTkn: $1, - OpenParenthesisTkn: $2, - CloseParenthesisTkn: $3, - SemiColonTkn: $4, - } - } - | T_NAMESPACE namespace_name ';' - { - $$ = &ast.StmtNamespace{ - Position: yylex.(*Parser).builder.NewTokensPosition($1, $3), - NsTkn: $1, - Name: &ast.Name{ - Position: yylex.(*Parser).builder.NewNodeListPosition($2.(*ParserSeparatedList).Items), - Parts: $2.(*ParserSeparatedList).Items, - SeparatorTkns: $2.(*ParserSeparatedList).SeparatorTkns, - }, - SemiColonTkn: $3, - } - } - | T_NAMESPACE namespace_name '{' top_statement_list '}' - { - $$ = &ast.StmtNamespace{ - Position: yylex.(*Parser).builder.NewTokensPosition($1, $5), - NsTkn: $1, - Name: &ast.Name{ - Position: yylex.(*Parser).builder.NewNodeListPosition($2.(*ParserSeparatedList).Items), - Parts: $2.(*ParserSeparatedList).Items, - SeparatorTkns: $2.(*ParserSeparatedList).SeparatorTkns, - }, - OpenCurlyBracketTkn: $3, - Stmts: $4, - CloseCurlyBracketTkn: $5, - } - } - | T_NAMESPACE '{' top_statement_list '}' - { - $$ = &ast.StmtNamespace{ - Position: yylex.(*Parser).builder.NewTokensPosition($1, $4), - NsTkn: $1, - OpenCurlyBracketTkn: $2, - Stmts: $3, - CloseCurlyBracketTkn: $4, - } - } - | T_USE use_declarations ';' - { - $$ = &ast.StmtUseList{ - Position: yylex.(*Parser).builder.NewTokensPosition($1, $3), - UseTkn: $1, - Uses: $2.(*ParserSeparatedList).Items, - SeparatorTkns: $2.(*ParserSeparatedList).SeparatorTkns, - SemiColonTkn: $3, - } - } - | T_USE T_FUNCTION use_function_declarations ';' - { - $$ = &ast.StmtUseList{ - Position: yylex.(*Parser).builder.NewTokensPosition($1, $4), - UseTkn: $1, - Type: &ast.Identifier{ - Position: yylex.(*Parser).builder.NewTokenPosition($2), - IdentifierTkn: $2, - Value: $2.Value, - }, - Uses: $3.(*ParserSeparatedList).Items, - SeparatorTkns: $3.(*ParserSeparatedList).SeparatorTkns, - SemiColonTkn: $4, - } - } - | T_USE T_CONST use_const_declarations ';' - { - $$ = &ast.StmtUseList{ - Position: yylex.(*Parser).builder.NewTokensPosition($1, $4), - UseTkn: $1, - Type: &ast.Identifier{ - Position: yylex.(*Parser).builder.NewTokenPosition($2), - IdentifierTkn: $2, - Value: $2.Value, - }, - Uses: $3.(*ParserSeparatedList).Items, - SeparatorTkns: $3.(*ParserSeparatedList).SeparatorTkns, - SemiColonTkn: $4, - } - } - | constant_declaration ';' - { - $1.(*ast.StmtConstList).SemiColonTkn = $2 - $1.(*ast.StmtConstList).Position = yylex.(*Parser).builder.NewNodeTokenPosition($1, $2) - $$ = $1 - } -; - -use_declarations: - use_declarations ',' use_declaration - { - $1.(*ParserSeparatedList).SeparatorTkns = append($1.(*ParserSeparatedList).SeparatorTkns, $2) - $1.(*ParserSeparatedList).Items = append($1.(*ParserSeparatedList).Items, $3) - - $$ = $1 - } - | use_declaration - { - $$ = &ParserSeparatedList{ - Items: []ast.Vertex{$1}, - } - } -; - -use_declaration: - namespace_name - { - $$ = &ast.StmtUse{ - Position: yylex.(*Parser).builder.NewNodeListPosition($1.(*ParserSeparatedList).Items), - Use: &ast.Name{ - Position: yylex.(*Parser).builder.NewNodeListPosition($1.(*ParserSeparatedList).Items), - Parts: $1.(*ParserSeparatedList).Items, - SeparatorTkns: $1.(*ParserSeparatedList).SeparatorTkns, - }, - } - } - | namespace_name T_AS T_STRING - { - $$ = &ast.StmtUse{ - Position: yylex.(*Parser).builder.NewNodeListTokenPosition($1.(*ParserSeparatedList).Items, $3), - Use: &ast.Name{ - Position: yylex.(*Parser).builder.NewNodeListPosition($1.(*ParserSeparatedList).Items), - Parts: $1.(*ParserSeparatedList).Items, - SeparatorTkns: $1.(*ParserSeparatedList).SeparatorTkns, - }, - AsTkn: $2, - Alias: &ast.Identifier{ - Position: yylex.(*Parser).builder.NewTokenPosition($3), - IdentifierTkn: $3, - Value: $3.Value, - }, - } - } - | T_NS_SEPARATOR namespace_name - { - $$ = &ast.StmtUse{ - Position: yylex.(*Parser).builder.NewTokenNodeListPosition($1, $2.(*ParserSeparatedList).Items), - NsSeparatorTkn: $1, - Use: &ast.Name{ - Position: yylex.(*Parser).builder.NewNodeListPosition($2.(*ParserSeparatedList).Items), - Parts: $2.(*ParserSeparatedList).Items, - SeparatorTkns: $2.(*ParserSeparatedList).SeparatorTkns, - }, - } - } - | T_NS_SEPARATOR namespace_name T_AS T_STRING - { - $$ = &ast.StmtUse{ - Position: yylex.(*Parser).builder.NewTokensPosition($1, $4), - NsSeparatorTkn: $1, - Use: &ast.Name{ - Position: yylex.(*Parser).builder.NewNodeListPosition($2.(*ParserSeparatedList).Items), - Parts: $2.(*ParserSeparatedList).Items, - SeparatorTkns: $2.(*ParserSeparatedList).SeparatorTkns, - }, - AsTkn: $3, - Alias: &ast.Identifier{ - Position: yylex.(*Parser).builder.NewTokenPosition($4), - IdentifierTkn: $4, - Value: $4.Value, - }, - } - } -; - -use_function_declarations: - use_function_declarations ',' use_function_declaration - { - $1.(*ParserSeparatedList).SeparatorTkns = append($1.(*ParserSeparatedList).SeparatorTkns, $2) - $1.(*ParserSeparatedList).Items = append($1.(*ParserSeparatedList).Items, $3) - - $$ = $1 - } - | use_function_declaration - { - $$ = &ParserSeparatedList{ - Items: []ast.Vertex{$1}, - } - } -; - -use_function_declaration: - namespace_name - { - $$ = &ast.StmtUse{ - Position: yylex.(*Parser).builder.NewNodeListPosition($1.(*ParserSeparatedList).Items), - Use: &ast.Name{ - Position: yylex.(*Parser).builder.NewNodeListPosition($1.(*ParserSeparatedList).Items), - Parts: $1.(*ParserSeparatedList).Items, - SeparatorTkns: $1.(*ParserSeparatedList).SeparatorTkns, - }, - } - } - | namespace_name T_AS T_STRING - { - $$ = &ast.StmtUse{ - Position: yylex.(*Parser).builder.NewNodeListTokenPosition($1.(*ParserSeparatedList).Items, $3), - Use: &ast.Name{ - Position: yylex.(*Parser).builder.NewNodeListPosition($1.(*ParserSeparatedList).Items), - Parts: $1.(*ParserSeparatedList).Items, - SeparatorTkns: $1.(*ParserSeparatedList).SeparatorTkns, - }, - AsTkn: $2, - Alias: &ast.Identifier{ - Position: yylex.(*Parser).builder.NewTokenPosition($3), - IdentifierTkn: $3, - Value: $3.Value, - }, - } - } - | T_NS_SEPARATOR namespace_name - { - $$ = &ast.StmtUse{ - Position: yylex.(*Parser).builder.NewTokenNodeListPosition($1, $2.(*ParserSeparatedList).Items), - NsSeparatorTkn: $1, - Use: &ast.Name{ - Position: yylex.(*Parser).builder.NewNodeListPosition($2.(*ParserSeparatedList).Items), - Parts: $2.(*ParserSeparatedList).Items, - SeparatorTkns: $2.(*ParserSeparatedList).SeparatorTkns, - }, - } - } - | T_NS_SEPARATOR namespace_name T_AS T_STRING - { - $$ = &ast.StmtUse{ - Position: yylex.(*Parser).builder.NewTokensPosition($1, $4), - NsSeparatorTkn: $1, - Use: &ast.Name{ - Position: yylex.(*Parser).builder.NewNodeListPosition($2.(*ParserSeparatedList).Items), - Parts: $2.(*ParserSeparatedList).Items, - SeparatorTkns: $2.(*ParserSeparatedList).SeparatorTkns, - }, - AsTkn: $3, - Alias: &ast.Identifier{ - Position: yylex.(*Parser).builder.NewTokenPosition($4), - IdentifierTkn: $4, - Value: $4.Value, - }, - } - } -; - -use_const_declarations: - use_const_declarations ',' use_const_declaration - { - $1.(*ParserSeparatedList).SeparatorTkns = append($1.(*ParserSeparatedList).SeparatorTkns, $2) - $1.(*ParserSeparatedList).Items = append($1.(*ParserSeparatedList).Items, $3) - - $$ = $1 - } - | use_const_declaration - { - $$ = &ParserSeparatedList{ - Items: []ast.Vertex{$1}, - } - } -; - -use_const_declaration: - namespace_name - { - $$ = &ast.StmtUse{ - Position: yylex.(*Parser).builder.NewNodeListPosition($1.(*ParserSeparatedList).Items), - Use: &ast.Name{ - Position: yylex.(*Parser).builder.NewNodeListPosition($1.(*ParserSeparatedList).Items), - Parts: $1.(*ParserSeparatedList).Items, - SeparatorTkns: $1.(*ParserSeparatedList).SeparatorTkns, - }, - } - } - | namespace_name T_AS T_STRING - { - $$ = &ast.StmtUse{ - Position: yylex.(*Parser).builder.NewNodeListTokenPosition($1.(*ParserSeparatedList).Items, $3), - Use: &ast.Name{ - Position: yylex.(*Parser).builder.NewNodeListPosition($1.(*ParserSeparatedList).Items), - Parts: $1.(*ParserSeparatedList).Items, - SeparatorTkns: $1.(*ParserSeparatedList).SeparatorTkns, - }, - AsTkn: $2, - Alias: &ast.Identifier{ - Position: yylex.(*Parser).builder.NewTokenPosition($3), - IdentifierTkn: $3, - Value: $3.Value, - }, - } - } - | T_NS_SEPARATOR namespace_name - { - $$ = &ast.StmtUse{ - Position: yylex.(*Parser).builder.NewTokenNodeListPosition($1, $2.(*ParserSeparatedList).Items), - NsSeparatorTkn: $1, - Use: &ast.Name{ - Position: yylex.(*Parser).builder.NewNodeListPosition($2.(*ParserSeparatedList).Items), - Parts: $2.(*ParserSeparatedList).Items, - SeparatorTkns: $2.(*ParserSeparatedList).SeparatorTkns, - }, - } - } - | T_NS_SEPARATOR namespace_name T_AS T_STRING - { - $$ = &ast.StmtUse{ - Position: yylex.(*Parser).builder.NewTokensPosition($1, $4), - NsSeparatorTkn: $1, - Use: &ast.Name{ - Position: yylex.(*Parser).builder.NewNodeListPosition($2.(*ParserSeparatedList).Items), - Parts: $2.(*ParserSeparatedList).Items, - SeparatorTkns: $2.(*ParserSeparatedList).SeparatorTkns, - }, - AsTkn: $3, - Alias: &ast.Identifier{ - Position: yylex.(*Parser).builder.NewTokenPosition($4), - IdentifierTkn: $4, - Value: $4.Value, - }, - } - } -; - -constant_declaration: - constant_declaration ',' T_STRING '=' static_scalar - { - constList := $1.(*ast.StmtConstList) - constList.Position = yylex.(*Parser).builder.NewNodesPosition($1, $5) - constList.SeparatorTkns = append(constList.SeparatorTkns, $2) - constList.Consts = append(constList.Consts, &ast.StmtConstant{ - Position: yylex.(*Parser).builder.NewTokenNodePosition($3, $5), - Name: &ast.Identifier{ - Position: yylex.(*Parser).builder.NewTokenPosition($3), - IdentifierTkn: $3, - Value: $3.Value, - }, - EqualTkn: $4, - Expr: $5, - }) - - $$ = $1 - } - | T_CONST T_STRING '=' static_scalar - { - $$ = &ast.StmtConstList{ - Position: yylex.(*Parser).builder.NewTokenNodePosition($1, $4), - ConstTkn: $1, - Consts: []ast.Vertex{ - &ast.StmtConstant{ - Position: yylex.(*Parser).builder.NewTokenNodePosition($2, $4), - Name: &ast.Identifier{ - Position: yylex.(*Parser).builder.NewTokenPosition($2), - IdentifierTkn: $2, - Value: $2.Value, - }, - EqualTkn: $3, - Expr: $4, - }, - }, - } - } -; - -inner_statement_list: - inner_statement_list inner_statement - { - if $2 != nil { - $$ = append($1, $2) - } - } - | /* empty */ - { - $$ = []ast.Vertex{} - } -; - - -inner_statement: - error - { - // error - $$ = nil - } - | statement - { - $$ = $1 - } - | function_declaration_statement - { - $$ = $1 - } - | class_declaration_statement - { - $$ = $1 - } - | T_HALT_COMPILER '(' ')' ';' - { - $$ = &ast.StmtHaltCompiler{ - Position: yylex.(*Parser).builder.NewTokensPosition($1, $4), - HaltCompilerTkn: $1, - OpenParenthesisTkn: $2, - CloseParenthesisTkn: $3, - SemiColonTkn: $4, - } - } -; - - -statement: - unticked_statement - { - $$ = $1 - } - | T_STRING ':' - { - $$ = &ast.StmtLabel{ - Position: yylex.(*Parser).builder.NewTokensPosition($1, $2), - Name: &ast.Identifier{ - Position: yylex.(*Parser).builder.NewTokenPosition($1), - IdentifierTkn: $1, - Value: $1.Value, - }, - ColonTkn: $2, - } - } -; - -unticked_statement: - '{' inner_statement_list '}' - { - $$ = &ast.StmtStmtList{ - Position: yylex.(*Parser).builder.NewTokensPosition($1, $3), - OpenCurlyBracketTkn: $1, - Stmts: $2, - CloseCurlyBracketTkn: $3, - } - } - | T_IF parenthesis_expr statement elseif_list else_single - { - pos := yylex.(*Parser).builder.NewTokenNodePosition($1, $3) - if $5 != nil { - pos = yylex.(*Parser).builder.NewTokenNodePosition($1, $5) - } else if len($4) > 0 { - pos = yylex.(*Parser).builder.NewTokenNodeListPosition($1, $4) - } - - $$ = &ast.StmtIf{ - Position: pos, - IfTkn: $1, - OpenParenthesisTkn: $2.(*ast.ExprBrackets).OpenParenthesisTkn, - Cond: $2.(*ast.ExprBrackets).Expr, - CloseParenthesisTkn: $2.(*ast.ExprBrackets).CloseParenthesisTkn, - Stmt: $3, - ElseIf: $4, - Else: $5, - } - } - | T_IF parenthesis_expr ':' inner_statement_list new_elseif_list new_else_single T_ENDIF ';' - { - $$ = &ast.StmtIf{ - Position: yylex.(*Parser).builder.NewTokensPosition($1, $8), - IfTkn: $1, - OpenParenthesisTkn: $2.(*ast.ExprBrackets).OpenParenthesisTkn, - Cond: $2.(*ast.ExprBrackets).Expr, - CloseParenthesisTkn: $2.(*ast.ExprBrackets).CloseParenthesisTkn, - ColonTkn: $3, - Stmt: &ast.StmtStmtList{ - Position: yylex.(*Parser).builder.NewNodeListPosition($4), - Stmts: $4, - }, - ElseIf: $5, - Else: $6, - EndIfTkn: $7, - SemiColonTkn: $8, - } - } - | T_WHILE parenthesis_expr while_statement - { - $3.(*ast.StmtWhile).WhileTkn = $1 - $3.(*ast.StmtWhile).OpenParenthesisTkn = $2.(*ast.ExprBrackets).OpenParenthesisTkn - $3.(*ast.StmtWhile).Cond = $2.(*ast.ExprBrackets).Expr - $3.(*ast.StmtWhile).CloseParenthesisTkn = $2.(*ast.ExprBrackets).CloseParenthesisTkn - $3.(*ast.StmtWhile).Position = yylex.(*Parser).builder.NewTokenNodePosition($1, $3) - - $$ = $3 - } - | T_DO statement T_WHILE parenthesis_expr ';' - { - $$ = &ast.StmtDo{ - Position: yylex.(*Parser).builder.NewTokensPosition($1, $5), - DoTkn: $1, - Stmt: $2, - WhileTkn: $3, - OpenParenthesisTkn: $4.(*ast.ExprBrackets).OpenParenthesisTkn, - Cond: $4.(*ast.ExprBrackets).Expr, - CloseParenthesisTkn: $4.(*ast.ExprBrackets).CloseParenthesisTkn, - SemiColonTkn: $5, - } - } - | T_FOR '(' for_expr ';' for_expr ';' for_expr ')' for_statement - { - $9.(*ast.StmtFor).ForTkn = $1 - $9.(*ast.StmtFor).OpenParenthesisTkn = $2 - $9.(*ast.StmtFor).Init = $3.(*ParserSeparatedList).Items - $9.(*ast.StmtFor).InitSeparatorTkns = $3.(*ParserSeparatedList).SeparatorTkns - $9.(*ast.StmtFor).InitSemiColonTkn = $4 - $9.(*ast.StmtFor).Cond = $5.(*ParserSeparatedList).Items - $9.(*ast.StmtFor).CondSeparatorTkns = $5.(*ParserSeparatedList).SeparatorTkns - $9.(*ast.StmtFor).CondSemiColonTkn = $6 - $9.(*ast.StmtFor).Loop = $7.(*ParserSeparatedList).Items - $9.(*ast.StmtFor).LoopSeparatorTkns = $7.(*ParserSeparatedList).SeparatorTkns - $9.(*ast.StmtFor).CloseParenthesisTkn = $8 - $9.(*ast.StmtFor).Position = yylex.(*Parser).builder.NewTokenNodePosition($1, $9) - - $$ = $9 - } - | T_SWITCH parenthesis_expr switch_case_list - { - $3.(*ast.StmtSwitch).SwitchTkn = $1 - $3.(*ast.StmtSwitch).OpenParenthesisTkn = $2.(*ast.ExprBrackets).OpenParenthesisTkn - $3.(*ast.StmtSwitch).Cond = $2.(*ast.ExprBrackets).Expr - $3.(*ast.StmtSwitch).CloseParenthesisTkn = $2.(*ast.ExprBrackets).CloseParenthesisTkn - $3.(*ast.StmtSwitch).Position = yylex.(*Parser).builder.NewTokenNodePosition($1, $3) - - $$ = $3 - } - | T_BREAK ';' - { - $$ = &ast.StmtBreak{ - Position: yylex.(*Parser).builder.NewTokensPosition($1, $2), - BreakTkn: $1, - SemiColonTkn: $2, - } - } - | T_BREAK expr ';' - { - $$ = &ast.StmtBreak{ - Position: yylex.(*Parser).builder.NewTokensPosition($1, $3), - BreakTkn: $1, - Expr: $2, - SemiColonTkn: $3, - } - } - | T_CONTINUE ';' - { - $$ = &ast.StmtContinue{ - Position: yylex.(*Parser).builder.NewTokensPosition($1, $2), - ContinueTkn: $1, - SemiColonTkn: $2, - } - } - | T_CONTINUE expr ';' - { - $$ = &ast.StmtContinue{ - Position: yylex.(*Parser).builder.NewTokensPosition($1, $3), - ContinueTkn: $1, - Expr: $2, - SemiColonTkn: $3, - } - } - | T_RETURN ';' - { - $$ = &ast.StmtReturn{ - Position: yylex.(*Parser).builder.NewTokensPosition($1, $2), - ReturnTkn: $1, - SemiColonTkn: $2, - } - } - | T_RETURN expr_without_variable ';' - { - $$ = &ast.StmtReturn{ - Position: yylex.(*Parser).builder.NewTokensPosition($1, $3), - ReturnTkn: $1, - Expr: $2, - SemiColonTkn: $3, - } - } - | T_RETURN variable ';' - { - $$ = &ast.StmtReturn{ - Position: yylex.(*Parser).builder.NewTokensPosition($1, $3), - ReturnTkn: $1, - Expr: $2, - SemiColonTkn: $3, - } - } - | yield_expr ';' - { - $$ = &ast.StmtExpression{ - Position: yylex.(*Parser).builder.NewNodeTokenPosition($1, $2), - Expr: $1, - SemiColonTkn: $2, - } - } - | T_GLOBAL global_var_list ';' - { - $2.(*ast.StmtGlobal).GlobalTkn = $1 - $2.(*ast.StmtGlobal).SemiColonTkn = $3 - $2.(*ast.StmtGlobal).Position = yylex.(*Parser).builder.NewTokensPosition($1, $3) - - $$ = $2 - } - | T_STATIC static_var_list ';' - { - $2.(*ast.StmtStatic).StaticTkn = $1 - $2.(*ast.StmtStatic).SemiColonTkn = $3 - $2.(*ast.StmtStatic).Position = yylex.(*Parser).builder.NewTokensPosition($1, $3) - - $$ = $2 - } - | T_ECHO echo_expr_list ';' - { - $2.(*ast.StmtEcho).EchoTkn = $1 - $2.(*ast.StmtEcho).SemiColonTkn = $3 - $2.(*ast.StmtEcho).Position = yylex.(*Parser).builder.NewTokensPosition($1, $3) - - $$ = $2 - } - | T_INLINE_HTML - { - $$ = &ast.StmtInlineHtml{ - Position: yylex.(*Parser).builder.NewTokenPosition($1), - InlineHtmlTkn: $1, - Value: $1.Value, - } - } - | expr ';' - { - $$ = &ast.StmtExpression{ - Position: yylex.(*Parser).builder.NewNodeTokenPosition($1, $2), - Expr: $1, - SemiColonTkn: $2, - } - } - | T_UNSET '(' unset_variables ')' ';' - { - $3.(*ast.StmtUnset).UnsetTkn = $1 - $3.(*ast.StmtUnset).OpenParenthesisTkn = $2 - $3.(*ast.StmtUnset).CloseParenthesisTkn = $4 - $3.(*ast.StmtUnset).SemiColonTkn = $5 - $3.(*ast.StmtUnset).Position = yylex.(*Parser).builder.NewTokensPosition($1, $5) - - $$ = $3 - } - | T_FOREACH '(' variable T_AS foreach_variable foreach_optional_arg ')' foreach_statement - { - foreach := $8.(*ast.StmtForeach) - - foreach.Position = yylex.(*Parser).builder.NewTokenNodePosition($1, $8) - foreach.ForeachTkn = $1 - foreach.OpenParenthesisTkn = $2 - foreach.Expr = $3 - foreach.AsTkn = $4 - foreach.Var = $5 - foreach.CloseParenthesisTkn = $7 - - if $6 != nil { - foreach.Key = foreach.Var - foreach.DoubleArrowTkn = $6.(*ast.StmtForeach).DoubleArrowTkn - foreach.Var = $6.(*ast.StmtForeach).Var - } - - if val, ok := foreach.Key.(*ast.StmtForeach); ok { - yylex.(*Parser).errHandlerFunc(errors.NewError("Key element cannot be a reference", val.AmpersandTkn.Position)) - foreach.Key = val.Var - } - - if val, ok := foreach.Var.(*ast.StmtForeach); ok { - foreach.AmpersandTkn = val.AmpersandTkn - foreach.Var = val.Var - } - - $$ = foreach - } - | T_FOREACH '(' expr_without_variable T_AS foreach_variable foreach_optional_arg ')' foreach_statement - { - foreach := $8.(*ast.StmtForeach) - - foreach.Position = yylex.(*Parser).builder.NewTokenNodePosition($1, $8) - foreach.ForeachTkn = $1 - foreach.OpenParenthesisTkn = $2 - foreach.Expr = $3 - foreach.AsTkn = $4 - foreach.Var = $5 - foreach.CloseParenthesisTkn = $7 - - if $6 != nil { - foreach.Key = foreach.Var - foreach.DoubleArrowTkn = $6.(*ast.StmtForeach).DoubleArrowTkn - foreach.Var = $6.(*ast.StmtForeach).Var - } - - if val, ok := foreach.Key.(*ast.StmtForeach); ok { - yylex.(*Parser).errHandlerFunc(errors.NewError("Key element cannot be a reference", val.AmpersandTkn.Position)) - foreach.Key = val.Var - } - - if val, ok := foreach.Var.(*ast.StmtForeach); ok { - foreach.AmpersandTkn = val.AmpersandTkn - foreach.Var = val.Var - } - - $$ = foreach - } - | T_DECLARE '(' declare_list ')' declare_statement - { - $5.(*ast.StmtDeclare).DeclareTkn = $1 - $5.(*ast.StmtDeclare).OpenParenthesisTkn = $2 - $5.(*ast.StmtDeclare).Consts = $3.(*ParserSeparatedList).Items - $5.(*ast.StmtDeclare).SeparatorTkns = $3.(*ParserSeparatedList).SeparatorTkns - $5.(*ast.StmtDeclare).CloseParenthesisTkn = $4 - $5.(*ast.StmtDeclare).Position = yylex.(*Parser).builder.NewTokenNodePosition($1, $5) - - $$ = $5 - } - | ';' - { - $$ = &ast.StmtNop{ - Position: yylex.(*Parser).builder.NewTokenPosition($1), - SemiColonTkn: $1, - } - } - | T_TRY '{' inner_statement_list '}' catch_statement finally_statement - { - pos := yylex.(*Parser).builder.NewTokenNodeListPosition($1, $5) - if $6 != nil { - pos = yylex.(*Parser).builder.NewTokenNodePosition($1, $6) - } - - $$ = &ast.StmtTry{ - Position: pos, - TryTkn: $1, - OpenCurlyBracketTkn: $2, - Stmts: $3, - CloseCurlyBracketTkn: $4, - Catches: $5, - Finally: $6, - } - } - | T_THROW expr ';' - { - $$ = &ast.StmtThrow{ - Position: yylex.(*Parser).builder.NewTokensPosition($1, $3), - ThrowTkn: $1, - Expr: $2, - SemiColonTkn: $3, - } - } - | T_GOTO T_STRING ';' - { - $$ = &ast.StmtGoto{ - Position: yylex.(*Parser).builder.NewTokensPosition($1, $3), - GotoTkn: $1, - Label: &ast.Identifier{ - Position: yylex.(*Parser).builder.NewTokenPosition($1), - IdentifierTkn: $2, - Value: $2.Value, - }, - SemiColonTkn: $3, - } - } -; - -catch_statement: - /* empty */ - { - $$ = []ast.Vertex{} - } - | T_CATCH '(' fully_qualified_class_name T_VARIABLE ')' '{' inner_statement_list '}' additional_catches - { - catch := &ast.StmtCatch{ - Position: yylex.(*Parser).builder.NewTokensPosition($1, $8), - CatchTkn: $1, - OpenParenthesisTkn: $2, - Types: []ast.Vertex{$3}, - Var: &ast.ExprVariable{ - Position: yylex.(*Parser).builder.NewTokenPosition($4), - Name: &ast.Identifier{ - Position: yylex.(*Parser).builder.NewTokenPosition($4), - IdentifierTkn: $4, - Value: $4.Value, - }, - }, - CloseParenthesisTkn: $5, - OpenCurlyBracketTkn: $6, - Stmts: $7, - CloseCurlyBracketTkn: $8, - } - $$ = append([]ast.Vertex{catch}, $9...) - } -; - -finally_statement: - /* empty */ - { - $$ = nil - } - | T_FINALLY '{' inner_statement_list '}' - { - $$ = &ast.StmtFinally{ - Position: yylex.(*Parser).builder.NewTokensPosition($1, $4), - FinallyTkn: $1, - OpenCurlyBracketTkn: $2, - Stmts: $3, - CloseCurlyBracketTkn: $4, - } - } -; - -additional_catches: - non_empty_additional_catches - { - $$ = $1 - } - | /* empty */ - { - $$ = []ast.Vertex{} - } -; - -non_empty_additional_catches: - additional_catch - { - $$ = []ast.Vertex{$1} - } - | non_empty_additional_catches additional_catch - { - $$ = append($1, $2) - } -; - -additional_catch: - T_CATCH '(' fully_qualified_class_name T_VARIABLE ')' '{' inner_statement_list '}' - { - $$ = &ast.StmtCatch{ - Position: yylex.(*Parser).builder.NewTokensPosition($1, $8), - CatchTkn: $1, - OpenParenthesisTkn: $2, - Types: []ast.Vertex{$3}, - Var: &ast.ExprVariable{ - Position: yylex.(*Parser).builder.NewTokenPosition($4), - Name: &ast.Identifier{ - Position: yylex.(*Parser).builder.NewTokenPosition($4), - IdentifierTkn: $4, - Value: $4.Value, - }, - }, - CloseParenthesisTkn: $5, - OpenCurlyBracketTkn: $6, - Stmts: $7, - CloseCurlyBracketTkn: $8, - } - } -; - -unset_variables: - unset_variable - { - $$ = &ast.StmtUnset{ - Vars: []ast.Vertex{$1}, - } - } - | unset_variables ',' unset_variable - { - $1.(*ast.StmtUnset).Vars = append($1.(*ast.StmtUnset).Vars, $3) - $1.(*ast.StmtUnset).SeparatorTkns = append($1.(*ast.StmtUnset).SeparatorTkns, $2) - - $$ = $1 - } -; - -unset_variable: - variable - { - $$ = $1 - } -; - -function_declaration_statement: - unticked_function_declaration_statement - { - $$ = $1 - } -; - -class_declaration_statement: - unticked_class_declaration_statement - { - $$ = $1 - } -; - -is_reference: - /* empty */ - { - $$ = nil - } - | '&' - { - $$ = $1 - } -; - -is_variadic: - /* empty */ - { - $$ = nil - } - | T_ELLIPSIS - { - $$ = $1 - } -; - -unticked_function_declaration_statement: - function is_reference T_STRING '(' parameter_list ')' '{' inner_statement_list '}' - { - $$ = &ast.StmtFunction{ - Position: yylex.(*Parser).builder.NewTokensPosition($1, $9), - FunctionTkn: $1, - AmpersandTkn: $2, - Name: &ast.Identifier{ - Position: yylex.(*Parser).builder.NewTokenPosition($3), - IdentifierTkn: $3, - Value: $3.Value, - }, - OpenParenthesisTkn: $4, - Params: $5.(*ParserSeparatedList).Items, - SeparatorTkns: $5.(*ParserSeparatedList).SeparatorTkns, - CloseParenthesisTkn: $6, - OpenCurlyBracketTkn: $7, - Stmts: $8, - CloseCurlyBracketTkn: $9, - } - } -; - -unticked_class_declaration_statement: - class_entry_type T_STRING extends_from implements_list '{' class_statement_list '}' - { - switch n := $1.(type) { - case *ast.StmtClass : - className := &ast.Identifier{ - Position: yylex.(*Parser).builder.NewTokenPosition($2), - IdentifierTkn: $2, - Value: $2.Value, - } - - n.Position = yylex.(*Parser).builder.NewNodeTokenPosition($1, $7) - n.Name = className - n.OpenCurlyBracketTkn = $5 - n.Stmts = $6 - n.CloseCurlyBracketTkn = $7 - - if $3 != nil { - n.ExtendsTkn = $3.(*ast.StmtClass).ExtendsTkn - n.Extends = $3.(*ast.StmtClass).Extends - } - - if $4 != nil { - n.ImplementsTkn = $4.(*ast.StmtClass).ImplementsTkn - n.Implements = $4.(*ast.StmtClass).Implements - n.ImplementsSeparatorTkns = $4.(*ast.StmtClass).ImplementsSeparatorTkns - } - case *ast.StmtTrait : - traitName := &ast.Identifier{ - Position: yylex.(*Parser).builder.NewTokenPosition($2), - IdentifierTkn: $2, - Value: $2.Value, - } - - n.Position = yylex.(*Parser).builder.NewNodeTokenPosition($1, $7) - n.Name = traitName - n.OpenCurlyBracketTkn = $5 - n.Stmts = $6 - n.CloseCurlyBracketTkn = $7 - - if $3 != nil { - yylex.(*Parser).errHandlerFunc(errors.NewError("A trait cannot extend a class. Traits can only be composed from other traits with the 'use' keyword", $3.(*ast.StmtClass).Position)) - } - - if $4 != nil { - yylex.(*Parser).errHandlerFunc(errors.NewError("A trait cannot implement an interface", $4.(*ast.StmtClass).Position)) - } - } - - $$ = $1 - } - | interface_entry T_STRING interface_extends_list '{' class_statement_list '}' - { - iface := &ast.StmtInterface{ - Position: yylex.(*Parser).builder.NewTokensPosition($1, $6), - InterfaceTkn: $1, - Name: &ast.Identifier{ - Position: yylex.(*Parser).builder.NewTokenPosition($2), - IdentifierTkn: $2, - Value: $2.Value, - }, - OpenCurlyBracketTkn: $4, - Stmts: $5, - CloseCurlyBracketTkn: $6, - } - - if $3 != nil { - iface.ExtendsTkn = $3.(*ast.StmtInterface).ExtendsTkn - iface.Extends = $3.(*ast.StmtInterface).Extends - iface.ExtendsSeparatorTkns = $3.(*ast.StmtInterface).ExtendsSeparatorTkns - } - - $$ = iface - } -; - - -class_entry_type: - T_CLASS - { - $$ = &ast.StmtClass{ - Position: yylex.(*Parser).builder.NewTokenPosition($1), - ClassTkn: $1, - } - } - | T_ABSTRACT T_CLASS - { - $$ = &ast.StmtClass{ - Position: yylex.(*Parser).builder.NewTokensPosition($1, $2), - Modifiers: []ast.Vertex{ - &ast.Identifier{ - Position: yylex.(*Parser).builder.NewTokenPosition($1), - IdentifierTkn: $1, - Value: $1.Value, - }, - }, - ClassTkn: $2, - } - } - | T_TRAIT - { - $$ = &ast.StmtTrait{ - Position: yylex.(*Parser).builder.NewTokenPosition($1), - TraitTkn: $1, - } - } - | T_FINAL T_CLASS - { - $$ = &ast.StmtClass{ - Position: yylex.(*Parser).builder.NewTokensPosition($1, $2), - Modifiers: []ast.Vertex{ - &ast.Identifier{ - Position: yylex.(*Parser).builder.NewTokenPosition($1), - IdentifierTkn: $1, - Value: $1.Value, - }, - }, - ClassTkn: $2, - } - } -; - -extends_from: - /* empty */ - { - $$ = nil - } - | T_EXTENDS fully_qualified_class_name - { - $$ = &ast.StmtClass{ - Position: yylex.(*Parser).builder.NewTokenNodePosition($1, $2), - ExtendsTkn: $1, - Extends: $2, - } - } -; - -interface_entry: - T_INTERFACE - { - $$ = $1 - } -; - -interface_extends_list: - /* empty */ - { - $$ = nil - } - | T_EXTENDS interface_list - { - $$ = &ast.StmtInterface{ - Position: yylex.(*Parser).builder.NewTokenNodeListPosition($1, $2.(*ParserSeparatedList).Items), - ExtendsTkn: $1, - Extends: $2.(*ParserSeparatedList).Items, - ExtendsSeparatorTkns: $2.(*ParserSeparatedList).SeparatorTkns, - }; - } -; - -implements_list: - /* empty */ - { - $$ = nil - } - | T_IMPLEMENTS interface_list - { - $$ = &ast.StmtClass{ - Position: yylex.(*Parser).builder.NewTokenNodeListPosition($1, $2.(*ParserSeparatedList).Items), - ImplementsTkn: $1, - Implements: $2.(*ParserSeparatedList).Items, - ImplementsSeparatorTkns: $2.(*ParserSeparatedList).SeparatorTkns, - }; - } -; - -interface_list: - fully_qualified_class_name - { - $$ = &ParserSeparatedList{ - Items: []ast.Vertex{$1}, - } - } - | interface_list ',' fully_qualified_class_name - { - $1.(*ParserSeparatedList).SeparatorTkns = append($1.(*ParserSeparatedList).SeparatorTkns, $2) - $1.(*ParserSeparatedList).Items = append($1.(*ParserSeparatedList).Items, $3) - - $$ = $1 - } -; - -foreach_optional_arg: - /* empty */ - { - $$ = nil - } - | T_DOUBLE_ARROW foreach_variable - { - $$ = &ast.StmtForeach{ - DoubleArrowTkn: $1, - Var: $2, - } - } -; - -foreach_variable: - variable - { - $$ = $1 - } - | '&' variable - { - $$ = &ast.StmtForeach{ - Position: yylex.(*Parser).builder.NewTokenNodePosition($1, $2), - AmpersandTkn: $1, - Var: $2, - } - } - | T_LIST '(' assignment_list ')' - { - pairList := $3.(*ParserSeparatedList) - fistPair := pairList.Items[0].(*ast.ExprArrayItem) - - if fistPair.Key == nil && fistPair.Val == nil && len(pairList.Items) == 1 { - pairList.Items = nil - } - - $$ = &ast.ExprList{ - Position: yylex.(*Parser).builder.NewTokensPosition($1, $4), - ListTkn: $1, - OpenBracketTkn: $2, - Items: $3.(*ParserSeparatedList).Items, - SeparatorTkns: $3.(*ParserSeparatedList).SeparatorTkns, - CloseBracketTkn: $4, - } - } -; - -for_statement: - statement - { - $$ = &ast.StmtFor{ - Position: yylex.(*Parser).builder.NewNodePosition($1), - Stmt: $1, - } - } - | ':' inner_statement_list T_ENDFOR ';' - { - $$ = &ast.StmtFor{ - Position: yylex.(*Parser).builder.NewTokensPosition($1, $4), - ColonTkn: $1, - Stmt: &ast.StmtStmtList{ - Position: yylex.(*Parser).builder.NewNodeListPosition($2), - Stmts: $2, - }, - EndForTkn: $3, - SemiColonTkn: $4, - } - } -; - -foreach_statement: - statement - { - $$ = &ast.StmtForeach{ - Position: yylex.(*Parser).builder.NewNodePosition($1), - Stmt: $1, - } - } - | ':' inner_statement_list T_ENDFOREACH ';' - { - $$ = &ast.StmtForeach{ - Position: yylex.(*Parser).builder.NewTokensPosition($1, $4), - ColonTkn: $1, - Stmt: &ast.StmtStmtList{ - Position: yylex.(*Parser).builder.NewNodeListPosition($2), - Stmts: $2, - }, - EndForeachTkn: $3, - SemiColonTkn: $4, - } - } -; - - -declare_statement: - statement - { - $$ = &ast.StmtDeclare{ - Position: yylex.(*Parser).builder.NewNodePosition($1), - Stmt: $1, - } - } - | ':' inner_statement_list T_ENDDECLARE ';' - { - $$ = &ast.StmtDeclare{ - Position: yylex.(*Parser).builder.NewTokensPosition($1, $4), - ColonTkn: $1, - Stmt: &ast.StmtStmtList{ - Position: yylex.(*Parser).builder.NewNodeListPosition($2), - Stmts: $2, - }, - EndDeclareTkn: $3, - SemiColonTkn: $4, - } - } -; - - -declare_list: - T_STRING '=' static_scalar - { - $$ = &ParserSeparatedList{ - Items: []ast.Vertex{ - &ast.StmtConstant{ - Position: yylex.(*Parser).builder.NewTokenNodePosition($1, $3), - Name: &ast.Identifier{ - Position: yylex.(*Parser).builder.NewTokenPosition($1), - IdentifierTkn: $1, - Value: $1.Value, - }, - EqualTkn: $2, - Expr: $3, - }, - }, - } - } - | declare_list ',' T_STRING '=' static_scalar - { - $1.(*ParserSeparatedList).SeparatorTkns = append($1.(*ParserSeparatedList).SeparatorTkns, $2) - $1.(*ParserSeparatedList).Items = append( - $1.(*ParserSeparatedList).Items, - &ast.StmtConstant{ - Position: yylex.(*Parser).builder.NewTokenNodePosition($3, $5), - Name: &ast.Identifier{ - Position: yylex.(*Parser).builder.NewTokenPosition($3), - IdentifierTkn: $3, - Value: $3.Value, - }, - EqualTkn: $4, - Expr: $5, - }, - ) - - $$ = $1 - } -; - - -switch_case_list: - '{' case_list '}' - { - $$ = &ast.StmtSwitch{ - Position: yylex.(*Parser).builder.NewTokensPosition($1, $3), - OpenCurlyBracketTkn: $1, - Cases: $2, - CloseCurlyBracketTkn: $3, - } - } - | '{' ';' case_list '}' - { - $$ = &ast.StmtSwitch{ - Position: yylex.(*Parser).builder.NewTokensPosition($1, $4), - OpenCurlyBracketTkn: $1, - CaseSeparatorTkn: $2, - Cases: $3, - CloseCurlyBracketTkn: $4, - } - } - | ':' case_list T_ENDSWITCH ';' - { - $$ = &ast.StmtSwitch{ - Position: yylex.(*Parser).builder.NewTokensPosition($1, $4), - ColonTkn: $1, - Cases: $2, - EndSwitchTkn: $3, - SemiColonTkn: $4, - } - } - | ':' ';' case_list T_ENDSWITCH ';' - { - $$ = &ast.StmtSwitch{ - Position: yylex.(*Parser).builder.NewTokensPosition($1, $5), - ColonTkn: $1, - CaseSeparatorTkn: $2, - Cases: $3, - EndSwitchTkn: $4, - SemiColonTkn: $5, - } - } -; - - -case_list: - /* empty */ - { - $$ = nil - } - | case_list T_CASE expr case_separator inner_statement_list - { - $$ = append($1, &ast.StmtCase{ - Position: yylex.(*Parser).builder.NewTokenNodeListPosition($2, $5), - CaseTkn: $2, - Cond: $3, - CaseSeparatorTkn: $4, - Stmts: $5, - }) - } - | case_list T_DEFAULT case_separator inner_statement_list - { - $$ = append($1, &ast.StmtDefault{ - Position: yylex.(*Parser).builder.NewTokenNodeListPosition($2, $4), - DefaultTkn: $2, - CaseSeparatorTkn: $3, - Stmts: $4, - }) - } -; - - -case_separator: - ':' - { - $$ = $1 - } - | ';' - { - $$ = $1 - } -; - - -while_statement: - statement - { - $$ = &ast.StmtWhile{ - Position: yylex.(*Parser).builder.NewNodePosition($1), - Stmt: $1, - } - } - | ':' inner_statement_list T_ENDWHILE ';' - { - $$ = &ast.StmtWhile{ - Position: yylex.(*Parser).builder.NewTokensPosition($1, $4), - ColonTkn: $1, - Stmt: &ast.StmtStmtList{ - Position: yylex.(*Parser).builder.NewNodeListPosition($2), - Stmts: $2, - }, - EndWhileTkn: $3, - SemiColonTkn: $4, - } - } -; - - - -elseif_list: - /* empty */ - { - $$ = nil - } - | elseif_list T_ELSEIF parenthesis_expr statement - { - $$ = append($1, &ast.StmtElseIf{ - Position: yylex.(*Parser).builder.NewTokenNodePosition($2, $4), - ElseIfTkn: $2, - OpenParenthesisTkn: $3.(*ast.ExprBrackets).OpenParenthesisTkn, - Cond: $3.(*ast.ExprBrackets).Expr, - CloseParenthesisTkn: $3.(*ast.ExprBrackets).CloseParenthesisTkn, - Stmt: $4, - }) - } -; - - -new_elseif_list: - /* empty */ - { - $$ = nil - } - | new_elseif_list T_ELSEIF parenthesis_expr ':' inner_statement_list - { - $$ = append($1, &ast.StmtElseIf{ - Position: yylex.(*Parser).builder.NewTokenNodeListPosition($2, $5), - ElseIfTkn: $2, - OpenParenthesisTkn: $3.(*ast.ExprBrackets).OpenParenthesisTkn, - Cond: $3.(*ast.ExprBrackets).Expr, - CloseParenthesisTkn: $3.(*ast.ExprBrackets).CloseParenthesisTkn, - ColonTkn: $4, - Stmt: &ast.StmtStmtList{ - Position: yylex.(*Parser).builder.NewNodeListPosition($5), - Stmts: $5, - }, - }) - } -; - - -else_single: - /* empty */ - { - $$ = nil - } - | T_ELSE statement - { - $$ = &ast.StmtElse{ - Position: yylex.(*Parser).builder.NewTokenNodePosition($1, $2), - ElseTkn: $1, - Stmt: $2, - } - } -; - - -new_else_single: - /* empty */ - { - $$ = nil - } - | T_ELSE ':' inner_statement_list - { - $$ = &ast.StmtElse{ - Position: yylex.(*Parser).builder.NewTokenNodeListPosition($1, $3), - ElseTkn: $1, - ColonTkn: $2, - Stmt: &ast.StmtStmtList{ - Position: yylex.(*Parser).builder.NewNodeListPosition($3), - Stmts: $3, - }, - } - } -; - - -parameter_list: - non_empty_parameter_list - { - $$ = $1 - } - | /* empty */ - { - $$ = &ParserSeparatedList{} - } -; - -non_empty_parameter_list: - parameter - { - $$ = &ParserSeparatedList{ - Items: []ast.Vertex{$1}, - } - } - | non_empty_parameter_list ',' parameter - { - $1.(*ParserSeparatedList).SeparatorTkns = append($1.(*ParserSeparatedList).SeparatorTkns, $2) - $1.(*ParserSeparatedList).Items = append($1.(*ParserSeparatedList).Items, $3) - - $$ = $1 - } -; - -parameter: - optional_class_type is_reference is_variadic T_VARIABLE - { - pos := yylex.(*Parser).builder.NewTokenPosition($4) - if $1 != nil { - pos = yylex.(*Parser).builder.NewNodeTokenPosition($1, $4) - } else if $2 != nil { - pos = yylex.(*Parser).builder.NewTokensPosition($2, $4) - } else if $3 != nil { - pos = yylex.(*Parser).builder.NewTokensPosition($3, $4) - } - - $$ = &ast.Parameter{ - Position: pos, - Type: $1, - AmpersandTkn: $2, - VariadicTkn: $3, - Var: &ast.ExprVariable{ - Position: yylex.(*Parser).builder.NewTokenPosition($4), - Name: &ast.Identifier{ - Position: yylex.(*Parser).builder.NewTokenPosition($4), - IdentifierTkn: $4, - Value: $4.Value, - }, - }, - } - } - | optional_class_type is_reference is_variadic T_VARIABLE '=' expr - { - pos := yylex.(*Parser).builder.NewTokenNodePosition($4, $6) - if $1 != nil { - pos = yylex.(*Parser).builder.NewNodesPosition($1, $6) - } else if $2 != nil { - pos = yylex.(*Parser).builder.NewTokenNodePosition($2, $6) - } else if $3 != nil { - pos = yylex.(*Parser).builder.NewTokenNodePosition($3, $6) - } - - $$ = &ast.Parameter{ - Position: pos, - Type: $1, - AmpersandTkn: $2, - VariadicTkn: $3, - Var: &ast.ExprVariable{ - Position: yylex.(*Parser).builder.NewTokenPosition($4), - Name: &ast.Identifier{ - Position: yylex.(*Parser).builder.NewTokenPosition($4), - IdentifierTkn: $4, - Value: $4.Value, - }, - }, - EqualTkn: $5, - DefaultValue: $6, - } - } -; - - -optional_class_type: - /* empty */ - { - $$ = nil - } - | T_ARRAY - { - $$ = &ast.Identifier{ - Position: yylex.(*Parser).builder.NewTokenPosition($1), - IdentifierTkn: $1, - Value: $1.Value, - } - } - | T_CALLABLE - { - $$ = &ast.Identifier{ - Position: yylex.(*Parser).builder.NewTokenPosition($1), - IdentifierTkn: $1, - Value: $1.Value, - } - } - | fully_qualified_class_name - { - $$ = $1 - } -; - - -function_call_parameter_list: - '(' ')' - { - $$ = &ArgumentList{ - Position: yylex.(*Parser).builder.NewTokensPosition($1, $2), - OpenParenthesisTkn: $1, - CloseParenthesisTkn: $2, - } - } - | '(' non_empty_function_call_parameter_list ')' - { - argumentList := $2.(*ArgumentList) - argumentList.Position = yylex.(*Parser).builder.NewTokensPosition($1, $3) - argumentList.OpenParenthesisTkn = $1 - argumentList.CloseParenthesisTkn = $3 - - $$ = argumentList - } - | '(' yield_expr ')' - { - $$ = &ArgumentList{ - Position: yylex.(*Parser).builder.NewTokensPosition($1, $3), - OpenParenthesisTkn: $1, - Arguments: []ast.Vertex{ - &ast.Argument{ - Position: yylex.(*Parser).builder.NewNodePosition($2), - Expr: $2, - }, - }, - CloseParenthesisTkn: $3, - } - } -; - - -non_empty_function_call_parameter_list: - function_call_parameter - { - $$ = &ArgumentList{ - Arguments: []ast.Vertex{$1}, - } - } - | non_empty_function_call_parameter_list ',' function_call_parameter - { - $1.(*ArgumentList).SeparatorTkns = append($1.(*ArgumentList).SeparatorTkns, $2) - $1.(*ArgumentList).Arguments = append($1.(*ArgumentList).Arguments, $3) - - $$ = $1 - } -; - -function_call_parameter: - expr_without_variable - { - $$ = &ast.Argument{ - Position: yylex.(*Parser).builder.NewNodePosition($1), - Expr: $1, - } - } - | variable - { - $$ = &ast.Argument{ - Position: yylex.(*Parser).builder.NewNodePosition($1), - Expr: $1, - } - } - | '&' w_variable - { - $$ = &ast.Argument{ - Position: yylex.(*Parser).builder.NewTokenNodePosition($1, $2), - AmpersandTkn: $1, - Expr: $2, - } - } - | T_ELLIPSIS expr - { - $$ = &ast.Argument{ - Position: yylex.(*Parser).builder.NewTokenNodePosition($1, $2), - VariadicTkn: $1, - Expr: $2, - } - } -; - -global_var_list: - global_var_list ',' global_var - { - $1.(*ast.StmtGlobal).Vars = append($1.(*ast.StmtGlobal).Vars, $3) - $1.(*ast.StmtGlobal).SeparatorTkns = append($1.(*ast.StmtGlobal).SeparatorTkns, $2) - - $$ = $1 - } - | global_var - { - $$ = &ast.StmtGlobal{ - Vars: []ast.Vertex{$1}, - } - } -; - - -global_var: - T_VARIABLE - { - $$ = &ast.ExprVariable{ - Position: yylex.(*Parser).builder.NewTokenPosition($1), - Name: &ast.Identifier{ - Position: yylex.(*Parser).builder.NewTokenPosition($1), - IdentifierTkn: $1, - Value: $1.Value, - }, - } - } - | '$' r_variable - { - $$ = &ast.ExprVariable{ - Position: yylex.(*Parser).builder.NewTokenNodePosition($1, $2), - DollarTkn: $1, - Name: $2, - } - } - | '$' '{' expr '}' - { - $$ = &ast.ExprVariable{ - Position: yylex.(*Parser).builder.NewTokensPosition($1, $4), - DollarTkn: $1, - OpenCurlyBracketTkn: $2, - Name: $3, - CloseCurlyBracketTkn: $4, - } - } -; - - -static_var_list: - static_var_list ',' T_VARIABLE - { - $1.(*ast.StmtStatic).Vars = append($1.(*ast.StmtStatic).Vars, &ast.StmtStaticVar{ - Position: yylex.(*Parser).builder.NewTokenPosition($3), - Var: &ast.ExprVariable{ - Position: yylex.(*Parser).builder.NewTokenPosition($3), - Name: &ast.Identifier{ - Position: yylex.(*Parser).builder.NewTokenPosition($3), - IdentifierTkn: $3, - Value: $3.Value, - }, - }, - }) - $1.(*ast.StmtStatic).SeparatorTkns = append($1.(*ast.StmtStatic).SeparatorTkns, $2) - - $$ = $1 - } - | static_var_list ',' T_VARIABLE '=' static_scalar - { - $1.(*ast.StmtStatic).Vars = append($1.(*ast.StmtStatic).Vars, &ast.StmtStaticVar{ - Position: yylex.(*Parser).builder.NewTokenNodePosition($3, $5), - Var: &ast.ExprVariable{ - Position: yylex.(*Parser).builder.NewTokenPosition($3), - Name: &ast.Identifier{ - Position: yylex.(*Parser).builder.NewTokenPosition($3), - IdentifierTkn: $3, - Value: $3.Value, - }, - }, - EqualTkn: $4, - Expr: $5, - }) - $1.(*ast.StmtStatic).SeparatorTkns = append($1.(*ast.StmtStatic).SeparatorTkns, $2) - - $$ = $1 - } - | T_VARIABLE - { - $$ = &ast.StmtStatic{ - Vars: []ast.Vertex{ - &ast.StmtStaticVar{ - Position: yylex.(*Parser).builder.NewTokenPosition($1), - Var: &ast.ExprVariable{ - Position: yylex.(*Parser).builder.NewTokenPosition($1), - Name: &ast.Identifier{ - Position: yylex.(*Parser).builder.NewTokenPosition($1), - IdentifierTkn: $1, - Value: $1.Value, - }, - }, - }, - }, - } - } - | T_VARIABLE '=' static_scalar - { - $$ = &ast.StmtStatic{ - Vars: []ast.Vertex{ - &ast.StmtStaticVar{ - Position: yylex.(*Parser).builder.NewTokenNodePosition($1, $3), - Var: &ast.ExprVariable{ - Position: yylex.(*Parser).builder.NewTokenPosition($1), - Name: &ast.Identifier{ - Position: yylex.(*Parser).builder.NewTokenPosition($1), - IdentifierTkn: $1, - Value: $1.Value, - }, - }, - EqualTkn: $2, - Expr: $3, - }, - }, - } - } -; - - -class_statement_list: - class_statement_list class_statement - { - $$ = append($1, $2) - } - | /* empty */ - { - $$ = []ast.Vertex{} - } -; - - -class_statement: - variable_modifiers class_variable_declaration ';' - { - $$ = &ast.StmtPropertyList{ - Position: yylex.(*Parser).builder.NewNodeListTokenPosition($1, $3), - Modifiers: $1, - Props: $2.(*ParserSeparatedList).Items, - SeparatorTkns: $2.(*ParserSeparatedList).SeparatorTkns, - SemiColonTkn: $3, - } - } - | class_constant_declaration ';' - { - $1.(*ast.StmtClassConstList).SemiColonTkn = $2 - $1.(*ast.StmtClassConstList).Position = yylex.(*Parser).builder.NewNodeTokenPosition($1, $2) - $$ = $1 - } - | trait_use_statement - { - $$ = $1 - } - | method_modifiers function is_reference T_STRING '(' parameter_list ')' method_body - { - pos := yylex.(*Parser).builder.NewTokenNodePosition($2, $8) - if $1 != nil { - pos = yylex.(*Parser).builder.NewNodeListNodePosition($1, $8) - } - - $$ = &ast.StmtClassMethod{ - Position: pos, - Modifiers: $1, - FunctionTkn: $2, - AmpersandTkn: $3, - Name: &ast.Identifier{ - Position: yylex.(*Parser).builder.NewTokenPosition($4), - IdentifierTkn: $4, - Value: $4.Value, - }, - OpenParenthesisTkn: $5, - Params: $6.(*ParserSeparatedList).Items, - SeparatorTkns: $6.(*ParserSeparatedList).SeparatorTkns, - CloseParenthesisTkn: $7, - Stmt: $8, - } - } -; - -trait_use_statement: - T_USE trait_list trait_adaptations - { - traitUse := &ast.StmtTraitUse{ - Position: yylex.(*Parser).builder.NewTokenNodePosition($1, $3), - UseTkn: $1, - Traits: $2.(*ParserSeparatedList).Items, - SeparatorTkns: $2.(*ParserSeparatedList).SeparatorTkns, - } - - switch n := $3.(type) { - case *TraitAdaptationList : - traitUse.OpenCurlyBracketTkn = n.OpenCurlyBracketTkn - traitUse.Adaptations = n.Adaptations - traitUse.CloseCurlyBracketTkn = n.CloseCurlyBracketTkn - case *ast.StmtNop : - traitUse.SemiColonTkn = n.SemiColonTkn - }; - - $$ = traitUse - } -; - -trait_list: - fully_qualified_class_name - { - $$ = &ParserSeparatedList{ - Items: []ast.Vertex{$1}, - } - } - | trait_list ',' fully_qualified_class_name - { - $1.(*ParserSeparatedList).SeparatorTkns = append($1.(*ParserSeparatedList).SeparatorTkns, $2) - $1.(*ParserSeparatedList).Items = append($1.(*ParserSeparatedList).Items, $3) - - $$ = $1 - } -; - -trait_adaptations: - ';' - { - $$ = &ast.StmtNop{ - Position: yylex.(*Parser).builder.NewTokenPosition($1), - SemiColonTkn: $1, - } - } - | '{' trait_adaptation_list '}' - { - $$ = &TraitAdaptationList{ - Position: yylex.(*Parser).builder.NewTokensPosition($1, $3), - OpenCurlyBracketTkn: $1, - Adaptations: $2, - CloseCurlyBracketTkn: $3, - } - } -; - -trait_adaptation_list: - /* empty */ - { - $$ = nil - } - | non_empty_trait_adaptation_list - { - $$ = $1 - } -; - -non_empty_trait_adaptation_list: - trait_adaptation_statement - { - $$ = []ast.Vertex{$1} - } - | non_empty_trait_adaptation_list trait_adaptation_statement - { - $$ = append($1, $2) - } -; - -trait_adaptation_statement: - trait_precedence ';' - { - $1.(*ast.StmtTraitUsePrecedence).SemiColonTkn = $2 - - $$ = $1; - } - | trait_alias ';' - { - $1.(*ast.StmtTraitUseAlias).SemiColonTkn = $2 - - $$ = $1; - } -; - -trait_precedence: - trait_method_reference_fully_qualified T_INSTEADOF trait_reference_list - { - $$ = &ast.StmtTraitUsePrecedence{ - Position: yylex.(*Parser).builder.NewNodeNodeListPosition($1, $3.(*ParserSeparatedList).Items), - Trait: $1.(*TraitMethodRef).Trait, - DoubleColonTkn: $1.(*TraitMethodRef).DoubleColonTkn, - Method: $1.(*TraitMethodRef).Method, - InsteadofTkn: $2, - Insteadof: $3.(*ParserSeparatedList).Items, - SeparatorTkns: $3.(*ParserSeparatedList).SeparatorTkns, - } - } -; - -trait_reference_list: - fully_qualified_class_name - { - $$ = &ParserSeparatedList{ - Items: []ast.Vertex{$1}, - } - } - | trait_reference_list ',' fully_qualified_class_name - { - $1.(*ParserSeparatedList).SeparatorTkns = append($1.(*ParserSeparatedList).SeparatorTkns, $2) - $1.(*ParserSeparatedList).Items = append($1.(*ParserSeparatedList).Items, $3) - - $$ = $1 - } -; - -trait_method_reference: - T_STRING - { - $$ = &TraitMethodRef{ - Position: yylex.(*Parser).builder.NewTokenPosition($1), - Method: &ast.Identifier{ - Position: yylex.(*Parser).builder.NewTokenPosition($1), - IdentifierTkn: $1, - Value: $1.Value, - }, - } - } - | trait_method_reference_fully_qualified - { - $$ = $1 - } -; - -trait_method_reference_fully_qualified: - fully_qualified_class_name T_PAAMAYIM_NEKUDOTAYIM T_STRING - { - $$ = &TraitMethodRef{ - Position: yylex.(*Parser).builder.NewNodeTokenPosition($1, $3), - Trait: $1, - DoubleColonTkn: $2, - Method: &ast.Identifier{ - Position: yylex.(*Parser).builder.NewTokenPosition($3), - IdentifierTkn: $3, - Value: $3.Value, - }, - } - } -; - -trait_alias: - trait_method_reference T_AS trait_modifiers T_STRING - { - $$ = &ast.StmtTraitUseAlias{ - Position: yylex.(*Parser).builder.NewNodeTokenPosition($1, $4), - Trait: $1.(*TraitMethodRef).Trait, - DoubleColonTkn: $1.(*TraitMethodRef).DoubleColonTkn, - Method: $1.(*TraitMethodRef).Method, - AsTkn: $2, - Modifier: $3, - Alias: &ast.Identifier{ - Position: yylex.(*Parser).builder.NewTokenPosition($4), - IdentifierTkn: $4, - Value: $4.Value, - }, - } - } - | trait_method_reference T_AS member_modifier - { - $$ = &ast.StmtTraitUseAlias{ - Position: yylex.(*Parser).builder.NewNodesPosition($1, $3), - Trait: $1.(*TraitMethodRef).Trait, - DoubleColonTkn: $1.(*TraitMethodRef).DoubleColonTkn, - Method: $1.(*TraitMethodRef).Method, - AsTkn: $2, - Modifier: $3, - } - } -; - -trait_modifiers: - /* empty */ - { - $$ = nil - } - | member_modifier - { - $$ = $1 - } -; - -method_body: - ';' /* abstract method */ - { - $$ = &ast.StmtNop{ - Position: yylex.(*Parser).builder.NewTokenPosition($1), - SemiColonTkn: $1, - } - } - | '{' inner_statement_list '}' - { - $$ = &ast.StmtStmtList{ - Position: yylex.(*Parser).builder.NewTokensPosition($1, $3), - OpenCurlyBracketTkn: $1, - Stmts: $2, - CloseCurlyBracketTkn: $3, - } - } -; - -variable_modifiers: - non_empty_member_modifiers - { - $$ = $1; - } - | T_VAR - { - $$ = []ast.Vertex{ - &ast.Identifier{ - Position: yylex.(*Parser).builder.NewTokenPosition($1), - IdentifierTkn: $1, - Value: $1.Value, - }, - } - } -; - -method_modifiers: - /* empty */ - { - $$ = nil - } - | non_empty_member_modifiers - { - $$ = $1 - } -; - -non_empty_member_modifiers: - member_modifier - { - $$ = []ast.Vertex{$1} - } - | non_empty_member_modifiers member_modifier - { - $$ = append($1, $2) - } -; - -member_modifier: - T_PUBLIC - { - $$ = &ast.Identifier{ - Position: yylex.(*Parser).builder.NewTokenPosition($1), - IdentifierTkn: $1, - Value: $1.Value, - } - } - | T_PROTECTED - { - $$ = &ast.Identifier{ - Position: yylex.(*Parser).builder.NewTokenPosition($1), - IdentifierTkn: $1, - Value: $1.Value, - } - } - | T_PRIVATE - { - $$ = &ast.Identifier{ - Position: yylex.(*Parser).builder.NewTokenPosition($1), - IdentifierTkn: $1, - Value: $1.Value, - } - } - | T_STATIC - { - $$ = &ast.Identifier{ - Position: yylex.(*Parser).builder.NewTokenPosition($1), - IdentifierTkn: $1, - Value: $1.Value, - } - } - | T_ABSTRACT - { - $$ = &ast.Identifier{ - Position: yylex.(*Parser).builder.NewTokenPosition($1), - IdentifierTkn: $1, - Value: $1.Value, - } - } - | T_FINAL - { - $$ = &ast.Identifier{ - Position: yylex.(*Parser).builder.NewTokenPosition($1), - IdentifierTkn: $1, - Value: $1.Value, - } - } -; - -class_variable_declaration: - class_variable_declaration ',' T_VARIABLE - { - item := &ast.StmtProperty{ - Position: yylex.(*Parser).builder.NewTokenPosition($3), - Var: &ast.ExprVariable{ - Position: yylex.(*Parser).builder.NewTokenPosition($3), - Name: &ast.Identifier{ - Position: yylex.(*Parser).builder.NewTokenPosition($3), - IdentifierTkn: $3, - Value: $3.Value, - }, - }, - } - - $1.(*ParserSeparatedList).SeparatorTkns = append($1.(*ParserSeparatedList).SeparatorTkns, $2) - $1.(*ParserSeparatedList).Items = append($1.(*ParserSeparatedList).Items, item) - - $$ = $1 - } - | class_variable_declaration ',' T_VARIABLE '=' static_scalar - { - item := &ast.StmtProperty{ - Position: yylex.(*Parser).builder.NewTokenNodePosition($3, $5), - Var: &ast.ExprVariable{ - Position: yylex.(*Parser).builder.NewTokenPosition($3), - Name: &ast.Identifier{ - Position: yylex.(*Parser).builder.NewTokenPosition($3), - IdentifierTkn: $3, - Value: $3.Value, - }, - }, - EqualTkn: $4, - Expr: $5, - } - - $1.(*ParserSeparatedList).SeparatorTkns = append($1.(*ParserSeparatedList).SeparatorTkns, $2) - $1.(*ParserSeparatedList).Items = append($1.(*ParserSeparatedList).Items, item) - - $$ = $1 - } - | T_VARIABLE - { - $$ = &ParserSeparatedList{ - Items: []ast.Vertex{ - &ast.StmtProperty{ - Position: yylex.(*Parser).builder.NewTokenPosition($1), - Var: &ast.ExprVariable{ - Position: yylex.(*Parser).builder.NewTokenPosition($1), - Name: &ast.Identifier{ - Position: yylex.(*Parser).builder.NewTokenPosition($1), - IdentifierTkn: $1, - Value: $1.Value, - }, - }, - Expr: nil, - }, - }, - } - } - | T_VARIABLE '=' static_scalar - { - $$ = &ParserSeparatedList{ - Items: []ast.Vertex{ - &ast.StmtProperty{ - Position: yylex.(*Parser).builder.NewTokenNodePosition($1, $3), - Var: &ast.ExprVariable{ - Position: yylex.(*Parser).builder.NewTokenPosition($1), - Name: &ast.Identifier{ - Position: yylex.(*Parser).builder.NewTokenPosition($1), - IdentifierTkn: $1, - Value: $1.Value, - }, - }, - EqualTkn: $2, - Expr: $3, - }, - }, - } - } -; - -class_constant_declaration: - class_constant_declaration ',' T_STRING '=' static_scalar - { - constList := $1.(*ast.StmtClassConstList) - constList.Position = yylex.(*Parser).builder.NewNodesPosition($1, $5) - constList.SeparatorTkns = append(constList.SeparatorTkns, $2) - constList.Consts = append(constList.Consts, &ast.StmtConstant{ - Position: yylex.(*Parser).builder.NewTokenNodePosition($3, $5), - Name: &ast.Identifier{ - Position: yylex.(*Parser).builder.NewTokenPosition($3), - IdentifierTkn: $3, - Value: $3.Value, - }, - EqualTkn: $4, - Expr: $5, - }) - - $$ = $1 - } - | T_CONST T_STRING '=' static_scalar - { - $$ = &ast.StmtClassConstList{ - Position: yylex.(*Parser).builder.NewTokenNodePosition($1, $4), - ConstTkn: $1, - Consts: []ast.Vertex{ - &ast.StmtConstant{ - Position: yylex.(*Parser).builder.NewTokenNodePosition($2, $4), - Name: &ast.Identifier{ - Position: yylex.(*Parser).builder.NewTokenPosition($2), - IdentifierTkn: $2, - Value: $2.Value, - }, - EqualTkn: $3, - Expr: $4, - }, - }, - } - } -; - -echo_expr_list: - echo_expr_list ',' expr - { - $1.(*ast.StmtEcho).Exprs = append($1.(*ast.StmtEcho).Exprs, $3) - $1.(*ast.StmtEcho).SeparatorTkns = append($1.(*ast.StmtEcho).SeparatorTkns, $2) - - $$ = $1 - } - | expr - { - $$ = &ast.StmtEcho{ - Exprs: []ast.Vertex{$1}, - } - } -; - - -for_expr: - /* empty */ - { - $$ = &ParserSeparatedList{} - } - | non_empty_for_expr - { - $$ = $1 - } -; - -non_empty_for_expr: - non_empty_for_expr ',' expr - { - $1.(*ParserSeparatedList).SeparatorTkns = append($1.(*ParserSeparatedList).SeparatorTkns, $2) - $1.(*ParserSeparatedList).Items = append($1.(*ParserSeparatedList).Items, $3) - - $$ = $1 - } - | expr - { - $$ = &ParserSeparatedList{ - Items: []ast.Vertex{$1}, - } - } -; - -chaining_method_or_property: - chaining_method_or_property variable_property - { - $$ = append($1, $2...) - } - | variable_property - { - $$ = $1 - } -; - -chaining_dereference: - chaining_dereference '[' dim_offset ']' - { - fetch := &ast.ExprArrayDimFetch{ - Position: yylex.(*Parser).builder.NewTokensPosition($2, $4), - Var: nil, - OpenBracketTkn: $2, - Dim: $3, - CloseBracketTkn: $4, - } - - $$ = append($1, fetch) - } - | '[' dim_offset ']' - { - fetch := &ast.ExprArrayDimFetch{ - Position: yylex.(*Parser).builder.NewTokensPosition($1, $3), - Var: nil, - OpenBracketTkn: $1, - Dim: $2, - CloseBracketTkn: $3, - } - - $$ = []ast.Vertex{fetch} - } -; - -chaining_instance_call: - chaining_dereference chaining_method_or_property - { - $$ = append($1, $2...) - } - | chaining_dereference - { - $$ = $1 - } - | chaining_method_or_property - { - $$ = $1 - } -; - -instance_call: - /* empty */ - { - $$ = nil - } - | chaining_instance_call - { - $$ = $1 - } -; - -new_expr: - T_NEW class_name_reference ctor_arguments - { - if $3 != nil { - $$ = &ast.ExprNew{ - Position: yylex.(*Parser).builder.NewTokenNodePosition($1, $3), - NewTkn: $1, - Class: $2, - OpenParenthesisTkn: $3.(*ArgumentList).OpenParenthesisTkn, - Args: $3.(*ArgumentList).Arguments, - SeparatorTkns: $3.(*ArgumentList).SeparatorTkns, - CloseParenthesisTkn: $3.(*ArgumentList).CloseParenthesisTkn, - } - } else { - $$ = &ast.ExprNew{ - Position: yylex.(*Parser).builder.NewTokenNodePosition($1, $2), - NewTkn: $1, - Class: $2, - } - } - } -; - -expr_without_variable: - T_LIST '(' assignment_list ')' '=' expr - { - $$ = &ast.ExprAssign{ - Position: yylex.(*Parser).builder.NewTokenNodePosition($1, $6), - Var: &ast.ExprList{ - Position: yylex.(*Parser).builder.NewTokensPosition($1, $4), - ListTkn: $1, - OpenBracketTkn: $2, - Items: $3.(*ParserSeparatedList).Items, - SeparatorTkns: $3.(*ParserSeparatedList).SeparatorTkns, - CloseBracketTkn: $4, - }, - EqualTkn: $5, - Expr: $6, - } - } - | variable '=' expr - { - $$ = &ast.ExprAssign{ - Position: yylex.(*Parser).builder.NewNodesPosition($1, $3), - Var: $1, - EqualTkn: $2, - Expr: $3, - } - } - | variable '=' '&' variable - { - $$ = &ast.ExprAssignReference{ - Position: yylex.(*Parser).builder.NewNodesPosition($1, $4), - Var: $1, - EqualTkn: $2, - AmpersandTkn: $3, - Expr: $4, - } - } - | variable '=' '&' T_NEW class_name_reference ctor_arguments - { - var _new *ast.ExprNew - if $6 != nil { - _new = &ast.ExprNew{ - Position: yylex.(*Parser).builder.NewTokenNodePosition($4, $6), - NewTkn: $4, - Class: $5, - OpenParenthesisTkn: $6.(*ArgumentList).OpenParenthesisTkn, - Args: $6.(*ArgumentList).Arguments, - SeparatorTkns: $6.(*ArgumentList).SeparatorTkns, - CloseParenthesisTkn: $6.(*ArgumentList).CloseParenthesisTkn, - } - } else { - _new = &ast.ExprNew{ - Position: yylex.(*Parser).builder.NewTokenNodePosition($4, $5), - NewTkn: $4, - Class: $5, - } - } - - $$ = &ast.ExprAssignReference{ - Position: yylex.(*Parser).builder.NewNodesPosition($1, _new), - Var: $1, - EqualTkn: $2, - AmpersandTkn: $3, - Expr: _new, - } - } - | T_CLONE expr - { - $$ = &ast.ExprClone{ - Position: yylex.(*Parser).builder.NewTokenNodePosition($1, $2), - CloneTkn: $1, - Expr: $2, - } - } - | variable T_PLUS_EQUAL expr - { - $$ = &ast.ExprAssignPlus{ - Position: yylex.(*Parser).builder.NewNodesPosition($1, $3), - Var: $1, - EqualTkn: $2, - Expr: $3, - } - } - | variable T_MINUS_EQUAL expr - { - $$ = &ast.ExprAssignMinus{ - Position: yylex.(*Parser).builder.NewNodesPosition($1, $3), - Var: $1, - EqualTkn: $2, - Expr: $3, - } - } - | variable T_MUL_EQUAL expr - { - $$ = &ast.ExprAssignMul{ - Position: yylex.(*Parser).builder.NewNodesPosition($1, $3), - Var: $1, - EqualTkn: $2, - Expr: $3, - } - } - | variable T_POW_EQUAL expr - { - $$ = &ast.ExprAssignPow{ - Position: yylex.(*Parser).builder.NewNodesPosition($1, $3), - Var: $1, - EqualTkn: $2, - Expr: $3, - } - } - | variable T_DIV_EQUAL expr - { - $$ = &ast.ExprAssignDiv{ - Position: yylex.(*Parser).builder.NewNodesPosition($1, $3), - Var: $1, - EqualTkn: $2, - Expr: $3, - } - } - | variable T_CONCAT_EQUAL expr - { - $$ = &ast.ExprAssignConcat{ - Position: yylex.(*Parser).builder.NewNodesPosition($1, $3), - Var: $1, - EqualTkn: $2, - Expr: $3, - } - } - | variable T_MOD_EQUAL expr - { - $$ = &ast.ExprAssignMod{ - Position: yylex.(*Parser).builder.NewNodesPosition($1, $3), - Var: $1, - EqualTkn: $2, - Expr: $3, - } - } - | variable T_AND_EQUAL expr - { - $$ = &ast.ExprAssignBitwiseAnd{ - Position: yylex.(*Parser).builder.NewNodesPosition($1, $3), - Var: $1, - EqualTkn: $2, - Expr: $3, - } - } - | variable T_OR_EQUAL expr - { - $$ = &ast.ExprAssignBitwiseOr{ - Position: yylex.(*Parser).builder.NewNodesPosition($1, $3), - Var: $1, - EqualTkn: $2, - Expr: $3, - } - } - | variable T_XOR_EQUAL expr - { - $$ = &ast.ExprAssignBitwiseXor{ - Position: yylex.(*Parser).builder.NewNodesPosition($1, $3), - Var: $1, - EqualTkn: $2, - Expr: $3, - } - } - | variable T_SL_EQUAL expr - { - $$ = &ast.ExprAssignShiftLeft{ - Position: yylex.(*Parser).builder.NewNodesPosition($1, $3), - Var: $1, - EqualTkn: $2, - Expr: $3, - } - } - | variable T_SR_EQUAL expr - { - $$ = &ast.ExprAssignShiftRight{ - Position: yylex.(*Parser).builder.NewNodesPosition($1, $3), - Var: $1, - EqualTkn: $2, - Expr: $3, - } - } - | rw_variable T_INC - { - $$ = &ast.ExprPostInc{ - Position: yylex.(*Parser).builder.NewNodeTokenPosition($1, $2), - Var: $1, - IncTkn: $2, - } - } - | T_INC rw_variable - { - $$ = &ast.ExprPreInc{ - Position: yylex.(*Parser).builder.NewTokenNodePosition($1, $2), - IncTkn: $1, - Var: $2, - } - } - | rw_variable T_DEC - { - $$ = &ast.ExprPostDec{ - Position: yylex.(*Parser).builder.NewNodeTokenPosition($1, $2), - Var: $1, - DecTkn: $2, - } - } - | T_DEC rw_variable - { - $$ = &ast.ExprPreDec{ - Position: yylex.(*Parser).builder.NewTokenNodePosition($1, $2), - DecTkn: $1, - Var: $2, - } - } - | expr T_BOOLEAN_OR expr - { - $$ = &ast.ExprBinaryBooleanOr{ - Position: yylex.(*Parser).builder.NewNodesPosition($1, $3), - Left: $1, - OpTkn: $2, - Right: $3, - } - } - | expr T_BOOLEAN_AND expr - { - $$ = &ast.ExprBinaryBooleanAnd{ - Position: yylex.(*Parser).builder.NewNodesPosition($1, $3), - Left: $1, - OpTkn: $2, - Right: $3, - } - } - | expr T_LOGICAL_OR expr - { - $$ = &ast.ExprBinaryLogicalOr{ - Position: yylex.(*Parser).builder.NewNodesPosition($1, $3), - Left: $1, - OpTkn: $2, - Right: $3, - } - } - | expr T_LOGICAL_AND expr - { - $$ = &ast.ExprBinaryLogicalAnd{ - Position: yylex.(*Parser).builder.NewNodesPosition($1, $3), - Left: $1, - OpTkn: $2, - Right: $3, - } - } - | expr T_LOGICAL_XOR expr - { - $$ = &ast.ExprBinaryLogicalXor{ - Position: yylex.(*Parser).builder.NewNodesPosition($1, $3), - Left: $1, - OpTkn: $2, - Right: $3, - } - } - | expr '|' expr - { - $$ = &ast.ExprBinaryBitwiseOr{ - Position: yylex.(*Parser).builder.NewNodesPosition($1, $3), - Left: $1, - OpTkn: $2, - Right: $3, - } - } - | expr '&' expr - { - $$ = &ast.ExprBinaryBitwiseAnd{ - Position: yylex.(*Parser).builder.NewNodesPosition($1, $3), - Left: $1, - OpTkn: $2, - Right: $3, - } - } - | expr '^' expr - { - $$ = &ast.ExprBinaryBitwiseXor{ - Position: yylex.(*Parser).builder.NewNodesPosition($1, $3), - Left: $1, - OpTkn: $2, - Right: $3, - } - } - | expr '.' expr - { - $$ = &ast.ExprBinaryConcat{ - Position: yylex.(*Parser).builder.NewNodesPosition($1, $3), - Left: $1, - OpTkn: $2, - Right: $3, - } - } - | expr '+' expr - { - $$ = &ast.ExprBinaryPlus{ - Position: yylex.(*Parser).builder.NewNodesPosition($1, $3), - Left: $1, - OpTkn: $2, - Right: $3, - } - } - | expr '-' expr - { - $$ = &ast.ExprBinaryMinus{ - Position: yylex.(*Parser).builder.NewNodesPosition($1, $3), - Left: $1, - OpTkn: $2, - Right: $3, - } - } - | expr '*' expr - { - $$ = &ast.ExprBinaryMul{ - Position: yylex.(*Parser).builder.NewNodesPosition($1, $3), - Left: $1, - OpTkn: $2, - Right: $3, - } - } - | expr T_POW expr - { - $$ = &ast.ExprBinaryPow{ - Position: yylex.(*Parser).builder.NewNodesPosition($1, $3), - Left: $1, - OpTkn: $2, - Right: $3, - } - } - | expr '/' expr - { - $$ = &ast.ExprBinaryDiv{ - Position: yylex.(*Parser).builder.NewNodesPosition($1, $3), - Left: $1, - OpTkn: $2, - Right: $3, - } - } - | expr '%' expr - { - $$ = &ast.ExprBinaryMod{ - Position: yylex.(*Parser).builder.NewNodesPosition($1, $3), - Left: $1, - OpTkn: $2, - Right: $3, - } - } - | expr T_SL expr - { - $$ = &ast.ExprBinaryShiftLeft{ - Position: yylex.(*Parser).builder.NewNodesPosition($1, $3), - Left: $1, - OpTkn: $2, - Right: $3, - } - } - | expr T_SR expr - { - $$ = &ast.ExprBinaryShiftRight{ - Position: yylex.(*Parser).builder.NewNodesPosition($1, $3), - Left: $1, - OpTkn: $2, - Right: $3, - } - } - | '+' expr %prec T_INC - { - $$ = &ast.ExprUnaryPlus{ - Position: yylex.(*Parser).builder.NewTokenNodePosition($1, $2), - PlusTkn: $1, - Expr: $2, - } - } - | '-' expr %prec T_INC - { - $$ = &ast.ExprUnaryMinus{ - Position: yylex.(*Parser).builder.NewTokenNodePosition($1, $2), - MinusTkn: $1, - Expr: $2, - } - } - | '!' expr - { - $$ = &ast.ExprBooleanNot{ - Position: yylex.(*Parser).builder.NewTokenNodePosition($1, $2), - ExclamationTkn: $1, - Expr: $2, - } - } - | '~' expr - { - $$ = &ast.ExprBitwiseNot{ - Position: yylex.(*Parser).builder.NewTokenNodePosition($1, $2), - TildaTkn: $1, - Expr: $2, - } - } - | expr T_IS_IDENTICAL expr - { - $$ = &ast.ExprBinaryIdentical{ - Position: yylex.(*Parser).builder.NewNodesPosition($1, $3), - Left: $1, - OpTkn: $2, - Right: $3, - } - } - | expr T_IS_NOT_IDENTICAL expr - { - $$ = &ast.ExprBinaryNotIdentical{ - Position: yylex.(*Parser).builder.NewNodesPosition($1, $3), - Left: $1, - OpTkn: $2, - Right: $3, - } - } - | expr T_IS_EQUAL expr - { - $$ = &ast.ExprBinaryEqual{ - Position: yylex.(*Parser).builder.NewNodesPosition($1, $3), - Left: $1, - OpTkn: $2, - Right: $3, - } - } - | expr T_IS_NOT_EQUAL expr - { - $$ = &ast.ExprBinaryNotEqual{ - Position: yylex.(*Parser).builder.NewNodesPosition($1, $3), - Left: $1, - OpTkn: $2, - Right: $3, - } - } - | expr '<' expr - { - $$ = &ast.ExprBinarySmaller{ - Position: yylex.(*Parser).builder.NewNodesPosition($1, $3), - Left: $1, - OpTkn: $2, - Right: $3, - } - } - | expr T_IS_SMALLER_OR_EQUAL expr - { - $$ = &ast.ExprBinarySmallerOrEqual{ - Position: yylex.(*Parser).builder.NewNodesPosition($1, $3), - Left: $1, - OpTkn: $2, - Right: $3, - } - } - | expr '>' expr - { - $$ = &ast.ExprBinaryGreater{ - Position: yylex.(*Parser).builder.NewNodesPosition($1, $3), - Left: $1, - OpTkn: $2, - Right: $3, - } - } - | expr T_IS_GREATER_OR_EQUAL expr - { - $$ = &ast.ExprBinaryGreaterOrEqual{ - Position: yylex.(*Parser).builder.NewNodesPosition($1, $3), - Left: $1, - OpTkn: $2, - Right: $3, - } - } - | expr T_INSTANCEOF class_name_reference - { - $$ = &ast.ExprInstanceOf{ - Position: yylex.(*Parser).builder.NewNodesPosition($1, $3), - Expr: $1, - InstanceOfTkn: $2, - Class: $3, - } - } - | parenthesis_expr - { - $$ = $1 - } - | new_expr - { - $$ = $1 - } - | '(' new_expr ')' instance_call - { - $$ = &ast.ExprBrackets{ - Position: yylex.(*Parser).builder.NewTokensPosition($1, $3), - OpenParenthesisTkn: $1, - Expr: $2, - CloseParenthesisTkn: $3, - } - - for _, n := range($4) { - switch nn := n.(type) { - case *ast.ExprFunctionCall: - nn.Function = $$ - nn.Position = yylex.(*Parser).builder.NewNodesPosition($$, nn) - $$ = nn - - case *ast.ExprArrayDimFetch: - nn.Var = $$ - nn.Position = yylex.(*Parser).builder.NewNodesPosition($$, nn) - $$ = nn - - case *ast.ExprPropertyFetch: - nn.Var = $$ - nn.Position = yylex.(*Parser).builder.NewNodesPosition($$, nn) - $$ = nn - - case *ast.ExprMethodCall: - nn.Var = $$ - nn.Position = yylex.(*Parser).builder.NewNodesPosition($$, nn) - $$ = nn - } - } - } - | expr '?' expr ':' expr - { - $$ = &ast.ExprTernary{ - Position: yylex.(*Parser).builder.NewNodesPosition($1, $5), - Cond: $1, - QuestionTkn: $2, - IfTrue: $3, - ColonTkn: $4, - IfFalse: $5, - } - } - | expr '?' ':' expr - { - $$ = &ast.ExprTernary{ - Position: yylex.(*Parser).builder.NewNodesPosition($1, $4), - Cond: $1, - QuestionTkn: $2, - ColonTkn: $3, - IfFalse: $4, - } - } - | internal_functions_in_yacc - { - $$ = $1 - } - | T_INT_CAST expr - { - $$ = &ast.ExprCastInt{ - Position: yylex.(*Parser).builder.NewTokenNodePosition($1, $2), - CastTkn: $1, - Expr: $2, - } - } - | T_DOUBLE_CAST expr - { - $$ = &ast.ExprCastDouble{ - Position: yylex.(*Parser).builder.NewTokenNodePosition($1, $2), - CastTkn: $1, - Expr: $2, - } - } - | T_STRING_CAST expr - { - $$ = &ast.ExprCastString{ - Position: yylex.(*Parser).builder.NewTokenNodePosition($1, $2), - CastTkn: $1, - Expr: $2, - } - } - | T_ARRAY_CAST expr - { - $$ = &ast.ExprCastArray{ - Position: yylex.(*Parser).builder.NewTokenNodePosition($1, $2), - CastTkn: $1, - Expr: $2, - } - } - | T_OBJECT_CAST expr - { - $$ = &ast.ExprCastObject{ - Position: yylex.(*Parser).builder.NewTokenNodePosition($1, $2), - CastTkn: $1, - Expr: $2, - } - } - | T_BOOL_CAST expr - { - $$ = &ast.ExprCastBool{ - Position: yylex.(*Parser).builder.NewTokenNodePosition($1, $2), - CastTkn: $1, - Expr: $2, - } - } - | T_UNSET_CAST expr - { - $$ = &ast.ExprCastUnset{ - Position: yylex.(*Parser).builder.NewTokenNodePosition($1, $2), - CastTkn: $1, - Expr: $2, - } - } - | T_EXIT exit_expr - { - exit := &ast.ExprExit{ - ExitTkn: $1, - } - - if $2 == nil { - exit.Position = yylex.(*Parser).builder.NewTokenPosition($1) - } else { - exit.Position = yylex.(*Parser).builder.NewTokenNodePosition($1, $2) - exit.OpenParenthesisTkn = $2.(*ast.ExprBrackets).OpenParenthesisTkn - exit.Expr = $2.(*ast.ExprBrackets).Expr - exit.CloseParenthesisTkn = $2.(*ast.ExprBrackets).CloseParenthesisTkn - } - - $$ = exit - } - | '@' expr - { - $$ = &ast.ExprErrorSuppress{ - Position: yylex.(*Parser).builder.NewTokenNodePosition($1, $2), - AtTkn: $1, - Expr: $2, - } - } - | scalar - { - $$ = $1 - } - | combined_scalar_offset - { - $$ = $1 - } - | combined_scalar - { - $$ = $1 - } - | '`' backticks_expr '`' - { - $$ = &ast.ExprShellExec{ - Position: yylex.(*Parser).builder.NewTokensPosition($1, $3), - OpenBacktickTkn: $1, - Parts: $2, - CloseBacktickTkn: $3, - } - } - | T_PRINT expr - { - $$ = &ast.ExprPrint{ - Position: yylex.(*Parser).builder.NewTokenNodePosition($1, $2), - PrintTkn: $1, - Expr: $2, - } - } - | T_YIELD - { - $$ = &ast.ExprYield{ - Position: yylex.(*Parser).builder.NewTokenPosition($1), - YieldTkn: $1, - } - } - | function is_reference '(' parameter_list ')' lexical_vars '{' inner_statement_list '}' - { - closure := $6.(*ast.ExprClosure) - - closure.Position = yylex.(*Parser).builder.NewTokensPosition($1, $9) - closure.FunctionTkn = $1 - closure.AmpersandTkn = $2 - closure.OpenParenthesisTkn = $3 - closure.Params = $4.(*ParserSeparatedList).Items - closure.SeparatorTkns = $4.(*ParserSeparatedList).SeparatorTkns - closure.CloseParenthesisTkn = $5 - closure.OpenCurlyBracketTkn = $7 - closure.Stmts = $8 - closure.CloseCurlyBracketTkn = $9 - - $$ = closure - } - | T_STATIC function is_reference '(' parameter_list ')' lexical_vars '{' inner_statement_list '}' - { - closure := $7.(*ast.ExprClosure) - - closure.Position = yylex.(*Parser).builder.NewTokensPosition($1, $10) - closure.StaticTkn = $1 - closure.FunctionTkn = $2 - closure.AmpersandTkn = $3 - closure.OpenParenthesisTkn = $4 - closure.Params = $5.(*ParserSeparatedList).Items - closure.SeparatorTkns = $5.(*ParserSeparatedList).SeparatorTkns - closure.CloseParenthesisTkn = $6 - closure.OpenCurlyBracketTkn = $8 - closure.Stmts = $9 - closure.CloseCurlyBracketTkn = $10 - - $$ = closure - } -; - -yield_expr: - T_YIELD expr_without_variable - { - $$ = &ast.ExprYield{ - Position: yylex.(*Parser).builder.NewTokenNodePosition($1, $2), - YieldTkn: $1, - Val: $2, - } - } - | T_YIELD variable - { - $$ = &ast.ExprYield{ - Position: yylex.(*Parser).builder.NewTokenNodePosition($1, $2), - YieldTkn: $1, - Val: $2, - } - } - | T_YIELD expr T_DOUBLE_ARROW expr_without_variable - { - $$ = &ast.ExprYield{ - Position: yylex.(*Parser).builder.NewTokenNodePosition($1, $4), - YieldTkn: $1, - Key: $2, - DoubleArrowTkn: $3, - Val: $4, - } - } - | T_YIELD expr T_DOUBLE_ARROW variable - { - $$ = &ast.ExprYield{ - Position: yylex.(*Parser).builder.NewTokenNodePosition($1, $4), - YieldTkn: $1, - Key: $2, - DoubleArrowTkn: $3, - Val: $4, - } - } -; - -combined_scalar_offset: - combined_scalar '[' dim_offset ']' - { - $$ = &ast.ExprArrayDimFetch{ - Position: yylex.(*Parser).builder.NewNodeTokenPosition($1, $4), - Var: $1, - OpenBracketTkn: $2, - Dim: $3, - CloseBracketTkn: $4, - } - } - | combined_scalar_offset '[' dim_offset ']' - { - $$ = &ast.ExprArrayDimFetch{ - Position: yylex.(*Parser).builder.NewNodeTokenPosition($1, $4), - Var: $1, - OpenBracketTkn: $2, - Dim: $3, - CloseBracketTkn: $4, - } - } - | T_CONSTANT_ENCAPSED_STRING '[' dim_offset ']' - { - $$ = &ast.ExprArrayDimFetch{ - Position: yylex.(*Parser).builder.NewTokensPosition($1, $4), - Var: &ast.ScalarString{ - Position: yylex.(*Parser).builder.NewTokenPosition($1), - StringTkn: $1, - Value: $1.Value, - }, - OpenBracketTkn: $2, - Dim: $3, - CloseBracketTkn: $4, - } - } - | general_constant '[' dim_offset ']' - { - $$ = &ast.ExprArrayDimFetch{ - Position: yylex.(*Parser).builder.NewNodeTokenPosition($1, $4), - Var: $1, - OpenBracketTkn: $2, - Dim: $3, - CloseBracketTkn: $4, - } - } -; - -combined_scalar: - T_ARRAY '(' array_pair_list ')' - { - $$ = &ast.ExprArray{ - Position: yylex.(*Parser).builder.NewTokensPosition($1, $4), - ArrayTkn: $1, - OpenBracketTkn: $2, - Items: $3.(*ParserSeparatedList).Items, - SeparatorTkns: $3.(*ParserSeparatedList).SeparatorTkns, - CloseBracketTkn: $4, - } - } - | '[' array_pair_list ']' - { - $$ = &ast.ExprArray{ - Position: yylex.(*Parser).builder.NewTokensPosition($1, $3), - OpenBracketTkn: $1, - Items: $2.(*ParserSeparatedList).Items, - SeparatorTkns: $2.(*ParserSeparatedList).SeparatorTkns, - CloseBracketTkn: $3, - } - } -; - -function: - T_FUNCTION - { - $$ = $1 - } -; - -lexical_vars: - /* empty */ - { - $$ = &ast.ExprClosure{} - } - | T_USE '(' lexical_var_list ')' - { - $$ = &ast.ExprClosure{ - UseTkn: $1, - UseOpenParenthesisTkn: $2, - Uses: $3.(*ParserSeparatedList).Items, - UseSeparatorTkns: $3.(*ParserSeparatedList).SeparatorTkns, - UseCloseParenthesisTkn: $4, - } - } -; - -lexical_var_list: - lexical_var_list ',' T_VARIABLE - { - variable := &ast.ExprClosureUse{ - Position: yylex.(*Parser).builder.NewTokenPosition($3), - Var: &ast.ExprVariable{ - Position: yylex.(*Parser).builder.NewTokenPosition($3), - Name: &ast.Identifier{ - Position: yylex.(*Parser).builder.NewTokenPosition($3), - IdentifierTkn: $3, - Value: $3.Value, - }, - }, - } - - $1.(*ParserSeparatedList).SeparatorTkns = append($1.(*ParserSeparatedList).SeparatorTkns, $2) - $1.(*ParserSeparatedList).Items = append($1.(*ParserSeparatedList).Items, variable) - - $$ = $1 - } - | lexical_var_list ',' '&' T_VARIABLE - { - variable := &ast.ExprClosureUse{ - Position: yylex.(*Parser).builder.NewTokensPosition($3, $4), - AmpersandTkn: $3, - Var: &ast.ExprVariable{ - Position: yylex.(*Parser).builder.NewTokenPosition($4), - Name: &ast.Identifier{ - Position: yylex.(*Parser).builder.NewTokenPosition($4), - IdentifierTkn: $4, - Value: $4.Value, - }, - }, - } - - $1.(*ParserSeparatedList).SeparatorTkns = append($1.(*ParserSeparatedList).SeparatorTkns, $2) - $1.(*ParserSeparatedList).Items = append($1.(*ParserSeparatedList).Items, variable) - - $$ = $1 - } - | T_VARIABLE - { - variable := &ast.ExprClosureUse{ - Position: yylex.(*Parser).builder.NewTokenPosition($1), - Var: &ast.ExprVariable{ - Position: yylex.(*Parser).builder.NewTokenPosition($1), - Name: &ast.Identifier{ - Position: yylex.(*Parser).builder.NewTokenPosition($1), - IdentifierTkn: $1, - Value: $1.Value, - }, - }, - } - - $$ = &ParserSeparatedList{ - Items: []ast.Vertex{ variable }, - } - } - | '&' T_VARIABLE - { - variable := &ast.ExprClosureUse{ - Position: yylex.(*Parser).builder.NewTokensPosition($1, $2), - AmpersandTkn: $1, - Var: &ast.ExprVariable{ - Position: yylex.(*Parser).builder.NewTokenPosition($2), - Name: &ast.Identifier{ - Position: yylex.(*Parser).builder.NewTokenPosition($2), - IdentifierTkn: $2, - Value: $2.Value, - }, - }, - } - - $$ = &ParserSeparatedList{ - Items: []ast.Vertex{ variable }, - } - } -; - -function_call: - namespace_name function_call_parameter_list - { - $$ = &ast.ExprFunctionCall{ - Position: yylex.(*Parser).builder.NewNodeListNodePosition($1.(*ParserSeparatedList).Items, $2), - Function: &ast.Name{ - Position: yylex.(*Parser).builder.NewNodeListPosition($1.(*ParserSeparatedList).Items), - Parts: $1.(*ParserSeparatedList).Items, - SeparatorTkns: $1.(*ParserSeparatedList).SeparatorTkns, - }, - OpenParenthesisTkn: $2.(*ArgumentList).OpenParenthesisTkn, - Args: $2.(*ArgumentList).Arguments, - SeparatorTkns: $2.(*ArgumentList).SeparatorTkns, - CloseParenthesisTkn: $2.(*ArgumentList).CloseParenthesisTkn, - } - } - | T_NAMESPACE T_NS_SEPARATOR namespace_name function_call_parameter_list - { - $$ = &ast.ExprFunctionCall{ - Position: yylex.(*Parser).builder.NewTokenNodePosition($1, $4), - Function: &ast.NameRelative{ - Position: yylex.(*Parser).builder.NewTokenNodeListPosition($1, $3.(*ParserSeparatedList).Items), - NsTkn: $1, - NsSeparatorTkn: $2, - Parts: $3.(*ParserSeparatedList).Items, - SeparatorTkns: $3.(*ParserSeparatedList).SeparatorTkns, - }, - OpenParenthesisTkn: $4.(*ArgumentList).OpenParenthesisTkn, - Args: $4.(*ArgumentList).Arguments, - SeparatorTkns: $4.(*ArgumentList).SeparatorTkns, - CloseParenthesisTkn: $4.(*ArgumentList).CloseParenthesisTkn, - } - } - | T_NS_SEPARATOR namespace_name function_call_parameter_list - { - $$ = &ast.ExprFunctionCall{ - Position: yylex.(*Parser).builder.NewTokenNodePosition($1, $3), - Function: &ast.NameFullyQualified{ - Position: yylex.(*Parser).builder.NewTokenNodeListPosition($1, $2.(*ParserSeparatedList).Items), - NsSeparatorTkn: $1, - Parts: $2.(*ParserSeparatedList).Items, - SeparatorTkns: $2.(*ParserSeparatedList).SeparatorTkns, - }, - OpenParenthesisTkn: $3.(*ArgumentList).OpenParenthesisTkn, - Args: $3.(*ArgumentList).Arguments, - SeparatorTkns: $3.(*ArgumentList).SeparatorTkns, - CloseParenthesisTkn: $3.(*ArgumentList).CloseParenthesisTkn, - } - } - | class_name T_PAAMAYIM_NEKUDOTAYIM variable_name function_call_parameter_list - { - staticCall := &ast.ExprStaticCall{ - Position: yylex.(*Parser).builder.NewNodesPosition($1, $4), - Class: $1, - DoubleColonTkn: $2, - Call: $3, - OpenParenthesisTkn: $4.(*ArgumentList).OpenParenthesisTkn, - Args: $4.(*ArgumentList).Arguments, - SeparatorTkns: $4.(*ArgumentList).SeparatorTkns, - CloseParenthesisTkn: $4.(*ArgumentList).CloseParenthesisTkn, - } - - if brackets, ok := $3.(*ParserBrackets); ok { - staticCall.OpenCurlyBracketTkn = brackets.OpenBracketTkn - staticCall.Call = brackets.Child - staticCall.CloseCurlyBracketTkn = brackets.CloseBracketTkn - } - - $$ = staticCall - } - | class_name T_PAAMAYIM_NEKUDOTAYIM variable_without_objects function_call_parameter_list - { - $$ = &ast.ExprStaticCall{ - Position: yylex.(*Parser).builder.NewNodesPosition($1, $4), - Class: $1, - DoubleColonTkn: $2, - Call: $3, - OpenParenthesisTkn: $4.(*ArgumentList).OpenParenthesisTkn, - Args: $4.(*ArgumentList).Arguments, - SeparatorTkns: $4.(*ArgumentList).SeparatorTkns, - CloseParenthesisTkn: $4.(*ArgumentList).CloseParenthesisTkn, - } - } - | variable_class_name T_PAAMAYIM_NEKUDOTAYIM variable_name function_call_parameter_list - { - staticCall := &ast.ExprStaticCall{ - Position: yylex.(*Parser).builder.NewNodesPosition($1, $4), - Class: $1, - DoubleColonTkn: $2, - Call: $3, - OpenParenthesisTkn: $4.(*ArgumentList).OpenParenthesisTkn, - Args: $4.(*ArgumentList).Arguments, - SeparatorTkns: $4.(*ArgumentList).SeparatorTkns, - CloseParenthesisTkn: $4.(*ArgumentList).CloseParenthesisTkn, - } - - if brackets, ok := $3.(*ParserBrackets); ok { - staticCall.OpenCurlyBracketTkn = brackets.OpenBracketTkn - staticCall.Call = brackets.Child - staticCall.CloseCurlyBracketTkn = brackets.CloseBracketTkn - } - - $$ = staticCall - } - | variable_class_name T_PAAMAYIM_NEKUDOTAYIM variable_without_objects function_call_parameter_list - { - $$ = &ast.ExprStaticCall{ - Position: yylex.(*Parser).builder.NewNodesPosition($1, $4), - Class: $1, - DoubleColonTkn: $2, - Call: $3, - OpenParenthesisTkn: $4.(*ArgumentList).OpenParenthesisTkn, - Args: $4.(*ArgumentList).Arguments, - SeparatorTkns: $4.(*ArgumentList).SeparatorTkns, - CloseParenthesisTkn: $4.(*ArgumentList).CloseParenthesisTkn, - } - } - | variable_without_objects function_call_parameter_list - { - $$ = &ast.ExprFunctionCall{ - Position: yylex.(*Parser).builder.NewNodesPosition($1, $2), - Function: $1, - OpenParenthesisTkn: $2.(*ArgumentList).OpenParenthesisTkn, - Args: $2.(*ArgumentList).Arguments, - SeparatorTkns: $2.(*ArgumentList).SeparatorTkns, - CloseParenthesisTkn: $2.(*ArgumentList).CloseParenthesisTkn, - } - } -; - -class_name: - T_STATIC - { - $$ = &ast.Identifier{ - Position: yylex.(*Parser).builder.NewTokenPosition($1), - IdentifierTkn: $1, - Value: $1.Value, - } - } - | namespace_name - { - $$ = &ast.Name{ - Position: yylex.(*Parser).builder.NewNodeListPosition($1.(*ParserSeparatedList).Items), - Parts: $1.(*ParserSeparatedList).Items, - SeparatorTkns: $1.(*ParserSeparatedList).SeparatorTkns, - } - } - | T_NAMESPACE T_NS_SEPARATOR namespace_name - { - $$ = &ast.NameRelative{ - Position: yylex.(*Parser).builder.NewTokenNodeListPosition($1, $3.(*ParserSeparatedList).Items), - NsTkn: $1, - NsSeparatorTkn: $2, - Parts: $3.(*ParserSeparatedList).Items, - SeparatorTkns: $3.(*ParserSeparatedList).SeparatorTkns, - } - } - | T_NS_SEPARATOR namespace_name - { - $$ = &ast.NameFullyQualified{ - Position: yylex.(*Parser).builder.NewTokenNodeListPosition($1, $2.(*ParserSeparatedList).Items), - NsSeparatorTkn: $1, - Parts: $2.(*ParserSeparatedList).Items, - SeparatorTkns: $2.(*ParserSeparatedList).SeparatorTkns, - } - } -; - -fully_qualified_class_name: - namespace_name - { - $$ = &ast.Name{ - Position: yylex.(*Parser).builder.NewNodeListPosition($1.(*ParserSeparatedList).Items), - Parts: $1.(*ParserSeparatedList).Items, - SeparatorTkns: $1.(*ParserSeparatedList).SeparatorTkns, - } - } - | T_NAMESPACE T_NS_SEPARATOR namespace_name - { - $$ = &ast.NameRelative{ - Position: yylex.(*Parser).builder.NewTokenNodeListPosition($1, $3.(*ParserSeparatedList).Items), - NsTkn: $1, - NsSeparatorTkn: $2, - Parts: $3.(*ParserSeparatedList).Items, - SeparatorTkns: $3.(*ParserSeparatedList).SeparatorTkns, - } - } - | T_NS_SEPARATOR namespace_name - { - $$ = &ast.NameFullyQualified{ - Position: yylex.(*Parser).builder.NewTokenNodeListPosition($1, $2.(*ParserSeparatedList).Items), - NsSeparatorTkn: $1, - Parts: $2.(*ParserSeparatedList).Items, - SeparatorTkns: $2.(*ParserSeparatedList).SeparatorTkns, - } - } -; - -class_name_reference: - class_name - { - $$ = $1 - } - | dynamic_class_name_reference - { - $$ = $1 - } -; - -dynamic_class_name_reference: - base_variable T_OBJECT_OPERATOR object_property dynamic_class_name_variable_properties - { - $$ = $1 - - $3[0].(*ast.ExprPropertyFetch).ObjectOperatorTkn = $2 - - for _, n := range($3) { - switch nn := n.(type) { - case *ast.ExprArrayDimFetch: - nn.Var = $$ - *$$.GetPosition() = *yylex.(*Parser).builder.NewNodesPosition($$, nn) - $$ = nn - - case *ast.ExprPropertyFetch: - nn.Var = $$ - *$$.GetPosition() = *yylex.(*Parser).builder.NewNodesPosition($$, nn) - $$ = nn - } - } - - for _, n := range($4) { - switch nn := n.(type) { - case *ast.ExprArrayDimFetch: - nn.Var = $$ - *$$.GetPosition() = *yylex.(*Parser).builder.NewNodesPosition($$, nn) - $$ = nn - - case *ast.ExprPropertyFetch: - nn.Var = $$ - *$$.GetPosition() = *yylex.(*Parser).builder.NewNodesPosition($$, nn) - $$ = nn - } - } - } - | base_variable - { - $$ = $1 - } -; - - -dynamic_class_name_variable_properties: - dynamic_class_name_variable_properties dynamic_class_name_variable_property - { - $$ = append($1, $2...) - } - | /* empty */ - { - $$ = []ast.Vertex{} - } -; - - -dynamic_class_name_variable_property: - T_OBJECT_OPERATOR object_property - { - $2[0].(*ast.ExprPropertyFetch).ObjectOperatorTkn = $1 - - $$ = $2 - } -; - -exit_expr: - /* empty */ - { - $$ = nil - } - | '(' ')' - { - $$ = &ast.ExprBrackets{ - Position: yylex.(*Parser).builder.NewTokensPosition($1, $2), - OpenParenthesisTkn: $1, - CloseParenthesisTkn: $2, - } - } - | parenthesis_expr - { - $$ = $1 - } -; - -backticks_expr: - /* empty */ - { - $$ = []ast.Vertex{} - } - | T_ENCAPSED_AND_WHITESPACE - { - $$ = []ast.Vertex{ - &ast.ScalarEncapsedStringPart{ - Position: yylex.(*Parser).builder.NewTokenPosition($1), - EncapsedStrTkn: $1, - Value: $1.Value, - }, - } - } - | encaps_list - { - $$ = $1; - } -; - -ctor_arguments: - /* empty */ - { - $$ = nil - } - | function_call_parameter_list - { - $$ = $1 - } -; - -common_scalar: - T_LNUMBER - { - $$ = &ast.ScalarLnumber{ - Position: yylex.(*Parser).builder.NewTokenPosition($1), - NumberTkn: $1, - Value: $1.Value, - } - } - | T_DNUMBER - { - $$ = &ast.ScalarDnumber{ - Position: yylex.(*Parser).builder.NewTokenPosition($1), - NumberTkn: $1, - Value: $1.Value, - } - } - | T_CONSTANT_ENCAPSED_STRING - { - $$ = &ast.ScalarString{ - Position: yylex.(*Parser).builder.NewTokenPosition($1), - StringTkn: $1, - Value: $1.Value, - } - } - | T_LINE - { - $$ = &ast.ScalarMagicConstant{ - Position: yylex.(*Parser).builder.NewTokenPosition($1), - MagicConstTkn: $1, - Value: $1.Value, - } - } - | T_FILE - { - $$ = &ast.ScalarMagicConstant{ - Position: yylex.(*Parser).builder.NewTokenPosition($1), - MagicConstTkn: $1, - Value: $1.Value, - } - } - | T_DIR - { - $$ = &ast.ScalarMagicConstant{ - Position: yylex.(*Parser).builder.NewTokenPosition($1), - MagicConstTkn: $1, - Value: $1.Value, - } - } - | T_TRAIT_C - { - $$ = &ast.ScalarMagicConstant{ - Position: yylex.(*Parser).builder.NewTokenPosition($1), - MagicConstTkn: $1, - Value: $1.Value, - } - } - | T_METHOD_C - { - $$ = &ast.ScalarMagicConstant{ - Position: yylex.(*Parser).builder.NewTokenPosition($1), - MagicConstTkn: $1, - Value: $1.Value, - } - } - | T_FUNC_C - { - $$ = &ast.ScalarMagicConstant{ - Position: yylex.(*Parser).builder.NewTokenPosition($1), - MagicConstTkn: $1, - Value: $1.Value, - } - } - | T_NS_C - { - $$ = &ast.ScalarMagicConstant{ - Position: yylex.(*Parser).builder.NewTokenPosition($1), - MagicConstTkn: $1, - Value: $1.Value, - } - } - | T_START_HEREDOC T_ENCAPSED_AND_WHITESPACE T_END_HEREDOC - { - $$ = &ast.ScalarHeredoc{ - Position: yylex.(*Parser).builder.NewTokensPosition($1, $3), - OpenHeredocTkn: $1, - Parts: []ast.Vertex{ - &ast.ScalarEncapsedStringPart{ - Position: yylex.(*Parser).builder.NewTokenPosition($2), - EncapsedStrTkn: $2, - Value: $2.Value, - }, - }, - CloseHeredocTkn: $3, - } - } - | T_START_HEREDOC T_END_HEREDOC - { - $$ = &ast.ScalarHeredoc{ - Position: yylex.(*Parser).builder.NewTokensPosition($1, $2), - OpenHeredocTkn: $1, - CloseHeredocTkn: $2, - } - } -; - -static_class_constant: - class_name T_PAAMAYIM_NEKUDOTAYIM T_STRING - { - $$ = &ast.ExprClassConstFetch{ - Position: yylex.(*Parser).builder.NewNodeTokenPosition($1, $3), - Class: $1, - DoubleColonTkn: $2, - Const: &ast.Identifier{ - Position: yylex.(*Parser).builder.NewTokenPosition($3), - IdentifierTkn: $3, - Value: $3.Value, - }, - } - } -; - -static_scalar: - static_scalar_value - { - $$ = $1 - } -; - -static_scalar_value: - common_scalar - { - $$ = $1 - } - | static_class_name_scalar - { - $$ = $1 - } - | namespace_name - { - $$ = &ast.ExprConstFetch{ - Position: yylex.(*Parser).builder.NewNodeListPosition($1.(*ParserSeparatedList).Items), - Const: &ast.Name{ - Position: yylex.(*Parser).builder.NewNodeListPosition($1.(*ParserSeparatedList).Items), - Parts: $1.(*ParserSeparatedList).Items, - SeparatorTkns: $1.(*ParserSeparatedList).SeparatorTkns, - }, - } - } - | T_NAMESPACE T_NS_SEPARATOR namespace_name - { - $$ = &ast.ExprConstFetch{ - Position: yylex.(*Parser).builder.NewTokenNodeListPosition($1, $3.(*ParserSeparatedList).Items), - Const: &ast.NameRelative{ - Position: yylex.(*Parser).builder.NewTokenNodeListPosition($1, $3.(*ParserSeparatedList).Items), - NsTkn: $1, - NsSeparatorTkn: $2, - Parts: $3.(*ParserSeparatedList).Items, - SeparatorTkns: $3.(*ParserSeparatedList).SeparatorTkns, - }, - } - } - | T_NS_SEPARATOR namespace_name - { - $$ = &ast.ExprConstFetch{ - Position: yylex.(*Parser).builder.NewTokenNodeListPosition($1, $2.(*ParserSeparatedList).Items), - Const: &ast.NameFullyQualified{ - Position: yylex.(*Parser).builder.NewTokenNodeListPosition($1, $2.(*ParserSeparatedList).Items), - NsSeparatorTkn: $1, - Parts: $2.(*ParserSeparatedList).Items, - SeparatorTkns: $2.(*ParserSeparatedList).SeparatorTkns, - }, - } - } - | T_ARRAY '(' static_array_pair_list ')' - { - $$ = &ast.ExprArray{ - Position: yylex.(*Parser).builder.NewTokensPosition($1, $4), - ArrayTkn: $1, - OpenBracketTkn: $2, - Items: $3.(*ParserSeparatedList).Items, - SeparatorTkns: $3.(*ParserSeparatedList).SeparatorTkns, - CloseBracketTkn: $4, - } - } - | '[' static_array_pair_list ']' - { - $$ = &ast.ExprArray{ - Position: yylex.(*Parser).builder.NewTokensPosition($1, $3), - OpenBracketTkn: $1, - Items: $2.(*ParserSeparatedList).Items, - SeparatorTkns: $2.(*ParserSeparatedList).SeparatorTkns, - CloseBracketTkn: $3, - } - } - | static_class_constant - { - $$ = $1 - } - | T_CLASS_C - { - $$ = &ast.ScalarMagicConstant{ - Position: yylex.(*Parser).builder.NewTokenPosition($1), - MagicConstTkn: $1, - Value: $1.Value, - } - } - | static_operation - { - $$ = $1 - } -; - -static_operation: - static_scalar_value '[' static_scalar_value ']' - { - $$ = &ast.ExprArrayDimFetch{ - Position: yylex.(*Parser).builder.NewNodeTokenPosition($1, $4), - Var: $1, - OpenBracketTkn: $2, - Dim: $3, - CloseBracketTkn: $4, - } - } - | static_scalar_value '+' static_scalar_value - { - $$ = &ast.ExprBinaryPlus{ - Position: yylex.(*Parser).builder.NewNodesPosition($1, $3), - Left: $1, - OpTkn: $2, - Right: $3, - } - } - | static_scalar_value '-' static_scalar_value - { - $$ = &ast.ExprBinaryMinus{ - Position: yylex.(*Parser).builder.NewNodesPosition($1, $3), - Left: $1, - OpTkn: $2, - Right: $3, - } - } - | static_scalar_value '*' static_scalar_value - { - $$ = &ast.ExprBinaryMul{ - Position: yylex.(*Parser).builder.NewNodesPosition($1, $3), - Left: $1, - OpTkn: $2, - Right: $3, - } - } - | static_scalar_value T_POW static_scalar_value - { - $$ = &ast.ExprBinaryPow{ - Position: yylex.(*Parser).builder.NewNodesPosition($1, $3), - Left: $1, - OpTkn: $2, - Right: $3, - } - } - | static_scalar_value '/' static_scalar_value - { - $$ = &ast.ExprBinaryDiv{ - Position: yylex.(*Parser).builder.NewNodesPosition($1, $3), - Left: $1, - OpTkn: $2, - Right: $3, - } - } - | static_scalar_value '%' static_scalar_value - { - $$ = &ast.ExprBinaryMod{ - Position: yylex.(*Parser).builder.NewNodesPosition($1, $3), - Left: $1, - OpTkn: $2, - Right: $3, - } - } - | '!' static_scalar_value - { - $$ = &ast.ExprBooleanNot{ - Position: yylex.(*Parser).builder.NewTokenNodePosition($1, $2), - ExclamationTkn: $1, - Expr: $2, - } - } - | '~' static_scalar_value - { - $$ = &ast.ExprBitwiseNot{ - Position: yylex.(*Parser).builder.NewTokenNodePosition($1, $2), - TildaTkn: $1, - Expr: $2, - } - } - | static_scalar_value '|' static_scalar_value - { - $$ = &ast.ExprBinaryBitwiseOr{ - Position: yylex.(*Parser).builder.NewNodesPosition($1, $3), - Left: $1, - OpTkn: $2, - Right: $3, - } - } - | static_scalar_value '&' static_scalar_value - { - $$ = &ast.ExprBinaryBitwiseAnd{ - Position: yylex.(*Parser).builder.NewNodesPosition($1, $3), - Left: $1, - OpTkn: $2, - Right: $3, - } - } - | static_scalar_value '^' static_scalar_value - { - $$ = &ast.ExprBinaryBitwiseXor{ - Position: yylex.(*Parser).builder.NewNodesPosition($1, $3), - Left: $1, - OpTkn: $2, - Right: $3, - } - } - | static_scalar_value T_SL static_scalar_value - { - $$ = &ast.ExprBinaryShiftLeft{ - Position: yylex.(*Parser).builder.NewNodesPosition($1, $3), - Left: $1, - OpTkn: $2, - Right: $3, - } - } - | static_scalar_value T_SR static_scalar_value - { - $$ = &ast.ExprBinaryShiftRight{ - Position: yylex.(*Parser).builder.NewNodesPosition($1, $3), - Left: $1, - OpTkn: $2, - Right: $3, - } - } - | static_scalar_value '.' static_scalar_value - { - $$ = &ast.ExprBinaryConcat{ - Position: yylex.(*Parser).builder.NewNodesPosition($1, $3), - Left: $1, - OpTkn: $2, - Right: $3, - } - } - | static_scalar_value T_LOGICAL_XOR static_scalar_value - { - $$ = &ast.ExprBinaryLogicalXor{ - Position: yylex.(*Parser).builder.NewNodesPosition($1, $3), - Left: $1, - OpTkn: $2, - Right: $3, - } - } - | static_scalar_value T_LOGICAL_AND static_scalar_value - { - $$ = &ast.ExprBinaryLogicalAnd{ - Position: yylex.(*Parser).builder.NewNodesPosition($1, $3), - Left: $1, - OpTkn: $2, - Right: $3, - } - } - | static_scalar_value T_LOGICAL_OR static_scalar_value - { - $$ = &ast.ExprBinaryLogicalOr{ - Position: yylex.(*Parser).builder.NewNodesPosition($1, $3), - Left: $1, - OpTkn: $2, - Right: $3, - } - } - | static_scalar_value T_BOOLEAN_AND static_scalar_value - { - $$ = &ast.ExprBinaryBooleanAnd{ - Position: yylex.(*Parser).builder.NewNodesPosition($1, $3), - Left: $1, - OpTkn: $2, - Right: $3, - } - } - | static_scalar_value T_BOOLEAN_OR static_scalar_value - { - $$ = &ast.ExprBinaryBooleanOr{ - Position: yylex.(*Parser).builder.NewNodesPosition($1, $3), - Left: $1, - OpTkn: $2, - Right: $3, - } - } - | static_scalar_value T_IS_IDENTICAL static_scalar_value - { - $$ = &ast.ExprBinaryIdentical{ - Position: yylex.(*Parser).builder.NewNodesPosition($1, $3), - Left: $1, - OpTkn: $2, - Right: $3, - } - } - | static_scalar_value T_IS_NOT_IDENTICAL static_scalar_value - { - $$ = &ast.ExprBinaryNotIdentical{ - Position: yylex.(*Parser).builder.NewNodesPosition($1, $3), - Left: $1, - OpTkn: $2, - Right: $3, - } - } - | static_scalar_value T_IS_EQUAL static_scalar_value - { - $$ = &ast.ExprBinaryEqual{ - Position: yylex.(*Parser).builder.NewNodesPosition($1, $3), - Left: $1, - OpTkn: $2, - Right: $3, - } - } - | static_scalar_value T_IS_NOT_EQUAL static_scalar_value - { - $$ = &ast.ExprBinaryNotEqual{ - Position: yylex.(*Parser).builder.NewNodesPosition($1, $3), - Left: $1, - OpTkn: $2, - Right: $3, - } - } - | static_scalar_value '<' static_scalar_value - { - $$ = &ast.ExprBinarySmaller{ - Position: yylex.(*Parser).builder.NewNodesPosition($1, $3), - Left: $1, - OpTkn: $2, - Right: $3, - } - } - | static_scalar_value '>' static_scalar_value - { - $$ = &ast.ExprBinaryGreater{ - Position: yylex.(*Parser).builder.NewNodesPosition($1, $3), - Left: $1, - OpTkn: $2, - Right: $3, - } - } - | static_scalar_value T_IS_SMALLER_OR_EQUAL static_scalar_value - { - $$ = &ast.ExprBinarySmallerOrEqual{ - Position: yylex.(*Parser).builder.NewNodesPosition($1, $3), - Left: $1, - OpTkn: $2, - Right: $3, - } - } - | static_scalar_value T_IS_GREATER_OR_EQUAL static_scalar_value - { - $$ = &ast.ExprBinaryGreaterOrEqual{ - Position: yylex.(*Parser).builder.NewNodesPosition($1, $3), - Left: $1, - OpTkn: $2, - Right: $3, - } - } - | static_scalar_value '?' ':' static_scalar_value - { - $$ = &ast.ExprTernary{ - Position: yylex.(*Parser).builder.NewNodesPosition($1, $4), - Cond: $1, - QuestionTkn: $2, - ColonTkn: $3, - IfFalse: $4, - } - } - | static_scalar_value '?' static_scalar_value ':' static_scalar_value - { - $$ = &ast.ExprTernary{ - Position: yylex.(*Parser).builder.NewNodesPosition($1, $5), - Cond: $1, - QuestionTkn: $2, - IfTrue: $3, - ColonTkn: $4, - IfFalse: $5, - } - } - | '+' static_scalar_value - { - $$ = &ast.ExprUnaryPlus{ - Position: yylex.(*Parser).builder.NewTokenNodePosition($1, $2), - PlusTkn: $1, - Expr: $2, - } - } - | '-' static_scalar_value - { - $$ = &ast.ExprUnaryMinus{ - Position: yylex.(*Parser).builder.NewTokenNodePosition($1, $2), - MinusTkn: $1, - Expr: $2, - } - } - | '(' static_scalar_value ')' - { - $$ = &ast.ExprBrackets{ - Position: yylex.(*Parser).builder.NewTokensPosition($1, $3), - OpenParenthesisTkn: $1, - Expr: $2, - CloseParenthesisTkn: $3, - } - } -; - -general_constant: - class_constant - { - $$ = $1 - } - | namespace_name - { - $$ = &ast.ExprConstFetch{ - Position: yylex.(*Parser).builder.NewNodeListPosition($1.(*ParserSeparatedList).Items), - Const: &ast.Name{ - Position: yylex.(*Parser).builder.NewNodeListPosition($1.(*ParserSeparatedList).Items), - Parts: $1.(*ParserSeparatedList).Items, - SeparatorTkns: $1.(*ParserSeparatedList).SeparatorTkns, - }, - } - } - | T_NAMESPACE T_NS_SEPARATOR namespace_name - { - $$ = &ast.ExprConstFetch{ - Position: yylex.(*Parser).builder.NewTokenNodeListPosition($1, $3.(*ParserSeparatedList).Items), - Const: &ast.NameRelative{ - Position: yylex.(*Parser).builder.NewTokenNodeListPosition($1, $3.(*ParserSeparatedList).Items), - NsTkn: $1, - NsSeparatorTkn: $2, - Parts: $3.(*ParserSeparatedList).Items, - SeparatorTkns: $3.(*ParserSeparatedList).SeparatorTkns, - }, - } - } - | T_NS_SEPARATOR namespace_name - { - $$ = &ast.ExprConstFetch{ - Position: yylex.(*Parser).builder.NewTokenNodeListPosition($1, $2.(*ParserSeparatedList).Items), - Const: &ast.NameFullyQualified{ - Position: yylex.(*Parser).builder.NewTokenNodeListPosition($1, $2.(*ParserSeparatedList).Items), - NsSeparatorTkn: $1, - Parts: $2.(*ParserSeparatedList).Items, - SeparatorTkns: $2.(*ParserSeparatedList).SeparatorTkns, - }, - } - } -; - -scalar: - T_STRING_VARNAME - { - $$ = &ast.ExprVariable{ - Position: yylex.(*Parser).builder.NewTokenPosition($1), - Name: &ast.Identifier{ - Position: yylex.(*Parser).builder.NewTokenPosition($1), - IdentifierTkn: $1, - Value: $1.Value, - }, - } - } - | general_constant - { - $$ = $1 - } - | class_name_scalar - { - $$ = $1 - } - | common_scalar - { - $$ = $1 - } - | '"' encaps_list '"' - { - $$ = &ast.ScalarEncapsed{ - Position: yylex.(*Parser).builder.NewTokensPosition($1, $3), - OpenQuoteTkn: $1, - Parts: $2, - CloseQuoteTkn: $3, - } - } - | T_START_HEREDOC encaps_list T_END_HEREDOC - { - $$ = &ast.ScalarHeredoc{ - Position: yylex.(*Parser).builder.NewTokensPosition($1, $3), - OpenHeredocTkn: $1, - Parts: $2, - CloseHeredocTkn: $3, - } - } - | T_CLASS_C - { - $$ = &ast.ScalarMagicConstant{ - Position: yylex.(*Parser).builder.NewTokenPosition($1), - MagicConstTkn: $1, - Value: $1.Value, - } - } -; - -static_array_pair_list: - /* empty */ - { - $$ = &ParserSeparatedList{} - } - | non_empty_static_array_pair_list possible_comma - { - if $2 != nil { - $1.(*ParserSeparatedList).SeparatorTkns = append($1.(*ParserSeparatedList).SeparatorTkns, $2) - $1.(*ParserSeparatedList).Items = append($1.(*ParserSeparatedList).Items, &ast.ExprArrayItem{}) - } - - $$ = $1 - } -; - -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 := &ast.ExprArrayItem{ - Position: yylex.(*Parser).builder.NewNodesPosition($3, $5), - Key: $3, - DoubleArrowTkn: $4, - Val: $5, - } - - $1.(*ParserSeparatedList).SeparatorTkns = append($1.(*ParserSeparatedList).SeparatorTkns, $2) - $1.(*ParserSeparatedList).Items = append($1.(*ParserSeparatedList).Items, arrayItem) - - $$ = $1 - } - | non_empty_static_array_pair_list ',' static_scalar_value - { - arrayItem := &ast.ExprArrayItem{ - Position: yylex.(*Parser).builder.NewNodePosition($3), - Val: $3, - } - - $1.(*ParserSeparatedList).SeparatorTkns = append($1.(*ParserSeparatedList).SeparatorTkns, $2) - $1.(*ParserSeparatedList).Items = append($1.(*ParserSeparatedList).Items, arrayItem) - - $$ = $1 - } - | static_scalar_value T_DOUBLE_ARROW static_scalar_value - { - $$ = &ParserSeparatedList{ - Items: []ast.Vertex{ - &ast.ExprArrayItem{ - Position: yylex.(*Parser).builder.NewNodesPosition($1, $3), - Key: $1, - DoubleArrowTkn: $2, - Val: $3, - }, - }, - } - } - | static_scalar_value - { - $$ = &ParserSeparatedList{ - Items: []ast.Vertex{ - &ast.ExprArrayItem{ - Position: yylex.(*Parser).builder.NewNodePosition($1), - Val: $1, - }, - }, - } - } -; - -expr: - r_variable - { - $$ = $1 - } - | expr_without_variable - { - $$ = $1 - } -; - -parenthesis_expr: - '(' expr ')' - { - $$ = &ast.ExprBrackets{ - Position: yylex.(*Parser).builder.NewTokensPosition($1, $3), - OpenParenthesisTkn: $1, - Expr: $2, - CloseParenthesisTkn: $3, - } - } - | '(' yield_expr ')' - { - $$ = &ast.ExprBrackets{ - Position: yylex.(*Parser).builder.NewTokensPosition($1, $3), - OpenParenthesisTkn: $1, - Expr: $2, - CloseParenthesisTkn: $3, - } - } -; - - -r_variable: - variable - { - $$ = $1 - } -; - - -w_variable: - variable - { - $$ = $1 - } -; - -rw_variable: - variable - { - $$ = $1 - } -; - -variable: - base_variable_with_function_calls T_OBJECT_OPERATOR object_property method_or_not variable_properties - { - $$ = $1 - - $3[0].(*ast.ExprPropertyFetch).ObjectOperatorTkn = $2 - - if $4 != nil { - last := $3[len($3)-1] - switch l := last.(type) { - case *ast.ExprArrayDimFetch: - mc := $4[0].(*ast.ExprMethodCall) - $3 = append($3, &ast.ExprFunctionCall{ - Position: yylex.(*Parser).builder.NewNodePosition(mc), - OpenParenthesisTkn: mc.OpenParenthesisTkn, - Args: mc.Args, - SeparatorTkns: mc.SeparatorTkns, - CloseParenthesisTkn: mc.CloseParenthesisTkn, - }, - ) - $3 = append($3, $4[1:len($4)]...) - case *ast.ExprPropertyFetch: - $4[0].(*ast.ExprMethodCall).OpenCurlyBracketTkn = l.OpenCurlyBracketTkn - $4[0].(*ast.ExprMethodCall).Method = l.Prop - $4[0].(*ast.ExprMethodCall).CloseCurlyBracketTkn = l.CloseCurlyBracketTkn - $4[0].(*ast.ExprMethodCall).ObjectOperatorTkn = l.ObjectOperatorTkn - $3 = append($3[:len($3)-1], $4...) - } - } - - for _, n := range($3) { - switch nn := n.(type) { - case *ast.ExprFunctionCall: - nn.Function = $$ - nn.Position = yylex.(*Parser).builder.NewNodesPosition($$, nn) - $$ = nn - - case *ast.ExprArrayDimFetch: - nn.Var = $$ - nn.Position = yylex.(*Parser).builder.NewNodesPosition($$, nn) - $$ = nn - - case *ast.ExprPropertyFetch: - nn.Var = $$ - nn.Position = yylex.(*Parser).builder.NewNodesPosition($$, nn) - $$ = nn - - case *ast.ExprMethodCall: - nn.Var = $$ - nn.Position = yylex.(*Parser).builder.NewNodesPosition($$, nn) - $$ = nn - } - } - - for _, n := range($5) { - switch nn := n.(type) { - case *ast.ExprFunctionCall: - nn.Function = $$ - nn.Position = yylex.(*Parser).builder.NewNodesPosition($$, nn) - $$ = nn - - case *ast.ExprArrayDimFetch: - nn.Var = $$ - nn.Position = yylex.(*Parser).builder.NewNodesPosition($$, nn) - $$ = nn - - case *ast.ExprPropertyFetch: - nn.Var = $$ - nn.Position = yylex.(*Parser).builder.NewNodesPosition($$, nn) - $$ = nn - - case *ast.ExprMethodCall: - nn.Var = $$ - nn.Position = yylex.(*Parser).builder.NewNodesPosition($$, nn) - $$ = nn - } - } - } - | base_variable_with_function_calls - { - $$ = $1 - } -; - -variable_properties: - variable_properties variable_property - { - $$ = append($1, $2...) - } - | /* empty */ - { - $$ = []ast.Vertex{} - } -; - - -variable_property: - T_OBJECT_OPERATOR object_property method_or_not - { - $2[0].(*ast.ExprPropertyFetch).ObjectOperatorTkn = $1 - - if $3 != nil { - last := $2[len($2)-1] - switch l := last.(type) { - case *ast.ExprArrayDimFetch: - mc := $3[0].(*ast.ExprMethodCall) - $2 = append($2, &ast.ExprFunctionCall{ - Position: yylex.(*Parser).builder.NewNodePosition(mc), - OpenParenthesisTkn: mc.OpenParenthesisTkn, - Args: mc.Args, - SeparatorTkns: mc.SeparatorTkns, - CloseParenthesisTkn: mc.OpenParenthesisTkn, - }, - ) - $2 = append($2, $3[1:len($3)]...) - case *ast.ExprPropertyFetch: - $3[0].(*ast.ExprMethodCall).OpenCurlyBracketTkn = l.OpenCurlyBracketTkn - $3[0].(*ast.ExprMethodCall).Method = l.Prop - $3[0].(*ast.ExprMethodCall).CloseCurlyBracketTkn = l.CloseCurlyBracketTkn - $3[0].(*ast.ExprMethodCall).ObjectOperatorTkn = l.ObjectOperatorTkn - $2 = append($2[:len($2)-1], $3...) - } - } - - $$ = $2 - } -; - -array_method_dereference: - array_method_dereference '[' dim_offset ']' - { - fetch := &ast.ExprArrayDimFetch{ - Position: yylex.(*Parser).builder.NewTokensPosition($2, $4), - Var: nil, - OpenBracketTkn: $2, - Dim: $3, - CloseBracketTkn: $4, - } - - $$ = append($1, fetch) - } - | method '[' dim_offset ']' - { - fetch := &ast.ExprArrayDimFetch{ - Position: yylex.(*Parser).builder.NewTokensPosition($2, $4), - Var: nil, - OpenBracketTkn: $2, - Dim: $3, - CloseBracketTkn: $4, - } - - $$ = []ast.Vertex{$1, fetch} - } -; - -method: - function_call_parameter_list - { - $$ = &ast.ExprMethodCall{ - Position: yylex.(*Parser).builder.NewNodePosition($1), - OpenParenthesisTkn: $1.(*ArgumentList).OpenParenthesisTkn, - Args: $1.(*ArgumentList).Arguments, - SeparatorTkns: $1.(*ArgumentList).SeparatorTkns, - CloseParenthesisTkn: $1.(*ArgumentList).CloseParenthesisTkn, - } - } -; - -method_or_not: - method - { - $$ = []ast.Vertex{$1} - } - | array_method_dereference - { - $$ = $1 - } - | /* empty */ - { - $$ = nil - } -; - -variable_without_objects: - reference_variable - { - $$ = $1 - } - | simple_indirect_reference reference_variable - { - for i := len($1)-1; i>=0; i-- { - $1[i].(*ast.ExprVariable).Name = $2 - $1[i].(*ast.ExprVariable).Position = yylex.(*Parser).builder.NewNodesPosition($1[i], $2) - $2 = $1[i] - } - - $$ = $1[0] - } -; - -static_member: - class_name T_PAAMAYIM_NEKUDOTAYIM variable_without_objects - { - $$ = &ast.ExprStaticPropertyFetch{ - Position: yylex.(*Parser).builder.NewNodesPosition($1, $3), - Class: $1, - DoubleColonTkn: $2, - Prop: $3, - } - } - | variable_class_name T_PAAMAYIM_NEKUDOTAYIM variable_without_objects - { - $$ = &ast.ExprStaticPropertyFetch{ - Position: yylex.(*Parser).builder.NewNodesPosition($1, $3), - Class: $1, - DoubleColonTkn: $2, - Prop: $3, - } - } -; - -variable_class_name: - reference_variable - { - $$ = $1 - } -; - -array_function_dereference: - array_function_dereference '[' dim_offset ']' - { - $$ = &ast.ExprArrayDimFetch{ - Position: yylex.(*Parser).builder.NewNodeTokenPosition($1, $4), - Var: $1, - OpenBracketTkn: $2, - Dim: $3, - CloseBracketTkn: $4, - } - } - | function_call '[' dim_offset ']' - { - $$ = &ast.ExprArrayDimFetch{ - Position: yylex.(*Parser).builder.NewNodeTokenPosition($1, $4), - Var: $1, - OpenBracketTkn: $2, - Dim: $3, - CloseBracketTkn: $4, - } - } -; - -base_variable_with_function_calls: - base_variable - { - $$ = $1 - } - | array_function_dereference - { - $$ = $1 - } - | function_call - { - $$ = $1 - } -; - - -base_variable: - reference_variable - { - $$ = $1 - } - | simple_indirect_reference reference_variable - { - for i := len($1)-1; i>=0; i-- { - $1[i].(*ast.ExprVariable).Name = $2 - $1[i].(*ast.ExprVariable).Position = yylex.(*Parser).builder.NewNodesPosition($1[i], $2) - $2 = $1[i] - } - - $$ = $1[0] - } - | static_member - { - $$ = $1 - } -; - -reference_variable: - reference_variable '[' dim_offset ']' - { - $$ = &ast.ExprArrayDimFetch{ - Position: yylex.(*Parser).builder.NewNodeTokenPosition($1, $4), - Var: $1, - OpenBracketTkn: $2, - Dim: $3, - CloseBracketTkn: $4, - } - } - | reference_variable '{' expr '}' - { - $$ = &ast.ExprArrayDimFetch{ - Position: yylex.(*Parser).builder.NewNodeTokenPosition($1, $4), - Var: $1, - OpenBracketTkn: $2, - Dim: $3, - CloseBracketTkn: $4, - } - } - | compound_variable - { - $$ = $1 - } -; - - -compound_variable: - T_VARIABLE - { - $$ = &ast.ExprVariable{ - Position: yylex.(*Parser).builder.NewTokenPosition($1), - Name: &ast.Identifier{ - Position: yylex.(*Parser).builder.NewTokenPosition($1), - IdentifierTkn: $1, - Value: $1.Value, - }, - } - } - | '$' '{' expr '}' - { - $$ = &ast.ExprVariable{ - Position: yylex.(*Parser).builder.NewTokensPosition($1, $4), - DollarTkn: $1, - OpenCurlyBracketTkn: $2, - Name: $3, - CloseCurlyBracketTkn: $4, - } - } -; - -dim_offset: - /* empty */ - { - $$ = nil - } - | expr - { - $$ = $1 - } -; - - -object_property: - object_dim_list - { - $$ = $1 - } - | variable_without_objects - { - $$ = []ast.Vertex{ - &ast.ExprPropertyFetch{ - Position: yylex.(*Parser).builder.NewNodePosition($1), - Prop: $1, - }, - } - } -; - -object_dim_list: - object_dim_list '[' dim_offset ']' - { - fetch := &ast.ExprArrayDimFetch{ - Position: yylex.(*Parser).builder.NewTokensPosition($2, $4), - Var: nil, - OpenBracketTkn: $2, - Dim: $3, - CloseBracketTkn: $4, - } - - $$ = append($1, fetch) - } - | object_dim_list '{' expr '}' - { - fetch := &ast.ExprArrayDimFetch{ - Position: yylex.(*Parser).builder.NewTokensPosition($2, $4), - Var: nil, - OpenBracketTkn: $2, - Dim: $3, - CloseBracketTkn: $4, - } - - $$ = append($1, fetch) - } - | variable_name - { - property := &ast.ExprPropertyFetch{ - Position: yylex.(*Parser).builder.NewNodePosition($1), - Prop: $1, - } - - if brackets, ok := $1.(*ParserBrackets); ok { - property.OpenCurlyBracketTkn = brackets.OpenBracketTkn - property.Prop = brackets.Child - property.CloseCurlyBracketTkn = brackets.CloseBracketTkn - } - - $$ = []ast.Vertex{ property } - } -; - -variable_name: - T_STRING - { - $$ = &ast.Identifier{ - Position: yylex.(*Parser).builder.NewTokenPosition($1), - IdentifierTkn: $1, - Value: $1.Value, - } - } - | '{' expr '}' - { - $$ = &ParserBrackets{ - Position: yylex.(*Parser).builder.NewTokensPosition($1, $3), - OpenBracketTkn: $1, - Child: $2, - CloseBracketTkn: $3, - } - } -; - -simple_indirect_reference: - '$' - { - $$ = []ast.Vertex{ - &ast.ExprVariable{ - Position: yylex.(*Parser).builder.NewTokenPosition($1), - DollarTkn: $1, - }, - } - } - | simple_indirect_reference '$' - { - $$ = append($1, &ast.ExprVariable{ - Position: yylex.(*Parser).builder.NewTokenPosition($2), - DollarTkn: $2, - }) - } -; - -assignment_list: - assignment_list ',' assignment_list_element - { - $1.(*ParserSeparatedList).SeparatorTkns = append($1.(*ParserSeparatedList).SeparatorTkns, $2) - $1.(*ParserSeparatedList).Items = append($1.(*ParserSeparatedList).Items, $3) - - $$ = $1 - } - | assignment_list_element - { - $$ = &ParserSeparatedList{ - Items: []ast.Vertex{$1}, - } - } -; - - -assignment_list_element: - variable - { - $$ = &ast.ExprArrayItem{ - Position: yylex.(*Parser).builder.NewNodePosition($1), - Val: $1, - } - } - | T_LIST '(' assignment_list ')' - { - pairList := $3.(*ParserSeparatedList) - fistPair := pairList.Items[0].(*ast.ExprArrayItem) - - if fistPair.Key == nil && fistPair.Val == nil && len(pairList.Items) == 1 { - pairList.Items = nil - } - - $$ = &ast.ExprArrayItem{ - Position: yylex.(*Parser).builder.NewTokensPosition($1, $4), - Val: &ast.ExprList{ - Position: yylex.(*Parser).builder.NewTokensPosition($1, $4), - ListTkn: $1, - OpenBracketTkn: $2, - Items: $3.(*ParserSeparatedList).Items, - SeparatorTkns: $3.(*ParserSeparatedList).SeparatorTkns, - CloseBracketTkn: $4, - }, - } - } - | /* empty */ - { - $$ = &ast.ExprArrayItem{} - } -; - - -array_pair_list: - /* empty */ - { - $$ = &ParserSeparatedList{} - } - | non_empty_array_pair_list possible_comma - { - if $2 != nil { - $1.(*ParserSeparatedList).SeparatorTkns = append($1.(*ParserSeparatedList).SeparatorTkns, $2) - $1.(*ParserSeparatedList).Items = append($1.(*ParserSeparatedList).Items, &ast.ExprArrayItem{}) - } - - $$ = $1 - } -; - -non_empty_array_pair_list: - non_empty_array_pair_list ',' expr T_DOUBLE_ARROW expr - { - arrayItem := &ast.ExprArrayItem{ - Position: yylex.(*Parser).builder.NewNodesPosition($3, $5), - Key: $3, - DoubleArrowTkn: $4, - Val: $5, - } - - $1.(*ParserSeparatedList).SeparatorTkns = append($1.(*ParserSeparatedList).SeparatorTkns, $2) - $1.(*ParserSeparatedList).Items = append($1.(*ParserSeparatedList).Items, arrayItem) - - $$ = $1 - } - | non_empty_array_pair_list ',' expr - { - arrayItem := &ast.ExprArrayItem{ - Position: yylex.(*Parser).builder.NewNodePosition($3), - Val: $3, - } - - $1.(*ParserSeparatedList).SeparatorTkns = append($1.(*ParserSeparatedList).SeparatorTkns, $2) - $1.(*ParserSeparatedList).Items = append($1.(*ParserSeparatedList).Items, arrayItem) - - $$ = $1 - } - | expr T_DOUBLE_ARROW expr - { - $$ = &ParserSeparatedList{ - Items: []ast.Vertex{ - &ast.ExprArrayItem{ - Position: yylex.(*Parser).builder.NewNodesPosition($1, $3), - Key: $1, - DoubleArrowTkn: $2, - Val: $3, - }, - }, - } - } - | expr - { - $$ = &ParserSeparatedList{ - Items: []ast.Vertex{ - &ast.ExprArrayItem{ - Position: yylex.(*Parser).builder.NewNodePosition($1), - Val: $1, - }, - }, - } - } - | non_empty_array_pair_list ',' expr T_DOUBLE_ARROW '&' w_variable - { - arrayItem := &ast.ExprArrayItem{ - Position: yylex.(*Parser).builder.NewNodesPosition($3, $6), - Key: $3, - DoubleArrowTkn: $4, - AmpersandTkn: $5, - Val: $6, - } - - $1.(*ParserSeparatedList).SeparatorTkns = append($1.(*ParserSeparatedList).SeparatorTkns, $2) - $1.(*ParserSeparatedList).Items = append($1.(*ParserSeparatedList).Items, arrayItem) - - $$ = $1 - } - | non_empty_array_pair_list ',' '&' w_variable - { - arrayItem := &ast.ExprArrayItem{ - Position: yylex.(*Parser).builder.NewTokenNodePosition($3, $4), - AmpersandTkn: $3, - Val: $4, - } - - $1.(*ParserSeparatedList).SeparatorTkns = append($1.(*ParserSeparatedList).SeparatorTkns, $2) - $1.(*ParserSeparatedList).Items = append($1.(*ParserSeparatedList).Items, arrayItem) - - $$ = $1 - } - | expr T_DOUBLE_ARROW '&' w_variable - { - $$ = &ParserSeparatedList{ - Items: []ast.Vertex{ - &ast.ExprArrayItem{ - Position: yylex.(*Parser).builder.NewNodesPosition($1, $4), - Key: $1, - DoubleArrowTkn: $2, - AmpersandTkn: $3, - Val: $4, - }, - }, - } - } - | '&' w_variable - { - $$ = &ParserSeparatedList{ - Items: []ast.Vertex{ - &ast.ExprArrayItem{ - Position: yylex.(*Parser).builder.NewTokenNodePosition($1, $2), - AmpersandTkn: $1, - Val: $2, - }, - }, - } - } -; - -encaps_list: - encaps_list encaps_var - { - $$ = append($1, $2) - } - | encaps_list T_ENCAPSED_AND_WHITESPACE - { - $$ = append( - $1, - &ast.ScalarEncapsedStringPart{ - Position: yylex.(*Parser).builder.NewTokenPosition($2), - EncapsedStrTkn: $2, - Value: $2.Value, - }, - ) - } - | encaps_var - { - $$ = []ast.Vertex{$1} - } - | T_ENCAPSED_AND_WHITESPACE encaps_var - { - $$ = []ast.Vertex{ - &ast.ScalarEncapsedStringPart{ - Position: yylex.(*Parser).builder.NewTokenPosition($1), - EncapsedStrTkn: $1, - Value: $1.Value, - }, - $2, - } - } -; - -encaps_var: - T_VARIABLE - { - $$ = &ast.ExprVariable{ - Position: yylex.(*Parser).builder.NewTokenPosition($1), - Name: &ast.Identifier{ - Position: yylex.(*Parser).builder.NewTokenPosition($1), - IdentifierTkn: $1, - Value: $1.Value, - }, - } - } - | T_VARIABLE '[' encaps_var_offset ']' - { - $$ = &ast.ExprArrayDimFetch{ - Position: yylex.(*Parser).builder.NewTokensPosition($1, $4), - Var: &ast.ExprVariable{ - Position: yylex.(*Parser).builder.NewTokenPosition($1), - Name: &ast.Identifier{ - Position: yylex.(*Parser).builder.NewTokenPosition($1), - IdentifierTkn: $1, - Value: $1.Value, - }, - }, - OpenBracketTkn: $2, - Dim: $3, - CloseBracketTkn: $4, - } - } - | T_VARIABLE T_OBJECT_OPERATOR T_STRING - { - $$ = &ast.ExprPropertyFetch{ - Position: yylex.(*Parser).builder.NewTokensPosition($1, $3), - Var: &ast.ExprVariable{ - Position: yylex.(*Parser).builder.NewTokenPosition($1), - Name: &ast.Identifier{ - Position: yylex.(*Parser).builder.NewTokenPosition($1), - IdentifierTkn: $1, - Value: $1.Value, - }, - }, - ObjectOperatorTkn: $2, - Prop: &ast.Identifier{ - Position: yylex.(*Parser).builder.NewTokenPosition($3), - IdentifierTkn: $3, - Value: $3.Value, - }, - } - } - | T_DOLLAR_OPEN_CURLY_BRACES expr '}' - { - $$ = &ast.ScalarEncapsedStringVar{ - Position: yylex.(*Parser).builder.NewTokensPosition($1, $3), - DollarOpenCurlyBracketTkn: $1, - Name: $2, - CloseCurlyBracketTkn: $3, - } - } - | T_DOLLAR_OPEN_CURLY_BRACES T_STRING_VARNAME '}' - { - $$ = &ast.ScalarEncapsedStringVar{ - Position: yylex.(*Parser).builder.NewTokensPosition($1, $3), - DollarOpenCurlyBracketTkn: $1, - Name: &ast.Identifier{ - Position: yylex.(*Parser).builder.NewTokenPosition($2), - IdentifierTkn: $2, - Value: $2.Value, - }, - CloseCurlyBracketTkn: $3, - } - } - | T_DOLLAR_OPEN_CURLY_BRACES T_STRING_VARNAME '[' expr ']' '}' - { - $$ = &ast.ScalarEncapsedStringVar{ - Position: yylex.(*Parser).builder.NewTokensPosition($1, $3), - DollarOpenCurlyBracketTkn: $1, - Name: &ast.Identifier{ - Position: yylex.(*Parser).builder.NewTokenPosition($2), - IdentifierTkn: $2, - Value: $2.Value, - }, - OpenSquareBracketTkn: $3, - Dim: $4, - CloseSquareBracketTkn: $5, - CloseCurlyBracketTkn: $6, - } - } - | T_CURLY_OPEN variable '}' - { - $$ = &ast.ScalarEncapsedStringBrackets{ - Position: yylex.(*Parser).builder.NewTokensPosition($1, $3), - OpenCurlyBracketTkn: $1, - Var: $2, - CloseCurlyBracketTkn: $3, - } - } -; - -encaps_var_offset: - T_STRING - { - $$ = &ast.ScalarString{ - Position: yylex.(*Parser).builder.NewTokenPosition($1), - StringTkn: $1, - Value: $1.Value, - } - } - | T_NUM_STRING - { - // TODO: add option to handle 64 bit integer - if _, err := strconv.Atoi(string($1.Value)); err == nil { - $$ = &ast.ScalarLnumber{ - Position: yylex.(*Parser).builder.NewTokenPosition($1), - NumberTkn: $1, - Value: $1.Value, - } - } else { - $$ = &ast.ScalarString{ - Position: yylex.(*Parser).builder.NewTokenPosition($1), - StringTkn: $1, - Value: $1.Value, - } - } - } - | T_VARIABLE - { - $$ = &ast.ExprVariable{ - Position: yylex.(*Parser).builder.NewTokenPosition($1), - Name: &ast.Identifier{ - Position: yylex.(*Parser).builder.NewTokenPosition($1), - IdentifierTkn: $1, - Value: $1.Value, - }, - } - } -; - -internal_functions_in_yacc: - T_ISSET '(' isset_variables ')' - { - $$ = &ast.ExprIsset{ - Position: yylex.(*Parser).builder.NewTokensPosition($1, $4), - IssetTkn: $1, - OpenParenthesisTkn: $2, - Vars: $3.(*ParserSeparatedList).Items, - SeparatorTkns: $3.(*ParserSeparatedList).SeparatorTkns, - CloseParenthesisTkn: $4, - } - } - | T_EMPTY '(' variable ')' - { - $$ = &ast.ExprEmpty{ - Position: yylex.(*Parser).builder.NewTokensPosition($1, $4), - EmptyTkn: $1, - OpenParenthesisTkn: $2, - Expr: $3, - CloseParenthesisTkn: $4, - } - } - | T_EMPTY '(' expr ')' - { - $$ = &ast.ExprEmpty{ - Position: yylex.(*Parser).builder.NewTokensPosition($1, $4), - EmptyTkn: $1, - OpenParenthesisTkn: $2, - Expr: $3, - CloseParenthesisTkn: $4, - } - } - | T_INCLUDE expr - { - $$ = &ast.ExprInclude{ - Position: yylex.(*Parser).builder.NewTokenNodePosition($1, $2), - IncludeTkn: $1, - Expr: $2, - } - } - | T_INCLUDE_ONCE expr - { - $$ = &ast.ExprIncludeOnce{ - Position: yylex.(*Parser).builder.NewTokenNodePosition($1, $2), - IncludeOnceTkn: $1, - Expr: $2, - } - } - | T_EVAL '(' expr ')' - { - $$ = &ast.ExprEval{ - Position: yylex.(*Parser).builder.NewTokensPosition($1, $4), - EvalTkn: $1, - OpenParenthesisTkn: $2, - Expr: $3, - CloseParenthesisTkn: $4, - } - } - | T_REQUIRE expr - { - $$ = &ast.ExprRequire{ - Position: yylex.(*Parser).builder.NewTokenNodePosition($1, $2), - RequireTkn: $1, - Expr: $2, - } - } - | T_REQUIRE_ONCE expr - { - $$ = &ast.ExprRequireOnce{ - Position: yylex.(*Parser).builder.NewTokenNodePosition($1, $2), - RequireOnceTkn: $1, - Expr: $2, - } - } -; - -isset_variables: - isset_variable - { - $$ = &ParserSeparatedList{ - Items: []ast.Vertex{$1}, - } - } - | isset_variables ',' isset_variable - { - $1.(*ParserSeparatedList).SeparatorTkns = append($1.(*ParserSeparatedList).SeparatorTkns, $2) - $1.(*ParserSeparatedList).Items = append($1.(*ParserSeparatedList).Items, $3) - - $$ = $1 - } -; - -isset_variable: - variable - { - $$ = $1 - } - | expr_without_variable - { - $$ = $1 - } -; - -class_constant: - class_name T_PAAMAYIM_NEKUDOTAYIM T_STRING - { - $$ = &ast.ExprClassConstFetch{ - Position: yylex.(*Parser).builder.NewNodeTokenPosition($1, $3), - Class: $1, - DoubleColonTkn: $2, - Const: &ast.Identifier{ - Position: yylex.(*Parser).builder.NewTokenPosition($3), - IdentifierTkn: $3, - Value: $3.Value, - }, - } - } - | variable_class_name T_PAAMAYIM_NEKUDOTAYIM T_STRING - { - $$ = &ast.ExprClassConstFetch{ - Position: yylex.(*Parser).builder.NewNodeTokenPosition($1, $3), - Class: $1, - DoubleColonTkn: $2, - Const: &ast.Identifier{ - Position: yylex.(*Parser).builder.NewTokenPosition($3), - IdentifierTkn: $3, - Value: $3.Value, - }, - } - } -; - -static_class_name_scalar: - class_name T_PAAMAYIM_NEKUDOTAYIM T_CLASS - { - $$ = &ast.ExprClassConstFetch{ - Position: yylex.(*Parser).builder.NewNodeTokenPosition($1, $3), - Class: $1, - DoubleColonTkn: $2, - Const: &ast.Identifier{ - Position: yylex.(*Parser).builder.NewTokenPosition($3), - IdentifierTkn: $3, - Value: $3.Value, - }, - } - } -; - -class_name_scalar: - class_name T_PAAMAYIM_NEKUDOTAYIM T_CLASS - { - $$ = &ast.ExprClassConstFetch{ - Position: yylex.(*Parser).builder.NewNodeTokenPosition($1, $3), - Class: $1, - DoubleColonTkn: $2, - Const: &ast.Identifier{ - Position: yylex.(*Parser).builder.NewTokenPosition($3), - IdentifierTkn: $3, - Value: $3.Value, - }, - } - } -; - -%% diff --git a/internal/php5/php5_bench_test.go b/internal/php5/php5_bench_test.go deleted file mode 100644 index 42b6917..0000000 --- a/internal/php5/php5_bench_test.go +++ /dev/null @@ -1,30 +0,0 @@ -package php5_test - -import ( - "io/ioutil" - "testing" - - "github.com/VKCOM/php-parser/internal/php5" - "github.com/VKCOM/php-parser/internal/scanner" - "github.com/VKCOM/php-parser/pkg/conf" - "github.com/VKCOM/php-parser/pkg/version" -) - -func BenchmarkPhp5(b *testing.B) { - src, err := ioutil.ReadFile("test.php") - if err != nil { - b.Fatal("can not read test.php: " + err.Error()) - } - - for n := 0; n < b.N; n++ { - config := conf.Config{ - Version: &version.Version{ - Major: 5, - Minor: 6, - }, - } - lexer := scanner.NewLexer(src, config) - php5parser := php5.NewParser(lexer, config) - php5parser.Parse() - } -} diff --git a/internal/php5/test.php b/internal/php5/test.php deleted file mode 100644 index c811eb1..0000000 --- a/internal/php5/test.php +++ /dev/null @@ -1,381 +0,0 @@ -bar($a, ...$b); -foo::bar($a, ...$b); -$foo::bar($a, ...$b); -new foo($a, ...$b); - -function foo(bar $bar=null, baz &...$baz) {} -class foo {public function foo(bar $bar=null, baz &...$baz) {}} -function(bar $bar=null, baz &...$baz) {}; -static function(bar $bar=null, baz &...$baz) {}; - -1234567890123456789; -12345678901234567890; -0.; -0b0111111111111111111111111111111111111111111111111111111111111111; -0b1111111111111111111111111111111111111111111111111111111111111111; -0x007111111111111111; -0x8111111111111111; -__CLASS__; -__DIR__; -__FILE__; -__FUNCTION__; -__LINE__; -__NAMESPACE__; -__METHOD__; -__TRAIT__; - -"test $var"; -"test $var[1]"; -"test $var[1234567890123456789012345678901234567890]"; -"test $var[bar]"; -"test $var[$bar]"; -"$foo $bar"; -"test $foo->bar()"; -"test ${foo}"; -"test ${foo[0]}"; -"test {$foo->bar()}"; - -if ($a) : -endif; -if ($a) : -elseif ($b): -endif; -if ($a) : -else: -endif; -if ($a) : -elseif ($b): -elseif ($c): -else: -endif; - -while (1) { break; } -while (1) { break 2; } -while (1) : break(3); endwhile; -class foo{ const FOO = 1, BAR = 2; } -class foo{ function bar() {} } -class foo{ public static function &bar() {} } -class foo{ final private function bar() {} protected function baz() {} } -abstract class foo{ abstract public function bar(); } -final class foo extends bar { } -final class foo implements bar { } -final class foo implements bar, baz { } - -const FOO = 1, BAR = 2; -while (1) { continue; } -while (1) { continue 2; } -while (1) { continue(3); } -declare(ticks=1); -declare(ticks=1, strict_types=1) {} -declare(ticks=1): enddeclare; -do {} while(1); -echo $a, 1; -echo($a); -for($i = 0; $i < 10; $i++, $i++) {} -for(; $i < 10; $i++) : endfor; -foreach ($a as $v) {} -foreach ([] as $v) {} -foreach ($a as $v) : endforeach; -foreach ($a as $k => $v) {} -foreach ([] as $k => $v) {} -foreach ($a as $k => &$v) {} -foreach ($a as $k => list($v)) {} -function foo() {} - -function foo() { - function bar() {} - class Baz {} - return $a; -} - -function foo(array $a, callable $b) {return;} -function &foo() {return 1;} -function &foo() {} -global $a, $b, $$c, ${foo()}; -a: -goto a; -if ($a) {} -if ($a) {} elseif ($b) {} -if ($a) {} else {} -if ($a) {} elseif ($b) {} elseif ($c) {} else {} -if ($a) {} elseif ($b) {} else if ($c) {} else {} -?>
1, &$b,); -array(3 =>&$b); -array(&$b, 1=>1, 1, 3 =>&$b); -~$a; -!$a; - -Foo::Bar; -clone($a); -clone $a; -function(){}; -function($a, $b) use ($c, &$d) {}; -function($a, $b) use (&$c, $d) {}; -function() {}; -foo; -namespace\foo; -\foo; - -empty($a); -empty(Foo); -@$a; -eval($a); -exit; -exit($a); -die(); -die($a); -foo(); -namespace\foo(&$a); -\foo([]); -$foo(yield $a); - -$a--; -$a++; ---$a; -++$a; - -include $a; -include_once $a; -require $a; -require_once $a; - -$a instanceof Foo; -$a instanceof namespace\Foo; -$a instanceof \Foo; - -isset($a, $b); -isset(Foo); -list() = $b; -list($a, $b) = $b; -list($a[]) = $b; -list(list($a)) = $b; - -$a->foo(); -new Foo; -new namespace\Foo(); -new \Foo(); -print($a); -$a->foo; -$a->foo[1]; -$a->foo->bar->baz()->quux[0]; -$a->foo()[1][1]; -`cmd $a`; -`cmd`; -``; -[]; -[1]; -[1=>1, &$b,]; - -Foo::bar(); -namespace\Foo::bar(); -\Foo::bar(); -Foo::$bar(); -$foo::$bar(); -Foo::$bar; -namespace\Foo::$bar; -\Foo::$bar; -$a ? $b : $c; -$a ? : $c; -$a ? $b ? $c : $d : $e; -$a ? $b : $c ? $d : $e; --$a; -+$a; -$$a; -$$$a; -yield; -yield $a; -yield $a => $b; -yield Foo::class; -yield $a => Foo::class; - -(array)$a; -(boolean)$a; -(bool)$a; -(double)$a; -(float)$a; -(integer)$a; -(int)$a; -(object)$a; -(string)$a; -(unset)$a; - -$a & $b; -$a | $b; -$a ^ $b; -$a && $b; -$a || $b; -$a . $b; -$a / $b; -$a == $b; -$a >= $b; -$a > $b; -$a === $b; -$a and $b; -$a or $b; -$a xor $b; -$a - $b; -$a % $b; -$a * $b; -$a != $b; -$a !== $b; -$a + $b; -$a ** $b; -$a << $b; -$a >> $b; -$a <= $b; -$a < $b; - -$a =& $b; -$a =& new Foo; -$a =& new Foo($b); -$a = $b; -$a &= $b; -$a |= $b; -$a ^= $b; -$a .= $b; -$a /= $b; -$a -= $b; -$a %= $b; -$a *= $b; -$a += $b; -$a **= $b; -$a <<= $b; -$a >>= $b; - - -(new \Foo()); -(new \Foo())->bar()->baz; -(new \Foo())[0][0]; -(new \Foo())[0]->bar(); - -array([0])[0][0]; -"foo"[0]; -foo[0]; -static::foo; - -new $foo; -new $foo::$bar; -new $a->b[0]; -new $a->b{$b ?: null}->$c->d[0];static $a = [1][0]; - -static $a = !1; -static $a = ~1; -static $a = +1; -static $a = -1; -static $a = (1); -static $a = 1 ?: 2; -static $a = 1 ? 2 : 3; -static $a = 1 & 2; -static $a = 1 | 2; -static $a = 1 ^ 2; -static $a = 1 && 2; -static $a = 1 || 2; -static $a = 1 . 2; -static $a = 1 / 2; -static $a = 1 == 2; -static $a = 1 >= 2; -static $a = 1 > 2; -static $a = 1 === 2; -static $a = 1 and 2; -static $a = 1 or 2; -static $a = 1 xor 2; -static $a = 1 - 2; -static $a = 1 % 2; -static $a = 1 * 2; -static $a = 1 != 2; -static $a = 1 !== 2; -static $a = 1 + 2; -static $a = 1 ** 2; -static $a = 1 << 2; -static $a = 1 >> 2; -static $a = 1 <= 2; -static $a = 1 < 2; -static $a = Foo::bar; -static $a = Foo::class; -static $a = __CLASS__; -static $a = Foo; -static $a = namespace\Foo; -static $a = \Foo; -static $a = array(); -static $a = array(1 => 1, 2); -static $a = [1, 2 => 2][0]; - -if (yield 1) {} -Foo::$$bar; - -$foo(); -$foo()[0][0]; -$a{$b}; -${$a}; -$foo::{$bar}(); -$foo::bar; - -__halt_compiler(); - -parsing process must be terminated \ No newline at end of file diff --git a/pkg/parser/parser.go b/pkg/parser/parser.go index 0000eab..5f09633 100644 --- a/pkg/parser/parser.go +++ b/pkg/parser/parser.go @@ -3,10 +3,8 @@ package parser import ( "errors" - "github.com/VKCOM/php-parser/internal/php5" "github.com/VKCOM/php-parser/internal/php7" "github.com/VKCOM/php-parser/internal/php8" - "github.com/VKCOM/php-parser/internal/scanner" "github.com/VKCOM/php-parser/pkg/ast" "github.com/VKCOM/php-parser/pkg/conf" "github.com/VKCOM/php-parser/pkg/version" @@ -16,9 +14,6 @@ var ( // ErrVersionOutOfRange is returned if the version is not supported ErrVersionOutOfRange = errors.New("the version is out of supported range") - php5RangeStart = &version.Version{Major: 5} - php5RangeEnd = &version.Version{Major: 5, Minor: 6} - php7RangeStart = &version.Version{Major: 7} php7RangeEnd = &version.Version{Major: 7, Minor: 4} @@ -39,15 +34,8 @@ func Parse(src []byte, config conf.Config) (ast.Vertex, error) { config.Version = php7RangeEnd } - if config.Version.InRange(php5RangeStart, php5RangeEnd) { - lexer := scanner.NewLexer(src, config) - parser = php5.NewParser(lexer, config) - parser.Parse() - return parser.GetRootNode(), nil - } - if config.Version.InRange(php7RangeStart, php7RangeEnd) { - lexer := scanner.NewLexer(src, config) + lexer := php7.NewLexer(src, config) parser = php7.NewParser(lexer, config) parser.Parse() return parser.GetRootNode(), nil diff --git a/pkg/visitor/printer/printer_php5_test.go b/pkg/visitor/printer/printer_php5_test.go deleted file mode 100644 index 7fffe23..0000000 --- a/pkg/visitor/printer/printer_php5_test.go +++ /dev/null @@ -1,1439 +0,0 @@ -package printer_test - -import ( - "bytes" - "testing" - - "github.com/VKCOM/php-parser/internal/php5" - "github.com/VKCOM/php-parser/internal/scanner" - "github.com/VKCOM/php-parser/pkg/ast" - "github.com/VKCOM/php-parser/pkg/conf" - "github.com/VKCOM/php-parser/pkg/version" - "github.com/VKCOM/php-parser/pkg/visitor/printer" -) - -func parsePhp5(src string) ast.Vertex { - config := conf.Config{ - Version: &version.Version{ - Major: 5, - Minor: 6, - }, - } - lexer := scanner.NewLexer([]byte(src), config) - php5parser := php5.NewParser(lexer, config) - php5parser.Parse() - - return php5parser.GetRootNode() -} - -func printPhp5(n ast.Vertex) string { - o := bytes.NewBufferString("") - - p := printer.NewPrinter(o) - n.Accept(p) - - return o.String() -} - -// test node - -func TestParseAndPrintPhp5Root(t *testing.T) { - - src := `
Hello
- >= $b ; - ` - - actual := printPhp5(parsePhp5(src)) - - if src != actual { - t.Errorf("\nexpected: %s\ngot: %s\n", src, actual) - } -} - -// test binary - -func TestParseAndPrintPhp5Binary(t *testing.T) { - src := `= $b ; - $a > $b ; - $a === $b ; - $a and $b ; - $a or $b ; - $a xor $b ; - $a - $b ; - $a % $b ; - $a * $b ; - $a != $b ; - $a <> $b ; - $a !== $b ; - $a + $b ; - $a ** $b ; - $a << $b ; - $a >> $b ; - $a <= $b ; - $a < $b ; - ` - - actual := printPhp5(parsePhp5(src)) - - if src != actual { - t.Errorf("\nexpected: %s\ngot: %s\n", src, actual) - } -} - -// test cast - -func TestParseAndPrintPhp5Cast(t *testing.T) { - src := ` $world , - ] ; - ` - - actual := printPhp5(parsePhp5(src)) - - if src != actual { - t.Errorf("\nexpected: %s\ngot: %s\n", src, actual) - } -} - -func TestParseAndPrintPhp5Array(t *testing.T) { - src := ` 2 ) ; - ` - - actual := printPhp5(parsePhp5(src)) - - if src != actual { - t.Errorf("\nexpected: %s\ngot: %s\n", src, actual) - } -} - -func TestParseAndPrintPhp5BitwiseNot(t *testing.T) { - src := ` bar ( $arg ) ;` - - actual := printPhp5(parsePhp5(src)) - - if src != actual { - t.Errorf("\nexpected: %s\ngot: %s\n", src, actual) - } -} - -func TestParseAndPrintPhp5New(t *testing.T) { - src := ` b ;` - - actual := printPhp5(parsePhp5(src)) - - if src != actual { - t.Errorf("\nexpected: %s\ngot: %s\n", src, actual) - } -} - -func TestParseAndPrintPhp5Reference(t *testing.T) { - src := ` & $c ] ; - - $a = function ( ) use ( & $b ) { - // do nothing - } ; - - foreach ( $a as & $b ) { - // do nothing - }` - - actual := printPhp5(parsePhp5(src)) - - if src != actual { - t.Errorf("\nexpected: %s\ngot: %s\n", src, actual) - } -} - -func TestParseAndPrintPhp5Require(t *testing.T) { - - src := ` & $b , // one - $c , /* two */ - ] ; - $a = [0, 1, 2] ;` - - actual := printPhp5(parsePhp5(src)) - - if src != actual { - t.Errorf("\nexpected: %s\ngot: %s\n", src, actual) - } -} - -func TestParseAndPrintPhp5StaticCall(t *testing.T) { - src := ` $v ;` - - actual := printPhp5(parsePhp5(src)) - - if src != actual { - t.Errorf("\nexpected: %s\ngot: %s\n", src, actual) - } -} - -// test stmt - -func TestParseAndPrintPhp5AltIf(t *testing.T) { - src := ` & $v ) : - echo $v ; - endforeach ;` - - actual := printPhp5(parsePhp5(src)) - - if src != actual { - t.Errorf("\nexpected: %s\ngot: %s\n", src, actual) - } -} - -func TestParseAndPrintPhp5AltSwitch(t *testing.T) { - src := ` - - - & $v ) { - ; - }` - - actual := printPhp5(parsePhp5(src)) - - if src != actual { - t.Errorf("\nexpected: %s\ngot: %s\n", src, actual) - } -} - -func TestParseAndPrintPhp5Function(t *testing.T) { - - src := `testtest call ( ) ; - $a -> { $b . 'b' } ; - $a -> $b ( ) -> { $c . 'c' } ; - ` - - actual := printPhp5(parsePhp5(src)) - - if src != actual { - t.Errorf("\nexpected: %s\ngot: %s\n", src, actual) - } -} - -func TestParseAndPrintPhp5ComplexString1(t *testing.T) { - src := `bar" ; - ` - - actual := printPhp5(parsePhp5(src)) - - if src != actual { - t.Errorf("\nexpected: %s\ngot: %s\n", src, actual) - } -} - -func TestParseAndPrintPhp5ComplexString2(t *testing.T) { - src := ` bar }" ; - "test ${ $foo -> bar ( ) }" ; - "test ${ $a . '' }" ; - ` - - actual := printPhp5(parsePhp5(src)) - - if src != actual { - t.Errorf("\nexpected: %s\ngot: %s\n", src, actual) - } -} - -func TestParseAndPrintPhp5ComplexString3(t *testing.T) { - src := ` bar }" ; - "test ${$foo -> bar ( ) }" ; - "test ${$a . '' }" ; - ` - - actual := printPhp5(parsePhp5(src)) - - if src != actual { - t.Errorf("\nexpected: %s\ngot: %s\n", src, actual) - } -} - -func TestParseAndPrintPhp5ComplexString4(t *testing.T) { - src := ` bar }" ; - "test {$foo -> bar ( ) }" ; - ` - - actual := printPhp5(parsePhp5(src)) - - if src != actual { - t.Errorf("\nexpected: %s\ngot: %s\n", src, actual) - } -}