From 767187ff853ee2e8dd59e9c7adea6ad52a9c30f8 Mon Sep 17 00:00:00 2001 From: Vadym Slizov Date: Sat, 22 Aug 2020 16:59:26 +0300 Subject: [PATCH] [refactoring] update ast structure for "Use" and "GroupUse" nodes --- internal/php5/parser_test.go | 873 +++++------ internal/php5/php5.go | Bin 301917 -> 298404 bytes internal/php5/php5.y | 415 ++--- internal/php5/php5_test.go | 872 +++++------ internal/php7/parser_test.go | 1589 ++++++++----------- internal/php7/php7.go | Bin 256975 -> 253133 bytes internal/php7/php7.y | 290 ++-- internal/php7/php7_test.go | 1590 ++++++++------------ pkg/ast/ast.go | 4 +- pkg/ast/node.go | 53 +- pkg/ast/traverser/dfs.go | 56 +- pkg/ast/visitor/dump.go | 50 +- pkg/ast/visitor/filter_parser_nodes.go | 28 - pkg/ast/visitor/filter_tokens.go | 21 + pkg/ast/visitor/namespace_resolver.go | 60 +- pkg/ast/visitor/namespace_resolver_test.go | 141 +- pkg/ast/visitor/null.go | 10 +- pkg/printer/pretty_printer.go | 48 +- pkg/printer/pretty_printer_test.go | 83 +- pkg/printer/printer.go | 119 +- pkg/printer/printer_parsed_php5_test.go | 3 +- pkg/printer/printer_parsed_php7_test.go | 6 +- pkg/printer/printer_test.go | 89 +- 23 files changed, 2761 insertions(+), 3639 deletions(-) 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"),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eCI6M*kl)N&3k;4{{sfIPMyezCQ^xZU7zTm_Y`6^MPF~_Cztp%PXBxZwUndMB-yEpSlLX2IbLv_K21xi z?+$wE#~x@jRHs89^9x`&1yHw_*9t_5{Rpd%Y==!$Hw<|DTERMyjyP**^GN7&ob zSr*k@ts%5(0R-em7xx{>3!PY6HMz3>9udD z4z~8)&w5+mRRz;=)$1MK$0BibmX7D3b9=In#i3h^MLM~+@C0>BOrxv%g1h>m4ELDZ zpM0jTz+qG%MAW6W*^o@n7K5fn^m*k!i$%P_p@o-&ithEH(#)nI11uV%mA=G-3$B}2 z2we!3!(W4!8w?%5k@)Y0=WM!M{AhUwwR=i*cb+j2PM#0*(#5=ZWYZX8!LKQuufNb5=6#Wh`HoZ^%TU=9;INcm+O?9X`oNXp!Oi7mWkG8 zwdyV5o^+%3_$Mc*D5sXIpwbxJhEruZw53Vwaz~TyK>u){v~~)bvC}78B+8hIc9d?$ zyf+!nfQ4>aITc45a(18*Qw*LCgc{agq3FJZc3F*eL{UR^+jNVs+UEKcc9~&#=h8c~8d1REQrys@K z6z+vvtGID@B_viqgR^NxTd-;Ycv>KGi#6-54pdd@It7e>0ncU+%oF%Y*(UyX8g`pQ z%cmX?LlT#0L_1B$33Q&C}kNcvWus$zS~SU z_(Bf7dAHp#kNV}X3Z#0|jBV)=VIBw5ZIXXe-U0<7Z0=Sec zQ6y({zf?Mlqlzsek0c4m1=pwc>rlKsa{^B^{T{K{BH)e6<&TJ2Mm-4uzjt46u8oBYvBdm-gC9&ZRE>O*bs(CLW7mv4oJRE{kl161 zh3)GG;dMi)sF}R%sF>3a?h4s;ztrhMR#z$1?NIY_Hhj=&LmO?AS%oVEatTz*_N`|-+>NspcuzW)I* C@{_Xw 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 := `