From 115d481a576c8f787543eeb84d4c1c1c1a700b19 Mon Sep 17 00:00:00 2001 From: Vadym Slizov Date: Sat, 26 Dec 2020 22:44:14 +0200 Subject: [PATCH] refactoring: update ast structure of "IncludeOnce" node --- internal/php5/parser_test.go | 2 +- internal/php5/php5.go | Bin 264710 -> 264722 bytes internal/php5/php5.y | 6 +++--- internal/php7/parser_test.go | 2 +- internal/php7/php7.go | Bin 219189 -> 219201 bytes internal/php7/php7.y | 6 +++--- pkg/ast/node.go | 6 +++--- pkg/ast/visitor/dumper.go | 4 ++-- pkg/ast/visitor/formatter.go | 2 +- pkg/ast/visitor/printer.go | 2 +- 10 files changed, 15 insertions(+), 15 deletions(-) diff --git a/internal/php5/parser_test.go b/internal/php5/parser_test.go index 7cf63ec..f4b35d8 100644 --- a/internal/php5/parser_test.go +++ b/internal/php5/parser_test.go @@ -35182,7 +35182,7 @@ func TestExprInclude_Once(t *testing.T) { StartPos: 3, EndPos: 18, }, - IncludeTkn: &token.Token{ + IncludeOnceTkn: &token.Token{ ID: token.T_INCLUDE_ONCE, Value: []byte("include_once"), Position: &position.Position{ diff --git a/internal/php5/php5.go b/internal/php5/php5.go index fb7f8dbbb4330434f8362d59d47419ac58ec7ce1..09a19308ced0fc3ff5d7791a98ff3fc56485e676 100644 GIT binary patch delta 56 zcmV-80LTA^ln|1X5P*aMgaWh!*ZG$)$^##lu>1o&moEAP2Lw-UV`Z0dJpmk-AcO%9 Om)}bRBe#C~1BefKE)`Y) delta 26 icmbOp!Qj{=vLrd-pHqc76bzr3@_q diff --git a/internal/php5/php5.y b/internal/php5/php5.y index 8a66936..f08fbff 100644 --- a/internal/php5/php5.y +++ b/internal/php5/php5.y @@ -5533,9 +5533,9 @@ internal_functions_in_yacc: | T_INCLUDE_ONCE expr { $$ = &ast.ExprIncludeOnce{ - Position: yylex.(*Parser).builder.NewTokenNodePosition($1, $2), - IncludeTkn: $1, - Expr: $2, + Position: yylex.(*Parser).builder.NewTokenNodePosition($1, $2), + IncludeOnceTkn: $1, + Expr: $2, } } | T_EVAL '(' expr ')' diff --git a/internal/php7/parser_test.go b/internal/php7/parser_test.go index 02bf256..2854d9a 100644 --- a/internal/php7/parser_test.go +++ b/internal/php7/parser_test.go @@ -39864,7 +39864,7 @@ func TestExprInclude_Once(t *testing.T) { StartPos: 3, EndPos: 18, }, - IncludeTkn: &token.Token{ + IncludeOnceTkn: &token.Token{ ID: token.T_INCLUDE_ONCE, Value: []byte("include_once"), Position: &position.Position{ diff --git a/internal/php7/php7.go b/internal/php7/php7.go index 9503f811bf9f1defe6ebb5abd691334b115512e9..2c5e9d0db325f02e2b2c819acf5fdad03faa2be9 100644 GIT binary patch delta 61 zcmV-D0K)&Zunobm4S<9JgaWh!tWcMb>jET~picun1W#^bWtX8k0vwl6wgL{9D_%pBEo*2mdfDHha!3vWA diff --git a/internal/php7/php7.y b/internal/php7/php7.y index 44d8880..4e44911 100644 --- a/internal/php7/php7.y +++ b/internal/php7/php7.y @@ -4292,9 +4292,9 @@ internal_functions_in_yacc: | T_INCLUDE_ONCE expr { $$ = &ast.ExprIncludeOnce{ - Position: yylex.(*Parser).builder.NewTokenNodePosition($1, $2), - IncludeTkn: $1, - Expr: $2, + Position: yylex.(*Parser).builder.NewTokenNodePosition($1, $2), + IncludeOnceTkn: $1, + Expr: $2, } } | T_EVAL '(' expr ')' diff --git a/pkg/ast/node.go b/pkg/ast/node.go index a3f60d8..e85fde6 100644 --- a/pkg/ast/node.go +++ b/pkg/ast/node.go @@ -1434,9 +1434,9 @@ func (n *ExprInclude) GetPosition() *position.Position { // ExprIncludeOnce node type ExprIncludeOnce struct { - Position *position.Position - IncludeTkn *token.Token - Expr Vertex + Position *position.Position + IncludeOnceTkn *token.Token + Expr Vertex } func (n *ExprIncludeOnce) Accept(v NodeVisitor) { diff --git a/pkg/ast/visitor/dumper.go b/pkg/ast/visitor/dumper.go index 689274d..dc5536d 100644 --- a/pkg/ast/visitor/dumper.go +++ b/pkg/ast/visitor/dumper.go @@ -1257,7 +1257,7 @@ func (v *Dumper) ExprInclude(n *ast.ExprInclude) { v.indent++ v.dumpPosition(n.Position) - v.dumpToken("IncludeTkn", n.IncludeTkn) + v.dumpToken("IncludeOnceTkn", n.IncludeTkn) v.dumpVertex("Expr", n.Expr) v.indent-- @@ -1269,7 +1269,7 @@ func (v *Dumper) ExprIncludeOnce(n *ast.ExprIncludeOnce) { v.indent++ v.dumpPosition(n.Position) - v.dumpToken("IncludeTkn", n.IncludeTkn) + v.dumpToken("IncludeOnceTkn", n.IncludeOnceTkn) v.dumpVertex("Expr", n.Expr) v.indent-- diff --git a/pkg/ast/visitor/formatter.go b/pkg/ast/visitor/formatter.go index 8ce9363..3831228 100644 --- a/pkg/ast/visitor/formatter.go +++ b/pkg/ast/visitor/formatter.go @@ -1258,7 +1258,7 @@ func (f *formatter) ExprInclude(n *ast.ExprInclude) { } func (f *formatter) ExprIncludeOnce(n *ast.ExprIncludeOnce) { - n.IncludeTkn = f.newToken(token.T_INCLUDE_ONCE, []byte("include_once")) + n.IncludeOnceTkn = f.newToken(token.T_INCLUDE_ONCE, []byte("include_once")) f.addFreeFloating(token.T_WHITESPACE, []byte(" ")) n.Expr.Accept(f) } diff --git a/pkg/ast/visitor/printer.go b/pkg/ast/visitor/printer.go index 524c1e8..22e0cae 100644 --- a/pkg/ast/visitor/printer.go +++ b/pkg/ast/visitor/printer.go @@ -745,7 +745,7 @@ func (p *printer) ExprInclude(n *ast.ExprInclude) { } func (p *printer) ExprIncludeOnce(n *ast.ExprIncludeOnce) { - p.printToken(n.IncludeTkn, []byte("include_once")) + p.printToken(n.IncludeOnceTkn, []byte("include_once")) p.printNode(n.Expr) }