diff --git a/internal/php5/parser_test.go b/internal/php5/parser_test.go index bc6d43c..6ab5b7a 100644 --- a/internal/php5/parser_test.go +++ b/internal/php5/parser_test.go @@ -11677,17 +11677,17 @@ func TestStmtUse(t *testing.T) { EndPos: 11, }, }, - UseList: &ast.StmtUseList{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 7, - EndPos: 10, + UseDeclarations: []ast.Vertex{ + &ast.StmtUseDeclaration{ + Node: ast.Node{ + Position: &position.Position{ + StartLine: 1, + EndLine: 1, + StartPos: 7, + EndPos: 10, + }, }, - }, - UseDeclarations: []ast.Vertex{ - &ast.StmtUseDeclaration{ + Use: &ast.NameName{ Node: ast.Node{ Position: &position.Position{ StartLine: 1, @@ -11696,27 +11696,17 @@ func TestStmtUse(t *testing.T) { EndPos: 10, }, }, - Use: &ast.NameName{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 7, - EndPos: 10, - }, - }, - Parts: []ast.Vertex{ - &ast.NameNamePart{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 7, - EndPos: 10, - }, + Parts: []ast.Vertex{ + &ast.NameNamePart{ + Node: ast.Node{ + Position: &position.Position{ + StartLine: 1, + EndLine: 1, + StartPos: 7, + EndPos: 10, }, - Value: []byte("Foo"), }, + Value: []byte("Foo"), }, }, }, @@ -11757,46 +11747,36 @@ func TestStmtUse_FullyQualified(t *testing.T) { EndPos: 12, }, }, - UseList: &ast.StmtUseList{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 7, - EndPos: 11, + UseDeclarations: []ast.Vertex{ + &ast.StmtUseDeclaration{ + Node: ast.Node{ + Position: &position.Position{ + StartLine: 1, + EndLine: 1, + StartPos: 7, + EndPos: 11, + }, }, - }, - UseDeclarations: []ast.Vertex{ - &ast.StmtUseDeclaration{ + Use: &ast.NameName{ Node: ast.Node{ Position: &position.Position{ StartLine: 1, EndLine: 1, - StartPos: 7, + StartPos: 8, EndPos: 11, }, }, - Use: &ast.NameName{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 8, - EndPos: 11, - }, - }, - Parts: []ast.Vertex{ - &ast.NameNamePart{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 8, - EndPos: 11, - }, + Parts: []ast.Vertex{ + &ast.NameNamePart{ + Node: ast.Node{ + Position: &position.Position{ + StartLine: 1, + EndLine: 1, + StartPos: 8, + EndPos: 11, }, - Value: []byte("Foo"), }, + Value: []byte("Foo"), }, }, }, @@ -11837,59 +11817,49 @@ func TestStmtUse_FullyQualifiedAlias(t *testing.T) { EndPos: 19, }, }, - UseList: &ast.StmtUseList{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 7, - EndPos: 18, + UseDeclarations: []ast.Vertex{ + &ast.StmtUseDeclaration{ + Node: ast.Node{ + Position: &position.Position{ + StartLine: 1, + EndLine: 1, + StartPos: 7, + EndPos: 18, + }, }, - }, - UseDeclarations: []ast.Vertex{ - &ast.StmtUseDeclaration{ + Use: &ast.NameName{ Node: ast.Node{ Position: &position.Position{ StartLine: 1, EndLine: 1, - StartPos: 7, + StartPos: 8, + EndPos: 11, + }, + }, + Parts: []ast.Vertex{ + &ast.NameNamePart{ + Node: ast.Node{ + Position: &position.Position{ + StartLine: 1, + EndLine: 1, + StartPos: 8, + EndPos: 11, + }, + }, + Value: []byte("Foo"), + }, + }, + }, + Alias: &ast.Identifier{ + Node: ast.Node{ + Position: &position.Position{ + StartLine: 1, + EndLine: 1, + StartPos: 15, EndPos: 18, }, }, - Use: &ast.NameName{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 8, - EndPos: 11, - }, - }, - Parts: []ast.Vertex{ - &ast.NameNamePart{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 8, - EndPos: 11, - }, - }, - Value: []byte("Foo"), - }, - }, - }, - Alias: &ast.Identifier{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 15, - EndPos: 18, - }, - }, - Value: []byte("Bar"), - }, + Value: []byte("Bar"), }, }, }, @@ -11928,17 +11898,17 @@ func TestStmtUse_List(t *testing.T) { EndPos: 16, }, }, - UseList: &ast.StmtUseList{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 7, - EndPos: 15, + UseDeclarations: []ast.Vertex{ + &ast.StmtUseDeclaration{ + Node: ast.Node{ + Position: &position.Position{ + StartLine: 1, + EndLine: 1, + StartPos: 7, + EndPos: 10, + }, }, - }, - UseDeclarations: []ast.Vertex{ - &ast.StmtUseDeclaration{ + Use: &ast.NameName{ Node: ast.Node{ Position: &position.Position{ StartLine: 1, @@ -11947,31 +11917,31 @@ func TestStmtUse_List(t *testing.T) { EndPos: 10, }, }, - Use: &ast.NameName{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 7, - EndPos: 10, - }, - }, - Parts: []ast.Vertex{ - &ast.NameNamePart{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 7, - EndPos: 10, - }, + Parts: []ast.Vertex{ + &ast.NameNamePart{ + Node: ast.Node{ + Position: &position.Position{ + StartLine: 1, + EndLine: 1, + StartPos: 7, + EndPos: 10, }, - Value: []byte("Foo"), }, + Value: []byte("Foo"), }, }, }, - &ast.StmtUseDeclaration{ + }, + &ast.StmtUseDeclaration{ + Node: ast.Node{ + Position: &position.Position{ + StartLine: 1, + EndLine: 1, + StartPos: 12, + EndPos: 15, + }, + }, + Use: &ast.NameName{ Node: ast.Node{ Position: &position.Position{ StartLine: 1, @@ -11980,27 +11950,17 @@ func TestStmtUse_List(t *testing.T) { EndPos: 15, }, }, - Use: &ast.NameName{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 12, - EndPos: 15, - }, - }, - Parts: []ast.Vertex{ - &ast.NameNamePart{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 12, - EndPos: 15, - }, + Parts: []ast.Vertex{ + &ast.NameNamePart{ + Node: ast.Node{ + Position: &position.Position{ + StartLine: 1, + EndLine: 1, + StartPos: 12, + EndPos: 15, }, - Value: []byte("Bar"), }, + Value: []byte("Bar"), }, }, }, @@ -12041,17 +12001,17 @@ func TestStmtUse_ListAlias(t *testing.T) { EndPos: 23, }, }, - UseList: &ast.StmtUseList{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 7, - EndPos: 22, + UseDeclarations: []ast.Vertex{ + &ast.StmtUseDeclaration{ + Node: ast.Node{ + Position: &position.Position{ + StartLine: 1, + EndLine: 1, + StartPos: 7, + EndPos: 10, + }, }, - }, - UseDeclarations: []ast.Vertex{ - &ast.StmtUseDeclaration{ + Use: &ast.NameName{ Node: ast.Node{ Position: &position.Position{ StartLine: 1, @@ -12060,73 +12020,63 @@ func TestStmtUse_ListAlias(t *testing.T) { EndPos: 10, }, }, - Use: &ast.NameName{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 7, - EndPos: 10, - }, - }, - Parts: []ast.Vertex{ - &ast.NameNamePart{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 7, - EndPos: 10, - }, + Parts: []ast.Vertex{ + &ast.NameNamePart{ + Node: ast.Node{ + Position: &position.Position{ + StartLine: 1, + EndLine: 1, + StartPos: 7, + EndPos: 10, }, - Value: []byte("Foo"), }, + Value: []byte("Foo"), }, }, }, - &ast.StmtUseDeclaration{ + }, + &ast.StmtUseDeclaration{ + Node: ast.Node{ + Position: &position.Position{ + StartLine: 1, + EndLine: 1, + StartPos: 12, + EndPos: 22, + }, + }, + Use: &ast.NameName{ Node: ast.Node{ Position: &position.Position{ StartLine: 1, EndLine: 1, StartPos: 12, + EndPos: 15, + }, + }, + Parts: []ast.Vertex{ + &ast.NameNamePart{ + Node: ast.Node{ + Position: &position.Position{ + StartLine: 1, + EndLine: 1, + StartPos: 12, + EndPos: 15, + }, + }, + Value: []byte("Bar"), + }, + }, + }, + Alias: &ast.Identifier{ + Node: ast.Node{ + Position: &position.Position{ + StartLine: 1, + EndLine: 1, + StartPos: 19, EndPos: 22, }, }, - Use: &ast.NameName{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 12, - EndPos: 15, - }, - }, - Parts: []ast.Vertex{ - &ast.NameNamePart{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 12, - EndPos: 15, - }, - }, - Value: []byte("Bar"), - }, - }, - }, - Alias: &ast.Identifier{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 19, - EndPos: 22, - }, - }, - Value: []byte("Baz"), - }, + Value: []byte("Baz"), }, }, }, @@ -12165,46 +12115,38 @@ func TestStmtUse_ListFunctionType(t *testing.T) { EndPos: 26, }, }, - UseList: &ast.StmtUseType{ + Type: &ast.Identifier{ Node: ast.Node{ Position: &position.Position{ StartLine: 1, EndLine: 1, StartPos: 7, - EndPos: 25, + EndPos: 15, }, }, - Type: &ast.Identifier{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 7, - EndPos: 15, - }, - }, - Value: []byte("function"), - }, - Use: &ast.StmtUseList{ + Value: []byte("function"), + }, + UseDeclarations: []ast.Vertex{ + &ast.StmtUseDeclaration{ Node: ast.Node{ Position: &position.Position{ StartLine: 1, EndLine: 1, StartPos: 16, - EndPos: 25, + EndPos: 19, }, }, - UseDeclarations: []ast.Vertex{ - &ast.StmtUseDeclaration{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 16, - EndPos: 19, - }, + Use: &ast.NameName{ + Node: ast.Node{ + Position: &position.Position{ + StartLine: 1, + EndLine: 1, + StartPos: 16, + EndPos: 19, }, - Use: &ast.NameName{ + }, + Parts: []ast.Vertex{ + &ast.NameNamePart{ Node: ast.Node{ Position: &position.Position{ StartLine: 1, @@ -12213,31 +12155,31 @@ func TestStmtUse_ListFunctionType(t *testing.T) { EndPos: 19, }, }, - Parts: []ast.Vertex{ - &ast.NameNamePart{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 16, - EndPos: 19, - }, - }, - Value: []byte("Foo"), - }, - }, + Value: []byte("Foo"), }, }, - &ast.StmtUseDeclaration{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 21, - EndPos: 25, - }, + }, + }, + &ast.StmtUseDeclaration{ + Node: ast.Node{ + Position: &position.Position{ + StartLine: 1, + EndLine: 1, + StartPos: 21, + EndPos: 25, + }, + }, + Use: &ast.NameName{ + Node: ast.Node{ + Position: &position.Position{ + StartLine: 1, + EndLine: 1, + StartPos: 22, + EndPos: 25, }, - Use: &ast.NameName{ + }, + Parts: []ast.Vertex{ + &ast.NameNamePart{ Node: ast.Node{ Position: &position.Position{ StartLine: 1, @@ -12246,19 +12188,7 @@ func TestStmtUse_ListFunctionType(t *testing.T) { EndPos: 25, }, }, - Parts: []ast.Vertex{ - &ast.NameNamePart{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 22, - EndPos: 25, - }, - }, - Value: []byte("Bar"), - }, - }, + Value: []byte("Bar"), }, }, }, @@ -12299,46 +12229,38 @@ func TestStmtUse_ListFunctionTypeAliases(t *testing.T) { EndPos: 40, }, }, - UseList: &ast.StmtUseType{ + Type: &ast.Identifier{ Node: ast.Node{ Position: &position.Position{ StartLine: 1, EndLine: 1, StartPos: 7, - EndPos: 39, + EndPos: 15, }, }, - Type: &ast.Identifier{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 7, - EndPos: 15, - }, - }, - Value: []byte("function"), - }, - Use: &ast.StmtUseList{ + Value: []byte("function"), + }, + UseDeclarations: []ast.Vertex{ + &ast.StmtUseDeclaration{ Node: ast.Node{ Position: &position.Position{ StartLine: 1, EndLine: 1, StartPos: 16, - EndPos: 39, + EndPos: 26, }, }, - UseDeclarations: []ast.Vertex{ - &ast.StmtUseDeclaration{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 16, - EndPos: 26, - }, + Use: &ast.NameName{ + Node: ast.Node{ + Position: &position.Position{ + StartLine: 1, + EndLine: 1, + StartPos: 16, + EndPos: 19, }, - Use: &ast.NameName{ + }, + Parts: []ast.Vertex{ + &ast.NameNamePart{ Node: ast.Node{ Position: &position.Position{ StartLine: 1, @@ -12347,42 +12269,42 @@ func TestStmtUse_ListFunctionTypeAliases(t *testing.T) { EndPos: 19, }, }, - Parts: []ast.Vertex{ - &ast.NameNamePart{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 16, - EndPos: 19, - }, - }, - Value: []byte("Foo"), - }, - }, - }, - Alias: &ast.Identifier{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 23, - EndPos: 26, - }, - }, - Value: []byte("foo"), + Value: []byte("Foo"), }, }, - &ast.StmtUseDeclaration{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 28, - EndPos: 39, - }, + }, + Alias: &ast.Identifier{ + Node: ast.Node{ + Position: &position.Position{ + StartLine: 1, + EndLine: 1, + StartPos: 23, + EndPos: 26, }, - Use: &ast.NameName{ + }, + Value: []byte("foo"), + }, + }, + &ast.StmtUseDeclaration{ + Node: ast.Node{ + Position: &position.Position{ + StartLine: 1, + EndLine: 1, + StartPos: 28, + EndPos: 39, + }, + }, + Use: &ast.NameName{ + Node: ast.Node{ + Position: &position.Position{ + StartLine: 1, + EndLine: 1, + StartPos: 29, + EndPos: 32, + }, + }, + Parts: []ast.Vertex{ + &ast.NameNamePart{ Node: ast.Node{ Position: &position.Position{ StartLine: 1, @@ -12391,33 +12313,21 @@ func TestStmtUse_ListFunctionTypeAliases(t *testing.T) { EndPos: 32, }, }, - Parts: []ast.Vertex{ - &ast.NameNamePart{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 29, - EndPos: 32, - }, - }, - Value: []byte("Bar"), - }, - }, - }, - Alias: &ast.Identifier{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 36, - EndPos: 39, - }, - }, - Value: []byte("bar"), + Value: []byte("Bar"), }, }, }, + Alias: &ast.Identifier{ + Node: ast.Node{ + Position: &position.Position{ + StartLine: 1, + EndLine: 1, + StartPos: 36, + EndPos: 39, + }, + }, + Value: []byte("bar"), + }, }, }, }, @@ -12455,47 +12365,38 @@ func TestStmtUse_ListConstType(t *testing.T) { EndPos: 23, }, }, - - UseList: &ast.StmtUseType{ + Type: &ast.Identifier{ Node: ast.Node{ Position: &position.Position{ StartLine: 1, EndLine: 1, StartPos: 7, - EndPos: 22, + EndPos: 12, }, }, - Type: &ast.Identifier{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 7, - EndPos: 12, - }, - }, - Value: []byte("const"), - }, - Use: &ast.StmtUseList{ + Value: []byte("const"), + }, + UseDeclarations: []ast.Vertex{ + &ast.StmtUseDeclaration{ Node: ast.Node{ Position: &position.Position{ StartLine: 1, EndLine: 1, StartPos: 13, - EndPos: 22, + EndPos: 16, }, }, - UseDeclarations: []ast.Vertex{ - &ast.StmtUseDeclaration{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 13, - EndPos: 16, - }, + Use: &ast.NameName{ + Node: ast.Node{ + Position: &position.Position{ + StartLine: 1, + EndLine: 1, + StartPos: 13, + EndPos: 16, }, - Use: &ast.NameName{ + }, + Parts: []ast.Vertex{ + &ast.NameNamePart{ Node: ast.Node{ Position: &position.Position{ StartLine: 1, @@ -12504,31 +12405,31 @@ func TestStmtUse_ListConstType(t *testing.T) { EndPos: 16, }, }, - Parts: []ast.Vertex{ - &ast.NameNamePart{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 13, - EndPos: 16, - }, - }, - Value: []byte("Foo"), - }, - }, + Value: []byte("Foo"), }, }, - &ast.StmtUseDeclaration{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 18, - EndPos: 22, - }, + }, + }, + &ast.StmtUseDeclaration{ + Node: ast.Node{ + Position: &position.Position{ + StartLine: 1, + EndLine: 1, + StartPos: 18, + EndPos: 22, + }, + }, + Use: &ast.NameName{ + Node: ast.Node{ + Position: &position.Position{ + StartLine: 1, + EndLine: 1, + StartPos: 19, + EndPos: 22, }, - Use: &ast.NameName{ + }, + Parts: []ast.Vertex{ + &ast.NameNamePart{ Node: ast.Node{ Position: &position.Position{ StartLine: 1, @@ -12537,19 +12438,7 @@ func TestStmtUse_ListConstType(t *testing.T) { EndPos: 22, }, }, - Parts: []ast.Vertex{ - &ast.NameNamePart{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 19, - EndPos: 22, - }, - }, - Value: []byte("Bar"), - }, - }, + Value: []byte("Bar"), }, }, }, @@ -12590,46 +12479,38 @@ func TestStmtUse_ListConstTypeAliases(t *testing.T) { EndPos: 37, }, }, - UseList: &ast.StmtUseType{ + Type: &ast.Identifier{ Node: ast.Node{ Position: &position.Position{ StartLine: 1, EndLine: 1, StartPos: 7, - EndPos: 36, + EndPos: 12, }, }, - Type: &ast.Identifier{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 7, - EndPos: 12, - }, - }, - Value: []byte("const"), - }, - Use: &ast.StmtUseList{ + Value: []byte("const"), + }, + UseDeclarations: []ast.Vertex{ + &ast.StmtUseDeclaration{ Node: ast.Node{ Position: &position.Position{ StartLine: 1, EndLine: 1, StartPos: 13, - EndPos: 36, + EndPos: 23, }, }, - UseDeclarations: []ast.Vertex{ - &ast.StmtUseDeclaration{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 13, - EndPos: 23, - }, + Use: &ast.NameName{ + Node: ast.Node{ + Position: &position.Position{ + StartLine: 1, + EndLine: 1, + StartPos: 13, + EndPos: 16, }, - Use: &ast.NameName{ + }, + Parts: []ast.Vertex{ + &ast.NameNamePart{ Node: ast.Node{ Position: &position.Position{ StartLine: 1, @@ -12638,42 +12519,42 @@ func TestStmtUse_ListConstTypeAliases(t *testing.T) { EndPos: 16, }, }, - Parts: []ast.Vertex{ - &ast.NameNamePart{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 13, - EndPos: 16, - }, - }, - Value: []byte("Foo"), - }, - }, - }, - Alias: &ast.Identifier{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 20, - EndPos: 23, - }, - }, - Value: []byte("foo"), + Value: []byte("Foo"), }, }, - &ast.StmtUseDeclaration{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 25, - EndPos: 36, - }, + }, + Alias: &ast.Identifier{ + Node: ast.Node{ + Position: &position.Position{ + StartLine: 1, + EndLine: 1, + StartPos: 20, + EndPos: 23, }, - Use: &ast.NameName{ + }, + Value: []byte("foo"), + }, + }, + &ast.StmtUseDeclaration{ + Node: ast.Node{ + Position: &position.Position{ + StartLine: 1, + EndLine: 1, + StartPos: 25, + EndPos: 36, + }, + }, + Use: &ast.NameName{ + Node: ast.Node{ + Position: &position.Position{ + StartLine: 1, + EndLine: 1, + StartPos: 26, + EndPos: 29, + }, + }, + Parts: []ast.Vertex{ + &ast.NameNamePart{ Node: ast.Node{ Position: &position.Position{ StartLine: 1, @@ -12682,33 +12563,21 @@ func TestStmtUse_ListConstTypeAliases(t *testing.T) { EndPos: 29, }, }, - Parts: []ast.Vertex{ - &ast.NameNamePart{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 26, - EndPos: 29, - }, - }, - Value: []byte("Bar"), - }, - }, - }, - Alias: &ast.Identifier{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 33, - EndPos: 36, - }, - }, - Value: []byte("bar"), + Value: []byte("Bar"), }, }, }, + Alias: &ast.Identifier{ + Node: ast.Node{ + Position: &position.Position{ + StartLine: 1, + EndLine: 1, + StartPos: 33, + EndPos: 36, + }, + }, + Value: []byte("bar"), + }, }, }, }, diff --git a/internal/php5/php5.go b/internal/php5/php5.go index f05d452..a1be3c0 100644 --- a/internal/php5/php5.go +++ b/internal/php5/php5.go @@ -346,7 +346,7 @@ const yyEofCode = 1 const yyErrCode = 2 const yyInitialStackSize = 16 -// line internal/php5/php5.y:6059 +// line internal/php5/php5.y:6088 type simpleIndirectReference struct { all []*ast.ExprVariable @@ -2315,7 +2315,7 @@ yydefault: case 1: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:275 + // line internal/php5/php5.y:275 { yylex.(*Parser).rootNode = &ast.Root{ast.Node{}, yyDollar[1].list} yylex.(*Parser).rootNode.GetNode().Position = position.NewNodeListPosition(yyDollar[1].list) @@ -2324,7 +2324,7 @@ yydefault: } case 2: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php5/php5.y:285 + // line internal/php5/php5.y:285 { if inlineHtmlNode, ok := yyDollar[2].node.(*ast.StmtInlineHtml); ok && len(yyDollar[1].list) > 0 { prevNode := lastNode(yyDollar[1].list) @@ -2337,13 +2337,13 @@ yydefault: } case 3: yyDollar = yyS[yypt-0 : yypt+1] -// line internal/php5/php5.y:296 + // line internal/php5/php5.y:296 { yyVAL.list = []ast.Vertex{} } case 4: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:303 + // line internal/php5/php5.y:303 { namePart := &ast.NameNamePart{ast.Node{}, yyDollar[1].token.Value} yyVAL.list = []ast.Vertex{namePart} @@ -2356,7 +2356,7 @@ yydefault: } case 5: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:314 + // line internal/php5/php5.y:314 { namePart := &ast.NameNamePart{ast.Node{}, yyDollar[3].token.Value} yyVAL.list = append(yyDollar[1].list, namePart) @@ -2370,32 +2370,32 @@ yydefault: } case 6: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:329 + // line internal/php5/php5.y:329 { // error yyVAL.node = nil } case 7: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:334 + // line internal/php5/php5.y:334 { yyVAL.node = yyDollar[1].node } case 8: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:338 + // line internal/php5/php5.y:338 { yyVAL.node = yyDollar[1].node } case 9: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:342 + // line internal/php5/php5.y:342 { yyVAL.node = yyDollar[1].node } case 10: yyDollar = yyS[yypt-4 : yypt+1] -// line internal/php5/php5.y:346 + // line internal/php5/php5.y:346 { yyVAL.node = &ast.StmtHaltCompiler{ast.Node{}} @@ -2408,7 +2408,7 @@ yydefault: } case 11: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:357 + // line internal/php5/php5.y:357 { name := &ast.NameName{ast.Node{}, yyDollar[2].list} yyVAL.node = &ast.StmtNamespace{ast.Node{}, name, nil} @@ -2424,7 +2424,7 @@ yydefault: } case 12: yyDollar = yyS[yypt-5 : yypt+1] -// line internal/php5/php5.y:371 + // line internal/php5/php5.y:371 { name := &ast.NameName{ast.Node{}, yyDollar[2].list} yyVAL.node = &ast.StmtNamespace{ast.Node{}, name, yyDollar[4].list} @@ -2440,7 +2440,7 @@ yydefault: } case 13: yyDollar = yyS[yypt-4 : yypt+1] -// line internal/php5/php5.y:385 + // line internal/php5/php5.y:385 { yyVAL.node = &ast.StmtNamespace{ast.Node{}, nil, yyDollar[3].list} @@ -2454,62 +2454,58 @@ yydefault: } case 14: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:397 + // line internal/php5/php5.y:397 { - useList := &ast.StmtUseList{ast.Node{}, yyDollar[2].list} - yyVAL.node = &ast.StmtUse{ast.Node{}, useList} - - // save position - useList.GetNode().Position = position.NewNodeListPosition(yyDollar[2].list) - yyVAL.node.GetNode().Position = position.NewTokensPosition(yyDollar[1].token, yyDollar[3].token) - - // save comments - yylex.(*Parser).setFreeFloating(yyVAL.node, token.Start, yyDollar[1].token.SkippedTokens) - yylex.(*Parser).setFreeFloatingTokens(yyVAL.node, token.End, yyDollar[3].token.SkippedTokens) + yyVAL.node = &ast.StmtUse{ + Node: ast.Node{ + Position: position.NewTokensPosition(yyDollar[1].token, yyDollar[3].token), + }, + UseTkn: yyDollar[1].token, + UseDeclarations: yyDollar[2].list, + SemiColonTkn: yyDollar[3].token, + } } case 15: yyDollar = yyS[yypt-4 : yypt+1] -// line internal/php5/php5.y:410 + // line internal/php5/php5.y:408 { - identifier := &ast.Identifier{ast.Node{}, yyDollar[2].token.Value} - useList := &ast.StmtUseList{ast.Node{}, yyDollar[3].list} - useType := &ast.StmtUseType{ast.Node{}, identifier, useList} - yyVAL.node = &ast.StmtUse{ast.Node{}, useType} - - // save position - identifier.GetNode().Position = position.NewTokenPosition(yyDollar[2].token) - useList.GetNode().Position = position.NewNodeListPosition(yyDollar[3].list) - useType.GetNode().Position = position.NewTokenNodePosition(yyDollar[2].token, useList) - yyVAL.node.GetNode().Position = position.NewTokensPosition(yyDollar[1].token, yyDollar[4].token) - - // save comments - yylex.(*Parser).setFreeFloating(identifier, token.Start, yyDollar[2].token.SkippedTokens) - yylex.(*Parser).setFreeFloating(yyVAL.node, token.Start, yyDollar[1].token.SkippedTokens) - yylex.(*Parser).setFreeFloatingTokens(yyVAL.node, token.End, yyDollar[4].token.SkippedTokens) + yyVAL.node = &ast.StmtUse{ + Node: ast.Node{ + Position: position.NewTokensPosition(yyDollar[1].token, yyDollar[4].token), + }, + UseTkn: yyDollar[1].token, + Type: &ast.Identifier{ + Node: ast.Node{ + Position: position.NewTokenPosition(yyDollar[2].token), + }, + Value: yyDollar[2].token.Value, + }, + UseDeclarations: yyDollar[3].list, + SemiColonTkn: yyDollar[4].token, + } } case 16: yyDollar = yyS[yypt-4 : yypt+1] -// line internal/php5/php5.y:428 + // line internal/php5/php5.y:425 { - identifier := &ast.Identifier{ast.Node{}, yyDollar[2].token.Value} - useList := &ast.StmtUseList{ast.Node{}, yyDollar[3].list} - useType := &ast.StmtUseType{ast.Node{}, identifier, useList} - yyVAL.node = &ast.StmtUse{ast.Node{}, useType} - - // save position - identifier.GetNode().Position = position.NewTokenPosition(yyDollar[2].token) - useList.GetNode().Position = position.NewNodeListPosition(yyDollar[3].list) - useType.GetNode().Position = position.NewTokenNodePosition(yyDollar[2].token, useList) - yyVAL.node.GetNode().Position = position.NewTokensPosition(yyDollar[1].token, yyDollar[4].token) - - // save comments - yylex.(*Parser).setFreeFloating(identifier, token.Start, yyDollar[2].token.SkippedTokens) - yylex.(*Parser).setFreeFloating(yyVAL.node, token.Start, yyDollar[1].token.SkippedTokens) - yylex.(*Parser).setFreeFloatingTokens(yyVAL.node, token.End, yyDollar[4].token.SkippedTokens) + yyVAL.node = &ast.StmtUse{ + Node: ast.Node{ + Position: position.NewTokensPosition(yyDollar[1].token, yyDollar[4].token), + }, + UseTkn: yyDollar[1].token, + Type: &ast.Identifier{ + Node: ast.Node{ + Position: position.NewTokenPosition(yyDollar[2].token), + }, + Value: yyDollar[2].token.Value, + }, + UseDeclarations: yyDollar[3].list, + SemiColonTkn: yyDollar[4].token, + } } case 17: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php5/php5.y:446 + // line internal/php5/php5.y:442 { yyVAL.node = yyDollar[1].node @@ -2522,256 +2518,289 @@ yydefault: } case 18: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:460 + // line internal/php5/php5.y:456 { - yyVAL.list = append(yyDollar[1].list, yyDollar[3].node) + yyDollar[1].list[len(yyDollar[1].list)-1].(*ast.StmtUseDeclaration).CommaTkn = yyDollar[2].token - // save comments - yylex.(*Parser).setFreeFloating(lastNode(yyDollar[1].list), token.End, yyDollar[2].token.SkippedTokens) + yyVAL.list = append(yyDollar[1].list, yyDollar[3].node) } case 19: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:467 + // line internal/php5/php5.y:462 { yyVAL.list = []ast.Vertex{yyDollar[1].node} } case 20: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:474 + // line internal/php5/php5.y:469 { - name := &ast.NameName{ast.Node{}, yyDollar[1].list} - yyVAL.node = &ast.StmtUseDeclaration{ast.Node{}, name, nil} - - // save position - name.GetNode().Position = position.NewNodeListPosition(yyDollar[1].list) - yyVAL.node.GetNode().Position = position.NewNodeListPosition(yyDollar[1].list) + yyVAL.node = &ast.StmtUseDeclaration{ + Node: ast.Node{ + Position: position.NewNodeListPosition(yyDollar[1].list), + }, + Use: &ast.NameName{ + Node: ast.Node{ + Position: position.NewNodeListPosition(yyDollar[1].list), + }, + Parts: yyDollar[1].list, + }, + } } case 21: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:483 + // line internal/php5/php5.y:483 { - name := &ast.NameName{ast.Node{}, yyDollar[1].list} - alias := &ast.Identifier{ast.Node{}, yyDollar[3].token.Value} - asAlias := &ast.ParserAs{ast.Node{}, alias} - yyVAL.node = &ast.StmtUseDeclaration{ast.Node{}, name, asAlias} - - // save position - name.GetNode().Position = position.NewNodeListPosition(yyDollar[1].list) - alias.GetNode().Position = position.NewTokenPosition(yyDollar[3].token) - asAlias.GetNode().Position = position.NewTokensPosition(yyDollar[2].token, yyDollar[3].token) - yyVAL.node.GetNode().Position = position.NewNodeListTokenPosition(yyDollar[1].list, yyDollar[3].token) - - // save comments - yylex.(*Parser).setFreeFloating(asAlias, token.Start, yyDollar[2].token.SkippedTokens) - yylex.(*Parser).setFreeFloating(alias, token.Start, yyDollar[3].token.SkippedTokens) + yyVAL.node = &ast.StmtUseDeclaration{ + Node: ast.Node{ + Position: position.NewNodeListTokenPosition(yyDollar[1].list, yyDollar[3].token), + }, + Use: &ast.NameName{ + Node: ast.Node{ + Position: position.NewNodeListPosition(yyDollar[1].list), + }, + Parts: yyDollar[1].list, + }, + AsTkn: yyDollar[2].token, + Alias: &ast.Identifier{ + Node: ast.Node{ + Position: position.NewTokenPosition(yyDollar[3].token), + }, + Value: yyDollar[3].token.Value, + }, + } } case 22: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php5/php5.y:500 + // line internal/php5/php5.y:504 { - name := &ast.NameName{ast.Node{}, yyDollar[2].list} - useDeclaration := &ast.StmtUseDeclaration{ast.Node{}, name, nil} - yyVAL.node = &ast.ParserNsSeparator{ast.Node{}, useDeclaration} - - // save position - name.GetNode().Position = position.NewNodeListPosition(yyDollar[2].list) - useDeclaration.GetNode().Position = position.NewTokenNodePosition(yyDollar[1].token, name) - yyVAL.node.GetNode().Position = position.NewTokenNodePosition(yyDollar[1].token, name) - - // save comments - yylex.(*Parser).setFreeFloating(yyVAL.node, token.Start, yyDollar[1].token.SkippedTokens) + yyVAL.node = &ast.StmtUseDeclaration{ + Node: ast.Node{ + Position: position.NewTokenNodeListPosition(yyDollar[1].token, yyDollar[2].list), + }, + NsSeparatorTkn: yyDollar[1].token, + Use: &ast.NameName{ + Node: ast.Node{ + Position: position.NewNodeListPosition(yyDollar[2].list), + }, + Parts: yyDollar[2].list, + }, + } } case 23: yyDollar = yyS[yypt-4 : yypt+1] -// line internal/php5/php5.y:514 + // line internal/php5/php5.y:519 { - name := &ast.NameName{ast.Node{}, yyDollar[2].list} - alias := &ast.Identifier{ast.Node{}, yyDollar[4].token.Value} - asAlias := &ast.ParserAs{ast.Node{}, alias} - useDeclaration := &ast.StmtUseDeclaration{ast.Node{}, name, alias} - yyVAL.node = &ast.ParserNsSeparator{ast.Node{}, useDeclaration} - - // save position - name.GetNode().Position = position.NewNodeListPosition(yyDollar[2].list) - alias.GetNode().Position = position.NewTokenPosition(yyDollar[4].token) - asAlias.GetNode().Position = position.NewTokensPosition(yyDollar[3].token, yyDollar[4].token) - useDeclaration.GetNode().Position = position.NewTokensPosition(yyDollar[1].token, yyDollar[4].token) - yyVAL.node.GetNode().Position = position.NewTokensPosition(yyDollar[1].token, yyDollar[4].token) - - // save comments - yylex.(*Parser).setFreeFloating(yyVAL.node, token.Start, yyDollar[1].token.SkippedTokens) - yylex.(*Parser).setFreeFloating(asAlias, token.Start, yyDollar[3].token.SkippedTokens) - yylex.(*Parser).setFreeFloating(alias, token.Start, yyDollar[4].token.SkippedTokens) + yyVAL.node = &ast.StmtUseDeclaration{ + Node: ast.Node{ + Position: position.NewTokensPosition(yyDollar[1].token, yyDollar[4].token), + }, + NsSeparatorTkn: yyDollar[1].token, + Use: &ast.NameName{ + Node: ast.Node{ + Position: position.NewNodeListPosition(yyDollar[2].list), + }, + Parts: yyDollar[2].list, + }, + AsTkn: yyDollar[3].token, + Alias: &ast.Identifier{ + Node: ast.Node{ + Position: position.NewTokenPosition(yyDollar[4].token), + }, + Value: yyDollar[4].token.Value, + }, + } } case 24: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:537 + // line internal/php5/php5.y:544 { - yyVAL.list = append(yyDollar[1].list, yyDollar[3].node) + yyDollar[1].list[len(yyDollar[1].list)-1].(*ast.StmtUseDeclaration).CommaTkn = yyDollar[2].token - // save comments - yylex.(*Parser).setFreeFloating(lastNode(yyDollar[1].list), token.End, yyDollar[2].token.SkippedTokens) + yyVAL.list = append(yyDollar[1].list, yyDollar[3].node) } case 25: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:544 + // line internal/php5/php5.y:550 { yyVAL.list = []ast.Vertex{yyDollar[1].node} } case 26: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:551 + // line internal/php5/php5.y:557 { - name := &ast.NameName{ast.Node{}, yyDollar[1].list} - yyVAL.node = &ast.StmtUseDeclaration{ast.Node{}, name, nil} - - // save position - name.GetNode().Position = position.NewNodeListPosition(yyDollar[1].list) - yyVAL.node.GetNode().Position = position.NewNodeListPosition(yyDollar[1].list) + yyVAL.node = &ast.StmtUseDeclaration{ + Node: ast.Node{ + Position: position.NewNodeListPosition(yyDollar[1].list), + }, + Use: &ast.NameName{ + Node: ast.Node{ + Position: position.NewNodeListPosition(yyDollar[1].list), + }, + Parts: yyDollar[1].list, + }, + } } case 27: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:560 + // line internal/php5/php5.y:571 { - name := &ast.NameName{ast.Node{}, yyDollar[1].list} - alias := &ast.Identifier{ast.Node{}, yyDollar[3].token.Value} - asAlias := &ast.ParserAs{ast.Node{}, alias} - yyVAL.node = &ast.StmtUseDeclaration{ast.Node{}, name, asAlias} - - // save position - name.GetNode().Position = position.NewNodeListPosition(yyDollar[1].list) - alias.GetNode().Position = position.NewTokenPosition(yyDollar[3].token) - asAlias.GetNode().Position = position.NewTokensPosition(yyDollar[2].token, yyDollar[3].token) - yyVAL.node.GetNode().Position = position.NewNodeListTokenPosition(yyDollar[1].list, yyDollar[3].token) - - // save comments - yylex.(*Parser).setFreeFloating(asAlias, token.Start, yyDollar[2].token.SkippedTokens) - yylex.(*Parser).setFreeFloating(alias, token.Start, yyDollar[3].token.SkippedTokens) + yyVAL.node = &ast.StmtUseDeclaration{ + Node: ast.Node{ + Position: position.NewNodeListTokenPosition(yyDollar[1].list, yyDollar[3].token), + }, + Use: &ast.NameName{ + Node: ast.Node{ + Position: position.NewNodeListPosition(yyDollar[1].list), + }, + Parts: yyDollar[1].list, + }, + AsTkn: yyDollar[2].token, + Alias: &ast.Identifier{ + Node: ast.Node{ + Position: position.NewTokenPosition(yyDollar[3].token), + }, + Value: yyDollar[3].token.Value, + }, + } } case 28: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php5/php5.y:577 + // line internal/php5/php5.y:592 { - name := &ast.NameName{ast.Node{}, yyDollar[2].list} - useDeclaration := &ast.StmtUseDeclaration{ast.Node{}, name, nil} - yyVAL.node = &ast.ParserNsSeparator{ast.Node{}, useDeclaration} - - // save position - name.GetNode().Position = position.NewNodeListPosition(yyDollar[2].list) - useDeclaration.GetNode().Position = position.NewTokenNodePosition(yyDollar[1].token, name) - yyVAL.node.GetNode().Position = position.NewTokenNodePosition(yyDollar[1].token, name) - - // save comments - yylex.(*Parser).setFreeFloating(yyVAL.node, token.Start, yyDollar[1].token.SkippedTokens) + yyVAL.node = &ast.StmtUseDeclaration{ + Node: ast.Node{ + Position: position.NewTokenNodeListPosition(yyDollar[1].token, yyDollar[2].list), + }, + NsSeparatorTkn: yyDollar[1].token, + Use: &ast.NameName{ + Node: ast.Node{ + Position: position.NewNodeListPosition(yyDollar[2].list), + }, + Parts: yyDollar[2].list, + }, + } } case 29: yyDollar = yyS[yypt-4 : yypt+1] -// line internal/php5/php5.y:591 + // line internal/php5/php5.y:607 { - name := &ast.NameName{ast.Node{}, yyDollar[2].list} - alias := &ast.Identifier{ast.Node{}, yyDollar[4].token.Value} - asAlias := &ast.ParserAs{ast.Node{}, alias} - useDeclaration := &ast.StmtUseDeclaration{ast.Node{}, name, alias} - yyVAL.node = &ast.ParserNsSeparator{ast.Node{}, useDeclaration} - - // save position - name.GetNode().Position = position.NewNodeListPosition(yyDollar[2].list) - alias.GetNode().Position = position.NewTokenPosition(yyDollar[4].token) - asAlias.GetNode().Position = position.NewTokensPosition(yyDollar[3].token, yyDollar[4].token) - useDeclaration.GetNode().Position = position.NewTokensPosition(yyDollar[1].token, yyDollar[4].token) - yyVAL.node.GetNode().Position = position.NewTokensPosition(yyDollar[1].token, yyDollar[4].token) - - // save comments - yylex.(*Parser).setFreeFloating(yyVAL.node, token.Start, yyDollar[1].token.SkippedTokens) - yylex.(*Parser).setFreeFloating(asAlias, token.Start, yyDollar[3].token.SkippedTokens) - yylex.(*Parser).setFreeFloating(alias, token.Start, yyDollar[4].token.SkippedTokens) + yyVAL.node = &ast.StmtUseDeclaration{ + Node: ast.Node{ + Position: position.NewTokensPosition(yyDollar[1].token, yyDollar[4].token), + }, + NsSeparatorTkn: yyDollar[1].token, + Use: &ast.NameName{ + Node: ast.Node{ + Position: position.NewNodeListPosition(yyDollar[2].list), + }, + Parts: yyDollar[2].list, + }, + AsTkn: yyDollar[3].token, + Alias: &ast.Identifier{ + Node: ast.Node{ + Position: position.NewTokenPosition(yyDollar[4].token), + }, + Value: yyDollar[4].token.Value, + }, + } } case 30: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:614 + // line internal/php5/php5.y:632 { - yyVAL.list = append(yyDollar[1].list, yyDollar[3].node) + yyDollar[1].list[len(yyDollar[1].list)-1].(*ast.StmtUseDeclaration).CommaTkn = yyDollar[2].token - // save comments - yylex.(*Parser).setFreeFloating(lastNode(yyDollar[1].list), token.End, yyDollar[2].token.SkippedTokens) + yyVAL.list = append(yyDollar[1].list, yyDollar[3].node) } case 31: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:621 + // line internal/php5/php5.y:638 { yyVAL.list = []ast.Vertex{yyDollar[1].node} } case 32: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:628 + // line internal/php5/php5.y:645 { - name := &ast.NameName{ast.Node{}, yyDollar[1].list} - yyVAL.node = &ast.StmtUseDeclaration{ast.Node{}, name, nil} - - // save position - name.GetNode().Position = position.NewNodeListPosition(yyDollar[1].list) - yyVAL.node.GetNode().Position = position.NewNodeListPosition(yyDollar[1].list) + yyVAL.node = &ast.StmtUseDeclaration{ + Node: ast.Node{ + Position: position.NewNodeListPosition(yyDollar[1].list), + }, + Use: &ast.NameName{ + Node: ast.Node{ + Position: position.NewNodeListPosition(yyDollar[1].list), + }, + Parts: yyDollar[1].list, + }, + } } case 33: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:637 + // line internal/php5/php5.y:659 { - name := &ast.NameName{ast.Node{}, yyDollar[1].list} - alias := &ast.Identifier{ast.Node{}, yyDollar[3].token.Value} - asAlias := &ast.ParserAs{ast.Node{}, alias} - yyVAL.node = &ast.StmtUseDeclaration{ast.Node{}, name, asAlias} - - // save position - name.GetNode().Position = position.NewNodeListPosition(yyDollar[1].list) - alias.GetNode().Position = position.NewTokenPosition(yyDollar[3].token) - asAlias.GetNode().Position = position.NewTokensPosition(yyDollar[2].token, yyDollar[3].token) - yyVAL.node.GetNode().Position = position.NewNodeListTokenPosition(yyDollar[1].list, yyDollar[3].token) - - // save comments - yylex.(*Parser).setFreeFloating(asAlias, token.Start, yyDollar[2].token.SkippedTokens) - yylex.(*Parser).setFreeFloating(alias, token.Start, yyDollar[3].token.SkippedTokens) + yyVAL.node = &ast.StmtUseDeclaration{ + Node: ast.Node{ + Position: position.NewNodeListTokenPosition(yyDollar[1].list, yyDollar[3].token), + }, + Use: &ast.NameName{ + Node: ast.Node{ + Position: position.NewNodeListPosition(yyDollar[1].list), + }, + Parts: yyDollar[1].list, + }, + AsTkn: yyDollar[2].token, + Alias: &ast.Identifier{ + Node: ast.Node{ + Position: position.NewTokenPosition(yyDollar[3].token), + }, + Value: yyDollar[3].token.Value, + }, + } } case 34: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php5/php5.y:654 + // line internal/php5/php5.y:680 { - name := &ast.NameName{ast.Node{}, yyDollar[2].list} - useDeclaration := &ast.StmtUseDeclaration{ast.Node{}, name, nil} - yyVAL.node = &ast.ParserNsSeparator{ast.Node{}, useDeclaration} - - // save position - name.GetNode().Position = position.NewNodeListPosition(yyDollar[2].list) - useDeclaration.GetNode().Position = position.NewTokenNodePosition(yyDollar[1].token, name) - yyVAL.node.GetNode().Position = position.NewTokenNodePosition(yyDollar[1].token, name) - - // save comments - yylex.(*Parser).setFreeFloating(yyVAL.node, token.Start, yyDollar[1].token.SkippedTokens) + yyVAL.node = &ast.StmtUseDeclaration{ + Node: ast.Node{ + Position: position.NewTokenNodeListPosition(yyDollar[1].token, yyDollar[2].list), + }, + NsSeparatorTkn: yyDollar[1].token, + Use: &ast.NameName{ + Node: ast.Node{ + Position: position.NewNodeListPosition(yyDollar[2].list), + }, + Parts: yyDollar[2].list, + }, + } } case 35: yyDollar = yyS[yypt-4 : yypt+1] -// line internal/php5/php5.y:668 + // line internal/php5/php5.y:695 { - name := &ast.NameName{ast.Node{}, yyDollar[2].list} - alias := &ast.Identifier{ast.Node{}, yyDollar[4].token.Value} - asAlias := &ast.ParserAs{ast.Node{}, alias} - useDeclaration := &ast.StmtUseDeclaration{ast.Node{}, name, alias} - yyVAL.node = &ast.ParserNsSeparator{ast.Node{}, useDeclaration} - - // save position - name.GetNode().Position = position.NewNodeListPosition(yyDollar[2].list) - alias.GetNode().Position = position.NewTokenPosition(yyDollar[4].token) - asAlias.GetNode().Position = position.NewTokensPosition(yyDollar[3].token, yyDollar[4].token) - useDeclaration.GetNode().Position = position.NewTokensPosition(yyDollar[1].token, yyDollar[4].token) - yyVAL.node.GetNode().Position = position.NewTokensPosition(yyDollar[1].token, yyDollar[4].token) - - // save comments - yylex.(*Parser).setFreeFloating(yyVAL.node, token.Start, yyDollar[1].token.SkippedTokens) - yylex.(*Parser).setFreeFloating(asAlias, token.Start, yyDollar[3].token.SkippedTokens) - yylex.(*Parser).setFreeFloating(alias, token.Start, yyDollar[4].token.SkippedTokens) + yyVAL.node = &ast.StmtUseDeclaration{ + Node: ast.Node{ + Position: position.NewTokensPosition(yyDollar[1].token, yyDollar[4].token), + }, + NsSeparatorTkn: yyDollar[1].token, + Use: &ast.NameName{ + Node: ast.Node{ + Position: position.NewNodeListPosition(yyDollar[2].list), + }, + Parts: yyDollar[2].list, + }, + AsTkn: yyDollar[3].token, + Alias: &ast.Identifier{ + Node: ast.Node{ + Position: position.NewTokenPosition(yyDollar[4].token), + }, + Value: yyDollar[4].token.Value, + }, + } } case 36: yyDollar = yyS[yypt-5 : yypt+1] -// line internal/php5/php5.y:691 + // line internal/php5/php5.y:720 { name := &ast.Identifier{ast.Node{}, yyDollar[3].token.Value} constant := &ast.StmtConstant{ast.Node{}, name, yyDollar[5].node} @@ -2792,7 +2821,7 @@ yydefault: } case 37: yyDollar = yyS[yypt-4 : yypt+1] -// line internal/php5/php5.y:710 + // line internal/php5/php5.y:739 { name := &ast.Identifier{ast.Node{}, yyDollar[2].token.Value} constant := &ast.StmtConstant{ast.Node{}, name, yyDollar[4].node} @@ -2811,7 +2840,7 @@ yydefault: } case 38: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php5/php5.y:730 + // line internal/php5/php5.y:759 { if inlineHtmlNode, ok := yyDollar[2].node.(*ast.StmtInlineHtml); ok && len(yyDollar[1].list) > 0 { prevNode := lastNode(yyDollar[1].list) @@ -2824,38 +2853,38 @@ yydefault: } case 39: yyDollar = yyS[yypt-0 : yypt+1] -// line internal/php5/php5.y:741 + // line internal/php5/php5.y:770 { yyVAL.list = []ast.Vertex{} } case 40: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:749 + // line internal/php5/php5.y:778 { // error yyVAL.node = nil } case 41: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:754 + // line internal/php5/php5.y:783 { yyVAL.node = yyDollar[1].node } case 42: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:758 + // line internal/php5/php5.y:787 { yyVAL.node = yyDollar[1].node } case 43: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:762 + // line internal/php5/php5.y:791 { yyVAL.node = yyDollar[1].node } case 44: yyDollar = yyS[yypt-4 : yypt+1] -// line internal/php5/php5.y:766 + // line internal/php5/php5.y:795 { yyVAL.node = &ast.StmtHaltCompiler{ast.Node{}} @@ -2868,13 +2897,13 @@ yydefault: } case 45: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:781 + // line internal/php5/php5.y:810 { yyVAL.node = yyDollar[1].node } case 46: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php5/php5.y:785 + // line internal/php5/php5.y:814 { label := &ast.Identifier{ast.Node{}, yyDollar[1].token.Value} yyVAL.node = &ast.StmtLabel{ast.Node{}, label} @@ -2889,7 +2918,7 @@ yydefault: } case 47: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:801 + // line internal/php5/php5.y:830 { yyVAL.node = &ast.StmtStmtList{ast.Node{}, yyDollar[2].list} @@ -2902,7 +2931,7 @@ yydefault: } case 48: yyDollar = yyS[yypt-5 : yypt+1] -// line internal/php5/php5.y:812 + // line internal/php5/php5.y:841 { yyVAL.node = &ast.StmtIf{ast.Node{}, yyDollar[2].node, yyDollar[3].node, yyDollar[4].list, yyDollar[5].node} @@ -2920,7 +2949,7 @@ yydefault: } case 49: yyDollar = yyS[yypt-8 : yypt+1] -// line internal/php5/php5.y:828 + // line internal/php5/php5.y:857 { stmts := &ast.StmtStmtList{ast.Node{}, yyDollar[4].list} stmtsBrackets := &ast.ParserBrackets{ast.Node{}, stmts} @@ -2945,7 +2974,7 @@ yydefault: } case 50: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:851 + // line internal/php5/php5.y:880 { switch n := yyDollar[3].node.(type) { case *ast.StmtWhile: @@ -2964,7 +2993,7 @@ yydefault: } case 51: yyDollar = yyS[yypt-5 : yypt+1] -// line internal/php5/php5.y:868 + // line internal/php5/php5.y:897 { yyVAL.node = &ast.StmtDo{ast.Node{}, yyDollar[2].node, yyDollar[4].node} @@ -2979,7 +3008,7 @@ yydefault: } case 52: yyDollar = yyS[yypt-9 : yypt+1] -// line internal/php5/php5.y:881 + // line internal/php5/php5.y:910 { switch n := yyDollar[9].node.(type) { case *ast.StmtFor: @@ -3006,7 +3035,7 @@ yydefault: } case 53: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:906 + // line internal/php5/php5.y:935 { switch n := yyDollar[3].node.(type) { case *ast.StmtSwitch: @@ -3027,7 +3056,7 @@ yydefault: } case 54: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php5/php5.y:925 + // line internal/php5/php5.y:954 { yyVAL.node = &ast.StmtBreak{ast.Node{}, nil} @@ -3041,7 +3070,7 @@ yydefault: } case 55: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:937 + // line internal/php5/php5.y:966 { yyVAL.node = &ast.StmtBreak{ast.Node{}, yyDollar[2].node} @@ -3055,7 +3084,7 @@ yydefault: } case 56: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php5/php5.y:949 + // line internal/php5/php5.y:978 { yyVAL.node = &ast.StmtContinue{ast.Node{}, nil} @@ -3069,7 +3098,7 @@ yydefault: } case 57: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:961 + // line internal/php5/php5.y:990 { yyVAL.node = &ast.StmtContinue{ast.Node{}, yyDollar[2].node} @@ -3083,7 +3112,7 @@ yydefault: } case 58: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php5/php5.y:973 + // line internal/php5/php5.y:1002 { yyVAL.node = &ast.StmtReturn{ast.Node{}, nil} @@ -3097,7 +3126,7 @@ yydefault: } case 59: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:985 + // line internal/php5/php5.y:1014 { yyVAL.node = &ast.StmtReturn{ast.Node{}, yyDollar[2].node} @@ -3111,7 +3140,7 @@ yydefault: } case 60: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:997 + // line internal/php5/php5.y:1026 { yyVAL.node = &ast.StmtReturn{ast.Node{}, yyDollar[2].node} @@ -3125,7 +3154,7 @@ yydefault: } case 61: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php5/php5.y:1009 + // line internal/php5/php5.y:1038 { yyVAL.node = &ast.StmtExpression{ast.Node{}, yyDollar[1].node} @@ -3139,7 +3168,7 @@ yydefault: } case 62: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:1021 + // line internal/php5/php5.y:1050 { yyVAL.node = &ast.StmtGlobal{ast.Node{}, yyDollar[2].list} @@ -3153,7 +3182,7 @@ yydefault: } case 63: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:1033 + // line internal/php5/php5.y:1062 { yyVAL.node = &ast.StmtStatic{ast.Node{}, yyDollar[2].list} @@ -3167,7 +3196,7 @@ yydefault: } case 64: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:1045 + // line internal/php5/php5.y:1074 { yyVAL.node = &ast.StmtEcho{ast.Node{}, yyDollar[2].list} @@ -3182,7 +3211,7 @@ yydefault: } case 65: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:1058 + // line internal/php5/php5.y:1087 { yyVAL.node = &ast.StmtInlineHtml{ast.Node{}, yyDollar[1].token.Value} @@ -3194,7 +3223,7 @@ yydefault: } case 66: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php5/php5.y:1068 + // line internal/php5/php5.y:1097 { yyVAL.node = &ast.StmtExpression{ast.Node{}, yyDollar[1].node} @@ -3208,7 +3237,7 @@ yydefault: } case 67: yyDollar = yyS[yypt-5 : yypt+1] -// line internal/php5/php5.y:1080 + // line internal/php5/php5.y:1109 { yyVAL.node = &ast.StmtUnset{ast.Node{}, yyDollar[3].list} @@ -3224,7 +3253,7 @@ yydefault: } case 68: yyDollar = yyS[yypt-8 : yypt+1] -// line internal/php5/php5.y:1094 + // line internal/php5/php5.y:1123 { if yyDollar[6].node == nil { switch n := yyDollar[8].node.(type) { @@ -3265,7 +3294,7 @@ yydefault: } case 69: yyDollar = yyS[yypt-8 : yypt+1] -// line internal/php5/php5.y:1132 + // line internal/php5/php5.y:1161 { if yyDollar[6].node == nil { switch n := yyDollar[8].node.(type) { @@ -3306,7 +3335,7 @@ yydefault: } case 70: yyDollar = yyS[yypt-5 : yypt+1] -// line internal/php5/php5.y:1170 + // line internal/php5/php5.y:1199 { yyVAL.node = yyDollar[5].node yyVAL.node.(*ast.StmtDeclare).Consts = yyDollar[3].list @@ -3321,7 +3350,7 @@ yydefault: } case 71: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:1183 + // line internal/php5/php5.y:1212 { yyVAL.node = &ast.StmtNop{ast.Node{}} @@ -3334,7 +3363,7 @@ yydefault: } case 72: yyDollar = yyS[yypt-6 : yypt+1] -// line internal/php5/php5.y:1194 + // line internal/php5/php5.y:1223 { yyVAL.node = &ast.StmtTry{ast.Node{}, yyDollar[3].list, yyDollar[5].list, yyDollar[6].node} @@ -3352,7 +3381,7 @@ yydefault: } case 73: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:1210 + // line internal/php5/php5.y:1239 { yyVAL.node = &ast.StmtThrow{ast.Node{}, yyDollar[2].node} @@ -3366,7 +3395,7 @@ yydefault: } case 74: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:1222 + // line internal/php5/php5.y:1251 { label := &ast.Identifier{ast.Node{}, yyDollar[2].token.Value} yyVAL.node = &ast.StmtGoto{ast.Node{}, label} @@ -3383,13 +3412,13 @@ yydefault: } case 75: yyDollar = yyS[yypt-0 : yypt+1] -// line internal/php5/php5.y:1240 + // line internal/php5/php5.y:1269 { yyVAL.list = []ast.Vertex{} } case 76: yyDollar = yyS[yypt-9 : yypt+1] -// line internal/php5/php5.y:1244 + // line internal/php5/php5.y:1273 { identifier := &ast.Identifier{ast.Node{}, yyDollar[4].token.Value} variable := &ast.ExprVariable{ast.Node{}, identifier} @@ -3411,13 +3440,13 @@ yydefault: } case 77: yyDollar = yyS[yypt-0 : yypt+1] -// line internal/php5/php5.y:1267 + // line internal/php5/php5.y:1296 { yyVAL.node = nil } case 78: yyDollar = yyS[yypt-4 : yypt+1] -// line internal/php5/php5.y:1271 + // line internal/php5/php5.y:1300 { yyVAL.node = &ast.StmtFinally{ast.Node{}, yyDollar[3].list} @@ -3431,31 +3460,31 @@ yydefault: } case 79: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:1286 + // line internal/php5/php5.y:1315 { yyVAL.list = yyDollar[1].list } case 80: yyDollar = yyS[yypt-0 : yypt+1] -// line internal/php5/php5.y:1290 + // line internal/php5/php5.y:1319 { yyVAL.list = []ast.Vertex{} } case 81: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:1297 + // line internal/php5/php5.y:1326 { yyVAL.list = []ast.Vertex{yyDollar[1].node} } case 82: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php5/php5.y:1301 + // line internal/php5/php5.y:1330 { yyVAL.list = append(yyDollar[1].list, yyDollar[2].node) } case 83: yyDollar = yyS[yypt-8 : yypt+1] -// line internal/php5/php5.y:1308 + // line internal/php5/php5.y:1337 { identifier := &ast.Identifier{ast.Node{}, yyDollar[4].token.Value} variable := &ast.ExprVariable{ast.Node{}, identifier} @@ -3476,13 +3505,13 @@ yydefault: } case 84: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:1330 + // line internal/php5/php5.y:1359 { yyVAL.list = []ast.Vertex{yyDollar[1].node} } case 85: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:1334 + // line internal/php5/php5.y:1363 { yyVAL.list = append(yyDollar[1].list, yyDollar[3].node) @@ -3491,49 +3520,49 @@ yydefault: } case 86: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:1344 + // line internal/php5/php5.y:1373 { yyVAL.node = yyDollar[1].node } case 87: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:1351 + // line internal/php5/php5.y:1380 { yyVAL.node = yyDollar[1].node } case 88: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:1358 + // line internal/php5/php5.y:1387 { yyVAL.node = yyDollar[1].node } case 89: yyDollar = yyS[yypt-0 : yypt+1] -// line internal/php5/php5.y:1365 + // line internal/php5/php5.y:1394 { yyVAL.token = nil } case 90: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:1369 + // line internal/php5/php5.y:1398 { yyVAL.token = yyDollar[1].token } case 91: yyDollar = yyS[yypt-0 : yypt+1] -// line internal/php5/php5.y:1376 + // line internal/php5/php5.y:1405 { yyVAL.token = nil } case 92: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:1380 + // line internal/php5/php5.y:1409 { yyVAL.token = yyDollar[1].token } case 93: yyDollar = yyS[yypt-9 : yypt+1] -// line internal/php5/php5.y:1387 + // line internal/php5/php5.y:1416 { name := &ast.Identifier{ast.Node{}, yyDollar[3].token.Value} yyVAL.node = &ast.StmtFunction{ast.Node{}, yyDollar[2].token != nil, name, yyDollar[5].list, nil, yyDollar[8].list} @@ -3557,7 +3586,7 @@ yydefault: } case 94: yyDollar = yyS[yypt-7 : yypt+1] -// line internal/php5/php5.y:1412 + // line internal/php5/php5.y:1441 { name := &ast.Identifier{ast.Node{}, yyDollar[2].token.Value} switch n := yyDollar[1].node.(type) { @@ -3585,7 +3614,7 @@ yydefault: } case 95: yyDollar = yyS[yypt-6 : yypt+1] -// line internal/php5/php5.y:1438 + // line internal/php5/php5.y:1467 { name := &ast.Identifier{ast.Node{}, yyDollar[2].token.Value} yyVAL.node = &ast.StmtInterface{ast.Node{}, name, yyDollar[3].InterfaceExtends, yyDollar[5].list} @@ -3602,7 +3631,7 @@ yydefault: } case 96: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:1457 + // line internal/php5/php5.y:1486 { yyVAL.node = &ast.StmtClass{ast.Node{}, nil, nil, nil, nil, nil, nil} @@ -3614,7 +3643,7 @@ yydefault: } case 97: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php5/php5.y:1467 + // line internal/php5/php5.y:1496 { classModifier := &ast.Identifier{ast.Node{}, yyDollar[1].token.Value} yyVAL.node = &ast.StmtClass{ast.Node{}, nil, []ast.Vertex{classModifier}, nil, nil, nil, nil} @@ -3629,7 +3658,7 @@ yydefault: } case 98: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:1480 + // line internal/php5/php5.y:1509 { yyVAL.node = &ast.StmtTrait{ast.Node{}, nil, nil} @@ -3641,7 +3670,7 @@ yydefault: } case 99: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php5/php5.y:1490 + // line internal/php5/php5.y:1519 { classModifier := &ast.Identifier{ast.Node{}, yyDollar[1].token.Value} yyVAL.node = &ast.StmtClass{ast.Node{}, nil, []ast.Vertex{classModifier}, nil, nil, nil, nil} @@ -3656,13 +3685,13 @@ yydefault: } case 100: yyDollar = yyS[yypt-0 : yypt+1] -// line internal/php5/php5.y:1506 + // line internal/php5/php5.y:1535 { yyVAL.ClassExtends = nil } case 101: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php5/php5.y:1510 + // line internal/php5/php5.y:1539 { yyVAL.ClassExtends = &ast.StmtClassExtends{ast.Node{}, yyDollar[2].node} @@ -3674,19 +3703,19 @@ yydefault: } case 102: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:1523 + // line internal/php5/php5.y:1552 { yyVAL.token = yyDollar[1].token } case 103: yyDollar = yyS[yypt-0 : yypt+1] -// line internal/php5/php5.y:1530 + // line internal/php5/php5.y:1559 { yyVAL.InterfaceExtends = nil } case 104: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php5/php5.y:1534 + // line internal/php5/php5.y:1563 { yyVAL.InterfaceExtends = &ast.StmtInterfaceExtends{ast.Node{}, yyDollar[2].list} @@ -3698,13 +3727,13 @@ yydefault: } case 105: yyDollar = yyS[yypt-0 : yypt+1] -// line internal/php5/php5.y:1547 + // line internal/php5/php5.y:1576 { yyVAL.ClassImplements = nil } case 106: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php5/php5.y:1551 + // line internal/php5/php5.y:1580 { yyVAL.ClassImplements = &ast.StmtClassImplements{ast.Node{}, yyDollar[2].list} @@ -3716,13 +3745,13 @@ yydefault: } case 107: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:1564 + // line internal/php5/php5.y:1593 { yyVAL.list = []ast.Vertex{yyDollar[1].node} } case 108: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:1568 + // line internal/php5/php5.y:1597 { yyVAL.list = append(yyDollar[1].list, yyDollar[3].node) @@ -3731,13 +3760,13 @@ yydefault: } case 109: yyDollar = yyS[yypt-0 : yypt+1] -// line internal/php5/php5.y:1578 + // line internal/php5/php5.y:1607 { yyVAL.node = nil } case 110: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php5/php5.y:1582 + // line internal/php5/php5.y:1611 { yyVAL.node = yyDollar[2].node @@ -3746,13 +3775,13 @@ yydefault: } case 111: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:1592 + // line internal/php5/php5.y:1621 { yyVAL.node = yyDollar[1].node } case 112: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php5/php5.y:1596 + // line internal/php5/php5.y:1625 { yyVAL.node = &ast.ExprReference{ast.Node{}, yyDollar[2].node} @@ -3764,7 +3793,7 @@ yydefault: } case 113: yyDollar = yyS[yypt-4 : yypt+1] -// line internal/php5/php5.y:1606 + // line internal/php5/php5.y:1635 { yyVAL.node = &ast.ExprList{ast.Node{}, yyDollar[3].list} @@ -3778,7 +3807,7 @@ yydefault: } case 114: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:1621 + // line internal/php5/php5.y:1650 { yyVAL.node = &ast.StmtFor{ast.Node{}, nil, nil, nil, yyDollar[1].node} @@ -3787,7 +3816,7 @@ yydefault: } case 115: yyDollar = yyS[yypt-4 : yypt+1] -// line internal/php5/php5.y:1628 + // line internal/php5/php5.y:1657 { stmtList := &ast.StmtStmtList{ast.Node{}, yyDollar[2].list} yyVAL.node = &ast.StmtAltFor{ast.Node{}, nil, nil, nil, stmtList} @@ -3804,7 +3833,7 @@ yydefault: } case 116: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:1646 + // line internal/php5/php5.y:1675 { yyVAL.node = &ast.StmtForeach{ast.Node{}, nil, nil, nil, yyDollar[1].node} @@ -3813,7 +3842,7 @@ yydefault: } case 117: yyDollar = yyS[yypt-4 : yypt+1] -// line internal/php5/php5.y:1653 + // line internal/php5/php5.y:1682 { stmtList := &ast.StmtStmtList{ast.Node{}, yyDollar[2].list} yyVAL.node = &ast.StmtAltForeach{ast.Node{}, nil, nil, nil, stmtList} @@ -3830,7 +3859,7 @@ yydefault: } case 118: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:1672 + // line internal/php5/php5.y:1701 { yyVAL.node = &ast.StmtDeclare{ast.Node{}, false, nil, yyDollar[1].node} @@ -3839,7 +3868,7 @@ yydefault: } case 119: yyDollar = yyS[yypt-4 : yypt+1] -// line internal/php5/php5.y:1679 + // line internal/php5/php5.y:1708 { stmtList := &ast.StmtStmtList{ast.Node{}, yyDollar[2].list} yyVAL.node = &ast.StmtDeclare{ast.Node{}, true, nil, stmtList} @@ -3856,7 +3885,7 @@ yydefault: } case 120: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:1698 + // line internal/php5/php5.y:1727 { name := &ast.Identifier{ast.Node{}, yyDollar[1].token.Value} constant := &ast.StmtConstant{ast.Node{}, name, yyDollar[3].node} @@ -3872,7 +3901,7 @@ yydefault: } case 121: yyDollar = yyS[yypt-5 : yypt+1] -// line internal/php5/php5.y:1712 + // line internal/php5/php5.y:1741 { name := &ast.Identifier{ast.Node{}, yyDollar[3].token.Value} constant := &ast.StmtConstant{ast.Node{}, name, yyDollar[5].node} @@ -3889,7 +3918,7 @@ yydefault: } case 122: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:1731 + // line internal/php5/php5.y:1760 { caseList := &ast.StmtCaseList{ast.Node{}, yyDollar[2].list} yyVAL.node = &ast.StmtSwitch{ast.Node{}, nil, caseList} @@ -3904,7 +3933,7 @@ yydefault: } case 123: yyDollar = yyS[yypt-4 : yypt+1] -// line internal/php5/php5.y:1744 + // line internal/php5/php5.y:1773 { caseList := &ast.StmtCaseList{ast.Node{}, yyDollar[3].list} yyVAL.node = &ast.StmtSwitch{ast.Node{}, nil, caseList} @@ -3920,7 +3949,7 @@ yydefault: } case 124: yyDollar = yyS[yypt-4 : yypt+1] -// line internal/php5/php5.y:1758 + // line internal/php5/php5.y:1787 { caseList := &ast.StmtCaseList{ast.Node{}, yyDollar[2].list} yyVAL.node = &ast.StmtAltSwitch{ast.Node{}, nil, caseList} @@ -3937,7 +3966,7 @@ yydefault: } case 125: yyDollar = yyS[yypt-5 : yypt+1] -// line internal/php5/php5.y:1773 + // line internal/php5/php5.y:1802 { caseList := &ast.StmtCaseList{ast.Node{}, yyDollar[3].list} @@ -3956,13 +3985,13 @@ yydefault: } case 126: yyDollar = yyS[yypt-0 : yypt+1] -// line internal/php5/php5.y:1794 + // line internal/php5/php5.y:1823 { yyVAL.list = []ast.Vertex{} } case 127: yyDollar = yyS[yypt-5 : yypt+1] -// line internal/php5/php5.y:1798 + // line internal/php5/php5.y:1827 { _case := &ast.StmtCase{ast.Node{}, yyDollar[3].node, yyDollar[5].list} yyVAL.list = append(yyDollar[1].list, _case) @@ -3977,7 +4006,7 @@ yydefault: } case 128: yyDollar = yyS[yypt-4 : yypt+1] -// line internal/php5/php5.y:1811 + // line internal/php5/php5.y:1840 { _default := &ast.StmtDefault{ast.Node{}, yyDollar[4].list} yyVAL.list = append(yyDollar[1].list, _default) @@ -3992,19 +4021,19 @@ yydefault: } case 129: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:1828 + // line internal/php5/php5.y:1857 { yyVAL.token = yyDollar[1].token } case 130: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:1832 + // line internal/php5/php5.y:1861 { yyVAL.token = yyDollar[1].token } case 131: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:1840 + // line internal/php5/php5.y:1869 { yyVAL.node = &ast.StmtWhile{ast.Node{}, nil, yyDollar[1].node} @@ -4013,7 +4042,7 @@ yydefault: } case 132: yyDollar = yyS[yypt-4 : yypt+1] -// line internal/php5/php5.y:1847 + // line internal/php5/php5.y:1876 { stmtList := &ast.StmtStmtList{ast.Node{}, yyDollar[2].list} yyVAL.node = &ast.StmtAltWhile{ast.Node{}, nil, stmtList} @@ -4030,13 +4059,13 @@ yydefault: } case 133: yyDollar = yyS[yypt-0 : yypt+1] -// line internal/php5/php5.y:1867 + // line internal/php5/php5.y:1896 { yyVAL.list = nil } case 134: yyDollar = yyS[yypt-4 : yypt+1] -// line internal/php5/php5.y:1871 + // line internal/php5/php5.y:1900 { _elseIf := &ast.StmtElseIf{ast.Node{}, yyDollar[3].node, yyDollar[4].node} yyVAL.list = append(yyDollar[1].list, _elseIf) @@ -4049,13 +4078,13 @@ yydefault: } case 135: yyDollar = yyS[yypt-0 : yypt+1] -// line internal/php5/php5.y:1886 + // line internal/php5/php5.y:1915 { yyVAL.list = nil } case 136: yyDollar = yyS[yypt-5 : yypt+1] -// line internal/php5/php5.y:1890 + // line internal/php5/php5.y:1919 { stmts := &ast.StmtStmtList{ast.Node{}, yyDollar[5].list} stmtsBrackets := &ast.ParserBrackets{ast.Node{}, stmts} @@ -4073,13 +4102,13 @@ yydefault: } case 137: yyDollar = yyS[yypt-0 : yypt+1] -// line internal/php5/php5.y:1910 + // line internal/php5/php5.y:1939 { yyVAL.node = nil } case 138: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php5/php5.y:1914 + // line internal/php5/php5.y:1943 { yyVAL.node = &ast.StmtElse{ast.Node{}, yyDollar[2].node} @@ -4091,13 +4120,13 @@ yydefault: } case 139: yyDollar = yyS[yypt-0 : yypt+1] -// line internal/php5/php5.y:1928 + // line internal/php5/php5.y:1957 { yyVAL.node = nil } case 140: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:1932 + // line internal/php5/php5.y:1961 { stmts := &ast.StmtStmtList{ast.Node{}, yyDollar[3].list} stmtsBrackets := &ast.ParserBrackets{ast.Node{}, stmts} @@ -4114,25 +4143,25 @@ yydefault: } case 141: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:1951 + // line internal/php5/php5.y:1980 { yyVAL.list = yyDollar[1].list } case 142: yyDollar = yyS[yypt-0 : yypt+1] -// line internal/php5/php5.y:1955 + // line internal/php5/php5.y:1984 { yyVAL.list = nil } case 143: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:1962 + // line internal/php5/php5.y:1991 { yyVAL.list = []ast.Vertex{yyDollar[1].node} } case 144: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:1966 + // line internal/php5/php5.y:1995 { yyVAL.list = append(yyDollar[1].list, yyDollar[3].node) @@ -4141,7 +4170,7 @@ yydefault: } case 145: yyDollar = yyS[yypt-4 : yypt+1] -// line internal/php5/php5.y:1976 + // line internal/php5/php5.y:2005 { identifier := &ast.Identifier{ast.Node{}, yyDollar[4].token.Value} identifier.GetNode().Position = position.NewTokenPosition(yyDollar[4].token) @@ -4177,7 +4206,7 @@ yydefault: } case 146: yyDollar = yyS[yypt-6 : yypt+1] -// line internal/php5/php5.y:2010 + // line internal/php5/php5.y:2039 { identifier := &ast.Identifier{ast.Node{}, yyDollar[4].token.Value} identifier.GetNode().Position = position.NewTokenPosition(yyDollar[4].token) @@ -4214,13 +4243,13 @@ yydefault: } case 147: yyDollar = yyS[yypt-0 : yypt+1] -// line internal/php5/php5.y:2049 + // line internal/php5/php5.y:2078 { yyVAL.node = nil } case 148: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:2053 + // line internal/php5/php5.y:2082 { yyVAL.node = &ast.Identifier{ast.Node{}, yyDollar[1].token.Value} @@ -4232,7 +4261,7 @@ yydefault: } case 149: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:2063 + // line internal/php5/php5.y:2092 { yyVAL.node = &ast.Identifier{ast.Node{}, yyDollar[1].token.Value} @@ -4244,13 +4273,13 @@ yydefault: } case 150: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:2073 + // line internal/php5/php5.y:2102 { yyVAL.node = yyDollar[1].node } case 151: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php5/php5.y:2081 + // line internal/php5/php5.y:2110 { yyVAL.node = &ast.ArgumentList{ast.Node{}, nil} @@ -4263,7 +4292,7 @@ yydefault: } case 152: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:2092 + // line internal/php5/php5.y:2121 { yyVAL.node = &ast.ArgumentList{ast.Node{}, yyDollar[2].list} @@ -4276,7 +4305,7 @@ yydefault: } case 153: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:2103 + // line internal/php5/php5.y:2132 { arg := &ast.Argument{ast.Node{}, false, false, yyDollar[2].node} yyVAL.node = &ast.ArgumentList{ast.Node{}, []ast.Vertex{arg}} @@ -4291,13 +4320,13 @@ yydefault: } case 154: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:2120 + // line internal/php5/php5.y:2149 { yyVAL.list = []ast.Vertex{yyDollar[1].node} } case 155: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:2124 + // line internal/php5/php5.y:2153 { yyVAL.list = append(yyDollar[1].list, yyDollar[3].node) @@ -4306,7 +4335,7 @@ yydefault: } case 156: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:2134 + // line internal/php5/php5.y:2163 { yyVAL.node = &ast.Argument{ast.Node{}, false, false, yyDollar[1].node} @@ -4318,7 +4347,7 @@ yydefault: } case 157: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:2144 + // line internal/php5/php5.y:2173 { yyVAL.node = &ast.Argument{ast.Node{}, false, false, yyDollar[1].node} @@ -4330,7 +4359,7 @@ yydefault: } case 158: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php5/php5.y:2154 + // line internal/php5/php5.y:2183 { yyVAL.node = &ast.Argument{ast.Node{}, false, true, yyDollar[2].node} @@ -4342,7 +4371,7 @@ yydefault: } case 159: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php5/php5.y:2164 + // line internal/php5/php5.y:2193 { yyVAL.node = &ast.Argument{ast.Node{}, true, false, yyDollar[2].node} @@ -4354,7 +4383,7 @@ yydefault: } case 160: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:2177 + // line internal/php5/php5.y:2206 { yyVAL.list = append(yyDollar[1].list, yyDollar[3].node) @@ -4363,13 +4392,13 @@ yydefault: } case 161: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:2184 + // line internal/php5/php5.y:2213 { yyVAL.list = []ast.Vertex{yyDollar[1].node} } case 162: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:2192 + // line internal/php5/php5.y:2221 { name := &ast.Identifier{ast.Node{}, yyDollar[1].token.Value} yyVAL.node = &ast.ExprVariable{ast.Node{}, name} @@ -4383,7 +4412,7 @@ yydefault: } case 163: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php5/php5.y:2204 + // line internal/php5/php5.y:2233 { yyVAL.node = &ast.ExprVariable{ast.Node{}, yyDollar[2].node} @@ -4395,7 +4424,7 @@ yydefault: } case 164: yyDollar = yyS[yypt-4 : yypt+1] -// line internal/php5/php5.y:2214 + // line internal/php5/php5.y:2243 { yyVAL.node = &ast.ExprVariable{ast.Node{}, yyDollar[3].node} @@ -4409,7 +4438,7 @@ yydefault: } case 165: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:2230 + // line internal/php5/php5.y:2259 { identifier := &ast.Identifier{ast.Node{}, yyDollar[3].token.Value} variable := &ast.ExprVariable{ast.Node{}, identifier} @@ -4427,7 +4456,7 @@ yydefault: } case 166: yyDollar = yyS[yypt-5 : yypt+1] -// line internal/php5/php5.y:2246 + // line internal/php5/php5.y:2275 { identifier := &ast.Identifier{ast.Node{}, yyDollar[3].token.Value} variable := &ast.ExprVariable{ast.Node{}, identifier} @@ -4446,7 +4475,7 @@ yydefault: } case 167: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:2263 + // line internal/php5/php5.y:2292 { identifier := &ast.Identifier{ast.Node{}, yyDollar[1].token.Value} variable := &ast.ExprVariable{ast.Node{}, identifier} @@ -4463,7 +4492,7 @@ yydefault: } case 168: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:2278 + // line internal/php5/php5.y:2307 { identifier := &ast.Identifier{ast.Node{}, yyDollar[1].token.Value} variable := &ast.ExprVariable{ast.Node{}, identifier} @@ -4481,19 +4510,19 @@ yydefault: } case 169: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php5/php5.y:2298 + // line internal/php5/php5.y:2327 { yyVAL.list = append(yyDollar[1].list, yyDollar[2].node) } case 170: yyDollar = yyS[yypt-0 : yypt+1] -// line internal/php5/php5.y:2302 + // line internal/php5/php5.y:2331 { yyVAL.list = []ast.Vertex{} } case 171: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:2310 + // line internal/php5/php5.y:2339 { yyVAL.node = &ast.StmtPropertyList{ast.Node{}, yyDollar[1].list, nil, yyDollar[2].list} @@ -4507,7 +4536,7 @@ yydefault: } case 172: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php5/php5.y:2322 + // line internal/php5/php5.y:2351 { yyVAL.node = yyDollar[1].node @@ -4520,13 +4549,13 @@ yydefault: } case 173: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:2333 + // line internal/php5/php5.y:2362 { yyVAL.node = yyDollar[1].node } case 174: yyDollar = yyS[yypt-8 : yypt+1] -// line internal/php5/php5.y:2337 + // line internal/php5/php5.y:2366 { name := &ast.Identifier{ast.Node{}, yyDollar[4].token.Value} yyVAL.node = &ast.StmtClassMethod{ast.Node{}, yyDollar[3].token != nil, name, yyDollar[1].list, yyDollar[6].list, nil, yyDollar[8].node} @@ -4557,7 +4586,7 @@ yydefault: } case 175: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:2369 + // line internal/php5/php5.y:2398 { yyVAL.node = &ast.StmtTraitUse{ast.Node{}, yyDollar[2].list, yyDollar[3].node} @@ -4569,13 +4598,13 @@ yydefault: } case 176: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:2382 + // line internal/php5/php5.y:2411 { yyVAL.list = []ast.Vertex{yyDollar[1].node} } case 177: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:2386 + // line internal/php5/php5.y:2415 { yyVAL.list = append(yyDollar[1].list, yyDollar[3].node) @@ -4584,7 +4613,7 @@ yydefault: } case 178: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:2396 + // line internal/php5/php5.y:2425 { yyVAL.node = &ast.StmtNop{ast.Node{}} @@ -4596,7 +4625,7 @@ yydefault: } case 179: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:2406 + // line internal/php5/php5.y:2435 { yyVAL.node = &ast.StmtTraitAdaptationList{ast.Node{}, yyDollar[2].list} @@ -4608,31 +4637,31 @@ yydefault: } case 180: yyDollar = yyS[yypt-0 : yypt+1] -// line internal/php5/php5.y:2419 + // line internal/php5/php5.y:2448 { yyVAL.list = nil } case 181: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:2423 + // line internal/php5/php5.y:2452 { yyVAL.list = yyDollar[1].list } case 182: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:2430 + // line internal/php5/php5.y:2459 { yyVAL.list = []ast.Vertex{yyDollar[1].node} } case 183: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php5/php5.y:2434 + // line internal/php5/php5.y:2463 { yyVAL.list = append(yyDollar[1].list, yyDollar[2].node) } case 184: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php5/php5.y:2441 + // line internal/php5/php5.y:2470 { yyVAL.node = yyDollar[1].node @@ -4642,7 +4671,7 @@ yydefault: } case 185: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php5/php5.y:2449 + // line internal/php5/php5.y:2478 { yyVAL.node = yyDollar[1].node @@ -4652,7 +4681,7 @@ yydefault: } case 186: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:2460 + // line internal/php5/php5.y:2489 { yyVAL.node = &ast.StmtTraitUsePrecedence{ast.Node{}, yyDollar[1].node, yyDollar[3].list} @@ -4665,13 +4694,13 @@ yydefault: } case 187: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:2474 + // line internal/php5/php5.y:2503 { yyVAL.list = []ast.Vertex{yyDollar[1].node} } case 188: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:2478 + // line internal/php5/php5.y:2507 { yyVAL.list = append(yyDollar[1].list, yyDollar[3].node) @@ -4680,7 +4709,7 @@ yydefault: } case 189: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:2488 + // line internal/php5/php5.y:2517 { name := &ast.Identifier{ast.Node{}, yyDollar[1].token.Value} yyVAL.node = &ast.StmtTraitMethodRef{ast.Node{}, nil, name} @@ -4694,13 +4723,13 @@ yydefault: } case 190: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:2500 + // line internal/php5/php5.y:2529 { yyVAL.node = yyDollar[1].node } case 191: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:2507 + // line internal/php5/php5.y:2536 { target := &ast.Identifier{ast.Node{}, yyDollar[3].token.Value} yyVAL.node = &ast.StmtTraitMethodRef{ast.Node{}, yyDollar[1].node, target} @@ -4716,7 +4745,7 @@ yydefault: } case 192: yyDollar = yyS[yypt-4 : yypt+1] -// line internal/php5/php5.y:2524 + // line internal/php5/php5.y:2553 { alias := &ast.Identifier{ast.Node{}, yyDollar[4].token.Value} yyVAL.node = &ast.StmtTraitUseAlias{ast.Node{}, yyDollar[1].node, yyDollar[3].node, alias} @@ -4732,7 +4761,7 @@ yydefault: } case 193: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:2538 + // line internal/php5/php5.y:2567 { yyVAL.node = &ast.StmtTraitUseAlias{ast.Node{}, yyDollar[1].node, yyDollar[3].node, nil} @@ -4745,19 +4774,19 @@ yydefault: } case 194: yyDollar = yyS[yypt-0 : yypt+1] -// line internal/php5/php5.y:2552 + // line internal/php5/php5.y:2581 { yyVAL.node = nil } case 195: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:2556 + // line internal/php5/php5.y:2585 { yyVAL.node = yyDollar[1].node } case 196: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:2563 + // line internal/php5/php5.y:2592 { yyVAL.node = &ast.StmtNop{ast.Node{}} @@ -4770,7 +4799,7 @@ yydefault: } case 197: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:2574 + // line internal/php5/php5.y:2603 { yyVAL.node = &ast.StmtStmtList{ast.Node{}, yyDollar[2].list} @@ -4783,13 +4812,13 @@ yydefault: } case 198: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:2588 + // line internal/php5/php5.y:2617 { yyVAL.list = yyDollar[1].list } case 199: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:2592 + // line internal/php5/php5.y:2621 { modifier := &ast.Identifier{ast.Node{}, yyDollar[1].token.Value} yyVAL.list = []ast.Vertex{modifier} @@ -4802,31 +4831,31 @@ yydefault: } case 200: yyDollar = yyS[yypt-0 : yypt+1] -// line internal/php5/php5.y:2606 + // line internal/php5/php5.y:2635 { yyVAL.list = nil } case 201: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:2610 + // line internal/php5/php5.y:2639 { yyVAL.list = yyDollar[1].list } case 202: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:2617 + // line internal/php5/php5.y:2646 { yyVAL.list = []ast.Vertex{yyDollar[1].node} } case 203: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php5/php5.y:2621 + // line internal/php5/php5.y:2650 { yyVAL.list = append(yyDollar[1].list, yyDollar[2].node) } case 204: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:2628 + // line internal/php5/php5.y:2657 { yyVAL.node = &ast.Identifier{ast.Node{}, yyDollar[1].token.Value} @@ -4838,7 +4867,7 @@ yydefault: } case 205: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:2638 + // line internal/php5/php5.y:2667 { yyVAL.node = &ast.Identifier{ast.Node{}, yyDollar[1].token.Value} @@ -4850,7 +4879,7 @@ yydefault: } case 206: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:2648 + // line internal/php5/php5.y:2677 { yyVAL.node = &ast.Identifier{ast.Node{}, yyDollar[1].token.Value} @@ -4862,7 +4891,7 @@ yydefault: } case 207: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:2658 + // line internal/php5/php5.y:2687 { yyVAL.node = &ast.Identifier{ast.Node{}, yyDollar[1].token.Value} @@ -4874,7 +4903,7 @@ yydefault: } case 208: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:2668 + // line internal/php5/php5.y:2697 { yyVAL.node = &ast.Identifier{ast.Node{}, yyDollar[1].token.Value} @@ -4886,7 +4915,7 @@ yydefault: } case 209: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:2678 + // line internal/php5/php5.y:2707 { yyVAL.node = &ast.Identifier{ast.Node{}, yyDollar[1].token.Value} @@ -4898,7 +4927,7 @@ yydefault: } case 210: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:2691 + // line internal/php5/php5.y:2720 { identifier := &ast.Identifier{ast.Node{}, yyDollar[3].token.Value} variable := &ast.ExprVariable{ast.Node{}, identifier} @@ -4916,7 +4945,7 @@ yydefault: } case 211: yyDollar = yyS[yypt-5 : yypt+1] -// line internal/php5/php5.y:2707 + // line internal/php5/php5.y:2736 { identifier := &ast.Identifier{ast.Node{}, yyDollar[3].token.Value} variable := &ast.ExprVariable{ast.Node{}, identifier} @@ -4935,7 +4964,7 @@ yydefault: } case 212: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:2724 + // line internal/php5/php5.y:2753 { identifier := &ast.Identifier{ast.Node{}, yyDollar[1].token.Value} variable := &ast.ExprVariable{ast.Node{}, identifier} @@ -4952,7 +4981,7 @@ yydefault: } case 213: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:2739 + // line internal/php5/php5.y:2768 { identifier := &ast.Identifier{ast.Node{}, yyDollar[1].token.Value} variable := &ast.ExprVariable{ast.Node{}, identifier} @@ -4970,7 +4999,7 @@ yydefault: } case 214: yyDollar = yyS[yypt-5 : yypt+1] -// line internal/php5/php5.y:2758 + // line internal/php5/php5.y:2787 { name := &ast.Identifier{ast.Node{}, yyDollar[3].token.Value} constant := &ast.StmtConstant{ast.Node{}, name, yyDollar[5].node} @@ -4991,7 +5020,7 @@ yydefault: } case 215: yyDollar = yyS[yypt-4 : yypt+1] -// line internal/php5/php5.y:2777 + // line internal/php5/php5.y:2806 { name := &ast.Identifier{ast.Node{}, yyDollar[2].token.Value} constant := &ast.StmtConstant{ast.Node{}, name, yyDollar[4].node} @@ -5009,7 +5038,7 @@ yydefault: } case 216: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:2796 + // line internal/php5/php5.y:2825 { yyVAL.list = append(yyDollar[1].list, yyDollar[3].node) @@ -5018,25 +5047,25 @@ yydefault: } case 217: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:2803 + // line internal/php5/php5.y:2832 { yyVAL.list = []ast.Vertex{yyDollar[1].node} } case 218: yyDollar = yyS[yypt-0 : yypt+1] -// line internal/php5/php5.y:2811 + // line internal/php5/php5.y:2840 { yyVAL.list = nil } case 219: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:2815 + // line internal/php5/php5.y:2844 { yyVAL.list = yyDollar[1].list } case 220: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:2822 + // line internal/php5/php5.y:2851 { yyVAL.list = append(yyDollar[1].list, yyDollar[3].node) @@ -5045,25 +5074,25 @@ yydefault: } case 221: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:2829 + // line internal/php5/php5.y:2858 { yyVAL.list = []ast.Vertex{yyDollar[1].node} } case 222: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php5/php5.y:2836 + // line internal/php5/php5.y:2865 { yyVAL.list = append(yyDollar[1].list, yyDollar[2].list...) } case 223: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:2840 + // line internal/php5/php5.y:2869 { yyVAL.list = yyDollar[1].list } case 224: yyDollar = yyS[yypt-4 : yypt+1] -// line internal/php5/php5.y:2847 + // line internal/php5/php5.y:2876 { fetch := &ast.ExprArrayDimFetch{ast.Node{}, nil, yyDollar[3].node} yyVAL.list = append(yyDollar[1].list, fetch) @@ -5077,7 +5106,7 @@ yydefault: } case 225: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:2859 + // line internal/php5/php5.y:2888 { fetch := &ast.ExprArrayDimFetch{ast.Node{}, nil, yyDollar[2].node} yyVAL.list = []ast.Vertex{fetch} @@ -5091,37 +5120,37 @@ yydefault: } case 226: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php5/php5.y:2874 + // line internal/php5/php5.y:2903 { yyVAL.list = append(yyDollar[1].list, yyDollar[2].list...) } case 227: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:2878 + // line internal/php5/php5.y:2907 { yyVAL.list = yyDollar[1].list } case 228: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:2882 + // line internal/php5/php5.y:2911 { yyVAL.list = yyDollar[1].list } case 229: yyDollar = yyS[yypt-0 : yypt+1] -// line internal/php5/php5.y:2889 + // line internal/php5/php5.y:2918 { yyVAL.list = nil } case 230: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:2893 + // line internal/php5/php5.y:2922 { yyVAL.list = yyDollar[1].list } case 231: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:2900 + // line internal/php5/php5.y:2929 { if yyDollar[3].node != nil { @@ -5137,7 +5166,7 @@ yydefault: } case 232: yyDollar = yyS[yypt-6 : yypt+1] -// line internal/php5/php5.y:2917 + // line internal/php5/php5.y:2946 { listNode := &ast.ExprList{ast.Node{}, yyDollar[3].list} yyVAL.node = &ast.ExprAssign{ast.Node{}, listNode, yyDollar[6].node} @@ -5154,7 +5183,7 @@ yydefault: } case 233: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:2932 + // line internal/php5/php5.y:2961 { yyVAL.node = &ast.ExprAssign{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -5167,7 +5196,7 @@ yydefault: } case 234: yyDollar = yyS[yypt-4 : yypt+1] -// line internal/php5/php5.y:2943 + // line internal/php5/php5.y:2972 { yyVAL.node = &ast.ExprAssignReference{ast.Node{}, yyDollar[1].node, yyDollar[4].node} @@ -5181,7 +5210,7 @@ yydefault: } case 235: yyDollar = yyS[yypt-6 : yypt+1] -// line internal/php5/php5.y:2955 + // line internal/php5/php5.y:2984 { var _new *ast.ExprNew @@ -5208,7 +5237,7 @@ yydefault: } case 236: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php5/php5.y:2980 + // line internal/php5/php5.y:3009 { yyVAL.node = &ast.ExprClone{ast.Node{}, yyDollar[2].node} @@ -5220,7 +5249,7 @@ yydefault: } case 237: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:2990 + // line internal/php5/php5.y:3019 { yyVAL.node = &ast.ExprAssignPlus{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -5232,7 +5261,7 @@ yydefault: } case 238: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:3000 + // line internal/php5/php5.y:3029 { yyVAL.node = &ast.ExprAssignMinus{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -5245,7 +5274,7 @@ yydefault: } case 239: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:3011 + // line internal/php5/php5.y:3040 { yyVAL.node = &ast.ExprAssignMul{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -5258,7 +5287,7 @@ yydefault: } case 240: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:3022 + // line internal/php5/php5.y:3051 { yyVAL.node = &ast.ExprAssignPow{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -5271,7 +5300,7 @@ yydefault: } case 241: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:3033 + // line internal/php5/php5.y:3062 { yyVAL.node = &ast.ExprAssignDiv{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -5284,7 +5313,7 @@ yydefault: } case 242: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:3044 + // line internal/php5/php5.y:3073 { yyVAL.node = &ast.ExprAssignConcat{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -5297,7 +5326,7 @@ yydefault: } case 243: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:3055 + // line internal/php5/php5.y:3084 { yyVAL.node = &ast.ExprAssignMod{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -5310,7 +5339,7 @@ yydefault: } case 244: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:3066 + // line internal/php5/php5.y:3095 { yyVAL.node = &ast.ExprAssignBitwiseAnd{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -5323,7 +5352,7 @@ yydefault: } case 245: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:3077 + // line internal/php5/php5.y:3106 { yyVAL.node = &ast.ExprAssignBitwiseOr{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -5336,7 +5365,7 @@ yydefault: } case 246: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:3088 + // line internal/php5/php5.y:3117 { yyVAL.node = &ast.ExprAssignBitwiseXor{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -5349,7 +5378,7 @@ yydefault: } case 247: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:3099 + // line internal/php5/php5.y:3128 { yyVAL.node = &ast.ExprAssignShiftLeft{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -5362,7 +5391,7 @@ yydefault: } case 248: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:3110 + // line internal/php5/php5.y:3139 { yyVAL.node = &ast.ExprAssignShiftRight{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -5375,7 +5404,7 @@ yydefault: } case 249: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php5/php5.y:3121 + // line internal/php5/php5.y:3150 { yyVAL.node = &ast.ExprPostInc{ast.Node{}, yyDollar[1].node} @@ -5388,7 +5417,7 @@ yydefault: } case 250: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php5/php5.y:3132 + // line internal/php5/php5.y:3161 { yyVAL.node = &ast.ExprPreInc{ast.Node{}, yyDollar[2].node} @@ -5400,7 +5429,7 @@ yydefault: } case 251: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php5/php5.y:3142 + // line internal/php5/php5.y:3171 { yyVAL.node = &ast.ExprPostDec{ast.Node{}, yyDollar[1].node} @@ -5413,7 +5442,7 @@ yydefault: } case 252: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php5/php5.y:3153 + // line internal/php5/php5.y:3182 { yyVAL.node = &ast.ExprPreDec{ast.Node{}, yyDollar[2].node} @@ -5425,7 +5454,7 @@ yydefault: } case 253: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:3163 + // line internal/php5/php5.y:3192 { yyVAL.node = &ast.ExprBinaryBooleanOr{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -5438,7 +5467,7 @@ yydefault: } case 254: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:3174 + // line internal/php5/php5.y:3203 { yyVAL.node = &ast.ExprBinaryBooleanAnd{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -5451,7 +5480,7 @@ yydefault: } case 255: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:3185 + // line internal/php5/php5.y:3214 { yyVAL.node = &ast.ExprBinaryLogicalOr{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -5464,7 +5493,7 @@ yydefault: } case 256: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:3196 + // line internal/php5/php5.y:3225 { yyVAL.node = &ast.ExprBinaryLogicalAnd{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -5477,7 +5506,7 @@ yydefault: } case 257: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:3207 + // line internal/php5/php5.y:3236 { yyVAL.node = &ast.ExprBinaryLogicalXor{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -5490,7 +5519,7 @@ yydefault: } case 258: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:3218 + // line internal/php5/php5.y:3247 { yyVAL.node = &ast.ExprBinaryBitwiseOr{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -5503,7 +5532,7 @@ yydefault: } case 259: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:3229 + // line internal/php5/php5.y:3258 { yyVAL.node = &ast.ExprBinaryBitwiseAnd{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -5516,7 +5545,7 @@ yydefault: } case 260: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:3240 + // line internal/php5/php5.y:3269 { yyVAL.node = &ast.ExprBinaryBitwiseXor{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -5529,7 +5558,7 @@ yydefault: } case 261: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:3251 + // line internal/php5/php5.y:3280 { yyVAL.node = &ast.ExprBinaryConcat{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -5542,7 +5571,7 @@ yydefault: } case 262: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:3262 + // line internal/php5/php5.y:3291 { yyVAL.node = &ast.ExprBinaryPlus{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -5555,7 +5584,7 @@ yydefault: } case 263: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:3273 + // line internal/php5/php5.y:3302 { yyVAL.node = &ast.ExprBinaryMinus{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -5568,7 +5597,7 @@ yydefault: } case 264: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:3284 + // line internal/php5/php5.y:3313 { yyVAL.node = &ast.ExprBinaryMul{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -5581,7 +5610,7 @@ yydefault: } case 265: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:3295 + // line internal/php5/php5.y:3324 { yyVAL.node = &ast.ExprBinaryPow{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -5594,7 +5623,7 @@ yydefault: } case 266: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:3306 + // line internal/php5/php5.y:3335 { yyVAL.node = &ast.ExprBinaryDiv{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -5607,7 +5636,7 @@ yydefault: } case 267: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:3317 + // line internal/php5/php5.y:3346 { yyVAL.node = &ast.ExprBinaryMod{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -5620,7 +5649,7 @@ yydefault: } case 268: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:3328 + // line internal/php5/php5.y:3357 { yyVAL.node = &ast.ExprBinaryShiftLeft{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -5633,7 +5662,7 @@ yydefault: } case 269: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:3339 + // line internal/php5/php5.y:3368 { yyVAL.node = &ast.ExprBinaryShiftRight{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -5646,7 +5675,7 @@ yydefault: } case 270: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php5/php5.y:3350 + // line internal/php5/php5.y:3379 { yyVAL.node = &ast.ExprUnaryPlus{ast.Node{}, yyDollar[2].node} @@ -5658,7 +5687,7 @@ yydefault: } case 271: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php5/php5.y:3360 + // line internal/php5/php5.y:3389 { yyVAL.node = &ast.ExprUnaryMinus{ast.Node{}, yyDollar[2].node} @@ -5670,7 +5699,7 @@ yydefault: } case 272: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php5/php5.y:3370 + // line internal/php5/php5.y:3399 { yyVAL.node = &ast.ExprBooleanNot{ast.Node{}, yyDollar[2].node} @@ -5682,7 +5711,7 @@ yydefault: } case 273: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php5/php5.y:3380 + // line internal/php5/php5.y:3409 { yyVAL.node = &ast.ExprBitwiseNot{ast.Node{}, yyDollar[2].node} @@ -5694,7 +5723,7 @@ yydefault: } case 274: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:3390 + // line internal/php5/php5.y:3419 { yyVAL.node = &ast.ExprBinaryIdentical{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -5707,7 +5736,7 @@ yydefault: } case 275: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:3401 + // line internal/php5/php5.y:3430 { yyVAL.node = &ast.ExprBinaryNotIdentical{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -5720,7 +5749,7 @@ yydefault: } case 276: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:3412 + // line internal/php5/php5.y:3441 { yyVAL.node = &ast.ExprBinaryEqual{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -5733,7 +5762,7 @@ yydefault: } case 277: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:3423 + // line internal/php5/php5.y:3452 { yyVAL.node = &ast.ExprBinaryNotEqual{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -5747,7 +5776,7 @@ yydefault: } case 278: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:3435 + // line internal/php5/php5.y:3464 { yyVAL.node = &ast.ExprBinarySmaller{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -5760,7 +5789,7 @@ yydefault: } case 279: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:3446 + // line internal/php5/php5.y:3475 { yyVAL.node = &ast.ExprBinarySmallerOrEqual{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -5773,7 +5802,7 @@ yydefault: } case 280: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:3457 + // line internal/php5/php5.y:3486 { yyVAL.node = &ast.ExprBinaryGreater{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -5786,7 +5815,7 @@ yydefault: } case 281: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:3468 + // line internal/php5/php5.y:3497 { yyVAL.node = &ast.ExprBinaryGreaterOrEqual{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -5799,7 +5828,7 @@ yydefault: } case 282: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:3479 + // line internal/php5/php5.y:3508 { yyVAL.node = &ast.ExprInstanceOf{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -5812,19 +5841,19 @@ yydefault: } case 283: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:3490 + // line internal/php5/php5.y:3519 { yyVAL.node = yyDollar[1].node } case 284: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:3494 + // line internal/php5/php5.y:3523 { yyVAL.node = yyDollar[1].node } case 285: yyDollar = yyS[yypt-4 : yypt+1] -// line internal/php5/php5.y:3498 + // line internal/php5/php5.y:3527 { yyVAL.node = yyDollar[2].node @@ -5856,7 +5885,7 @@ yydefault: } case 286: yyDollar = yyS[yypt-5 : yypt+1] -// line internal/php5/php5.y:3528 + // line internal/php5/php5.y:3557 { yyVAL.node = &ast.ExprTernary{ast.Node{}, yyDollar[1].node, yyDollar[3].node, yyDollar[5].node} @@ -5870,7 +5899,7 @@ yydefault: } case 287: yyDollar = yyS[yypt-4 : yypt+1] -// line internal/php5/php5.y:3540 + // line internal/php5/php5.y:3569 { yyVAL.node = &ast.ExprTernary{ast.Node{}, yyDollar[1].node, nil, yyDollar[4].node} @@ -5884,13 +5913,13 @@ yydefault: } case 288: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:3552 + // line internal/php5/php5.y:3581 { yyVAL.node = yyDollar[1].node } case 289: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php5/php5.y:3556 + // line internal/php5/php5.y:3585 { yyVAL.node = &ast.ExprCastInt{ast.Node{}, yyDollar[2].node} @@ -5903,7 +5932,7 @@ yydefault: } case 290: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php5/php5.y:3567 + // line internal/php5/php5.y:3596 { yyVAL.node = &ast.ExprCastDouble{ast.Node{}, yyDollar[2].node} @@ -5916,7 +5945,7 @@ yydefault: } case 291: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php5/php5.y:3578 + // line internal/php5/php5.y:3607 { yyVAL.node = &ast.ExprCastString{ast.Node{}, yyDollar[2].node} @@ -5929,7 +5958,7 @@ yydefault: } case 292: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php5/php5.y:3589 + // line internal/php5/php5.y:3618 { yyVAL.node = &ast.ExprCastArray{ast.Node{}, yyDollar[2].node} @@ -5942,7 +5971,7 @@ yydefault: } case 293: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php5/php5.y:3600 + // line internal/php5/php5.y:3629 { yyVAL.node = &ast.ExprCastObject{ast.Node{}, yyDollar[2].node} @@ -5955,7 +5984,7 @@ yydefault: } case 294: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php5/php5.y:3611 + // line internal/php5/php5.y:3640 { yyVAL.node = &ast.ExprCastBool{ast.Node{}, yyDollar[2].node} @@ -5968,7 +5997,7 @@ yydefault: } case 295: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php5/php5.y:3622 + // line internal/php5/php5.y:3651 { yyVAL.node = &ast.ExprCastUnset{ast.Node{}, yyDollar[2].node} @@ -5981,7 +6010,7 @@ yydefault: } case 296: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php5/php5.y:3633 + // line internal/php5/php5.y:3662 { yyVAL.node = &ast.ExprExit{ast.Node{}, false, yyDollar[2].node} @@ -6001,7 +6030,7 @@ yydefault: } case 297: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php5/php5.y:3651 + // line internal/php5/php5.y:3680 { yyVAL.node = &ast.ExprErrorSuppress{ast.Node{}, yyDollar[2].node} @@ -6013,25 +6042,25 @@ yydefault: } case 298: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:3661 + // line internal/php5/php5.y:3690 { yyVAL.node = yyDollar[1].node } case 299: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:3665 + // line internal/php5/php5.y:3694 { yyVAL.node = yyDollar[1].node } case 300: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:3669 + // line internal/php5/php5.y:3698 { yyVAL.node = yyDollar[1].node } case 301: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:3673 + // line internal/php5/php5.y:3702 { yyVAL.node = &ast.ExprShellExec{ast.Node{}, yyDollar[2].list} @@ -6043,7 +6072,7 @@ yydefault: } case 302: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php5/php5.y:3683 + // line internal/php5/php5.y:3712 { yyVAL.node = &ast.ExprPrint{ast.Node{}, yyDollar[2].node} @@ -6055,7 +6084,7 @@ yydefault: } case 303: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:3693 + // line internal/php5/php5.y:3722 { yyVAL.node = &ast.ExprYield{ast.Node{}, nil, nil} @@ -6067,7 +6096,7 @@ yydefault: } case 304: yyDollar = yyS[yypt-9 : yypt+1] -// line internal/php5/php5.y:3703 + // line internal/php5/php5.y:3732 { yyVAL.node = &ast.ExprClosure{ast.Node{}, yyDollar[2].token != nil, false, yyDollar[4].list, yyDollar[6].ClosureUse, nil, yyDollar[8].list} @@ -6094,7 +6123,7 @@ yydefault: } case 305: yyDollar = yyS[yypt-10 : yypt+1] -// line internal/php5/php5.y:3727 + // line internal/php5/php5.y:3756 { yyVAL.node = &ast.ExprClosure{ast.Node{}, yyDollar[3].token != nil, true, yyDollar[5].list, yyDollar[7].ClosureUse, nil, yyDollar[9].list} @@ -6122,7 +6151,7 @@ yydefault: } case 306: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php5/php5.y:3755 + // line internal/php5/php5.y:3784 { yyVAL.node = &ast.ExprYield{ast.Node{}, nil, yyDollar[2].node} @@ -6134,7 +6163,7 @@ yydefault: } case 307: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php5/php5.y:3765 + // line internal/php5/php5.y:3794 { yyVAL.node = &ast.ExprYield{ast.Node{}, nil, yyDollar[2].node} @@ -6146,7 +6175,7 @@ yydefault: } case 308: yyDollar = yyS[yypt-4 : yypt+1] -// line internal/php5/php5.y:3775 + // line internal/php5/php5.y:3804 { yyVAL.node = &ast.ExprYield{ast.Node{}, yyDollar[2].node, yyDollar[4].node} @@ -6159,7 +6188,7 @@ yydefault: } case 309: yyDollar = yyS[yypt-4 : yypt+1] -// line internal/php5/php5.y:3786 + // line internal/php5/php5.y:3815 { yyVAL.node = &ast.ExprYield{ast.Node{}, yyDollar[2].node, yyDollar[4].node} @@ -6172,7 +6201,7 @@ yydefault: } case 310: yyDollar = yyS[yypt-4 : yypt+1] -// line internal/php5/php5.y:3800 + // line internal/php5/php5.y:3829 { yyVAL.node = &ast.ExprArrayDimFetch{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -6185,7 +6214,7 @@ yydefault: } case 311: yyDollar = yyS[yypt-4 : yypt+1] -// line internal/php5/php5.y:3811 + // line internal/php5/php5.y:3840 { yyVAL.node = &ast.ExprArrayDimFetch{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -6198,7 +6227,7 @@ yydefault: } case 312: yyDollar = yyS[yypt-4 : yypt+1] -// line internal/php5/php5.y:3822 + // line internal/php5/php5.y:3851 { str := &ast.ScalarString{ast.Node{}, yyDollar[1].token.Value} yyVAL.node = &ast.ExprArrayDimFetch{ast.Node{}, str, yyDollar[3].node} @@ -6214,7 +6243,7 @@ yydefault: } case 313: yyDollar = yyS[yypt-4 : yypt+1] -// line internal/php5/php5.y:3836 + // line internal/php5/php5.y:3865 { yyVAL.node = &ast.ExprArrayDimFetch{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -6227,7 +6256,7 @@ yydefault: } case 314: yyDollar = yyS[yypt-4 : yypt+1] -// line internal/php5/php5.y:3850 + // line internal/php5/php5.y:3879 { yyVAL.node = &ast.ExprArray{ast.Node{}, yyDollar[3].list} @@ -6241,7 +6270,7 @@ yydefault: } case 315: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:3862 + // line internal/php5/php5.y:3891 { yyVAL.node = &ast.ExprShortArray{ast.Node{}, yyDollar[2].list} @@ -6254,19 +6283,19 @@ yydefault: } case 316: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:3876 + // line internal/php5/php5.y:3905 { yyVAL.token = yyDollar[1].token } case 317: yyDollar = yyS[yypt-0 : yypt+1] -// line internal/php5/php5.y:3883 + // line internal/php5/php5.y:3912 { yyVAL.ClosureUse = nil } case 318: yyDollar = yyS[yypt-4 : yypt+1] -// line internal/php5/php5.y:3887 + // line internal/php5/php5.y:3916 { yyVAL.ClosureUse = &ast.ExprClosureUse{ast.Node{}, yyDollar[3].list} @@ -6280,7 +6309,7 @@ yydefault: } case 319: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:3902 + // line internal/php5/php5.y:3931 { identifier := &ast.Identifier{ast.Node{}, yyDollar[3].token.Value} variable := &ast.ExprVariable{ast.Node{}, identifier} @@ -6296,7 +6325,7 @@ yydefault: } case 320: yyDollar = yyS[yypt-4 : yypt+1] -// line internal/php5/php5.y:3916 + // line internal/php5/php5.y:3945 { identifier := &ast.Identifier{ast.Node{}, yyDollar[4].token.Value} variable := &ast.ExprVariable{ast.Node{}, identifier} @@ -6315,7 +6344,7 @@ yydefault: } case 321: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:3933 + // line internal/php5/php5.y:3962 { identifier := &ast.Identifier{ast.Node{}, yyDollar[1].token.Value} variable := &ast.ExprVariable{ast.Node{}, identifier} @@ -6330,7 +6359,7 @@ yydefault: } case 322: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php5/php5.y:3946 + // line internal/php5/php5.y:3975 { identifier := &ast.Identifier{ast.Node{}, yyDollar[2].token.Value} variable := &ast.ExprVariable{ast.Node{}, identifier} @@ -6348,7 +6377,7 @@ yydefault: } case 323: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php5/php5.y:3965 + // line internal/php5/php5.y:3994 { name := &ast.NameName{ast.Node{}, yyDollar[1].list} yyVAL.node = &ast.ExprFunctionCall{ast.Node{}, name, yyDollar[2].node.(*ast.ArgumentList)} @@ -6359,7 +6388,7 @@ yydefault: } case 324: yyDollar = yyS[yypt-4 : yypt+1] -// line internal/php5/php5.y:3974 + // line internal/php5/php5.y:4003 { funcName := &ast.NameRelative{ast.Node{}, yyDollar[3].list} yyVAL.node = &ast.ExprFunctionCall{ast.Node{}, funcName, yyDollar[4].node.(*ast.ArgumentList)} @@ -6374,7 +6403,7 @@ yydefault: } case 325: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:3987 + // line internal/php5/php5.y:4016 { funcName := &ast.NameFullyQualified{ast.Node{}, yyDollar[2].list} yyVAL.node = &ast.ExprFunctionCall{ast.Node{}, funcName, yyDollar[3].node.(*ast.ArgumentList)} @@ -6388,7 +6417,7 @@ yydefault: } case 326: yyDollar = yyS[yypt-4 : yypt+1] -// line internal/php5/php5.y:3999 + // line internal/php5/php5.y:4028 { yyVAL.node = &ast.ExprStaticCall{ast.Node{}, yyDollar[1].node, yyDollar[3].node, yyDollar[4].node.(*ast.ArgumentList)} @@ -6401,7 +6430,7 @@ yydefault: } case 327: yyDollar = yyS[yypt-4 : yypt+1] -// line internal/php5/php5.y:4010 + // line internal/php5/php5.y:4039 { yyVAL.node = &ast.ExprStaticCall{ast.Node{}, yyDollar[1].node, yyDollar[3].node, yyDollar[4].node.(*ast.ArgumentList)} @@ -6414,7 +6443,7 @@ yydefault: } case 328: yyDollar = yyS[yypt-4 : yypt+1] -// line internal/php5/php5.y:4021 + // line internal/php5/php5.y:4050 { yyVAL.node = &ast.ExprStaticCall{ast.Node{}, yyDollar[1].node, yyDollar[3].node, yyDollar[4].node.(*ast.ArgumentList)} @@ -6427,7 +6456,7 @@ yydefault: } case 329: yyDollar = yyS[yypt-4 : yypt+1] -// line internal/php5/php5.y:4032 + // line internal/php5/php5.y:4061 { yyVAL.node = &ast.ExprStaticCall{ast.Node{}, yyDollar[1].node, yyDollar[3].node, yyDollar[4].node.(*ast.ArgumentList)} @@ -6440,7 +6469,7 @@ yydefault: } case 330: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php5/php5.y:4043 + // line internal/php5/php5.y:4072 { yyVAL.node = &ast.ExprFunctionCall{ast.Node{}, yyDollar[1].node, yyDollar[2].node.(*ast.ArgumentList)} @@ -6452,7 +6481,7 @@ yydefault: } case 331: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:4056 + // line internal/php5/php5.y:4085 { yyVAL.node = &ast.Identifier{ast.Node{}, yyDollar[1].token.Value} @@ -6464,7 +6493,7 @@ yydefault: } case 332: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:4066 + // line internal/php5/php5.y:4095 { yyVAL.node = &ast.NameName{ast.Node{}, yyDollar[1].list} @@ -6473,7 +6502,7 @@ yydefault: } case 333: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:4073 + // line internal/php5/php5.y:4102 { yyVAL.node = &ast.NameRelative{ast.Node{}, yyDollar[3].list} @@ -6486,7 +6515,7 @@ yydefault: } case 334: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php5/php5.y:4084 + // line internal/php5/php5.y:4113 { yyVAL.node = &ast.NameFullyQualified{ast.Node{}, yyDollar[2].list} @@ -6498,7 +6527,7 @@ yydefault: } case 335: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:4097 + // line internal/php5/php5.y:4126 { yyVAL.node = &ast.NameName{ast.Node{}, yyDollar[1].list} @@ -6507,7 +6536,7 @@ yydefault: } case 336: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:4104 + // line internal/php5/php5.y:4133 { yyVAL.node = &ast.NameRelative{ast.Node{}, yyDollar[3].list} @@ -6520,7 +6549,7 @@ yydefault: } case 337: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php5/php5.y:4115 + // line internal/php5/php5.y:4144 { yyVAL.node = &ast.NameFullyQualified{ast.Node{}, yyDollar[2].list} @@ -6532,19 +6561,19 @@ yydefault: } case 338: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:4128 + // line internal/php5/php5.y:4157 { yyVAL.node = yyDollar[1].node } case 339: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:4132 + // line internal/php5/php5.y:4161 { yyVAL.node = yyDollar[1].node } case 340: yyDollar = yyS[yypt-4 : yypt+1] -// line internal/php5/php5.y:4139 + // line internal/php5/php5.y:4168 { yyVAL.node = yyDollar[1].node @@ -6585,25 +6614,25 @@ yydefault: } case 341: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:4178 + // line internal/php5/php5.y:4207 { yyVAL.node = yyDollar[1].node } case 342: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php5/php5.y:4186 + // line internal/php5/php5.y:4215 { yyVAL.list = append(yyDollar[1].list, yyDollar[2].list...) } case 343: yyDollar = yyS[yypt-0 : yypt+1] -// line internal/php5/php5.y:4190 + // line internal/php5/php5.y:4219 { yyVAL.list = []ast.Vertex{} } case 344: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php5/php5.y:4198 + // line internal/php5/php5.y:4227 { yyVAL.list = yyDollar[2].list @@ -6612,13 +6641,13 @@ yydefault: } case 345: yyDollar = yyS[yypt-0 : yypt+1] -// line internal/php5/php5.y:4208 + // line internal/php5/php5.y:4237 { yyVAL.node = nil } case 346: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php5/php5.y:4212 + // line internal/php5/php5.y:4241 { yyVAL.node = &ast.ParserBrackets{ast.Node{}, nil} @@ -6631,19 +6660,19 @@ yydefault: } case 347: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:4223 + // line internal/php5/php5.y:4252 { yyVAL.node = yyDollar[1].node } case 348: yyDollar = yyS[yypt-0 : yypt+1] -// line internal/php5/php5.y:4230 + // line internal/php5/php5.y:4259 { yyVAL.list = []ast.Vertex{} } case 349: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:4234 + // line internal/php5/php5.y:4263 { part := &ast.ScalarEncapsedStringPart{ast.Node{}, yyDollar[1].token.Value} yyVAL.list = []ast.Vertex{part} @@ -6653,25 +6682,25 @@ yydefault: } case 350: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:4242 + // line internal/php5/php5.y:4271 { yyVAL.list = yyDollar[1].list } case 351: yyDollar = yyS[yypt-0 : yypt+1] -// line internal/php5/php5.y:4249 + // line internal/php5/php5.y:4278 { yyVAL.node = nil } case 352: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:4253 + // line internal/php5/php5.y:4282 { yyVAL.node = yyDollar[1].node } case 353: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:4260 + // line internal/php5/php5.y:4289 { yyVAL.node = &ast.ScalarLnumber{ast.Node{}, yyDollar[1].token.Value} @@ -6683,7 +6712,7 @@ yydefault: } case 354: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:4270 + // line internal/php5/php5.y:4299 { yyVAL.node = &ast.ScalarDnumber{ast.Node{}, yyDollar[1].token.Value} @@ -6695,7 +6724,7 @@ yydefault: } case 355: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:4280 + // line internal/php5/php5.y:4309 { yyVAL.node = &ast.ScalarString{ast.Node{}, yyDollar[1].token.Value} @@ -6707,7 +6736,7 @@ yydefault: } case 356: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:4290 + // line internal/php5/php5.y:4319 { yyVAL.node = &ast.ScalarMagicConstant{ast.Node{}, yyDollar[1].token.Value} @@ -6719,7 +6748,7 @@ yydefault: } case 357: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:4300 + // line internal/php5/php5.y:4329 { yyVAL.node = &ast.ScalarMagicConstant{ast.Node{}, yyDollar[1].token.Value} @@ -6731,7 +6760,7 @@ yydefault: } case 358: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:4310 + // line internal/php5/php5.y:4339 { yyVAL.node = &ast.ScalarMagicConstant{ast.Node{}, yyDollar[1].token.Value} @@ -6743,7 +6772,7 @@ yydefault: } case 359: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:4320 + // line internal/php5/php5.y:4349 { yyVAL.node = &ast.ScalarMagicConstant{ast.Node{}, yyDollar[1].token.Value} @@ -6755,7 +6784,7 @@ yydefault: } case 360: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:4330 + // line internal/php5/php5.y:4359 { yyVAL.node = &ast.ScalarMagicConstant{ast.Node{}, yyDollar[1].token.Value} @@ -6767,7 +6796,7 @@ yydefault: } case 361: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:4340 + // line internal/php5/php5.y:4369 { yyVAL.node = &ast.ScalarMagicConstant{ast.Node{}, yyDollar[1].token.Value} @@ -6779,7 +6808,7 @@ yydefault: } case 362: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:4350 + // line internal/php5/php5.y:4379 { yyVAL.node = &ast.ScalarMagicConstant{ast.Node{}, yyDollar[1].token.Value} @@ -6791,7 +6820,7 @@ yydefault: } case 363: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:4360 + // line internal/php5/php5.y:4389 { encapsed := &ast.ScalarEncapsedStringPart{ast.Node{}, yyDollar[2].token.Value} yyVAL.node = &ast.ScalarHeredoc{ast.Node{}, yyDollar[1].token.Value, []ast.Vertex{encapsed}} @@ -6805,7 +6834,7 @@ yydefault: } case 364: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php5/php5.y:4372 + // line internal/php5/php5.y:4401 { yyVAL.node = &ast.ScalarHeredoc{ast.Node{}, yyDollar[1].token.Value, nil} @@ -6817,7 +6846,7 @@ yydefault: } case 365: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:4385 + // line internal/php5/php5.y:4414 { target := &ast.Identifier{ast.Node{}, yyDollar[3].token.Value} yyVAL.node = &ast.ExprClassConstFetch{ast.Node{}, yyDollar[1].node, target} @@ -6833,25 +6862,25 @@ yydefault: } case 366: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:4402 + // line internal/php5/php5.y:4431 { yyVAL.node = yyDollar[1].node } case 367: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:4409 + // line internal/php5/php5.y:4438 { yyVAL.node = yyDollar[1].node } case 368: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:4413 + // line internal/php5/php5.y:4442 { yyVAL.node = yyDollar[1].node } case 369: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:4417 + // line internal/php5/php5.y:4446 { name := &ast.NameName{ast.Node{}, yyDollar[1].list} yyVAL.node = &ast.ExprConstFetch{ast.Node{}, name} @@ -6862,7 +6891,7 @@ yydefault: } case 370: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:4426 + // line internal/php5/php5.y:4455 { name := &ast.NameRelative{ast.Node{}, yyDollar[3].list} yyVAL.node = &ast.ExprConstFetch{ast.Node{}, name} @@ -6877,7 +6906,7 @@ yydefault: } case 371: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php5/php5.y:4439 + // line internal/php5/php5.y:4468 { name := &ast.NameFullyQualified{ast.Node{}, yyDollar[2].list} yyVAL.node = &ast.ExprConstFetch{ast.Node{}, name} @@ -6891,7 +6920,7 @@ yydefault: } case 372: yyDollar = yyS[yypt-4 : yypt+1] -// line internal/php5/php5.y:4451 + // line internal/php5/php5.y:4480 { yyVAL.node = &ast.ExprArray{ast.Node{}, yyDollar[3].list} @@ -6905,7 +6934,7 @@ yydefault: } case 373: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:4463 + // line internal/php5/php5.y:4492 { yyVAL.node = &ast.ExprShortArray{ast.Node{}, yyDollar[2].list} @@ -6918,13 +6947,13 @@ yydefault: } case 374: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:4474 + // line internal/php5/php5.y:4503 { yyVAL.node = yyDollar[1].node } case 375: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:4478 + // line internal/php5/php5.y:4507 { yyVAL.node = &ast.ScalarMagicConstant{ast.Node{}, yyDollar[1].token.Value} @@ -6936,13 +6965,13 @@ yydefault: } case 376: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:4488 + // line internal/php5/php5.y:4517 { yyVAL.node = yyDollar[1].node } case 377: yyDollar = yyS[yypt-4 : yypt+1] -// line internal/php5/php5.y:4495 + // line internal/php5/php5.y:4524 { yyVAL.node = &ast.ExprArrayDimFetch{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -6955,7 +6984,7 @@ yydefault: } case 378: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:4506 + // line internal/php5/php5.y:4535 { yyVAL.node = &ast.ExprBinaryPlus{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -6968,7 +6997,7 @@ yydefault: } case 379: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:4517 + // line internal/php5/php5.y:4546 { yyVAL.node = &ast.ExprBinaryMinus{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -6981,7 +7010,7 @@ yydefault: } case 380: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:4528 + // line internal/php5/php5.y:4557 { yyVAL.node = &ast.ExprBinaryMul{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -6994,7 +7023,7 @@ yydefault: } case 381: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:4539 + // line internal/php5/php5.y:4568 { yyVAL.node = &ast.ExprBinaryPow{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -7007,7 +7036,7 @@ yydefault: } case 382: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:4550 + // line internal/php5/php5.y:4579 { yyVAL.node = &ast.ExprBinaryDiv{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -7020,7 +7049,7 @@ yydefault: } case 383: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:4561 + // line internal/php5/php5.y:4590 { yyVAL.node = &ast.ExprBinaryMod{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -7033,7 +7062,7 @@ yydefault: } case 384: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php5/php5.y:4572 + // line internal/php5/php5.y:4601 { yyVAL.node = &ast.ExprBooleanNot{ast.Node{}, yyDollar[2].node} @@ -7045,7 +7074,7 @@ yydefault: } case 385: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php5/php5.y:4582 + // line internal/php5/php5.y:4611 { yyVAL.node = &ast.ExprBitwiseNot{ast.Node{}, yyDollar[2].node} @@ -7057,7 +7086,7 @@ yydefault: } case 386: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:4592 + // line internal/php5/php5.y:4621 { yyVAL.node = &ast.ExprBinaryBitwiseOr{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -7070,7 +7099,7 @@ yydefault: } case 387: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:4603 + // line internal/php5/php5.y:4632 { yyVAL.node = &ast.ExprBinaryBitwiseAnd{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -7083,7 +7112,7 @@ yydefault: } case 388: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:4614 + // line internal/php5/php5.y:4643 { yyVAL.node = &ast.ExprBinaryBitwiseXor{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -7096,7 +7125,7 @@ yydefault: } case 389: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:4625 + // line internal/php5/php5.y:4654 { yyVAL.node = &ast.ExprBinaryShiftLeft{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -7109,7 +7138,7 @@ yydefault: } case 390: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:4636 + // line internal/php5/php5.y:4665 { yyVAL.node = &ast.ExprBinaryShiftRight{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -7122,7 +7151,7 @@ yydefault: } case 391: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:4647 + // line internal/php5/php5.y:4676 { yyVAL.node = &ast.ExprBinaryConcat{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -7135,7 +7164,7 @@ yydefault: } case 392: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:4658 + // line internal/php5/php5.y:4687 { yyVAL.node = &ast.ExprBinaryLogicalXor{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -7148,7 +7177,7 @@ yydefault: } case 393: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:4669 + // line internal/php5/php5.y:4698 { yyVAL.node = &ast.ExprBinaryLogicalAnd{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -7161,7 +7190,7 @@ yydefault: } case 394: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:4680 + // line internal/php5/php5.y:4709 { yyVAL.node = &ast.ExprBinaryLogicalOr{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -7174,7 +7203,7 @@ yydefault: } case 395: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:4691 + // line internal/php5/php5.y:4720 { yyVAL.node = &ast.ExprBinaryBooleanAnd{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -7187,7 +7216,7 @@ yydefault: } case 396: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:4702 + // line internal/php5/php5.y:4731 { yyVAL.node = &ast.ExprBinaryBooleanOr{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -7200,7 +7229,7 @@ yydefault: } case 397: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:4713 + // line internal/php5/php5.y:4742 { yyVAL.node = &ast.ExprBinaryIdentical{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -7213,7 +7242,7 @@ yydefault: } case 398: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:4724 + // line internal/php5/php5.y:4753 { yyVAL.node = &ast.ExprBinaryNotIdentical{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -7226,7 +7255,7 @@ yydefault: } case 399: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:4735 + // line internal/php5/php5.y:4764 { yyVAL.node = &ast.ExprBinaryEqual{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -7239,7 +7268,7 @@ yydefault: } case 400: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:4746 + // line internal/php5/php5.y:4775 { yyVAL.node = &ast.ExprBinaryNotEqual{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -7253,7 +7282,7 @@ yydefault: } case 401: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:4758 + // line internal/php5/php5.y:4787 { yyVAL.node = &ast.ExprBinarySmaller{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -7266,7 +7295,7 @@ yydefault: } case 402: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:4769 + // line internal/php5/php5.y:4798 { yyVAL.node = &ast.ExprBinaryGreater{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -7279,7 +7308,7 @@ yydefault: } case 403: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:4780 + // line internal/php5/php5.y:4809 { yyVAL.node = &ast.ExprBinarySmallerOrEqual{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -7292,7 +7321,7 @@ yydefault: } case 404: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:4791 + // line internal/php5/php5.y:4820 { yyVAL.node = &ast.ExprBinaryGreaterOrEqual{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -7305,7 +7334,7 @@ yydefault: } case 405: yyDollar = yyS[yypt-4 : yypt+1] -// line internal/php5/php5.y:4802 + // line internal/php5/php5.y:4831 { yyVAL.node = &ast.ExprTernary{ast.Node{}, yyDollar[1].node, nil, yyDollar[4].node} @@ -7319,7 +7348,7 @@ yydefault: } case 406: yyDollar = yyS[yypt-5 : yypt+1] -// line internal/php5/php5.y:4814 + // line internal/php5/php5.y:4843 { yyVAL.node = &ast.ExprTernary{ast.Node{}, yyDollar[1].node, yyDollar[3].node, yyDollar[5].node} @@ -7333,7 +7362,7 @@ yydefault: } case 407: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php5/php5.y:4826 + // line internal/php5/php5.y:4855 { yyVAL.node = &ast.ExprUnaryPlus{ast.Node{}, yyDollar[2].node} @@ -7345,7 +7374,7 @@ yydefault: } case 408: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php5/php5.y:4836 + // line internal/php5/php5.y:4865 { yyVAL.node = &ast.ExprUnaryMinus{ast.Node{}, yyDollar[2].node} @@ -7357,7 +7386,7 @@ yydefault: } case 409: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:4846 + // line internal/php5/php5.y:4875 { yyVAL.node = yyDollar[2].node @@ -7367,13 +7396,13 @@ yydefault: } case 410: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:4857 + // line internal/php5/php5.y:4886 { yyVAL.node = yyDollar[1].node } case 411: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:4861 + // line internal/php5/php5.y:4890 { name := &ast.NameName{ast.Node{}, yyDollar[1].list} yyVAL.node = &ast.ExprConstFetch{ast.Node{}, name} @@ -7384,7 +7413,7 @@ yydefault: } case 412: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:4870 + // line internal/php5/php5.y:4899 { name := &ast.NameRelative{ast.Node{}, yyDollar[3].list} yyVAL.node = &ast.ExprConstFetch{ast.Node{}, name} @@ -7399,7 +7428,7 @@ yydefault: } case 413: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php5/php5.y:4883 + // line internal/php5/php5.y:4912 { name := &ast.NameFullyQualified{ast.Node{}, yyDollar[2].list} yyVAL.node = &ast.ExprConstFetch{ast.Node{}, name} @@ -7413,7 +7442,7 @@ yydefault: } case 414: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:4898 + // line internal/php5/php5.y:4927 { name := &ast.Identifier{ast.Node{}, yyDollar[1].token.Value} yyVAL.node = &ast.ExprVariable{ast.Node{}, name} @@ -7427,25 +7456,25 @@ yydefault: } case 415: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:4910 + // line internal/php5/php5.y:4939 { yyVAL.node = yyDollar[1].node } case 416: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:4914 + // line internal/php5/php5.y:4943 { yyVAL.node = yyDollar[1].node } case 417: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:4918 + // line internal/php5/php5.y:4947 { yyVAL.node = yyDollar[1].node } case 418: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:4922 + // line internal/php5/php5.y:4951 { yyVAL.node = &ast.ScalarEncapsed{ast.Node{}, yyDollar[2].list} @@ -7457,7 +7486,7 @@ yydefault: } case 419: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:4932 + // line internal/php5/php5.y:4961 { yyVAL.node = &ast.ScalarHeredoc{ast.Node{}, yyDollar[1].token.Value, yyDollar[2].list} @@ -7469,7 +7498,7 @@ yydefault: } case 420: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:4942 + // line internal/php5/php5.y:4971 { yyVAL.node = &ast.ScalarMagicConstant{ast.Node{}, yyDollar[1].token.Value} @@ -7481,13 +7510,13 @@ yydefault: } case 421: yyDollar = yyS[yypt-0 : yypt+1] -// line internal/php5/php5.y:4955 + // line internal/php5/php5.y:4984 { yyVAL.list = nil } case 422: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php5/php5.y:4959 + // line internal/php5/php5.y:4988 { yyVAL.list = yyDollar[1].list @@ -7498,19 +7527,19 @@ yydefault: } case 423: yyDollar = yyS[yypt-0 : yypt+1] -// line internal/php5/php5.y:4971 + // line internal/php5/php5.y:5000 { yyVAL.token = nil } case 424: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:4975 + // line internal/php5/php5.y:5004 { yyVAL.token = yyDollar[1].token } case 425: yyDollar = yyS[yypt-5 : yypt+1] -// line internal/php5/php5.y:4982 + // line internal/php5/php5.y:5011 { arrayItem := &ast.ExprArrayItem{ast.Node{}, false, yyDollar[3].node, yyDollar[5].node} yyVAL.list = append(yyDollar[1].list, arrayItem) @@ -7525,7 +7554,7 @@ yydefault: } case 426: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:4995 + // line internal/php5/php5.y:5024 { arrayItem := &ast.ExprArrayItem{ast.Node{}, false, nil, yyDollar[3].node} yyVAL.list = append(yyDollar[1].list, arrayItem) @@ -7539,7 +7568,7 @@ yydefault: } case 427: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:5007 + // line internal/php5/php5.y:5036 { arrayItem := &ast.ExprArrayItem{ast.Node{}, false, yyDollar[1].node, yyDollar[3].node} yyVAL.list = []ast.Vertex{arrayItem} @@ -7553,7 +7582,7 @@ yydefault: } case 428: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:5019 + // line internal/php5/php5.y:5048 { arrayItem := &ast.ExprArrayItem{ast.Node{}, false, nil, yyDollar[1].node} yyVAL.list = []ast.Vertex{arrayItem} @@ -7566,19 +7595,19 @@ yydefault: } case 429: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:5033 + // line internal/php5/php5.y:5062 { yyVAL.node = yyDollar[1].node } case 430: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:5037 + // line internal/php5/php5.y:5066 { yyVAL.node = yyDollar[1].node } case 431: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:5044 + // line internal/php5/php5.y:5073 { yyVAL.node = &ast.ParserBrackets{ast.Node{}, yyDollar[2].node} @@ -7591,7 +7620,7 @@ yydefault: } case 432: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:5055 + // line internal/php5/php5.y:5084 { yyVAL.node = &ast.ParserBrackets{ast.Node{}, yyDollar[2].node} @@ -7604,25 +7633,25 @@ yydefault: } case 433: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:5070 + // line internal/php5/php5.y:5099 { yyVAL.node = yyDollar[1].node } case 434: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:5078 + // line internal/php5/php5.y:5107 { yyVAL.node = yyDollar[1].node } case 435: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:5085 + // line internal/php5/php5.y:5114 { yyVAL.node = yyDollar[1].node } case 436: yyDollar = yyS[yypt-5 : yypt+1] -// line internal/php5/php5.y:5092 + // line internal/php5/php5.y:5121 { yyVAL.node = yyDollar[1].node @@ -7680,25 +7709,25 @@ yydefault: } case 437: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:5148 + // line internal/php5/php5.y:5177 { yyVAL.node = yyDollar[1].node } case 438: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php5/php5.y:5155 + // line internal/php5/php5.y:5184 { yyVAL.list = append(yyDollar[1].list, yyDollar[2].list...) } case 439: yyDollar = yyS[yypt-0 : yypt+1] -// line internal/php5/php5.y:5159 + // line internal/php5/php5.y:5188 { yyVAL.list = []ast.Vertex{} } case 440: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:5167 + // line internal/php5/php5.y:5196 { if yyDollar[3].list != nil { yyDollar[3].list[0].(*ast.ExprMethodCall).Method = yyDollar[2].list[len(yyDollar[2].list)-1].(*ast.ExprPropertyFetch).Property @@ -7712,7 +7741,7 @@ yydefault: } case 441: yyDollar = yyS[yypt-4 : yypt+1] -// line internal/php5/php5.y:5182 + // line internal/php5/php5.y:5211 { fetch := &ast.ExprArrayDimFetch{ast.Node{}, nil, yyDollar[3].node} yyVAL.list = append(yyDollar[1].list, fetch) @@ -7726,7 +7755,7 @@ yydefault: } case 442: yyDollar = yyS[yypt-4 : yypt+1] -// line internal/php5/php5.y:5194 + // line internal/php5/php5.y:5223 { fetch := &ast.ExprArrayDimFetch{ast.Node{}, nil, yyDollar[3].node} yyVAL.list = []ast.Vertex{yyDollar[1].node, fetch} @@ -7740,7 +7769,7 @@ yydefault: } case 443: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:5209 + // line internal/php5/php5.y:5238 { yyVAL.node = &ast.ExprMethodCall{ast.Node{}, nil, nil, yyDollar[1].node.(*ast.ArgumentList)} @@ -7749,31 +7778,31 @@ yydefault: } case 444: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:5219 + // line internal/php5/php5.y:5248 { yyVAL.list = []ast.Vertex{yyDollar[1].node} } case 445: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:5223 + // line internal/php5/php5.y:5252 { yyVAL.list = yyDollar[1].list } case 446: yyDollar = yyS[yypt-0 : yypt+1] -// line internal/php5/php5.y:5227 + // line internal/php5/php5.y:5256 { yyVAL.list = nil } case 447: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:5234 + // line internal/php5/php5.y:5263 { yyVAL.node = yyDollar[1].node } case 448: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php5/php5.y:5238 + // line internal/php5/php5.y:5267 { yyDollar[1].simpleIndirectReference.last.VarName = yyDollar[2].node @@ -7785,7 +7814,7 @@ yydefault: } case 449: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:5251 + // line internal/php5/php5.y:5280 { yyVAL.node = &ast.ExprStaticPropertyFetch{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -7798,7 +7827,7 @@ yydefault: } case 450: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:5262 + // line internal/php5/php5.y:5291 { yyVAL.node = &ast.ExprStaticPropertyFetch{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -7811,13 +7840,13 @@ yydefault: } case 451: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:5276 + // line internal/php5/php5.y:5305 { yyVAL.node = yyDollar[1].node } case 452: yyDollar = yyS[yypt-4 : yypt+1] -// line internal/php5/php5.y:5283 + // line internal/php5/php5.y:5312 { yyVAL.node = &ast.ExprArrayDimFetch{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -7830,7 +7859,7 @@ yydefault: } case 453: yyDollar = yyS[yypt-4 : yypt+1] -// line internal/php5/php5.y:5294 + // line internal/php5/php5.y:5323 { yyVAL.node = &ast.ExprArrayDimFetch{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -7843,31 +7872,31 @@ yydefault: } case 454: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:5308 + // line internal/php5/php5.y:5337 { yyVAL.node = yyDollar[1].node } case 455: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:5312 + // line internal/php5/php5.y:5341 { yyVAL.node = yyDollar[1].node } case 456: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:5316 + // line internal/php5/php5.y:5345 { yyVAL.node = yyDollar[1].node } case 457: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:5324 + // line internal/php5/php5.y:5353 { yyVAL.node = yyDollar[1].node } case 458: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php5/php5.y:5328 + // line internal/php5/php5.y:5357 { yyDollar[1].simpleIndirectReference.last.VarName = yyDollar[2].node @@ -7879,13 +7908,13 @@ yydefault: } case 459: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:5338 + // line internal/php5/php5.y:5367 { yyVAL.node = yyDollar[1].node } case 460: yyDollar = yyS[yypt-4 : yypt+1] -// line internal/php5/php5.y:5345 + // line internal/php5/php5.y:5374 { yyVAL.node = &ast.ExprArrayDimFetch{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -7898,7 +7927,7 @@ yydefault: } case 461: yyDollar = yyS[yypt-4 : yypt+1] -// line internal/php5/php5.y:5356 + // line internal/php5/php5.y:5385 { yyVAL.node = &ast.ExprArrayDimFetch{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -7911,13 +7940,13 @@ yydefault: } case 462: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:5367 + // line internal/php5/php5.y:5396 { yyVAL.node = yyDollar[1].node } case 463: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:5375 + // line internal/php5/php5.y:5404 { name := &ast.Identifier{ast.Node{}, yyDollar[1].token.Value} yyVAL.node = &ast.ExprVariable{ast.Node{}, name} @@ -7931,7 +7960,7 @@ yydefault: } case 464: yyDollar = yyS[yypt-4 : yypt+1] -// line internal/php5/php5.y:5387 + // line internal/php5/php5.y:5416 { yyVAL.node = &ast.ExprVariable{ast.Node{}, yyDollar[3].node} @@ -7945,25 +7974,25 @@ yydefault: } case 465: yyDollar = yyS[yypt-0 : yypt+1] -// line internal/php5/php5.y:5402 + // line internal/php5/php5.y:5431 { yyVAL.node = nil } case 466: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:5406 + // line internal/php5/php5.y:5435 { yyVAL.node = yyDollar[1].node } case 467: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:5414 + // line internal/php5/php5.y:5443 { yyVAL.list = yyDollar[1].list } case 468: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:5418 + // line internal/php5/php5.y:5447 { fetch := &ast.ExprPropertyFetch{ast.Node{}, nil, yyDollar[1].node} yyVAL.list = []ast.Vertex{fetch} @@ -7973,7 +8002,7 @@ yydefault: } case 469: yyDollar = yyS[yypt-4 : yypt+1] -// line internal/php5/php5.y:5429 + // line internal/php5/php5.y:5458 { fetch := &ast.ExprArrayDimFetch{ast.Node{}, nil, yyDollar[3].node} yyVAL.list = append(yyDollar[1].list, fetch) @@ -7987,7 +8016,7 @@ yydefault: } case 470: yyDollar = yyS[yypt-4 : yypt+1] -// line internal/php5/php5.y:5441 + // line internal/php5/php5.y:5470 { fetch := &ast.ExprArrayDimFetch{ast.Node{}, nil, yyDollar[3].node} yyVAL.list = append(yyDollar[1].list, fetch) @@ -8001,7 +8030,7 @@ yydefault: } case 471: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:5453 + // line internal/php5/php5.y:5482 { fetch := &ast.ExprPropertyFetch{ast.Node{}, nil, yyDollar[1].node} yyVAL.list = []ast.Vertex{fetch} @@ -8011,7 +8040,7 @@ yydefault: } case 472: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:5464 + // line internal/php5/php5.y:5493 { yyVAL.node = &ast.Identifier{ast.Node{}, yyDollar[1].token.Value} @@ -8023,7 +8052,7 @@ yydefault: } case 473: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:5474 + // line internal/php5/php5.y:5503 { yyVAL.node = yyDollar[2].node @@ -8036,7 +8065,7 @@ yydefault: } case 474: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:5488 + // line internal/php5/php5.y:5517 { n := &ast.ExprVariable{ast.Node{}, nil} yyVAL.simpleIndirectReference = simpleIndirectReference{[]*ast.ExprVariable{n}, n} @@ -8049,7 +8078,7 @@ yydefault: } case 475: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php5/php5.y:5499 + // line internal/php5/php5.y:5528 { n := &ast.ExprVariable{ast.Node{}, nil} @@ -8066,7 +8095,7 @@ yydefault: } case 476: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:5517 + // line internal/php5/php5.y:5546 { if len(yyDollar[1].list) == 0 { yyDollar[1].list = []ast.Vertex{&ast.ExprArrayItem{ast.Node{}, false, nil, nil}} @@ -8079,7 +8108,7 @@ yydefault: } case 477: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:5528 + // line internal/php5/php5.y:5557 { if yyDollar[1].node.(*ast.ExprArrayItem).Key == nil && yyDollar[1].node.(*ast.ExprArrayItem).Val == nil { yyVAL.list = []ast.Vertex{} @@ -8089,7 +8118,7 @@ yydefault: } case 478: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:5540 + // line internal/php5/php5.y:5569 { yyVAL.node = &ast.ExprArrayItem{ast.Node{}, false, nil, yyDollar[1].node} @@ -8101,7 +8130,7 @@ yydefault: } case 479: yyDollar = yyS[yypt-4 : yypt+1] -// line internal/php5/php5.y:5550 + // line internal/php5/php5.y:5579 { listNode := &ast.ExprList{ast.Node{}, yyDollar[3].list} yyVAL.node = &ast.ExprArrayItem{ast.Node{}, false, nil, listNode} @@ -8117,19 +8146,19 @@ yydefault: } case 480: yyDollar = yyS[yypt-0 : yypt+1] -// line internal/php5/php5.y:5564 + // line internal/php5/php5.y:5593 { yyVAL.node = &ast.ExprArrayItem{ast.Node{}, false, nil, nil} } case 481: yyDollar = yyS[yypt-0 : yypt+1] -// line internal/php5/php5.y:5572 + // line internal/php5/php5.y:5601 { yyVAL.list = []ast.Vertex{} } case 482: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php5/php5.y:5576 + // line internal/php5/php5.y:5605 { yyVAL.list = yyDollar[1].list @@ -8144,7 +8173,7 @@ yydefault: } case 483: yyDollar = yyS[yypt-5 : yypt+1] -// line internal/php5/php5.y:5592 + // line internal/php5/php5.y:5621 { arrayItem := &ast.ExprArrayItem{ast.Node{}, false, yyDollar[3].node, yyDollar[5].node} yyVAL.list = append(yyDollar[1].list, arrayItem) @@ -8159,7 +8188,7 @@ yydefault: } case 484: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:5605 + // line internal/php5/php5.y:5634 { arrayItem := &ast.ExprArrayItem{ast.Node{}, false, nil, yyDollar[3].node} yyVAL.list = append(yyDollar[1].list, arrayItem) @@ -8173,7 +8202,7 @@ yydefault: } case 485: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:5617 + // line internal/php5/php5.y:5646 { arrayItem := &ast.ExprArrayItem{ast.Node{}, false, yyDollar[1].node, yyDollar[3].node} yyVAL.list = []ast.Vertex{arrayItem} @@ -8187,7 +8216,7 @@ yydefault: } case 486: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:5629 + // line internal/php5/php5.y:5658 { arrayItem := &ast.ExprArrayItem{ast.Node{}, false, nil, yyDollar[1].node} yyVAL.list = []ast.Vertex{arrayItem} @@ -8200,7 +8229,7 @@ yydefault: } case 487: yyDollar = yyS[yypt-6 : yypt+1] -// line internal/php5/php5.y:5640 + // line internal/php5/php5.y:5669 { reference := &ast.ExprReference{ast.Node{}, yyDollar[6].node} arrayItem := &ast.ExprArrayItem{ast.Node{}, false, yyDollar[3].node, reference} @@ -8218,7 +8247,7 @@ yydefault: } case 488: yyDollar = yyS[yypt-4 : yypt+1] -// line internal/php5/php5.y:5656 + // line internal/php5/php5.y:5685 { reference := &ast.ExprReference{ast.Node{}, yyDollar[4].node} arrayItem := &ast.ExprArrayItem{ast.Node{}, false, nil, reference} @@ -8234,7 +8263,7 @@ yydefault: } case 489: yyDollar = yyS[yypt-4 : yypt+1] -// line internal/php5/php5.y:5670 + // line internal/php5/php5.y:5699 { reference := &ast.ExprReference{ast.Node{}, yyDollar[4].node} arrayItem := &ast.ExprArrayItem{ast.Node{}, false, yyDollar[1].node, reference} @@ -8251,7 +8280,7 @@ yydefault: } case 490: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php5/php5.y:5685 + // line internal/php5/php5.y:5714 { reference := &ast.ExprReference{ast.Node{}, yyDollar[2].node} arrayItem := &ast.ExprArrayItem{ast.Node{}, false, nil, reference} @@ -8266,13 +8295,13 @@ yydefault: } case 491: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php5/php5.y:5701 + // line internal/php5/php5.y:5730 { yyVAL.list = append(yyDollar[1].list, yyDollar[2].node) } case 492: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php5/php5.y:5705 + // line internal/php5/php5.y:5734 { encapsed := &ast.ScalarEncapsedStringPart{ast.Node{}, yyDollar[2].token.Value} yyVAL.list = append(yyDollar[1].list, encapsed) @@ -8285,13 +8314,13 @@ yydefault: } case 493: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:5716 + // line internal/php5/php5.y:5745 { yyVAL.list = []ast.Vertex{yyDollar[1].node} } case 494: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php5/php5.y:5720 + // line internal/php5/php5.y:5749 { encapsed := &ast.ScalarEncapsedStringPart{ast.Node{}, yyDollar[1].token.Value} yyVAL.list = []ast.Vertex{encapsed, yyDollar[2].node} @@ -8304,7 +8333,7 @@ yydefault: } case 495: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:5734 + // line internal/php5/php5.y:5763 { name := &ast.Identifier{ast.Node{}, yyDollar[1].token.Value} yyVAL.node = &ast.ExprVariable{ast.Node{}, name} @@ -8318,7 +8347,7 @@ yydefault: } case 496: yyDollar = yyS[yypt-4 : yypt+1] -// line internal/php5/php5.y:5746 + // line internal/php5/php5.y:5775 { identifier := &ast.Identifier{ast.Node{}, yyDollar[1].token.Value} variable := &ast.ExprVariable{ast.Node{}, identifier} @@ -8335,7 +8364,7 @@ yydefault: } case 497: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:5761 + // line internal/php5/php5.y:5790 { identifier := &ast.Identifier{ast.Node{}, yyDollar[1].token.Value} variable := &ast.ExprVariable{ast.Node{}, identifier} @@ -8354,7 +8383,7 @@ yydefault: } case 498: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:5778 + // line internal/php5/php5.y:5807 { variable := &ast.ExprVariable{ast.Node{}, yyDollar[2].node} @@ -8369,7 +8398,7 @@ yydefault: } case 499: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:5791 + // line internal/php5/php5.y:5820 { name := &ast.Identifier{ast.Node{}, yyDollar[2].token.Value} variable := &ast.ExprVariable{ast.Node{}, name} @@ -8386,7 +8415,7 @@ yydefault: } case 500: yyDollar = yyS[yypt-6 : yypt+1] -// line internal/php5/php5.y:5806 + // line internal/php5/php5.y:5835 { identifier := &ast.Identifier{ast.Node{}, yyDollar[2].token.Value} variable := &ast.ExprVariable{ast.Node{}, identifier} @@ -8405,7 +8434,7 @@ yydefault: } case 501: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:5823 + // line internal/php5/php5.y:5852 { yyVAL.node = yyDollar[2].node @@ -8415,7 +8444,7 @@ yydefault: } case 502: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:5834 + // line internal/php5/php5.y:5863 { yyVAL.node = &ast.ScalarString{ast.Node{}, yyDollar[1].token.Value} @@ -8427,7 +8456,7 @@ yydefault: } case 503: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:5844 + // line internal/php5/php5.y:5873 { // TODO: add option to handle 64 bit integer if _, err := strconv.Atoi(string(yyDollar[1].token.Value)); err == nil { @@ -8444,7 +8473,7 @@ yydefault: } case 504: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:5859 + // line internal/php5/php5.y:5888 { identifier := &ast.Identifier{ast.Node{}, yyDollar[1].token.Value} yyVAL.node = &ast.ExprVariable{ast.Node{}, identifier} @@ -8458,7 +8487,7 @@ yydefault: } case 505: yyDollar = yyS[yypt-4 : yypt+1] -// line internal/php5/php5.y:5874 + // line internal/php5/php5.y:5903 { yyVAL.node = &ast.ExprIsset{ast.Node{}, yyDollar[3].list} @@ -8472,7 +8501,7 @@ yydefault: } case 506: yyDollar = yyS[yypt-4 : yypt+1] -// line internal/php5/php5.y:5886 + // line internal/php5/php5.y:5915 { exprBrackets := &ast.ParserBrackets{ast.Node{}, yyDollar[3].node} yyVAL.node = &ast.ExprEmpty{ast.Node{}, exprBrackets} @@ -8488,7 +8517,7 @@ yydefault: } case 507: yyDollar = yyS[yypt-4 : yypt+1] -// line internal/php5/php5.y:5900 + // line internal/php5/php5.y:5929 { exprBrackets := &ast.ParserBrackets{ast.Node{}, yyDollar[3].node} yyVAL.node = &ast.ExprEmpty{ast.Node{}, exprBrackets} @@ -8504,7 +8533,7 @@ yydefault: } case 508: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php5/php5.y:5914 + // line internal/php5/php5.y:5943 { yyVAL.node = &ast.ExprInclude{ast.Node{}, yyDollar[2].node} @@ -8516,7 +8545,7 @@ yydefault: } case 509: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php5/php5.y:5924 + // line internal/php5/php5.y:5953 { yyVAL.node = &ast.ExprIncludeOnce{ast.Node{}, yyDollar[2].node} @@ -8528,7 +8557,7 @@ yydefault: } case 510: yyDollar = yyS[yypt-4 : yypt+1] -// line internal/php5/php5.y:5934 + // line internal/php5/php5.y:5963 { exprBrackets := &ast.ParserBrackets{ast.Node{}, yyDollar[3].node} yyVAL.node = &ast.ExprEval{ast.Node{}, exprBrackets} @@ -8544,7 +8573,7 @@ yydefault: } case 511: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php5/php5.y:5948 + // line internal/php5/php5.y:5977 { yyVAL.node = &ast.ExprRequire{ast.Node{}, yyDollar[2].node} @@ -8556,7 +8585,7 @@ yydefault: } case 512: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php5/php5.y:5958 + // line internal/php5/php5.y:5987 { yyVAL.node = &ast.ExprRequireOnce{ast.Node{}, yyDollar[2].node} @@ -8568,13 +8597,13 @@ yydefault: } case 513: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:5971 + // line internal/php5/php5.y:6000 { yyVAL.list = []ast.Vertex{yyDollar[1].node} } case 514: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:5975 + // line internal/php5/php5.y:6004 { yyVAL.list = append(yyDollar[1].list, yyDollar[3].node) @@ -8583,19 +8612,19 @@ yydefault: } case 515: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:5985 + // line internal/php5/php5.y:6014 { yyVAL.node = yyDollar[1].node } case 516: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php5/php5.y:5989 + // line internal/php5/php5.y:6018 { yyVAL.node = yyDollar[1].node } case 517: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:5996 + // line internal/php5/php5.y:6025 { target := &ast.Identifier{ast.Node{}, yyDollar[3].token.Value} yyVAL.node = &ast.ExprClassConstFetch{ast.Node{}, yyDollar[1].node, target} @@ -8611,7 +8640,7 @@ yydefault: } case 518: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:6010 + // line internal/php5/php5.y:6039 { target := &ast.Identifier{ast.Node{}, yyDollar[3].token.Value} yyVAL.node = &ast.ExprClassConstFetch{ast.Node{}, yyDollar[1].node, target} @@ -8627,7 +8656,7 @@ yydefault: } case 519: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:6027 + // line internal/php5/php5.y:6056 { target := &ast.Identifier{ast.Node{}, yyDollar[3].token.Value} yyVAL.node = &ast.ExprClassConstFetch{ast.Node{}, yyDollar[1].node, target} @@ -8643,7 +8672,7 @@ yydefault: } case 520: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php5/php5.y:6044 + // line internal/php5/php5.y:6073 { target := &ast.Identifier{ast.Node{}, yyDollar[3].token.Value} yyVAL.node = &ast.ExprClassConstFetch{ast.Node{}, yyDollar[1].node, target} diff --git a/internal/php5/php5.y b/internal/php5/php5.y index d328d44..a462f00 100644 --- a/internal/php5/php5.y +++ b/internal/php5/php5.y @@ -395,52 +395,48 @@ top_statement: } | T_USE use_declarations ';' { - useList := &ast.StmtUseList{ast.Node{}, $2} - $$ = &ast.StmtUse{ast.Node{}, useList} - - // save position - useList.GetNode().Position = position.NewNodeListPosition($2) - $$.GetNode().Position = position.NewTokensPosition($1, $3) - - // save comments - yylex.(*Parser).setFreeFloating($$, token.Start, $1.SkippedTokens) - yylex.(*Parser).setFreeFloatingTokens($$, token.End, $3.SkippedTokens) + $$ = &ast.StmtUse{ + Node: ast.Node{ + Position: position.NewTokensPosition($1, $3), + }, + UseTkn: $1, + UseDeclarations: $2, + SemiColonTkn: $3, + } } | T_USE T_FUNCTION use_function_declarations ';' { - identifier := &ast.Identifier{ast.Node{}, $2.Value} - useList := &ast.StmtUseList{ast.Node{}, $3} - useType := &ast.StmtUseType{ast.Node{}, identifier, useList} - $$ = &ast.StmtUse{ast.Node{}, useType} - - // save position - identifier.GetNode().Position = position.NewTokenPosition($2) - useList.GetNode().Position = position.NewNodeListPosition($3) - useType.GetNode().Position = position.NewTokenNodePosition($2, useList) - $$.GetNode().Position = position.NewTokensPosition($1, $4) - - // save comments - yylex.(*Parser).setFreeFloating(identifier, token.Start, $2.SkippedTokens) - yylex.(*Parser).setFreeFloating($$, token.Start, $1.SkippedTokens) - yylex.(*Parser).setFreeFloatingTokens($$, token.End, $4.SkippedTokens) + $$ = &ast.StmtUse{ + Node: ast.Node{ + Position: position.NewTokensPosition($1, $4), + }, + UseTkn: $1, + Type: &ast.Identifier{ + Node: ast.Node{ + Position: position.NewTokenPosition($2), + }, + Value: $2.Value, + }, + UseDeclarations: $3, + SemiColonTkn: $4, + } } | T_USE T_CONST use_const_declarations ';' { - identifier := &ast.Identifier{ast.Node{}, $2.Value} - useList := &ast.StmtUseList{ast.Node{}, $3} - useType := &ast.StmtUseType{ast.Node{}, identifier, useList} - $$ = &ast.StmtUse{ast.Node{}, useType} - - // save position - identifier.GetNode().Position = position.NewTokenPosition($2) - useList.GetNode().Position = position.NewNodeListPosition($3) - useType.GetNode().Position = position.NewTokenNodePosition($2, useList) - $$.GetNode().Position = position.NewTokensPosition($1, $4) - - // save comments - yylex.(*Parser).setFreeFloating(identifier, token.Start, $2.SkippedTokens) - yylex.(*Parser).setFreeFloating($$, token.Start, $1.SkippedTokens) - yylex.(*Parser).setFreeFloatingTokens($$, token.End, $4.SkippedTokens) + $$ = &ast.StmtUse{ + Node: ast.Node{ + Position: position.NewTokensPosition($1, $4), + }, + UseTkn: $1, + Type: &ast.Identifier{ + Node: ast.Node{ + Position: position.NewTokenPosition($2), + }, + Value: $2.Value, + }, + UseDeclarations: $3, + SemiColonTkn: $4, + } } | constant_declaration ';' { @@ -458,10 +454,9 @@ top_statement: use_declarations: use_declarations ',' use_declaration { - $$ = append($1, $3) + $1[len($1)-1].(*ast.StmtUseDeclaration).CommaTkn = $2 - // save comments - yylex.(*Parser).setFreeFloating(lastNode($1), token.End, $2.SkippedTokens) + $$ = append($1, $3) } | use_declaration { @@ -472,73 +467,84 @@ use_declarations: use_declaration: namespace_name { - name := &ast.NameName{ast.Node{}, $1} - $$ = &ast.StmtUseDeclaration{ast.Node{}, name, nil} - - // save position - name.GetNode().Position = position.NewNodeListPosition($1) - $$.GetNode().Position = position.NewNodeListPosition($1) + $$ = &ast.StmtUseDeclaration{ + Node: ast.Node{ + Position: position.NewNodeListPosition($1), + }, + Use: &ast.NameName{ + Node: ast.Node{ + Position: position.NewNodeListPosition($1), + }, + Parts: $1, + }, + } } | namespace_name T_AS T_STRING { - name := &ast.NameName{ast.Node{}, $1} - alias := &ast.Identifier{ast.Node{}, $3.Value} - asAlias := &ast.ParserAs{ast.Node{}, alias} - $$ = &ast.StmtUseDeclaration{ast.Node{}, name, asAlias} - - // save position - name.GetNode().Position = position.NewNodeListPosition($1) - alias.GetNode().Position = position.NewTokenPosition($3) - asAlias.GetNode().Position = position.NewTokensPosition($2, $3) - $$.GetNode().Position = position.NewNodeListTokenPosition($1, $3) - - // save comments - yylex.(*Parser).setFreeFloating(asAlias, token.Start, $2.SkippedTokens) - yylex.(*Parser).setFreeFloating(alias, token.Start, $3.SkippedTokens) + $$ = &ast.StmtUseDeclaration{ + Node: ast.Node{ + Position: position.NewNodeListTokenPosition($1, $3), + }, + Use: &ast.NameName{ + Node: ast.Node{ + Position: position.NewNodeListPosition($1), + }, + Parts: $1, + }, + AsTkn: $2, + Alias: &ast.Identifier{ + Node: ast.Node{ + Position: position.NewTokenPosition($3), + }, + Value: $3.Value, + }, + } } | T_NS_SEPARATOR namespace_name { - name := &ast.NameName{ast.Node{}, $2} - useDeclaration := &ast.StmtUseDeclaration{ast.Node{}, name, nil} - $$ = &ast.ParserNsSeparator{ast.Node{}, useDeclaration} - - // save position - name.GetNode().Position = position.NewNodeListPosition($2) - useDeclaration.GetNode().Position = position.NewTokenNodePosition($1, name) - $$.GetNode().Position = position.NewTokenNodePosition($1, name) - - // save comments - yylex.(*Parser).setFreeFloating($$, token.Start, $1.SkippedTokens) + $$ = &ast.StmtUseDeclaration{ + Node: ast.Node{ + Position: position.NewTokenNodeListPosition($1, $2), + }, + NsSeparatorTkn: $1, + Use: &ast.NameName{ + Node: ast.Node{ + Position: position.NewNodeListPosition($2), + }, + Parts: $2, + }, + } } | T_NS_SEPARATOR namespace_name T_AS T_STRING { - name := &ast.NameName{ast.Node{}, $2} - alias := &ast.Identifier{ast.Node{}, $4.Value} - asAlias := &ast.ParserAs{ast.Node{}, alias} - useDeclaration := &ast.StmtUseDeclaration{ast.Node{}, name, alias} - $$ = &ast.ParserNsSeparator{ast.Node{}, useDeclaration} - - // save position - name.GetNode().Position = position.NewNodeListPosition($2) - alias.GetNode().Position = position.NewTokenPosition($4) - asAlias.GetNode().Position = position.NewTokensPosition($3, $4) - useDeclaration.GetNode().Position = position.NewTokensPosition($1, $4) - $$.GetNode().Position = position.NewTokensPosition($1, $4) - - // save comments - yylex.(*Parser).setFreeFloating($$, token.Start, $1.SkippedTokens) - yylex.(*Parser).setFreeFloating(asAlias, token.Start, $3.SkippedTokens) - yylex.(*Parser).setFreeFloating(alias, token.Start, $4.SkippedTokens) + $$ = &ast.StmtUseDeclaration{ + Node: ast.Node{ + Position: position.NewTokensPosition($1, $4), + }, + NsSeparatorTkn: $1, + Use: &ast.NameName{ + Node: ast.Node{ + Position: position.NewNodeListPosition($2), + }, + Parts: $2, + }, + AsTkn: $3, + Alias: &ast.Identifier{ + Node: ast.Node{ + Position: position.NewTokenPosition($4), + }, + Value: $4.Value, + }, + } } ; use_function_declarations: use_function_declarations ',' use_function_declaration { - $$ = append($1, $3) + $1[len($1)-1].(*ast.StmtUseDeclaration).CommaTkn = $2 - // save comments - yylex.(*Parser).setFreeFloating(lastNode($1), token.End, $2.SkippedTokens) + $$ = append($1, $3) } | use_function_declaration { @@ -549,73 +555,84 @@ use_function_declarations: use_function_declaration: namespace_name { - name := &ast.NameName{ast.Node{}, $1} - $$ = &ast.StmtUseDeclaration{ast.Node{}, name, nil} - - // save position - name.GetNode().Position = position.NewNodeListPosition($1) - $$.GetNode().Position = position.NewNodeListPosition($1) + $$ = &ast.StmtUseDeclaration{ + Node: ast.Node{ + Position: position.NewNodeListPosition($1), + }, + Use: &ast.NameName{ + Node: ast.Node{ + Position: position.NewNodeListPosition($1), + }, + Parts: $1, + }, + } } | namespace_name T_AS T_STRING { - name := &ast.NameName{ast.Node{}, $1} - alias := &ast.Identifier{ast.Node{}, $3.Value} - asAlias := &ast.ParserAs{ast.Node{}, alias} - $$ = &ast.StmtUseDeclaration{ast.Node{}, name, asAlias} - - // save position - name.GetNode().Position = position.NewNodeListPosition($1) - alias.GetNode().Position = position.NewTokenPosition($3) - asAlias.GetNode().Position = position.NewTokensPosition($2, $3) - $$.GetNode().Position = position.NewNodeListTokenPosition($1, $3) - - // save comments - yylex.(*Parser).setFreeFloating(asAlias, token.Start, $2.SkippedTokens) - yylex.(*Parser).setFreeFloating(alias, token.Start, $3.SkippedTokens) + $$ = &ast.StmtUseDeclaration{ + Node: ast.Node{ + Position: position.NewNodeListTokenPosition($1, $3), + }, + Use: &ast.NameName{ + Node: ast.Node{ + Position: position.NewNodeListPosition($1), + }, + Parts: $1, + }, + AsTkn: $2, + Alias: &ast.Identifier{ + Node: ast.Node{ + Position: position.NewTokenPosition($3), + }, + Value: $3.Value, + }, + } } | T_NS_SEPARATOR namespace_name { - name := &ast.NameName{ast.Node{}, $2} - useDeclaration := &ast.StmtUseDeclaration{ast.Node{}, name, nil} - $$ = &ast.ParserNsSeparator{ast.Node{}, useDeclaration} - - // save position - name.GetNode().Position = position.NewNodeListPosition($2) - useDeclaration.GetNode().Position = position.NewTokenNodePosition($1, name) - $$.GetNode().Position = position.NewTokenNodePosition($1, name) - - // save comments - yylex.(*Parser).setFreeFloating($$, token.Start, $1.SkippedTokens) + $$ = &ast.StmtUseDeclaration{ + Node: ast.Node{ + Position: position.NewTokenNodeListPosition($1, $2), + }, + NsSeparatorTkn: $1, + Use: &ast.NameName{ + Node: ast.Node{ + Position: position.NewNodeListPosition($2), + }, + Parts: $2, + }, + } } | T_NS_SEPARATOR namespace_name T_AS T_STRING { - name := &ast.NameName{ast.Node{}, $2} - alias := &ast.Identifier{ast.Node{}, $4.Value} - asAlias := &ast.ParserAs{ast.Node{}, alias} - useDeclaration := &ast.StmtUseDeclaration{ast.Node{}, name, alias} - $$ = &ast.ParserNsSeparator{ast.Node{}, useDeclaration} - - // save position - name.GetNode().Position = position.NewNodeListPosition($2) - alias.GetNode().Position = position.NewTokenPosition($4) - asAlias.GetNode().Position = position.NewTokensPosition($3, $4) - useDeclaration.GetNode().Position = position.NewTokensPosition($1, $4) - $$.GetNode().Position = position.NewTokensPosition($1, $4) - - // save comments - yylex.(*Parser).setFreeFloating($$, token.Start, $1.SkippedTokens) - yylex.(*Parser).setFreeFloating(asAlias, token.Start, $3.SkippedTokens) - yylex.(*Parser).setFreeFloating(alias, token.Start, $4.SkippedTokens) + $$ = &ast.StmtUseDeclaration{ + Node: ast.Node{ + Position: position.NewTokensPosition($1, $4), + }, + NsSeparatorTkn: $1, + Use: &ast.NameName{ + Node: ast.Node{ + Position: position.NewNodeListPosition($2), + }, + Parts: $2, + }, + AsTkn: $3, + Alias: &ast.Identifier{ + Node: ast.Node{ + Position: position.NewTokenPosition($4), + }, + Value: $4.Value, + }, + } } ; use_const_declarations: use_const_declarations ',' use_const_declaration { - $$ = append($1, $3) + $1[len($1)-1].(*ast.StmtUseDeclaration).CommaTkn = $2 - // save comments - yylex.(*Parser).setFreeFloating(lastNode($1), token.End, $2.SkippedTokens) + $$ = append($1, $3) } | use_const_declaration { @@ -626,63 +643,75 @@ use_const_declarations: use_const_declaration: namespace_name { - name := &ast.NameName{ast.Node{}, $1} - $$ = &ast.StmtUseDeclaration{ast.Node{}, name, nil} - - // save position - name.GetNode().Position = position.NewNodeListPosition($1) - $$.GetNode().Position = position.NewNodeListPosition($1) + $$ = &ast.StmtUseDeclaration{ + Node: ast.Node{ + Position: position.NewNodeListPosition($1), + }, + Use: &ast.NameName{ + Node: ast.Node{ + Position: position.NewNodeListPosition($1), + }, + Parts: $1, + }, + } } | namespace_name T_AS T_STRING { - name := &ast.NameName{ast.Node{}, $1} - alias := &ast.Identifier{ast.Node{}, $3.Value} - asAlias := &ast.ParserAs{ast.Node{}, alias} - $$ = &ast.StmtUseDeclaration{ast.Node{}, name, asAlias} - - // save position - name.GetNode().Position = position.NewNodeListPosition($1) - alias.GetNode().Position = position.NewTokenPosition($3) - asAlias.GetNode().Position = position.NewTokensPosition($2, $3) - $$.GetNode().Position = position.NewNodeListTokenPosition($1, $3) - - // save comments - yylex.(*Parser).setFreeFloating(asAlias, token.Start, $2.SkippedTokens) - yylex.(*Parser).setFreeFloating(alias, token.Start, $3.SkippedTokens) + $$ = &ast.StmtUseDeclaration{ + Node: ast.Node{ + Position: position.NewNodeListTokenPosition($1, $3), + }, + Use: &ast.NameName{ + Node: ast.Node{ + Position: position.NewNodeListPosition($1), + }, + Parts: $1, + }, + AsTkn: $2, + Alias: &ast.Identifier{ + Node: ast.Node{ + Position: position.NewTokenPosition($3), + }, + Value: $3.Value, + }, + } } | T_NS_SEPARATOR namespace_name { - name := &ast.NameName{ast.Node{}, $2} - useDeclaration := &ast.StmtUseDeclaration{ast.Node{}, name, nil} - $$ = &ast.ParserNsSeparator{ast.Node{}, useDeclaration} - - // save position - name.GetNode().Position = position.NewNodeListPosition($2) - useDeclaration.GetNode().Position = position.NewTokenNodePosition($1, name) - $$.GetNode().Position = position.NewTokenNodePosition($1, name) - - // save comments - yylex.(*Parser).setFreeFloating($$, token.Start, $1.SkippedTokens) + $$ = &ast.StmtUseDeclaration{ + Node: ast.Node{ + Position: position.NewTokenNodeListPosition($1, $2), + }, + NsSeparatorTkn: $1, + Use: &ast.NameName{ + Node: ast.Node{ + Position: position.NewNodeListPosition($2), + }, + Parts: $2, + }, + } } | T_NS_SEPARATOR namespace_name T_AS T_STRING { - name := &ast.NameName{ast.Node{}, $2} - alias := &ast.Identifier{ast.Node{}, $4.Value} - asAlias := &ast.ParserAs{ast.Node{}, alias} - useDeclaration := &ast.StmtUseDeclaration{ast.Node{}, name, alias} - $$ = &ast.ParserNsSeparator{ast.Node{}, useDeclaration} - - // save position - name.GetNode().Position = position.NewNodeListPosition($2) - alias.GetNode().Position = position.NewTokenPosition($4) - asAlias.GetNode().Position = position.NewTokensPosition($3, $4) - useDeclaration.GetNode().Position = position.NewTokensPosition($1, $4) - $$.GetNode().Position = position.NewTokensPosition($1, $4) - - // save comments - yylex.(*Parser).setFreeFloating($$, token.Start, $1.SkippedTokens) - yylex.(*Parser).setFreeFloating(asAlias, token.Start, $3.SkippedTokens) - yylex.(*Parser).setFreeFloating(alias, token.Start, $4.SkippedTokens) + $$ = &ast.StmtUseDeclaration{ + Node: ast.Node{ + Position: position.NewTokensPosition($1, $4), + }, + NsSeparatorTkn: $1, + Use: &ast.NameName{ + Node: ast.Node{ + Position: position.NewNodeListPosition($2), + }, + Parts: $2, + }, + AsTkn: $3, + Alias: &ast.Identifier{ + Node: ast.Node{ + Position: position.NewTokenPosition($4), + }, + Value: $4.Value, + }, + } } ; diff --git a/internal/php5/php5_test.go b/internal/php5/php5_test.go index 051917b..d802b19 100644 --- a/internal/php5/php5_test.go +++ b/internal/php5/php5_test.go @@ -8536,17 +8536,17 @@ func TestPhp5(t *testing.T) { EndPos: 3289, }, }, - UseList: &ast.StmtUseList{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 154, - EndLine: 154, - StartPos: 3285, - EndPos: 3288, + UseDeclarations: []ast.Vertex{ + &ast.StmtUseDeclaration{ + Node: ast.Node{ + Position: &position.Position{ + StartLine: 154, + EndLine: 154, + StartPos: 3285, + EndPos: 3288, + }, }, - }, - UseDeclarations: []ast.Vertex{ - &ast.StmtUseDeclaration{ + Use: &ast.NameName{ Node: ast.Node{ Position: &position.Position{ StartLine: 154, @@ -8555,27 +8555,17 @@ func TestPhp5(t *testing.T) { EndPos: 3288, }, }, - Use: &ast.NameName{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 154, - EndLine: 154, - StartPos: 3285, - EndPos: 3288, - }, - }, - Parts: []ast.Vertex{ - &ast.NameNamePart{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 154, - EndLine: 154, - StartPos: 3285, - EndPos: 3288, - }, + Parts: []ast.Vertex{ + &ast.NameNamePart{ + Node: ast.Node{ + Position: &position.Position{ + StartLine: 154, + EndLine: 154, + StartPos: 3285, + EndPos: 3288, }, - Value: []byte("Foo"), }, + Value: []byte("Foo"), }, }, }, @@ -8591,46 +8581,36 @@ func TestPhp5(t *testing.T) { EndPos: 3299, }, }, - UseList: &ast.StmtUseList{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 155, - EndLine: 155, - StartPos: 3294, - EndPos: 3298, + UseDeclarations: []ast.Vertex{ + &ast.StmtUseDeclaration{ + Node: ast.Node{ + Position: &position.Position{ + StartLine: 155, + EndLine: 155, + StartPos: 3294, + EndPos: 3298, + }, }, - }, - UseDeclarations: []ast.Vertex{ - &ast.StmtUseDeclaration{ + Use: &ast.NameName{ Node: ast.Node{ Position: &position.Position{ StartLine: 155, EndLine: 155, - StartPos: 3294, + StartPos: 3295, EndPos: 3298, }, }, - Use: &ast.NameName{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 155, - EndLine: 155, - StartPos: 3295, - EndPos: 3298, - }, - }, - Parts: []ast.Vertex{ - &ast.NameNamePart{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 155, - EndLine: 155, - StartPos: 3295, - EndPos: 3298, - }, + Parts: []ast.Vertex{ + &ast.NameNamePart{ + Node: ast.Node{ + Position: &position.Position{ + StartLine: 155, + EndLine: 155, + StartPos: 3295, + EndPos: 3298, }, - Value: []byte("Foo"), }, + Value: []byte("Foo"), }, }, }, @@ -8646,59 +8626,49 @@ func TestPhp5(t *testing.T) { EndPos: 3316, }, }, - UseList: &ast.StmtUseList{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 156, - EndLine: 156, - StartPos: 3304, - EndPos: 3315, + UseDeclarations: []ast.Vertex{ + &ast.StmtUseDeclaration{ + Node: ast.Node{ + Position: &position.Position{ + StartLine: 156, + EndLine: 156, + StartPos: 3304, + EndPos: 3315, + }, }, - }, - UseDeclarations: []ast.Vertex{ - &ast.StmtUseDeclaration{ + Use: &ast.NameName{ Node: ast.Node{ Position: &position.Position{ StartLine: 156, EndLine: 156, - StartPos: 3304, + StartPos: 3305, + EndPos: 3308, + }, + }, + Parts: []ast.Vertex{ + &ast.NameNamePart{ + Node: ast.Node{ + Position: &position.Position{ + StartLine: 156, + EndLine: 156, + StartPos: 3305, + EndPos: 3308, + }, + }, + Value: []byte("Foo"), + }, + }, + }, + Alias: &ast.Identifier{ + Node: ast.Node{ + Position: &position.Position{ + StartLine: 156, + EndLine: 156, + StartPos: 3312, EndPos: 3315, }, }, - Use: &ast.NameName{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 156, - EndLine: 156, - StartPos: 3305, - EndPos: 3308, - }, - }, - Parts: []ast.Vertex{ - &ast.NameNamePart{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 156, - EndLine: 156, - StartPos: 3305, - EndPos: 3308, - }, - }, - Value: []byte("Foo"), - }, - }, - }, - Alias: &ast.Identifier{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 156, - EndLine: 156, - StartPos: 3312, - EndPos: 3315, - }, - }, - Value: []byte("Bar"), - }, + Value: []byte("Bar"), }, }, }, @@ -8712,17 +8682,17 @@ func TestPhp5(t *testing.T) { EndPos: 3330, }, }, - UseList: &ast.StmtUseList{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 157, - EndLine: 157, - StartPos: 3321, - EndPos: 3329, + UseDeclarations: []ast.Vertex{ + &ast.StmtUseDeclaration{ + Node: ast.Node{ + Position: &position.Position{ + StartLine: 157, + EndLine: 157, + StartPos: 3321, + EndPos: 3324, + }, }, - }, - UseDeclarations: []ast.Vertex{ - &ast.StmtUseDeclaration{ + Use: &ast.NameName{ Node: ast.Node{ Position: &position.Position{ StartLine: 157, @@ -8731,31 +8701,31 @@ func TestPhp5(t *testing.T) { EndPos: 3324, }, }, - Use: &ast.NameName{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 157, - EndLine: 157, - StartPos: 3321, - EndPos: 3324, - }, - }, - Parts: []ast.Vertex{ - &ast.NameNamePart{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 157, - EndLine: 157, - StartPos: 3321, - EndPos: 3324, - }, + Parts: []ast.Vertex{ + &ast.NameNamePart{ + Node: ast.Node{ + Position: &position.Position{ + StartLine: 157, + EndLine: 157, + StartPos: 3321, + EndPos: 3324, }, - Value: []byte("Foo"), }, + Value: []byte("Foo"), }, }, }, - &ast.StmtUseDeclaration{ + }, + &ast.StmtUseDeclaration{ + Node: ast.Node{ + Position: &position.Position{ + StartLine: 157, + EndLine: 157, + StartPos: 3326, + EndPos: 3329, + }, + }, + Use: &ast.NameName{ Node: ast.Node{ Position: &position.Position{ StartLine: 157, @@ -8764,27 +8734,17 @@ func TestPhp5(t *testing.T) { EndPos: 3329, }, }, - Use: &ast.NameName{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 157, - EndLine: 157, - StartPos: 3326, - EndPos: 3329, - }, - }, - Parts: []ast.Vertex{ - &ast.NameNamePart{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 157, - EndLine: 157, - StartPos: 3326, - EndPos: 3329, - }, + Parts: []ast.Vertex{ + &ast.NameNamePart{ + Node: ast.Node{ + Position: &position.Position{ + StartLine: 157, + EndLine: 157, + StartPos: 3326, + EndPos: 3329, }, - Value: []byte("Bar"), }, + Value: []byte("Bar"), }, }, }, @@ -8800,17 +8760,17 @@ func TestPhp5(t *testing.T) { EndPos: 3351, }, }, - UseList: &ast.StmtUseList{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 158, - EndLine: 158, - StartPos: 3335, - EndPos: 3350, + UseDeclarations: []ast.Vertex{ + &ast.StmtUseDeclaration{ + Node: ast.Node{ + Position: &position.Position{ + StartLine: 158, + EndLine: 158, + StartPos: 3335, + EndPos: 3338, + }, }, - }, - UseDeclarations: []ast.Vertex{ - &ast.StmtUseDeclaration{ + Use: &ast.NameName{ Node: ast.Node{ Position: &position.Position{ StartLine: 158, @@ -8819,73 +8779,63 @@ func TestPhp5(t *testing.T) { EndPos: 3338, }, }, - Use: &ast.NameName{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 158, - EndLine: 158, - StartPos: 3335, - EndPos: 3338, - }, - }, - Parts: []ast.Vertex{ - &ast.NameNamePart{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 158, - EndLine: 158, - StartPos: 3335, - EndPos: 3338, - }, + Parts: []ast.Vertex{ + &ast.NameNamePart{ + Node: ast.Node{ + Position: &position.Position{ + StartLine: 158, + EndLine: 158, + StartPos: 3335, + EndPos: 3338, }, - Value: []byte("Foo"), }, + Value: []byte("Foo"), }, }, }, - &ast.StmtUseDeclaration{ + }, + &ast.StmtUseDeclaration{ + Node: ast.Node{ + Position: &position.Position{ + StartLine: 158, + EndLine: 158, + StartPos: 3340, + EndPos: 3350, + }, + }, + Use: &ast.NameName{ Node: ast.Node{ Position: &position.Position{ StartLine: 158, EndLine: 158, StartPos: 3340, + EndPos: 3343, + }, + }, + Parts: []ast.Vertex{ + &ast.NameNamePart{ + Node: ast.Node{ + Position: &position.Position{ + StartLine: 158, + EndLine: 158, + StartPos: 3340, + EndPos: 3343, + }, + }, + Value: []byte("Bar"), + }, + }, + }, + Alias: &ast.Identifier{ + Node: ast.Node{ + Position: &position.Position{ + StartLine: 158, + EndLine: 158, + StartPos: 3347, EndPos: 3350, }, }, - Use: &ast.NameName{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 158, - EndLine: 158, - StartPos: 3340, - EndPos: 3343, - }, - }, - Parts: []ast.Vertex{ - &ast.NameNamePart{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 158, - EndLine: 158, - StartPos: 3340, - EndPos: 3343, - }, - }, - Value: []byte("Bar"), - }, - }, - }, - Alias: &ast.Identifier{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 158, - EndLine: 158, - StartPos: 3347, - EndPos: 3350, - }, - }, - Value: []byte("Baz"), - }, + Value: []byte("Baz"), }, }, }, @@ -8899,46 +8849,38 @@ func TestPhp5(t *testing.T) { EndPos: 3375, }, }, - UseList: &ast.StmtUseType{ + Type: &ast.Identifier{ Node: ast.Node{ Position: &position.Position{ StartLine: 159, EndLine: 159, StartPos: 3356, - EndPos: 3374, + EndPos: 3364, }, }, - Type: &ast.Identifier{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 159, - EndLine: 159, - StartPos: 3356, - EndPos: 3364, - }, - }, - Value: []byte("function"), - }, - Use: &ast.StmtUseList{ + Value: []byte("function"), + }, + UseDeclarations: []ast.Vertex{ + &ast.StmtUseDeclaration{ Node: ast.Node{ Position: &position.Position{ StartLine: 159, EndLine: 159, StartPos: 3365, - EndPos: 3374, + EndPos: 3368, }, }, - UseDeclarations: []ast.Vertex{ - &ast.StmtUseDeclaration{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 159, - EndLine: 159, - StartPos: 3365, - EndPos: 3368, - }, + Use: &ast.NameName{ + Node: ast.Node{ + Position: &position.Position{ + StartLine: 159, + EndLine: 159, + StartPos: 3365, + EndPos: 3368, }, - Use: &ast.NameName{ + }, + Parts: []ast.Vertex{ + &ast.NameNamePart{ Node: ast.Node{ Position: &position.Position{ StartLine: 159, @@ -8947,31 +8889,31 @@ func TestPhp5(t *testing.T) { EndPos: 3368, }, }, - Parts: []ast.Vertex{ - &ast.NameNamePart{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 159, - EndLine: 159, - StartPos: 3365, - EndPos: 3368, - }, - }, - Value: []byte("Foo"), - }, - }, + Value: []byte("Foo"), }, }, - &ast.StmtUseDeclaration{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 159, - EndLine: 159, - StartPos: 3370, - EndPos: 3374, - }, + }, + }, + &ast.StmtUseDeclaration{ + Node: ast.Node{ + Position: &position.Position{ + StartLine: 159, + EndLine: 159, + StartPos: 3370, + EndPos: 3374, + }, + }, + Use: &ast.NameName{ + Node: ast.Node{ + Position: &position.Position{ + StartLine: 159, + EndLine: 159, + StartPos: 3371, + EndPos: 3374, }, - Use: &ast.NameName{ + }, + Parts: []ast.Vertex{ + &ast.NameNamePart{ Node: ast.Node{ Position: &position.Position{ StartLine: 159, @@ -8980,19 +8922,7 @@ func TestPhp5(t *testing.T) { EndPos: 3374, }, }, - Parts: []ast.Vertex{ - &ast.NameNamePart{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 159, - EndLine: 159, - StartPos: 3371, - EndPos: 3374, - }, - }, - Value: []byte("Bar"), - }, - }, + Value: []byte("Bar"), }, }, }, @@ -9008,46 +8938,38 @@ func TestPhp5(t *testing.T) { EndPos: 3413, }, }, - UseList: &ast.StmtUseType{ + Type: &ast.Identifier{ Node: ast.Node{ Position: &position.Position{ StartLine: 160, EndLine: 160, StartPos: 3380, - EndPos: 3412, + EndPos: 3388, }, }, - Type: &ast.Identifier{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 160, - EndLine: 160, - StartPos: 3380, - EndPos: 3388, - }, - }, - Value: []byte("function"), - }, - Use: &ast.StmtUseList{ + Value: []byte("function"), + }, + UseDeclarations: []ast.Vertex{ + &ast.StmtUseDeclaration{ Node: ast.Node{ Position: &position.Position{ StartLine: 160, EndLine: 160, StartPos: 3389, - EndPos: 3412, + EndPos: 3399, }, }, - UseDeclarations: []ast.Vertex{ - &ast.StmtUseDeclaration{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 160, - EndLine: 160, - StartPos: 3389, - EndPos: 3399, - }, + Use: &ast.NameName{ + Node: ast.Node{ + Position: &position.Position{ + StartLine: 160, + EndLine: 160, + StartPos: 3389, + EndPos: 3392, }, - Use: &ast.NameName{ + }, + Parts: []ast.Vertex{ + &ast.NameNamePart{ Node: ast.Node{ Position: &position.Position{ StartLine: 160, @@ -9056,42 +8978,42 @@ func TestPhp5(t *testing.T) { EndPos: 3392, }, }, - Parts: []ast.Vertex{ - &ast.NameNamePart{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 160, - EndLine: 160, - StartPos: 3389, - EndPos: 3392, - }, - }, - Value: []byte("Foo"), - }, - }, - }, - Alias: &ast.Identifier{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 160, - EndLine: 160, - StartPos: 3396, - EndPos: 3399, - }, - }, - Value: []byte("foo"), + Value: []byte("Foo"), }, }, - &ast.StmtUseDeclaration{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 160, - EndLine: 160, - StartPos: 3401, - EndPos: 3412, - }, + }, + Alias: &ast.Identifier{ + Node: ast.Node{ + Position: &position.Position{ + StartLine: 160, + EndLine: 160, + StartPos: 3396, + EndPos: 3399, }, - Use: &ast.NameName{ + }, + Value: []byte("foo"), + }, + }, + &ast.StmtUseDeclaration{ + Node: ast.Node{ + Position: &position.Position{ + StartLine: 160, + EndLine: 160, + StartPos: 3401, + EndPos: 3412, + }, + }, + Use: &ast.NameName{ + Node: ast.Node{ + Position: &position.Position{ + StartLine: 160, + EndLine: 160, + StartPos: 3402, + EndPos: 3405, + }, + }, + Parts: []ast.Vertex{ + &ast.NameNamePart{ Node: ast.Node{ Position: &position.Position{ StartLine: 160, @@ -9100,33 +9022,21 @@ func TestPhp5(t *testing.T) { EndPos: 3405, }, }, - Parts: []ast.Vertex{ - &ast.NameNamePart{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 160, - EndLine: 160, - StartPos: 3402, - EndPos: 3405, - }, - }, - Value: []byte("Bar"), - }, - }, - }, - Alias: &ast.Identifier{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 160, - EndLine: 160, - StartPos: 3409, - EndPos: 3412, - }, - }, - Value: []byte("bar"), + Value: []byte("Bar"), }, }, }, + Alias: &ast.Identifier{ + Node: ast.Node{ + Position: &position.Position{ + StartLine: 160, + EndLine: 160, + StartPos: 3409, + EndPos: 3412, + }, + }, + Value: []byte("bar"), + }, }, }, }, @@ -9139,46 +9049,38 @@ func TestPhp5(t *testing.T) { EndPos: 3434, }, }, - UseList: &ast.StmtUseType{ + Type: &ast.Identifier{ Node: ast.Node{ Position: &position.Position{ StartLine: 161, EndLine: 161, StartPos: 3418, - EndPos: 3433, + EndPos: 3423, }, }, - Type: &ast.Identifier{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 161, - EndLine: 161, - StartPos: 3418, - EndPos: 3423, - }, - }, - Value: []byte("const"), - }, - Use: &ast.StmtUseList{ + Value: []byte("const"), + }, + UseDeclarations: []ast.Vertex{ + &ast.StmtUseDeclaration{ Node: ast.Node{ Position: &position.Position{ StartLine: 161, EndLine: 161, StartPos: 3424, - EndPos: 3433, + EndPos: 3427, }, }, - UseDeclarations: []ast.Vertex{ - &ast.StmtUseDeclaration{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 161, - EndLine: 161, - StartPos: 3424, - EndPos: 3427, - }, + Use: &ast.NameName{ + Node: ast.Node{ + Position: &position.Position{ + StartLine: 161, + EndLine: 161, + StartPos: 3424, + EndPos: 3427, }, - Use: &ast.NameName{ + }, + Parts: []ast.Vertex{ + &ast.NameNamePart{ Node: ast.Node{ Position: &position.Position{ StartLine: 161, @@ -9187,31 +9089,31 @@ func TestPhp5(t *testing.T) { EndPos: 3427, }, }, - Parts: []ast.Vertex{ - &ast.NameNamePart{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 161, - EndLine: 161, - StartPos: 3424, - EndPos: 3427, - }, - }, - Value: []byte("Foo"), - }, - }, + Value: []byte("Foo"), }, }, - &ast.StmtUseDeclaration{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 161, - EndLine: 161, - StartPos: 3429, - EndPos: 3433, - }, + }, + }, + &ast.StmtUseDeclaration{ + Node: ast.Node{ + Position: &position.Position{ + StartLine: 161, + EndLine: 161, + StartPos: 3429, + EndPos: 3433, + }, + }, + Use: &ast.NameName{ + Node: ast.Node{ + Position: &position.Position{ + StartLine: 161, + EndLine: 161, + StartPos: 3430, + EndPos: 3433, }, - Use: &ast.NameName{ + }, + Parts: []ast.Vertex{ + &ast.NameNamePart{ Node: ast.Node{ Position: &position.Position{ StartLine: 161, @@ -9220,19 +9122,7 @@ func TestPhp5(t *testing.T) { EndPos: 3433, }, }, - Parts: []ast.Vertex{ - &ast.NameNamePart{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 161, - EndLine: 161, - StartPos: 3430, - EndPos: 3433, - }, - }, - Value: []byte("Bar"), - }, - }, + Value: []byte("Bar"), }, }, }, @@ -9248,46 +9138,38 @@ func TestPhp5(t *testing.T) { EndPos: 3469, }, }, - UseList: &ast.StmtUseType{ + Type: &ast.Identifier{ Node: ast.Node{ Position: &position.Position{ StartLine: 162, EndLine: 162, StartPos: 3439, - EndPos: 3468, + EndPos: 3444, }, }, - Type: &ast.Identifier{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 162, - EndLine: 162, - StartPos: 3439, - EndPos: 3444, - }, - }, - Value: []byte("const"), - }, - Use: &ast.StmtUseList{ + Value: []byte("const"), + }, + UseDeclarations: []ast.Vertex{ + &ast.StmtUseDeclaration{ Node: ast.Node{ Position: &position.Position{ StartLine: 162, EndLine: 162, StartPos: 3445, - EndPos: 3468, + EndPos: 3455, }, }, - UseDeclarations: []ast.Vertex{ - &ast.StmtUseDeclaration{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 162, - EndLine: 162, - StartPos: 3445, - EndPos: 3455, - }, + Use: &ast.NameName{ + Node: ast.Node{ + Position: &position.Position{ + StartLine: 162, + EndLine: 162, + StartPos: 3445, + EndPos: 3448, }, - Use: &ast.NameName{ + }, + Parts: []ast.Vertex{ + &ast.NameNamePart{ Node: ast.Node{ Position: &position.Position{ StartLine: 162, @@ -9296,42 +9178,42 @@ func TestPhp5(t *testing.T) { EndPos: 3448, }, }, - Parts: []ast.Vertex{ - &ast.NameNamePart{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 162, - EndLine: 162, - StartPos: 3445, - EndPos: 3448, - }, - }, - Value: []byte("Foo"), - }, - }, - }, - Alias: &ast.Identifier{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 162, - EndLine: 162, - StartPos: 3452, - EndPos: 3455, - }, - }, - Value: []byte("foo"), + Value: []byte("Foo"), }, }, - &ast.StmtUseDeclaration{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 162, - EndLine: 162, - StartPos: 3457, - EndPos: 3468, - }, + }, + Alias: &ast.Identifier{ + Node: ast.Node{ + Position: &position.Position{ + StartLine: 162, + EndLine: 162, + StartPos: 3452, + EndPos: 3455, }, - Use: &ast.NameName{ + }, + Value: []byte("foo"), + }, + }, + &ast.StmtUseDeclaration{ + Node: ast.Node{ + Position: &position.Position{ + StartLine: 162, + EndLine: 162, + StartPos: 3457, + EndPos: 3468, + }, + }, + Use: &ast.NameName{ + Node: ast.Node{ + Position: &position.Position{ + StartLine: 162, + EndLine: 162, + StartPos: 3458, + EndPos: 3461, + }, + }, + Parts: []ast.Vertex{ + &ast.NameNamePart{ Node: ast.Node{ Position: &position.Position{ StartLine: 162, @@ -9340,33 +9222,21 @@ func TestPhp5(t *testing.T) { EndPos: 3461, }, }, - Parts: []ast.Vertex{ - &ast.NameNamePart{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 162, - EndLine: 162, - StartPos: 3458, - EndPos: 3461, - }, - }, - Value: []byte("Bar"), - }, - }, - }, - Alias: &ast.Identifier{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 162, - EndLine: 162, - StartPos: 3465, - EndPos: 3468, - }, - }, - Value: []byte("bar"), + Value: []byte("Bar"), }, }, }, + Alias: &ast.Identifier{ + Node: ast.Node{ + Position: &position.Position{ + StartLine: 162, + EndLine: 162, + StartPos: 3465, + EndPos: 3468, + }, + }, + Value: []byte("bar"), + }, }, }, }, diff --git a/internal/php7/parser_test.go b/internal/php7/parser_test.go index d909c98..b33e201 100644 --- a/internal/php7/parser_test.go +++ b/internal/php7/parser_test.go @@ -12671,17 +12671,17 @@ func TestStmtUse(t *testing.T) { EndPos: 11, }, }, - UseList: &ast.StmtUseList{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 7, - EndPos: 10, + UseDeclarations: []ast.Vertex{ + &ast.StmtUseDeclaration{ + Node: ast.Node{ + Position: &position.Position{ + StartLine: 1, + EndLine: 1, + StartPos: 7, + EndPos: 10, + }, }, - }, - UseDeclarations: []ast.Vertex{ - &ast.StmtUseDeclaration{ + Use: &ast.NameName{ Node: ast.Node{ Position: &position.Position{ StartLine: 1, @@ -12690,27 +12690,17 @@ func TestStmtUse(t *testing.T) { EndPos: 10, }, }, - Use: &ast.NameName{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 7, - EndPos: 10, - }, - }, - Parts: []ast.Vertex{ - &ast.NameNamePart{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 7, - EndPos: 10, - }, + Parts: []ast.Vertex{ + &ast.NameNamePart{ + Node: ast.Node{ + Position: &position.Position{ + StartLine: 1, + EndLine: 1, + StartPos: 7, + EndPos: 10, }, - Value: []byte("Foo"), }, + Value: []byte("Foo"), }, }, }, @@ -12751,46 +12741,36 @@ func TestStmtUse_FullyQualified(t *testing.T) { EndPos: 12, }, }, - UseList: &ast.StmtUseList{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 7, - EndPos: 11, + UseDeclarations: []ast.Vertex{ + &ast.StmtUseDeclaration{ + Node: ast.Node{ + Position: &position.Position{ + StartLine: 1, + EndLine: 1, + StartPos: 7, + EndPos: 11, + }, }, - }, - UseDeclarations: []ast.Vertex{ - &ast.StmtUseDeclaration{ + Use: &ast.NameName{ Node: ast.Node{ Position: &position.Position{ StartLine: 1, EndLine: 1, - StartPos: 7, + StartPos: 8, EndPos: 11, }, }, - Use: &ast.NameName{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 8, - EndPos: 11, - }, - }, - Parts: []ast.Vertex{ - &ast.NameNamePart{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 8, - EndPos: 11, - }, + Parts: []ast.Vertex{ + &ast.NameNamePart{ + Node: ast.Node{ + Position: &position.Position{ + StartLine: 1, + EndLine: 1, + StartPos: 8, + EndPos: 11, }, - Value: []byte("Foo"), }, + Value: []byte("Foo"), }, }, }, @@ -12831,59 +12811,49 @@ func TestStmtUse_FullyQualifiedAlias(t *testing.T) { EndPos: 19, }, }, - UseList: &ast.StmtUseList{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 7, - EndPos: 18, + UseDeclarations: []ast.Vertex{ + &ast.StmtUseDeclaration{ + Node: ast.Node{ + Position: &position.Position{ + StartLine: 1, + EndLine: 1, + StartPos: 7, + EndPos: 18, + }, }, - }, - UseDeclarations: []ast.Vertex{ - &ast.StmtUseDeclaration{ + Use: &ast.NameName{ Node: ast.Node{ Position: &position.Position{ StartLine: 1, EndLine: 1, - StartPos: 7, + StartPos: 8, + EndPos: 11, + }, + }, + Parts: []ast.Vertex{ + &ast.NameNamePart{ + Node: ast.Node{ + Position: &position.Position{ + StartLine: 1, + EndLine: 1, + StartPos: 8, + EndPos: 11, + }, + }, + Value: []byte("Foo"), + }, + }, + }, + Alias: &ast.Identifier{ + Node: ast.Node{ + Position: &position.Position{ + StartLine: 1, + EndLine: 1, + StartPos: 15, EndPos: 18, }, }, - Use: &ast.NameName{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 8, - EndPos: 11, - }, - }, - Parts: []ast.Vertex{ - &ast.NameNamePart{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 8, - EndPos: 11, - }, - }, - Value: []byte("Foo"), - }, - }, - }, - Alias: &ast.Identifier{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 15, - EndPos: 18, - }, - }, - Value: []byte("Bar"), - }, + Value: []byte("Bar"), }, }, }, @@ -12922,17 +12892,17 @@ func TestStmtUse_List(t *testing.T) { EndPos: 16, }, }, - UseList: &ast.StmtUseList{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 7, - EndPos: 15, + UseDeclarations: []ast.Vertex{ + &ast.StmtUseDeclaration{ + Node: ast.Node{ + Position: &position.Position{ + StartLine: 1, + EndLine: 1, + StartPos: 7, + EndPos: 10, + }, }, - }, - UseDeclarations: []ast.Vertex{ - &ast.StmtUseDeclaration{ + Use: &ast.NameName{ Node: ast.Node{ Position: &position.Position{ StartLine: 1, @@ -12941,31 +12911,31 @@ func TestStmtUse_List(t *testing.T) { EndPos: 10, }, }, - Use: &ast.NameName{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 7, - EndPos: 10, - }, - }, - Parts: []ast.Vertex{ - &ast.NameNamePart{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 7, - EndPos: 10, - }, + Parts: []ast.Vertex{ + &ast.NameNamePart{ + Node: ast.Node{ + Position: &position.Position{ + StartLine: 1, + EndLine: 1, + StartPos: 7, + EndPos: 10, }, - Value: []byte("Foo"), }, + Value: []byte("Foo"), }, }, }, - &ast.StmtUseDeclaration{ + }, + &ast.StmtUseDeclaration{ + Node: ast.Node{ + Position: &position.Position{ + StartLine: 1, + EndLine: 1, + StartPos: 12, + EndPos: 15, + }, + }, + Use: &ast.NameName{ Node: ast.Node{ Position: &position.Position{ StartLine: 1, @@ -12974,27 +12944,17 @@ func TestStmtUse_List(t *testing.T) { EndPos: 15, }, }, - Use: &ast.NameName{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 12, - EndPos: 15, - }, - }, - Parts: []ast.Vertex{ - &ast.NameNamePart{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 12, - EndPos: 15, - }, + Parts: []ast.Vertex{ + &ast.NameNamePart{ + Node: ast.Node{ + Position: &position.Position{ + StartLine: 1, + EndLine: 1, + StartPos: 12, + EndPos: 15, }, - Value: []byte("Bar"), }, + Value: []byte("Bar"), }, }, }, @@ -13035,17 +12995,17 @@ func TestStmtUse_ListAlias(t *testing.T) { EndPos: 23, }, }, - UseList: &ast.StmtUseList{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 7, - EndPos: 22, + UseDeclarations: []ast.Vertex{ + &ast.StmtUseDeclaration{ + Node: ast.Node{ + Position: &position.Position{ + StartLine: 1, + EndLine: 1, + StartPos: 7, + EndPos: 10, + }, }, - }, - UseDeclarations: []ast.Vertex{ - &ast.StmtUseDeclaration{ + Use: &ast.NameName{ Node: ast.Node{ Position: &position.Position{ StartLine: 1, @@ -13054,73 +13014,63 @@ func TestStmtUse_ListAlias(t *testing.T) { EndPos: 10, }, }, - Use: &ast.NameName{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 7, - EndPos: 10, - }, - }, - Parts: []ast.Vertex{ - &ast.NameNamePart{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 7, - EndPos: 10, - }, + Parts: []ast.Vertex{ + &ast.NameNamePart{ + Node: ast.Node{ + Position: &position.Position{ + StartLine: 1, + EndLine: 1, + StartPos: 7, + EndPos: 10, }, - Value: []byte("Foo"), }, + Value: []byte("Foo"), }, }, }, - &ast.StmtUseDeclaration{ + }, + &ast.StmtUseDeclaration{ + Node: ast.Node{ + Position: &position.Position{ + StartLine: 1, + EndLine: 1, + StartPos: 12, + EndPos: 22, + }, + }, + Use: &ast.NameName{ Node: ast.Node{ Position: &position.Position{ StartLine: 1, EndLine: 1, StartPos: 12, + EndPos: 15, + }, + }, + Parts: []ast.Vertex{ + &ast.NameNamePart{ + Node: ast.Node{ + Position: &position.Position{ + StartLine: 1, + EndLine: 1, + StartPos: 12, + EndPos: 15, + }, + }, + Value: []byte("Bar"), + }, + }, + }, + Alias: &ast.Identifier{ + Node: ast.Node{ + Position: &position.Position{ + StartLine: 1, + EndLine: 1, + StartPos: 19, EndPos: 22, }, }, - Use: &ast.NameName{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 12, - EndPos: 15, - }, - }, - Parts: []ast.Vertex{ - &ast.NameNamePart{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 12, - EndPos: 15, - }, - }, - Value: []byte("Bar"), - }, - }, - }, - Alias: &ast.Identifier{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 19, - EndPos: 22, - }, - }, - Value: []byte("Baz"), - }, + Value: []byte("Baz"), }, }, }, @@ -13159,46 +13109,38 @@ func TestStmtUse_ListFunctionType(t *testing.T) { EndPos: 26, }, }, - UseList: &ast.StmtUseType{ + Type: &ast.Identifier{ Node: ast.Node{ Position: &position.Position{ StartLine: 1, EndLine: 1, StartPos: 7, - EndPos: 25, + EndPos: 15, }, }, - Type: &ast.Identifier{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 7, - EndPos: 15, - }, - }, - Value: []byte("function"), - }, - Use: &ast.StmtUseList{ + Value: []byte("function"), + }, + UseDeclarations: []ast.Vertex{ + &ast.StmtUseDeclaration{ Node: ast.Node{ Position: &position.Position{ StartLine: 1, EndLine: 1, StartPos: 16, - EndPos: 25, + EndPos: 19, }, }, - UseDeclarations: []ast.Vertex{ - &ast.StmtUseDeclaration{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 16, - EndPos: 19, - }, + Use: &ast.NameName{ + Node: ast.Node{ + Position: &position.Position{ + StartLine: 1, + EndLine: 1, + StartPos: 16, + EndPos: 19, }, - Use: &ast.NameName{ + }, + Parts: []ast.Vertex{ + &ast.NameNamePart{ Node: ast.Node{ Position: &position.Position{ StartLine: 1, @@ -13207,31 +13149,31 @@ func TestStmtUse_ListFunctionType(t *testing.T) { EndPos: 19, }, }, - Parts: []ast.Vertex{ - &ast.NameNamePart{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 16, - EndPos: 19, - }, - }, - Value: []byte("Foo"), - }, - }, + Value: []byte("Foo"), }, }, - &ast.StmtUseDeclaration{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 21, - EndPos: 25, - }, + }, + }, + &ast.StmtUseDeclaration{ + Node: ast.Node{ + Position: &position.Position{ + StartLine: 1, + EndLine: 1, + StartPos: 21, + EndPos: 25, + }, + }, + Use: &ast.NameName{ + Node: ast.Node{ + Position: &position.Position{ + StartLine: 1, + EndLine: 1, + StartPos: 22, + EndPos: 25, }, - Use: &ast.NameName{ + }, + Parts: []ast.Vertex{ + &ast.NameNamePart{ Node: ast.Node{ Position: &position.Position{ StartLine: 1, @@ -13240,19 +13182,7 @@ func TestStmtUse_ListFunctionType(t *testing.T) { EndPos: 25, }, }, - Parts: []ast.Vertex{ - &ast.NameNamePart{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 22, - EndPos: 25, - }, - }, - Value: []byte("Bar"), - }, - }, + Value: []byte("Bar"), }, }, }, @@ -13293,46 +13223,38 @@ func TestStmtUse_ListFunctionTypeAliases(t *testing.T) { EndPos: 40, }, }, - UseList: &ast.StmtUseType{ + Type: &ast.Identifier{ Node: ast.Node{ Position: &position.Position{ StartLine: 1, EndLine: 1, StartPos: 7, - EndPos: 39, + EndPos: 15, }, }, - Type: &ast.Identifier{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 7, - EndPos: 15, - }, - }, - Value: []byte("function"), - }, - Use: &ast.StmtUseList{ + Value: []byte("function"), + }, + UseDeclarations: []ast.Vertex{ + &ast.StmtUseDeclaration{ Node: ast.Node{ Position: &position.Position{ StartLine: 1, EndLine: 1, StartPos: 16, - EndPos: 39, + EndPos: 26, }, }, - UseDeclarations: []ast.Vertex{ - &ast.StmtUseDeclaration{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 16, - EndPos: 26, - }, + Use: &ast.NameName{ + Node: ast.Node{ + Position: &position.Position{ + StartLine: 1, + EndLine: 1, + StartPos: 16, + EndPos: 19, }, - Use: &ast.NameName{ + }, + Parts: []ast.Vertex{ + &ast.NameNamePart{ Node: ast.Node{ Position: &position.Position{ StartLine: 1, @@ -13341,42 +13263,42 @@ func TestStmtUse_ListFunctionTypeAliases(t *testing.T) { EndPos: 19, }, }, - Parts: []ast.Vertex{ - &ast.NameNamePart{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 16, - EndPos: 19, - }, - }, - Value: []byte("Foo"), - }, - }, - }, - Alias: &ast.Identifier{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 23, - EndPos: 26, - }, - }, - Value: []byte("foo"), + Value: []byte("Foo"), }, }, - &ast.StmtUseDeclaration{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 28, - EndPos: 39, - }, + }, + Alias: &ast.Identifier{ + Node: ast.Node{ + Position: &position.Position{ + StartLine: 1, + EndLine: 1, + StartPos: 23, + EndPos: 26, }, - Use: &ast.NameName{ + }, + Value: []byte("foo"), + }, + }, + &ast.StmtUseDeclaration{ + Node: ast.Node{ + Position: &position.Position{ + StartLine: 1, + EndLine: 1, + StartPos: 28, + EndPos: 39, + }, + }, + Use: &ast.NameName{ + Node: ast.Node{ + Position: &position.Position{ + StartLine: 1, + EndLine: 1, + StartPos: 29, + EndPos: 32, + }, + }, + Parts: []ast.Vertex{ + &ast.NameNamePart{ Node: ast.Node{ Position: &position.Position{ StartLine: 1, @@ -13385,33 +13307,21 @@ func TestStmtUse_ListFunctionTypeAliases(t *testing.T) { EndPos: 32, }, }, - Parts: []ast.Vertex{ - &ast.NameNamePart{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 29, - EndPos: 32, - }, - }, - Value: []byte("Bar"), - }, - }, - }, - Alias: &ast.Identifier{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 36, - EndPos: 39, - }, - }, - Value: []byte("bar"), + Value: []byte("Bar"), }, }, }, + Alias: &ast.Identifier{ + Node: ast.Node{ + Position: &position.Position{ + StartLine: 1, + EndLine: 1, + StartPos: 36, + EndPos: 39, + }, + }, + Value: []byte("bar"), + }, }, }, }, @@ -13449,47 +13359,38 @@ func TestStmtUse_ListConstType(t *testing.T) { EndPos: 23, }, }, - - UseList: &ast.StmtUseType{ + Type: &ast.Identifier{ Node: ast.Node{ Position: &position.Position{ StartLine: 1, EndLine: 1, StartPos: 7, - EndPos: 22, + EndPos: 12, }, }, - Type: &ast.Identifier{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 7, - EndPos: 12, - }, - }, - Value: []byte("const"), - }, - Use: &ast.StmtUseList{ + Value: []byte("const"), + }, + UseDeclarations: []ast.Vertex{ + &ast.StmtUseDeclaration{ Node: ast.Node{ Position: &position.Position{ StartLine: 1, EndLine: 1, StartPos: 13, - EndPos: 22, + EndPos: 16, }, }, - UseDeclarations: []ast.Vertex{ - &ast.StmtUseDeclaration{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 13, - EndPos: 16, - }, + Use: &ast.NameName{ + Node: ast.Node{ + Position: &position.Position{ + StartLine: 1, + EndLine: 1, + StartPos: 13, + EndPos: 16, }, - Use: &ast.NameName{ + }, + Parts: []ast.Vertex{ + &ast.NameNamePart{ Node: ast.Node{ Position: &position.Position{ StartLine: 1, @@ -13498,31 +13399,31 @@ func TestStmtUse_ListConstType(t *testing.T) { EndPos: 16, }, }, - Parts: []ast.Vertex{ - &ast.NameNamePart{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 13, - EndPos: 16, - }, - }, - Value: []byte("Foo"), - }, - }, + Value: []byte("Foo"), }, }, - &ast.StmtUseDeclaration{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 18, - EndPos: 22, - }, + }, + }, + &ast.StmtUseDeclaration{ + Node: ast.Node{ + Position: &position.Position{ + StartLine: 1, + EndLine: 1, + StartPos: 18, + EndPos: 22, + }, + }, + Use: &ast.NameName{ + Node: ast.Node{ + Position: &position.Position{ + StartLine: 1, + EndLine: 1, + StartPos: 19, + EndPos: 22, }, - Use: &ast.NameName{ + }, + Parts: []ast.Vertex{ + &ast.NameNamePart{ Node: ast.Node{ Position: &position.Position{ StartLine: 1, @@ -13531,19 +13432,7 @@ func TestStmtUse_ListConstType(t *testing.T) { EndPos: 22, }, }, - Parts: []ast.Vertex{ - &ast.NameNamePart{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 19, - EndPos: 22, - }, - }, - Value: []byte("Bar"), - }, - }, + Value: []byte("Bar"), }, }, }, @@ -13584,46 +13473,38 @@ func TestStmtUse_ListConstTypeAliases(t *testing.T) { EndPos: 37, }, }, - UseList: &ast.StmtUseType{ + Type: &ast.Identifier{ Node: ast.Node{ Position: &position.Position{ StartLine: 1, EndLine: 1, StartPos: 7, - EndPos: 36, + EndPos: 12, }, }, - Type: &ast.Identifier{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 7, - EndPos: 12, - }, - }, - Value: []byte("const"), - }, - Use: &ast.StmtUseList{ + Value: []byte("const"), + }, + UseDeclarations: []ast.Vertex{ + &ast.StmtUseDeclaration{ Node: ast.Node{ Position: &position.Position{ StartLine: 1, EndLine: 1, StartPos: 13, - EndPos: 36, + EndPos: 23, }, }, - UseDeclarations: []ast.Vertex{ - &ast.StmtUseDeclaration{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 13, - EndPos: 23, - }, + Use: &ast.NameName{ + Node: ast.Node{ + Position: &position.Position{ + StartLine: 1, + EndLine: 1, + StartPos: 13, + EndPos: 16, }, - Use: &ast.NameName{ + }, + Parts: []ast.Vertex{ + &ast.NameNamePart{ Node: ast.Node{ Position: &position.Position{ StartLine: 1, @@ -13632,42 +13513,42 @@ func TestStmtUse_ListConstTypeAliases(t *testing.T) { EndPos: 16, }, }, - Parts: []ast.Vertex{ - &ast.NameNamePart{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 13, - EndPos: 16, - }, - }, - Value: []byte("Foo"), - }, - }, - }, - Alias: &ast.Identifier{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 20, - EndPos: 23, - }, - }, - Value: []byte("foo"), + Value: []byte("Foo"), }, }, - &ast.StmtUseDeclaration{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 25, - EndPos: 36, - }, + }, + Alias: &ast.Identifier{ + Node: ast.Node{ + Position: &position.Position{ + StartLine: 1, + EndLine: 1, + StartPos: 20, + EndPos: 23, }, - Use: &ast.NameName{ + }, + Value: []byte("foo"), + }, + }, + &ast.StmtUseDeclaration{ + Node: ast.Node{ + Position: &position.Position{ + StartLine: 1, + EndLine: 1, + StartPos: 25, + EndPos: 36, + }, + }, + Use: &ast.NameName{ + Node: ast.Node{ + Position: &position.Position{ + StartLine: 1, + EndLine: 1, + StartPos: 26, + EndPos: 29, + }, + }, + Parts: []ast.Vertex{ + &ast.NameNamePart{ Node: ast.Node{ Position: &position.Position{ StartLine: 1, @@ -13676,33 +13557,21 @@ func TestStmtUse_ListConstTypeAliases(t *testing.T) { EndPos: 29, }, }, - Parts: []ast.Vertex{ - &ast.NameNamePart{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 26, - EndPos: 29, - }, - }, - Value: []byte("Bar"), - }, - }, - }, - Alias: &ast.Identifier{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 33, - EndPos: 36, - }, - }, - Value: []byte("bar"), + Value: []byte("Bar"), }, }, }, + Alias: &ast.Identifier{ + Node: ast.Node{ + Position: &position.Position{ + StartLine: 1, + EndLine: 1, + StartPos: 33, + EndPos: 36, + }, + }, + Value: []byte("bar"), + }, }, }, }, @@ -13731,7 +13600,7 @@ func TestStmtUse_GroupUse(t *testing.T) { }, }, Stmts: []ast.Vertex{ - &ast.StmtUse{ + &ast.StmtGroupUse{ Node: ast.Node{ Position: &position.Position{ StartLine: 1, @@ -13740,58 +13609,50 @@ func TestStmtUse_GroupUse(t *testing.T) { EndPos: 22, }, }, - UseList: &ast.StmtGroupUseList{ + Prefix: &ast.NameName{ Node: ast.Node{ Position: &position.Position{ StartLine: 1, EndLine: 1, StartPos: 7, - EndPos: 21, + EndPos: 10, }, }, - Prefix: &ast.NameName{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 7, - EndPos: 10, - }, - }, - Parts: []ast.Vertex{ - &ast.NameNamePart{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 7, - EndPos: 10, - }, + Parts: []ast.Vertex{ + &ast.NameNamePart{ + Node: ast.Node{ + Position: &position.Position{ + StartLine: 1, + EndLine: 1, + StartPos: 7, + EndPos: 10, }, - Value: []byte("Foo"), }, + Value: []byte("Foo"), }, }, - UseList: &ast.StmtUseList{ + }, + UseDeclarations: []ast.Vertex{ + &ast.StmtUseDeclaration{ Node: ast.Node{ Position: &position.Position{ StartLine: 1, EndLine: 1, StartPos: 12, - EndPos: 20, + EndPos: 15, }, }, - UseDeclarations: []ast.Vertex{ - &ast.StmtUseDeclaration{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 12, - EndPos: 15, - }, + Use: &ast.NameName{ + Node: ast.Node{ + Position: &position.Position{ + StartLine: 1, + EndLine: 1, + StartPos: 12, + EndPos: 15, }, - Use: &ast.NameName{ + }, + Parts: []ast.Vertex{ + &ast.NameNamePart{ Node: ast.Node{ Position: &position.Position{ StartLine: 1, @@ -13800,31 +13661,31 @@ func TestStmtUse_GroupUse(t *testing.T) { EndPos: 15, }, }, - Parts: []ast.Vertex{ - &ast.NameNamePart{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 12, - EndPos: 15, - }, - }, - Value: []byte("Bar"), - }, - }, + Value: []byte("Bar"), }, }, - &ast.StmtUseDeclaration{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 17, - EndPos: 20, - }, + }, + }, + &ast.StmtUseDeclaration{ + Node: ast.Node{ + Position: &position.Position{ + StartLine: 1, + EndLine: 1, + StartPos: 17, + EndPos: 20, + }, + }, + Use: &ast.NameName{ + Node: ast.Node{ + Position: &position.Position{ + StartLine: 1, + EndLine: 1, + StartPos: 17, + EndPos: 20, }, - Use: &ast.NameName{ + }, + Parts: []ast.Vertex{ + &ast.NameNamePart{ Node: ast.Node{ Position: &position.Position{ StartLine: 1, @@ -13833,19 +13694,7 @@ func TestStmtUse_GroupUse(t *testing.T) { EndPos: 20, }, }, - Parts: []ast.Vertex{ - &ast.NameNamePart{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 17, - EndPos: 20, - }, - }, - Value: []byte("Baz"), - }, - }, + Value: []byte("Baz"), }, }, }, @@ -13877,7 +13726,7 @@ func TestStmtUse_GroupUseAlias(t *testing.T) { }, }, Stmts: []ast.Vertex{ - &ast.StmtUse{ + &ast.StmtGroupUse{ Node: ast.Node{ Position: &position.Position{ StartLine: 1, @@ -13886,58 +13735,50 @@ func TestStmtUse_GroupUseAlias(t *testing.T) { EndPos: 30, }, }, - UseList: &ast.StmtGroupUseList{ + Prefix: &ast.NameName{ Node: ast.Node{ Position: &position.Position{ StartLine: 1, EndLine: 1, StartPos: 7, - EndPos: 29, + EndPos: 10, }, }, - Prefix: &ast.NameName{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 7, - EndPos: 10, - }, - }, - Parts: []ast.Vertex{ - &ast.NameNamePart{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 7, - EndPos: 10, - }, + Parts: []ast.Vertex{ + &ast.NameNamePart{ + Node: ast.Node{ + Position: &position.Position{ + StartLine: 1, + EndLine: 1, + StartPos: 7, + EndPos: 10, }, - Value: []byte("Foo"), }, + Value: []byte("Foo"), }, }, - UseList: &ast.StmtUseList{ + }, + UseDeclarations: []ast.Vertex{ + &ast.StmtUseDeclaration{ Node: ast.Node{ Position: &position.Position{ StartLine: 1, EndLine: 1, StartPos: 12, - EndPos: 28, + EndPos: 15, }, }, - UseDeclarations: []ast.Vertex{ - &ast.StmtUseDeclaration{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 12, - EndPos: 15, - }, + Use: &ast.NameName{ + Node: ast.Node{ + Position: &position.Position{ + StartLine: 1, + EndLine: 1, + StartPos: 12, + EndPos: 15, }, - Use: &ast.NameName{ + }, + Parts: []ast.Vertex{ + &ast.NameNamePart{ Node: ast.Node{ Position: &position.Position{ StartLine: 1, @@ -13946,31 +13787,31 @@ func TestStmtUse_GroupUseAlias(t *testing.T) { EndPos: 15, }, }, - Parts: []ast.Vertex{ - &ast.NameNamePart{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 12, - EndPos: 15, - }, - }, - Value: []byte("Bar"), - }, - }, + Value: []byte("Bar"), }, }, - &ast.StmtUseDeclaration{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 17, - EndPos: 28, - }, + }, + }, + &ast.StmtUseDeclaration{ + Node: ast.Node{ + Position: &position.Position{ + StartLine: 1, + EndLine: 1, + StartPos: 17, + EndPos: 28, + }, + }, + Use: &ast.NameName{ + Node: ast.Node{ + Position: &position.Position{ + StartLine: 1, + EndLine: 1, + StartPos: 17, + EndPos: 20, }, - Use: &ast.NameName{ + }, + Parts: []ast.Vertex{ + &ast.NameNamePart{ Node: ast.Node{ Position: &position.Position{ StartLine: 1, @@ -13979,33 +13820,21 @@ func TestStmtUse_GroupUseAlias(t *testing.T) { EndPos: 20, }, }, - Parts: []ast.Vertex{ - &ast.NameNamePart{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 17, - EndPos: 20, - }, - }, - Value: []byte("Baz"), - }, - }, - }, - Alias: &ast.Identifier{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 24, - EndPos: 28, - }, - }, - Value: []byte("quux"), + Value: []byte("Baz"), }, }, }, + Alias: &ast.Identifier{ + Node: ast.Node{ + Position: &position.Position{ + StartLine: 1, + EndLine: 1, + StartPos: 24, + EndPos: 28, + }, + }, + Value: []byte("quux"), + }, }, }, }, @@ -14034,7 +13863,7 @@ func TestStmtUse_FunctionGroupUse(t *testing.T) { }, }, Stmts: []ast.Vertex{ - &ast.StmtUse{ + &ast.StmtGroupUse{ Node: ast.Node{ Position: &position.Position{ StartLine: 1, @@ -14043,36 +13872,28 @@ func TestStmtUse_FunctionGroupUse(t *testing.T) { EndPos: 31, }, }, - UseList: &ast.StmtUseType{ + Type: &ast.Identifier{ Node: ast.Node{ Position: &position.Position{ StartLine: 1, EndLine: 1, StartPos: 7, - EndPos: 30, + EndPos: 15, }, }, - Type: &ast.Identifier{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 7, - EndPos: 15, - }, + Value: []byte("function"), + }, + Prefix: &ast.NameName{ + Node: ast.Node{ + Position: &position.Position{ + StartLine: 1, + EndLine: 1, + StartPos: 16, + EndPos: 19, }, - Value: []byte("function"), }, - Use: &ast.StmtGroupUseList{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 16, - EndPos: 30, - }, - }, - Prefix: &ast.NameName{ + Parts: []ast.Vertex{ + &ast.NameNamePart{ Node: ast.Node{ Position: &position.Position{ StartLine: 1, @@ -14081,31 +13902,31 @@ func TestStmtUse_FunctionGroupUse(t *testing.T) { EndPos: 19, }, }, - Parts: []ast.Vertex{ - &ast.NameNamePart{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 16, - EndPos: 19, - }, - }, - Value: []byte("Foo"), - }, + Value: []byte("Foo"), + }, + }, + }, + UseDeclarations: []ast.Vertex{ + &ast.StmtUseDeclaration{ + Node: ast.Node{ + Position: &position.Position{ + StartLine: 1, + EndLine: 1, + StartPos: 21, + EndPos: 24, }, }, - UseList: &ast.StmtUseList{ + Use: &ast.NameName{ Node: ast.Node{ Position: &position.Position{ StartLine: 1, EndLine: 1, StartPos: 21, - EndPos: 29, + EndPos: 24, }, }, - UseDeclarations: []ast.Vertex{ - &ast.StmtUseDeclaration{ + Parts: []ast.Vertex{ + &ast.NameNamePart{ Node: ast.Node{ Position: &position.Position{ StartLine: 1, @@ -14114,31 +13935,31 @@ func TestStmtUse_FunctionGroupUse(t *testing.T) { EndPos: 24, }, }, - Use: &ast.NameName{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 21, - EndPos: 24, - }, - }, - Parts: []ast.Vertex{ - &ast.NameNamePart{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 21, - EndPos: 24, - }, - }, - Value: []byte("Bar"), - }, - }, - }, + Value: []byte("Bar"), }, - &ast.StmtUseDeclaration{ + }, + }, + }, + &ast.StmtUseDeclaration{ + Node: ast.Node{ + Position: &position.Position{ + StartLine: 1, + EndLine: 1, + StartPos: 26, + EndPos: 29, + }, + }, + Use: &ast.NameName{ + Node: ast.Node{ + Position: &position.Position{ + StartLine: 1, + EndLine: 1, + StartPos: 26, + EndPos: 29, + }, + }, + Parts: []ast.Vertex{ + &ast.NameNamePart{ Node: ast.Node{ Position: &position.Position{ StartLine: 1, @@ -14147,29 +13968,7 @@ func TestStmtUse_FunctionGroupUse(t *testing.T) { EndPos: 29, }, }, - Use: &ast.NameName{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 26, - EndPos: 29, - }, - }, - Parts: []ast.Vertex{ - &ast.NameNamePart{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 26, - EndPos: 29, - }, - }, - Value: []byte("Baz"), - }, - }, - }, + Value: []byte("Baz"), }, }, }, @@ -14201,7 +14000,7 @@ func TestStmtUse_ConstGroupUse(t *testing.T) { }, }, Stmts: []ast.Vertex{ - &ast.StmtUse{ + &ast.StmtGroupUse{ Node: ast.Node{ Position: &position.Position{ StartLine: 1, @@ -14210,36 +14009,28 @@ func TestStmtUse_ConstGroupUse(t *testing.T) { EndPos: 28, }, }, - UseList: &ast.StmtUseType{ + Type: &ast.Identifier{ Node: ast.Node{ Position: &position.Position{ StartLine: 1, EndLine: 1, StartPos: 7, - EndPos: 27, + EndPos: 12, }, }, - Type: &ast.Identifier{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 7, - EndPos: 12, - }, + Value: []byte("const"), + }, + Prefix: &ast.NameName{ + Node: ast.Node{ + Position: &position.Position{ + StartLine: 1, + EndLine: 1, + StartPos: 13, + EndPos: 16, }, - Value: []byte("const"), }, - Use: &ast.StmtGroupUseList{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 13, - EndPos: 27, - }, - }, - Prefix: &ast.NameName{ + Parts: []ast.Vertex{ + &ast.NameNamePart{ Node: ast.Node{ Position: &position.Position{ StartLine: 1, @@ -14248,31 +14039,31 @@ func TestStmtUse_ConstGroupUse(t *testing.T) { EndPos: 16, }, }, - Parts: []ast.Vertex{ - &ast.NameNamePart{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 13, - EndPos: 16, - }, - }, - Value: []byte("Foo"), - }, + Value: []byte("Foo"), + }, + }, + }, + UseDeclarations: []ast.Vertex{ + &ast.StmtUseDeclaration{ + Node: ast.Node{ + Position: &position.Position{ + StartLine: 1, + EndLine: 1, + StartPos: 18, + EndPos: 21, }, }, - UseList: &ast.StmtUseList{ + Use: &ast.NameName{ Node: ast.Node{ Position: &position.Position{ StartLine: 1, EndLine: 1, StartPos: 18, - EndPos: 26, + EndPos: 21, }, }, - UseDeclarations: []ast.Vertex{ - &ast.StmtUseDeclaration{ + Parts: []ast.Vertex{ + &ast.NameNamePart{ Node: ast.Node{ Position: &position.Position{ StartLine: 1, @@ -14281,31 +14072,31 @@ func TestStmtUse_ConstGroupUse(t *testing.T) { EndPos: 21, }, }, - Use: &ast.NameName{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 18, - EndPos: 21, - }, - }, - Parts: []ast.Vertex{ - &ast.NameNamePart{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 18, - EndPos: 21, - }, - }, - Value: []byte("Bar"), - }, - }, - }, + Value: []byte("Bar"), }, - &ast.StmtUseDeclaration{ + }, + }, + }, + &ast.StmtUseDeclaration{ + Node: ast.Node{ + Position: &position.Position{ + StartLine: 1, + EndLine: 1, + StartPos: 23, + EndPos: 26, + }, + }, + Use: &ast.NameName{ + Node: ast.Node{ + Position: &position.Position{ + StartLine: 1, + EndLine: 1, + StartPos: 23, + EndPos: 26, + }, + }, + Parts: []ast.Vertex{ + &ast.NameNamePart{ Node: ast.Node{ Position: &position.Position{ StartLine: 1, @@ -14314,29 +14105,7 @@ func TestStmtUse_ConstGroupUse(t *testing.T) { EndPos: 26, }, }, - Use: &ast.NameName{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 23, - EndPos: 26, - }, - }, - Parts: []ast.Vertex{ - &ast.NameNamePart{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 23, - EndPos: 26, - }, - }, - Value: []byte("Baz"), - }, - }, - }, + Value: []byte("Baz"), }, }, }, @@ -14368,7 +14137,7 @@ func TestStmtUse_MixedGroupUse(t *testing.T) { }, }, Stmts: []ast.Vertex{ - &ast.StmtUse{ + &ast.StmtGroupUse{ Node: ast.Node{ Position: &position.Position{ StartLine: 1, @@ -14377,69 +14146,61 @@ func TestStmtUse_MixedGroupUse(t *testing.T) { EndPos: 37, }, }, - UseList: &ast.StmtGroupUseList{ + Prefix: &ast.NameName{ Node: ast.Node{ Position: &position.Position{ StartLine: 1, EndLine: 1, StartPos: 7, - EndPos: 36, + EndPos: 10, }, }, - Prefix: &ast.NameName{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 7, - EndPos: 10, - }, - }, - Parts: []ast.Vertex{ - &ast.NameNamePart{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 7, - EndPos: 10, - }, + Parts: []ast.Vertex{ + &ast.NameNamePart{ + Node: ast.Node{ + Position: &position.Position{ + StartLine: 1, + EndLine: 1, + StartPos: 7, + EndPos: 10, }, - Value: []byte("Foo"), }, + Value: []byte("Foo"), }, }, - UseList: &ast.StmtUseList{ + }, + UseDeclarations: []ast.Vertex{ + &ast.StmtUseDeclaration{ Node: ast.Node{ Position: &position.Position{ StartLine: 1, EndLine: 1, StartPos: 12, - EndPos: 35, + EndPos: 21, }, }, - UseDeclarations: []ast.Vertex{ - &ast.StmtUseType{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 12, - EndPos: 21, - }, + Type: &ast.Identifier{ + Node: ast.Node{ + Position: &position.Position{ + StartLine: 1, + EndLine: 1, + StartPos: 12, + EndPos: 17, }, - Type: &ast.Identifier{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 12, - EndPos: 17, - }, - }, - Value: []byte("const"), + }, + Value: []byte("const"), + }, + Use: &ast.NameName{ + Node: ast.Node{ + Position: &position.Position{ + StartLine: 1, + EndLine: 1, + StartPos: 18, + EndPos: 21, }, - Use: &ast.StmtUseDeclaration{ + }, + Parts: []ast.Vertex{ + &ast.NameNamePart{ Node: ast.Node{ Position: &position.Position{ StartLine: 1, @@ -14448,52 +14209,42 @@ func TestStmtUse_MixedGroupUse(t *testing.T) { EndPos: 21, }, }, - Use: &ast.NameName{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 18, - EndPos: 21, - }, - }, - Parts: []ast.Vertex{ - &ast.NameNamePart{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 18, - EndPos: 21, - }, - }, - Value: []byte("Bar"), - }, - }, - }, + Value: []byte("Bar"), }, }, - &ast.StmtUseType{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 23, - EndPos: 35, - }, + }, + }, + &ast.StmtUseDeclaration{ + Node: ast.Node{ + Position: &position.Position{ + StartLine: 1, + EndLine: 1, + StartPos: 23, + EndPos: 35, + }, + }, + Type: &ast.Identifier{ + Node: ast.Node{ + Position: &position.Position{ + StartLine: 1, + EndLine: 1, + StartPos: 23, + EndPos: 31, }, - Type: &ast.Identifier{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 23, - EndPos: 31, - }, - }, - Value: []byte("function"), + }, + Value: []byte("function"), + }, + Use: &ast.NameName{ + Node: ast.Node{ + Position: &position.Position{ + StartLine: 1, + EndLine: 1, + StartPos: 32, + EndPos: 35, }, - Use: &ast.StmtUseDeclaration{ + }, + Parts: []ast.Vertex{ + &ast.NameNamePart{ Node: ast.Node{ Position: &position.Position{ StartLine: 1, @@ -14502,29 +14253,7 @@ func TestStmtUse_MixedGroupUse(t *testing.T) { EndPos: 35, }, }, - Use: &ast.NameName{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 32, - EndPos: 35, - }, - }, - Parts: []ast.Vertex{ - &ast.NameNamePart{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 1, - EndLine: 1, - StartPos: 32, - EndPos: 35, - }, - }, - Value: []byte("Baz"), - }, - }, - }, + Value: []byte("Baz"), }, }, }, diff --git a/internal/php7/php7.go b/internal/php7/php7.go index 7ed02ea..2e0a57b 100644 --- a/internal/php7/php7.go +++ b/internal/php7/php7.go @@ -346,7 +346,7 @@ const yyEofCode = 1 const yyErrCode = 2 const yyInitialStackSize = 16 -// line internal/php7/php7.y:4838 +// line internal/php7/php7.y:4820 // line yacctab:1 var yyExca = [...]int{ @@ -2113,7 +2113,7 @@ yydefault: case 1: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:293 + // line internal/php7/php7.y:293 { yylex.(*Parser).rootNode = &ast.Root{ast.Node{}, yyDollar[1].list} @@ -2124,469 +2124,469 @@ yydefault: } case 2: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:304 + // line internal/php7/php7.y:304 { yyVAL.token = yyDollar[1].token } case 3: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:304 + // line internal/php7/php7.y:304 { yyVAL.token = yyDollar[1].token } case 4: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:304 + // line internal/php7/php7.y:304 { yyVAL.token = yyDollar[1].token } case 5: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:304 + // line internal/php7/php7.y:304 { yyVAL.token = yyDollar[1].token } case 6: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:304 + // line internal/php7/php7.y:304 { yyVAL.token = yyDollar[1].token } case 7: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:304 + // line internal/php7/php7.y:304 { yyVAL.token = yyDollar[1].token } case 8: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:304 + // line internal/php7/php7.y:304 { yyVAL.token = yyDollar[1].token } case 9: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:304 + // line internal/php7/php7.y:304 { yyVAL.token = yyDollar[1].token } case 10: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:305 + // line internal/php7/php7.y:305 { yyVAL.token = yyDollar[1].token } case 11: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:305 + // line internal/php7/php7.y:305 { yyVAL.token = yyDollar[1].token } case 12: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:305 + // line internal/php7/php7.y:305 { yyVAL.token = yyDollar[1].token } case 13: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:305 + // line internal/php7/php7.y:305 { yyVAL.token = yyDollar[1].token } case 14: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:305 + // line internal/php7/php7.y:305 { yyVAL.token = yyDollar[1].token } case 15: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:305 + // line internal/php7/php7.y:305 { yyVAL.token = yyDollar[1].token } case 16: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:305 + // line internal/php7/php7.y:305 { yyVAL.token = yyDollar[1].token } case 17: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:305 + // line internal/php7/php7.y:305 { yyVAL.token = yyDollar[1].token } case 18: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:305 + // line internal/php7/php7.y:305 { yyVAL.token = yyDollar[1].token } case 19: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:305 + // line internal/php7/php7.y:305 { yyVAL.token = yyDollar[1].token } case 20: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:305 + // line internal/php7/php7.y:305 { yyVAL.token = yyDollar[1].token } case 21: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:305 + // line internal/php7/php7.y:305 { yyVAL.token = yyDollar[1].token } case 22: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:306 + // line internal/php7/php7.y:306 { yyVAL.token = yyDollar[1].token } case 23: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:306 + // line internal/php7/php7.y:306 { yyVAL.token = yyDollar[1].token } case 24: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:306 + // line internal/php7/php7.y:306 { yyVAL.token = yyDollar[1].token } case 25: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:306 + // line internal/php7/php7.y:306 { yyVAL.token = yyDollar[1].token } case 26: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:306 + // line internal/php7/php7.y:306 { yyVAL.token = yyDollar[1].token } case 27: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:306 + // line internal/php7/php7.y:306 { yyVAL.token = yyDollar[1].token } case 28: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:306 + // line internal/php7/php7.y:306 { yyVAL.token = yyDollar[1].token } case 29: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:306 + // line internal/php7/php7.y:306 { yyVAL.token = yyDollar[1].token } case 30: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:306 + // line internal/php7/php7.y:306 { yyVAL.token = yyDollar[1].token } case 31: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:306 + // line internal/php7/php7.y:306 { yyVAL.token = yyDollar[1].token } case 32: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:307 + // line internal/php7/php7.y:307 { yyVAL.token = yyDollar[1].token } case 33: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:307 + // line internal/php7/php7.y:307 { yyVAL.token = yyDollar[1].token } case 34: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:307 + // line internal/php7/php7.y:307 { yyVAL.token = yyDollar[1].token } case 35: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:307 + // line internal/php7/php7.y:307 { yyVAL.token = yyDollar[1].token } case 36: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:307 + // line internal/php7/php7.y:307 { yyVAL.token = yyDollar[1].token } case 37: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:307 + // line internal/php7/php7.y:307 { yyVAL.token = yyDollar[1].token } case 38: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:307 + // line internal/php7/php7.y:307 { yyVAL.token = yyDollar[1].token } case 39: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:307 + // line internal/php7/php7.y:307 { yyVAL.token = yyDollar[1].token } case 40: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:307 + // line internal/php7/php7.y:307 { yyVAL.token = yyDollar[1].token } case 41: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:307 + // line internal/php7/php7.y:307 { yyVAL.token = yyDollar[1].token } case 42: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:308 + // line internal/php7/php7.y:308 { yyVAL.token = yyDollar[1].token } case 43: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:308 + // line internal/php7/php7.y:308 { yyVAL.token = yyDollar[1].token } case 44: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:308 + // line internal/php7/php7.y:308 { yyVAL.token = yyDollar[1].token } case 45: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:308 + // line internal/php7/php7.y:308 { yyVAL.token = yyDollar[1].token } case 46: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:308 + // line internal/php7/php7.y:308 { yyVAL.token = yyDollar[1].token } case 47: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:308 + // line internal/php7/php7.y:308 { yyVAL.token = yyDollar[1].token } case 48: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:308 + // line internal/php7/php7.y:308 { yyVAL.token = yyDollar[1].token } case 49: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:308 + // line internal/php7/php7.y:308 { yyVAL.token = yyDollar[1].token } case 50: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:308 + // line internal/php7/php7.y:308 { yyVAL.token = yyDollar[1].token } case 51: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:308 + // line internal/php7/php7.y:308 { yyVAL.token = yyDollar[1].token } case 52: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:308 + // line internal/php7/php7.y:308 { yyVAL.token = yyDollar[1].token } case 53: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:309 + // line internal/php7/php7.y:309 { yyVAL.token = yyDollar[1].token } case 54: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:309 + // line internal/php7/php7.y:309 { yyVAL.token = yyDollar[1].token } case 55: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:309 + // line internal/php7/php7.y:309 { yyVAL.token = yyDollar[1].token } case 56: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:309 + // line internal/php7/php7.y:309 { yyVAL.token = yyDollar[1].token } case 57: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:309 + // line internal/php7/php7.y:309 { yyVAL.token = yyDollar[1].token } case 58: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:309 + // line internal/php7/php7.y:309 { yyVAL.token = yyDollar[1].token } case 59: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:309 + // line internal/php7/php7.y:309 { yyVAL.token = yyDollar[1].token } case 60: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:309 + // line internal/php7/php7.y:309 { yyVAL.token = yyDollar[1].token } case 61: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:310 + // line internal/php7/php7.y:310 { yyVAL.token = yyDollar[1].token } case 62: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:310 + // line internal/php7/php7.y:310 { yyVAL.token = yyDollar[1].token } case 63: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:310 + // line internal/php7/php7.y:310 { yyVAL.token = yyDollar[1].token } case 64: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:310 + // line internal/php7/php7.y:310 { yyVAL.token = yyDollar[1].token } case 65: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:310 + // line internal/php7/php7.y:310 { yyVAL.token = yyDollar[1].token } case 66: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:310 + // line internal/php7/php7.y:310 { yyVAL.token = yyDollar[1].token } case 67: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:310 + // line internal/php7/php7.y:310 { yyVAL.token = yyDollar[1].token } case 68: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:310 + // line internal/php7/php7.y:310 { yyVAL.token = yyDollar[1].token } case 69: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:310 + // line internal/php7/php7.y:310 { yyVAL.token = yyDollar[1].token } case 70: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:315 + // line internal/php7/php7.y:315 { yyVAL.token = yyDollar[1].token } case 71: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:318 + // line internal/php7/php7.y:318 { yyVAL.token = yyDollar[1].token } case 72: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:318 + // line internal/php7/php7.y:318 { yyVAL.token = yyDollar[1].token } case 73: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:318 + // line internal/php7/php7.y:318 { yyVAL.token = yyDollar[1].token } case 74: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:318 + // line internal/php7/php7.y:318 { yyVAL.token = yyDollar[1].token } case 75: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:318 + // line internal/php7/php7.y:318 { yyVAL.token = yyDollar[1].token } case 76: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:318 + // line internal/php7/php7.y:318 { yyVAL.token = yyDollar[1].token } case 77: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:323 + // line internal/php7/php7.y:323 { yyVAL.token = yyDollar[1].token } case 78: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:327 + // line internal/php7/php7.y:327 { yyVAL.token = yyDollar[1].token } case 79: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php7/php7.y:334 + // line internal/php7/php7.y:334 { if inlineHtmlNode, ok := yyDollar[2].node.(*ast.StmtInlineHtml); ok && len(yyDollar[1].list) > 0 { prevNode := lastNode(yyDollar[1].list) @@ -2599,13 +2599,13 @@ yydefault: } case 80: yyDollar = yyS[yypt-0 : yypt+1] -// line internal/php7/php7.y:345 + // line internal/php7/php7.y:345 { yyVAL.list = []ast.Vertex{} } case 81: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:352 + // line internal/php7/php7.y:352 { namePart := &ast.NameNamePart{ast.Node{}, yyDollar[1].token.Value} yyVAL.list = []ast.Vertex{namePart} @@ -2618,7 +2618,7 @@ yydefault: } case 82: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:363 + // line internal/php7/php7.y:363 { namePart := &ast.NameNamePart{ast.Node{}, yyDollar[3].token.Value} yyVAL.list = append(yyDollar[1].list, namePart) @@ -2632,7 +2632,7 @@ yydefault: } case 83: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:378 + // line internal/php7/php7.y:378 { yyVAL.node = &ast.NameName{ast.Node{}, yyDollar[1].list} @@ -2641,7 +2641,7 @@ yydefault: } case 84: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:385 + // line internal/php7/php7.y:385 { yyVAL.node = &ast.NameRelative{ast.Node{}, yyDollar[3].list} @@ -2654,7 +2654,7 @@ yydefault: } case 85: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php7/php7.y:396 + // line internal/php7/php7.y:396 { yyVAL.node = &ast.NameFullyQualified{ast.Node{}, yyDollar[2].list} @@ -2666,44 +2666,44 @@ yydefault: } case 86: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:409 + // line internal/php7/php7.y:409 { // error yyVAL.node = nil } case 87: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:414 + // line internal/php7/php7.y:414 { yyVAL.node = yyDollar[1].node } case 88: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:418 + // line internal/php7/php7.y:418 { yyVAL.node = yyDollar[1].node } case 89: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:422 + // line internal/php7/php7.y:422 { yyVAL.node = yyDollar[1].node } case 90: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:426 + // line internal/php7/php7.y:426 { yyVAL.node = yyDollar[1].node } case 91: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:430 + // line internal/php7/php7.y:430 { yyVAL.node = yyDollar[1].node } case 92: yyDollar = yyS[yypt-4 : yypt+1] -// line internal/php7/php7.y:434 + // line internal/php7/php7.y:434 { yyVAL.node = &ast.StmtHaltCompiler{ast.Node{}} @@ -2716,7 +2716,7 @@ yydefault: } case 93: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:445 + // line internal/php7/php7.y:445 { name := &ast.NameName{ast.Node{}, yyDollar[2].list} yyVAL.node = &ast.StmtNamespace{ast.Node{}, name, nil} @@ -2733,7 +2733,7 @@ yydefault: } case 94: yyDollar = yyS[yypt-5 : yypt+1] -// line internal/php7/php7.y:460 + // line internal/php7/php7.y:460 { name := &ast.NameName{ast.Node{}, yyDollar[2].list} yyVAL.node = &ast.StmtNamespace{ast.Node{}, name, yyDollar[4].list} @@ -2750,7 +2750,7 @@ yydefault: } case 95: yyDollar = yyS[yypt-4 : yypt+1] -// line internal/php7/php7.y:475 + // line internal/php7/php7.y:475 { yyVAL.node = &ast.StmtNamespace{ast.Node{}, nil, yyDollar[3].list} @@ -2764,67 +2764,59 @@ yydefault: } case 96: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:487 + // line internal/php7/php7.y:487 { - yyVAL.node = &ast.StmtUse{ast.Node{}, yyDollar[2].node} + use := yyDollar[2].node.(*ast.StmtGroupUse) - // save position - yyVAL.node.GetNode().Position = position.NewTokensPosition(yyDollar[1].token, yyDollar[3].token) + use.Node.Position = position.NewTokensPosition(yyDollar[1].token, yyDollar[3].token) + use.UseTkn = yyDollar[1].token + use.SemiColonTkn = yyDollar[3].token - // save comments - yylex.(*Parser).setFreeFloating(yyVAL.node, token.Start, yyDollar[1].token.SkippedTokens) - yylex.(*Parser).setFreeFloatingTokens(yyVAL.node, token.End, yyDollar[3].token.SkippedTokens) + yyVAL.node = yyDollar[2].node } case 97: yyDollar = yyS[yypt-4 : yypt+1] -// line internal/php7/php7.y:498 + // line internal/php7/php7.y:497 { - useType := &ast.StmtUseType{ast.Node{}, yyDollar[2].node, yyDollar[3].node} - yyVAL.node = &ast.StmtUse{ast.Node{}, useType} + use := yyDollar[3].node.(*ast.StmtGroupUse) - // save position - useType.GetNode().Position = position.NewNodesPosition(yyDollar[2].node, yyDollar[3].node) - yyVAL.node.GetNode().Position = position.NewTokensPosition(yyDollar[1].token, yyDollar[4].token) + use.Node.Position = position.NewTokensPosition(yyDollar[1].token, yyDollar[4].token) + use.UseTkn = yyDollar[1].token + use.Type = yyDollar[2].node + use.SemiColonTkn = yyDollar[4].token - // save comments - yylex.(*Parser).setFreeFloating(yyVAL.node, token.Start, yyDollar[1].token.SkippedTokens) - yylex.(*Parser).setFreeFloatingTokens(yyVAL.node, token.End, yyDollar[4].token.SkippedTokens) + yyVAL.node = yyDollar[3].node } case 98: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:511 + // line internal/php7/php7.y:508 { - useList := &ast.StmtUseList{ast.Node{}, yyDollar[2].list} - yyVAL.node = &ast.StmtUse{ast.Node{}, useList} - - // save position - useList.GetNode().Position = position.NewNodeListPosition(yyDollar[2].list) - yyVAL.node.GetNode().Position = position.NewTokensPosition(yyDollar[1].token, yyDollar[3].token) - - // save comments - yylex.(*Parser).setFreeFloating(yyVAL.node, token.Start, yyDollar[1].token.SkippedTokens) - yylex.(*Parser).setFreeFloatingTokens(yyVAL.node, token.End, yyDollar[3].token.SkippedTokens) + yyVAL.node = &ast.StmtUse{ + Node: ast.Node{ + Position: position.NewTokensPosition(yyDollar[1].token, yyDollar[3].token), + }, + UseTkn: yyDollar[1].token, + UseDeclarations: yyDollar[2].list, + SemiColonTkn: yyDollar[3].token, + } } case 99: yyDollar = yyS[yypt-4 : yypt+1] -// line internal/php7/php7.y:524 + // line internal/php7/php7.y:519 { - useList := &ast.StmtUseList{ast.Node{}, yyDollar[3].list} - useType := &ast.StmtUseType{ast.Node{}, yyDollar[2].node, useList} - yyVAL.node = &ast.StmtUse{ast.Node{}, useType} - - // save position - useList.GetNode().Position = position.NewNodeListPosition(yyDollar[3].list) - useType.GetNode().Position = position.NewNodesPosition(yyDollar[2].node, useList) - yyVAL.node.GetNode().Position = position.NewTokensPosition(yyDollar[1].token, yyDollar[4].token) - - // save comments - yylex.(*Parser).setFreeFloating(yyVAL.node, token.Start, yyDollar[1].token.SkippedTokens) - yylex.(*Parser).setFreeFloatingTokens(yyVAL.node, token.End, yyDollar[4].token.SkippedTokens) + yyVAL.node = &ast.StmtUse{ + Node: ast.Node{ + Position: position.NewTokensPosition(yyDollar[1].token, yyDollar[4].token), + }, + UseTkn: yyDollar[1].token, + Type: yyDollar[2].node, + UseDeclarations: yyDollar[3].list, + SemiColonTkn: yyDollar[4].token, + } } case 100: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:539 + // line internal/php7/php7.y:531 { yyVAL.node = &ast.StmtConstList{ast.Node{}, yyDollar[2].list} @@ -2838,7 +2830,7 @@ yydefault: } case 101: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:554 + // line internal/php7/php7.y:546 { yyVAL.node = &ast.Identifier{ast.Node{}, yyDollar[1].token.Value} @@ -2850,7 +2842,7 @@ yydefault: } case 102: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:564 + // line internal/php7/php7.y:556 { yyVAL.node = &ast.Identifier{ast.Node{}, yyDollar[1].token.Value} @@ -2862,234 +2854,224 @@ yydefault: } case 103: yyDollar = yyS[yypt-6 : yypt+1] -// line internal/php7/php7.y:577 + // line internal/php7/php7.y:569 { - name := &ast.NameName{ast.Node{}, yyDollar[1].list} - useList := &ast.StmtUseList{ast.Node{}, yyDollar[4].list} - useListBrackets := &ast.ParserBrackets{ast.Node{}, useList} - useListNsSeparator := &ast.ParserNsSeparator{ast.Node{}, useListBrackets} - yyVAL.node = &ast.StmtGroupUseList{ast.Node{}, name, useListNsSeparator} - - // save position - name.GetNode().Position = position.NewNodeListPosition(yyDollar[1].list) - useList.GetNode().Position = position.NewNodeListPosition(yyDollar[4].list) - useListBrackets.GetNode().Position = position.NewTokensPosition(yyDollar[3].token, yyDollar[6].token) - useListNsSeparator.GetNode().Position = position.NewTokensPosition(yyDollar[2].token, yyDollar[6].token) - yyVAL.node.GetNode().Position = position.NewNodeListTokenPosition(yyDollar[1].list, yyDollar[6].token) - - // save comments - if yyDollar[5].token != nil { - yylex.(*Parser).setFreeFloatingTokens(useList, token.End, yyDollar[5].token.SkippedTokens) + if len(yyDollar[4].list) > 0 { + yyDollar[4].list[len(yyDollar[4].list)-1].(*ast.StmtUseDeclaration).CommaTkn = yyDollar[5].token + } + + yyVAL.node = &ast.StmtGroupUse{ + Node: ast.Node{ + Position: position.NewNodeListTokenPosition(yyDollar[1].list, yyDollar[6].token), + }, + Prefix: &ast.NameName{ + Node: ast.Node{ + Position: position.NewNodeListPosition(yyDollar[1].list), + }, + Parts: yyDollar[1].list, + }, + NsSeparatorTkn: yyDollar[2].token, + OpenCurlyBracketTkn: yyDollar[3].token, + UseDeclarations: yyDollar[4].list, + CloseCurlyBracketTkn: yyDollar[6].token, } - yylex.(*Parser).setFreeFloatingTokens(useListBrackets, token.Start, yyDollar[3].token.SkippedTokens) - yylex.(*Parser).setFreeFloatingTokens(useListBrackets, token.End, yyDollar[6].token.SkippedTokens) - yylex.(*Parser).setFreeFloating(useListNsSeparator, token.Start, yyDollar[2].token.SkippedTokens) } case 104: yyDollar = yyS[yypt-7 : yypt+1] -// line internal/php7/php7.y:600 + // line internal/php7/php7.y:591 { - name := &ast.NameName{ast.Node{}, yyDollar[2].list} - prefixNsSeparator := &ast.ParserNsSeparator{ast.Node{}, name} - useList := &ast.StmtUseList{ast.Node{}, yyDollar[5].list} - useListBrackets := &ast.ParserBrackets{ast.Node{}, useList} - useListNsSeparator := &ast.ParserNsSeparator{ast.Node{}, useListBrackets} - yyVAL.node = &ast.StmtGroupUseList{ast.Node{}, prefixNsSeparator, useListNsSeparator} + yyDollar[5].list[len(yyDollar[5].list)-1].(*ast.StmtUseDeclaration).CommaTkn = yyDollar[6].token - // save position - name.GetNode().Position = position.NewNodeListPosition(yyDollar[2].list) - prefixNsSeparator.GetNode().Position = position.NewTokenNodePosition(yyDollar[1].token, name) - useList.GetNode().Position = position.NewNodeListPosition(yyDollar[5].list) - useListBrackets.GetNode().Position = position.NewTokensPosition(yyDollar[4].token, yyDollar[7].token) - useListNsSeparator.GetNode().Position = position.NewTokensPosition(yyDollar[3].token, yyDollar[7].token) - yyVAL.node.GetNode().Position = position.NewTokensPosition(yyDollar[1].token, yyDollar[7].token) - - // save comments - yylex.(*Parser).setFreeFloating(prefixNsSeparator, token.Start, yyDollar[1].token.SkippedTokens) - if yyDollar[6].token != nil { - yylex.(*Parser).setFreeFloatingTokens(useList, token.End, yyDollar[6].token.SkippedTokens) + yyVAL.node = &ast.StmtGroupUse{ + Node: ast.Node{ + Position: position.NewTokensPosition(yyDollar[1].token, yyDollar[7].token), + }, + LeadingNsSeparatorTkn: yyDollar[1].token, + Prefix: &ast.NameName{ + Node: ast.Node{ + Position: position.NewNodeListPosition(yyDollar[2].list), + }, + Parts: yyDollar[2].list, + }, + NsSeparatorTkn: yyDollar[3].token, + OpenCurlyBracketTkn: yyDollar[4].token, + UseDeclarations: yyDollar[5].list, + CloseCurlyBracketTkn: yyDollar[7].token, } - yylex.(*Parser).setFreeFloatingTokens(useListBrackets, token.Start, yyDollar[4].token.SkippedTokens) - yylex.(*Parser).setFreeFloatingTokens(useListBrackets, token.End, yyDollar[7].token.SkippedTokens) - yylex.(*Parser).setFreeFloating(useListNsSeparator, token.Start, yyDollar[3].token.SkippedTokens) } case 105: yyDollar = yyS[yypt-6 : yypt+1] -// line internal/php7/php7.y:629 + // line internal/php7/php7.y:615 { - name := &ast.NameName{ast.Node{}, yyDollar[1].list} - useList := &ast.StmtUseList{ast.Node{}, yyDollar[4].list} - useListBrackets := &ast.ParserBrackets{ast.Node{}, useList} - useListNsSeparator := &ast.ParserNsSeparator{ast.Node{}, useListBrackets} - yyVAL.node = &ast.StmtGroupUseList{ast.Node{}, name, useListNsSeparator} + yyDollar[4].list[len(yyDollar[4].list)-1].(*ast.StmtUseDeclaration).CommaTkn = yyDollar[5].token - // save position - name.GetNode().Position = position.NewNodeListPosition(yyDollar[1].list) - useList.GetNode().Position = position.NewNodeListPosition(yyDollar[4].list) - useListBrackets.GetNode().Position = position.NewTokensPosition(yyDollar[3].token, yyDollar[6].token) - useListNsSeparator.GetNode().Position = position.NewTokensPosition(yyDollar[2].token, yyDollar[6].token) - yyVAL.node.GetNode().Position = position.NewNodeListTokenPosition(yyDollar[1].list, yyDollar[6].token) - - // save comments - if yyDollar[5].token != nil { - yylex.(*Parser).setFreeFloatingTokens(useList, token.End, yyDollar[5].token.SkippedTokens) + yyVAL.node = &ast.StmtGroupUse{ + Node: ast.Node{ + Position: position.NewNodeListTokenPosition(yyDollar[1].list, yyDollar[6].token), + }, + Prefix: &ast.NameName{ + Node: ast.Node{ + Position: position.NewNodeListPosition(yyDollar[1].list), + }, + Parts: yyDollar[1].list, + }, + NsSeparatorTkn: yyDollar[2].token, + OpenCurlyBracketTkn: yyDollar[3].token, + UseDeclarations: yyDollar[4].list, + CloseCurlyBracketTkn: yyDollar[6].token, } - yylex.(*Parser).setFreeFloatingTokens(useListBrackets, token.Start, yyDollar[3].token.SkippedTokens) - yylex.(*Parser).setFreeFloatingTokens(useListBrackets, token.End, yyDollar[6].token.SkippedTokens) - yylex.(*Parser).setFreeFloating(useListNsSeparator, token.Start, yyDollar[2].token.SkippedTokens) } case 106: yyDollar = yyS[yypt-7 : yypt+1] -// line internal/php7/php7.y:652 + // line internal/php7/php7.y:635 { - name := &ast.NameName{ast.Node{}, yyDollar[2].list} - prefixNsSeparator := &ast.ParserNsSeparator{ast.Node{}, name} - useList := &ast.StmtUseList{ast.Node{}, yyDollar[5].list} - useListBrackets := &ast.ParserBrackets{ast.Node{}, useList} - useListNsSeparator := &ast.ParserNsSeparator{ast.Node{}, useListBrackets} - yyVAL.node = &ast.StmtGroupUseList{ast.Node{}, prefixNsSeparator, useListNsSeparator} + yyDollar[5].list[len(yyDollar[5].list)-1].(*ast.StmtUseDeclaration).CommaTkn = yyDollar[6].token - // save position - name.GetNode().Position = position.NewNodeListPosition(yyDollar[2].list) - prefixNsSeparator.GetNode().Position = position.NewTokenNodePosition(yyDollar[1].token, name) - useList.GetNode().Position = position.NewNodeListPosition(yyDollar[5].list) - useListBrackets.GetNode().Position = position.NewTokensPosition(yyDollar[4].token, yyDollar[7].token) - useListNsSeparator.GetNode().Position = position.NewTokensPosition(yyDollar[3].token, yyDollar[7].token) - yyVAL.node.GetNode().Position = position.NewTokensPosition(yyDollar[1].token, yyDollar[7].token) - - // save comments - yylex.(*Parser).setFreeFloating(prefixNsSeparator, token.Start, yyDollar[1].token.SkippedTokens) - if yyDollar[6].token != nil { - yylex.(*Parser).setFreeFloatingTokens(useList, token.End, yyDollar[6].token.SkippedTokens) + yyVAL.node = &ast.StmtGroupUse{ + Node: ast.Node{ + Position: position.NewTokensPosition(yyDollar[1].token, yyDollar[7].token), + }, + LeadingNsSeparatorTkn: yyDollar[1].token, + Prefix: &ast.NameName{ + Node: ast.Node{ + Position: position.NewNodeListPosition(yyDollar[2].list), + }, + Parts: yyDollar[2].list, + }, + NsSeparatorTkn: yyDollar[3].token, + OpenCurlyBracketTkn: yyDollar[4].token, + UseDeclarations: yyDollar[5].list, + CloseCurlyBracketTkn: yyDollar[7].token, } - yylex.(*Parser).setFreeFloatingTokens(useListBrackets, token.Start, yyDollar[4].token.SkippedTokens) - yylex.(*Parser).setFreeFloatingTokens(useListBrackets, token.End, yyDollar[7].token.SkippedTokens) - yylex.(*Parser).setFreeFloating(useListNsSeparator, token.Start, yyDollar[3].token.SkippedTokens) } case 107: yyDollar = yyS[yypt-0 : yypt+1] -// line internal/php7/php7.y:681 + // line internal/php7/php7.y:659 { yyVAL.token = nil } case 108: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:685 + // line internal/php7/php7.y:663 { yyVAL.token = yyDollar[1].token } case 109: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:692 + // line internal/php7/php7.y:670 { - yyVAL.list = append(yyDollar[1].list, yyDollar[3].node) + yyDollar[1].list[len(yyDollar[1].list)-1].(*ast.StmtUseDeclaration).CommaTkn = yyDollar[2].token - // save comments - yylex.(*Parser).setFreeFloating(lastNode(yyDollar[1].list), token.End, yyDollar[2].token.SkippedTokens) + yyVAL.list = append(yyDollar[1].list, yyDollar[3].node) } case 110: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:699 + // line internal/php7/php7.y:676 { yyVAL.list = []ast.Vertex{yyDollar[1].node} } case 111: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:706 + // line internal/php7/php7.y:683 { - yyVAL.list = append(yyDollar[1].list, yyDollar[3].node) + yyDollar[1].list[len(yyDollar[1].list)-1].(*ast.StmtUseDeclaration).CommaTkn = yyDollar[2].token - // save comments - yylex.(*Parser).setFreeFloating(lastNode(yyDollar[1].list), token.End, yyDollar[2].token.SkippedTokens) + yyVAL.list = append(yyDollar[1].list, yyDollar[3].node) } case 112: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:713 + // line internal/php7/php7.y:689 { yyVAL.list = []ast.Vertex{yyDollar[1].node} } case 113: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:720 + // line internal/php7/php7.y:696 { - yyVAL.list = append(yyDollar[1].list, yyDollar[3].node) + yyDollar[1].list[len(yyDollar[1].list)-1].(*ast.StmtUseDeclaration).CommaTkn = yyDollar[2].token - // save comments - yylex.(*Parser).setFreeFloating(lastNode(yyDollar[1].list), token.End, yyDollar[2].token.SkippedTokens) + yyVAL.list = append(yyDollar[1].list, yyDollar[3].node) } case 114: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:727 + // line internal/php7/php7.y:702 { yyVAL.list = []ast.Vertex{yyDollar[1].node} } case 115: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:734 + // line internal/php7/php7.y:709 { yyVAL.node = yyDollar[1].node } case 116: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php7/php7.y:738 + // line internal/php7/php7.y:713 { - yyVAL.node = &ast.StmtUseType{ast.Node{}, yyDollar[1].node, yyDollar[2].node} + decl := yyDollar[2].node.(*ast.StmtUseDeclaration) + decl.Type = yyDollar[1].node + decl.Node.Position = position.NewNodesPosition(yyDollar[1].node, yyDollar[2].node) - // save position - yyVAL.node.GetNode().Position = position.NewNodesPosition(yyDollar[1].node, yyDollar[2].node) + yyVAL.node = yyDollar[2].node } case 117: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:748 + // line internal/php7/php7.y:724 { - name := &ast.NameName{ast.Node{}, yyDollar[1].list} - yyVAL.node = &ast.StmtUseDeclaration{ast.Node{}, name, nil} - - // save position - name.GetNode().Position = position.NewNodeListPosition(yyDollar[1].list) - yyVAL.node.GetNode().Position = position.NewNodePosition(name) + yyVAL.node = &ast.StmtUseDeclaration{ + Node: ast.Node{ + Position: position.NewNodeListPosition(yyDollar[1].list), + }, + Use: &ast.NameName{ + Node: ast.Node{ + Position: position.NewNodeListPosition(yyDollar[1].list), + }, + Parts: yyDollar[1].list, + }, + } } case 118: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:757 + // line internal/php7/php7.y:738 { - name := &ast.NameName{ast.Node{}, yyDollar[1].list} - alias := &ast.Identifier{ast.Node{}, yyDollar[3].token.Value} - asAlias := &ast.ParserAs{ast.Node{}, alias} - yyVAL.node = &ast.StmtUseDeclaration{ast.Node{}, name, asAlias} - - // save position - name.GetNode().Position = position.NewNodeListPosition(yyDollar[1].list) - alias.GetNode().Position = position.NewTokenPosition(yyDollar[3].token) - asAlias.GetNode().Position = position.NewTokensPosition(yyDollar[2].token, yyDollar[3].token) - yyVAL.node.GetNode().Position = position.NewNodeListTokenPosition(yyDollar[1].list, yyDollar[3].token) - - // save comments - yylex.(*Parser).setFreeFloating(asAlias, token.Start, yyDollar[2].token.SkippedTokens) - yylex.(*Parser).setFreeFloating(alias, token.Start, yyDollar[3].token.SkippedTokens) + yyVAL.node = &ast.StmtUseDeclaration{ + Node: ast.Node{ + Position: position.NewNodeListTokenPosition(yyDollar[1].list, yyDollar[3].token), + }, + Use: &ast.NameName{ + Node: ast.Node{ + Position: position.NewNodeListPosition(yyDollar[1].list), + }, + Parts: yyDollar[1].list, + }, + AsTkn: yyDollar[2].token, + Alias: &ast.Identifier{ + Node: ast.Node{ + Position: position.NewTokenPosition(yyDollar[3].token), + }, + Value: yyDollar[3].token.Value, + }, + } } case 119: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:777 + // line internal/php7/php7.y:762 { yyVAL.node = yyDollar[1].node } case 120: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php7/php7.y:781 + // line internal/php7/php7.y:766 { - yyVAL.node = &ast.ParserNsSeparator{ast.Node{}, yyDollar[2].node} + decl := yyDollar[2].node.(*ast.StmtUseDeclaration) + decl.NsSeparatorTkn = yyDollar[1].token + decl.Node.Position = position.NewTokenNodePosition(yyDollar[1].token, yyDollar[2].node) - // save position - yyDollar[2].node.GetNode().Position = position.NewTokenNodePosition(yyDollar[1].token, yyDollar[2].node) - yyVAL.node.GetNode().Position = position.NewTokenNodePosition(yyDollar[1].token, yyDollar[2].node) - - // save comments - yylex.(*Parser).setFreeFloating(yyVAL.node, token.Start, yyDollar[1].token.SkippedTokens) + yyVAL.node = yyDollar[2].node } case 121: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:795 + // line internal/php7/php7.y:777 { yyVAL.list = append(yyDollar[1].list, yyDollar[3].node) @@ -3098,13 +3080,13 @@ yydefault: } case 122: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:802 + // line internal/php7/php7.y:784 { yyVAL.list = []ast.Vertex{yyDollar[1].node} } case 123: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php7/php7.y:809 + // line internal/php7/php7.y:791 { if inlineHtmlNode, ok := yyDollar[2].node.(*ast.StmtInlineHtml); ok && len(yyDollar[1].list) > 0 { prevNode := lastNode(yyDollar[1].list) @@ -3117,50 +3099,50 @@ yydefault: } case 124: yyDollar = yyS[yypt-0 : yypt+1] -// line internal/php7/php7.y:820 + // line internal/php7/php7.y:802 { yyVAL.list = []ast.Vertex{} } case 125: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:827 + // line internal/php7/php7.y:809 { // error yyVAL.node = nil } case 126: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:832 + // line internal/php7/php7.y:814 { yyVAL.node = yyDollar[1].node } case 127: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:836 + // line internal/php7/php7.y:818 { yyVAL.node = yyDollar[1].node } case 128: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:840 + // line internal/php7/php7.y:822 { yyVAL.node = yyDollar[1].node } case 129: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:844 + // line internal/php7/php7.y:826 { yyVAL.node = yyDollar[1].node } case 130: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:848 + // line internal/php7/php7.y:830 { yyVAL.node = yyDollar[1].node } case 131: yyDollar = yyS[yypt-4 : yypt+1] -// line internal/php7/php7.y:852 + // line internal/php7/php7.y:834 { yyVAL.node = &ast.StmtHaltCompiler{ast.Node{}} @@ -3173,7 +3155,7 @@ yydefault: } case 132: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:865 + // line internal/php7/php7.y:847 { yyVAL.node = &ast.StmtStmtList{ast.Node{}, yyDollar[2].list} @@ -3186,19 +3168,19 @@ yydefault: } case 133: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:876 + // line internal/php7/php7.y:858 { yyVAL.node = yyDollar[1].node } case 134: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:880 + // line internal/php7/php7.y:862 { yyVAL.node = yyDollar[1].node } case 135: yyDollar = yyS[yypt-5 : yypt+1] -// line internal/php7/php7.y:884 + // line internal/php7/php7.y:866 { exprBrackets := &ast.ParserBrackets{ast.Node{}, yyDollar[3].node} @@ -3222,7 +3204,7 @@ yydefault: } case 136: yyDollar = yyS[yypt-7 : yypt+1] -// line internal/php7/php7.y:906 + // line internal/php7/php7.y:888 { exprBrackets := &ast.ParserBrackets{ast.Node{}, yyDollar[5].node} yyVAL.node = &ast.StmtDo{ast.Node{}, yyDollar[2].node, exprBrackets} @@ -3240,7 +3222,7 @@ yydefault: } case 137: yyDollar = yyS[yypt-9 : yypt+1] -// line internal/php7/php7.y:922 + // line internal/php7/php7.y:904 { switch n := yyDollar[9].node.(type) { case *ast.StmtFor: @@ -3267,7 +3249,7 @@ yydefault: } case 138: yyDollar = yyS[yypt-5 : yypt+1] -// line internal/php7/php7.y:947 + // line internal/php7/php7.y:929 { exprBrackets := &ast.ParserBrackets{ast.Node{}, yyDollar[3].node} @@ -3293,7 +3275,7 @@ yydefault: } case 139: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:971 + // line internal/php7/php7.y:953 { yyVAL.node = &ast.StmtBreak{ast.Node{}, yyDollar[2].node} @@ -3307,7 +3289,7 @@ yydefault: } case 140: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:983 + // line internal/php7/php7.y:965 { yyVAL.node = &ast.StmtContinue{ast.Node{}, yyDollar[2].node} @@ -3321,7 +3303,7 @@ yydefault: } case 141: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:995 + // line internal/php7/php7.y:977 { yyVAL.node = &ast.StmtReturn{ast.Node{}, yyDollar[2].node} @@ -3335,7 +3317,7 @@ yydefault: } case 142: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:1007 + // line internal/php7/php7.y:989 { yyVAL.node = &ast.StmtGlobal{ast.Node{}, yyDollar[2].list} @@ -3349,7 +3331,7 @@ yydefault: } case 143: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:1019 + // line internal/php7/php7.y:1001 { yyVAL.node = &ast.StmtStatic{ast.Node{}, yyDollar[2].list} @@ -3363,7 +3345,7 @@ yydefault: } case 144: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:1031 + // line internal/php7/php7.y:1013 { yyVAL.node = &ast.StmtEcho{ast.Node{}, yyDollar[2].list} @@ -3378,7 +3360,7 @@ yydefault: } case 145: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:1044 + // line internal/php7/php7.y:1026 { yyVAL.node = &ast.StmtInlineHtml{ast.Node{}, yyDollar[1].token.Value} @@ -3390,7 +3372,7 @@ yydefault: } case 146: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php7/php7.y:1054 + // line internal/php7/php7.y:1036 { yyVAL.node = &ast.StmtExpression{ast.Node{}, yyDollar[1].node} @@ -3404,7 +3386,7 @@ yydefault: } case 147: yyDollar = yyS[yypt-6 : yypt+1] -// line internal/php7/php7.y:1066 + // line internal/php7/php7.y:1048 { yyVAL.node = &ast.StmtUnset{ast.Node{}, yyDollar[3].list} @@ -3424,7 +3406,7 @@ yydefault: } case 148: yyDollar = yyS[yypt-7 : yypt+1] -// line internal/php7/php7.y:1084 + // line internal/php7/php7.y:1066 { switch n := yyDollar[7].node.(type) { case *ast.StmtForeach: @@ -3448,7 +3430,7 @@ yydefault: } case 149: yyDollar = yyS[yypt-9 : yypt+1] -// line internal/php7/php7.y:1106 + // line internal/php7/php7.y:1088 { switch n := yyDollar[9].node.(type) { case *ast.StmtForeach: @@ -3475,7 +3457,7 @@ yydefault: } case 150: yyDollar = yyS[yypt-5 : yypt+1] -// line internal/php7/php7.y:1131 + // line internal/php7/php7.y:1113 { yyVAL.node = yyDollar[5].node yyVAL.node.(*ast.StmtDeclare).Consts = yyDollar[3].list @@ -3490,7 +3472,7 @@ yydefault: } case 151: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:1144 + // line internal/php7/php7.y:1126 { yyVAL.node = &ast.StmtNop{ast.Node{}} @@ -3503,7 +3485,7 @@ yydefault: } case 152: yyDollar = yyS[yypt-6 : yypt+1] -// line internal/php7/php7.y:1155 + // line internal/php7/php7.y:1137 { if yyDollar[6].node == nil { yyVAL.node = &ast.StmtTry{ast.Node{}, yyDollar[3].list, yyDollar[5].list, yyDollar[6].node} @@ -3520,7 +3502,7 @@ yydefault: } case 153: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:1170 + // line internal/php7/php7.y:1152 { yyVAL.node = &ast.StmtThrow{ast.Node{}, yyDollar[2].node} @@ -3534,7 +3516,7 @@ yydefault: } case 154: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:1182 + // line internal/php7/php7.y:1164 { label := &ast.Identifier{ast.Node{}, yyDollar[2].token.Value} yyVAL.node = &ast.StmtGoto{ast.Node{}, label} @@ -3551,7 +3533,7 @@ yydefault: } case 155: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php7/php7.y:1197 + // line internal/php7/php7.y:1179 { label := &ast.Identifier{ast.Node{}, yyDollar[1].token.Value} yyVAL.node = &ast.StmtLabel{ast.Node{}, label} @@ -3566,13 +3548,13 @@ yydefault: } case 156: yyDollar = yyS[yypt-0 : yypt+1] -// line internal/php7/php7.y:1212 + // line internal/php7/php7.y:1194 { yyVAL.list = []ast.Vertex{} } case 157: yyDollar = yyS[yypt-9 : yypt+1] -// line internal/php7/php7.y:1216 + // line internal/php7/php7.y:1198 { identifier := &ast.Identifier{ast.Node{}, yyDollar[5].token.Value} variable := &ast.ExprVariable{ast.Node{}, identifier} @@ -3594,13 +3576,13 @@ yydefault: } case 158: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:1238 + // line internal/php7/php7.y:1220 { yyVAL.list = []ast.Vertex{yyDollar[1].node} } case 159: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:1242 + // line internal/php7/php7.y:1224 { yyVAL.list = append(yyDollar[1].list, yyDollar[3].node) @@ -3609,13 +3591,13 @@ yydefault: } case 160: yyDollar = yyS[yypt-0 : yypt+1] -// line internal/php7/php7.y:1252 + // line internal/php7/php7.y:1234 { yyVAL.node = nil } case 161: yyDollar = yyS[yypt-4 : yypt+1] -// line internal/php7/php7.y:1256 + // line internal/php7/php7.y:1238 { yyVAL.node = &ast.StmtFinally{ast.Node{}, yyDollar[3].list} @@ -3629,13 +3611,13 @@ yydefault: } case 162: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:1271 + // line internal/php7/php7.y:1253 { yyVAL.list = []ast.Vertex{yyDollar[1].node} } case 163: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:1275 + // line internal/php7/php7.y:1257 { yyVAL.list = append(yyDollar[1].list, yyDollar[3].node) @@ -3644,13 +3626,13 @@ yydefault: } case 164: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:1285 + // line internal/php7/php7.y:1267 { yyVAL.node = yyDollar[1].node } case 165: yyDollar = yyS[yypt-11 : yypt+1] -// line internal/php7/php7.y:1292 + // line internal/php7/php7.y:1274 { name := &ast.Identifier{ast.Node{}, yyDollar[3].token.Value} yyVAL.node = &ast.StmtFunction{ast.Node{}, yyDollar[2].token != nil, name, yyDollar[6].list, yyDollar[8].node, yyDollar[10].list} @@ -3680,31 +3662,31 @@ yydefault: } case 166: yyDollar = yyS[yypt-0 : yypt+1] -// line internal/php7/php7.y:1323 + // line internal/php7/php7.y:1305 { yyVAL.token = nil } case 167: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:1327 + // line internal/php7/php7.y:1309 { yyVAL.token = yyDollar[1].token } case 168: yyDollar = yyS[yypt-0 : yypt+1] -// line internal/php7/php7.y:1334 + // line internal/php7/php7.y:1316 { yyVAL.token = nil } case 169: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:1338 + // line internal/php7/php7.y:1320 { yyVAL.token = yyDollar[1].token } case 170: yyDollar = yyS[yypt-9 : yypt+1] -// line internal/php7/php7.y:1345 + // line internal/php7/php7.y:1327 { name := &ast.Identifier{ast.Node{}, yyDollar[3].token.Value} yyVAL.node = &ast.StmtClass{ast.Node{}, name, yyDollar[1].list, nil, yyDollar[4].ClassExtends, yyDollar[5].ClassImplements, yyDollar[8].list} @@ -3722,7 +3704,7 @@ yydefault: } case 171: yyDollar = yyS[yypt-8 : yypt+1] -// line internal/php7/php7.y:1361 + // line internal/php7/php7.y:1343 { name := &ast.Identifier{ast.Node{}, yyDollar[2].token.Value} yyVAL.node = &ast.StmtClass{ast.Node{}, name, nil, nil, yyDollar[3].ClassExtends, yyDollar[4].ClassImplements, yyDollar[7].list} @@ -3739,19 +3721,19 @@ yydefault: } case 172: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:1379 + // line internal/php7/php7.y:1361 { yyVAL.list = []ast.Vertex{yyDollar[1].node} } case 173: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php7/php7.y:1383 + // line internal/php7/php7.y:1365 { yyVAL.list = append(yyDollar[1].list, yyDollar[2].node) } case 174: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:1390 + // line internal/php7/php7.y:1372 { yyVAL.node = &ast.Identifier{ast.Node{}, yyDollar[1].token.Value} @@ -3763,7 +3745,7 @@ yydefault: } case 175: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:1400 + // line internal/php7/php7.y:1382 { yyVAL.node = &ast.Identifier{ast.Node{}, yyDollar[1].token.Value} @@ -3775,7 +3757,7 @@ yydefault: } case 176: yyDollar = yyS[yypt-6 : yypt+1] -// line internal/php7/php7.y:1413 + // line internal/php7/php7.y:1395 { name := &ast.Identifier{ast.Node{}, yyDollar[2].token.Value} yyVAL.node = &ast.StmtTrait{ast.Node{}, name, yyDollar[5].list} @@ -3792,7 +3774,7 @@ yydefault: } case 177: yyDollar = yyS[yypt-7 : yypt+1] -// line internal/php7/php7.y:1431 + // line internal/php7/php7.y:1413 { name := &ast.Identifier{ast.Node{}, yyDollar[2].token.Value} yyVAL.node = &ast.StmtInterface{ast.Node{}, name, yyDollar[3].InterfaceExtends, yyDollar[6].list} @@ -3809,13 +3791,13 @@ yydefault: } case 178: yyDollar = yyS[yypt-0 : yypt+1] -// line internal/php7/php7.y:1449 + // line internal/php7/php7.y:1431 { yyVAL.ClassExtends = nil } case 179: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php7/php7.y:1453 + // line internal/php7/php7.y:1435 { yyVAL.ClassExtends = &ast.StmtClassExtends{ast.Node{}, yyDollar[2].node} @@ -3827,13 +3809,13 @@ yydefault: } case 180: yyDollar = yyS[yypt-0 : yypt+1] -// line internal/php7/php7.y:1466 + // line internal/php7/php7.y:1448 { yyVAL.InterfaceExtends = nil } case 181: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php7/php7.y:1470 + // line internal/php7/php7.y:1452 { yyVAL.InterfaceExtends = &ast.StmtInterfaceExtends{ast.Node{}, yyDollar[2].list} @@ -3845,13 +3827,13 @@ yydefault: } case 182: yyDollar = yyS[yypt-0 : yypt+1] -// line internal/php7/php7.y:1483 + // line internal/php7/php7.y:1465 { yyVAL.ClassImplements = nil } case 183: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php7/php7.y:1487 + // line internal/php7/php7.y:1469 { yyVAL.ClassImplements = &ast.StmtClassImplements{ast.Node{}, yyDollar[2].list} @@ -3863,13 +3845,13 @@ yydefault: } case 184: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:1500 + // line internal/php7/php7.y:1482 { yyVAL.node = yyDollar[1].node } case 185: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php7/php7.y:1504 + // line internal/php7/php7.y:1486 { yyVAL.node = &ast.ExprReference{ast.Node{}, yyDollar[2].node} @@ -3881,7 +3863,7 @@ yydefault: } case 186: yyDollar = yyS[yypt-4 : yypt+1] -// line internal/php7/php7.y:1514 + // line internal/php7/php7.y:1496 { yyVAL.node = &ast.ExprList{ast.Node{}, yyDollar[3].list} @@ -3895,7 +3877,7 @@ yydefault: } case 187: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:1526 + // line internal/php7/php7.y:1508 { yyVAL.node = &ast.ExprShortList{ast.Node{}, yyDollar[2].list} @@ -3908,7 +3890,7 @@ yydefault: } case 188: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:1540 + // line internal/php7/php7.y:1522 { yyVAL.node = &ast.StmtFor{ast.Node{}, nil, nil, nil, yyDollar[1].node} @@ -3917,7 +3899,7 @@ yydefault: } case 189: yyDollar = yyS[yypt-4 : yypt+1] -// line internal/php7/php7.y:1547 + // line internal/php7/php7.y:1529 { stmtList := &ast.StmtStmtList{ast.Node{}, yyDollar[2].list} yyVAL.node = &ast.StmtAltFor{ast.Node{}, nil, nil, nil, stmtList} @@ -3934,7 +3916,7 @@ yydefault: } case 190: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:1565 + // line internal/php7/php7.y:1547 { yyVAL.node = &ast.StmtForeach{ast.Node{}, nil, nil, nil, yyDollar[1].node} @@ -3943,7 +3925,7 @@ yydefault: } case 191: yyDollar = yyS[yypt-4 : yypt+1] -// line internal/php7/php7.y:1572 + // line internal/php7/php7.y:1554 { stmtList := &ast.StmtStmtList{ast.Node{}, yyDollar[2].list} yyVAL.node = &ast.StmtAltForeach{ast.Node{}, nil, nil, nil, stmtList} @@ -3960,7 +3942,7 @@ yydefault: } case 192: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:1590 + // line internal/php7/php7.y:1572 { yyVAL.node = &ast.StmtDeclare{ast.Node{}, false, nil, yyDollar[1].node} @@ -3969,7 +3951,7 @@ yydefault: } case 193: yyDollar = yyS[yypt-4 : yypt+1] -// line internal/php7/php7.y:1597 + // line internal/php7/php7.y:1579 { stmtList := &ast.StmtStmtList{ast.Node{}, yyDollar[2].list} yyVAL.node = &ast.StmtDeclare{ast.Node{}, true, nil, stmtList} @@ -3986,7 +3968,7 @@ yydefault: } case 194: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:1615 + // line internal/php7/php7.y:1597 { caseList := &ast.StmtCaseList{ast.Node{}, yyDollar[2].list} yyVAL.node = &ast.StmtSwitch{ast.Node{}, nil, caseList} @@ -4001,7 +3983,7 @@ yydefault: } case 195: yyDollar = yyS[yypt-4 : yypt+1] -// line internal/php7/php7.y:1628 + // line internal/php7/php7.y:1610 { caseList := &ast.StmtCaseList{ast.Node{}, yyDollar[3].list} yyVAL.node = &ast.StmtSwitch{ast.Node{}, nil, caseList} @@ -4017,7 +3999,7 @@ yydefault: } case 196: yyDollar = yyS[yypt-4 : yypt+1] -// line internal/php7/php7.y:1642 + // line internal/php7/php7.y:1624 { caseList := &ast.StmtCaseList{ast.Node{}, yyDollar[2].list} yyVAL.node = &ast.StmtAltSwitch{ast.Node{}, nil, caseList} @@ -4034,7 +4016,7 @@ yydefault: } case 197: yyDollar = yyS[yypt-5 : yypt+1] -// line internal/php7/php7.y:1657 + // line internal/php7/php7.y:1639 { caseList := &ast.StmtCaseList{ast.Node{}, yyDollar[3].list} @@ -4053,13 +4035,13 @@ yydefault: } case 198: yyDollar = yyS[yypt-0 : yypt+1] -// line internal/php7/php7.y:1677 + // line internal/php7/php7.y:1659 { yyVAL.list = []ast.Vertex{} } case 199: yyDollar = yyS[yypt-5 : yypt+1] -// line internal/php7/php7.y:1681 + // line internal/php7/php7.y:1663 { _case := &ast.StmtCase{ast.Node{}, yyDollar[3].node, yyDollar[5].list} yyVAL.list = append(yyDollar[1].list, _case) @@ -4074,7 +4056,7 @@ yydefault: } case 200: yyDollar = yyS[yypt-4 : yypt+1] -// line internal/php7/php7.y:1694 + // line internal/php7/php7.y:1676 { _default := &ast.StmtDefault{ast.Node{}, yyDollar[4].list} yyVAL.list = append(yyDollar[1].list, _default) @@ -4089,19 +4071,19 @@ yydefault: } case 201: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:1710 + // line internal/php7/php7.y:1692 { yyVAL.token = yyDollar[1].token } case 202: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:1714 + // line internal/php7/php7.y:1696 { yyVAL.token = yyDollar[1].token } case 203: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:1721 + // line internal/php7/php7.y:1703 { yyVAL.node = &ast.StmtWhile{ast.Node{}, nil, yyDollar[1].node} @@ -4110,7 +4092,7 @@ yydefault: } case 204: yyDollar = yyS[yypt-4 : yypt+1] -// line internal/php7/php7.y:1728 + // line internal/php7/php7.y:1710 { stmtList := &ast.StmtStmtList{ast.Node{}, yyDollar[2].list} yyVAL.node = &ast.StmtAltWhile{ast.Node{}, nil, stmtList} @@ -4127,7 +4109,7 @@ yydefault: } case 205: yyDollar = yyS[yypt-5 : yypt+1] -// line internal/php7/php7.y:1746 + // line internal/php7/php7.y:1728 { exprBrackets := &ast.ParserBrackets{ast.Node{}, yyDollar[3].node} yyVAL.node = &ast.StmtIf{ast.Node{}, exprBrackets, yyDollar[5].node, nil, nil} @@ -4143,7 +4125,7 @@ yydefault: } case 206: yyDollar = yyS[yypt-6 : yypt+1] -// line internal/php7/php7.y:1760 + // line internal/php7/php7.y:1742 { exprBrackets := &ast.ParserBrackets{ast.Node{}, yyDollar[4].node} _elseIf := &ast.StmtElseIf{ast.Node{}, exprBrackets, yyDollar[6].node} @@ -4163,13 +4145,13 @@ yydefault: } case 207: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:1781 + // line internal/php7/php7.y:1763 { yyVAL.node = yyDollar[1].node } case 208: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:1785 + // line internal/php7/php7.y:1767 { _else := &ast.StmtElse{ast.Node{}, yyDollar[3].node} yyDollar[1].node.(*ast.StmtIf).Else = _else @@ -4185,7 +4167,7 @@ yydefault: } case 209: yyDollar = yyS[yypt-6 : yypt+1] -// line internal/php7/php7.y:1802 + // line internal/php7/php7.y:1784 { exprBrackets := &ast.ParserBrackets{ast.Node{}, yyDollar[3].node} stmts := &ast.StmtStmtList{ast.Node{}, yyDollar[6].list} @@ -4206,7 +4188,7 @@ yydefault: } case 210: yyDollar = yyS[yypt-7 : yypt+1] -// line internal/php7/php7.y:1821 + // line internal/php7/php7.y:1803 { exprBrackets := &ast.ParserBrackets{ast.Node{}, yyDollar[4].node} stmts := &ast.StmtStmtList{ast.Node{}, yyDollar[7].list} @@ -4230,7 +4212,7 @@ yydefault: } case 211: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:1846 + // line internal/php7/php7.y:1828 { yyVAL.node = yyDollar[1].node @@ -4248,7 +4230,7 @@ yydefault: } case 212: yyDollar = yyS[yypt-6 : yypt+1] -// line internal/php7/php7.y:1862 + // line internal/php7/php7.y:1844 { stmts := &ast.StmtStmtList{ast.Node{}, yyDollar[4].list} stmtsBrackets := &ast.ParserBrackets{ast.Node{}, stmts} @@ -4271,25 +4253,25 @@ yydefault: } case 213: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:1886 + // line internal/php7/php7.y:1868 { yyVAL.list = yyDollar[1].list } case 214: yyDollar = yyS[yypt-0 : yypt+1] -// line internal/php7/php7.y:1890 + // line internal/php7/php7.y:1872 { yyVAL.list = nil } case 215: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:1897 + // line internal/php7/php7.y:1879 { yyVAL.list = []ast.Vertex{yyDollar[1].node} } case 216: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:1901 + // line internal/php7/php7.y:1883 { yyVAL.list = append(yyDollar[1].list, yyDollar[3].node) @@ -4298,7 +4280,7 @@ yydefault: } case 217: yyDollar = yyS[yypt-4 : yypt+1] -// line internal/php7/php7.y:1911 + // line internal/php7/php7.y:1893 { identifier := &ast.Identifier{ast.Node{}, yyDollar[4].token.Value} identifier.GetNode().Position = position.NewTokenPosition(yyDollar[4].token) @@ -4334,7 +4316,7 @@ yydefault: } case 218: yyDollar = yyS[yypt-6 : yypt+1] -// line internal/php7/php7.y:1945 + // line internal/php7/php7.y:1927 { identifier := &ast.Identifier{ast.Node{}, yyDollar[4].token.Value} identifier.GetNode().Position = position.NewTokenPosition(yyDollar[4].token) @@ -4371,25 +4353,25 @@ yydefault: } case 219: yyDollar = yyS[yypt-0 : yypt+1] -// line internal/php7/php7.y:1983 + // line internal/php7/php7.y:1965 { yyVAL.node = nil } case 220: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:1987 + // line internal/php7/php7.y:1969 { yyVAL.node = yyDollar[1].node } case 221: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:1994 + // line internal/php7/php7.y:1976 { yyVAL.node = yyDollar[1].node } case 222: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php7/php7.y:1998 + // line internal/php7/php7.y:1980 { yyVAL.node = &ast.Nullable{ast.Node{}, yyDollar[2].node} @@ -4401,7 +4383,7 @@ yydefault: } case 223: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:2011 + // line internal/php7/php7.y:1993 { yyVAL.node = &ast.Identifier{ast.Node{}, yyDollar[1].token.Value} @@ -4413,7 +4395,7 @@ yydefault: } case 224: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:2021 + // line internal/php7/php7.y:2003 { yyVAL.node = &ast.Identifier{ast.Node{}, yyDollar[1].token.Value} @@ -4425,19 +4407,19 @@ yydefault: } case 225: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:2031 + // line internal/php7/php7.y:2013 { yyVAL.node = yyDollar[1].node } case 226: yyDollar = yyS[yypt-0 : yypt+1] -// line internal/php7/php7.y:2038 + // line internal/php7/php7.y:2020 { yyVAL.node = nil } case 227: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php7/php7.y:2042 + // line internal/php7/php7.y:2024 { yyVAL.node = yyDollar[2].node @@ -4446,7 +4428,7 @@ yydefault: } case 228: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php7/php7.y:2052 + // line internal/php7/php7.y:2034 { yyVAL.node = &ast.ArgumentList{ast.Node{}, nil} @@ -4459,7 +4441,7 @@ yydefault: } case 229: yyDollar = yyS[yypt-4 : yypt+1] -// line internal/php7/php7.y:2063 + // line internal/php7/php7.y:2045 { yyVAL.node = &ast.ArgumentList{ast.Node{}, yyDollar[2].list} @@ -4476,13 +4458,13 @@ yydefault: } case 230: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:2081 + // line internal/php7/php7.y:2063 { yyVAL.list = []ast.Vertex{yyDollar[1].node} } case 231: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:2085 + // line internal/php7/php7.y:2067 { yyVAL.list = append(yyDollar[1].list, yyDollar[3].node) @@ -4491,7 +4473,7 @@ yydefault: } case 232: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:2095 + // line internal/php7/php7.y:2077 { yyVAL.node = &ast.Argument{ast.Node{}, false, false, yyDollar[1].node} @@ -4503,7 +4485,7 @@ yydefault: } case 233: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php7/php7.y:2105 + // line internal/php7/php7.y:2087 { yyVAL.node = &ast.Argument{ast.Node{}, true, false, yyDollar[2].node} @@ -4515,7 +4497,7 @@ yydefault: } case 234: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:2118 + // line internal/php7/php7.y:2100 { yyVAL.list = append(yyDollar[1].list, yyDollar[3].node) @@ -4524,19 +4506,19 @@ yydefault: } case 235: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:2125 + // line internal/php7/php7.y:2107 { yyVAL.list = []ast.Vertex{yyDollar[1].node} } case 236: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:2132 + // line internal/php7/php7.y:2114 { yyVAL.node = yyDollar[1].node } case 237: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:2139 + // line internal/php7/php7.y:2121 { yyVAL.list = append(yyDollar[1].list, yyDollar[3].node) @@ -4545,13 +4527,13 @@ yydefault: } case 238: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:2146 + // line internal/php7/php7.y:2128 { yyVAL.list = []ast.Vertex{yyDollar[1].node} } case 239: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:2153 + // line internal/php7/php7.y:2135 { identifier := &ast.Identifier{ast.Node{}, yyDollar[1].token.Value} variable := &ast.ExprVariable{ast.Node{}, identifier} @@ -4567,7 +4549,7 @@ yydefault: } case 240: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:2167 + // line internal/php7/php7.y:2149 { identifier := &ast.Identifier{ast.Node{}, yyDollar[1].token.Value} variable := &ast.ExprVariable{ast.Node{}, identifier} @@ -4584,19 +4566,19 @@ yydefault: } case 241: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php7/php7.y:2185 + // line internal/php7/php7.y:2167 { yyVAL.list = append(yyDollar[1].list, yyDollar[2].node) } case 242: yyDollar = yyS[yypt-0 : yypt+1] -// line internal/php7/php7.y:2189 + // line internal/php7/php7.y:2171 { yyVAL.list = []ast.Vertex{} } case 243: yyDollar = yyS[yypt-4 : yypt+1] -// line internal/php7/php7.y:2196 + // line internal/php7/php7.y:2178 { yyVAL.node = &ast.StmtPropertyList{ast.Node{}, yyDollar[1].list, yyDollar[2].node, yyDollar[3].list} @@ -4610,7 +4592,7 @@ yydefault: } case 244: yyDollar = yyS[yypt-4 : yypt+1] -// line internal/php7/php7.y:2208 + // line internal/php7/php7.y:2190 { yyVAL.node = &ast.StmtClassConstList{ast.Node{}, yyDollar[1].list, yyDollar[3].list} @@ -4629,7 +4611,7 @@ yydefault: } case 245: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:2225 + // line internal/php7/php7.y:2207 { yyVAL.node = &ast.StmtTraitUse{ast.Node{}, yyDollar[2].list, yyDollar[3].node} @@ -4641,7 +4623,7 @@ yydefault: } case 246: yyDollar = yyS[yypt-10 : yypt+1] -// line internal/php7/php7.y:2235 + // line internal/php7/php7.y:2217 { name := &ast.Identifier{ast.Node{}, yyDollar[4].token.Value} yyVAL.node = &ast.StmtClassMethod{ast.Node{}, yyDollar[3].token != nil, name, yyDollar[1].list, yyDollar[7].list, yyDollar[9].node, yyDollar[10].node} @@ -4672,13 +4654,13 @@ yydefault: } case 247: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:2267 + // line internal/php7/php7.y:2249 { yyVAL.list = []ast.Vertex{yyDollar[1].node} } case 248: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:2271 + // line internal/php7/php7.y:2253 { yyVAL.list = append(yyDollar[1].list, yyDollar[3].node) @@ -4687,7 +4669,7 @@ yydefault: } case 249: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:2281 + // line internal/php7/php7.y:2263 { yyVAL.node = &ast.StmtNop{ast.Node{}} @@ -4699,7 +4681,7 @@ yydefault: } case 250: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php7/php7.y:2291 + // line internal/php7/php7.y:2273 { yyVAL.node = &ast.StmtTraitAdaptationList{ast.Node{}, nil} @@ -4711,7 +4693,7 @@ yydefault: } case 251: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:2301 + // line internal/php7/php7.y:2283 { yyVAL.node = &ast.StmtTraitAdaptationList{ast.Node{}, yyDollar[2].list} @@ -4723,19 +4705,19 @@ yydefault: } case 252: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:2314 + // line internal/php7/php7.y:2296 { yyVAL.list = []ast.Vertex{yyDollar[1].node} } case 253: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php7/php7.y:2318 + // line internal/php7/php7.y:2300 { yyVAL.list = append(yyDollar[1].list, yyDollar[2].node) } case 254: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php7/php7.y:2325 + // line internal/php7/php7.y:2307 { yyVAL.node = yyDollar[1].node @@ -4745,7 +4727,7 @@ yydefault: } case 255: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php7/php7.y:2333 + // line internal/php7/php7.y:2315 { yyVAL.node = yyDollar[1].node @@ -4755,7 +4737,7 @@ yydefault: } case 256: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:2344 + // line internal/php7/php7.y:2326 { yyVAL.node = &ast.StmtTraitUsePrecedence{ast.Node{}, yyDollar[1].node, yyDollar[3].list} @@ -4768,7 +4750,7 @@ yydefault: } case 257: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:2358 + // line internal/php7/php7.y:2340 { alias := &ast.Identifier{ast.Node{}, yyDollar[3].token.Value} yyVAL.node = &ast.StmtTraitUseAlias{ast.Node{}, yyDollar[1].node, nil, alias} @@ -4784,7 +4766,7 @@ yydefault: } case 258: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:2372 + // line internal/php7/php7.y:2354 { alias := &ast.Identifier{ast.Node{}, yyDollar[3].token.Value} yyVAL.node = &ast.StmtTraitUseAlias{ast.Node{}, yyDollar[1].node, nil, alias} @@ -4800,7 +4782,7 @@ yydefault: } case 259: yyDollar = yyS[yypt-4 : yypt+1] -// line internal/php7/php7.y:2386 + // line internal/php7/php7.y:2368 { alias := &ast.Identifier{ast.Node{}, yyDollar[4].token.Value} yyVAL.node = &ast.StmtTraitUseAlias{ast.Node{}, yyDollar[1].node, yyDollar[3].node, alias} @@ -4816,7 +4798,7 @@ yydefault: } case 260: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:2400 + // line internal/php7/php7.y:2382 { yyVAL.node = &ast.StmtTraitUseAlias{ast.Node{}, yyDollar[1].node, yyDollar[3].node, nil} @@ -4829,7 +4811,7 @@ yydefault: } case 261: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:2414 + // line internal/php7/php7.y:2396 { name := &ast.Identifier{ast.Node{}, yyDollar[1].token.Value} yyVAL.node = &ast.StmtTraitMethodRef{ast.Node{}, nil, name} @@ -4843,13 +4825,13 @@ yydefault: } case 262: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:2426 + // line internal/php7/php7.y:2408 { yyVAL.node = yyDollar[1].node } case 263: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:2433 + // line internal/php7/php7.y:2415 { target := &ast.Identifier{ast.Node{}, yyDollar[3].token.Value} yyVAL.node = &ast.StmtTraitMethodRef{ast.Node{}, yyDollar[1].node, target} @@ -4865,7 +4847,7 @@ yydefault: } case 264: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:2450 + // line internal/php7/php7.y:2432 { yyVAL.node = &ast.StmtNop{ast.Node{}} @@ -4878,7 +4860,7 @@ yydefault: } case 265: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:2461 + // line internal/php7/php7.y:2443 { yyVAL.node = &ast.StmtStmtList{ast.Node{}, yyDollar[2].list} @@ -4891,13 +4873,13 @@ yydefault: } case 266: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:2475 + // line internal/php7/php7.y:2457 { yyVAL.list = yyDollar[1].list } case 267: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:2479 + // line internal/php7/php7.y:2461 { modifier := &ast.Identifier{ast.Node{}, yyDollar[1].token.Value} yyVAL.list = []ast.Vertex{modifier} @@ -4910,31 +4892,31 @@ yydefault: } case 268: yyDollar = yyS[yypt-0 : yypt+1] -// line internal/php7/php7.y:2493 + // line internal/php7/php7.y:2475 { yyVAL.list = nil } case 269: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:2497 + // line internal/php7/php7.y:2479 { yyVAL.list = yyDollar[1].list } case 270: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:2504 + // line internal/php7/php7.y:2486 { yyVAL.list = []ast.Vertex{yyDollar[1].node} } case 271: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php7/php7.y:2508 + // line internal/php7/php7.y:2490 { yyVAL.list = append(yyDollar[1].list, yyDollar[2].node) } case 272: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:2515 + // line internal/php7/php7.y:2497 { yyVAL.node = &ast.Identifier{ast.Node{}, yyDollar[1].token.Value} @@ -4946,7 +4928,7 @@ yydefault: } case 273: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:2525 + // line internal/php7/php7.y:2507 { yyVAL.node = &ast.Identifier{ast.Node{}, yyDollar[1].token.Value} @@ -4958,7 +4940,7 @@ yydefault: } case 274: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:2535 + // line internal/php7/php7.y:2517 { yyVAL.node = &ast.Identifier{ast.Node{}, yyDollar[1].token.Value} @@ -4970,7 +4952,7 @@ yydefault: } case 275: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:2545 + // line internal/php7/php7.y:2527 { yyVAL.node = &ast.Identifier{ast.Node{}, yyDollar[1].token.Value} @@ -4982,7 +4964,7 @@ yydefault: } case 276: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:2555 + // line internal/php7/php7.y:2537 { yyVAL.node = &ast.Identifier{ast.Node{}, yyDollar[1].token.Value} @@ -4994,7 +4976,7 @@ yydefault: } case 277: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:2565 + // line internal/php7/php7.y:2547 { yyVAL.node = &ast.Identifier{ast.Node{}, yyDollar[1].token.Value} @@ -5006,7 +4988,7 @@ yydefault: } case 278: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:2578 + // line internal/php7/php7.y:2560 { yyVAL.list = append(yyDollar[1].list, yyDollar[3].node) @@ -5015,13 +4997,13 @@ yydefault: } case 279: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:2585 + // line internal/php7/php7.y:2567 { yyVAL.list = []ast.Vertex{yyDollar[1].node} } case 280: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php7/php7.y:2592 + // line internal/php7/php7.y:2574 { identifier := &ast.Identifier{ast.Node{}, yyDollar[1].token.Value} variable := &ast.ExprVariable{ast.Node{}, identifier} @@ -5037,7 +5019,7 @@ yydefault: } case 281: yyDollar = yyS[yypt-4 : yypt+1] -// line internal/php7/php7.y:2606 + // line internal/php7/php7.y:2588 { identifier := &ast.Identifier{ast.Node{}, yyDollar[1].token.Value} variable := &ast.ExprVariable{ast.Node{}, identifier} @@ -5054,7 +5036,7 @@ yydefault: } case 282: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:2624 + // line internal/php7/php7.y:2606 { yyVAL.list = append(yyDollar[1].list, yyDollar[3].node) @@ -5063,13 +5045,13 @@ yydefault: } case 283: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:2631 + // line internal/php7/php7.y:2613 { yyVAL.list = []ast.Vertex{yyDollar[1].node} } case 284: yyDollar = yyS[yypt-4 : yypt+1] -// line internal/php7/php7.y:2638 + // line internal/php7/php7.y:2620 { name := &ast.Identifier{ast.Node{}, yyDollar[1].token.Value} yyVAL.node = &ast.StmtConstant{ast.Node{}, name, yyDollar[3].node} @@ -5084,7 +5066,7 @@ yydefault: } case 285: yyDollar = yyS[yypt-4 : yypt+1] -// line internal/php7/php7.y:2654 + // line internal/php7/php7.y:2636 { name := &ast.Identifier{ast.Node{}, yyDollar[1].token.Value} yyVAL.node = &ast.StmtConstant{ast.Node{}, name, yyDollar[3].node} @@ -5099,7 +5081,7 @@ yydefault: } case 286: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:2670 + // line internal/php7/php7.y:2652 { yyVAL.list = append(yyDollar[1].list, yyDollar[3].node) @@ -5108,31 +5090,31 @@ yydefault: } case 287: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:2677 + // line internal/php7/php7.y:2659 { yyVAL.list = []ast.Vertex{yyDollar[1].node} } case 288: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:2684 + // line internal/php7/php7.y:2666 { yyVAL.node = yyDollar[1].node } case 289: yyDollar = yyS[yypt-0 : yypt+1] -// line internal/php7/php7.y:2691 + // line internal/php7/php7.y:2673 { yyVAL.list = nil } case 290: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:2695 + // line internal/php7/php7.y:2677 { yyVAL.list = yyDollar[1].list } case 291: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:2702 + // line internal/php7/php7.y:2684 { yyVAL.list = append(yyDollar[1].list, yyDollar[3].node) @@ -5141,13 +5123,13 @@ yydefault: } case 292: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:2709 + // line internal/php7/php7.y:2691 { yyVAL.list = []ast.Vertex{yyDollar[1].node} } case 293: yyDollar = yyS[yypt-8 : yypt+1] -// line internal/php7/php7.y:2716 + // line internal/php7/php7.y:2698 { if yyDollar[2].node != nil { yyVAL.node = &ast.StmtClass{ast.Node{}, nil, nil, yyDollar[2].node.(*ast.ArgumentList), yyDollar[3].ClassExtends, yyDollar[4].ClassImplements, yyDollar[7].list} @@ -5165,7 +5147,7 @@ yydefault: } case 294: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:2735 + // line internal/php7/php7.y:2717 { if yyDollar[3].node != nil { yyVAL.node = &ast.ExprNew{ast.Node{}, yyDollar[2].node, yyDollar[3].node.(*ast.ArgumentList)} @@ -5180,7 +5162,7 @@ yydefault: } case 295: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php7/php7.y:2748 + // line internal/php7/php7.y:2730 { yyVAL.node = &ast.ExprNew{ast.Node{}, yyDollar[2].node, nil} @@ -5192,7 +5174,7 @@ yydefault: } case 296: yyDollar = yyS[yypt-6 : yypt+1] -// line internal/php7/php7.y:2761 + // line internal/php7/php7.y:2743 { listNode := &ast.ExprList{ast.Node{}, yyDollar[3].list} yyVAL.node = &ast.ExprAssign{ast.Node{}, listNode, yyDollar[6].node} @@ -5209,7 +5191,7 @@ yydefault: } case 297: yyDollar = yyS[yypt-5 : yypt+1] -// line internal/php7/php7.y:2776 + // line internal/php7/php7.y:2758 { shortList := &ast.ExprShortList{ast.Node{}, yyDollar[2].list} yyVAL.node = &ast.ExprAssign{ast.Node{}, shortList, yyDollar[5].node} @@ -5225,7 +5207,7 @@ yydefault: } case 298: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:2790 + // line internal/php7/php7.y:2772 { yyVAL.node = &ast.ExprAssign{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -5238,7 +5220,7 @@ yydefault: } case 299: yyDollar = yyS[yypt-4 : yypt+1] -// line internal/php7/php7.y:2801 + // line internal/php7/php7.y:2783 { yyVAL.node = &ast.ExprAssignReference{ast.Node{}, yyDollar[1].node, yyDollar[4].node} @@ -5252,7 +5234,7 @@ yydefault: } case 300: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php7/php7.y:2813 + // line internal/php7/php7.y:2795 { yyVAL.node = &ast.ExprClone{ast.Node{}, yyDollar[2].node} @@ -5264,7 +5246,7 @@ yydefault: } case 301: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:2823 + // line internal/php7/php7.y:2805 { yyVAL.node = &ast.ExprAssignPlus{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -5277,7 +5259,7 @@ yydefault: } case 302: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:2834 + // line internal/php7/php7.y:2816 { yyVAL.node = &ast.ExprAssignMinus{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -5290,7 +5272,7 @@ yydefault: } case 303: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:2845 + // line internal/php7/php7.y:2827 { yyVAL.node = &ast.ExprAssignMul{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -5303,7 +5285,7 @@ yydefault: } case 304: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:2856 + // line internal/php7/php7.y:2838 { yyVAL.node = &ast.ExprAssignPow{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -5316,7 +5298,7 @@ yydefault: } case 305: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:2867 + // line internal/php7/php7.y:2849 { yyVAL.node = &ast.ExprAssignDiv{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -5329,7 +5311,7 @@ yydefault: } case 306: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:2878 + // line internal/php7/php7.y:2860 { yyVAL.node = &ast.ExprAssignConcat{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -5342,7 +5324,7 @@ yydefault: } case 307: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:2889 + // line internal/php7/php7.y:2871 { yyVAL.node = &ast.ExprAssignMod{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -5355,7 +5337,7 @@ yydefault: } case 308: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:2900 + // line internal/php7/php7.y:2882 { yyVAL.node = &ast.ExprAssignBitwiseAnd{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -5368,7 +5350,7 @@ yydefault: } case 309: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:2911 + // line internal/php7/php7.y:2893 { yyVAL.node = &ast.ExprAssignBitwiseOr{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -5381,7 +5363,7 @@ yydefault: } case 310: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:2922 + // line internal/php7/php7.y:2904 { yyVAL.node = &ast.ExprAssignBitwiseXor{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -5394,7 +5376,7 @@ yydefault: } case 311: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:2933 + // line internal/php7/php7.y:2915 { yyVAL.node = &ast.ExprAssignShiftLeft{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -5407,7 +5389,7 @@ yydefault: } case 312: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:2944 + // line internal/php7/php7.y:2926 { yyVAL.node = &ast.ExprAssignShiftRight{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -5420,7 +5402,7 @@ yydefault: } case 313: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:2955 + // line internal/php7/php7.y:2937 { yyVAL.node = &ast.ExprAssignCoalesce{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -5433,7 +5415,7 @@ yydefault: } case 314: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php7/php7.y:2966 + // line internal/php7/php7.y:2948 { yyVAL.node = &ast.ExprPostInc{ast.Node{}, yyDollar[1].node} @@ -5446,7 +5428,7 @@ yydefault: } case 315: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php7/php7.y:2977 + // line internal/php7/php7.y:2959 { yyVAL.node = &ast.ExprPreInc{ast.Node{}, yyDollar[2].node} @@ -5458,7 +5440,7 @@ yydefault: } case 316: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php7/php7.y:2987 + // line internal/php7/php7.y:2969 { yyVAL.node = &ast.ExprPostDec{ast.Node{}, yyDollar[1].node} @@ -5471,7 +5453,7 @@ yydefault: } case 317: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php7/php7.y:2998 + // line internal/php7/php7.y:2980 { yyVAL.node = &ast.ExprPreDec{ast.Node{}, yyDollar[2].node} @@ -5483,7 +5465,7 @@ yydefault: } case 318: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:3008 + // line internal/php7/php7.y:2990 { yyVAL.node = &ast.ExprBinaryBooleanOr{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -5496,7 +5478,7 @@ yydefault: } case 319: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:3019 + // line internal/php7/php7.y:3001 { yyVAL.node = &ast.ExprBinaryBooleanAnd{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -5509,7 +5491,7 @@ yydefault: } case 320: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:3030 + // line internal/php7/php7.y:3012 { yyVAL.node = &ast.ExprBinaryLogicalOr{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -5522,7 +5504,7 @@ yydefault: } case 321: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:3041 + // line internal/php7/php7.y:3023 { yyVAL.node = &ast.ExprBinaryLogicalAnd{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -5535,7 +5517,7 @@ yydefault: } case 322: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:3052 + // line internal/php7/php7.y:3034 { yyVAL.node = &ast.ExprBinaryLogicalXor{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -5548,7 +5530,7 @@ yydefault: } case 323: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:3063 + // line internal/php7/php7.y:3045 { yyVAL.node = &ast.ExprBinaryBitwiseOr{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -5561,7 +5543,7 @@ yydefault: } case 324: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:3074 + // line internal/php7/php7.y:3056 { yyVAL.node = &ast.ExprBinaryBitwiseAnd{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -5574,7 +5556,7 @@ yydefault: } case 325: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:3085 + // line internal/php7/php7.y:3067 { yyVAL.node = &ast.ExprBinaryBitwiseXor{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -5587,7 +5569,7 @@ yydefault: } case 326: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:3096 + // line internal/php7/php7.y:3078 { yyVAL.node = &ast.ExprBinaryConcat{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -5600,7 +5582,7 @@ yydefault: } case 327: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:3107 + // line internal/php7/php7.y:3089 { yyVAL.node = &ast.ExprBinaryPlus{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -5613,7 +5595,7 @@ yydefault: } case 328: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:3118 + // line internal/php7/php7.y:3100 { yyVAL.node = &ast.ExprBinaryMinus{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -5626,7 +5608,7 @@ yydefault: } case 329: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:3129 + // line internal/php7/php7.y:3111 { yyVAL.node = &ast.ExprBinaryMul{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -5639,7 +5621,7 @@ yydefault: } case 330: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:3140 + // line internal/php7/php7.y:3122 { yyVAL.node = &ast.ExprBinaryPow{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -5652,7 +5634,7 @@ yydefault: } case 331: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:3151 + // line internal/php7/php7.y:3133 { yyVAL.node = &ast.ExprBinaryDiv{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -5665,7 +5647,7 @@ yydefault: } case 332: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:3162 + // line internal/php7/php7.y:3144 { yyVAL.node = &ast.ExprBinaryMod{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -5678,7 +5660,7 @@ yydefault: } case 333: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:3173 + // line internal/php7/php7.y:3155 { yyVAL.node = &ast.ExprBinaryShiftLeft{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -5691,7 +5673,7 @@ yydefault: } case 334: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:3184 + // line internal/php7/php7.y:3166 { yyVAL.node = &ast.ExprBinaryShiftRight{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -5704,7 +5686,7 @@ yydefault: } case 335: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php7/php7.y:3195 + // line internal/php7/php7.y:3177 { yyVAL.node = &ast.ExprUnaryPlus{ast.Node{}, yyDollar[2].node} @@ -5716,7 +5698,7 @@ yydefault: } case 336: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php7/php7.y:3205 + // line internal/php7/php7.y:3187 { yyVAL.node = &ast.ExprUnaryMinus{ast.Node{}, yyDollar[2].node} @@ -5728,7 +5710,7 @@ yydefault: } case 337: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php7/php7.y:3215 + // line internal/php7/php7.y:3197 { yyVAL.node = &ast.ExprBooleanNot{ast.Node{}, yyDollar[2].node} @@ -5740,7 +5722,7 @@ yydefault: } case 338: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php7/php7.y:3225 + // line internal/php7/php7.y:3207 { yyVAL.node = &ast.ExprBitwiseNot{ast.Node{}, yyDollar[2].node} @@ -5752,7 +5734,7 @@ yydefault: } case 339: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:3235 + // line internal/php7/php7.y:3217 { yyVAL.node = &ast.ExprBinaryIdentical{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -5765,7 +5747,7 @@ yydefault: } case 340: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:3246 + // line internal/php7/php7.y:3228 { yyVAL.node = &ast.ExprBinaryNotIdentical{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -5778,7 +5760,7 @@ yydefault: } case 341: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:3257 + // line internal/php7/php7.y:3239 { yyVAL.node = &ast.ExprBinaryEqual{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -5791,7 +5773,7 @@ yydefault: } case 342: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:3268 + // line internal/php7/php7.y:3250 { yyVAL.node = &ast.ExprBinaryNotEqual{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -5805,7 +5787,7 @@ yydefault: } case 343: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:3280 + // line internal/php7/php7.y:3262 { yyVAL.node = &ast.ExprBinarySmaller{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -5818,7 +5800,7 @@ yydefault: } case 344: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:3291 + // line internal/php7/php7.y:3273 { yyVAL.node = &ast.ExprBinarySmallerOrEqual{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -5831,7 +5813,7 @@ yydefault: } case 345: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:3302 + // line internal/php7/php7.y:3284 { yyVAL.node = &ast.ExprBinaryGreater{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -5844,7 +5826,7 @@ yydefault: } case 346: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:3313 + // line internal/php7/php7.y:3295 { yyVAL.node = &ast.ExprBinaryGreaterOrEqual{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -5857,7 +5839,7 @@ yydefault: } case 347: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:3324 + // line internal/php7/php7.y:3306 { yyVAL.node = &ast.ExprBinarySpaceship{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -5870,7 +5852,7 @@ yydefault: } case 348: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:3335 + // line internal/php7/php7.y:3317 { yyVAL.node = &ast.ExprInstanceOf{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -5883,7 +5865,7 @@ yydefault: } case 349: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:3346 + // line internal/php7/php7.y:3328 { yyVAL.node = &ast.ParserBrackets{ast.Node{}, yyDollar[2].node} @@ -5896,13 +5878,13 @@ yydefault: } case 350: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:3357 + // line internal/php7/php7.y:3339 { yyVAL.node = yyDollar[1].node } case 351: yyDollar = yyS[yypt-5 : yypt+1] -// line internal/php7/php7.y:3361 + // line internal/php7/php7.y:3343 { yyVAL.node = &ast.ExprTernary{ast.Node{}, yyDollar[1].node, yyDollar[3].node, yyDollar[5].node} @@ -5916,7 +5898,7 @@ yydefault: } case 352: yyDollar = yyS[yypt-4 : yypt+1] -// line internal/php7/php7.y:3373 + // line internal/php7/php7.y:3355 { yyVAL.node = &ast.ExprTernary{ast.Node{}, yyDollar[1].node, nil, yyDollar[4].node} @@ -5930,7 +5912,7 @@ yydefault: } case 353: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:3385 + // line internal/php7/php7.y:3367 { yyVAL.node = &ast.ExprBinaryCoalesce{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -5943,13 +5925,13 @@ yydefault: } case 354: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:3396 + // line internal/php7/php7.y:3378 { yyVAL.node = yyDollar[1].node } case 355: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php7/php7.y:3400 + // line internal/php7/php7.y:3382 { yyVAL.node = &ast.ExprCastInt{ast.Node{}, yyDollar[2].node} @@ -5962,7 +5944,7 @@ yydefault: } case 356: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php7/php7.y:3411 + // line internal/php7/php7.y:3393 { yyVAL.node = &ast.ExprCastDouble{ast.Node{}, yyDollar[2].node} @@ -5975,7 +5957,7 @@ yydefault: } case 357: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php7/php7.y:3422 + // line internal/php7/php7.y:3404 { yyVAL.node = &ast.ExprCastString{ast.Node{}, yyDollar[2].node} @@ -5988,7 +5970,7 @@ yydefault: } case 358: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php7/php7.y:3433 + // line internal/php7/php7.y:3415 { yyVAL.node = &ast.ExprCastArray{ast.Node{}, yyDollar[2].node} @@ -6001,7 +5983,7 @@ yydefault: } case 359: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php7/php7.y:3444 + // line internal/php7/php7.y:3426 { yyVAL.node = &ast.ExprCastObject{ast.Node{}, yyDollar[2].node} @@ -6014,7 +5996,7 @@ yydefault: } case 360: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php7/php7.y:3455 + // line internal/php7/php7.y:3437 { yyVAL.node = &ast.ExprCastBool{ast.Node{}, yyDollar[2].node} @@ -6027,7 +6009,7 @@ yydefault: } case 361: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php7/php7.y:3466 + // line internal/php7/php7.y:3448 { yyVAL.node = &ast.ExprCastUnset{ast.Node{}, yyDollar[2].node} @@ -6040,7 +6022,7 @@ yydefault: } case 362: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php7/php7.y:3477 + // line internal/php7/php7.y:3459 { yyVAL.node = &ast.ExprExit{ast.Node{}, false, yyDollar[2].node} @@ -6060,7 +6042,7 @@ yydefault: } case 363: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php7/php7.y:3495 + // line internal/php7/php7.y:3477 { yyVAL.node = &ast.ExprErrorSuppress{ast.Node{}, yyDollar[2].node} @@ -6072,13 +6054,13 @@ yydefault: } case 364: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:3505 + // line internal/php7/php7.y:3487 { yyVAL.node = yyDollar[1].node } case 365: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:3509 + // line internal/php7/php7.y:3491 { yyVAL.node = &ast.ExprShellExec{ast.Node{}, yyDollar[2].list} @@ -6090,7 +6072,7 @@ yydefault: } case 366: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php7/php7.y:3519 + // line internal/php7/php7.y:3501 { yyVAL.node = &ast.ExprPrint{ast.Node{}, yyDollar[2].node} @@ -6102,7 +6084,7 @@ yydefault: } case 367: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:3529 + // line internal/php7/php7.y:3511 { yyVAL.node = &ast.ExprYield{ast.Node{}, nil, nil} @@ -6114,7 +6096,7 @@ yydefault: } case 368: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php7/php7.y:3539 + // line internal/php7/php7.y:3521 { yyVAL.node = &ast.ExprYield{ast.Node{}, nil, yyDollar[2].node} @@ -6126,7 +6108,7 @@ yydefault: } case 369: yyDollar = yyS[yypt-4 : yypt+1] -// line internal/php7/php7.y:3549 + // line internal/php7/php7.y:3531 { yyVAL.node = &ast.ExprYield{ast.Node{}, yyDollar[2].node, yyDollar[4].node} @@ -6139,7 +6121,7 @@ yydefault: } case 370: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php7/php7.y:3560 + // line internal/php7/php7.y:3542 { yyVAL.node = &ast.ExprYieldFrom{ast.Node{}, yyDollar[2].node} @@ -6151,13 +6133,13 @@ yydefault: } case 371: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:3570 + // line internal/php7/php7.y:3552 { yyVAL.node = yyDollar[1].node } case 372: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php7/php7.y:3574 + // line internal/php7/php7.y:3556 { yyVAL.node = yyDollar[2].node @@ -6178,7 +6160,7 @@ yydefault: } case 373: yyDollar = yyS[yypt-11 : yypt+1] -// line internal/php7/php7.y:3595 + // line internal/php7/php7.y:3577 { yyVAL.node = &ast.ExprClosure{ast.Node{}, yyDollar[2].token != nil, false, yyDollar[5].list, yyDollar[7].ClosureUse, yyDollar[8].node, yyDollar[10].list} @@ -6209,7 +6191,7 @@ yydefault: } case 374: yyDollar = yyS[yypt-9 : yypt+1] -// line internal/php7/php7.y:3622 + // line internal/php7/php7.y:3604 { yyVAL.node = &ast.ExprArrowFunction{ast.Node{}, yyDollar[2].token != nil, false, yyDollar[4].list, yyDollar[6].node, yyDollar[9].node} @@ -6235,25 +6217,25 @@ yydefault: } case 376: yyDollar = yyS[yypt-0 : yypt+1] -// line internal/php7/php7.y:3652 + // line internal/php7/php7.y:3634 { yyVAL.token = nil } case 377: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:3656 + // line internal/php7/php7.y:3638 { yyVAL.token = yyDollar[1].token } case 378: yyDollar = yyS[yypt-0 : yypt+1] -// line internal/php7/php7.y:3663 + // line internal/php7/php7.y:3645 { yyVAL.ClosureUse = nil } case 379: yyDollar = yyS[yypt-4 : yypt+1] -// line internal/php7/php7.y:3667 + // line internal/php7/php7.y:3649 { yyVAL.ClosureUse = &ast.ExprClosureUse{ast.Node{}, yyDollar[3].list} @@ -6267,7 +6249,7 @@ yydefault: } case 380: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:3682 + // line internal/php7/php7.y:3664 { yyVAL.list = append(yyDollar[1].list, yyDollar[3].node) @@ -6276,13 +6258,13 @@ yydefault: } case 381: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:3689 + // line internal/php7/php7.y:3671 { yyVAL.list = []ast.Vertex{yyDollar[1].node} } case 382: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:3696 + // line internal/php7/php7.y:3678 { identifier := &ast.Identifier{ast.Node{}, yyDollar[1].token.Value} yyVAL.node = &ast.ExprVariable{ast.Node{}, identifier} @@ -6296,7 +6278,7 @@ yydefault: } case 383: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php7/php7.y:3708 + // line internal/php7/php7.y:3690 { identifier := &ast.Identifier{ast.Node{}, yyDollar[2].token.Value} variable := &ast.ExprVariable{ast.Node{}, identifier} @@ -6313,7 +6295,7 @@ yydefault: } case 384: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php7/php7.y:3726 + // line internal/php7/php7.y:3708 { yyVAL.node = &ast.ExprFunctionCall{ast.Node{}, yyDollar[1].node, yyDollar[2].node.(*ast.ArgumentList)} @@ -6325,7 +6307,7 @@ yydefault: } case 385: yyDollar = yyS[yypt-4 : yypt+1] -// line internal/php7/php7.y:3736 + // line internal/php7/php7.y:3718 { yyVAL.node = &ast.ExprStaticCall{ast.Node{}, yyDollar[1].node, yyDollar[3].node, yyDollar[4].node.(*ast.ArgumentList)} @@ -6338,7 +6320,7 @@ yydefault: } case 386: yyDollar = yyS[yypt-4 : yypt+1] -// line internal/php7/php7.y:3747 + // line internal/php7/php7.y:3729 { yyVAL.node = &ast.ExprStaticCall{ast.Node{}, yyDollar[1].node, yyDollar[3].node, yyDollar[4].node.(*ast.ArgumentList)} @@ -6351,7 +6333,7 @@ yydefault: } case 387: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php7/php7.y:3758 + // line internal/php7/php7.y:3740 { yyVAL.node = &ast.ExprFunctionCall{ast.Node{}, yyDollar[1].node, yyDollar[2].node.(*ast.ArgumentList)} @@ -6363,7 +6345,7 @@ yydefault: } case 388: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:3771 + // line internal/php7/php7.y:3753 { yyVAL.node = &ast.Identifier{ast.Node{}, yyDollar[1].token.Value} @@ -6375,31 +6357,31 @@ yydefault: } case 389: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:3781 + // line internal/php7/php7.y:3763 { yyVAL.node = yyDollar[1].node } case 390: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:3788 + // line internal/php7/php7.y:3770 { yyVAL.node = yyDollar[1].node } case 391: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:3792 + // line internal/php7/php7.y:3774 { yyVAL.node = yyDollar[1].node } case 392: yyDollar = yyS[yypt-0 : yypt+1] -// line internal/php7/php7.y:3799 + // line internal/php7/php7.y:3781 { yyVAL.node = nil } case 393: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:3803 + // line internal/php7/php7.y:3785 { yyVAL.node = &ast.ParserBrackets{ast.Node{}, yyDollar[2].node} @@ -6412,13 +6394,13 @@ yydefault: } case 394: yyDollar = yyS[yypt-0 : yypt+1] -// line internal/php7/php7.y:3817 + // line internal/php7/php7.y:3799 { yyVAL.list = []ast.Vertex{} } case 395: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:3821 + // line internal/php7/php7.y:3803 { part := &ast.ScalarEncapsedStringPart{ast.Node{}, yyDollar[1].token.Value} yyVAL.list = []ast.Vertex{part} @@ -6428,25 +6410,25 @@ yydefault: } case 396: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:3829 + // line internal/php7/php7.y:3811 { yyVAL.list = yyDollar[1].list } case 397: yyDollar = yyS[yypt-0 : yypt+1] -// line internal/php7/php7.y:3836 + // line internal/php7/php7.y:3818 { yyVAL.node = nil } case 398: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:3840 + // line internal/php7/php7.y:3822 { yyVAL.node = yyDollar[1].node } case 399: yyDollar = yyS[yypt-4 : yypt+1] -// line internal/php7/php7.y:3847 + // line internal/php7/php7.y:3829 { yyVAL.node = &ast.ExprArray{ast.Node{}, yyDollar[3].list} @@ -6460,7 +6442,7 @@ yydefault: } case 400: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:3859 + // line internal/php7/php7.y:3841 { yyVAL.node = &ast.ExprShortArray{ast.Node{}, yyDollar[2].list} @@ -6473,7 +6455,7 @@ yydefault: } case 401: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:3870 + // line internal/php7/php7.y:3852 { yyVAL.node = &ast.ScalarString{ast.Node{}, yyDollar[1].token.Value} @@ -6485,7 +6467,7 @@ yydefault: } case 402: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:3883 + // line internal/php7/php7.y:3865 { yyVAL.node = &ast.ScalarLnumber{ast.Node{}, yyDollar[1].token.Value} @@ -6497,7 +6479,7 @@ yydefault: } case 403: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:3893 + // line internal/php7/php7.y:3875 { yyVAL.node = &ast.ScalarDnumber{ast.Node{}, yyDollar[1].token.Value} @@ -6509,7 +6491,7 @@ yydefault: } case 404: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:3903 + // line internal/php7/php7.y:3885 { yyVAL.node = &ast.ScalarMagicConstant{ast.Node{}, yyDollar[1].token.Value} @@ -6521,7 +6503,7 @@ yydefault: } case 405: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:3913 + // line internal/php7/php7.y:3895 { yyVAL.node = &ast.ScalarMagicConstant{ast.Node{}, yyDollar[1].token.Value} @@ -6533,7 +6515,7 @@ yydefault: } case 406: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:3923 + // line internal/php7/php7.y:3905 { yyVAL.node = &ast.ScalarMagicConstant{ast.Node{}, yyDollar[1].token.Value} @@ -6545,7 +6527,7 @@ yydefault: } case 407: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:3933 + // line internal/php7/php7.y:3915 { yyVAL.node = &ast.ScalarMagicConstant{ast.Node{}, yyDollar[1].token.Value} @@ -6557,7 +6539,7 @@ yydefault: } case 408: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:3943 + // line internal/php7/php7.y:3925 { yyVAL.node = &ast.ScalarMagicConstant{ast.Node{}, yyDollar[1].token.Value} @@ -6569,7 +6551,7 @@ yydefault: } case 409: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:3953 + // line internal/php7/php7.y:3935 { yyVAL.node = &ast.ScalarMagicConstant{ast.Node{}, yyDollar[1].token.Value} @@ -6581,7 +6563,7 @@ yydefault: } case 410: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:3963 + // line internal/php7/php7.y:3945 { yyVAL.node = &ast.ScalarMagicConstant{ast.Node{}, yyDollar[1].token.Value} @@ -6593,7 +6575,7 @@ yydefault: } case 411: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:3973 + // line internal/php7/php7.y:3955 { yyVAL.node = &ast.ScalarMagicConstant{ast.Node{}, yyDollar[1].token.Value} @@ -6605,7 +6587,7 @@ yydefault: } case 412: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:3983 + // line internal/php7/php7.y:3965 { encapsed := &ast.ScalarEncapsedStringPart{ast.Node{}, yyDollar[2].token.Value} yyVAL.node = &ast.ScalarHeredoc{ast.Node{}, yyDollar[1].token.Value, []ast.Vertex{encapsed}} @@ -6619,7 +6601,7 @@ yydefault: } case 413: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php7/php7.y:3995 + // line internal/php7/php7.y:3977 { yyVAL.node = &ast.ScalarHeredoc{ast.Node{}, yyDollar[1].token.Value, nil} @@ -6631,7 +6613,7 @@ yydefault: } case 414: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:4005 + // line internal/php7/php7.y:3987 { yyVAL.node = &ast.ScalarEncapsed{ast.Node{}, yyDollar[2].list} @@ -6643,7 +6625,7 @@ yydefault: } case 415: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:4015 + // line internal/php7/php7.y:3997 { yyVAL.node = &ast.ScalarHeredoc{ast.Node{}, yyDollar[1].token.Value, yyDollar[2].list} @@ -6655,19 +6637,19 @@ yydefault: } case 416: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:4025 + // line internal/php7/php7.y:4007 { yyVAL.node = yyDollar[1].node } case 417: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:4029 + // line internal/php7/php7.y:4011 { yyVAL.node = yyDollar[1].node } case 418: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:4036 + // line internal/php7/php7.y:4018 { yyVAL.node = &ast.ExprConstFetch{ast.Node{}, yyDollar[1].node} @@ -6679,7 +6661,7 @@ yydefault: } case 419: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:4046 + // line internal/php7/php7.y:4028 { target := &ast.Identifier{ast.Node{}, yyDollar[3].token.Value} yyVAL.node = &ast.ExprClassConstFetch{ast.Node{}, yyDollar[1].node, target} @@ -6695,7 +6677,7 @@ yydefault: } case 420: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:4060 + // line internal/php7/php7.y:4042 { target := &ast.Identifier{ast.Node{}, yyDollar[3].token.Value} yyVAL.node = &ast.ExprClassConstFetch{ast.Node{}, yyDollar[1].node, target} @@ -6711,43 +6693,43 @@ yydefault: } case 421: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:4077 + // line internal/php7/php7.y:4059 { yyVAL.node = yyDollar[1].node } case 422: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:4081 + // line internal/php7/php7.y:4063 { yyVAL.node = yyDollar[1].node } case 423: yyDollar = yyS[yypt-0 : yypt+1] -// line internal/php7/php7.y:4088 + // line internal/php7/php7.y:4070 { yyVAL.node = nil } case 424: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:4092 + // line internal/php7/php7.y:4074 { yyVAL.node = yyDollar[1].node } case 425: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:4099 + // line internal/php7/php7.y:4081 { yyVAL.node = yyDollar[1].node } case 426: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:4106 + // line internal/php7/php7.y:4088 { yyVAL.node = yyDollar[1].node } case 427: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:4110 + // line internal/php7/php7.y:4092 { yyVAL.node = &ast.ParserBrackets{ast.Node{}, yyDollar[2].node} @@ -6760,19 +6742,19 @@ yydefault: } case 428: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:4121 + // line internal/php7/php7.y:4103 { yyVAL.node = yyDollar[1].node } case 429: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:4128 + // line internal/php7/php7.y:4110 { yyVAL.node = yyDollar[1].node } case 430: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:4132 + // line internal/php7/php7.y:4114 { yyVAL.node = &ast.ParserBrackets{ast.Node{}, yyDollar[2].node} @@ -6785,19 +6767,19 @@ yydefault: } case 431: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:4143 + // line internal/php7/php7.y:4125 { yyVAL.node = yyDollar[1].node } case 432: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:4150 + // line internal/php7/php7.y:4132 { yyVAL.node = yyDollar[1].node } case 433: yyDollar = yyS[yypt-4 : yypt+1] -// line internal/php7/php7.y:4154 + // line internal/php7/php7.y:4136 { yyVAL.node = &ast.ExprArrayDimFetch{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -6810,7 +6792,7 @@ yydefault: } case 434: yyDollar = yyS[yypt-4 : yypt+1] -// line internal/php7/php7.y:4165 + // line internal/php7/php7.y:4147 { yyVAL.node = &ast.ExprArrayDimFetch{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -6823,7 +6805,7 @@ yydefault: } case 435: yyDollar = yyS[yypt-4 : yypt+1] -// line internal/php7/php7.y:4176 + // line internal/php7/php7.y:4158 { yyVAL.node = &ast.ExprArrayDimFetch{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -6836,7 +6818,7 @@ yydefault: } case 436: yyDollar = yyS[yypt-4 : yypt+1] -// line internal/php7/php7.y:4187 + // line internal/php7/php7.y:4169 { yyVAL.node = &ast.ExprMethodCall{ast.Node{}, yyDollar[1].node, yyDollar[3].node, yyDollar[4].node.(*ast.ArgumentList)} @@ -6849,25 +6831,25 @@ yydefault: } case 437: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:4198 + // line internal/php7/php7.y:4180 { yyVAL.node = yyDollar[1].node } case 438: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:4205 + // line internal/php7/php7.y:4187 { yyVAL.node = yyDollar[1].node } case 439: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:4209 + // line internal/php7/php7.y:4191 { yyVAL.node = yyDollar[1].node } case 440: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:4213 + // line internal/php7/php7.y:4195 { yyVAL.node = &ast.ExprPropertyFetch{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -6880,7 +6862,7 @@ yydefault: } case 441: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:4227 + // line internal/php7/php7.y:4209 { name := &ast.Identifier{ast.Node{}, yyDollar[1].token.Value} yyVAL.node = &ast.ExprVariable{ast.Node{}, name} @@ -6894,7 +6876,7 @@ yydefault: } case 442: yyDollar = yyS[yypt-4 : yypt+1] -// line internal/php7/php7.y:4239 + // line internal/php7/php7.y:4221 { yyVAL.node = &ast.ExprVariable{ast.Node{}, yyDollar[3].node} @@ -6908,7 +6890,7 @@ yydefault: } case 443: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php7/php7.y:4251 + // line internal/php7/php7.y:4233 { yyVAL.node = &ast.ExprVariable{ast.Node{}, yyDollar[2].node} @@ -6920,7 +6902,7 @@ yydefault: } case 444: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:4264 + // line internal/php7/php7.y:4246 { yyVAL.node = &ast.ExprStaticPropertyFetch{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -6933,7 +6915,7 @@ yydefault: } case 445: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:4275 + // line internal/php7/php7.y:4257 { yyVAL.node = &ast.ExprStaticPropertyFetch{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -6946,13 +6928,13 @@ yydefault: } case 446: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:4289 + // line internal/php7/php7.y:4271 { yyVAL.node = yyDollar[1].node } case 447: yyDollar = yyS[yypt-4 : yypt+1] -// line internal/php7/php7.y:4293 + // line internal/php7/php7.y:4275 { yyVAL.node = &ast.ExprArrayDimFetch{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -6965,7 +6947,7 @@ yydefault: } case 448: yyDollar = yyS[yypt-4 : yypt+1] -// line internal/php7/php7.y:4304 + // line internal/php7/php7.y:4286 { yyVAL.node = &ast.ExprArrayDimFetch{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -6978,7 +6960,7 @@ yydefault: } case 449: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:4315 + // line internal/php7/php7.y:4297 { yyVAL.node = &ast.ExprPropertyFetch{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -6991,7 +6973,7 @@ yydefault: } case 450: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:4326 + // line internal/php7/php7.y:4308 { yyVAL.node = &ast.ExprStaticPropertyFetch{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -7004,7 +6986,7 @@ yydefault: } case 451: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:4337 + // line internal/php7/php7.y:4319 { yyVAL.node = &ast.ExprStaticPropertyFetch{ast.Node{}, yyDollar[1].node, yyDollar[3].node} @@ -7017,7 +6999,7 @@ yydefault: } case 452: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:4351 + // line internal/php7/php7.y:4333 { yyVAL.node = &ast.Identifier{ast.Node{}, yyDollar[1].token.Value} @@ -7029,7 +7011,7 @@ yydefault: } case 453: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:4361 + // line internal/php7/php7.y:4343 { yyVAL.node = yyDollar[2].node @@ -7039,13 +7021,13 @@ yydefault: } case 454: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:4369 + // line internal/php7/php7.y:4351 { yyVAL.node = yyDollar[1].node } case 455: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:4376 + // line internal/php7/php7.y:4358 { yyVAL.node = &ast.Identifier{ast.Node{}, yyDollar[1].token.Value} @@ -7057,7 +7039,7 @@ yydefault: } case 456: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:4386 + // line internal/php7/php7.y:4368 { yyVAL.node = yyDollar[2].node @@ -7067,31 +7049,31 @@ yydefault: } case 457: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:4394 + // line internal/php7/php7.y:4376 { yyVAL.node = yyDollar[1].node } case 458: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:4401 + // line internal/php7/php7.y:4383 { yyVAL.list = yyDollar[1].list } case 459: yyDollar = yyS[yypt-0 : yypt+1] -// line internal/php7/php7.y:4408 + // line internal/php7/php7.y:4390 { yyVAL.node = &ast.ExprArrayItem{ast.Node{}, false, nil, nil} } case 460: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:4412 + // line internal/php7/php7.y:4394 { yyVAL.node = yyDollar[1].node } case 461: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:4419 + // line internal/php7/php7.y:4401 { if len(yyDollar[1].list) == 0 { yyDollar[1].list = []ast.Vertex{&ast.ExprArrayItem{ast.Node{}, false, nil, nil}} @@ -7104,7 +7086,7 @@ yydefault: } case 462: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:4430 + // line internal/php7/php7.y:4412 { if yyDollar[1].node.(*ast.ExprArrayItem).Key == nil && yyDollar[1].node.(*ast.ExprArrayItem).Val == nil { yyVAL.list = []ast.Vertex{} @@ -7114,7 +7096,7 @@ yydefault: } case 463: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:4441 + // line internal/php7/php7.y:4423 { yyVAL.node = &ast.ExprArrayItem{ast.Node{}, false, yyDollar[1].node, yyDollar[3].node} @@ -7127,7 +7109,7 @@ yydefault: } case 464: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:4452 + // line internal/php7/php7.y:4434 { yyVAL.node = &ast.ExprArrayItem{ast.Node{}, false, nil, yyDollar[1].node} @@ -7139,7 +7121,7 @@ yydefault: } case 465: yyDollar = yyS[yypt-4 : yypt+1] -// line internal/php7/php7.y:4462 + // line internal/php7/php7.y:4444 { reference := &ast.ExprReference{ast.Node{}, yyDollar[4].node} yyVAL.node = &ast.ExprArrayItem{ast.Node{}, false, yyDollar[1].node, reference} @@ -7155,7 +7137,7 @@ yydefault: } case 466: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php7/php7.y:4476 + // line internal/php7/php7.y:4458 { reference := &ast.ExprReference{ast.Node{}, yyDollar[2].node} yyVAL.node = &ast.ExprArrayItem{ast.Node{}, false, nil, reference} @@ -7169,7 +7151,7 @@ yydefault: } case 467: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php7/php7.y:4488 + // line internal/php7/php7.y:4470 { yyVAL.node = &ast.ExprArrayItem{ast.Node{}, true, nil, yyDollar[2].node} @@ -7181,7 +7163,7 @@ yydefault: } case 468: yyDollar = yyS[yypt-6 : yypt+1] -// line internal/php7/php7.y:4498 + // line internal/php7/php7.y:4480 { // TODO: Cannot use list() as standalone expression listNode := &ast.ExprList{ast.Node{}, yyDollar[5].list} @@ -7200,7 +7182,7 @@ yydefault: } case 469: yyDollar = yyS[yypt-4 : yypt+1] -// line internal/php7/php7.y:4515 + // line internal/php7/php7.y:4497 { // TODO: Cannot use list() as standalone expression listNode := &ast.ExprList{ast.Node{}, yyDollar[3].list} @@ -7217,13 +7199,13 @@ yydefault: } case 470: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php7/php7.y:4533 + // line internal/php7/php7.y:4515 { yyVAL.list = append(yyDollar[1].list, yyDollar[2].node) } case 471: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php7/php7.y:4537 + // line internal/php7/php7.y:4519 { encapsed := &ast.ScalarEncapsedStringPart{ast.Node{}, yyDollar[2].token.Value} yyVAL.list = append(yyDollar[1].list, encapsed) @@ -7236,13 +7218,13 @@ yydefault: } case 472: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:4548 + // line internal/php7/php7.y:4530 { yyVAL.list = []ast.Vertex{yyDollar[1].node} } case 473: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php7/php7.y:4552 + // line internal/php7/php7.y:4534 { encapsed := &ast.ScalarEncapsedStringPart{ast.Node{}, yyDollar[1].token.Value} yyVAL.list = []ast.Vertex{encapsed, yyDollar[2].node} @@ -7255,7 +7237,7 @@ yydefault: } case 474: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:4566 + // line internal/php7/php7.y:4548 { name := &ast.Identifier{ast.Node{}, yyDollar[1].token.Value} yyVAL.node = &ast.ExprVariable{ast.Node{}, name} @@ -7269,7 +7251,7 @@ yydefault: } case 475: yyDollar = yyS[yypt-4 : yypt+1] -// line internal/php7/php7.y:4578 + // line internal/php7/php7.y:4560 { identifier := &ast.Identifier{ast.Node{}, yyDollar[1].token.Value} variable := &ast.ExprVariable{ast.Node{}, identifier} @@ -7286,7 +7268,7 @@ yydefault: } case 476: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:4593 + // line internal/php7/php7.y:4575 { identifier := &ast.Identifier{ast.Node{}, yyDollar[1].token.Value} variable := &ast.ExprVariable{ast.Node{}, identifier} @@ -7305,7 +7287,7 @@ yydefault: } case 477: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:4610 + // line internal/php7/php7.y:4592 { variable := &ast.ExprVariable{ast.Node{}, yyDollar[2].node} @@ -7320,7 +7302,7 @@ yydefault: } case 478: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:4623 + // line internal/php7/php7.y:4605 { name := &ast.Identifier{ast.Node{}, yyDollar[2].token.Value} variable := &ast.ExprVariable{ast.Node{}, name} @@ -7337,7 +7319,7 @@ yydefault: } case 479: yyDollar = yyS[yypt-6 : yypt+1] -// line internal/php7/php7.y:4638 + // line internal/php7/php7.y:4620 { identifier := &ast.Identifier{ast.Node{}, yyDollar[2].token.Value} variable := &ast.ExprVariable{ast.Node{}, identifier} @@ -7356,7 +7338,7 @@ yydefault: } case 480: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:4655 + // line internal/php7/php7.y:4637 { yyVAL.node = yyDollar[2].node @@ -7366,7 +7348,7 @@ yydefault: } case 481: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:4666 + // line internal/php7/php7.y:4648 { yyVAL.node = &ast.ScalarString{ast.Node{}, yyDollar[1].token.Value} @@ -7378,7 +7360,7 @@ yydefault: } case 482: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:4676 + // line internal/php7/php7.y:4658 { // TODO: add option to handle 64 bit integer if _, err := strconv.Atoi(string(yyDollar[1].token.Value)); err == nil { @@ -7395,7 +7377,7 @@ yydefault: } case 483: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php7/php7.y:4691 + // line internal/php7/php7.y:4673 { var lnumber *ast.ScalarLnumber // TODO: add option to handle 64 bit integer @@ -7421,7 +7403,7 @@ yydefault: } case 484: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:4715 + // line internal/php7/php7.y:4697 { identifier := &ast.Identifier{ast.Node{}, yyDollar[1].token.Value} yyVAL.node = &ast.ExprVariable{ast.Node{}, identifier} @@ -7435,7 +7417,7 @@ yydefault: } case 485: yyDollar = yyS[yypt-5 : yypt+1] -// line internal/php7/php7.y:4730 + // line internal/php7/php7.y:4712 { yyVAL.node = &ast.ExprIsset{ast.Node{}, yyDollar[3].list} @@ -7453,7 +7435,7 @@ yydefault: } case 486: yyDollar = yyS[yypt-4 : yypt+1] -// line internal/php7/php7.y:4746 + // line internal/php7/php7.y:4728 { exprBrackets := &ast.ParserBrackets{ast.Node{}, yyDollar[3].node} yyVAL.node = &ast.ExprEmpty{ast.Node{}, exprBrackets} @@ -7469,7 +7451,7 @@ yydefault: } case 487: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php7/php7.y:4760 + // line internal/php7/php7.y:4742 { yyVAL.node = &ast.ExprInclude{ast.Node{}, yyDollar[2].node} @@ -7481,7 +7463,7 @@ yydefault: } case 488: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php7/php7.y:4770 + // line internal/php7/php7.y:4752 { yyVAL.node = &ast.ExprIncludeOnce{ast.Node{}, yyDollar[2].node} @@ -7493,7 +7475,7 @@ yydefault: } case 489: yyDollar = yyS[yypt-4 : yypt+1] -// line internal/php7/php7.y:4780 + // line internal/php7/php7.y:4762 { exprBrackets := &ast.ParserBrackets{ast.Node{}, yyDollar[3].node} yyVAL.node = &ast.ExprEval{ast.Node{}, exprBrackets} @@ -7509,7 +7491,7 @@ yydefault: } case 490: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php7/php7.y:4794 + // line internal/php7/php7.y:4776 { yyVAL.node = &ast.ExprRequire{ast.Node{}, yyDollar[2].node} @@ -7521,7 +7503,7 @@ yydefault: } case 491: yyDollar = yyS[yypt-2 : yypt+1] -// line internal/php7/php7.y:4804 + // line internal/php7/php7.y:4786 { yyVAL.node = &ast.ExprRequireOnce{ast.Node{}, yyDollar[2].node} @@ -7533,13 +7515,13 @@ yydefault: } case 492: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:4817 + // line internal/php7/php7.y:4799 { yyVAL.list = []ast.Vertex{yyDollar[1].node} } case 493: yyDollar = yyS[yypt-3 : yypt+1] -// line internal/php7/php7.y:4821 + // line internal/php7/php7.y:4803 { yyVAL.list = append(yyDollar[1].list, yyDollar[3].node) @@ -7548,7 +7530,7 @@ yydefault: } case 494: yyDollar = yyS[yypt-1 : yypt+1] -// line internal/php7/php7.y:4831 + // line internal/php7/php7.y:4813 { yyVAL.node = yyDollar[1].node } diff --git a/internal/php7/php7.y b/internal/php7/php7.y index 23503c6..f6589cd 100644 --- a/internal/php7/php7.y +++ b/internal/php7/php7.y @@ -485,55 +485,47 @@ top_statement: } | T_USE mixed_group_use_declaration ';' { - $$ = &ast.StmtUse{ast.Node{}, $2} + use := $2.(*ast.StmtGroupUse) - // save position - $$.GetNode().Position = position.NewTokensPosition($1, $3) + use.Node.Position = position.NewTokensPosition($1, $3) + use.UseTkn = $1 + use.SemiColonTkn = $3 - // save comments - yylex.(*Parser).setFreeFloating($$, token.Start, $1.SkippedTokens) - yylex.(*Parser).setFreeFloatingTokens($$, token.End, $3.SkippedTokens) + $$ = $2 } | T_USE use_type group_use_declaration ';' { - useType := &ast.StmtUseType{ast.Node{}, $2, $3} - $$ = &ast.StmtUse{ast.Node{}, useType} + use := $3.(*ast.StmtGroupUse) - // save position - useType.GetNode().Position = position.NewNodesPosition($2, $3) - $$.GetNode().Position = position.NewTokensPosition($1, $4) + use.Node.Position = position.NewTokensPosition($1, $4) + use.UseTkn = $1 + use.Type = $2 + use.SemiColonTkn = $4 - // save comments - yylex.(*Parser).setFreeFloating($$, token.Start, $1.SkippedTokens) - yylex.(*Parser).setFreeFloatingTokens($$, token.End, $4.SkippedTokens) + $$ = $3 } | T_USE use_declarations ';' { - useList := &ast.StmtUseList{ast.Node{}, $2} - $$ = &ast.StmtUse{ast.Node{}, useList} - - // save position - useList.GetNode().Position = position.NewNodeListPosition($2) - $$.GetNode().Position = position.NewTokensPosition($1, $3) - - // save comments - yylex.(*Parser).setFreeFloating($$, token.Start, $1.SkippedTokens) - yylex.(*Parser).setFreeFloatingTokens($$, token.End, $3.SkippedTokens) + $$ = &ast.StmtUse{ + Node: ast.Node{ + Position: position.NewTokensPosition($1, $3), + }, + UseTkn: $1, + UseDeclarations: $2, + SemiColonTkn: $3, + } } | T_USE use_type use_declarations ';' { - useList := &ast.StmtUseList{ast.Node{}, $3} - useType := &ast.StmtUseType{ast.Node{}, $2, useList} - $$ = &ast.StmtUse{ast.Node{}, useType} - - // save position - useList.GetNode().Position = position.NewNodeListPosition($3) - useType.GetNode().Position = position.NewNodesPosition($2, useList) - $$.GetNode().Position = position.NewTokensPosition($1, $4) - - // save comments - yylex.(*Parser).setFreeFloating($$, token.Start, $1.SkippedTokens) - yylex.(*Parser).setFreeFloatingTokens($$, token.End, $4.SkippedTokens) + $$ = &ast.StmtUse{ + Node: ast.Node{ + Position: position.NewTokensPosition($1, $4), + }, + UseTkn: $1, + Type: $2, + UseDeclarations: $3, + SemiColonTkn: $4, + } } | T_CONST const_list ';' { @@ -575,104 +567,90 @@ use_type: group_use_declaration: namespace_name T_NS_SEPARATOR '{' unprefixed_use_declarations possible_comma '}' { - name := &ast.NameName{ast.Node{}, $1} - useList := &ast.StmtUseList{ast.Node{}, $4} - useListBrackets := &ast.ParserBrackets{ast.Node{}, useList} - useListNsSeparator := &ast.ParserNsSeparator{ast.Node{}, useListBrackets} - $$ = &ast.StmtGroupUseList{ast.Node{}, name, useListNsSeparator} - - // save position - name.GetNode().Position = position.NewNodeListPosition($1) - useList.GetNode().Position = position.NewNodeListPosition($4) - useListBrackets.GetNode().Position = position.NewTokensPosition($3, $6) - useListNsSeparator.GetNode().Position = position.NewTokensPosition($2, $6) - $$.GetNode().Position = position.NewNodeListTokenPosition($1, $6) - - // save comments - if $5 != nil { - yylex.(*Parser).setFreeFloatingTokens(useList, token.End, $5.SkippedTokens) + if len($4) > 0 { + $4[len($4)-1].(*ast.StmtUseDeclaration).CommaTkn = $5 + } + + $$ = &ast.StmtGroupUse{ + Node: ast.Node{ + Position: position.NewNodeListTokenPosition($1, $6), + }, + Prefix: &ast.NameName{ + Node: ast.Node{ + Position: position.NewNodeListPosition($1), + }, + Parts: $1, + }, + NsSeparatorTkn: $2, + OpenCurlyBracketTkn: $3, + UseDeclarations: $4, + CloseCurlyBracketTkn: $6, } - yylex.(*Parser).setFreeFloatingTokens(useListBrackets, token.Start, $3.SkippedTokens) - yylex.(*Parser).setFreeFloatingTokens(useListBrackets, token.End, $6.SkippedTokens) - yylex.(*Parser).setFreeFloating(useListNsSeparator, token.Start, $2.SkippedTokens) } | T_NS_SEPARATOR namespace_name T_NS_SEPARATOR '{' unprefixed_use_declarations possible_comma '}' { - name := &ast.NameName{ast.Node{}, $2} - prefixNsSeparator := &ast.ParserNsSeparator{ast.Node{}, name} - useList := &ast.StmtUseList{ast.Node{}, $5} - useListBrackets := &ast.ParserBrackets{ast.Node{}, useList} - useListNsSeparator := &ast.ParserNsSeparator{ast.Node{}, useListBrackets} - $$ = &ast.StmtGroupUseList{ast.Node{}, prefixNsSeparator, useListNsSeparator} + $5[len($5)-1].(*ast.StmtUseDeclaration).CommaTkn = $6 - // save position - name.GetNode().Position = position.NewNodeListPosition($2) - prefixNsSeparator.GetNode().Position = position.NewTokenNodePosition($1, name) - useList.GetNode().Position = position.NewNodeListPosition($5) - useListBrackets.GetNode().Position = position.NewTokensPosition($4, $7) - useListNsSeparator.GetNode().Position = position.NewTokensPosition($3, $7) - $$.GetNode().Position = position.NewTokensPosition($1, $7) - - // save comments - yylex.(*Parser).setFreeFloating(prefixNsSeparator, token.Start, $1.SkippedTokens) - if $6 != nil { - yylex.(*Parser).setFreeFloatingTokens(useList, token.End, $6.SkippedTokens) + $$ = &ast.StmtGroupUse{ + Node: ast.Node{ + Position: position.NewTokensPosition($1, $7), + }, + LeadingNsSeparatorTkn: $1, + Prefix: &ast.NameName{ + Node: ast.Node{ + Position: position.NewNodeListPosition($2), + }, + Parts: $2, + }, + NsSeparatorTkn: $3, + OpenCurlyBracketTkn: $4, + UseDeclarations: $5, + CloseCurlyBracketTkn: $7, } - yylex.(*Parser).setFreeFloatingTokens(useListBrackets, token.Start, $4.SkippedTokens) - yylex.(*Parser).setFreeFloatingTokens(useListBrackets, token.End, $7.SkippedTokens) - yylex.(*Parser).setFreeFloating(useListNsSeparator, token.Start, $3.SkippedTokens) } ; mixed_group_use_declaration: namespace_name T_NS_SEPARATOR '{' inline_use_declarations possible_comma '}' { - name := &ast.NameName{ast.Node{}, $1} - useList := &ast.StmtUseList{ast.Node{}, $4} - useListBrackets := &ast.ParserBrackets{ast.Node{}, useList} - useListNsSeparator := &ast.ParserNsSeparator{ast.Node{}, useListBrackets} - $$ = &ast.StmtGroupUseList{ast.Node{}, name, useListNsSeparator} + $4[len($4)-1].(*ast.StmtUseDeclaration).CommaTkn = $5 - // save position - name.GetNode().Position = position.NewNodeListPosition($1) - useList.GetNode().Position = position.NewNodeListPosition($4) - useListBrackets.GetNode().Position = position.NewTokensPosition($3, $6) - useListNsSeparator.GetNode().Position = position.NewTokensPosition($2, $6) - $$.GetNode().Position = position.NewNodeListTokenPosition($1, $6) - - // save comments - if $5 != nil { - yylex.(*Parser).setFreeFloatingTokens(useList, token.End, $5.SkippedTokens) + $$ = &ast.StmtGroupUse{ + Node: ast.Node{ + Position: position.NewNodeListTokenPosition($1, $6), + }, + Prefix: &ast.NameName{ + Node: ast.Node{ + Position: position.NewNodeListPosition($1), + }, + Parts: $1, + }, + NsSeparatorTkn: $2, + OpenCurlyBracketTkn: $3, + UseDeclarations: $4, + CloseCurlyBracketTkn: $6, } - yylex.(*Parser).setFreeFloatingTokens(useListBrackets, token.Start, $3.SkippedTokens) - yylex.(*Parser).setFreeFloatingTokens(useListBrackets, token.End, $6.SkippedTokens) - yylex.(*Parser).setFreeFloating(useListNsSeparator, token.Start, $2.SkippedTokens) } | T_NS_SEPARATOR namespace_name T_NS_SEPARATOR '{' inline_use_declarations possible_comma '}' { - name := &ast.NameName{ast.Node{}, $2} - prefixNsSeparator := &ast.ParserNsSeparator{ast.Node{}, name} - useList := &ast.StmtUseList{ast.Node{}, $5} - useListBrackets := &ast.ParserBrackets{ast.Node{}, useList} - useListNsSeparator := &ast.ParserNsSeparator{ast.Node{}, useListBrackets} - $$ = &ast.StmtGroupUseList{ast.Node{}, prefixNsSeparator, useListNsSeparator} + $5[len($5)-1].(*ast.StmtUseDeclaration).CommaTkn = $6 - // save position - name.GetNode().Position = position.NewNodeListPosition($2) - prefixNsSeparator.GetNode().Position = position.NewTokenNodePosition($1, name) - useList.GetNode().Position = position.NewNodeListPosition($5) - useListBrackets.GetNode().Position = position.NewTokensPosition($4, $7) - useListNsSeparator.GetNode().Position = position.NewTokensPosition($3, $7) - $$.GetNode().Position = position.NewTokensPosition($1, $7) - - // save comments - yylex.(*Parser).setFreeFloating(prefixNsSeparator, token.Start, $1.SkippedTokens) - if $6 != nil { - yylex.(*Parser).setFreeFloatingTokens(useList, token.End, $6.SkippedTokens) + $$ = &ast.StmtGroupUse{ + Node: ast.Node{ + Position: position.NewTokensPosition($1, $7), + }, + LeadingNsSeparatorTkn: $1, + Prefix: &ast.NameName{ + Node: ast.Node{ + Position: position.NewNodeListPosition($2), + }, + Parts: $2, + }, + NsSeparatorTkn: $3, + OpenCurlyBracketTkn: $4, + UseDeclarations: $5, + CloseCurlyBracketTkn: $7, } - yylex.(*Parser).setFreeFloatingTokens(useListBrackets, token.Start, $4.SkippedTokens) - yylex.(*Parser).setFreeFloatingTokens(useListBrackets, token.End, $7.SkippedTokens) - yylex.(*Parser).setFreeFloating(useListNsSeparator, token.Start, $3.SkippedTokens) } ; @@ -690,10 +668,9 @@ possible_comma: inline_use_declarations: inline_use_declarations ',' inline_use_declaration { - $$ = append($1, $3) + $1[len($1)-1].(*ast.StmtUseDeclaration).CommaTkn = $2 - // save comments - yylex.(*Parser).setFreeFloating(lastNode($1), token.End, $2.SkippedTokens) + $$ = append($1, $3) } | inline_use_declaration { @@ -704,10 +681,9 @@ inline_use_declarations: unprefixed_use_declarations: unprefixed_use_declarations ',' unprefixed_use_declaration { - $$ = append($1, $3) + $1[len($1)-1].(*ast.StmtUseDeclaration).CommaTkn = $2 - // save comments - yylex.(*Parser).setFreeFloating(lastNode($1), token.End, $2.SkippedTokens) + $$ = append($1, $3) } | unprefixed_use_declaration { @@ -718,10 +694,9 @@ unprefixed_use_declarations: use_declarations: use_declarations ',' use_declaration { - $$ = append($1, $3) + $1[len($1)-1].(*ast.StmtUseDeclaration).CommaTkn = $2 - // save comments - yylex.(*Parser).setFreeFloating(lastNode($1), token.End, $2.SkippedTokens) + $$ = append($1, $3) } | use_declaration { @@ -736,39 +711,49 @@ inline_use_declaration: } | use_type unprefixed_use_declaration { - $$ = &ast.StmtUseType{ast.Node{}, $1, $2} + decl := $2.(*ast.StmtUseDeclaration) + decl.Type = $1 + decl.Node.Position = position.NewNodesPosition($1, $2) - // save position - $$.GetNode().Position = position.NewNodesPosition($1, $2) + $$ = $2 } ; unprefixed_use_declaration: namespace_name { - name := &ast.NameName{ast.Node{}, $1} - $$ = &ast.StmtUseDeclaration{ast.Node{}, name, nil} - - // save position - name.GetNode().Position = position.NewNodeListPosition($1) - $$.GetNode().Position = position.NewNodePosition(name) + $$ = &ast.StmtUseDeclaration{ + Node: ast.Node{ + Position: position.NewNodeListPosition($1), + }, + Use: &ast.NameName{ + Node: ast.Node{ + Position: position.NewNodeListPosition($1), + }, + Parts: $1, + }, + } } | namespace_name T_AS T_STRING { - name := &ast.NameName{ast.Node{}, $1} - alias := &ast.Identifier{ast.Node{}, $3.Value} - asAlias := &ast.ParserAs{ast.Node{}, alias} - $$ = &ast.StmtUseDeclaration{ast.Node{}, name, asAlias} - - // save position - name.GetNode().Position = position.NewNodeListPosition($1) - alias.GetNode().Position = position.NewTokenPosition($3) - asAlias.GetNode().Position = position.NewTokensPosition($2, $3) - $$.GetNode().Position = position.NewNodeListTokenPosition($1, $3) - - // save comments - yylex.(*Parser).setFreeFloating(asAlias, token.Start, $2.SkippedTokens) - yylex.(*Parser).setFreeFloating(alias, token.Start, $3.SkippedTokens) + $$ = &ast.StmtUseDeclaration{ + Node: ast.Node{ + Position: position.NewNodeListTokenPosition($1, $3), + }, + Use: &ast.NameName{ + Node: ast.Node{ + Position: position.NewNodeListPosition($1), + }, + Parts: $1, + }, + AsTkn: $2, + Alias: &ast.Identifier{ + Node: ast.Node{ + Position: position.NewTokenPosition($3), + }, + Value: $3.Value, + }, + } } ; @@ -779,14 +764,11 @@ use_declaration: } | T_NS_SEPARATOR unprefixed_use_declaration { - $$ = &ast.ParserNsSeparator{ast.Node{}, $2} + decl := $2.(*ast.StmtUseDeclaration) + decl.NsSeparatorTkn = $1 + decl.Node.Position = position.NewTokenNodePosition($1, $2) - // save position - $2.GetNode().Position = position.NewTokenNodePosition($1, $2) - $$.GetNode().Position = position.NewTokenNodePosition($1, $2) - - // save comments - yylex.(*Parser).setFreeFloating($$, token.Start, $1.SkippedTokens) + $$ = $2 } ; diff --git a/internal/php7/php7_test.go b/internal/php7/php7_test.go index 8d52038..00d02cc 100644 --- a/internal/php7/php7_test.go +++ b/internal/php7/php7_test.go @@ -9024,17 +9024,17 @@ func TestPhp7(t *testing.T) { EndPos: 3370, }, }, - UseList: &ast.StmtUseList{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 161, - EndLine: 161, - StartPos: 3366, - EndPos: 3369, + UseDeclarations: []ast.Vertex{ + &ast.StmtUseDeclaration{ + Node: ast.Node{ + Position: &position.Position{ + StartLine: 161, + EndLine: 161, + StartPos: 3366, + EndPos: 3369, + }, }, - }, - UseDeclarations: []ast.Vertex{ - &ast.StmtUseDeclaration{ + Use: &ast.NameName{ Node: ast.Node{ Position: &position.Position{ StartLine: 161, @@ -9043,27 +9043,17 @@ func TestPhp7(t *testing.T) { EndPos: 3369, }, }, - Use: &ast.NameName{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 161, - EndLine: 161, - StartPos: 3366, - EndPos: 3369, - }, - }, - Parts: []ast.Vertex{ - &ast.NameNamePart{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 161, - EndLine: 161, - StartPos: 3366, - EndPos: 3369, - }, + Parts: []ast.Vertex{ + &ast.NameNamePart{ + Node: ast.Node{ + Position: &position.Position{ + StartLine: 161, + EndLine: 161, + StartPos: 3366, + EndPos: 3369, }, - Value: []byte("Foo"), }, + Value: []byte("Foo"), }, }, }, @@ -9079,46 +9069,36 @@ func TestPhp7(t *testing.T) { EndPos: 3380, }, }, - UseList: &ast.StmtUseList{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 162, - EndLine: 162, - StartPos: 3375, - EndPos: 3379, + UseDeclarations: []ast.Vertex{ + &ast.StmtUseDeclaration{ + Node: ast.Node{ + Position: &position.Position{ + StartLine: 162, + EndLine: 162, + StartPos: 3375, + EndPos: 3379, + }, }, - }, - UseDeclarations: []ast.Vertex{ - &ast.StmtUseDeclaration{ + Use: &ast.NameName{ Node: ast.Node{ Position: &position.Position{ StartLine: 162, EndLine: 162, - StartPos: 3375, + StartPos: 3376, EndPos: 3379, }, }, - Use: &ast.NameName{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 162, - EndLine: 162, - StartPos: 3376, - EndPos: 3379, - }, - }, - Parts: []ast.Vertex{ - &ast.NameNamePart{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 162, - EndLine: 162, - StartPos: 3376, - EndPos: 3379, - }, + Parts: []ast.Vertex{ + &ast.NameNamePart{ + Node: ast.Node{ + Position: &position.Position{ + StartLine: 162, + EndLine: 162, + StartPos: 3376, + EndPos: 3379, }, - Value: []byte("Foo"), }, + Value: []byte("Foo"), }, }, }, @@ -9134,59 +9114,49 @@ func TestPhp7(t *testing.T) { EndPos: 3397, }, }, - UseList: &ast.StmtUseList{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 163, - EndLine: 163, - StartPos: 3385, - EndPos: 3396, + UseDeclarations: []ast.Vertex{ + &ast.StmtUseDeclaration{ + Node: ast.Node{ + Position: &position.Position{ + StartLine: 163, + EndLine: 163, + StartPos: 3385, + EndPos: 3396, + }, }, - }, - UseDeclarations: []ast.Vertex{ - &ast.StmtUseDeclaration{ + Use: &ast.NameName{ Node: ast.Node{ Position: &position.Position{ StartLine: 163, EndLine: 163, - StartPos: 3385, + StartPos: 3386, + EndPos: 3389, + }, + }, + Parts: []ast.Vertex{ + &ast.NameNamePart{ + Node: ast.Node{ + Position: &position.Position{ + StartLine: 163, + EndLine: 163, + StartPos: 3386, + EndPos: 3389, + }, + }, + Value: []byte("Foo"), + }, + }, + }, + Alias: &ast.Identifier{ + Node: ast.Node{ + Position: &position.Position{ + StartLine: 163, + EndLine: 163, + StartPos: 3393, EndPos: 3396, }, }, - Use: &ast.NameName{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 163, - EndLine: 163, - StartPos: 3386, - EndPos: 3389, - }, - }, - Parts: []ast.Vertex{ - &ast.NameNamePart{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 163, - EndLine: 163, - StartPos: 3386, - EndPos: 3389, - }, - }, - Value: []byte("Foo"), - }, - }, - }, - Alias: &ast.Identifier{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 163, - EndLine: 163, - StartPos: 3393, - EndPos: 3396, - }, - }, - Value: []byte("Bar"), - }, + Value: []byte("Bar"), }, }, }, @@ -9200,17 +9170,17 @@ func TestPhp7(t *testing.T) { EndPos: 3411, }, }, - UseList: &ast.StmtUseList{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 164, - EndLine: 164, - StartPos: 3402, - EndPos: 3410, + UseDeclarations: []ast.Vertex{ + &ast.StmtUseDeclaration{ + Node: ast.Node{ + Position: &position.Position{ + StartLine: 164, + EndLine: 164, + StartPos: 3402, + EndPos: 3405, + }, }, - }, - UseDeclarations: []ast.Vertex{ - &ast.StmtUseDeclaration{ + Use: &ast.NameName{ Node: ast.Node{ Position: &position.Position{ StartLine: 164, @@ -9219,31 +9189,31 @@ func TestPhp7(t *testing.T) { EndPos: 3405, }, }, - Use: &ast.NameName{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 164, - EndLine: 164, - StartPos: 3402, - EndPos: 3405, - }, - }, - Parts: []ast.Vertex{ - &ast.NameNamePart{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 164, - EndLine: 164, - StartPos: 3402, - EndPos: 3405, - }, + Parts: []ast.Vertex{ + &ast.NameNamePart{ + Node: ast.Node{ + Position: &position.Position{ + StartLine: 164, + EndLine: 164, + StartPos: 3402, + EndPos: 3405, }, - Value: []byte("Foo"), }, + Value: []byte("Foo"), }, }, }, - &ast.StmtUseDeclaration{ + }, + &ast.StmtUseDeclaration{ + Node: ast.Node{ + Position: &position.Position{ + StartLine: 164, + EndLine: 164, + StartPos: 3407, + EndPos: 3410, + }, + }, + Use: &ast.NameName{ Node: ast.Node{ Position: &position.Position{ StartLine: 164, @@ -9252,27 +9222,17 @@ func TestPhp7(t *testing.T) { EndPos: 3410, }, }, - Use: &ast.NameName{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 164, - EndLine: 164, - StartPos: 3407, - EndPos: 3410, - }, - }, - Parts: []ast.Vertex{ - &ast.NameNamePart{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 164, - EndLine: 164, - StartPos: 3407, - EndPos: 3410, - }, + Parts: []ast.Vertex{ + &ast.NameNamePart{ + Node: ast.Node{ + Position: &position.Position{ + StartLine: 164, + EndLine: 164, + StartPos: 3407, + EndPos: 3410, }, - Value: []byte("Bar"), }, + Value: []byte("Bar"), }, }, }, @@ -9288,17 +9248,17 @@ func TestPhp7(t *testing.T) { EndPos: 3432, }, }, - UseList: &ast.StmtUseList{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 165, - EndLine: 165, - StartPos: 3416, - EndPos: 3431, + UseDeclarations: []ast.Vertex{ + &ast.StmtUseDeclaration{ + Node: ast.Node{ + Position: &position.Position{ + StartLine: 165, + EndLine: 165, + StartPos: 3416, + EndPos: 3419, + }, }, - }, - UseDeclarations: []ast.Vertex{ - &ast.StmtUseDeclaration{ + Use: &ast.NameName{ Node: ast.Node{ Position: &position.Position{ StartLine: 165, @@ -9307,73 +9267,63 @@ func TestPhp7(t *testing.T) { EndPos: 3419, }, }, - Use: &ast.NameName{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 165, - EndLine: 165, - StartPos: 3416, - EndPos: 3419, - }, - }, - Parts: []ast.Vertex{ - &ast.NameNamePart{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 165, - EndLine: 165, - StartPos: 3416, - EndPos: 3419, - }, + Parts: []ast.Vertex{ + &ast.NameNamePart{ + Node: ast.Node{ + Position: &position.Position{ + StartLine: 165, + EndLine: 165, + StartPos: 3416, + EndPos: 3419, }, - Value: []byte("Foo"), }, + Value: []byte("Foo"), }, }, }, - &ast.StmtUseDeclaration{ + }, + &ast.StmtUseDeclaration{ + Node: ast.Node{ + Position: &position.Position{ + StartLine: 165, + EndLine: 165, + StartPos: 3421, + EndPos: 3431, + }, + }, + Use: &ast.NameName{ Node: ast.Node{ Position: &position.Position{ StartLine: 165, EndLine: 165, StartPos: 3421, + EndPos: 3424, + }, + }, + Parts: []ast.Vertex{ + &ast.NameNamePart{ + Node: ast.Node{ + Position: &position.Position{ + StartLine: 165, + EndLine: 165, + StartPos: 3421, + EndPos: 3424, + }, + }, + Value: []byte("Bar"), + }, + }, + }, + Alias: &ast.Identifier{ + Node: ast.Node{ + Position: &position.Position{ + StartLine: 165, + EndLine: 165, + StartPos: 3428, EndPos: 3431, }, }, - Use: &ast.NameName{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 165, - EndLine: 165, - StartPos: 3421, - EndPos: 3424, - }, - }, - Parts: []ast.Vertex{ - &ast.NameNamePart{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 165, - EndLine: 165, - StartPos: 3421, - EndPos: 3424, - }, - }, - Value: []byte("Bar"), - }, - }, - }, - Alias: &ast.Identifier{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 165, - EndLine: 165, - StartPos: 3428, - EndPos: 3431, - }, - }, - Value: []byte("Baz"), - }, + Value: []byte("Baz"), }, }, }, @@ -9387,46 +9337,38 @@ func TestPhp7(t *testing.T) { EndPos: 3456, }, }, - UseList: &ast.StmtUseType{ + Type: &ast.Identifier{ Node: ast.Node{ Position: &position.Position{ StartLine: 166, EndLine: 166, StartPos: 3437, - EndPos: 3455, + EndPos: 3445, }, }, - Type: &ast.Identifier{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 166, - EndLine: 166, - StartPos: 3437, - EndPos: 3445, - }, - }, - Value: []byte("function"), - }, - Use: &ast.StmtUseList{ + Value: []byte("function"), + }, + UseDeclarations: []ast.Vertex{ + &ast.StmtUseDeclaration{ Node: ast.Node{ Position: &position.Position{ StartLine: 166, EndLine: 166, StartPos: 3446, - EndPos: 3455, + EndPos: 3449, }, }, - UseDeclarations: []ast.Vertex{ - &ast.StmtUseDeclaration{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 166, - EndLine: 166, - StartPos: 3446, - EndPos: 3449, - }, + Use: &ast.NameName{ + Node: ast.Node{ + Position: &position.Position{ + StartLine: 166, + EndLine: 166, + StartPos: 3446, + EndPos: 3449, }, - Use: &ast.NameName{ + }, + Parts: []ast.Vertex{ + &ast.NameNamePart{ Node: ast.Node{ Position: &position.Position{ StartLine: 166, @@ -9435,31 +9377,31 @@ func TestPhp7(t *testing.T) { EndPos: 3449, }, }, - Parts: []ast.Vertex{ - &ast.NameNamePart{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 166, - EndLine: 166, - StartPos: 3446, - EndPos: 3449, - }, - }, - Value: []byte("Foo"), - }, - }, + Value: []byte("Foo"), }, }, - &ast.StmtUseDeclaration{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 166, - EndLine: 166, - StartPos: 3451, - EndPos: 3455, - }, + }, + }, + &ast.StmtUseDeclaration{ + Node: ast.Node{ + Position: &position.Position{ + StartLine: 166, + EndLine: 166, + StartPos: 3451, + EndPos: 3455, + }, + }, + Use: &ast.NameName{ + Node: ast.Node{ + Position: &position.Position{ + StartLine: 166, + EndLine: 166, + StartPos: 3452, + EndPos: 3455, }, - Use: &ast.NameName{ + }, + Parts: []ast.Vertex{ + &ast.NameNamePart{ Node: ast.Node{ Position: &position.Position{ StartLine: 166, @@ -9468,19 +9410,7 @@ func TestPhp7(t *testing.T) { EndPos: 3455, }, }, - Parts: []ast.Vertex{ - &ast.NameNamePart{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 166, - EndLine: 166, - StartPos: 3452, - EndPos: 3455, - }, - }, - Value: []byte("Bar"), - }, - }, + Value: []byte("Bar"), }, }, }, @@ -9496,46 +9426,38 @@ func TestPhp7(t *testing.T) { EndPos: 3494, }, }, - UseList: &ast.StmtUseType{ + Type: &ast.Identifier{ Node: ast.Node{ Position: &position.Position{ StartLine: 167, EndLine: 167, StartPos: 3461, - EndPos: 3493, + EndPos: 3469, }, }, - Type: &ast.Identifier{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 167, - EndLine: 167, - StartPos: 3461, - EndPos: 3469, - }, - }, - Value: []byte("function"), - }, - Use: &ast.StmtUseList{ + Value: []byte("function"), + }, + UseDeclarations: []ast.Vertex{ + &ast.StmtUseDeclaration{ Node: ast.Node{ Position: &position.Position{ StartLine: 167, EndLine: 167, StartPos: 3470, - EndPos: 3493, + EndPos: 3480, }, }, - UseDeclarations: []ast.Vertex{ - &ast.StmtUseDeclaration{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 167, - EndLine: 167, - StartPos: 3470, - EndPos: 3480, - }, + Use: &ast.NameName{ + Node: ast.Node{ + Position: &position.Position{ + StartLine: 167, + EndLine: 167, + StartPos: 3470, + EndPos: 3473, }, - Use: &ast.NameName{ + }, + Parts: []ast.Vertex{ + &ast.NameNamePart{ Node: ast.Node{ Position: &position.Position{ StartLine: 167, @@ -9544,42 +9466,42 @@ func TestPhp7(t *testing.T) { EndPos: 3473, }, }, - Parts: []ast.Vertex{ - &ast.NameNamePart{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 167, - EndLine: 167, - StartPos: 3470, - EndPos: 3473, - }, - }, - Value: []byte("Foo"), - }, - }, - }, - Alias: &ast.Identifier{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 167, - EndLine: 167, - StartPos: 3477, - EndPos: 3480, - }, - }, - Value: []byte("foo"), + Value: []byte("Foo"), }, }, - &ast.StmtUseDeclaration{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 167, - EndLine: 167, - StartPos: 3482, - EndPos: 3493, - }, + }, + Alias: &ast.Identifier{ + Node: ast.Node{ + Position: &position.Position{ + StartLine: 167, + EndLine: 167, + StartPos: 3477, + EndPos: 3480, }, - Use: &ast.NameName{ + }, + Value: []byte("foo"), + }, + }, + &ast.StmtUseDeclaration{ + Node: ast.Node{ + Position: &position.Position{ + StartLine: 167, + EndLine: 167, + StartPos: 3482, + EndPos: 3493, + }, + }, + Use: &ast.NameName{ + Node: ast.Node{ + Position: &position.Position{ + StartLine: 167, + EndLine: 167, + StartPos: 3483, + EndPos: 3486, + }, + }, + Parts: []ast.Vertex{ + &ast.NameNamePart{ Node: ast.Node{ Position: &position.Position{ StartLine: 167, @@ -9588,33 +9510,21 @@ func TestPhp7(t *testing.T) { EndPos: 3486, }, }, - Parts: []ast.Vertex{ - &ast.NameNamePart{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 167, - EndLine: 167, - StartPos: 3483, - EndPos: 3486, - }, - }, - Value: []byte("Bar"), - }, - }, - }, - Alias: &ast.Identifier{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 167, - EndLine: 167, - StartPos: 3490, - EndPos: 3493, - }, - }, - Value: []byte("bar"), + Value: []byte("Bar"), }, }, }, + Alias: &ast.Identifier{ + Node: ast.Node{ + Position: &position.Position{ + StartLine: 167, + EndLine: 167, + StartPos: 3490, + EndPos: 3493, + }, + }, + Value: []byte("bar"), + }, }, }, }, @@ -9627,46 +9537,38 @@ func TestPhp7(t *testing.T) { EndPos: 3515, }, }, - UseList: &ast.StmtUseType{ + Type: &ast.Identifier{ Node: ast.Node{ Position: &position.Position{ StartLine: 168, EndLine: 168, StartPos: 3499, - EndPos: 3514, + EndPos: 3504, }, }, - Type: &ast.Identifier{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 168, - EndLine: 168, - StartPos: 3499, - EndPos: 3504, - }, - }, - Value: []byte("const"), - }, - Use: &ast.StmtUseList{ + Value: []byte("const"), + }, + UseDeclarations: []ast.Vertex{ + &ast.StmtUseDeclaration{ Node: ast.Node{ Position: &position.Position{ StartLine: 168, EndLine: 168, StartPos: 3505, - EndPos: 3514, + EndPos: 3508, }, }, - UseDeclarations: []ast.Vertex{ - &ast.StmtUseDeclaration{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 168, - EndLine: 168, - StartPos: 3505, - EndPos: 3508, - }, + Use: &ast.NameName{ + Node: ast.Node{ + Position: &position.Position{ + StartLine: 168, + EndLine: 168, + StartPos: 3505, + EndPos: 3508, }, - Use: &ast.NameName{ + }, + Parts: []ast.Vertex{ + &ast.NameNamePart{ Node: ast.Node{ Position: &position.Position{ StartLine: 168, @@ -9675,31 +9577,31 @@ func TestPhp7(t *testing.T) { EndPos: 3508, }, }, - Parts: []ast.Vertex{ - &ast.NameNamePart{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 168, - EndLine: 168, - StartPos: 3505, - EndPos: 3508, - }, - }, - Value: []byte("Foo"), - }, - }, + Value: []byte("Foo"), }, }, - &ast.StmtUseDeclaration{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 168, - EndLine: 168, - StartPos: 3510, - EndPos: 3514, - }, + }, + }, + &ast.StmtUseDeclaration{ + Node: ast.Node{ + Position: &position.Position{ + StartLine: 168, + EndLine: 168, + StartPos: 3510, + EndPos: 3514, + }, + }, + Use: &ast.NameName{ + Node: ast.Node{ + Position: &position.Position{ + StartLine: 168, + EndLine: 168, + StartPos: 3511, + EndPos: 3514, }, - Use: &ast.NameName{ + }, + Parts: []ast.Vertex{ + &ast.NameNamePart{ Node: ast.Node{ Position: &position.Position{ StartLine: 168, @@ -9708,19 +9610,7 @@ func TestPhp7(t *testing.T) { EndPos: 3514, }, }, - Parts: []ast.Vertex{ - &ast.NameNamePart{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 168, - EndLine: 168, - StartPos: 3511, - EndPos: 3514, - }, - }, - Value: []byte("Bar"), - }, - }, + Value: []byte("Bar"), }, }, }, @@ -9736,46 +9626,38 @@ func TestPhp7(t *testing.T) { EndPos: 3550, }, }, - UseList: &ast.StmtUseType{ + Type: &ast.Identifier{ Node: ast.Node{ Position: &position.Position{ StartLine: 169, EndLine: 169, StartPos: 3520, - EndPos: 3549, + EndPos: 3525, }, }, - Type: &ast.Identifier{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 169, - EndLine: 169, - StartPos: 3520, - EndPos: 3525, - }, - }, - Value: []byte("const"), - }, - Use: &ast.StmtUseList{ + Value: []byte("const"), + }, + UseDeclarations: []ast.Vertex{ + &ast.StmtUseDeclaration{ Node: ast.Node{ Position: &position.Position{ StartLine: 169, EndLine: 169, StartPos: 3526, - EndPos: 3549, + EndPos: 3536, }, }, - UseDeclarations: []ast.Vertex{ - &ast.StmtUseDeclaration{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 169, - EndLine: 169, - StartPos: 3526, - EndPos: 3536, - }, + Use: &ast.NameName{ + Node: ast.Node{ + Position: &position.Position{ + StartLine: 169, + EndLine: 169, + StartPos: 3526, + EndPos: 3529, }, - Use: &ast.NameName{ + }, + Parts: []ast.Vertex{ + &ast.NameNamePart{ Node: ast.Node{ Position: &position.Position{ StartLine: 169, @@ -9784,42 +9666,42 @@ func TestPhp7(t *testing.T) { EndPos: 3529, }, }, - Parts: []ast.Vertex{ - &ast.NameNamePart{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 169, - EndLine: 169, - StartPos: 3526, - EndPos: 3529, - }, - }, - Value: []byte("Foo"), - }, - }, - }, - Alias: &ast.Identifier{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 169, - EndLine: 169, - StartPos: 3533, - EndPos: 3536, - }, - }, - Value: []byte("foo"), + Value: []byte("Foo"), }, }, - &ast.StmtUseDeclaration{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 169, - EndLine: 169, - StartPos: 3538, - EndPos: 3549, - }, + }, + Alias: &ast.Identifier{ + Node: ast.Node{ + Position: &position.Position{ + StartLine: 169, + EndLine: 169, + StartPos: 3533, + EndPos: 3536, }, - Use: &ast.NameName{ + }, + Value: []byte("foo"), + }, + }, + &ast.StmtUseDeclaration{ + Node: ast.Node{ + Position: &position.Position{ + StartLine: 169, + EndLine: 169, + StartPos: 3538, + EndPos: 3549, + }, + }, + Use: &ast.NameName{ + Node: ast.Node{ + Position: &position.Position{ + StartLine: 169, + EndLine: 169, + StartPos: 3539, + EndPos: 3542, + }, + }, + Parts: []ast.Vertex{ + &ast.NameNamePart{ Node: ast.Node{ Position: &position.Position{ StartLine: 169, @@ -9828,37 +9710,25 @@ func TestPhp7(t *testing.T) { EndPos: 3542, }, }, - Parts: []ast.Vertex{ - &ast.NameNamePart{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 169, - EndLine: 169, - StartPos: 3539, - EndPos: 3542, - }, - }, - Value: []byte("Bar"), - }, - }, - }, - Alias: &ast.Identifier{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 169, - EndLine: 169, - StartPos: 3546, - EndPos: 3549, - }, - }, - Value: []byte("bar"), + Value: []byte("Bar"), }, }, }, + Alias: &ast.Identifier{ + Node: ast.Node{ + Position: &position.Position{ + StartLine: 169, + EndLine: 169, + StartPos: 3546, + EndPos: 3549, + }, + }, + Value: []byte("bar"), + }, }, }, }, - &ast.StmtUse{ + &ast.StmtGroupUse{ Node: ast.Node{ Position: &position.Position{ StartLine: 171, @@ -9867,58 +9737,50 @@ func TestPhp7(t *testing.T) { EndPos: 3572, }, }, - UseList: &ast.StmtGroupUseList{ + Prefix: &ast.NameName{ Node: ast.Node{ Position: &position.Position{ StartLine: 171, EndLine: 171, - StartPos: 3556, - EndPos: 3571, + StartPos: 3557, + EndPos: 3560, }, }, - Prefix: &ast.NameName{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 171, - EndLine: 171, - StartPos: 3557, - EndPos: 3560, - }, - }, - Parts: []ast.Vertex{ - &ast.NameNamePart{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 171, - EndLine: 171, - StartPos: 3557, - EndPos: 3560, - }, + Parts: []ast.Vertex{ + &ast.NameNamePart{ + Node: ast.Node{ + Position: &position.Position{ + StartLine: 171, + EndLine: 171, + StartPos: 3557, + EndPos: 3560, }, - Value: []byte("Foo"), }, + Value: []byte("Foo"), }, }, - UseList: &ast.StmtUseList{ + }, + UseDeclarations: []ast.Vertex{ + &ast.StmtUseDeclaration{ Node: ast.Node{ Position: &position.Position{ StartLine: 171, EndLine: 171, StartPos: 3562, - EndPos: 3570, + EndPos: 3565, }, }, - UseDeclarations: []ast.Vertex{ - &ast.StmtUseDeclaration{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 171, - EndLine: 171, - StartPos: 3562, - EndPos: 3565, - }, + Use: &ast.NameName{ + Node: ast.Node{ + Position: &position.Position{ + StartLine: 171, + EndLine: 171, + StartPos: 3562, + EndPos: 3565, }, - Use: &ast.NameName{ + }, + Parts: []ast.Vertex{ + &ast.NameNamePart{ Node: ast.Node{ Position: &position.Position{ StartLine: 171, @@ -9927,31 +9789,31 @@ func TestPhp7(t *testing.T) { EndPos: 3565, }, }, - Parts: []ast.Vertex{ - &ast.NameNamePart{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 171, - EndLine: 171, - StartPos: 3562, - EndPos: 3565, - }, - }, - Value: []byte("Bar"), - }, - }, + Value: []byte("Bar"), }, }, - &ast.StmtUseDeclaration{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 171, - EndLine: 171, - StartPos: 3567, - EndPos: 3570, - }, + }, + }, + &ast.StmtUseDeclaration{ + Node: ast.Node{ + Position: &position.Position{ + StartLine: 171, + EndLine: 171, + StartPos: 3567, + EndPos: 3570, + }, + }, + Use: &ast.NameName{ + Node: ast.Node{ + Position: &position.Position{ + StartLine: 171, + EndLine: 171, + StartPos: 3567, + EndPos: 3570, }, - Use: &ast.NameName{ + }, + Parts: []ast.Vertex{ + &ast.NameNamePart{ Node: ast.Node{ Position: &position.Position{ StartLine: 171, @@ -9960,26 +9822,14 @@ func TestPhp7(t *testing.T) { EndPos: 3570, }, }, - Parts: []ast.Vertex{ - &ast.NameNamePart{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 171, - EndLine: 171, - StartPos: 3567, - EndPos: 3570, - }, - }, - Value: []byte("Baz"), - }, - }, + Value: []byte("Baz"), }, }, }, }, }, }, - &ast.StmtUse{ + &ast.StmtGroupUse{ Node: ast.Node{ Position: &position.Position{ StartLine: 172, @@ -9988,58 +9838,50 @@ func TestPhp7(t *testing.T) { EndPos: 3600, }, }, - UseList: &ast.StmtGroupUseList{ + Prefix: &ast.NameName{ Node: ast.Node{ Position: &position.Position{ StartLine: 172, EndLine: 172, StartPos: 3577, - EndPos: 3599, + EndPos: 3580, }, }, - Prefix: &ast.NameName{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 172, - EndLine: 172, - StartPos: 3577, - EndPos: 3580, - }, - }, - Parts: []ast.Vertex{ - &ast.NameNamePart{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 172, - EndLine: 172, - StartPos: 3577, - EndPos: 3580, - }, + Parts: []ast.Vertex{ + &ast.NameNamePart{ + Node: ast.Node{ + Position: &position.Position{ + StartLine: 172, + EndLine: 172, + StartPos: 3577, + EndPos: 3580, }, - Value: []byte("Foo"), }, + Value: []byte("Foo"), }, }, - UseList: &ast.StmtUseList{ + }, + UseDeclarations: []ast.Vertex{ + &ast.StmtUseDeclaration{ Node: ast.Node{ Position: &position.Position{ StartLine: 172, EndLine: 172, StartPos: 3582, - EndPos: 3598, + EndPos: 3585, }, }, - UseDeclarations: []ast.Vertex{ - &ast.StmtUseDeclaration{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 172, - EndLine: 172, - StartPos: 3582, - EndPos: 3585, - }, + Use: &ast.NameName{ + Node: ast.Node{ + Position: &position.Position{ + StartLine: 172, + EndLine: 172, + StartPos: 3582, + EndPos: 3585, }, - Use: &ast.NameName{ + }, + Parts: []ast.Vertex{ + &ast.NameNamePart{ Node: ast.Node{ Position: &position.Position{ StartLine: 172, @@ -10048,31 +9890,31 @@ func TestPhp7(t *testing.T) { EndPos: 3585, }, }, - Parts: []ast.Vertex{ - &ast.NameNamePart{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 172, - EndLine: 172, - StartPos: 3582, - EndPos: 3585, - }, - }, - Value: []byte("Bar"), - }, - }, + Value: []byte("Bar"), }, }, - &ast.StmtUseDeclaration{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 172, - EndLine: 172, - StartPos: 3587, - EndPos: 3598, - }, + }, + }, + &ast.StmtUseDeclaration{ + Node: ast.Node{ + Position: &position.Position{ + StartLine: 172, + EndLine: 172, + StartPos: 3587, + EndPos: 3598, + }, + }, + Use: &ast.NameName{ + Node: ast.Node{ + Position: &position.Position{ + StartLine: 172, + EndLine: 172, + StartPos: 3587, + EndPos: 3590, }, - Use: &ast.NameName{ + }, + Parts: []ast.Vertex{ + &ast.NameNamePart{ Node: ast.Node{ Position: &position.Position{ StartLine: 172, @@ -10081,37 +9923,25 @@ func TestPhp7(t *testing.T) { EndPos: 3590, }, }, - Parts: []ast.Vertex{ - &ast.NameNamePart{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 172, - EndLine: 172, - StartPos: 3587, - EndPos: 3590, - }, - }, - Value: []byte("Baz"), - }, - }, - }, - Alias: &ast.Identifier{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 172, - EndLine: 172, - StartPos: 3594, - EndPos: 3598, - }, - }, - Value: []byte("quux"), + Value: []byte("Baz"), }, }, }, + Alias: &ast.Identifier{ + Node: ast.Node{ + Position: &position.Position{ + StartLine: 172, + EndLine: 172, + StartPos: 3594, + EndPos: 3598, + }, + }, + Value: []byte("quux"), + }, }, }, }, - &ast.StmtUse{ + &ast.StmtGroupUse{ Node: ast.Node{ Position: &position.Position{ StartLine: 173, @@ -10120,36 +9950,28 @@ func TestPhp7(t *testing.T) { EndPos: 3629, }, }, - UseList: &ast.StmtUseType{ + Type: &ast.Identifier{ Node: ast.Node{ Position: &position.Position{ StartLine: 173, EndLine: 173, StartPos: 3605, - EndPos: 3628, + EndPos: 3613, }, }, - Type: &ast.Identifier{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 173, - EndLine: 173, - StartPos: 3605, - EndPos: 3613, - }, + Value: []byte("function"), + }, + Prefix: &ast.NameName{ + Node: ast.Node{ + Position: &position.Position{ + StartLine: 173, + EndLine: 173, + StartPos: 3614, + EndPos: 3617, }, - Value: []byte("function"), }, - Use: &ast.StmtGroupUseList{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 173, - EndLine: 173, - StartPos: 3614, - EndPos: 3628, - }, - }, - Prefix: &ast.NameName{ + Parts: []ast.Vertex{ + &ast.NameNamePart{ Node: ast.Node{ Position: &position.Position{ StartLine: 173, @@ -10158,31 +9980,31 @@ func TestPhp7(t *testing.T) { EndPos: 3617, }, }, - Parts: []ast.Vertex{ - &ast.NameNamePart{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 173, - EndLine: 173, - StartPos: 3614, - EndPos: 3617, - }, - }, - Value: []byte("Foo"), - }, + Value: []byte("Foo"), + }, + }, + }, + UseDeclarations: []ast.Vertex{ + &ast.StmtUseDeclaration{ + Node: ast.Node{ + Position: &position.Position{ + StartLine: 173, + EndLine: 173, + StartPos: 3619, + EndPos: 3622, }, }, - UseList: &ast.StmtUseList{ + Use: &ast.NameName{ Node: ast.Node{ Position: &position.Position{ StartLine: 173, EndLine: 173, StartPos: 3619, - EndPos: 3627, + EndPos: 3622, }, }, - UseDeclarations: []ast.Vertex{ - &ast.StmtUseDeclaration{ + Parts: []ast.Vertex{ + &ast.NameNamePart{ Node: ast.Node{ Position: &position.Position{ StartLine: 173, @@ -10191,31 +10013,31 @@ func TestPhp7(t *testing.T) { EndPos: 3622, }, }, - Use: &ast.NameName{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 173, - EndLine: 173, - StartPos: 3619, - EndPos: 3622, - }, - }, - Parts: []ast.Vertex{ - &ast.NameNamePart{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 173, - EndLine: 173, - StartPos: 3619, - EndPos: 3622, - }, - }, - Value: []byte("Bar"), - }, - }, - }, + Value: []byte("Bar"), }, - &ast.StmtUseDeclaration{ + }, + }, + }, + &ast.StmtUseDeclaration{ + Node: ast.Node{ + Position: &position.Position{ + StartLine: 173, + EndLine: 173, + StartPos: 3624, + EndPos: 3627, + }, + }, + Use: &ast.NameName{ + Node: ast.Node{ + Position: &position.Position{ + StartLine: 173, + EndLine: 173, + StartPos: 3624, + EndPos: 3627, + }, + }, + Parts: []ast.Vertex{ + &ast.NameNamePart{ Node: ast.Node{ Position: &position.Position{ StartLine: 173, @@ -10224,36 +10046,14 @@ func TestPhp7(t *testing.T) { EndPos: 3627, }, }, - Use: &ast.NameName{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 173, - EndLine: 173, - StartPos: 3624, - EndPos: 3627, - }, - }, - Parts: []ast.Vertex{ - &ast.NameNamePart{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 173, - EndLine: 173, - StartPos: 3624, - EndPos: 3627, - }, - }, - Value: []byte("Baz"), - }, - }, - }, + Value: []byte("Baz"), }, }, }, }, }, }, - &ast.StmtUse{ + &ast.StmtGroupUse{ Node: ast.Node{ Position: &position.Position{ StartLine: 174, @@ -10262,36 +10062,28 @@ func TestPhp7(t *testing.T) { EndPos: 3656, }, }, - UseList: &ast.StmtUseType{ + Type: &ast.Identifier{ Node: ast.Node{ Position: &position.Position{ StartLine: 174, EndLine: 174, StartPos: 3634, - EndPos: 3655, + EndPos: 3639, }, }, - Type: &ast.Identifier{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 174, - EndLine: 174, - StartPos: 3634, - EndPos: 3639, - }, + Value: []byte("const"), + }, + Prefix: &ast.NameName{ + Node: ast.Node{ + Position: &position.Position{ + StartLine: 174, + EndLine: 174, + StartPos: 3641, + EndPos: 3644, }, - Value: []byte("const"), }, - Use: &ast.StmtGroupUseList{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 174, - EndLine: 174, - StartPos: 3640, - EndPos: 3655, - }, - }, - Prefix: &ast.NameName{ + Parts: []ast.Vertex{ + &ast.NameNamePart{ Node: ast.Node{ Position: &position.Position{ StartLine: 174, @@ -10300,31 +10092,31 @@ func TestPhp7(t *testing.T) { EndPos: 3644, }, }, - Parts: []ast.Vertex{ - &ast.NameNamePart{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 174, - EndLine: 174, - StartPos: 3641, - EndPos: 3644, - }, - }, - Value: []byte("Foo"), - }, + Value: []byte("Foo"), + }, + }, + }, + UseDeclarations: []ast.Vertex{ + &ast.StmtUseDeclaration{ + Node: ast.Node{ + Position: &position.Position{ + StartLine: 174, + EndLine: 174, + StartPos: 3646, + EndPos: 3649, }, }, - UseList: &ast.StmtUseList{ + Use: &ast.NameName{ Node: ast.Node{ Position: &position.Position{ StartLine: 174, EndLine: 174, StartPos: 3646, - EndPos: 3654, + EndPos: 3649, }, }, - UseDeclarations: []ast.Vertex{ - &ast.StmtUseDeclaration{ + Parts: []ast.Vertex{ + &ast.NameNamePart{ Node: ast.Node{ Position: &position.Position{ StartLine: 174, @@ -10333,31 +10125,31 @@ func TestPhp7(t *testing.T) { EndPos: 3649, }, }, - Use: &ast.NameName{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 174, - EndLine: 174, - StartPos: 3646, - EndPos: 3649, - }, - }, - Parts: []ast.Vertex{ - &ast.NameNamePart{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 174, - EndLine: 174, - StartPos: 3646, - EndPos: 3649, - }, - }, - Value: []byte("Bar"), - }, - }, - }, + Value: []byte("Bar"), }, - &ast.StmtUseDeclaration{ + }, + }, + }, + &ast.StmtUseDeclaration{ + Node: ast.Node{ + Position: &position.Position{ + StartLine: 174, + EndLine: 174, + StartPos: 3651, + EndPos: 3654, + }, + }, + Use: &ast.NameName{ + Node: ast.Node{ + Position: &position.Position{ + StartLine: 174, + EndLine: 174, + StartPos: 3651, + EndPos: 3654, + }, + }, + Parts: []ast.Vertex{ + &ast.NameNamePart{ Node: ast.Node{ Position: &position.Position{ StartLine: 174, @@ -10366,36 +10158,14 @@ func TestPhp7(t *testing.T) { EndPos: 3654, }, }, - Use: &ast.NameName{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 174, - EndLine: 174, - StartPos: 3651, - EndPos: 3654, - }, - }, - Parts: []ast.Vertex{ - &ast.NameNamePart{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 174, - EndLine: 174, - StartPos: 3651, - EndPos: 3654, - }, - }, - Value: []byte("Baz"), - }, - }, - }, + Value: []byte("Baz"), }, }, }, }, }, }, - &ast.StmtUse{ + &ast.StmtGroupUse{ Node: ast.Node{ Position: &position.Position{ StartLine: 175, @@ -10404,69 +10174,61 @@ func TestPhp7(t *testing.T) { EndPos: 3691, }, }, - UseList: &ast.StmtGroupUseList{ + Prefix: &ast.NameName{ Node: ast.Node{ Position: &position.Position{ StartLine: 175, EndLine: 175, StartPos: 3661, - EndPos: 3690, + EndPos: 3664, }, }, - Prefix: &ast.NameName{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 175, - EndLine: 175, - StartPos: 3661, - EndPos: 3664, - }, - }, - Parts: []ast.Vertex{ - &ast.NameNamePart{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 175, - EndLine: 175, - StartPos: 3661, - EndPos: 3664, - }, + Parts: []ast.Vertex{ + &ast.NameNamePart{ + Node: ast.Node{ + Position: &position.Position{ + StartLine: 175, + EndLine: 175, + StartPos: 3661, + EndPos: 3664, }, - Value: []byte("Foo"), }, + Value: []byte("Foo"), }, }, - UseList: &ast.StmtUseList{ + }, + UseDeclarations: []ast.Vertex{ + &ast.StmtUseDeclaration{ Node: ast.Node{ Position: &position.Position{ StartLine: 175, EndLine: 175, StartPos: 3666, - EndPos: 3689, + EndPos: 3675, }, }, - UseDeclarations: []ast.Vertex{ - &ast.StmtUseType{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 175, - EndLine: 175, - StartPos: 3666, - EndPos: 3675, - }, + Type: &ast.Identifier{ + Node: ast.Node{ + Position: &position.Position{ + StartLine: 175, + EndLine: 175, + StartPos: 3666, + EndPos: 3671, }, - Type: &ast.Identifier{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 175, - EndLine: 175, - StartPos: 3666, - EndPos: 3671, - }, - }, - Value: []byte("const"), + }, + Value: []byte("const"), + }, + Use: &ast.NameName{ + Node: ast.Node{ + Position: &position.Position{ + StartLine: 175, + EndLine: 175, + StartPos: 3672, + EndPos: 3675, }, - Use: &ast.StmtUseDeclaration{ + }, + Parts: []ast.Vertex{ + &ast.NameNamePart{ Node: ast.Node{ Position: &position.Position{ StartLine: 175, @@ -10475,52 +10237,42 @@ func TestPhp7(t *testing.T) { EndPos: 3675, }, }, - Use: &ast.NameName{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 175, - EndLine: 175, - StartPos: 3672, - EndPos: 3675, - }, - }, - Parts: []ast.Vertex{ - &ast.NameNamePart{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 175, - EndLine: 175, - StartPos: 3672, - EndPos: 3675, - }, - }, - Value: []byte("Bar"), - }, - }, - }, + Value: []byte("Bar"), }, }, - &ast.StmtUseType{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 175, - EndLine: 175, - StartPos: 3677, - EndPos: 3689, - }, + }, + }, + &ast.StmtUseDeclaration{ + Node: ast.Node{ + Position: &position.Position{ + StartLine: 175, + EndLine: 175, + StartPos: 3677, + EndPos: 3689, + }, + }, + Type: &ast.Identifier{ + Node: ast.Node{ + Position: &position.Position{ + StartLine: 175, + EndLine: 175, + StartPos: 3677, + EndPos: 3685, }, - Type: &ast.Identifier{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 175, - EndLine: 175, - StartPos: 3677, - EndPos: 3685, - }, - }, - Value: []byte("function"), + }, + Value: []byte("function"), + }, + Use: &ast.NameName{ + Node: ast.Node{ + Position: &position.Position{ + StartLine: 175, + EndLine: 175, + StartPos: 3686, + EndPos: 3689, }, - Use: &ast.StmtUseDeclaration{ + }, + Parts: []ast.Vertex{ + &ast.NameNamePart{ Node: ast.Node{ Position: &position.Position{ StartLine: 175, @@ -10529,29 +10281,7 @@ func TestPhp7(t *testing.T) { EndPos: 3689, }, }, - Use: &ast.NameName{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 175, - EndLine: 175, - StartPos: 3686, - EndPos: 3689, - }, - }, - Parts: []ast.Vertex{ - &ast.NameNamePart{ - Node: ast.Node{ - Position: &position.Position{ - StartLine: 175, - EndLine: 175, - StartPos: 3686, - EndPos: 3689, - }, - }, - Value: []byte("Baz"), - }, - }, - }, + Value: []byte("Baz"), }, }, }, diff --git a/pkg/ast/ast.go b/pkg/ast/ast.go index 4259f92..2da9b8e 100644 --- a/pkg/ast/ast.go +++ b/pkg/ast/ast.go @@ -84,10 +84,8 @@ type NodeVisitor interface { StmtTry(n *StmtTry) StmtUnset(n *StmtUnset) StmtUse(n *StmtUse) - StmtGroupUseList(n *StmtGroupUseList) - StmtUseList(n *StmtUseList) + StmtGroupUse(n *StmtGroupUse) StmtUseDeclaration(n *StmtUseDeclaration) - StmtUseType(n *StmtUseType) StmtWhile(n *StmtWhile) ExprArray(n *ExprArray) diff --git a/pkg/ast/node.go b/pkg/ast/node.go index 85b494a..d7dd01d 100644 --- a/pkg/ast/node.go +++ b/pkg/ast/node.go @@ -796,56 +796,49 @@ func (n *StmtUnset) Accept(v NodeVisitor) { // StmtUse node type StmtUse struct { Node - UseList Vertex + UseTkn *token.Token + Type Vertex + UseDeclarations []Vertex + SemiColonTkn *token.Token } func (n *StmtUse) Accept(v NodeVisitor) { v.StmtUse(n) } -// StmtGroupUseList node -type StmtGroupUseList struct { +// StmtGroupUse node +type StmtGroupUse struct { Node - Prefix Vertex - UseList Vertex + UseTkn *token.Token + Type Vertex + LeadingNsSeparatorTkn *token.Token + Prefix Vertex + NsSeparatorTkn *token.Token + OpenCurlyBracketTkn *token.Token + UseDeclarations []Vertex + CloseCurlyBracketTkn *token.Token + SemiColonTkn *token.Token } -func (n *StmtGroupUseList) Accept(v NodeVisitor) { - v.StmtGroupUseList(n) -} - -// StmtUseList node -type StmtUseList struct { - Node - UseDeclarations []Vertex -} - -func (n *StmtUseList) Accept(v NodeVisitor) { - v.StmtUseList(n) +func (n *StmtGroupUse) Accept(v NodeVisitor) { + v.StmtGroupUse(n) } // StmtUseDeclaration node type StmtUseDeclaration struct { Node - Use Vertex - Alias Vertex + Type Vertex + NsSeparatorTkn *token.Token + Use Vertex + AsTkn *token.Token + Alias Vertex + CommaTkn *token.Token } func (n *StmtUseDeclaration) Accept(v NodeVisitor) { v.StmtUseDeclaration(n) } -// StmtUseType node -type StmtUseType struct { - Node - Type Vertex - Use Vertex -} - -func (n *StmtUseType) Accept(v NodeVisitor) { - v.StmtUseType(n) -} - // StmtWhile node type StmtWhile struct { Node diff --git a/pkg/ast/traverser/dfs.go b/pkg/ast/traverser/dfs.go index 03ebbad..20eecf3 100644 --- a/pkg/ast/traverser/dfs.go +++ b/pkg/ast/traverser/dfs.go @@ -1150,35 +1150,35 @@ func (t *DFS) Traverse(n ast.Vertex) { if !t.visitor.EnterNode(nn) { return } - if nn.UseList != nil { - t.visitor.Enter("UseList", true) - t.Traverse(nn.UseList) - t.visitor.Leave("UseList", true) + if nn.Type != nil { + t.visitor.Enter("Type", true) + t.Traverse(nn.Type) + t.visitor.Leave("Type", true) } - case *ast.StmtGroupUseList: + if nn.UseDeclarations != nil { + t.visitor.Enter("UseDeclarations", false) + for _, c := range nn.UseDeclarations { + t.Traverse(c) + } + t.visitor.Leave("UseDeclarations", false) + } + case *ast.StmtGroupUse: if nn == nil { return } if !t.visitor.EnterNode(nn) { return } + if nn.Type != nil { + t.visitor.Enter("Type", true) + t.Traverse(nn.Type) + t.visitor.Leave("Type", true) + } if nn.Prefix != nil { t.visitor.Enter("Prefix", true) t.Traverse(nn.Prefix) t.visitor.Leave("Prefix", true) } - if nn.UseList != nil { - t.visitor.Enter("UseList", true) - t.Traverse(nn.UseList) - t.visitor.Leave("UseList", true) - } - case *ast.StmtUseList: - if nn == nil { - return - } - if !t.visitor.EnterNode(nn) { - return - } if nn.UseDeclarations != nil { t.visitor.Enter("UseDeclarations", false) for _, c := range nn.UseDeclarations { @@ -1187,23 +1187,6 @@ func (t *DFS) Traverse(n ast.Vertex) { t.visitor.Leave("UseDeclarations", false) } case *ast.StmtUseDeclaration: - if nn == nil { - return - } - if !t.visitor.EnterNode(nn) { - return - } - if nn.Use != nil { - t.visitor.Enter("Use", true) - t.Traverse(nn.Use) - t.visitor.Leave("Use", true) - } - if nn.Alias != nil { - t.visitor.Enter("Alias", true) - t.Traverse(nn.Alias) - t.visitor.Leave("Alias", true) - } - case *ast.StmtUseType: if nn == nil { return } @@ -1220,6 +1203,11 @@ func (t *DFS) Traverse(n ast.Vertex) { t.Traverse(nn.Use) t.visitor.Leave("Use", true) } + if nn.Alias != nil { + t.visitor.Enter("Alias", true) + t.Traverse(nn.Alias) + t.visitor.Leave("Alias", true) + } case *ast.StmtWhile: if nn == nil { return diff --git a/pkg/ast/visitor/dump.go b/pkg/ast/visitor/dump.go index 67bbaac..61deec6 100644 --- a/pkg/ast/visitor/dump.go +++ b/pkg/ast/visitor/dump.go @@ -169,6 +169,28 @@ func (v *Dump) printNode(n *ast.Node) { v.print("},\n") } +func (v *Dump) printToken(key string, t *token.Token) { + if t == nil { + return + } + + v.printIndent(v.indent) + v.print(key) + v.print(": &token.Token{\n") + + v.printIndent(v.indent + 1) + v.print("ID: token." + t.ID.String() + ",\n") + + v.printIndent(v.indent + 1) + v.print("Value: []byte(" + strconv.Quote(string(t.Value)) + "),\n") + + v.printIndent(v.indent + 1) + v.print("Skipped: []byte(" + strconv.Quote(string(t.Skipped)) + "),\n") + + v.printIndent(v.indent) + v.print("},\n") +} + func (v *Dump) Root(n *ast.Root) { v.printIndentIfNotSingle(v.indent - 1) v.print("&ast.Root{\n") @@ -588,30 +610,30 @@ func (v *Dump) StmtUse(n *ast.StmtUse) { v.printIndentIfNotSingle(v.indent - 1) v.print("&ast.StmtUse{\n") v.printNode(n.GetNode()) + v.printToken("UseTkn", n.UseTkn) + v.printToken("SemiColonTkn", n.SemiColonTkn) + } -func (v *Dump) StmtGroupUseList(n *ast.StmtGroupUseList) { +func (v *Dump) StmtGroupUse(n *ast.StmtGroupUse) { v.printIndentIfNotSingle(v.indent - 1) - v.print("&ast.StmtGroupUseList{\n") - v.printNode(n.GetNode()) -} - -func (v *Dump) StmtUseList(n *ast.StmtUseList) { - v.printIndentIfNotSingle(v.indent - 1) - v.print("&ast.StmtUseList{\n") + v.print("&ast.StmtGroupUse{\n") v.printNode(n.GetNode()) + v.printToken("UseTkn", n.UseTkn) + v.printToken("LeadingNsSeparatorTkn", n.LeadingNsSeparatorTkn) + v.printToken("NsSeparatorTkn", n.NsSeparatorTkn) + v.printToken("OpenCurlyBracketTkn", n.OpenCurlyBracketTkn) + v.printToken("CloseCurlyBracketTkn", n.CloseCurlyBracketTkn) + v.printToken("SemiColonTkn", n.SemiColonTkn) } func (v *Dump) StmtUseDeclaration(n *ast.StmtUseDeclaration) { v.printIndentIfNotSingle(v.indent - 1) v.print("&ast.StmtUseDeclaration{\n") v.printNode(n.GetNode()) -} - -func (v *Dump) StmtUseType(n *ast.StmtUseType) { - v.printIndentIfNotSingle(v.indent - 1) - v.print("&ast.StmtUseType{\n") - v.printNode(n.GetNode()) + v.printToken("NsSeparatorTkn", n.NsSeparatorTkn) + v.printToken("AsTkn", n.AsTkn) + v.printToken("CommaTkn", n.CommaTkn) } func (v *Dump) StmtWhile(n *ast.StmtWhile) { diff --git a/pkg/ast/visitor/filter_parser_nodes.go b/pkg/ast/visitor/filter_parser_nodes.go index f1a5655..4df410a 100644 --- a/pkg/ast/visitor/filter_parser_nodes.go +++ b/pkg/ast/visitor/filter_parser_nodes.go @@ -13,34 +13,6 @@ func (v *FilterParserNodes) EnterNode(n ast.Vertex) bool { return true } -func (v *FilterParserNodes) StmtGroupUseList(n *ast.StmtGroupUseList) { - if nn, ok := n.Prefix.(*ast.ParserNsSeparator); ok { - n.Prefix = nn.Child - } - - if nn, ok := n.UseList.(*ast.ParserNsSeparator); ok { - n.UseList = nn.Child - } - - if nn, ok := n.UseList.(*ast.ParserBrackets); ok { - n.UseList = nn.Child - } -} - -func (v *FilterParserNodes) StmtUseList(n *ast.StmtUseList) { - for k, v := range n.UseDeclarations { - if nn, ok := v.(*ast.ParserNsSeparator); ok { - n.UseDeclarations[k] = nn.Child - } - } -} - -func (v *FilterParserNodes) StmtUseDeclaration(n *ast.StmtUseDeclaration) { - if nn, ok := n.Alias.(*ast.ParserAs); ok { - n.Alias = nn.Child - } -} - func (v *FilterParserNodes) StmtAltIf(n *ast.StmtAltIf) { for { if nn, ok := n.Cond.(*ast.ParserBrackets); ok { diff --git a/pkg/ast/visitor/filter_tokens.go b/pkg/ast/visitor/filter_tokens.go index c69a3f6..7101b86 100644 --- a/pkg/ast/visitor/filter_tokens.go +++ b/pkg/ast/visitor/filter_tokens.go @@ -10,5 +10,26 @@ type FilterTokens struct { func (v *FilterTokens) EnterNode(n ast.Vertex) bool { n.GetNode().Tokens = nil + n.Accept(v) return true } + +func (v *FilterTokens) StmtUse(n *ast.StmtUse) { + n.UseTkn = nil + n.SemiColonTkn = nil +} + +func (v *FilterTokens) StmtGroupUse(n *ast.StmtGroupUse) { + n.UseTkn = nil + n.LeadingNsSeparatorTkn = nil + n.NsSeparatorTkn = nil + n.OpenCurlyBracketTkn = nil + n.CloseCurlyBracketTkn = nil + n.SemiColonTkn = nil +} + +func (v *FilterTokens) StmtUseDeclaration(n *ast.StmtUseDeclaration) { + n.NsSeparatorTkn = nil + n.AsTkn = nil + n.CommaTkn = nil +} diff --git a/pkg/ast/visitor/namespace_resolver.go b/pkg/ast/visitor/namespace_resolver.go index 65f0f54..34c92c7 100644 --- a/pkg/ast/visitor/namespace_resolver.go +++ b/pkg/ast/visitor/namespace_resolver.go @@ -13,9 +13,7 @@ type NamespaceResolver struct { Namespace *Namespace ResolvedNames map[ast.Vertex]string - goDeep bool - useType string - usePrefix []ast.Vertex + goDeep bool } // NewNamespaceResolver NamespaceResolver type constructor @@ -47,28 +45,28 @@ func (nsr *NamespaceResolver) StmtNamespace(n *ast.StmtNamespace) { } } -func (nsr *NamespaceResolver) StmtUseType(n *ast.StmtUseType) { +func (nsr *NamespaceResolver) StmtUse(n *ast.StmtUse) { + useType := "" if n.Type != nil { - nsr.useType = string(n.Type.(*ast.Identifier).Value) + useType = string(n.Type.(*ast.Identifier).Value) } + + for _, nn := range n.UseDeclarations { + nsr.AddAlias(useType, nn, nil) + } + + nsr.goDeep = false } -func (nsr *NamespaceResolver) StmtGroupUseList(n *ast.StmtGroupUseList) { - if n.Prefix != nil { - nsr.usePrefix = n.Prefix.(*ast.NameName).Parts - } -} - -func (nsr *NamespaceResolver) StmtUseDeclaration(n *ast.StmtUseDeclaration) { - useNameParts := n.Use.(*ast.NameName).Parts - var alias string - if n.Alias == nil { - alias = string(useNameParts[len(useNameParts)-1].(*ast.NameNamePart).Value) - } else { - alias = string(n.Alias.(*ast.Identifier).Value) +func (nsr *NamespaceResolver) StmtGroupUse(n *ast.StmtGroupUse) { + useType := "" + if n.Type != nil { + useType = string(n.Type.(*ast.Identifier).Value) } - nsr.Namespace.AddAlias(nsr.useType, concatNameParts(nsr.usePrefix, useNameParts), alias) + for _, nn := range n.UseDeclarations { + nsr.AddAlias(useType, nn, n.Prefix.(*ast.NameName).Parts) + } nsr.goDeep = false } @@ -215,10 +213,26 @@ func (nsr *NamespaceResolver) LeaveNode(n ast.Vertex) { if nn.Stmts != nil { nsr.Namespace = NewNamespace("") } - case *ast.StmtUseType: - nsr.useType = "" - case *ast.StmtGroupUseList: - nsr.usePrefix = nil + } +} + +// AddAlias adds a new alias +func (nsr *NamespaceResolver) AddAlias(useType string, nn ast.Vertex, prefix []ast.Vertex) { + switch use := nn.(type) { + case *ast.StmtUseDeclaration: + if use.Type != nil { + useType = string(use.Type.(*ast.Identifier).Value) + } + + useNameParts := use.Use.(*ast.NameName).Parts + var alias string + if use.Alias == nil { + alias = string(useNameParts[len(useNameParts)-1].(*ast.NameNamePart).Value) + } else { + alias = string(use.Alias.(*ast.Identifier).Value) + } + + nsr.Namespace.AddAlias(useType, concatNameParts(prefix, useNameParts), alias) } } diff --git a/pkg/ast/visitor/namespace_resolver_test.go b/pkg/ast/visitor/namespace_resolver_test.go index 22eb8bc..34a31f7 100644 --- a/pkg/ast/visitor/namespace_resolver_test.go +++ b/pkg/ast/visitor/namespace_resolver_test.go @@ -17,11 +17,9 @@ func TestResolveStaticCall(t *testing.T) { stxTree := &ast.StmtStmtList{ Stmts: []ast.Vertex{ &ast.StmtUse{ - UseList: &ast.StmtUseList{ - UseDeclarations: []ast.Vertex{ - &ast.StmtUseDeclaration{ - Use: nameAB, - }, + UseDeclarations: []ast.Vertex{ + &ast.StmtUseDeclaration{ + Use: nameAB, }, }, }, @@ -51,11 +49,9 @@ func TestResolveStaticPropertyFetch(t *testing.T) { stxTree := &ast.StmtStmtList{ Stmts: []ast.Vertex{ &ast.StmtUse{ - UseList: &ast.StmtUseList{ - UseDeclarations: []ast.Vertex{ - &ast.StmtUseDeclaration{ - Use: nameAB, - }, + UseDeclarations: []ast.Vertex{ + &ast.StmtUseDeclaration{ + Use: nameAB, }, }, }, @@ -84,11 +80,9 @@ func TestResolveClassConstFetch(t *testing.T) { stxTree := &ast.StmtStmtList{ Stmts: []ast.Vertex{ &ast.StmtUse{ - UseList: &ast.StmtUseList{ - UseDeclarations: []ast.Vertex{ - &ast.StmtUseDeclaration{ - Use: nameAB, - }, + UseDeclarations: []ast.Vertex{ + &ast.StmtUseDeclaration{ + Use: nameAB, }, }, }, @@ -117,11 +111,9 @@ func TestResolveNew(t *testing.T) { stxTree := &ast.StmtStmtList{ Stmts: []ast.Vertex{ &ast.StmtUse{ - UseList: &ast.StmtUseList{ - UseDeclarations: []ast.Vertex{ - &ast.StmtUseDeclaration{ - Use: nameAB, - }, + UseDeclarations: []ast.Vertex{ + &ast.StmtUseDeclaration{ + Use: nameAB, }, }, }, @@ -150,11 +142,9 @@ func TestResolveInstanceOf(t *testing.T) { stxTree := &ast.StmtStmtList{ Stmts: []ast.Vertex{ &ast.StmtUse{ - UseList: &ast.StmtUseList{ - UseDeclarations: []ast.Vertex{ - &ast.StmtUseDeclaration{ - Use: nameAB, - }, + UseDeclarations: []ast.Vertex{ + &ast.StmtUseDeclaration{ + Use: nameAB, }, }, }, @@ -186,14 +176,13 @@ func TestResolveInstanceCatch(t *testing.T) { stxTree := &ast.StmtStmtList{ Stmts: []ast.Vertex{ &ast.StmtUse{ - UseList: &ast.StmtUseList{ - UseDeclarations: []ast.Vertex{ - &ast.StmtUseDeclaration{ - Use: nameAB, - }, &ast.StmtUseDeclaration{ - Use: nameDE, - Alias: &ast.Identifier{Value: []byte("F")}, - }, + UseDeclarations: []ast.Vertex{ + &ast.StmtUseDeclaration{ + Use: nameAB, + }, + &ast.StmtUseDeclaration{ + Use: nameDE, + Alias: &ast.Identifier{Value: []byte("F")}, }, }, }, @@ -232,14 +221,10 @@ func TestResolveFunctionCall(t *testing.T) { stxTree := &ast.StmtStmtList{ Stmts: []ast.Vertex{ &ast.StmtUse{ - UseList: &ast.StmtUseType{ - Type: &ast.Identifier{Value: []byte("function")}, - Use: &ast.StmtUseList{ - UseDeclarations: []ast.Vertex{ - &ast.StmtUseDeclaration{ - Use: nameAB, - }, - }, + Type: &ast.Identifier{Value: []byte("function")}, + UseDeclarations: []ast.Vertex{ + &ast.StmtUseDeclaration{ + Use: nameAB, }, }, }, @@ -268,14 +253,10 @@ func TestResolveConstFetch(t *testing.T) { stxTree := &ast.StmtStmtList{ Stmts: []ast.Vertex{ &ast.StmtUse{ - UseList: &ast.StmtUseType{ - Type: &ast.Identifier{Value: []byte("const")}, - Use: &ast.StmtUseList{ - UseDeclarations: []ast.Vertex{ - &ast.StmtUseDeclaration{ - Use: nameAB, - }, - }, + Type: &ast.Identifier{Value: []byte("const")}, + UseDeclarations: []ast.Vertex{ + &ast.StmtUseDeclaration{ + Use: nameAB, }, }, }, @@ -305,39 +286,25 @@ func TestResolveGroupUse(t *testing.T) { stxTree := &ast.StmtStmtList{ Stmts: []ast.Vertex{ - &ast.StmtUse{ - UseList: &ast.StmtGroupUseList{ - Prefix: nameAB, - UseList: &ast.StmtUseList{ - UseDeclarations: []ast.Vertex{ - &ast.StmtUseType{ - Type: &ast.Identifier{Value: []byte("Function")}, - Use: &ast.StmtUseDeclaration{ - Use: nameF, - }, - }, - &ast.StmtUseType{ - Type: &ast.Identifier{Value: []byte("const")}, - Use: &ast.StmtUseDeclaration{ - Use: nameC, - }, - }, - }, + &ast.StmtGroupUse{ + Prefix: nameAB, + UseDeclarations: []ast.Vertex{ + &ast.StmtUseDeclaration{ + Type: &ast.Identifier{Value: []byte("Function")}, + Use: nameF, + }, + &ast.StmtUseDeclaration{ + Type: &ast.Identifier{Value: []byte("const")}, + Use: nameC, }, }, }, - &ast.StmtUse{ - UseList: &ast.StmtUseType{ - Type: &ast.Identifier{Value: []byte("Function")}, - Use: &ast.StmtGroupUseList{ - Prefix: nameBD, - UseList: &ast.StmtUseList{ - UseDeclarations: []ast.Vertex{ - &ast.StmtUseDeclaration{ - Use: nameE, - }, - }, - }, + &ast.StmtGroupUse{ + Prefix: nameBD, + Type: &ast.Identifier{Value: []byte("Function")}, + UseDeclarations: []ast.Vertex{ + &ast.StmtUseDeclaration{ + Use: nameE, }, }, }, @@ -381,11 +348,9 @@ func TestResolveTraitUse(t *testing.T) { stxTree := &ast.StmtStmtList{ Stmts: []ast.Vertex{ &ast.StmtUse{ - UseList: &ast.StmtUseList{ - UseDeclarations: []ast.Vertex{ - &ast.StmtUseDeclaration{ - Use: nameAB, - }, + UseDeclarations: []ast.Vertex{ + &ast.StmtUseDeclaration{ + Use: nameAB, }, }, }, @@ -704,11 +669,9 @@ func TestResolveNamespaces(t *testing.T) { NamespaceName: namespaceCD, Stmts: []ast.Vertex{ &ast.StmtUse{ - UseList: &ast.StmtUseList{ - UseDeclarations: []ast.Vertex{ - &ast.StmtUseDeclaration{ - Use: nameAC, - }, + UseDeclarations: []ast.Vertex{ + &ast.StmtUseDeclaration{ + Use: nameAC, }, }, }, diff --git a/pkg/ast/visitor/null.go b/pkg/ast/visitor/null.go index 033a77f..291d8f9 100644 --- a/pkg/ast/visitor/null.go +++ b/pkg/ast/visitor/null.go @@ -282,11 +282,7 @@ func (v *Null) StmtUse(_ *ast.StmtUse) { // do nothing } -func (v *Null) StmtGroupUseList(_ *ast.StmtGroupUseList) { - // do nothing -} - -func (v *Null) StmtUseList(_ *ast.StmtUseList) { +func (v *Null) StmtGroupUse(_ *ast.StmtGroupUse) { // do nothing } @@ -294,10 +290,6 @@ func (v *Null) StmtUseDeclaration(_ *ast.StmtUseDeclaration) { // do nothing } -func (v *Null) StmtUseType(_ *ast.StmtUseType) { - // do nothing -} - func (v *Null) StmtWhile(_ *ast.StmtWhile) { // do nothing } diff --git a/pkg/printer/pretty_printer.go b/pkg/printer/pretty_printer.go index 71a89a8..1aab5d1 100644 --- a/pkg/printer/pretty_printer.go +++ b/pkg/printer/pretty_printer.go @@ -399,14 +399,10 @@ func (p *PrettyPrinter) printNode(n ast.Vertex) { p.printStmtUnset(n) case *ast.StmtUse: p.printStmtUse(n) - case *ast.StmtGroupUseList: - p.printStmtGroupUseList(n) - case *ast.StmtUseList: - p.printStmtUseList(n) + case *ast.StmtGroupUse: + p.printStmtGroupUse(n) case *ast.StmtUseDeclaration: p.printStmtUseDeclaration(n) - case *ast.StmtUseType: - p.printStmtUseType(n) case *ast.StmtWhile: p.printStmtWhile(n) } @@ -2139,30 +2135,41 @@ func (p *PrettyPrinter) printStmtUse(n ast.Vertex) { io.WriteString(p.w, "use ") - p.Print(nn.UseList) + if nn.Type != nil { + p.Print(nn.Type) + io.WriteString(p.w, " ") + } + + p.joinPrint(", ", nn.UseDeclarations) io.WriteString(p.w, ";") } -func (p *PrettyPrinter) printStmtGroupUseList(n ast.Vertex) { - nn := n.(*ast.StmtGroupUseList) +func (p *PrettyPrinter) printStmtGroupUse(n ast.Vertex) { + nn := n.(*ast.StmtGroupUse) + + io.WriteString(p.w, "use ") + + if nn.Type != nil { + p.Print(nn.Type) + io.WriteString(p.w, " ") + } p.Print(nn.Prefix) io.WriteString(p.w, "\\{") - p.Print(nn.UseList) - io.WriteString(p.w, "}") -} - -func (p *PrettyPrinter) printStmtUseList(n ast.Vertex) { - nn := n.(*ast.StmtUseList) - p.joinPrint(", ", nn.UseDeclarations) + io.WriteString(p.w, "}") } func (p *PrettyPrinter) printStmtUseDeclaration(n ast.Vertex) { nn := n.(*ast.StmtUseDeclaration) + if nn.Type != nil { + p.Print(nn.Type) + io.WriteString(p.w, " ") + } + p.Print(nn.Use) if nn.Alias != nil { @@ -2171,15 +2178,6 @@ func (p *PrettyPrinter) printStmtUseDeclaration(n ast.Vertex) { } } -func (p *PrettyPrinter) printStmtUseType(n ast.Vertex) { - nn := n.(*ast.StmtUseType) - - p.Print(nn.Type) - io.WriteString(p.w, " ") - - p.Print(nn.Use) -} - func (p *PrettyPrinter) printStmtWhile(n ast.Vertex) { nn := n.(*ast.StmtWhile) diff --git a/pkg/printer/pretty_printer_test.go b/pkg/printer/pretty_printer_test.go index 72f4988..199bc2f 100644 --- a/pkg/printer/pretty_printer_test.go +++ b/pkg/printer/pretty_printer_test.go @@ -3954,39 +3954,7 @@ func TestPrintUse(t *testing.T) { p := printer.NewPrettyPrinter(o, " ") p.Print(&ast.StmtUse{ - UseList: &ast.StmtUseList{}, - }) - - expected := `use ;` - actual := o.String() - - if expected != actual { - t.Errorf("\nexpected: %s\ngot: %s\n", expected, actual) - } -} - -func TestPrintStmtGroupUseList(t *testing.T) { - o := bytes.NewBufferString("") - - p := printer.NewPrettyPrinter(o, " ") - p.Print(&ast.StmtGroupUseList{ - Prefix: &ast.NameName{Parts: []ast.Vertex{&ast.NameNamePart{Value: []byte("Foo")}}}, - UseList: &ast.StmtUseList{}, - }) - - expected := `Foo\{}` - actual := o.String() - - if expected != actual { - t.Errorf("\nexpected: %s\ngot: %s\n", expected, actual) - } -} - -func TestPrintStmtUseList(t *testing.T) { - o := bytes.NewBufferString("") - - p := printer.NewPrettyPrinter(o, " ") - p.Print(&ast.StmtUseList{ + Type: &ast.Identifier{Value: []byte("function")}, UseDeclarations: []ast.Vertex{ &ast.StmtUseDeclaration{ Use: &ast.NameName{Parts: []ast.Vertex{&ast.NameNamePart{Value: []byte("Foo")}}}, @@ -3998,7 +3966,33 @@ func TestPrintStmtUseList(t *testing.T) { }, }) - expected := `Foo as Bar, Baz` + expected := `use function Foo as Bar, Baz;` + actual := o.String() + + if expected != actual { + t.Errorf("\nexpected: %s\ngot: %s\n", expected, actual) + } +} + +func TestPrintStmtGroupUse(t *testing.T) { + o := bytes.NewBufferString("") + + p := printer.NewPrettyPrinter(o, " ") + p.Print(&ast.StmtGroupUse{ + Type: &ast.Identifier{Value: []byte("function")}, + Prefix: &ast.NameName{Parts: []ast.Vertex{&ast.NameNamePart{Value: []byte("Foo")}}}, + UseDeclarations: []ast.Vertex{ + &ast.StmtUseDeclaration{ + Use: &ast.NameName{Parts: []ast.Vertex{&ast.NameNamePart{Value: []byte("Foo")}}}, + Alias: &ast.Identifier{Value: []byte("Bar")}, + }, + &ast.StmtUseDeclaration{ + Use: &ast.NameName{Parts: []ast.Vertex{&ast.NameNamePart{Value: []byte("Baz")}}}, + }, + }, + }) + + expected := `use function Foo\{Foo as Bar, Baz}` actual := o.String() if expected != actual { @@ -4011,30 +4005,11 @@ func TestPrintUseDeclaration(t *testing.T) { p := printer.NewPrettyPrinter(o, " ") p.Print(&ast.StmtUseDeclaration{ + Type: &ast.Identifier{Value: []byte("function")}, Use: &ast.NameName{Parts: []ast.Vertex{&ast.NameNamePart{Value: []byte("Foo")}}}, Alias: &ast.Identifier{Value: []byte("Bar")}, }) - expected := `Foo as Bar` - actual := o.String() - - if expected != actual { - t.Errorf("\nexpected: %s\ngot: %s\n", expected, actual) - } -} - -func TestPrintUseType(t *testing.T) { - o := bytes.NewBufferString("") - - p := printer.NewPrettyPrinter(o, " ") - p.Print(&ast.StmtUseType{ - Type: &ast.Identifier{Value: []byte("function")}, - Use: &ast.StmtUseDeclaration{ - Use: &ast.NameName{Parts: []ast.Vertex{&ast.NameNamePart{Value: []byte("Foo")}}}, - Alias: &ast.Identifier{Value: []byte("Bar")}, - }, - }) - expected := `function Foo as Bar` actual := o.String() diff --git a/pkg/printer/printer.go b/pkg/printer/printer.go index 3951b6f..8d73f1b 100644 --- a/pkg/printer/printer.go +++ b/pkg/printer/printer.go @@ -76,6 +76,23 @@ func (p *Printer) printFreeFloatingOrDefault(n ast.Vertex, pos token.Position, d } } +func (p *Printer) printToken(t *token.Token, def string) { + if t != nil { + p.w.Write(t.Skipped) + p.w.Write(t.Value) + p.bufStart = "" + return + } + + if def != "" { + p.w.Write([]byte(p.bufStart)) + p.bufStart = "" + + p.w.Write([]byte(def)) + return + } +} + func (p *Printer) printFreeFloating(n ast.Vertex, pos token.Position) { if n == nil { return @@ -87,7 +104,7 @@ func (p *Printer) printFreeFloating(n ast.Vertex, pos token.Position) { } func (p *Printer) printNode(n ast.Vertex) { - switch n.(type) { + switch n := n.(type) { // node @@ -438,14 +455,10 @@ func (p *Printer) printNode(n ast.Vertex) { p.printStmtUnset(n) case *ast.StmtUse: p.printStmtUse(n) - case *ast.StmtGroupUseList: - p.printStmtGroupUseList(n) - case *ast.StmtUseList: - p.printStmtUseList(n) + case *ast.StmtGroupUse: + p.printStmtGroupUse(n) case *ast.StmtUseDeclaration: p.printStmtUseDeclaration(n) - case *ast.StmtUseType: - p.printStmtUseType(n) case *ast.StmtWhile: p.printStmtWhile(n) case *ast.ParserAs: @@ -3260,74 +3273,66 @@ func (p *Printer) printStmtUnset(n ast.Vertex) { p.printFreeFloating(nn, token.End) } -func (p *Printer) printStmtUse(n ast.Vertex) { - nn := n.(*ast.StmtUse) - p.printFreeFloating(nn, token.Start) - - io.WriteString(p.w, "use") +func (p *Printer) printStmtUse(n *ast.StmtUse) { + p.printToken(n.UseTkn, "use") p.bufStart = " " - p.Print(nn.UseList) + p.Print(n.Type) - p.printFreeFloatingOrDefault(nn, token.End, ";") + p.bufStart = " " + p.joinPrint(",", n.UseDeclarations) + + p.printToken(n.SemiColonTkn, ";") } -func (p *Printer) printStmtGroupUseList(n ast.Vertex) { - nn := n.(*ast.StmtGroupUseList) - p.printFreeFloating(nn, token.Start) +func (p *Printer) printStmtGroupUse(n *ast.StmtGroupUse) { + p.printToken(n.UseTkn, "use") - p.Print(nn.Prefix) + p.bufStart = " " + p.Print(n.Type) - if _, ok := nn.UseList.(*ast.ParserNsSeparator); !ok { - io.WriteString(p.w, "\\{") - } + p.bufStart = " " + p.printToken(n.LeadingNsSeparatorTkn, "") - p.Print(nn.UseList) + p.Print(n.Prefix) + p.printToken(n.NsSeparatorTkn, "\\") + p.printToken(n.OpenCurlyBracketTkn, "{") - if _, ok := nn.UseList.(*ast.ParserNsSeparator); !ok { - io.WriteString(p.w, "}") - } - - p.printFreeFloating(nn, token.End) -} - -func (p *Printer) printStmtUseList(n ast.Vertex) { - nn := n.(*ast.StmtUseList) - p.printFreeFloating(nn, token.Start) - - p.joinPrint(",", nn.UseDeclarations) - - p.printFreeFloating(nn, token.End) -} - -func (p *Printer) printStmtUseDeclaration(n ast.Vertex) { - nn := n.(*ast.StmtUseDeclaration) - p.printFreeFloating(nn, token.Start) - - p.Print(nn.Use) - - if nn.Alias != nil { - if _, ok := nn.Alias.(*ast.ParserAs); !ok { - io.WriteString(p.w, " as") + for k, v := range n.UseDeclarations { + p.Print(v) + var def string + if k != len(n.UseDeclarations)-1 { + def = "," + } + if decl, ok := v.(*ast.StmtUseDeclaration); ok { + p.printToken(decl.CommaTkn, def) } - - p.bufStart = " " - p.Print(nn.Alias) } - p.printFreeFloating(nn, token.End) + p.printToken(n.CloseCurlyBracketTkn, "}") + p.printToken(n.SemiColonTkn, ";") } -func (p *Printer) printStmtUseType(n ast.Vertex) { - nn := n.(*ast.StmtUseType) - p.printFreeFloating(nn, token.Start) +func (p *Printer) printStmtUseDeclaration(n *ast.StmtUseDeclaration) { + p.Print(n.Type) - p.Print(nn.Type) + if n.Type != nil { + p.bufStart = " " + } + + p.printToken(n.NsSeparatorTkn, "") + + p.Print(n.Use) + + if n.Alias == nil { + return + } p.bufStart = " " - p.Print(nn.Use) + p.printToken(n.AsTkn, "as") - p.printFreeFloating(nn, token.End) + p.bufStart = " " + p.Print(n.Alias) } func (p *Printer) printStmtWhile(n ast.Vertex) { diff --git a/pkg/printer/printer_parsed_php5_test.go b/pkg/printer/printer_parsed_php5_test.go index 2745542..60cdc39 100644 --- a/pkg/printer/printer_parsed_php5_test.go +++ b/pkg/printer/printer_parsed_php5_test.go @@ -1308,7 +1308,8 @@ func TestParseAndPrintPhp5Unset(t *testing.T) { } func TestParseAndPrintPhp5UseList(t *testing.T) { - src := `