diff --git a/cmd/php-parser/main.go b/cmd/php-parser/main.go index 13d8734..a94d348 100644 --- a/cmd/php-parser/main.go +++ b/cmd/php-parser/main.go @@ -3,6 +3,10 @@ package main import ( "bytes" "flag" + "github.com/z7zmey/php-parser/pkg/visitor/dumper" + "github.com/z7zmey/php-parser/pkg/visitor/nsresolver" + "github.com/z7zmey/php-parser/pkg/visitor/printer" + "github.com/z7zmey/php-parser/pkg/visitor/traverser" "io" "io/ioutil" "log" @@ -17,8 +21,6 @@ import ( "github.com/yookoala/realpath" "github.com/z7zmey/php-parser/pkg/ast" - "github.com/z7zmey/php-parser/pkg/ast/traverser" - "github.com/z7zmey/php-parser/pkg/ast/visitor" "github.com/z7zmey/php-parser/pkg/errors" "github.com/z7zmey/php-parser/pkg/parser" ) @@ -165,7 +167,7 @@ func printerWorker(r <-chan result) { if *printBack { o := bytes.NewBuffer([]byte{}) - p := visitor.NewPrinter(o) + p := printer.NewPrinter(o) res.rootNode.Accept(p) err := ioutil.WriteFile(res.path, o.Bytes(), 0644) @@ -173,16 +175,15 @@ func printerWorker(r <-chan result) { } if *showResolvedNs { - v := visitor.NewNamespaceResolver() - t := traverser.NewDFS(v) - t.Traverse(res.rootNode) + v := nsresolver.NewNamespaceResolver() + traverser.NewTraverser(v).Traverse(res.rootNode) for _, n := range v.ResolvedNames { _, _ = io.WriteString(os.Stderr, "===> "+n+"\n") } } if *dump == true { - visitor.NewDumper(os.Stdout).WithPositions().WithTokens().Dump(res.rootNode) + dumper.NewDumper(os.Stdout).WithPositions().WithTokens().Dump(res.rootNode) } wg.Done() diff --git a/pkg/ast/ast.go b/pkg/ast/ast.go index fb5b351..261001f 100644 --- a/pkg/ast/ast.go +++ b/pkg/ast/ast.go @@ -3,23 +3,11 @@ package ast import "github.com/z7zmey/php-parser/pkg/position" type Vertex interface { - Accept(v NodeVisitor) + Accept(v Visitor) GetPosition() *position.Position } -type Traverser interface { - Traverse(n Vertex) -} - type Visitor interface { - Enter(key string, singleNode bool) - Leave(key string, singleNode bool) - - EnterNode(n Vertex) bool - LeaveNode(n Vertex) -} - -type NodeVisitor interface { Root(n *Root) Nullable(n *Nullable) Parameter(n *Parameter) diff --git a/pkg/ast/node.go b/pkg/ast/node.go index e97fc87..043c404 100644 --- a/pkg/ast/node.go +++ b/pkg/ast/node.go @@ -12,7 +12,7 @@ type Root struct { EndTkn *token.Token } -func (n *Root) Accept(v NodeVisitor) { +func (n *Root) Accept(v Visitor) { v.Root(n) } @@ -27,7 +27,7 @@ type Nullable struct { Expr Vertex } -func (n *Nullable) Accept(v NodeVisitor) { +func (n *Nullable) Accept(v Visitor) { v.Nullable(n) } @@ -46,7 +46,7 @@ type Parameter struct { DefaultValue Vertex } -func (n *Parameter) Accept(v NodeVisitor) { +func (n *Parameter) Accept(v Visitor) { v.Parameter(n) } @@ -61,7 +61,7 @@ type Identifier struct { Value []byte } -func (n *Identifier) Accept(v NodeVisitor) { +func (n *Identifier) Accept(v Visitor) { v.Identifier(n) } @@ -77,7 +77,7 @@ type Argument struct { Expr Vertex } -func (n *Argument) Accept(v NodeVisitor) { +func (n *Argument) Accept(v Visitor) { v.Argument(n) } @@ -92,7 +92,7 @@ type ScalarDnumber struct { Value []byte } -func (n *ScalarDnumber) Accept(v NodeVisitor) { +func (n *ScalarDnumber) Accept(v Visitor) { v.ScalarDnumber(n) } @@ -108,7 +108,7 @@ type ScalarEncapsed struct { CloseQuoteTkn *token.Token } -func (n *ScalarEncapsed) Accept(v NodeVisitor) { +func (n *ScalarEncapsed) Accept(v Visitor) { v.ScalarEncapsed(n) } @@ -123,7 +123,7 @@ type ScalarEncapsedStringPart struct { Value []byte } -func (n *ScalarEncapsedStringPart) Accept(v NodeVisitor) { +func (n *ScalarEncapsedStringPart) Accept(v Visitor) { v.ScalarEncapsedStringPart(n) } @@ -142,7 +142,7 @@ type ScalarEncapsedStringVar struct { CloseCurlyBracketTkn *token.Token } -func (n *ScalarEncapsedStringVar) Accept(v NodeVisitor) { +func (n *ScalarEncapsedStringVar) Accept(v Visitor) { v.ScalarEncapsedStringVar(n) } @@ -158,7 +158,7 @@ type ScalarEncapsedStringBrackets struct { CloseCurlyBracketTkn *token.Token } -func (n *ScalarEncapsedStringBrackets) Accept(v NodeVisitor) { +func (n *ScalarEncapsedStringBrackets) Accept(v Visitor) { v.ScalarEncapsedStringBrackets(n) } @@ -174,7 +174,7 @@ type ScalarHeredoc struct { CloseHeredocTkn *token.Token } -func (n *ScalarHeredoc) Accept(v NodeVisitor) { +func (n *ScalarHeredoc) Accept(v Visitor) { v.ScalarHeredoc(n) } @@ -189,7 +189,7 @@ type ScalarLnumber struct { Value []byte } -func (n *ScalarLnumber) Accept(v NodeVisitor) { +func (n *ScalarLnumber) Accept(v Visitor) { v.ScalarLnumber(n) } @@ -204,7 +204,7 @@ type ScalarMagicConstant struct { Value []byte } -func (n *ScalarMagicConstant) Accept(v NodeVisitor) { +func (n *ScalarMagicConstant) Accept(v Visitor) { v.ScalarMagicConstant(n) } @@ -220,7 +220,7 @@ type ScalarString struct { Value []byte } -func (n *ScalarString) Accept(v NodeVisitor) { +func (n *ScalarString) Accept(v Visitor) { v.ScalarString(n) } @@ -236,7 +236,7 @@ type StmtBreak struct { SemiColonTkn *token.Token } -func (n *StmtBreak) Accept(v NodeVisitor) { +func (n *StmtBreak) Accept(v Visitor) { v.StmtBreak(n) } @@ -253,7 +253,7 @@ type StmtCase struct { Stmts []Vertex } -func (n *StmtCase) Accept(v NodeVisitor) { +func (n *StmtCase) Accept(v Visitor) { v.StmtCase(n) } @@ -275,7 +275,7 @@ type StmtCatch struct { CloseCurlyBracketTkn *token.Token } -func (n *StmtCatch) Accept(v NodeVisitor) { +func (n *StmtCatch) Accept(v Visitor) { v.StmtCatch(n) } @@ -303,7 +303,7 @@ type StmtClass struct { CloseCurlyBracketTkn *token.Token } -func (n *StmtClass) Accept(v NodeVisitor) { +func (n *StmtClass) Accept(v Visitor) { v.StmtClass(n) } @@ -321,7 +321,7 @@ type StmtClassConstList struct { SemiColonTkn *token.Token } -func (n *StmtClassConstList) Accept(v NodeVisitor) { +func (n *StmtClassConstList) Accept(v Visitor) { v.StmtClassConstList(n) } @@ -345,7 +345,7 @@ type StmtClassMethod struct { Stmt Vertex } -func (n *StmtClassMethod) Accept(v NodeVisitor) { +func (n *StmtClassMethod) Accept(v Visitor) { v.StmtClassMethod(n) } @@ -362,7 +362,7 @@ type StmtConstList struct { SemiColonTkn *token.Token } -func (n *StmtConstList) Accept(v NodeVisitor) { +func (n *StmtConstList) Accept(v Visitor) { v.StmtConstList(n) } @@ -378,7 +378,7 @@ type StmtConstant struct { Expr Vertex } -func (n *StmtConstant) Accept(v NodeVisitor) { +func (n *StmtConstant) Accept(v Visitor) { v.StmtConstant(n) } @@ -394,7 +394,7 @@ type StmtContinue struct { SemiColonTkn *token.Token } -func (n *StmtContinue) Accept(v NodeVisitor) { +func (n *StmtContinue) Accept(v Visitor) { v.StmtContinue(n) } @@ -416,7 +416,7 @@ type StmtDeclare struct { SemiColonTkn *token.Token } -func (n *StmtDeclare) Accept(v NodeVisitor) { +func (n *StmtDeclare) Accept(v Visitor) { v.StmtDeclare(n) } @@ -432,7 +432,7 @@ type StmtDefault struct { Stmts []Vertex } -func (n *StmtDefault) Accept(v NodeVisitor) { +func (n *StmtDefault) Accept(v Visitor) { v.StmtDefault(n) } @@ -452,7 +452,7 @@ type StmtDo struct { SemiColonTkn *token.Token } -func (n *StmtDo) Accept(v NodeVisitor) { +func (n *StmtDo) Accept(v Visitor) { v.StmtDo(n) } @@ -469,7 +469,7 @@ type StmtEcho struct { SemiColonTkn *token.Token } -func (n *StmtEcho) Accept(v NodeVisitor) { +func (n *StmtEcho) Accept(v Visitor) { v.StmtEcho(n) } @@ -485,7 +485,7 @@ type StmtElse struct { Stmt Vertex } -func (n *StmtElse) Accept(v NodeVisitor) { +func (n *StmtElse) Accept(v Visitor) { v.StmtElse(n) } @@ -504,7 +504,7 @@ type StmtElseIf struct { Stmt Vertex } -func (n *StmtElseIf) Accept(v NodeVisitor) { +func (n *StmtElseIf) Accept(v Visitor) { v.StmtElseIf(n) } @@ -519,7 +519,7 @@ type StmtExpression struct { SemiColonTkn *token.Token } -func (n *StmtExpression) Accept(v NodeVisitor) { +func (n *StmtExpression) Accept(v Visitor) { v.StmtExpression(n) } @@ -536,7 +536,7 @@ type StmtFinally struct { CloseCurlyBracketTkn *token.Token } -func (n *StmtFinally) Accept(v NodeVisitor) { +func (n *StmtFinally) Accept(v Visitor) { v.StmtFinally(n) } @@ -564,7 +564,7 @@ type StmtFor struct { SemiColonTkn *token.Token } -func (n *StmtFor) Accept(v NodeVisitor) { +func (n *StmtFor) Accept(v Visitor) { v.StmtFor(n) } @@ -590,7 +590,7 @@ type StmtForeach struct { SemiColonTkn *token.Token } -func (n *StmtForeach) Accept(v NodeVisitor) { +func (n *StmtForeach) Accept(v Visitor) { v.StmtForeach(n) } @@ -615,7 +615,7 @@ type StmtFunction struct { CloseCurlyBracketTkn *token.Token } -func (n *StmtFunction) Accept(v NodeVisitor) { +func (n *StmtFunction) Accept(v Visitor) { v.StmtFunction(n) } @@ -632,7 +632,7 @@ type StmtGlobal struct { SemiColonTkn *token.Token } -func (n *StmtGlobal) Accept(v NodeVisitor) { +func (n *StmtGlobal) Accept(v Visitor) { v.StmtGlobal(n) } @@ -648,7 +648,7 @@ type StmtGoto struct { SemiColonTkn *token.Token } -func (n *StmtGoto) Accept(v NodeVisitor) { +func (n *StmtGoto) Accept(v Visitor) { v.StmtGoto(n) } @@ -665,7 +665,7 @@ type StmtHaltCompiler struct { SemiColonTkn *token.Token } -func (n *StmtHaltCompiler) Accept(v NodeVisitor) { +func (n *StmtHaltCompiler) Accept(v Visitor) { v.StmtHaltCompiler(n) } @@ -688,7 +688,7 @@ type StmtIf struct { SemiColonTkn *token.Token } -func (n *StmtIf) Accept(v NodeVisitor) { +func (n *StmtIf) Accept(v Visitor) { v.StmtIf(n) } @@ -703,7 +703,7 @@ type StmtInlineHtml struct { Value []byte } -func (n *StmtInlineHtml) Accept(v NodeVisitor) { +func (n *StmtInlineHtml) Accept(v Visitor) { v.StmtInlineHtml(n) } @@ -724,7 +724,7 @@ type StmtInterface struct { CloseCurlyBracketTkn *token.Token } -func (n *StmtInterface) Accept(v NodeVisitor) { +func (n *StmtInterface) Accept(v Visitor) { v.StmtInterface(n) } @@ -739,7 +739,7 @@ type StmtLabel struct { ColonTkn *token.Token } -func (n *StmtLabel) Accept(v NodeVisitor) { +func (n *StmtLabel) Accept(v Visitor) { v.StmtLabel(n) } @@ -758,7 +758,7 @@ type StmtNamespace struct { SemiColonTkn *token.Token } -func (n *StmtNamespace) Accept(v NodeVisitor) { +func (n *StmtNamespace) Accept(v Visitor) { v.StmtNamespace(n) } @@ -772,7 +772,7 @@ type StmtNop struct { SemiColonTkn *token.Token } -func (n *StmtNop) Accept(v NodeVisitor) { +func (n *StmtNop) Accept(v Visitor) { v.StmtNop(n) } @@ -788,7 +788,7 @@ type StmtProperty struct { Expr Vertex } -func (n *StmtProperty) Accept(v NodeVisitor) { +func (n *StmtProperty) Accept(v Visitor) { v.StmtProperty(n) } @@ -806,7 +806,7 @@ type StmtPropertyList struct { SemiColonTkn *token.Token } -func (n *StmtPropertyList) Accept(v NodeVisitor) { +func (n *StmtPropertyList) Accept(v Visitor) { v.StmtPropertyList(n) } @@ -822,7 +822,7 @@ type StmtReturn struct { SemiColonTkn *token.Token } -func (n *StmtReturn) Accept(v NodeVisitor) { +func (n *StmtReturn) Accept(v Visitor) { v.StmtReturn(n) } @@ -839,7 +839,7 @@ type StmtStatic struct { SemiColonTkn *token.Token } -func (n *StmtStatic) Accept(v NodeVisitor) { +func (n *StmtStatic) Accept(v Visitor) { v.StmtStatic(n) } @@ -855,7 +855,7 @@ type StmtStaticVar struct { Expr Vertex } -func (n *StmtStaticVar) Accept(v NodeVisitor) { +func (n *StmtStaticVar) Accept(v Visitor) { v.StmtStaticVar(n) } @@ -871,7 +871,7 @@ type StmtStmtList struct { CloseCurlyBracketTkn *token.Token } -func (n *StmtStmtList) Accept(v NodeVisitor) { +func (n *StmtStmtList) Accept(v Visitor) { v.StmtStmtList(n) } @@ -895,7 +895,7 @@ type StmtSwitch struct { SemiColonTkn *token.Token } -func (n *StmtSwitch) Accept(v NodeVisitor) { +func (n *StmtSwitch) Accept(v Visitor) { v.StmtSwitch(n) } @@ -911,7 +911,7 @@ type StmtThrow struct { SemiColonTkn *token.Token } -func (n *StmtThrow) Accept(v NodeVisitor) { +func (n *StmtThrow) Accept(v Visitor) { v.StmtThrow(n) } @@ -929,7 +929,7 @@ type StmtTrait struct { CloseCurlyBracketTkn *token.Token } -func (n *StmtTrait) Accept(v NodeVisitor) { +func (n *StmtTrait) Accept(v Visitor) { v.StmtTrait(n) } @@ -949,7 +949,7 @@ type StmtTraitUse struct { SemiColonTkn *token.Token } -func (n *StmtTraitUse) Accept(v NodeVisitor) { +func (n *StmtTraitUse) Accept(v Visitor) { v.StmtTraitUse(n) } @@ -969,7 +969,7 @@ type StmtTraitUseAlias struct { SemiColonTkn *token.Token } -func (n *StmtTraitUseAlias) Accept(v NodeVisitor) { +func (n *StmtTraitUseAlias) Accept(v Visitor) { v.StmtTraitUseAlias(n) } @@ -989,7 +989,7 @@ type StmtTraitUsePrecedence struct { SemiColonTkn *token.Token } -func (n *StmtTraitUsePrecedence) Accept(v NodeVisitor) { +func (n *StmtTraitUsePrecedence) Accept(v Visitor) { v.StmtTraitUsePrecedence(n) } @@ -1008,7 +1008,7 @@ type StmtTry struct { Finally Vertex } -func (n *StmtTry) Accept(v NodeVisitor) { +func (n *StmtTry) Accept(v Visitor) { v.StmtTry(n) } @@ -1027,7 +1027,7 @@ type StmtUnset struct { SemiColonTkn *token.Token } -func (n *StmtUnset) Accept(v NodeVisitor) { +func (n *StmtUnset) Accept(v Visitor) { v.StmtUnset(n) } @@ -1045,7 +1045,7 @@ type StmtUse struct { SemiColonTkn *token.Token } -func (n *StmtUse) Accept(v NodeVisitor) { +func (n *StmtUse) Accept(v Visitor) { v.StmtUse(n) } @@ -1068,7 +1068,7 @@ type StmtGroupUse struct { SemiColonTkn *token.Token } -func (n *StmtGroupUse) Accept(v NodeVisitor) { +func (n *StmtGroupUse) Accept(v Visitor) { v.StmtGroupUse(n) } @@ -1086,7 +1086,7 @@ type StmtUseDeclaration struct { Alias Vertex } -func (n *StmtUseDeclaration) Accept(v NodeVisitor) { +func (n *StmtUseDeclaration) Accept(v Visitor) { v.StmtUseDeclaration(n) } @@ -1107,7 +1107,7 @@ type StmtWhile struct { SemiColonTkn *token.Token } -func (n *StmtWhile) Accept(v NodeVisitor) { +func (n *StmtWhile) Accept(v Visitor) { v.StmtWhile(n) } @@ -1125,7 +1125,7 @@ type ExprArray struct { CloseBracketTkn *token.Token } -func (n *ExprArray) Accept(v NodeVisitor) { +func (n *ExprArray) Accept(v Visitor) { v.ExprArray(n) } @@ -1142,7 +1142,7 @@ type ExprArrayDimFetch struct { CloseBracketTkn *token.Token } -func (n *ExprArrayDimFetch) Accept(v NodeVisitor) { +func (n *ExprArrayDimFetch) Accept(v Visitor) { v.ExprArrayDimFetch(n) } @@ -1160,7 +1160,7 @@ type ExprArrayItem struct { Val Vertex } -func (n *ExprArrayItem) Accept(v NodeVisitor) { +func (n *ExprArrayItem) Accept(v Visitor) { v.ExprArrayItem(n) } @@ -1184,7 +1184,7 @@ type ExprArrowFunction struct { Expr Vertex } -func (n *ExprArrowFunction) Accept(v NodeVisitor) { +func (n *ExprArrowFunction) Accept(v Visitor) { v.ExprArrowFunction(n) } @@ -1199,7 +1199,7 @@ type ExprBitwiseNot struct { Expr Vertex } -func (n *ExprBitwiseNot) Accept(v NodeVisitor) { +func (n *ExprBitwiseNot) Accept(v Visitor) { v.ExprBitwiseNot(n) } @@ -1214,7 +1214,7 @@ type ExprBooleanNot struct { Expr Vertex } -func (n *ExprBooleanNot) Accept(v NodeVisitor) { +func (n *ExprBooleanNot) Accept(v Visitor) { v.ExprBooleanNot(n) } @@ -1229,7 +1229,7 @@ type ExprBrackets struct { CloseParenthesisTkn *token.Token } -func (n *ExprBrackets) Accept(v NodeVisitor) { +func (n *ExprBrackets) Accept(v Visitor) { v.ExprBrackets(n) } @@ -1245,7 +1245,7 @@ type ExprClassConstFetch struct { ConstantName Vertex } -func (n *ExprClassConstFetch) Accept(v NodeVisitor) { +func (n *ExprClassConstFetch) Accept(v Visitor) { v.ExprClassConstFetch(n) } @@ -1260,7 +1260,7 @@ type ExprClone struct { Expr Vertex } -func (n *ExprClone) Accept(v NodeVisitor) { +func (n *ExprClone) Accept(v Visitor) { v.ExprClone(n) } @@ -1290,7 +1290,7 @@ type ExprClosure struct { CloseCurlyBracketTkn *token.Token } -func (n *ExprClosure) Accept(v NodeVisitor) { +func (n *ExprClosure) Accept(v Visitor) { v.ExprClosure(n) } @@ -1305,7 +1305,7 @@ type ExprClosureUse struct { Var Vertex } -func (n *ExprClosureUse) Accept(v NodeVisitor) { +func (n *ExprClosureUse) Accept(v Visitor) { v.ExprClosureUse(n) } @@ -1319,7 +1319,7 @@ type ExprConstFetch struct { Const Vertex } -func (n *ExprConstFetch) Accept(v NodeVisitor) { +func (n *ExprConstFetch) Accept(v Visitor) { v.ExprConstFetch(n) } @@ -1336,7 +1336,7 @@ type ExprEmpty struct { CloseParenthesisTkn *token.Token } -func (n *ExprEmpty) Accept(v NodeVisitor) { +func (n *ExprEmpty) Accept(v Visitor) { v.ExprEmpty(n) } @@ -1351,7 +1351,7 @@ type ExprErrorSuppress struct { Expr Vertex } -func (n *ExprErrorSuppress) Accept(v NodeVisitor) { +func (n *ExprErrorSuppress) Accept(v Visitor) { v.ExprErrorSuppress(n) } @@ -1368,7 +1368,7 @@ type ExprEval struct { CloseParenthesisTkn *token.Token } -func (n *ExprEval) Accept(v NodeVisitor) { +func (n *ExprEval) Accept(v Visitor) { v.ExprEval(n) } @@ -1385,7 +1385,7 @@ type ExprExit struct { CloseParenthesisTkn *token.Token } -func (n *ExprExit) Accept(v NodeVisitor) { +func (n *ExprExit) Accept(v Visitor) { v.ExprExit(n) } @@ -1403,7 +1403,7 @@ type ExprFunctionCall struct { CloseParenthesisTkn *token.Token } -func (n *ExprFunctionCall) Accept(v NodeVisitor) { +func (n *ExprFunctionCall) Accept(v Visitor) { v.ExprFunctionCall(n) } @@ -1418,7 +1418,7 @@ type ExprInclude struct { Expr Vertex } -func (n *ExprInclude) Accept(v NodeVisitor) { +func (n *ExprInclude) Accept(v Visitor) { v.ExprInclude(n) } @@ -1433,7 +1433,7 @@ type ExprIncludeOnce struct { Expr Vertex } -func (n *ExprIncludeOnce) Accept(v NodeVisitor) { +func (n *ExprIncludeOnce) Accept(v Visitor) { v.ExprIncludeOnce(n) } @@ -1449,7 +1449,7 @@ type ExprInstanceOf struct { Class Vertex } -func (n *ExprInstanceOf) Accept(v NodeVisitor) { +func (n *ExprInstanceOf) Accept(v Visitor) { v.ExprInstanceOf(n) } @@ -1467,7 +1467,7 @@ type ExprIsset struct { CloseParenthesisTkn *token.Token } -func (n *ExprIsset) Accept(v NodeVisitor) { +func (n *ExprIsset) Accept(v Visitor) { v.ExprIsset(n) } @@ -1485,7 +1485,7 @@ type ExprList struct { CloseBracketTkn *token.Token } -func (n *ExprList) Accept(v NodeVisitor) { +func (n *ExprList) Accept(v Visitor) { v.ExprList(n) } @@ -1507,7 +1507,7 @@ type ExprMethodCall struct { CloseParenthesisTkn *token.Token } -func (n *ExprMethodCall) Accept(v NodeVisitor) { +func (n *ExprMethodCall) Accept(v Visitor) { v.ExprMethodCall(n) } @@ -1526,7 +1526,7 @@ type ExprNew struct { CloseParenthesisTkn *token.Token } -func (n *ExprNew) Accept(v NodeVisitor) { +func (n *ExprNew) Accept(v Visitor) { v.ExprNew(n) } @@ -1541,7 +1541,7 @@ type ExprPostDec struct { DecTkn *token.Token } -func (n *ExprPostDec) Accept(v NodeVisitor) { +func (n *ExprPostDec) Accept(v Visitor) { v.ExprPostDec(n) } @@ -1556,7 +1556,7 @@ type ExprPostInc struct { IncTkn *token.Token } -func (n *ExprPostInc) Accept(v NodeVisitor) { +func (n *ExprPostInc) Accept(v Visitor) { v.ExprPostInc(n) } @@ -1571,7 +1571,7 @@ type ExprPreDec struct { Var Vertex } -func (n *ExprPreDec) Accept(v NodeVisitor) { +func (n *ExprPreDec) Accept(v Visitor) { v.ExprPreDec(n) } @@ -1586,7 +1586,7 @@ type ExprPreInc struct { Var Vertex } -func (n *ExprPreInc) Accept(v NodeVisitor) { +func (n *ExprPreInc) Accept(v Visitor) { v.ExprPreInc(n) } @@ -1601,7 +1601,7 @@ type ExprPrint struct { Expr Vertex } -func (n *ExprPrint) Accept(v NodeVisitor) { +func (n *ExprPrint) Accept(v Visitor) { v.ExprPrint(n) } @@ -1619,7 +1619,7 @@ type ExprPropertyFetch struct { CloseCurlyBracketTkn *token.Token } -func (n *ExprPropertyFetch) Accept(v NodeVisitor) { +func (n *ExprPropertyFetch) Accept(v Visitor) { v.ExprPropertyFetch(n) } @@ -1634,7 +1634,7 @@ type ExprRequire struct { Expr Vertex } -func (n *ExprRequire) Accept(v NodeVisitor) { +func (n *ExprRequire) Accept(v Visitor) { v.ExprRequire(n) } @@ -1649,7 +1649,7 @@ type ExprRequireOnce struct { Expr Vertex } -func (n *ExprRequireOnce) Accept(v NodeVisitor) { +func (n *ExprRequireOnce) Accept(v Visitor) { v.ExprRequireOnce(n) } @@ -1665,7 +1665,7 @@ type ExprShellExec struct { CloseBacktickTkn *token.Token } -func (n *ExprShellExec) Accept(v NodeVisitor) { +func (n *ExprShellExec) Accept(v Visitor) { v.ExprShellExec(n) } @@ -1687,7 +1687,7 @@ type ExprStaticCall struct { CloseParenthesisTkn *token.Token } -func (n *ExprStaticCall) Accept(v NodeVisitor) { +func (n *ExprStaticCall) Accept(v Visitor) { v.ExprStaticCall(n) } @@ -1703,7 +1703,7 @@ type ExprStaticPropertyFetch struct { Property Vertex } -func (n *ExprStaticPropertyFetch) Accept(v NodeVisitor) { +func (n *ExprStaticPropertyFetch) Accept(v Visitor) { v.ExprStaticPropertyFetch(n) } @@ -1721,7 +1721,7 @@ type ExprTernary struct { IfFalse Vertex } -func (n *ExprTernary) Accept(v NodeVisitor) { +func (n *ExprTernary) Accept(v Visitor) { v.ExprTernary(n) } @@ -1736,7 +1736,7 @@ type ExprUnaryMinus struct { Expr Vertex } -func (n *ExprUnaryMinus) Accept(v NodeVisitor) { +func (n *ExprUnaryMinus) Accept(v Visitor) { v.ExprUnaryMinus(n) } @@ -1751,7 +1751,7 @@ type ExprUnaryPlus struct { Expr Vertex } -func (n *ExprUnaryPlus) Accept(v NodeVisitor) { +func (n *ExprUnaryPlus) Accept(v Visitor) { v.ExprUnaryPlus(n) } @@ -1768,7 +1768,7 @@ type ExprVariable struct { CloseCurlyBracketTkn *token.Token } -func (n *ExprVariable) Accept(v NodeVisitor) { +func (n *ExprVariable) Accept(v Visitor) { v.ExprVariable(n) } @@ -1785,7 +1785,7 @@ type ExprYield struct { Value Vertex } -func (n *ExprYield) Accept(v NodeVisitor) { +func (n *ExprYield) Accept(v Visitor) { v.ExprYield(n) } @@ -1800,7 +1800,7 @@ type ExprYieldFrom struct { Expr Vertex } -func (n *ExprYieldFrom) Accept(v NodeVisitor) { +func (n *ExprYieldFrom) Accept(v Visitor) { v.ExprYieldFrom(n) } @@ -1815,7 +1815,7 @@ type ExprCastArray struct { Expr Vertex } -func (n *ExprCastArray) Accept(v NodeVisitor) { +func (n *ExprCastArray) Accept(v Visitor) { v.ExprCastArray(n) } @@ -1830,7 +1830,7 @@ type ExprCastBool struct { Expr Vertex } -func (n *ExprCastBool) Accept(v NodeVisitor) { +func (n *ExprCastBool) Accept(v Visitor) { v.ExprCastBool(n) } @@ -1845,7 +1845,7 @@ type ExprCastDouble struct { Expr Vertex } -func (n *ExprCastDouble) Accept(v NodeVisitor) { +func (n *ExprCastDouble) Accept(v Visitor) { v.ExprCastDouble(n) } @@ -1860,7 +1860,7 @@ type ExprCastInt struct { Expr Vertex } -func (n *ExprCastInt) Accept(v NodeVisitor) { +func (n *ExprCastInt) Accept(v Visitor) { v.ExprCastInt(n) } @@ -1875,7 +1875,7 @@ type ExprCastObject struct { Expr Vertex } -func (n *ExprCastObject) Accept(v NodeVisitor) { +func (n *ExprCastObject) Accept(v Visitor) { v.ExprCastObject(n) } @@ -1890,7 +1890,7 @@ type ExprCastString struct { Expr Vertex } -func (n *ExprCastString) Accept(v NodeVisitor) { +func (n *ExprCastString) Accept(v Visitor) { v.ExprCastString(n) } @@ -1905,7 +1905,7 @@ type ExprCastUnset struct { Expr Vertex } -func (n *ExprCastUnset) Accept(v NodeVisitor) { +func (n *ExprCastUnset) Accept(v Visitor) { v.ExprCastUnset(n) } @@ -1921,7 +1921,7 @@ type ExprAssign struct { Expr Vertex } -func (n *ExprAssign) Accept(v NodeVisitor) { +func (n *ExprAssign) Accept(v Visitor) { v.ExprAssign(n) } @@ -1938,7 +1938,7 @@ type ExprAssignReference struct { Expr Vertex } -func (n *ExprAssignReference) Accept(v NodeVisitor) { +func (n *ExprAssignReference) Accept(v Visitor) { v.ExprAssignReference(n) } @@ -1954,7 +1954,7 @@ type ExprAssignBitwiseAnd struct { Expr Vertex } -func (n *ExprAssignBitwiseAnd) Accept(v NodeVisitor) { +func (n *ExprAssignBitwiseAnd) Accept(v Visitor) { v.ExprAssignBitwiseAnd(n) } @@ -1970,7 +1970,7 @@ type ExprAssignBitwiseOr struct { Expr Vertex } -func (n *ExprAssignBitwiseOr) Accept(v NodeVisitor) { +func (n *ExprAssignBitwiseOr) Accept(v Visitor) { v.ExprAssignBitwiseOr(n) } @@ -1986,7 +1986,7 @@ type ExprAssignBitwiseXor struct { Expr Vertex } -func (n *ExprAssignBitwiseXor) Accept(v NodeVisitor) { +func (n *ExprAssignBitwiseXor) Accept(v Visitor) { v.ExprAssignBitwiseXor(n) } @@ -2002,7 +2002,7 @@ type ExprAssignCoalesce struct { Expr Vertex } -func (n *ExprAssignCoalesce) Accept(v NodeVisitor) { +func (n *ExprAssignCoalesce) Accept(v Visitor) { v.ExprAssignCoalesce(n) } @@ -2018,7 +2018,7 @@ type ExprAssignConcat struct { Expr Vertex } -func (n *ExprAssignConcat) Accept(v NodeVisitor) { +func (n *ExprAssignConcat) Accept(v Visitor) { v.ExprAssignConcat(n) } @@ -2034,7 +2034,7 @@ type ExprAssignDiv struct { Expr Vertex } -func (n *ExprAssignDiv) Accept(v NodeVisitor) { +func (n *ExprAssignDiv) Accept(v Visitor) { v.ExprAssignDiv(n) } @@ -2050,7 +2050,7 @@ type ExprAssignMinus struct { Expr Vertex } -func (n *ExprAssignMinus) Accept(v NodeVisitor) { +func (n *ExprAssignMinus) Accept(v Visitor) { v.ExprAssignMinus(n) } @@ -2066,7 +2066,7 @@ type ExprAssignMod struct { Expr Vertex } -func (n *ExprAssignMod) Accept(v NodeVisitor) { +func (n *ExprAssignMod) Accept(v Visitor) { v.ExprAssignMod(n) } @@ -2082,7 +2082,7 @@ type ExprAssignMul struct { Expr Vertex } -func (n *ExprAssignMul) Accept(v NodeVisitor) { +func (n *ExprAssignMul) Accept(v Visitor) { v.ExprAssignMul(n) } @@ -2098,7 +2098,7 @@ type ExprAssignPlus struct { Expr Vertex } -func (n *ExprAssignPlus) Accept(v NodeVisitor) { +func (n *ExprAssignPlus) Accept(v Visitor) { v.ExprAssignPlus(n) } @@ -2114,7 +2114,7 @@ type ExprAssignPow struct { Expr Vertex } -func (n *ExprAssignPow) Accept(v NodeVisitor) { +func (n *ExprAssignPow) Accept(v Visitor) { v.ExprAssignPow(n) } @@ -2130,7 +2130,7 @@ type ExprAssignShiftLeft struct { Expr Vertex } -func (n *ExprAssignShiftLeft) Accept(v NodeVisitor) { +func (n *ExprAssignShiftLeft) Accept(v Visitor) { v.ExprAssignShiftLeft(n) } @@ -2146,7 +2146,7 @@ type ExprAssignShiftRight struct { Expr Vertex } -func (n *ExprAssignShiftRight) Accept(v NodeVisitor) { +func (n *ExprAssignShiftRight) Accept(v Visitor) { v.ExprAssignShiftRight(n) } @@ -2162,7 +2162,7 @@ type ExprBinaryBitwiseAnd struct { Right Vertex } -func (n *ExprBinaryBitwiseAnd) Accept(v NodeVisitor) { +func (n *ExprBinaryBitwiseAnd) Accept(v Visitor) { v.ExprBinaryBitwiseAnd(n) } @@ -2178,7 +2178,7 @@ type ExprBinaryBitwiseOr struct { Right Vertex } -func (n *ExprBinaryBitwiseOr) Accept(v NodeVisitor) { +func (n *ExprBinaryBitwiseOr) Accept(v Visitor) { v.ExprBinaryBitwiseOr(n) } @@ -2194,7 +2194,7 @@ type ExprBinaryBitwiseXor struct { Right Vertex } -func (n *ExprBinaryBitwiseXor) Accept(v NodeVisitor) { +func (n *ExprBinaryBitwiseXor) Accept(v Visitor) { v.ExprBinaryBitwiseXor(n) } @@ -2210,7 +2210,7 @@ type ExprBinaryBooleanAnd struct { Right Vertex } -func (n *ExprBinaryBooleanAnd) Accept(v NodeVisitor) { +func (n *ExprBinaryBooleanAnd) Accept(v Visitor) { v.ExprBinaryBooleanAnd(n) } @@ -2226,7 +2226,7 @@ type ExprBinaryBooleanOr struct { Right Vertex } -func (n *ExprBinaryBooleanOr) Accept(v NodeVisitor) { +func (n *ExprBinaryBooleanOr) Accept(v Visitor) { v.ExprBinaryBooleanOr(n) } @@ -2242,7 +2242,7 @@ type ExprBinaryCoalesce struct { Right Vertex } -func (n *ExprBinaryCoalesce) Accept(v NodeVisitor) { +func (n *ExprBinaryCoalesce) Accept(v Visitor) { v.ExprBinaryCoalesce(n) } @@ -2258,7 +2258,7 @@ type ExprBinaryConcat struct { Right Vertex } -func (n *ExprBinaryConcat) Accept(v NodeVisitor) { +func (n *ExprBinaryConcat) Accept(v Visitor) { v.ExprBinaryConcat(n) } @@ -2274,7 +2274,7 @@ type ExprBinaryDiv struct { Right Vertex } -func (n *ExprBinaryDiv) Accept(v NodeVisitor) { +func (n *ExprBinaryDiv) Accept(v Visitor) { v.ExprBinaryDiv(n) } @@ -2290,7 +2290,7 @@ type ExprBinaryEqual struct { Right Vertex } -func (n *ExprBinaryEqual) Accept(v NodeVisitor) { +func (n *ExprBinaryEqual) Accept(v Visitor) { v.ExprBinaryEqual(n) } @@ -2306,7 +2306,7 @@ type ExprBinaryGreater struct { Right Vertex } -func (n *ExprBinaryGreater) Accept(v NodeVisitor) { +func (n *ExprBinaryGreater) Accept(v Visitor) { v.ExprBinaryGreater(n) } @@ -2322,7 +2322,7 @@ type ExprBinaryGreaterOrEqual struct { Right Vertex } -func (n *ExprBinaryGreaterOrEqual) Accept(v NodeVisitor) { +func (n *ExprBinaryGreaterOrEqual) Accept(v Visitor) { v.ExprBinaryGreaterOrEqual(n) } @@ -2338,7 +2338,7 @@ type ExprBinaryIdentical struct { Right Vertex } -func (n *ExprBinaryIdentical) Accept(v NodeVisitor) { +func (n *ExprBinaryIdentical) Accept(v Visitor) { v.ExprBinaryIdentical(n) } @@ -2354,7 +2354,7 @@ type ExprBinaryLogicalAnd struct { Right Vertex } -func (n *ExprBinaryLogicalAnd) Accept(v NodeVisitor) { +func (n *ExprBinaryLogicalAnd) Accept(v Visitor) { v.ExprBinaryLogicalAnd(n) } @@ -2370,7 +2370,7 @@ type ExprBinaryLogicalOr struct { Right Vertex } -func (n *ExprBinaryLogicalOr) Accept(v NodeVisitor) { +func (n *ExprBinaryLogicalOr) Accept(v Visitor) { v.ExprBinaryLogicalOr(n) } @@ -2386,7 +2386,7 @@ type ExprBinaryLogicalXor struct { Right Vertex } -func (n *ExprBinaryLogicalXor) Accept(v NodeVisitor) { +func (n *ExprBinaryLogicalXor) Accept(v Visitor) { v.ExprBinaryLogicalXor(n) } @@ -2402,7 +2402,7 @@ type ExprBinaryMinus struct { Right Vertex } -func (n *ExprBinaryMinus) Accept(v NodeVisitor) { +func (n *ExprBinaryMinus) Accept(v Visitor) { v.ExprBinaryMinus(n) } @@ -2418,7 +2418,7 @@ type ExprBinaryMod struct { Right Vertex } -func (n *ExprBinaryMod) Accept(v NodeVisitor) { +func (n *ExprBinaryMod) Accept(v Visitor) { v.ExprBinaryMod(n) } @@ -2434,7 +2434,7 @@ type ExprBinaryMul struct { Right Vertex } -func (n *ExprBinaryMul) Accept(v NodeVisitor) { +func (n *ExprBinaryMul) Accept(v Visitor) { v.ExprBinaryMul(n) } @@ -2450,7 +2450,7 @@ type ExprBinaryNotEqual struct { Right Vertex } -func (n *ExprBinaryNotEqual) Accept(v NodeVisitor) { +func (n *ExprBinaryNotEqual) Accept(v Visitor) { v.ExprBinaryNotEqual(n) } @@ -2466,7 +2466,7 @@ type ExprBinaryNotIdentical struct { Right Vertex } -func (n *ExprBinaryNotIdentical) Accept(v NodeVisitor) { +func (n *ExprBinaryNotIdentical) Accept(v Visitor) { v.ExprBinaryNotIdentical(n) } @@ -2482,7 +2482,7 @@ type ExprBinaryPlus struct { Right Vertex } -func (n *ExprBinaryPlus) Accept(v NodeVisitor) { +func (n *ExprBinaryPlus) Accept(v Visitor) { v.ExprBinaryPlus(n) } @@ -2498,7 +2498,7 @@ type ExprBinaryPow struct { Right Vertex } -func (n *ExprBinaryPow) Accept(v NodeVisitor) { +func (n *ExprBinaryPow) Accept(v Visitor) { v.ExprBinaryPow(n) } @@ -2514,7 +2514,7 @@ type ExprBinaryShiftLeft struct { Right Vertex } -func (n *ExprBinaryShiftLeft) Accept(v NodeVisitor) { +func (n *ExprBinaryShiftLeft) Accept(v Visitor) { v.ExprBinaryShiftLeft(n) } @@ -2530,7 +2530,7 @@ type ExprBinaryShiftRight struct { Right Vertex } -func (n *ExprBinaryShiftRight) Accept(v NodeVisitor) { +func (n *ExprBinaryShiftRight) Accept(v Visitor) { v.ExprBinaryShiftRight(n) } @@ -2546,7 +2546,7 @@ type ExprBinarySmaller struct { Right Vertex } -func (n *ExprBinarySmaller) Accept(v NodeVisitor) { +func (n *ExprBinarySmaller) Accept(v Visitor) { v.ExprBinarySmaller(n) } @@ -2562,7 +2562,7 @@ type ExprBinarySmallerOrEqual struct { Right Vertex } -func (n *ExprBinarySmallerOrEqual) Accept(v NodeVisitor) { +func (n *ExprBinarySmallerOrEqual) Accept(v Visitor) { v.ExprBinarySmallerOrEqual(n) } @@ -2578,7 +2578,7 @@ type ExprBinarySpaceship struct { Right Vertex } -func (n *ExprBinarySpaceship) Accept(v NodeVisitor) { +func (n *ExprBinarySpaceship) Accept(v Visitor) { v.ExprBinarySpaceship(n) } @@ -2592,7 +2592,7 @@ type NameName struct { SeparatorTkns []*token.Token } -func (n *NameName) Accept(v NodeVisitor) { +func (n *NameName) Accept(v Visitor) { v.NameName(n) } @@ -2607,7 +2607,7 @@ type NameFullyQualified struct { SeparatorTkns []*token.Token } -func (n *NameFullyQualified) Accept(v NodeVisitor) { +func (n *NameFullyQualified) Accept(v Visitor) { v.NameFullyQualified(n) } @@ -2623,7 +2623,7 @@ type NameRelative struct { SeparatorTkns []*token.Token } -func (n *NameRelative) Accept(v NodeVisitor) { +func (n *NameRelative) Accept(v Visitor) { v.NameRelative(n) } @@ -2637,7 +2637,7 @@ type NameNamePart struct { Value []byte } -func (n *NameNamePart) Accept(v NodeVisitor) { +func (n *NameNamePart) Accept(v Visitor) { v.NameNamePart(n) } @@ -2654,7 +2654,7 @@ type ParserBrackets struct { CloseBracketTkn *token.Token } -func (n *ParserBrackets) Accept(v NodeVisitor) { +func (n *ParserBrackets) Accept(v Visitor) { // do nothing } @@ -2668,7 +2668,7 @@ type ParserSeparatedList struct { SeparatorTkns []*token.Token } -func (n *ParserSeparatedList) Accept(v NodeVisitor) { +func (n *ParserSeparatedList) Accept(v Visitor) { // do nothing } @@ -2684,7 +2684,7 @@ type TraitAdaptationList struct { CloseCurlyBracketTkn *token.Token } -func (n *TraitAdaptationList) Accept(v NodeVisitor) { +func (n *TraitAdaptationList) Accept(v Visitor) { // do nothing } @@ -2701,7 +2701,7 @@ type ArgumentList struct { CloseParenthesisTkn *token.Token } -func (n *ArgumentList) Accept(v NodeVisitor) { +func (n *ArgumentList) Accept(v Visitor) { // do nothing } @@ -2715,7 +2715,7 @@ type ReturnType struct { Type Vertex } -func (n *ReturnType) Accept(v NodeVisitor) { +func (n *ReturnType) Accept(v Visitor) { // do nothing } @@ -2731,7 +2731,7 @@ type TraitMethodRef struct { Method Vertex } -func (n *TraitMethodRef) Accept(v NodeVisitor) { +func (n *TraitMethodRef) Accept(v Visitor) { // do nothing } diff --git a/pkg/ast/traverser/dfs.go b/pkg/ast/traverser/dfs.go deleted file mode 100644 index 716bb30..0000000 --- a/pkg/ast/traverser/dfs.go +++ /dev/null @@ -1,2533 +0,0 @@ -package traverser - -import "github.com/z7zmey/php-parser/pkg/ast" - -type DFS struct { - visitor ast.Visitor -} - -func NewDFS(visitor ast.Visitor) *DFS { - return &DFS{ - visitor: visitor, - } -} - -func (t *DFS) Traverse(n ast.Vertex) { - switch nn := n.(type) { - case *ast.Root: - if nn == nil { - return - } - if !t.visitor.EnterNode(nn) { - return - } - if nn.Stmts != nil { - t.visitor.Enter("Stmts", false) - for _, c := range nn.Stmts { - t.Traverse(c) - } - t.visitor.Leave("Stmts", false) - } - case *ast.Nullable: - if nn == nil { - return - } - if !t.visitor.EnterNode(nn) { - return - } - if nn.Expr != nil { - t.visitor.Enter("Expr", true) - t.Traverse(nn.Expr) - t.visitor.Leave("Expr", true) - } - case *ast.Parameter: - 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.Var != nil { - t.visitor.Enter("Var", true) - t.Traverse(nn.Var) - t.visitor.Leave("Var", true) - } - if nn.DefaultValue != nil { - t.visitor.Enter("DefaultValue", true) - t.Traverse(nn.DefaultValue) - t.visitor.Leave("DefaultValue", true) - } - case *ast.Identifier: - if nn == nil { - return - } - if !t.visitor.EnterNode(nn) { - return - } - case *ast.Argument: - if nn == nil { - return - } - if !t.visitor.EnterNode(nn) { - return - } - if nn.Expr != nil { - t.visitor.Enter("Expr", true) - t.Traverse(nn.Expr) - t.visitor.Leave("Expr", true) - } - case *ast.StmtBreak: - if nn == nil { - return - } - if !t.visitor.EnterNode(nn) { - return - } - if nn.Expr != nil { - t.visitor.Enter("Expr", true) - t.Traverse(nn.Expr) - t.visitor.Leave("Expr", true) - } - case *ast.StmtCase: - if nn == nil { - return - } - if !t.visitor.EnterNode(nn) { - return - } - if nn.Cond != nil { - t.visitor.Enter("Cond", true) - t.Traverse(nn.Cond) - t.visitor.Leave("Cond", true) - } - if nn.Stmts != nil { - t.visitor.Enter("Stmts", false) - for _, c := range nn.Stmts { - t.Traverse(c) - } - t.visitor.Leave("Stmts", false) - } - case *ast.StmtCatch: - if nn == nil { - return - } - if !t.visitor.EnterNode(nn) { - return - } - if nn.Types != nil { - t.visitor.Enter("Types", false) - for _, c := range nn.Types { - t.Traverse(c) - } - t.visitor.Leave("Types", false) - } - if nn.Var != nil { - t.visitor.Enter("Var", true) - t.Traverse(nn.Var) - t.visitor.Leave("Var", true) - } - if nn.Stmts != nil { - t.visitor.Enter("Stmts", false) - for _, c := range nn.Stmts { - t.Traverse(c) - } - t.visitor.Leave("Stmts", false) - } - case *ast.StmtClass: - if nn == nil { - return - } - if !t.visitor.EnterNode(nn) { - return - } - if nn.ClassName != nil { - t.visitor.Enter("ClassName", true) - t.Traverse(nn.ClassName) - t.visitor.Leave("ClassName", true) - } - if nn.Modifiers != nil { - t.visitor.Enter("Modifiers", false) - for _, c := range nn.Modifiers { - t.Traverse(c) - } - t.visitor.Leave("Modifiers", false) - } - if nn.Arguments != nil { - t.visitor.Enter("Arguments", false) - for _, c := range nn.Arguments { - t.Traverse(c) - } - t.visitor.Leave("Arguments", false) - } - if nn.Extends != nil { - t.visitor.Enter("Extends", true) - t.Traverse(nn.Extends) - t.visitor.Leave("Extends", true) - } - if nn.Implements != nil { - t.visitor.Enter("Implements", false) - for _, c := range nn.Implements { - t.Traverse(c) - } - t.visitor.Leave("Implements", false) - } - if nn.Stmts != nil { - t.visitor.Enter("Stmts", false) - for _, c := range nn.Stmts { - t.Traverse(c) - } - t.visitor.Leave("Stmts", false) - } - case *ast.StmtClassConstList: - if nn == nil { - return - } - if !t.visitor.EnterNode(nn) { - return - } - if nn.Modifiers != nil { - t.visitor.Enter("Modifiers", false) - for _, c := range nn.Modifiers { - t.Traverse(c) - } - t.visitor.Leave("Modifiers", false) - } - if nn.Consts != nil { - t.visitor.Enter("Consts", false) - for _, c := range nn.Consts { - t.Traverse(c) - } - t.visitor.Leave("Consts", false) - } - case *ast.StmtClassMethod: - if nn == nil { - return - } - if !t.visitor.EnterNode(nn) { - return - } - if nn.MethodName != nil { - t.visitor.Enter("MethodName", true) - t.Traverse(nn.MethodName) - t.visitor.Leave("MethodName", true) - } - if nn.Modifiers != nil { - t.visitor.Enter("Modifiers", false) - for _, c := range nn.Modifiers { - t.Traverse(c) - } - t.visitor.Leave("Modifiers", false) - } - if nn.Params != nil { - t.visitor.Enter("Params", false) - for _, c := range nn.Params { - t.Traverse(c) - } - t.visitor.Leave("Params", false) - } - if nn.ReturnType != nil { - t.visitor.Enter("ReturnType", true) - t.Traverse(nn.ReturnType) - t.visitor.Leave("ReturnType", true) - } - if nn.Stmt != nil { - t.visitor.Enter("Stmt", true) - t.Traverse(nn.Stmt) - t.visitor.Leave("Stmt", true) - } - case *ast.StmtConstList: - if nn == nil { - return - } - if !t.visitor.EnterNode(nn) { - return - } - if nn.Consts != nil { - t.visitor.Enter("Consts", false) - for _, c := range nn.Consts { - t.Traverse(c) - } - t.visitor.Leave("Consts", false) - } - case *ast.StmtConstant: - if nn == nil { - return - } - if !t.visitor.EnterNode(nn) { - return - } - if nn.Name != nil { - t.visitor.Enter("Name", true) - t.Traverse(nn.Name) - t.visitor.Leave("Name", true) - } - if nn.Expr != nil { - t.visitor.Enter("Expr", true) - t.Traverse(nn.Expr) - t.visitor.Leave("Expr", true) - } - case *ast.StmtContinue: - if nn == nil { - return - } - if !t.visitor.EnterNode(nn) { - return - } - if nn.Expr != nil { - t.visitor.Enter("Expr", true) - t.Traverse(nn.Expr) - t.visitor.Leave("Expr", true) - } - case *ast.StmtDeclare: - if nn == nil { - return - } - if !t.visitor.EnterNode(nn) { - return - } - if nn.Consts != nil { - t.visitor.Enter("Consts", false) - for _, c := range nn.Consts { - t.Traverse(c) - } - t.visitor.Leave("Consts", false) - } - if nn.Stmt != nil { - t.visitor.Enter("Stmt", true) - t.Traverse(nn.Stmt) - t.visitor.Leave("Stmt", true) - } - case *ast.StmtDefault: - if nn == nil { - return - } - if !t.visitor.EnterNode(nn) { - return - } - if nn.Stmts != nil { - t.visitor.Enter("Stmts", false) - for _, c := range nn.Stmts { - t.Traverse(c) - } - t.visitor.Leave("Stmts", false) - } - case *ast.StmtDo: - if nn == nil { - return - } - if !t.visitor.EnterNode(nn) { - return - } - if nn.Stmt != nil { - t.visitor.Enter("Stmt", true) - t.Traverse(nn.Stmt) - t.visitor.Leave("Stmt", true) - } - if nn.Cond != nil { - t.visitor.Enter("Cond", true) - t.Traverse(nn.Cond) - t.visitor.Leave("Cond", true) - } - case *ast.StmtEcho: - if nn == nil { - return - } - if !t.visitor.EnterNode(nn) { - return - } - if nn.Exprs != nil { - t.visitor.Enter("Exprs", false) - for _, c := range nn.Exprs { - t.Traverse(c) - } - t.visitor.Leave("Exprs", false) - } - case *ast.StmtElse: - if nn == nil { - return - } - if !t.visitor.EnterNode(nn) { - return - } - if nn.Stmt != nil { - t.visitor.Enter("Stmt", true) - t.Traverse(nn.Stmt) - t.visitor.Leave("Stmt", true) - } - case *ast.StmtElseIf: - if nn == nil { - return - } - if !t.visitor.EnterNode(nn) { - return - } - if nn.Cond != nil { - t.visitor.Enter("Cond", true) - t.Traverse(nn.Cond) - t.visitor.Leave("Cond", true) - } - if nn.Stmt != nil { - t.visitor.Enter("Stmt", true) - t.Traverse(nn.Stmt) - t.visitor.Leave("Stmt", true) - } - case *ast.StmtExpression: - if nn == nil { - return - } - if !t.visitor.EnterNode(nn) { - return - } - if nn.Expr != nil { - t.visitor.Enter("Expr", true) - t.Traverse(nn.Expr) - t.visitor.Leave("Expr", true) - } - case *ast.StmtFinally: - if nn == nil { - return - } - if !t.visitor.EnterNode(nn) { - return - } - if nn.Stmts != nil { - t.visitor.Enter("Stmts", false) - for _, c := range nn.Stmts { - t.Traverse(c) - } - t.visitor.Leave("Stmts", false) - } - case *ast.StmtFor: - if nn == nil { - return - } - if !t.visitor.EnterNode(nn) { - return - } - if nn.Init != nil { - t.visitor.Enter("Init", false) - for _, c := range nn.Init { - t.Traverse(c) - } - t.visitor.Leave("Init", false) - } - if nn.Cond != nil { - t.visitor.Enter("Cond", false) - for _, c := range nn.Cond { - t.Traverse(c) - } - t.visitor.Leave("Cond", false) - } - if nn.Loop != nil { - t.visitor.Enter("Loop", false) - for _, c := range nn.Loop { - t.Traverse(c) - } - t.visitor.Leave("Loop", false) - } - if nn.Stmt != nil { - t.visitor.Enter("Stmt", true) - t.Traverse(nn.Stmt) - t.visitor.Leave("Stmt", true) - } - case *ast.StmtForeach: - if nn == nil { - return - } - if !t.visitor.EnterNode(nn) { - return - } - if nn.Expr != nil { - t.visitor.Enter("Expr", true) - t.Traverse(nn.Expr) - t.visitor.Leave("Expr", true) - } - if nn.Key != nil { - t.visitor.Enter("Key", true) - t.Traverse(nn.Key) - t.visitor.Leave("Key", true) - } - if nn.Var != nil { - t.visitor.Enter("Var", true) - t.Traverse(nn.Var) - t.visitor.Leave("Var", true) - } - if nn.Stmt != nil { - t.visitor.Enter("Stmt", true) - t.Traverse(nn.Stmt) - t.visitor.Leave("Stmt", true) - } - case *ast.StmtFunction: - if nn == nil { - return - } - if !t.visitor.EnterNode(nn) { - return - } - if nn.FunctionName != nil { - t.visitor.Enter("FunctionName", true) - t.Traverse(nn.FunctionName) - t.visitor.Leave("FunctionName", true) - } - if nn.Params != nil { - t.visitor.Enter("Params", false) - for _, c := range nn.Params { - t.Traverse(c) - } - t.visitor.Leave("Params", false) - } - if nn.ReturnType != nil { - t.visitor.Enter("ReturnType", true) - t.Traverse(nn.ReturnType) - t.visitor.Leave("ReturnType", true) - } - if nn.Stmts != nil { - t.visitor.Enter("Stmts", false) - for _, c := range nn.Stmts { - t.Traverse(c) - } - t.visitor.Leave("Stmts", false) - } - case *ast.StmtGlobal: - if nn == nil { - return - } - if !t.visitor.EnterNode(nn) { - return - } - if nn.Vars != nil { - t.visitor.Enter("Vars", false) - for _, c := range nn.Vars { - t.Traverse(c) - } - t.visitor.Leave("Vars", false) - } - case *ast.StmtGoto: - if nn == nil { - return - } - if !t.visitor.EnterNode(nn) { - return - } - if nn.Label != nil { - t.visitor.Enter("Label", true) - t.Traverse(nn.Label) - t.visitor.Leave("Label", true) - } - case *ast.StmtHaltCompiler: - if nn == nil { - return - } - if !t.visitor.EnterNode(nn) { - return - } - case *ast.StmtIf: - if nn == nil { - return - } - if !t.visitor.EnterNode(nn) { - return - } - if nn.Cond != nil { - t.visitor.Enter("Cond", true) - t.Traverse(nn.Cond) - t.visitor.Leave("Cond", true) - } - if nn.Stmt != nil { - t.visitor.Enter("Stmt", true) - t.Traverse(nn.Stmt) - t.visitor.Leave("Stmt", true) - } - if nn.ElseIf != nil { - t.visitor.Enter("ElseIf", false) - for _, c := range nn.ElseIf { - t.Traverse(c) - } - t.visitor.Leave("ElseIf", false) - } - if nn.Else != nil { - t.visitor.Enter("Else", true) - t.Traverse(nn.Else) - t.visitor.Leave("Else", true) - } - case *ast.StmtInlineHtml: - if nn == nil { - return - } - if !t.visitor.EnterNode(nn) { - return - } - case *ast.StmtInterface: - if nn == nil { - return - } - if !t.visitor.EnterNode(nn) { - return - } - if nn.InterfaceName != nil { - t.visitor.Enter("InterfaceName", true) - t.Traverse(nn.InterfaceName) - t.visitor.Leave("InterfaceName", true) - } - if nn.Extends != nil { - t.visitor.Enter("Extends", false) - for _, c := range nn.Extends { - t.Traverse(c) - } - t.visitor.Leave("Extends", false) - } - if nn.Stmts != nil { - t.visitor.Enter("Stmts", false) - for _, c := range nn.Stmts { - t.Traverse(c) - } - t.visitor.Leave("Stmts", false) - } - case *ast.StmtLabel: - if nn == nil { - return - } - if !t.visitor.EnterNode(nn) { - return - } - if nn.LabelName != nil { - t.visitor.Enter("LabelName", true) - t.Traverse(nn.LabelName) - t.visitor.Leave("LabelName", true) - } - case *ast.StmtNamespace: - if nn == nil { - return - } - if !t.visitor.EnterNode(nn) { - return - } - if nn.Name != nil { - t.visitor.Enter("Name", true) - t.Traverse(nn.Name) - t.visitor.Leave("Name", true) - } - if nn.Stmts != nil { - t.visitor.Enter("Stmts", false) - for _, c := range nn.Stmts { - t.Traverse(c) - } - t.visitor.Leave("Stmts", false) - } - case *ast.StmtNop: - if nn == nil { - return - } - if !t.visitor.EnterNode(nn) { - return - } - case *ast.StmtProperty: - if nn == nil { - return - } - if !t.visitor.EnterNode(nn) { - return - } - if nn.Var != nil { - t.visitor.Enter("Var", true) - t.Traverse(nn.Var) - t.visitor.Leave("Var", true) - } - if nn.Expr != nil { - t.visitor.Enter("Expr", true) - t.Traverse(nn.Expr) - t.visitor.Leave("Expr", true) - } - case *ast.StmtPropertyList: - if nn == nil { - return - } - if !t.visitor.EnterNode(nn) { - return - } - if nn.Modifiers != nil { - t.visitor.Enter("Modifiers", false) - for _, c := range nn.Modifiers { - t.Traverse(c) - } - t.visitor.Leave("Modifiers", false) - } - if nn.Type != nil { - t.visitor.Enter("Type", true) - t.Traverse(nn.Type) - t.visitor.Leave("Type", true) - } - if nn.Properties != nil { - t.visitor.Enter("Properties", false) - for _, c := range nn.Properties { - t.Traverse(c) - } - t.visitor.Leave("Properties", false) - } - case *ast.StmtReturn: - if nn == nil { - return - } - if !t.visitor.EnterNode(nn) { - return - } - if nn.Expr != nil { - t.visitor.Enter("Expr", true) - t.Traverse(nn.Expr) - t.visitor.Leave("Expr", true) - } - case *ast.StmtStatic: - if nn == nil { - return - } - if !t.visitor.EnterNode(nn) { - return - } - if nn.Vars != nil { - t.visitor.Enter("Vars", false) - for _, c := range nn.Vars { - t.Traverse(c) - } - t.visitor.Leave("Vars", false) - } - case *ast.StmtStaticVar: - if nn == nil { - return - } - if !t.visitor.EnterNode(nn) { - return - } - if nn.Var != nil { - t.visitor.Enter("Var", true) - t.Traverse(nn.Var) - t.visitor.Leave("Var", true) - } - if nn.Expr != nil { - t.visitor.Enter("Expr", true) - t.Traverse(nn.Expr) - t.visitor.Leave("Expr", true) - } - case *ast.StmtStmtList: - if nn == nil { - return - } - if !t.visitor.EnterNode(nn) { - return - } - if nn.Stmts != nil { - t.visitor.Enter("Stmts", false) - for _, c := range nn.Stmts { - t.Traverse(c) - } - t.visitor.Leave("Stmts", false) - } - case *ast.StmtSwitch: - if nn == nil { - return - } - if !t.visitor.EnterNode(nn) { - return - } - if nn.Cond != nil { - t.visitor.Enter("Cond", true) - t.Traverse(nn.Cond) - t.visitor.Leave("Cond", true) - } - if nn.CaseList != nil { - t.visitor.Enter("CaseList", false) - for _, c := range nn.CaseList { - t.Traverse(c) - } - t.visitor.Leave("CaseList", false) - } - case *ast.StmtThrow: - if nn == nil { - return - } - if !t.visitor.EnterNode(nn) { - return - } - if nn.Expr != nil { - t.visitor.Enter("Expr", true) - t.Traverse(nn.Expr) - t.visitor.Leave("Expr", true) - } - case *ast.StmtTrait: - if nn == nil { - return - } - if !t.visitor.EnterNode(nn) { - return - } - if nn.TraitName != nil { - t.visitor.Enter("TraitName", true) - t.Traverse(nn.TraitName) - t.visitor.Leave("TraitName", true) - } - if nn.Stmts != nil { - t.visitor.Enter("Stmts", false) - for _, c := range nn.Stmts { - t.Traverse(c) - } - t.visitor.Leave("Stmts", false) - } - case *ast.StmtTraitUse: - if nn == nil { - return - } - if !t.visitor.EnterNode(nn) { - return - } - if nn.Traits != nil { - t.visitor.Enter("Traits", false) - for _, c := range nn.Traits { - t.Traverse(c) - } - t.visitor.Leave("Traits", false) - } - if nn.Adaptations != nil { - t.visitor.Enter("Adaptations", false) - for _, c := range nn.Adaptations { - t.Traverse(c) - } - t.visitor.Leave("Adaptations", false) - } - case *ast.StmtTraitUseAlias: - if nn == nil { - return - } - if !t.visitor.EnterNode(nn) { - return - } - if nn.Trait != nil { - t.visitor.Enter("Trait", true) - t.Traverse(nn.Trait) - t.visitor.Leave("Trait", true) - } - if nn.Method != nil { - t.visitor.Enter("Method", true) - t.Traverse(nn.Method) - t.visitor.Leave("Method", true) - } - if nn.Modifier != nil { - t.visitor.Enter("Modifier", true) - t.Traverse(nn.Modifier) - t.visitor.Leave("Modifier", true) - } - if nn.Alias != nil { - t.visitor.Enter("Alias", true) - t.Traverse(nn.Alias) - t.visitor.Leave("Alias", true) - } - case *ast.StmtTraitUsePrecedence: - if nn == nil { - return - } - if !t.visitor.EnterNode(nn) { - return - } - if nn.Trait != nil { - t.visitor.Enter("Trait", true) - t.Traverse(nn.Trait) - t.visitor.Leave("Trait", true) - } - if nn.Method != nil { - t.visitor.Enter("Method", true) - t.Traverse(nn.Method) - t.visitor.Leave("Method", true) - } - if nn.Insteadof != nil { - t.visitor.Enter("Insteadof", false) - for _, c := range nn.Insteadof { - t.Traverse(c) - } - t.visitor.Leave("Insteadof", false) - } - case *ast.StmtTry: - if nn == nil { - return - } - if !t.visitor.EnterNode(nn) { - return - } - if nn.Stmts != nil { - t.visitor.Enter("Stmts", false) - for _, c := range nn.Stmts { - t.Traverse(c) - } - t.visitor.Leave("Stmts", false) - } - if nn.Catches != nil { - t.visitor.Enter("Catches", false) - for _, c := range nn.Catches { - t.Traverse(c) - } - t.visitor.Leave("Catches", false) - } - if nn.Finally != nil { - t.visitor.Enter("Finally", true) - t.Traverse(nn.Finally) - t.visitor.Leave("Finally", true) - } - case *ast.StmtUnset: - if nn == nil { - return - } - if !t.visitor.EnterNode(nn) { - return - } - if nn.Vars != nil { - t.visitor.Enter("Vars", false) - for _, c := range nn.Vars { - t.Traverse(c) - } - t.visitor.Leave("Vars", false) - } - case *ast.StmtUse: - 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.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.UseDeclarations != nil { - t.visitor.Enter("UseDeclarations", false) - for _, c := range nn.UseDeclarations { - t.Traverse(c) - } - t.visitor.Leave("UseDeclarations", false) - } - case *ast.StmtUseDeclaration: - 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.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.StmtWhile: - if nn == nil { - return - } - if !t.visitor.EnterNode(nn) { - return - } - if nn.Cond != nil { - t.visitor.Enter("Cond", true) - t.Traverse(nn.Cond) - t.visitor.Leave("Cond", true) - } - if nn.Stmt != nil { - t.visitor.Enter("Stmt", true) - t.Traverse(nn.Stmt) - t.visitor.Leave("Stmt", true) - } - case *ast.ExprArray: - if nn == nil { - return - } - if !t.visitor.EnterNode(nn) { - return - } - if nn.Items != nil { - t.visitor.Enter("Items", false) - for _, c := range nn.Items { - t.Traverse(c) - } - t.visitor.Leave("Items", false) - } - case *ast.ExprArrayDimFetch: - if nn == nil { - return - } - if !t.visitor.EnterNode(nn) { - return - } - if nn.Var != nil { - t.visitor.Enter("Var", true) - t.Traverse(nn.Var) - t.visitor.Leave("Var", true) - } - if nn.Dim != nil { - t.visitor.Enter("Dim", true) - t.Traverse(nn.Dim) - t.visitor.Leave("Dim", true) - } - case *ast.ExprArrayItem: - if nn == nil { - return - } - if !t.visitor.EnterNode(nn) { - return - } - if nn.Key != nil { - t.visitor.Enter("Key", true) - t.Traverse(nn.Key) - t.visitor.Leave("Key", true) - } - if nn.Val != nil { - t.visitor.Enter("Val", true) - t.Traverse(nn.Val) - t.visitor.Leave("Val", true) - } - case *ast.ExprArrowFunction: - if nn == nil { - return - } - if !t.visitor.EnterNode(nn) { - return - } - if nn.Params != nil { - t.visitor.Enter("Params", false) - for _, c := range nn.Params { - t.Traverse(c) - } - t.visitor.Leave("Params", false) - } - if nn.ReturnType != nil { - t.visitor.Enter("ReturnType", true) - t.Traverse(nn.ReturnType) - t.visitor.Leave("ReturnType", true) - } - if nn.Expr != nil { - t.visitor.Enter("Expr", true) - t.Traverse(nn.Expr) - t.visitor.Leave("Expr", true) - } - case *ast.ExprBitwiseNot: - if nn == nil { - return - } - if !t.visitor.EnterNode(nn) { - return - } - if nn.Expr != nil { - t.visitor.Enter("Expr", true) - t.Traverse(nn.Expr) - t.visitor.Leave("Expr", true) - } - case *ast.ExprBooleanNot: - if nn == nil { - return - } - if !t.visitor.EnterNode(nn) { - return - } - if nn.Expr != nil { - t.visitor.Enter("Expr", true) - t.Traverse(nn.Expr) - t.visitor.Leave("Expr", true) - } - case *ast.ExprBrackets: - if nn == nil { - return - } - if !t.visitor.EnterNode(nn) { - return - } - if nn.Expr != nil { - t.visitor.Enter("Expr", true) - t.Traverse(nn.Expr) - t.visitor.Leave("Expr", true) - } - case *ast.ExprClassConstFetch: - if nn == nil { - return - } - if !t.visitor.EnterNode(nn) { - return - } - if nn.Class != nil { - t.visitor.Enter("Class", true) - t.Traverse(nn.Class) - t.visitor.Leave("Class", true) - } - if nn.ConstantName != nil { - t.visitor.Enter("Name", true) - t.Traverse(nn.ConstantName) - t.visitor.Leave("Name", true) - } - case *ast.ExprClone: - if nn == nil { - return - } - if !t.visitor.EnterNode(nn) { - return - } - if nn.Expr != nil { - t.visitor.Enter("Expr", true) - t.Traverse(nn.Expr) - t.visitor.Leave("Expr", true) - } - case *ast.ExprClosure: - if nn == nil { - return - } - if !t.visitor.EnterNode(nn) { - return - } - if nn.Params != nil { - t.visitor.Enter("Params", false) - for _, c := range nn.Params { - t.Traverse(c) - } - t.visitor.Leave("Params", false) - } - if nn.Use != nil { - t.visitor.Enter("Use", false) - for _, c := range nn.Use { - t.Traverse(c) - } - t.visitor.Leave("Use", false) - } - if nn.ReturnType != nil { - t.visitor.Enter("ReturnType", true) - t.Traverse(nn.ReturnType) - t.visitor.Leave("ReturnType", true) - } - if nn.Stmts != nil { - t.visitor.Enter("Stmts", false) - for _, c := range nn.Stmts { - t.Traverse(c) - } - t.visitor.Leave("Stmts", false) - } - case *ast.ExprClosureUse: - if nn == nil { - return - } - if !t.visitor.EnterNode(nn) { - return - } - if nn.Var != nil { - t.visitor.Enter("Var", true) - t.Traverse(nn.Var) - t.visitor.Leave("Var", true) - } - case *ast.ExprConstFetch: - if nn == nil { - return - } - if !t.visitor.EnterNode(nn) { - return - } - if nn.Const != nil { - t.visitor.Enter("Const", true) - t.Traverse(nn.Const) - t.visitor.Leave("Const", true) - } - case *ast.ExprEmpty: - if nn == nil { - return - } - if !t.visitor.EnterNode(nn) { - return - } - if nn.Expr != nil { - t.visitor.Enter("Expr", true) - t.Traverse(nn.Expr) - t.visitor.Leave("Expr", true) - } - case *ast.ExprErrorSuppress: - if nn == nil { - return - } - if !t.visitor.EnterNode(nn) { - return - } - if nn.Expr != nil { - t.visitor.Enter("Expr", true) - t.Traverse(nn.Expr) - t.visitor.Leave("Expr", true) - } - case *ast.ExprEval: - if nn == nil { - return - } - if !t.visitor.EnterNode(nn) { - return - } - if nn.Expr != nil { - t.visitor.Enter("Expr", true) - t.Traverse(nn.Expr) - t.visitor.Leave("Expr", true) - } - case *ast.ExprExit: - if nn == nil { - return - } - if !t.visitor.EnterNode(nn) { - return - } - if nn.Expr != nil { - t.visitor.Enter("Expr", true) - t.Traverse(nn.Expr) - t.visitor.Leave("Expr", true) - } - case *ast.ExprFunctionCall: - if nn == nil { - return - } - if !t.visitor.EnterNode(nn) { - return - } - if nn.Function != nil { - t.visitor.Enter("Function", true) - t.Traverse(nn.Function) - t.visitor.Leave("Function", true) - } - if nn.Arguments != nil { - t.visitor.Enter("Arguments", false) - for _, c := range nn.Arguments { - t.Traverse(c) - } - t.visitor.Leave("Arguments", false) - } - case *ast.ExprInclude: - if nn == nil { - return - } - if !t.visitor.EnterNode(nn) { - return - } - if nn.Expr != nil { - t.visitor.Enter("Expr", true) - t.Traverse(nn.Expr) - t.visitor.Leave("Expr", true) - } - case *ast.ExprIncludeOnce: - if nn == nil { - return - } - if !t.visitor.EnterNode(nn) { - return - } - if nn.Expr != nil { - t.visitor.Enter("Expr", true) - t.Traverse(nn.Expr) - t.visitor.Leave("Expr", true) - } - case *ast.ExprInstanceOf: - if nn == nil { - return - } - if !t.visitor.EnterNode(nn) { - return - } - if nn.Expr != nil { - t.visitor.Enter("Expr", true) - t.Traverse(nn.Expr) - t.visitor.Leave("Expr", true) - } - if nn.Class != nil { - t.visitor.Enter("Class", true) - t.Traverse(nn.Class) - t.visitor.Leave("Class", true) - } - case *ast.ExprIsset: - if nn == nil { - return - } - if !t.visitor.EnterNode(nn) { - return - } - if nn.Vars != nil { - t.visitor.Enter("Vars", false) - for _, c := range nn.Vars { - t.Traverse(c) - } - t.visitor.Leave("Vars", false) - } - case *ast.ExprList: - if nn == nil { - return - } - if !t.visitor.EnterNode(nn) { - return - } - if nn.Items != nil { - t.visitor.Enter("Items", false) - for _, c := range nn.Items { - t.Traverse(c) - } - t.visitor.Leave("Items", false) - } - case *ast.ExprMethodCall: - if nn == nil { - return - } - if !t.visitor.EnterNode(nn) { - return - } - if nn.Var != nil { - t.visitor.Enter("Var", true) - t.Traverse(nn.Var) - t.visitor.Leave("Var", true) - } - if nn.Method != nil { - t.visitor.Enter("Method", true) - t.Traverse(nn.Method) - t.visitor.Leave("Method", true) - } - if nn.Arguments != nil { - t.visitor.Enter("Arguments", false) - for _, c := range nn.Arguments { - t.Traverse(c) - } - t.visitor.Leave("Arguments", false) - } - case *ast.ExprNew: - if nn == nil { - return - } - if !t.visitor.EnterNode(nn) { - return - } - if nn.Class != nil { - t.visitor.Enter("Class", true) - t.Traverse(nn.Class) - t.visitor.Leave("Class", true) - } - if nn.Arguments != nil { - t.visitor.Enter("Arguments", false) - for _, c := range nn.Arguments { - t.Traverse(c) - } - t.visitor.Leave("Arguments", false) - } - case *ast.ExprPostDec: - if nn == nil { - return - } - if !t.visitor.EnterNode(nn) { - return - } - if nn.Var != nil { - t.visitor.Enter("Var", true) - t.Traverse(nn.Var) - t.visitor.Leave("Var", true) - } - case *ast.ExprPostInc: - if nn == nil { - return - } - if !t.visitor.EnterNode(nn) { - return - } - if nn.Var != nil { - t.visitor.Enter("Var", true) - t.Traverse(nn.Var) - t.visitor.Leave("Var", true) - } - case *ast.ExprPreDec: - if nn == nil { - return - } - if !t.visitor.EnterNode(nn) { - return - } - if nn.Var != nil { - t.visitor.Enter("Var", true) - t.Traverse(nn.Var) - t.visitor.Leave("Var", true) - } - case *ast.ExprPreInc: - if nn == nil { - return - } - if !t.visitor.EnterNode(nn) { - return - } - if nn.Var != nil { - t.visitor.Enter("Var", true) - t.Traverse(nn.Var) - t.visitor.Leave("Var", true) - } - case *ast.ExprPrint: - if nn == nil { - return - } - if !t.visitor.EnterNode(nn) { - return - } - if nn.Expr != nil { - t.visitor.Enter("Expr", true) - t.Traverse(nn.Expr) - t.visitor.Leave("Expr", true) - } - case *ast.ExprPropertyFetch: - if nn == nil { - return - } - if !t.visitor.EnterNode(nn) { - return - } - if nn.Var != nil { - t.visitor.Enter("Var", true) - t.Traverse(nn.Var) - t.visitor.Leave("Var", true) - } - if nn.Property != nil { - t.visitor.Enter("Property", true) - t.Traverse(nn.Property) - t.visitor.Leave("Property", true) - } - case *ast.ExprRequire: - if nn == nil { - return - } - if !t.visitor.EnterNode(nn) { - return - } - if nn.Expr != nil { - t.visitor.Enter("Expr", true) - t.Traverse(nn.Expr) - t.visitor.Leave("Expr", true) - } - case *ast.ExprRequireOnce: - if nn == nil { - return - } - if !t.visitor.EnterNode(nn) { - return - } - if nn.Expr != nil { - t.visitor.Enter("Expr", true) - t.Traverse(nn.Expr) - t.visitor.Leave("Expr", true) - } - case *ast.ExprShellExec: - if nn == nil { - return - } - if !t.visitor.EnterNode(nn) { - return - } - if nn.Parts != nil { - t.visitor.Enter("Parts", false) - for _, c := range nn.Parts { - t.Traverse(c) - } - t.visitor.Leave("Parts", false) - } - case *ast.ExprStaticCall: - if nn == nil { - return - } - if !t.visitor.EnterNode(nn) { - return - } - if nn.Class != nil { - t.visitor.Enter("Class", true) - t.Traverse(nn.Class) - t.visitor.Leave("Class", true) - } - if nn.Call != nil { - t.visitor.Enter("Call", true) - t.Traverse(nn.Call) - t.visitor.Leave("Call", true) - } - if nn.Arguments != nil { - t.visitor.Enter("Arguments", false) - for _, c := range nn.Arguments { - t.Traverse(c) - } - t.visitor.Leave("Arguments", false) - } - case *ast.ExprStaticPropertyFetch: - if nn == nil { - return - } - if !t.visitor.EnterNode(nn) { - return - } - if nn.Class != nil { - t.visitor.Enter("Class", true) - t.Traverse(nn.Class) - t.visitor.Leave("Class", true) - } - if nn.Property != nil { - t.visitor.Enter("Property", true) - t.Traverse(nn.Property) - t.visitor.Leave("Property", true) - } - case *ast.ExprTernary: - if nn == nil { - return - } - if !t.visitor.EnterNode(nn) { - return - } - if nn.Condition != nil { - t.visitor.Enter("Condition", true) - t.Traverse(nn.Condition) - t.visitor.Leave("Condition", true) - } - if nn.IfTrue != nil { - t.visitor.Enter("IfTrue", true) - t.Traverse(nn.IfTrue) - t.visitor.Leave("IfTrue", true) - } - if nn.IfFalse != nil { - t.visitor.Enter("IfFalse", true) - t.Traverse(nn.IfFalse) - t.visitor.Leave("IfFalse", true) - } - case *ast.ExprUnaryMinus: - if nn == nil { - return - } - if !t.visitor.EnterNode(nn) { - return - } - if nn.Expr != nil { - t.visitor.Enter("Expr", true) - t.Traverse(nn.Expr) - t.visitor.Leave("Expr", true) - } - case *ast.ExprUnaryPlus: - if nn == nil { - return - } - if !t.visitor.EnterNode(nn) { - return - } - if nn.Expr != nil { - t.visitor.Enter("Expr", true) - t.Traverse(nn.Expr) - t.visitor.Leave("Expr", true) - } - case *ast.ExprVariable: - if nn == nil { - return - } - if !t.visitor.EnterNode(nn) { - return - } - if nn.VarName != nil { - t.visitor.Enter("VarName", true) - t.Traverse(nn.VarName) - t.visitor.Leave("VarName", true) - } - case *ast.ExprYield: - if nn == nil { - return - } - if !t.visitor.EnterNode(nn) { - return - } - if nn.Key != nil { - t.visitor.Enter("Key", true) - t.Traverse(nn.Key) - t.visitor.Leave("Key", true) - } - if nn.Value != nil { - t.visitor.Enter("Value", true) - t.Traverse(nn.Value) - t.visitor.Leave("Value", true) - } - case *ast.ExprYieldFrom: - if nn == nil { - return - } - if !t.visitor.EnterNode(nn) { - return - } - if nn.Expr != nil { - t.visitor.Enter("Expr", true) - t.Traverse(nn.Expr) - t.visitor.Leave("Expr", true) - } - case *ast.ExprAssign: - if nn == nil { - return - } - if !t.visitor.EnterNode(nn) { - return - } - if nn.Var != nil { - t.visitor.Enter("Var", true) - t.Traverse(nn.Var) - t.visitor.Leave("Var", true) - } - if nn.Expr != nil { - t.visitor.Enter("Expr", true) - t.Traverse(nn.Expr) - t.visitor.Leave("Expr", true) - } - case *ast.ExprAssignReference: - if nn == nil { - return - } - if !t.visitor.EnterNode(nn) { - return - } - if nn.Var != nil { - t.visitor.Enter("Var", true) - t.Traverse(nn.Var) - t.visitor.Leave("Var", true) - } - if nn.Expr != nil { - t.visitor.Enter("Expr", true) - t.Traverse(nn.Expr) - t.visitor.Leave("Expr", true) - } - case *ast.ExprAssignBitwiseAnd: - if nn == nil { - return - } - if !t.visitor.EnterNode(nn) { - return - } - if nn.Var != nil { - t.visitor.Enter("Var", true) - t.Traverse(nn.Var) - t.visitor.Leave("Var", true) - } - if nn.Expr != nil { - t.visitor.Enter("Expr", true) - t.Traverse(nn.Expr) - t.visitor.Leave("Expr", true) - } - case *ast.ExprAssignBitwiseOr: - if nn == nil { - return - } - if !t.visitor.EnterNode(nn) { - return - } - if nn.Var != nil { - t.visitor.Enter("Var", true) - t.Traverse(nn.Var) - t.visitor.Leave("Var", true) - } - if nn.Expr != nil { - t.visitor.Enter("Expr", true) - t.Traverse(nn.Expr) - t.visitor.Leave("Expr", true) - } - case *ast.ExprAssignBitwiseXor: - if nn == nil { - return - } - if !t.visitor.EnterNode(nn) { - return - } - if nn.Var != nil { - t.visitor.Enter("Var", true) - t.Traverse(nn.Var) - t.visitor.Leave("Var", true) - } - if nn.Expr != nil { - t.visitor.Enter("Expr", true) - t.Traverse(nn.Expr) - t.visitor.Leave("Expr", true) - } - case *ast.ExprAssignCoalesce: - if nn == nil { - return - } - if !t.visitor.EnterNode(nn) { - return - } - if nn.Var != nil { - t.visitor.Enter("Var", true) - t.Traverse(nn.Var) - t.visitor.Leave("Var", true) - } - if nn.Expr != nil { - t.visitor.Enter("Expr", true) - t.Traverse(nn.Expr) - t.visitor.Leave("Expr", true) - } - case *ast.ExprAssignConcat: - if nn == nil { - return - } - if !t.visitor.EnterNode(nn) { - return - } - if nn.Var != nil { - t.visitor.Enter("Var", true) - t.Traverse(nn.Var) - t.visitor.Leave("Var", true) - } - if nn.Expr != nil { - t.visitor.Enter("Expr", true) - t.Traverse(nn.Expr) - t.visitor.Leave("Expr", true) - } - case *ast.ExprAssignDiv: - if nn == nil { - return - } - if !t.visitor.EnterNode(nn) { - return - } - if nn.Var != nil { - t.visitor.Enter("Var", true) - t.Traverse(nn.Var) - t.visitor.Leave("Var", true) - } - if nn.Expr != nil { - t.visitor.Enter("Expr", true) - t.Traverse(nn.Expr) - t.visitor.Leave("Expr", true) - } - case *ast.ExprAssignMinus: - if nn == nil { - return - } - if !t.visitor.EnterNode(nn) { - return - } - if nn.Var != nil { - t.visitor.Enter("Var", true) - t.Traverse(nn.Var) - t.visitor.Leave("Var", true) - } - if nn.Expr != nil { - t.visitor.Enter("Expr", true) - t.Traverse(nn.Expr) - t.visitor.Leave("Expr", true) - } - case *ast.ExprAssignMod: - if nn == nil { - return - } - if !t.visitor.EnterNode(nn) { - return - } - if nn.Var != nil { - t.visitor.Enter("Var", true) - t.Traverse(nn.Var) - t.visitor.Leave("Var", true) - } - if nn.Expr != nil { - t.visitor.Enter("Expr", true) - t.Traverse(nn.Expr) - t.visitor.Leave("Expr", true) - } - case *ast.ExprAssignMul: - if nn == nil { - return - } - if !t.visitor.EnterNode(nn) { - return - } - if nn.Var != nil { - t.visitor.Enter("Var", true) - t.Traverse(nn.Var) - t.visitor.Leave("Var", true) - } - if nn.Expr != nil { - t.visitor.Enter("Expr", true) - t.Traverse(nn.Expr) - t.visitor.Leave("Expr", true) - } - case *ast.ExprAssignPlus: - if nn == nil { - return - } - if !t.visitor.EnterNode(nn) { - return - } - if nn.Var != nil { - t.visitor.Enter("Var", true) - t.Traverse(nn.Var) - t.visitor.Leave("Var", true) - } - if nn.Expr != nil { - t.visitor.Enter("Expr", true) - t.Traverse(nn.Expr) - t.visitor.Leave("Expr", true) - } - case *ast.ExprAssignPow: - if nn == nil { - return - } - if !t.visitor.EnterNode(nn) { - return - } - if nn.Var != nil { - t.visitor.Enter("Var", true) - t.Traverse(nn.Var) - t.visitor.Leave("Var", true) - } - if nn.Expr != nil { - t.visitor.Enter("Expr", true) - t.Traverse(nn.Expr) - t.visitor.Leave("Expr", true) - } - case *ast.ExprAssignShiftLeft: - if nn == nil { - return - } - if !t.visitor.EnterNode(nn) { - return - } - if nn.Var != nil { - t.visitor.Enter("Var", true) - t.Traverse(nn.Var) - t.visitor.Leave("Var", true) - } - if nn.Expr != nil { - t.visitor.Enter("Expr", true) - t.Traverse(nn.Expr) - t.visitor.Leave("Expr", true) - } - case *ast.ExprAssignShiftRight: - if nn == nil { - return - } - if !t.visitor.EnterNode(nn) { - return - } - if nn.Var != nil { - t.visitor.Enter("Var", true) - t.Traverse(nn.Var) - t.visitor.Leave("Var", true) - } - if nn.Expr != nil { - t.visitor.Enter("Expr", true) - t.Traverse(nn.Expr) - t.visitor.Leave("Expr", true) - } - case *ast.ExprBinaryBitwiseAnd: - if nn == nil { - return - } - if !t.visitor.EnterNode(nn) { - return - } - if nn.Left != nil { - t.visitor.Enter("Left", true) - t.Traverse(nn.Left) - t.visitor.Leave("Left", true) - } - if nn.Right != nil { - t.visitor.Enter("Right", true) - t.Traverse(nn.Right) - t.visitor.Leave("Right", true) - } - case *ast.ExprBinaryBitwiseOr: - if nn == nil { - return - } - if !t.visitor.EnterNode(nn) { - return - } - if nn.Left != nil { - t.visitor.Enter("Left", true) - t.Traverse(nn.Left) - t.visitor.Leave("Left", true) - } - if nn.Right != nil { - t.visitor.Enter("Right", true) - t.Traverse(nn.Right) - t.visitor.Leave("Right", true) - } - case *ast.ExprBinaryBitwiseXor: - if nn == nil { - return - } - if !t.visitor.EnterNode(nn) { - return - } - if nn.Left != nil { - t.visitor.Enter("Left", true) - t.Traverse(nn.Left) - t.visitor.Leave("Left", true) - } - if nn.Right != nil { - t.visitor.Enter("Right", true) - t.Traverse(nn.Right) - t.visitor.Leave("Right", true) - } - case *ast.ExprBinaryBooleanAnd: - if nn == nil { - return - } - if !t.visitor.EnterNode(nn) { - return - } - if nn.Left != nil { - t.visitor.Enter("Left", true) - t.Traverse(nn.Left) - t.visitor.Leave("Left", true) - } - if nn.Right != nil { - t.visitor.Enter("Right", true) - t.Traverse(nn.Right) - t.visitor.Leave("Right", true) - } - case *ast.ExprBinaryBooleanOr: - if nn == nil { - return - } - if !t.visitor.EnterNode(nn) { - return - } - if nn.Left != nil { - t.visitor.Enter("Left", true) - t.Traverse(nn.Left) - t.visitor.Leave("Left", true) - } - if nn.Right != nil { - t.visitor.Enter("Right", true) - t.Traverse(nn.Right) - t.visitor.Leave("Right", true) - } - case *ast.ExprBinaryCoalesce: - if nn == nil { - return - } - if !t.visitor.EnterNode(nn) { - return - } - if nn.Left != nil { - t.visitor.Enter("Left", true) - t.Traverse(nn.Left) - t.visitor.Leave("Left", true) - } - if nn.Right != nil { - t.visitor.Enter("Right", true) - t.Traverse(nn.Right) - t.visitor.Leave("Right", true) - } - case *ast.ExprBinaryConcat: - if nn == nil { - return - } - if !t.visitor.EnterNode(nn) { - return - } - if nn.Left != nil { - t.visitor.Enter("Left", true) - t.Traverse(nn.Left) - t.visitor.Leave("Left", true) - } - if nn.Right != nil { - t.visitor.Enter("Right", true) - t.Traverse(nn.Right) - t.visitor.Leave("Right", true) - } - case *ast.ExprBinaryDiv: - if nn == nil { - return - } - if !t.visitor.EnterNode(nn) { - return - } - if nn.Left != nil { - t.visitor.Enter("Left", true) - t.Traverse(nn.Left) - t.visitor.Leave("Left", true) - } - if nn.Right != nil { - t.visitor.Enter("Right", true) - t.Traverse(nn.Right) - t.visitor.Leave("Right", true) - } - case *ast.ExprBinaryEqual: - if nn == nil { - return - } - if !t.visitor.EnterNode(nn) { - return - } - if nn.Left != nil { - t.visitor.Enter("Left", true) - t.Traverse(nn.Left) - t.visitor.Leave("Left", true) - } - if nn.Right != nil { - t.visitor.Enter("Right", true) - t.Traverse(nn.Right) - t.visitor.Leave("Right", true) - } - case *ast.ExprBinaryGreater: - if nn == nil { - return - } - if !t.visitor.EnterNode(nn) { - return - } - if nn.Left != nil { - t.visitor.Enter("Left", true) - t.Traverse(nn.Left) - t.visitor.Leave("Left", true) - } - if nn.Right != nil { - t.visitor.Enter("Right", true) - t.Traverse(nn.Right) - t.visitor.Leave("Right", true) - } - case *ast.ExprBinaryGreaterOrEqual: - if nn == nil { - return - } - if !t.visitor.EnterNode(nn) { - return - } - if nn.Left != nil { - t.visitor.Enter("Left", true) - t.Traverse(nn.Left) - t.visitor.Leave("Left", true) - } - if nn.Right != nil { - t.visitor.Enter("Right", true) - t.Traverse(nn.Right) - t.visitor.Leave("Right", true) - } - case *ast.ExprBinaryIdentical: - if nn == nil { - return - } - if !t.visitor.EnterNode(nn) { - return - } - if nn.Left != nil { - t.visitor.Enter("Left", true) - t.Traverse(nn.Left) - t.visitor.Leave("Left", true) - } - if nn.Right != nil { - t.visitor.Enter("Right", true) - t.Traverse(nn.Right) - t.visitor.Leave("Right", true) - } - case *ast.ExprBinaryLogicalAnd: - if nn == nil { - return - } - if !t.visitor.EnterNode(nn) { - return - } - if nn.Left != nil { - t.visitor.Enter("Left", true) - t.Traverse(nn.Left) - t.visitor.Leave("Left", true) - } - if nn.Right != nil { - t.visitor.Enter("Right", true) - t.Traverse(nn.Right) - t.visitor.Leave("Right", true) - } - case *ast.ExprBinaryLogicalOr: - if nn == nil { - return - } - if !t.visitor.EnterNode(nn) { - return - } - if nn.Left != nil { - t.visitor.Enter("Left", true) - t.Traverse(nn.Left) - t.visitor.Leave("Left", true) - } - if nn.Right != nil { - t.visitor.Enter("Right", true) - t.Traverse(nn.Right) - t.visitor.Leave("Right", true) - } - case *ast.ExprBinaryLogicalXor: - if nn == nil { - return - } - if !t.visitor.EnterNode(nn) { - return - } - if nn.Left != nil { - t.visitor.Enter("Left", true) - t.Traverse(nn.Left) - t.visitor.Leave("Left", true) - } - if nn.Right != nil { - t.visitor.Enter("Right", true) - t.Traverse(nn.Right) - t.visitor.Leave("Right", true) - } - case *ast.ExprBinaryMinus: - if nn == nil { - return - } - if !t.visitor.EnterNode(nn) { - return - } - if nn.Left != nil { - t.visitor.Enter("Left", true) - t.Traverse(nn.Left) - t.visitor.Leave("Left", true) - } - if nn.Right != nil { - t.visitor.Enter("Right", true) - t.Traverse(nn.Right) - t.visitor.Leave("Right", true) - } - case *ast.ExprBinaryMod: - if nn == nil { - return - } - if !t.visitor.EnterNode(nn) { - return - } - if nn.Left != nil { - t.visitor.Enter("Left", true) - t.Traverse(nn.Left) - t.visitor.Leave("Left", true) - } - if nn.Right != nil { - t.visitor.Enter("Right", true) - t.Traverse(nn.Right) - t.visitor.Leave("Right", true) - } - case *ast.ExprBinaryMul: - if nn == nil { - return - } - if !t.visitor.EnterNode(nn) { - return - } - if nn.Left != nil { - t.visitor.Enter("Left", true) - t.Traverse(nn.Left) - t.visitor.Leave("Left", true) - } - if nn.Right != nil { - t.visitor.Enter("Right", true) - t.Traverse(nn.Right) - t.visitor.Leave("Right", true) - } - case *ast.ExprBinaryNotEqual: - if nn == nil { - return - } - if !t.visitor.EnterNode(nn) { - return - } - if nn.Left != nil { - t.visitor.Enter("Left", true) - t.Traverse(nn.Left) - t.visitor.Leave("Left", true) - } - if nn.Right != nil { - t.visitor.Enter("Right", true) - t.Traverse(nn.Right) - t.visitor.Leave("Right", true) - } - case *ast.ExprBinaryNotIdentical: - if nn == nil { - return - } - if !t.visitor.EnterNode(nn) { - return - } - if nn.Left != nil { - t.visitor.Enter("Left", true) - t.Traverse(nn.Left) - t.visitor.Leave("Left", true) - } - if nn.Right != nil { - t.visitor.Enter("Right", true) - t.Traverse(nn.Right) - t.visitor.Leave("Right", true) - } - case *ast.ExprBinaryPlus: - if nn == nil { - return - } - if !t.visitor.EnterNode(nn) { - return - } - if nn.Left != nil { - t.visitor.Enter("Left", true) - t.Traverse(nn.Left) - t.visitor.Leave("Left", true) - } - if nn.Right != nil { - t.visitor.Enter("Right", true) - t.Traverse(nn.Right) - t.visitor.Leave("Right", true) - } - case *ast.ExprBinaryPow: - if nn == nil { - return - } - if !t.visitor.EnterNode(nn) { - return - } - if nn.Left != nil { - t.visitor.Enter("Left", true) - t.Traverse(nn.Left) - t.visitor.Leave("Left", true) - } - if nn.Right != nil { - t.visitor.Enter("Right", true) - t.Traverse(nn.Right) - t.visitor.Leave("Right", true) - } - case *ast.ExprBinaryShiftLeft: - if nn == nil { - return - } - if !t.visitor.EnterNode(nn) { - return - } - if nn.Left != nil { - t.visitor.Enter("Left", true) - t.Traverse(nn.Left) - t.visitor.Leave("Left", true) - } - if nn.Right != nil { - t.visitor.Enter("Right", true) - t.Traverse(nn.Right) - t.visitor.Leave("Right", true) - } - case *ast.ExprBinaryShiftRight: - if nn == nil { - return - } - if !t.visitor.EnterNode(nn) { - return - } - if nn.Left != nil { - t.visitor.Enter("Left", true) - t.Traverse(nn.Left) - t.visitor.Leave("Left", true) - } - if nn.Right != nil { - t.visitor.Enter("Right", true) - t.Traverse(nn.Right) - t.visitor.Leave("Right", true) - } - case *ast.ExprBinarySmaller: - if nn == nil { - return - } - if !t.visitor.EnterNode(nn) { - return - } - if nn.Left != nil { - t.visitor.Enter("Left", true) - t.Traverse(nn.Left) - t.visitor.Leave("Left", true) - } - if nn.Right != nil { - t.visitor.Enter("Right", true) - t.Traverse(nn.Right) - t.visitor.Leave("Right", true) - } - case *ast.ExprBinarySmallerOrEqual: - if nn == nil { - return - } - if !t.visitor.EnterNode(nn) { - return - } - if nn.Left != nil { - t.visitor.Enter("Left", true) - t.Traverse(nn.Left) - t.visitor.Leave("Left", true) - } - if nn.Right != nil { - t.visitor.Enter("Right", true) - t.Traverse(nn.Right) - t.visitor.Leave("Right", true) - } - case *ast.ExprBinarySpaceship: - if nn == nil { - return - } - if !t.visitor.EnterNode(nn) { - return - } - if nn.Left != nil { - t.visitor.Enter("Left", true) - t.Traverse(nn.Left) - t.visitor.Leave("Left", true) - } - if nn.Right != nil { - t.visitor.Enter("Right", true) - t.Traverse(nn.Right) - t.visitor.Leave("Right", true) - } - case *ast.ExprCastArray: - if nn == nil { - return - } - if !t.visitor.EnterNode(nn) { - return - } - if nn.Expr != nil { - t.visitor.Enter("Expr", true) - t.Traverse(nn.Expr) - t.visitor.Leave("Expr", true) - } - case *ast.ExprCastBool: - if nn == nil { - return - } - if !t.visitor.EnterNode(nn) { - return - } - if nn.Expr != nil { - t.visitor.Enter("Expr", true) - t.Traverse(nn.Expr) - t.visitor.Leave("Expr", true) - } - case *ast.ExprCastDouble: - if nn == nil { - return - } - if !t.visitor.EnterNode(nn) { - return - } - if nn.Expr != nil { - t.visitor.Enter("Expr", true) - t.Traverse(nn.Expr) - t.visitor.Leave("Expr", true) - } - case *ast.ExprCastInt: - if nn == nil { - return - } - if !t.visitor.EnterNode(nn) { - return - } - if nn.Expr != nil { - t.visitor.Enter("Expr", true) - t.Traverse(nn.Expr) - t.visitor.Leave("Expr", true) - } - case *ast.ExprCastObject: - if nn == nil { - return - } - if !t.visitor.EnterNode(nn) { - return - } - if nn.Expr != nil { - t.visitor.Enter("Expr", true) - t.Traverse(nn.Expr) - t.visitor.Leave("Expr", true) - } - case *ast.ExprCastString: - if nn == nil { - return - } - if !t.visitor.EnterNode(nn) { - return - } - if nn.Expr != nil { - t.visitor.Enter("Expr", true) - t.Traverse(nn.Expr) - t.visitor.Leave("Expr", true) - } - case *ast.ExprCastUnset: - if nn == nil { - return - } - if !t.visitor.EnterNode(nn) { - return - } - if nn.Expr != nil { - t.visitor.Enter("Expr", true) - t.Traverse(nn.Expr) - t.visitor.Leave("Expr", true) - } - case *ast.ScalarDnumber: - if nn == nil { - return - } - if !t.visitor.EnterNode(nn) { - return - } - case *ast.ScalarEncapsed: - if nn == nil { - return - } - if !t.visitor.EnterNode(nn) { - return - } - if nn.Parts != nil { - t.visitor.Enter("Parts", false) - for _, c := range nn.Parts { - t.Traverse(c) - } - t.visitor.Leave("Parts", false) - } - case *ast.ScalarEncapsedStringPart: - if nn == nil { - return - } - if !t.visitor.EnterNode(nn) { - return - } - case *ast.ScalarEncapsedStringVar: - if nn == nil { - return - } - if !t.visitor.EnterNode(nn) { - return - } - if nn.VarName != nil { - t.visitor.Enter("VarName", true) - t.Traverse(nn.VarName) - t.visitor.Leave("VarName", true) - } - if nn.Dim != nil { - t.visitor.Enter("Dim", true) - t.Traverse(nn.Dim) - t.visitor.Leave("Dim", true) - } - case *ast.ScalarEncapsedStringBrackets: - if nn == nil { - return - } - if !t.visitor.EnterNode(nn) { - return - } - if nn.Var != nil { - t.visitor.Enter("Var", true) - t.Traverse(nn.Var) - t.visitor.Leave("Var", true) - } - case *ast.ScalarHeredoc: - if nn == nil { - return - } - if !t.visitor.EnterNode(nn) { - return - } - if nn.Parts != nil { - t.visitor.Enter("Parts", false) - for _, c := range nn.Parts { - t.Traverse(c) - } - t.visitor.Leave("Parts", false) - } - case *ast.ScalarLnumber: - if nn == nil { - return - } - if !t.visitor.EnterNode(nn) { - return - } - case *ast.ScalarMagicConstant: - if nn == nil { - return - } - if !t.visitor.EnterNode(nn) { - return - } - case *ast.ScalarString: - if nn == nil { - return - } - if !t.visitor.EnterNode(nn) { - return - } - case *ast.NameName: - if nn == nil { - return - } - if !t.visitor.EnterNode(nn) { - return - } - if nn.Parts != nil { - t.visitor.Enter("Parts", false) - for _, c := range nn.Parts { - t.Traverse(c) - } - t.visitor.Leave("Parts", false) - } - case *ast.NameFullyQualified: - if nn == nil { - return - } - if !t.visitor.EnterNode(nn) { - return - } - if nn.Parts != nil { - t.visitor.Enter("Parts", false) - for _, c := range nn.Parts { - t.Traverse(c) - } - t.visitor.Leave("Parts", false) - } - case *ast.NameRelative: - if nn == nil { - return - } - if !t.visitor.EnterNode(nn) { - return - } - if nn.Parts != nil { - t.visitor.Enter("Parts", false) - for _, c := range nn.Parts { - t.Traverse(c) - } - t.visitor.Leave("Parts", false) - } - case *ast.NameNamePart: - if nn == nil { - return - } - if !t.visitor.EnterNode(nn) { - return - } - default: - panic("unexpected type of node") - } - - t.visitor.LeaveNode(n) -} diff --git a/pkg/ast/visitor/dumper.go b/pkg/visitor/dumper/dumper.go similarity index 99% rename from pkg/ast/visitor/dumper.go rename to pkg/visitor/dumper/dumper.go index 9a7f501..2aa6d0e 100644 --- a/pkg/ast/visitor/dumper.go +++ b/pkg/visitor/dumper/dumper.go @@ -1,4 +1,4 @@ -package visitor +package dumper import ( "github.com/z7zmey/php-parser/pkg/position" diff --git a/pkg/ast/visitor/dumper_test.go b/pkg/visitor/dumper/dumper_test.go similarity index 90% rename from pkg/ast/visitor/dumper_test.go rename to pkg/visitor/dumper/dumper_test.go index c9f3e8c..8c94ac2 100644 --- a/pkg/ast/visitor/dumper_test.go +++ b/pkg/visitor/dumper/dumper_test.go @@ -1,19 +1,19 @@ -package visitor_test +package dumper_test import ( "bytes" "github.com/z7zmey/php-parser/pkg/position" "github.com/z7zmey/php-parser/pkg/token" + "github.com/z7zmey/php-parser/pkg/visitor/dumper" "testing" "github.com/z7zmey/php-parser/pkg/ast" - "github.com/z7zmey/php-parser/pkg/ast/visitor" ) func TestDumper_root(t *testing.T) { o := bytes.NewBufferString("") - p := visitor.NewDumper(o).WithTokens().WithPositions() + p := dumper.NewDumper(o).WithTokens().WithPositions() n := &ast.Root{ Position: &position.Position{ StartLine: 1, diff --git a/pkg/ast/visitor/formatter.go b/pkg/visitor/formatter/formatter.go similarity index 99% rename from pkg/ast/visitor/formatter.go rename to pkg/visitor/formatter/formatter.go index 757cd49..e6cb6f6 100644 --- a/pkg/ast/visitor/formatter.go +++ b/pkg/visitor/formatter/formatter.go @@ -1,4 +1,4 @@ -package visitor +package formatter import ( "bytes" diff --git a/pkg/ast/visitor/formatter_test.go b/pkg/visitor/formatter/formatter_test.go similarity index 75% rename from pkg/ast/visitor/formatter_test.go rename to pkg/visitor/formatter/formatter_test.go index fc0ede9..a170d89 100644 --- a/pkg/ast/visitor/formatter_test.go +++ b/pkg/visitor/formatter/formatter_test.go @@ -1,12 +1,13 @@ -package visitor_test +package formatter_test import ( "bytes" "github.com/z7zmey/php-parser/pkg/token" + "github.com/z7zmey/php-parser/pkg/visitor/formatter" + "github.com/z7zmey/php-parser/pkg/visitor/printer" "testing" "github.com/z7zmey/php-parser/pkg/ast" - "github.com/z7zmey/php-parser/pkg/ast/visitor" ) func TestFormatter_Root(t *testing.T) { @@ -18,10 +19,10 @@ func TestFormatter_Root(t *testing.T) { }, } - f := visitor.NewFormatter() + f := formatter.NewFormatter() n.Accept(f) - p := visitor.NewPrinter(o) + p := printer.NewPrinter(o) n.Accept(p) expected := ` $val) { @@ -1397,10 +1398,10 @@ func TestFormatter_StmtFunction(t *testing.T) { }, } - f := visitor.NewFormatter().WithState(visitor.FormatterStatePHP).WithIndent(1) + f := formatter.NewFormatter().WithState(formatter.FormatterStatePHP).WithIndent(1) n.Accept(f) - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n.Accept(p) expected := `function foo() { @@ -1426,10 +1427,10 @@ func TestFormatter_StmtFunction_Ref(t *testing.T) { }, } - f := visitor.NewFormatter().WithState(visitor.FormatterStatePHP).WithIndent(1) + f := formatter.NewFormatter().WithState(formatter.FormatterStatePHP).WithIndent(1) n.Accept(f) - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n.Accept(p) expected := `function &foo() { @@ -1470,10 +1471,10 @@ func TestFormatter_StmtFunction_Params(t *testing.T) { }, } - f := visitor.NewFormatter().WithState(visitor.FormatterStatePHP).WithIndent(1) + f := formatter.NewFormatter().WithState(formatter.FormatterStatePHP).WithIndent(1) n.Accept(f) - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n.Accept(p) expected := `function foo($a, $b) { @@ -1505,10 +1506,10 @@ func TestFormatter_StmtFunction_ReturnType(t *testing.T) { }, } - f := visitor.NewFormatter().WithState(visitor.FormatterStatePHP).WithIndent(1) + f := formatter.NewFormatter().WithState(formatter.FormatterStatePHP).WithIndent(1) n.Accept(f) - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n.Accept(p) expected := `function foo(): bar { @@ -1539,10 +1540,10 @@ func TestFormatter_StmtGlobal(t *testing.T) { }, } - f := visitor.NewFormatter().WithState(visitor.FormatterStatePHP).WithIndent(1) + f := formatter.NewFormatter().WithState(formatter.FormatterStatePHP).WithIndent(1) n.Accept(f) - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n.Accept(p) expected := `global $a, $b;` @@ -1562,10 +1563,10 @@ func TestFormatter_StmtGoto(t *testing.T) { }, } - f := visitor.NewFormatter().WithState(visitor.FormatterStatePHP).WithIndent(1) + f := formatter.NewFormatter().WithState(formatter.FormatterStatePHP).WithIndent(1) n.Accept(f) - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n.Accept(p) expected := `goto FOO;` @@ -1581,10 +1582,10 @@ func TestFormatter_StmtHaltCompiler(t *testing.T) { n := &ast.StmtHaltCompiler{} - f := visitor.NewFormatter().WithState(visitor.FormatterStatePHP).WithIndent(1) + f := formatter.NewFormatter().WithState(formatter.FormatterStatePHP).WithIndent(1) n.Accept(f) - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n.Accept(p) expected := `__halt_compiler();` @@ -1611,10 +1612,10 @@ func TestFormatter_StmtIf(t *testing.T) { }, } - f := visitor.NewFormatter().WithState(visitor.FormatterStatePHP).WithIndent(1) + f := formatter.NewFormatter().WithState(formatter.FormatterStatePHP).WithIndent(1) n.Accept(f) - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n.Accept(p) expected := `if ($foo) { @@ -1669,10 +1670,10 @@ func TestFormatter_StmtIf_ElseIf(t *testing.T) { }, } - f := visitor.NewFormatter().WithState(visitor.FormatterStatePHP).WithIndent(1) + f := formatter.NewFormatter().WithState(formatter.FormatterStatePHP).WithIndent(1) n.Accept(f) - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n.Accept(p) expected := `if ($foo) { @@ -1712,10 +1713,10 @@ func TestFormatter_StmtIf_Else(t *testing.T) { }, } - f := visitor.NewFormatter().WithState(visitor.FormatterStatePHP).WithIndent(1) + f := formatter.NewFormatter().WithState(formatter.FormatterStatePHP).WithIndent(1) n.Accept(f) - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n.Accept(p) expected := `if ($foo) { @@ -1759,10 +1760,10 @@ func TestFormatter_StmtInlineHtml(t *testing.T) { }, } - f := visitor.NewFormatter() + f := formatter.NewFormatter() n.Accept(f) - p := visitor.NewPrinter(o) + p := printer.NewPrinter(o) n.Accept(p) expected := ` $bar` @@ -3214,10 +3215,10 @@ func TestFormatter_ExprArrayItem_Variadic(t *testing.T) { }, } - f := visitor.NewFormatter().WithState(visitor.FormatterStatePHP).WithIndent(1) + f := formatter.NewFormatter().WithState(formatter.FormatterStatePHP).WithIndent(1) n.Accept(f) - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n.Accept(p) expected := `...$foo` @@ -3239,10 +3240,10 @@ func TestFormatter_ExprArrowFunction(t *testing.T) { }, } - f := visitor.NewFormatter().WithState(visitor.FormatterStatePHP).WithIndent(1) + f := formatter.NewFormatter().WithState(formatter.FormatterStatePHP).WithIndent(1) n.Accept(f) - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n.Accept(p) expected := `fn() => $foo` @@ -3265,10 +3266,10 @@ func TestFormatter_ExprArrowFunction_Ref(t *testing.T) { }, } - f := visitor.NewFormatter().WithState(visitor.FormatterStatePHP).WithIndent(1) + f := formatter.NewFormatter().WithState(formatter.FormatterStatePHP).WithIndent(1) n.Accept(f) - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n.Accept(p) expected := `fn&() => $foo` @@ -3306,10 +3307,10 @@ func TestFormatter_ExprArrowFunction_Params(t *testing.T) { }, } - f := visitor.NewFormatter().WithState(visitor.FormatterStatePHP).WithIndent(1) + f := formatter.NewFormatter().WithState(formatter.FormatterStatePHP).WithIndent(1) n.Accept(f) - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n.Accept(p) expected := `fn($a, $b) => $foo` @@ -3338,10 +3339,10 @@ func TestFormatter_ExprArrowFunction_ReturnType(t *testing.T) { }, } - f := visitor.NewFormatter().WithState(visitor.FormatterStatePHP).WithIndent(1) + f := formatter.NewFormatter().WithState(formatter.FormatterStatePHP).WithIndent(1) n.Accept(f) - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n.Accept(p) expected := `fn(): foo => $bar` @@ -3363,10 +3364,10 @@ func TestFormatter_ExprBitwiseNot(t *testing.T) { }, } - f := visitor.NewFormatter().WithState(visitor.FormatterStatePHP).WithIndent(1) + f := formatter.NewFormatter().WithState(formatter.FormatterStatePHP).WithIndent(1) n.Accept(f) - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n.Accept(p) expected := `~$foo` @@ -3388,10 +3389,10 @@ func TestFormatter_ExprBooleanNot(t *testing.T) { }, } - f := visitor.NewFormatter().WithState(visitor.FormatterStatePHP).WithIndent(1) + f := formatter.NewFormatter().WithState(formatter.FormatterStatePHP).WithIndent(1) n.Accept(f) - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n.Accept(p) expected := `!$foo` @@ -3413,10 +3414,10 @@ func TestFormatter_ExprBrackets(t *testing.T) { }, } - f := visitor.NewFormatter().WithState(visitor.FormatterStatePHP).WithIndent(1) + f := formatter.NewFormatter().WithState(formatter.FormatterStatePHP).WithIndent(1) n.Accept(f) - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n.Accept(p) expected := `($foo)` @@ -3441,10 +3442,10 @@ func TestFormatter_ExprClassConstFetch(t *testing.T) { }, } - f := visitor.NewFormatter().WithState(visitor.FormatterStatePHP).WithIndent(1) + f := formatter.NewFormatter().WithState(formatter.FormatterStatePHP).WithIndent(1) n.Accept(f) - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n.Accept(p) expected := `$foo::bar` @@ -3466,10 +3467,10 @@ func TestFormatter_ExprClone(t *testing.T) { }, } - f := visitor.NewFormatter().WithState(visitor.FormatterStatePHP).WithIndent(1) + f := formatter.NewFormatter().WithState(formatter.FormatterStatePHP).WithIndent(1) n.Accept(f) - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n.Accept(p) expected := `clone $foo` @@ -3489,10 +3490,10 @@ func TestFormatter_ExprClosure(t *testing.T) { }, } - f := visitor.NewFormatter().WithState(visitor.FormatterStatePHP).WithIndent(1) + f := formatter.NewFormatter().WithState(formatter.FormatterStatePHP).WithIndent(1) n.Accept(f) - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n.Accept(p) expected := `function() { @@ -3515,10 +3516,10 @@ func TestFormatter_ExprClosure_Ref(t *testing.T) { }, } - f := visitor.NewFormatter().WithState(visitor.FormatterStatePHP).WithIndent(1) + f := formatter.NewFormatter().WithState(formatter.FormatterStatePHP).WithIndent(1) n.Accept(f) - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n.Accept(p) expected := `function&() { @@ -3556,10 +3557,10 @@ func TestFormatter_ExprClosure_Params(t *testing.T) { }, } - f := visitor.NewFormatter().WithState(visitor.FormatterStatePHP).WithIndent(1) + f := formatter.NewFormatter().WithState(formatter.FormatterStatePHP).WithIndent(1) n.Accept(f) - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n.Accept(p) expected := `function($a, $b) { @@ -3588,10 +3589,10 @@ func TestFormatter_ExprClosure_ReturnType(t *testing.T) { }, } - f := visitor.NewFormatter().WithState(visitor.FormatterStatePHP).WithIndent(1) + f := formatter.NewFormatter().WithState(formatter.FormatterStatePHP).WithIndent(1) n.Accept(f) - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n.Accept(p) expected := `function(): foo { @@ -3622,10 +3623,10 @@ func TestFormatter_ExprClosure_Use(t *testing.T) { }, } - f := visitor.NewFormatter().WithState(visitor.FormatterStatePHP).WithIndent(1) + f := formatter.NewFormatter().WithState(formatter.FormatterStatePHP).WithIndent(1) n.Accept(f) - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n.Accept(p) expected := `function() use($foo) { @@ -3649,10 +3650,10 @@ func TestFormatter_ExprClosureUse(t *testing.T) { }, } - f := visitor.NewFormatter().WithState(visitor.FormatterStatePHP).WithIndent(1) + f := formatter.NewFormatter().WithState(formatter.FormatterStatePHP).WithIndent(1) n.Accept(f) - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n.Accept(p) expected := `$a` @@ -3675,10 +3676,10 @@ func TestFormatter_ExprClosureUse_Reference(t *testing.T) { }, } - f := visitor.NewFormatter().WithState(visitor.FormatterStatePHP).WithIndent(1) + f := formatter.NewFormatter().WithState(formatter.FormatterStatePHP).WithIndent(1) n.Accept(f) - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n.Accept(p) expected := `&$a` @@ -3702,10 +3703,10 @@ func TestFormatter_ExprConstFetch(t *testing.T) { }, } - f := visitor.NewFormatter().WithState(visitor.FormatterStatePHP).WithIndent(1) + f := formatter.NewFormatter().WithState(formatter.FormatterStatePHP).WithIndent(1) n.Accept(f) - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n.Accept(p) expected := `FOO` @@ -3727,10 +3728,10 @@ func TestFormatter_ExprEmpty(t *testing.T) { }, } - f := visitor.NewFormatter().WithState(visitor.FormatterStatePHP).WithIndent(1) + f := formatter.NewFormatter().WithState(formatter.FormatterStatePHP).WithIndent(1) n.Accept(f) - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n.Accept(p) expected := `empty($foo)` @@ -3752,10 +3753,10 @@ func TestFormatter_ExprErrorSuppress(t *testing.T) { }, } - f := visitor.NewFormatter().WithState(visitor.FormatterStatePHP).WithIndent(1) + f := formatter.NewFormatter().WithState(formatter.FormatterStatePHP).WithIndent(1) n.Accept(f) - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n.Accept(p) expected := `@$foo` @@ -3777,10 +3778,10 @@ func TestFormatter_ExprEval(t *testing.T) { }, } - f := visitor.NewFormatter().WithState(visitor.FormatterStatePHP).WithIndent(1) + f := formatter.NewFormatter().WithState(formatter.FormatterStatePHP).WithIndent(1) n.Accept(f) - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n.Accept(p) expected := `eval($foo)` @@ -3796,10 +3797,10 @@ func TestFormatter_ExprExit(t *testing.T) { n := &ast.ExprExit{} - f := visitor.NewFormatter().WithState(visitor.FormatterStatePHP).WithIndent(1) + f := formatter.NewFormatter().WithState(formatter.FormatterStatePHP).WithIndent(1) n.Accept(f) - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n.Accept(p) expected := `exit` @@ -3821,10 +3822,10 @@ func TestFormatter_ExprExit_Expr(t *testing.T) { }, } - f := visitor.NewFormatter().WithState(visitor.FormatterStatePHP).WithIndent(1) + f := formatter.NewFormatter().WithState(formatter.FormatterStatePHP).WithIndent(1) n.Accept(f) - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n.Accept(p) expected := `exit($foo)` @@ -3848,10 +3849,10 @@ func TestFormatter_ExprFunctionCall(t *testing.T) { }, } - f := visitor.NewFormatter().WithState(visitor.FormatterStatePHP).WithIndent(1) + f := formatter.NewFormatter().WithState(formatter.FormatterStatePHP).WithIndent(1) n.Accept(f) - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n.Accept(p) expected := `foo()` @@ -3884,10 +3885,10 @@ func TestFormatter_ExprFunctionCall_Arguments(t *testing.T) { }, } - f := visitor.NewFormatter().WithState(visitor.FormatterStatePHP).WithIndent(1) + f := formatter.NewFormatter().WithState(formatter.FormatterStatePHP).WithIndent(1) n.Accept(f) - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n.Accept(p) expected := `foo($bar)` @@ -3907,10 +3908,10 @@ func TestFormatter_ExprInclude(t *testing.T) { }, } - f := visitor.NewFormatter().WithState(visitor.FormatterStatePHP).WithIndent(1) + f := formatter.NewFormatter().WithState(formatter.FormatterStatePHP).WithIndent(1) n.Accept(f) - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n.Accept(p) expected := `include 'foo.php'` @@ -3930,10 +3931,10 @@ func TestFormatter_ExprIncludeOnce(t *testing.T) { }, } - f := visitor.NewFormatter().WithState(visitor.FormatterStatePHP).WithIndent(1) + f := formatter.NewFormatter().WithState(formatter.FormatterStatePHP).WithIndent(1) n.Accept(f) - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n.Accept(p) expected := `include_once 'foo.php'` @@ -3962,10 +3963,10 @@ func TestFormatter_ExprInstanceOf(t *testing.T) { }, } - f := visitor.NewFormatter().WithState(visitor.FormatterStatePHP).WithIndent(1) + f := formatter.NewFormatter().WithState(formatter.FormatterStatePHP).WithIndent(1) n.Accept(f) - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n.Accept(p) expected := `$foo instanceof bar` @@ -3994,10 +3995,10 @@ func TestFormatter_ExprIsset(t *testing.T) { }, } - f := visitor.NewFormatter().WithState(visitor.FormatterStatePHP).WithIndent(1) + f := formatter.NewFormatter().WithState(formatter.FormatterStatePHP).WithIndent(1) n.Accept(f) - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n.Accept(p) expected := `isset($a, $b)` @@ -4030,10 +4031,10 @@ func TestFormatter_ExprList(t *testing.T) { }, } - f := visitor.NewFormatter().WithState(visitor.FormatterStatePHP).WithIndent(1) + f := formatter.NewFormatter().WithState(formatter.FormatterStatePHP).WithIndent(1) n.Accept(f) - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n.Accept(p) expected := `list($a, $b)` @@ -4058,10 +4059,10 @@ func TestFormatter_ExprMethodCall(t *testing.T) { }, } - f := visitor.NewFormatter().WithState(visitor.FormatterStatePHP).WithIndent(1) + f := formatter.NewFormatter().WithState(formatter.FormatterStatePHP).WithIndent(1) n.Accept(f) - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n.Accept(p) expected := `$foo->bar()` @@ -4086,10 +4087,10 @@ func TestFormatter_ExprMethodCall_Expr(t *testing.T) { }, } - f := visitor.NewFormatter().WithState(visitor.FormatterStatePHP).WithIndent(1) + f := formatter.NewFormatter().WithState(formatter.FormatterStatePHP).WithIndent(1) n.Accept(f) - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n.Accept(p) expected := `$foo->{'bar'}()` @@ -4130,10 +4131,10 @@ func TestFormatter_ExprMethodCall_Arguments(t *testing.T) { }, } - f := visitor.NewFormatter().WithState(visitor.FormatterStatePHP).WithIndent(1) + f := formatter.NewFormatter().WithState(formatter.FormatterStatePHP).WithIndent(1) n.Accept(f) - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n.Accept(p) expected := `$foo->bar($a, $b)` @@ -4157,10 +4158,10 @@ func TestFormatter_ExprNew(t *testing.T) { }, } - f := visitor.NewFormatter().WithState(visitor.FormatterStatePHP).WithIndent(1) + f := formatter.NewFormatter().WithState(formatter.FormatterStatePHP).WithIndent(1) n.Accept(f) - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n.Accept(p) expected := `new foo` @@ -4200,10 +4201,10 @@ func TestFormatter_ExprNew_Arguments(t *testing.T) { }, } - f := visitor.NewFormatter().WithState(visitor.FormatterStatePHP).WithIndent(1) + f := formatter.NewFormatter().WithState(formatter.FormatterStatePHP).WithIndent(1) n.Accept(f) - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n.Accept(p) expected := `new foo($a, $b)` @@ -4225,10 +4226,10 @@ func TestFormatter_ExprPreDec(t *testing.T) { }, } - f := visitor.NewFormatter().WithState(visitor.FormatterStatePHP).WithIndent(1) + f := formatter.NewFormatter().WithState(formatter.FormatterStatePHP).WithIndent(1) n.Accept(f) - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n.Accept(p) expected := `--$foo` @@ -4250,10 +4251,10 @@ func TestFormatter_ExprPreInc(t *testing.T) { }, } - f := visitor.NewFormatter().WithState(visitor.FormatterStatePHP).WithIndent(1) + f := formatter.NewFormatter().WithState(formatter.FormatterStatePHP).WithIndent(1) n.Accept(f) - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n.Accept(p) expected := `++$foo` @@ -4275,10 +4276,10 @@ func TestFormatter_ExprPostDec(t *testing.T) { }, } - f := visitor.NewFormatter().WithState(visitor.FormatterStatePHP).WithIndent(1) + f := formatter.NewFormatter().WithState(formatter.FormatterStatePHP).WithIndent(1) n.Accept(f) - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n.Accept(p) expected := `$foo--` @@ -4300,10 +4301,10 @@ func TestFormatter_ExprPostInc(t *testing.T) { }, } - f := visitor.NewFormatter().WithState(visitor.FormatterStatePHP).WithIndent(1) + f := formatter.NewFormatter().WithState(formatter.FormatterStatePHP).WithIndent(1) n.Accept(f) - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n.Accept(p) expected := `$foo++` @@ -4325,10 +4326,10 @@ func TestFormatter_ExprPrint(t *testing.T) { }, } - f := visitor.NewFormatter().WithState(visitor.FormatterStatePHP).WithIndent(1) + f := formatter.NewFormatter().WithState(formatter.FormatterStatePHP).WithIndent(1) n.Accept(f) - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n.Accept(p) expected := `print $foo` @@ -4353,10 +4354,10 @@ func TestFormatter_ExprPropertyFetch(t *testing.T) { }, } - f := visitor.NewFormatter().WithState(visitor.FormatterStatePHP).WithIndent(1) + f := formatter.NewFormatter().WithState(formatter.FormatterStatePHP).WithIndent(1) n.Accept(f) - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n.Accept(p) expected := `$foo->bar` @@ -4381,10 +4382,10 @@ func TestFormatter_ExprPropertyFetch_Expr(t *testing.T) { }, } - f := visitor.NewFormatter().WithState(visitor.FormatterStatePHP).WithIndent(1) + f := formatter.NewFormatter().WithState(formatter.FormatterStatePHP).WithIndent(1) n.Accept(f) - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n.Accept(p) expected := `$foo->{'bar'}` @@ -4404,10 +4405,10 @@ func TestFormatter_ExprRequire(t *testing.T) { }, } - f := visitor.NewFormatter().WithState(visitor.FormatterStatePHP).WithIndent(1) + f := formatter.NewFormatter().WithState(formatter.FormatterStatePHP).WithIndent(1) n.Accept(f) - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n.Accept(p) expected := `require 'foo.php'` @@ -4427,10 +4428,10 @@ func TestFormatter_ExprRequireOnce(t *testing.T) { }, } - f := visitor.NewFormatter().WithState(visitor.FormatterStatePHP).WithIndent(1) + f := formatter.NewFormatter().WithState(formatter.FormatterStatePHP).WithIndent(1) n.Accept(f) - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n.Accept(p) expected := `require_once 'foo.php'` @@ -4446,10 +4447,10 @@ func TestFormatter_ExprShellExec(t *testing.T) { n := &ast.ExprShellExec{} - f := visitor.NewFormatter().WithState(visitor.FormatterStatePHP).WithIndent(1) + f := formatter.NewFormatter().WithState(formatter.FormatterStatePHP).WithIndent(1) n.Accept(f) - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n.Accept(p) expected := "``" @@ -4471,10 +4472,10 @@ func TestFormatter_ExprShellExec_Part(t *testing.T) { }, } - f := visitor.NewFormatter().WithState(visitor.FormatterStatePHP).WithIndent(1) + f := formatter.NewFormatter().WithState(formatter.FormatterStatePHP).WithIndent(1) n.Accept(f) - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n.Accept(p) expected := "`foo`" @@ -4504,10 +4505,10 @@ func TestFormatter_ExprShellExec_Parts(t *testing.T) { }, } - f := visitor.NewFormatter().WithState(visitor.FormatterStatePHP).WithIndent(1) + f := formatter.NewFormatter().WithState(formatter.FormatterStatePHP).WithIndent(1) n.Accept(f) - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n.Accept(p) expected := "`foo $bar baz`" @@ -4534,10 +4535,10 @@ func TestFormatter_ExprStaticCall(t *testing.T) { }, } - f := visitor.NewFormatter().WithState(visitor.FormatterStatePHP).WithIndent(1) + f := formatter.NewFormatter().WithState(formatter.FormatterStatePHP).WithIndent(1) n.Accept(f) - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n.Accept(p) expected := `foo::bar()` @@ -4564,10 +4565,10 @@ func TestFormatter_ExprStaticCall_Expr(t *testing.T) { }, } - f := visitor.NewFormatter().WithState(visitor.FormatterStatePHP).WithIndent(1) + f := formatter.NewFormatter().WithState(formatter.FormatterStatePHP).WithIndent(1) n.Accept(f) - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n.Accept(p) expected := `foo::{'bar'}()` @@ -4610,10 +4611,10 @@ func TestFormatter_ExprStaticCall_Arguments(t *testing.T) { }, } - f := visitor.NewFormatter().WithState(visitor.FormatterStatePHP).WithIndent(1) + f := formatter.NewFormatter().WithState(formatter.FormatterStatePHP).WithIndent(1) n.Accept(f) - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n.Accept(p) expected := `foo::bar($a, $b)` @@ -4642,10 +4643,10 @@ func TestFormatter_ExprStaticPropertyFetch(t *testing.T) { }, } - f := visitor.NewFormatter().WithState(visitor.FormatterStatePHP).WithIndent(1) + f := formatter.NewFormatter().WithState(formatter.FormatterStatePHP).WithIndent(1) n.Accept(f) - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n.Accept(p) expected := `foo::$bar` @@ -4677,10 +4678,10 @@ func TestFormatter_ExprTernary(t *testing.T) { }, } - f := visitor.NewFormatter().WithState(visitor.FormatterStatePHP).WithIndent(1) + f := formatter.NewFormatter().WithState(formatter.FormatterStatePHP).WithIndent(1) n.Accept(f) - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n.Accept(p) expected := `$foo ? $bar : $baz` @@ -4707,10 +4708,10 @@ func TestFormatter_ExprTernary_short(t *testing.T) { }, } - f := visitor.NewFormatter().WithState(visitor.FormatterStatePHP).WithIndent(1) + f := formatter.NewFormatter().WithState(formatter.FormatterStatePHP).WithIndent(1) n.Accept(f) - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n.Accept(p) expected := `$foo ?: $bar` @@ -4732,10 +4733,10 @@ func TestFormatter_ExprUnaryMinus(t *testing.T) { }, } - f := visitor.NewFormatter().WithState(visitor.FormatterStatePHP).WithIndent(1) + f := formatter.NewFormatter().WithState(formatter.FormatterStatePHP).WithIndent(1) n.Accept(f) - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n.Accept(p) expected := `-$foo` @@ -4757,10 +4758,10 @@ func TestFormatter_ExprUnaryPlus(t *testing.T) { }, } - f := visitor.NewFormatter().WithState(visitor.FormatterStatePHP).WithIndent(1) + f := formatter.NewFormatter().WithState(formatter.FormatterStatePHP).WithIndent(1) n.Accept(f) - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n.Accept(p) expected := `+$foo` @@ -4780,10 +4781,10 @@ func TestFormatter_ExprVariable(t *testing.T) { }, } - f := visitor.NewFormatter().WithState(visitor.FormatterStatePHP).WithIndent(1) + f := formatter.NewFormatter().WithState(formatter.FormatterStatePHP).WithIndent(1) n.Accept(f) - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n.Accept(p) expected := `$foo` @@ -4805,10 +4806,10 @@ func TestFormatter_ExprVariable_Variable(t *testing.T) { }, } - f := visitor.NewFormatter().WithState(visitor.FormatterStatePHP).WithIndent(1) + f := formatter.NewFormatter().WithState(formatter.FormatterStatePHP).WithIndent(1) n.Accept(f) - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n.Accept(p) expected := `$$foo` @@ -4828,10 +4829,10 @@ func TestFormatter_ExprVariable_Expression(t *testing.T) { }, } - f := visitor.NewFormatter().WithState(visitor.FormatterStatePHP).WithIndent(1) + f := formatter.NewFormatter().WithState(formatter.FormatterStatePHP).WithIndent(1) n.Accept(f) - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n.Accept(p) expected := `${'foo'}` @@ -4853,10 +4854,10 @@ func TestFormatter_ExprYield(t *testing.T) { }, } - f := visitor.NewFormatter().WithState(visitor.FormatterStatePHP).WithIndent(1) + f := formatter.NewFormatter().WithState(formatter.FormatterStatePHP).WithIndent(1) n.Accept(f) - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n.Accept(p) expected := `yield $foo` @@ -4883,10 +4884,10 @@ func TestFormatter_ExprYield_Key(t *testing.T) { }, } - f := visitor.NewFormatter().WithState(visitor.FormatterStatePHP).WithIndent(1) + f := formatter.NewFormatter().WithState(formatter.FormatterStatePHP).WithIndent(1) n.Accept(f) - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n.Accept(p) expected := `yield $foo => $bar` @@ -4908,10 +4909,10 @@ func TestFormatter_ExprYieldFrom(t *testing.T) { }, } - f := visitor.NewFormatter().WithState(visitor.FormatterStatePHP).WithIndent(1) + f := formatter.NewFormatter().WithState(formatter.FormatterStatePHP).WithIndent(1) n.Accept(f) - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n.Accept(p) expected := `yield from $foo` @@ -4938,10 +4939,10 @@ func TestFormatter_ExprAssign(t *testing.T) { }, } - f := visitor.NewFormatter().WithState(visitor.FormatterStatePHP).WithIndent(1) + f := formatter.NewFormatter().WithState(formatter.FormatterStatePHP).WithIndent(1) n.Accept(f) - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n.Accept(p) expected := `$foo = $bar` @@ -4968,10 +4969,10 @@ func TestFormatter_ExprAssignReference(t *testing.T) { }, } - f := visitor.NewFormatter().WithState(visitor.FormatterStatePHP).WithIndent(1) + f := formatter.NewFormatter().WithState(formatter.FormatterStatePHP).WithIndent(1) n.Accept(f) - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n.Accept(p) expected := `$foo =& $bar` @@ -4998,10 +4999,10 @@ func TestFormatter_ExprAssignBitwiseAnd(t *testing.T) { }, } - f := visitor.NewFormatter().WithState(visitor.FormatterStatePHP).WithIndent(1) + f := formatter.NewFormatter().WithState(formatter.FormatterStatePHP).WithIndent(1) n.Accept(f) - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n.Accept(p) expected := `$foo &= $bar` @@ -5028,10 +5029,10 @@ func TestFormatter_ExprAssignBitwiseOr(t *testing.T) { }, } - f := visitor.NewFormatter().WithState(visitor.FormatterStatePHP).WithIndent(1) + f := formatter.NewFormatter().WithState(formatter.FormatterStatePHP).WithIndent(1) n.Accept(f) - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n.Accept(p) expected := `$foo |= $bar` @@ -5058,10 +5059,10 @@ func TestFormatter_ExprAssignBitwiseXor(t *testing.T) { }, } - f := visitor.NewFormatter().WithState(visitor.FormatterStatePHP).WithIndent(1) + f := formatter.NewFormatter().WithState(formatter.FormatterStatePHP).WithIndent(1) n.Accept(f) - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n.Accept(p) expected := `$foo ^= $bar` @@ -5088,10 +5089,10 @@ func TestFormatter_ExprAssignCoalesce(t *testing.T) { }, } - f := visitor.NewFormatter().WithState(visitor.FormatterStatePHP).WithIndent(1) + f := formatter.NewFormatter().WithState(formatter.FormatterStatePHP).WithIndent(1) n.Accept(f) - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n.Accept(p) expected := `$foo ??= $bar` @@ -5118,10 +5119,10 @@ func TestFormatter_ExprAssignConcat(t *testing.T) { }, } - f := visitor.NewFormatter().WithState(visitor.FormatterStatePHP).WithIndent(1) + f := formatter.NewFormatter().WithState(formatter.FormatterStatePHP).WithIndent(1) n.Accept(f) - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n.Accept(p) expected := `$foo .= $bar` @@ -5148,10 +5149,10 @@ func TestFormatter_ExprAssignDiv(t *testing.T) { }, } - f := visitor.NewFormatter().WithState(visitor.FormatterStatePHP).WithIndent(1) + f := formatter.NewFormatter().WithState(formatter.FormatterStatePHP).WithIndent(1) n.Accept(f) - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n.Accept(p) expected := `$foo /= $bar` @@ -5178,10 +5179,10 @@ func TestFormatter_ExprAssignMinus(t *testing.T) { }, } - f := visitor.NewFormatter().WithState(visitor.FormatterStatePHP).WithIndent(1) + f := formatter.NewFormatter().WithState(formatter.FormatterStatePHP).WithIndent(1) n.Accept(f) - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n.Accept(p) expected := `$foo -= $bar` @@ -5208,10 +5209,10 @@ func TestFormatter_ExprAssignMod(t *testing.T) { }, } - f := visitor.NewFormatter().WithState(visitor.FormatterStatePHP).WithIndent(1) + f := formatter.NewFormatter().WithState(formatter.FormatterStatePHP).WithIndent(1) n.Accept(f) - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n.Accept(p) expected := `$foo %= $bar` @@ -5238,10 +5239,10 @@ func TestFormatter_ExprAssignMul(t *testing.T) { }, } - f := visitor.NewFormatter().WithState(visitor.FormatterStatePHP).WithIndent(1) + f := formatter.NewFormatter().WithState(formatter.FormatterStatePHP).WithIndent(1) n.Accept(f) - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n.Accept(p) expected := `$foo *= $bar` @@ -5268,10 +5269,10 @@ func TestFormatter_ExprAssignPlus(t *testing.T) { }, } - f := visitor.NewFormatter().WithState(visitor.FormatterStatePHP).WithIndent(1) + f := formatter.NewFormatter().WithState(formatter.FormatterStatePHP).WithIndent(1) n.Accept(f) - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n.Accept(p) expected := `$foo += $bar` @@ -5298,10 +5299,10 @@ func TestFormatter_ExprAssignPow(t *testing.T) { }, } - f := visitor.NewFormatter().WithState(visitor.FormatterStatePHP).WithIndent(1) + f := formatter.NewFormatter().WithState(formatter.FormatterStatePHP).WithIndent(1) n.Accept(f) - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n.Accept(p) expected := `$foo **= $bar` @@ -5328,10 +5329,10 @@ func TestFormatter_ExprAssignShiftLeft(t *testing.T) { }, } - f := visitor.NewFormatter().WithState(visitor.FormatterStatePHP).WithIndent(1) + f := formatter.NewFormatter().WithState(formatter.FormatterStatePHP).WithIndent(1) n.Accept(f) - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n.Accept(p) expected := `$foo <<= $bar` @@ -5358,10 +5359,10 @@ func TestFormatter_ExprAssignShiftRight(t *testing.T) { }, } - f := visitor.NewFormatter().WithState(visitor.FormatterStatePHP).WithIndent(1) + f := formatter.NewFormatter().WithState(formatter.FormatterStatePHP).WithIndent(1) n.Accept(f) - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n.Accept(p) expected := `$foo >>= $bar` @@ -5388,10 +5389,10 @@ func TestFormatter_ExprBinaryBitwiseAnd(t *testing.T) { }, } - f := visitor.NewFormatter().WithState(visitor.FormatterStatePHP).WithIndent(1) + f := formatter.NewFormatter().WithState(formatter.FormatterStatePHP).WithIndent(1) n.Accept(f) - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n.Accept(p) expected := `$foo & $bar` @@ -5418,10 +5419,10 @@ func TestFormatter_ExprBinaryBitwiseOr(t *testing.T) { }, } - f := visitor.NewFormatter().WithState(visitor.FormatterStatePHP).WithIndent(1) + f := formatter.NewFormatter().WithState(formatter.FormatterStatePHP).WithIndent(1) n.Accept(f) - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n.Accept(p) expected := `$foo | $bar` @@ -5448,10 +5449,10 @@ func TestFormatter_ExprBinaryBitwiseXor(t *testing.T) { }, } - f := visitor.NewFormatter().WithState(visitor.FormatterStatePHP).WithIndent(1) + f := formatter.NewFormatter().WithState(formatter.FormatterStatePHP).WithIndent(1) n.Accept(f) - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n.Accept(p) expected := `$foo ^ $bar` @@ -5478,10 +5479,10 @@ func TestFormatter_ExprBinaryBooleanAnd(t *testing.T) { }, } - f := visitor.NewFormatter().WithState(visitor.FormatterStatePHP).WithIndent(1) + f := formatter.NewFormatter().WithState(formatter.FormatterStatePHP).WithIndent(1) n.Accept(f) - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n.Accept(p) expected := `$foo && $bar` @@ -5508,10 +5509,10 @@ func TestFormatter_ExprBinaryBooleanOr(t *testing.T) { }, } - f := visitor.NewFormatter().WithState(visitor.FormatterStatePHP).WithIndent(1) + f := formatter.NewFormatter().WithState(formatter.FormatterStatePHP).WithIndent(1) n.Accept(f) - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n.Accept(p) expected := `$foo || $bar` @@ -5538,10 +5539,10 @@ func TestFormatter_ExprBinaryCoalesce(t *testing.T) { }, } - f := visitor.NewFormatter().WithState(visitor.FormatterStatePHP).WithIndent(1) + f := formatter.NewFormatter().WithState(formatter.FormatterStatePHP).WithIndent(1) n.Accept(f) - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n.Accept(p) expected := `$foo ?? $bar` @@ -5568,10 +5569,10 @@ func TestFormatter_ExprBinaryConcat(t *testing.T) { }, } - f := visitor.NewFormatter().WithState(visitor.FormatterStatePHP).WithIndent(1) + f := formatter.NewFormatter().WithState(formatter.FormatterStatePHP).WithIndent(1) n.Accept(f) - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n.Accept(p) expected := `$foo . $bar` @@ -5598,10 +5599,10 @@ func TestFormatter_ExprBinaryDiv(t *testing.T) { }, } - f := visitor.NewFormatter().WithState(visitor.FormatterStatePHP).WithIndent(1) + f := formatter.NewFormatter().WithState(formatter.FormatterStatePHP).WithIndent(1) n.Accept(f) - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n.Accept(p) expected := `$foo / $bar` @@ -5628,10 +5629,10 @@ func TestFormatter_ExprBinaryEqual(t *testing.T) { }, } - f := visitor.NewFormatter().WithState(visitor.FormatterStatePHP).WithIndent(1) + f := formatter.NewFormatter().WithState(formatter.FormatterStatePHP).WithIndent(1) n.Accept(f) - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n.Accept(p) expected := `$foo == $bar` @@ -5658,10 +5659,10 @@ func TestFormatter_ExprBinaryGreater(t *testing.T) { }, } - f := visitor.NewFormatter().WithState(visitor.FormatterStatePHP).WithIndent(1) + f := formatter.NewFormatter().WithState(formatter.FormatterStatePHP).WithIndent(1) n.Accept(f) - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n.Accept(p) expected := `$foo > $bar` @@ -5688,10 +5689,10 @@ func TestFormatter_ExprBinaryGreaterOrEqual(t *testing.T) { }, } - f := visitor.NewFormatter().WithState(visitor.FormatterStatePHP).WithIndent(1) + f := formatter.NewFormatter().WithState(formatter.FormatterStatePHP).WithIndent(1) n.Accept(f) - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n.Accept(p) expected := `$foo >= $bar` @@ -5718,10 +5719,10 @@ func TestFormatter_ExprBinaryIdentical(t *testing.T) { }, } - f := visitor.NewFormatter().WithState(visitor.FormatterStatePHP).WithIndent(1) + f := formatter.NewFormatter().WithState(formatter.FormatterStatePHP).WithIndent(1) n.Accept(f) - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n.Accept(p) expected := `$foo === $bar` @@ -5748,10 +5749,10 @@ func TestFormatter_ExprBinaryLogicalAnd(t *testing.T) { }, } - f := visitor.NewFormatter().WithState(visitor.FormatterStatePHP).WithIndent(1) + f := formatter.NewFormatter().WithState(formatter.FormatterStatePHP).WithIndent(1) n.Accept(f) - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n.Accept(p) expected := `$foo and $bar` @@ -5778,10 +5779,10 @@ func TestFormatter_ExprBinaryLogicalOr(t *testing.T) { }, } - f := visitor.NewFormatter().WithState(visitor.FormatterStatePHP).WithIndent(1) + f := formatter.NewFormatter().WithState(formatter.FormatterStatePHP).WithIndent(1) n.Accept(f) - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n.Accept(p) expected := `$foo or $bar` @@ -5808,10 +5809,10 @@ func TestFormatter_ExprBinaryLogicalXor(t *testing.T) { }, } - f := visitor.NewFormatter().WithState(visitor.FormatterStatePHP).WithIndent(1) + f := formatter.NewFormatter().WithState(formatter.FormatterStatePHP).WithIndent(1) n.Accept(f) - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n.Accept(p) expected := `$foo xor $bar` @@ -5838,10 +5839,10 @@ func TestFormatter_ExprBinaryMinus(t *testing.T) { }, } - f := visitor.NewFormatter().WithState(visitor.FormatterStatePHP).WithIndent(1) + f := formatter.NewFormatter().WithState(formatter.FormatterStatePHP).WithIndent(1) n.Accept(f) - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n.Accept(p) expected := `$foo - $bar` @@ -5868,10 +5869,10 @@ func TestFormatter_ExprBinaryMod(t *testing.T) { }, } - f := visitor.NewFormatter().WithState(visitor.FormatterStatePHP).WithIndent(1) + f := formatter.NewFormatter().WithState(formatter.FormatterStatePHP).WithIndent(1) n.Accept(f) - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n.Accept(p) expected := `$foo % $bar` @@ -5898,10 +5899,10 @@ func TestFormatter_ExprBinaryMul(t *testing.T) { }, } - f := visitor.NewFormatter().WithState(visitor.FormatterStatePHP).WithIndent(1) + f := formatter.NewFormatter().WithState(formatter.FormatterStatePHP).WithIndent(1) n.Accept(f) - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n.Accept(p) expected := `$foo * $bar` @@ -5928,10 +5929,10 @@ func TestFormatter_ExprBinaryNotEqual(t *testing.T) { }, } - f := visitor.NewFormatter().WithState(visitor.FormatterStatePHP).WithIndent(1) + f := formatter.NewFormatter().WithState(formatter.FormatterStatePHP).WithIndent(1) n.Accept(f) - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n.Accept(p) expected := `$foo != $bar` @@ -5958,10 +5959,10 @@ func TestFormatter_ExprBinaryNotIdentical(t *testing.T) { }, } - f := visitor.NewFormatter().WithState(visitor.FormatterStatePHP).WithIndent(1) + f := formatter.NewFormatter().WithState(formatter.FormatterStatePHP).WithIndent(1) n.Accept(f) - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n.Accept(p) expected := `$foo !== $bar` @@ -5988,10 +5989,10 @@ func TestFormatter_ExprBinaryPlus(t *testing.T) { }, } - f := visitor.NewFormatter().WithState(visitor.FormatterStatePHP).WithIndent(1) + f := formatter.NewFormatter().WithState(formatter.FormatterStatePHP).WithIndent(1) n.Accept(f) - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n.Accept(p) expected := `$foo + $bar` @@ -6018,10 +6019,10 @@ func TestFormatter_ExprBinaryPow(t *testing.T) { }, } - f := visitor.NewFormatter().WithState(visitor.FormatterStatePHP).WithIndent(1) + f := formatter.NewFormatter().WithState(formatter.FormatterStatePHP).WithIndent(1) n.Accept(f) - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n.Accept(p) expected := `$foo ** $bar` @@ -6048,10 +6049,10 @@ func TestFormatter_ExprBinaryShiftLeft(t *testing.T) { }, } - f := visitor.NewFormatter().WithState(visitor.FormatterStatePHP).WithIndent(1) + f := formatter.NewFormatter().WithState(formatter.FormatterStatePHP).WithIndent(1) n.Accept(f) - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n.Accept(p) expected := `$foo << $bar` @@ -6078,10 +6079,10 @@ func TestFormatter_ExprBinaryShiftRight(t *testing.T) { }, } - f := visitor.NewFormatter().WithState(visitor.FormatterStatePHP).WithIndent(1) + f := formatter.NewFormatter().WithState(formatter.FormatterStatePHP).WithIndent(1) n.Accept(f) - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n.Accept(p) expected := `$foo >> $bar` @@ -6108,10 +6109,10 @@ func TestFormatter_ExprBinarySmaller(t *testing.T) { }, } - f := visitor.NewFormatter().WithState(visitor.FormatterStatePHP).WithIndent(1) + f := formatter.NewFormatter().WithState(formatter.FormatterStatePHP).WithIndent(1) n.Accept(f) - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n.Accept(p) expected := `$foo < $bar` @@ -6138,10 +6139,10 @@ func TestFormatter_ExprBinarySmallerOrEqual(t *testing.T) { }, } - f := visitor.NewFormatter().WithState(visitor.FormatterStatePHP).WithIndent(1) + f := formatter.NewFormatter().WithState(formatter.FormatterStatePHP).WithIndent(1) n.Accept(f) - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n.Accept(p) expected := `$foo <= $bar` @@ -6168,10 +6169,10 @@ func TestFormatter_ExprBinarySpaceship(t *testing.T) { }, } - f := visitor.NewFormatter().WithState(visitor.FormatterStatePHP).WithIndent(1) + f := formatter.NewFormatter().WithState(formatter.FormatterStatePHP).WithIndent(1) n.Accept(f) - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n.Accept(p) expected := `$foo <=> $bar` @@ -6193,10 +6194,10 @@ func TestFormatter_ExprCastArray(t *testing.T) { }, } - f := visitor.NewFormatter().WithState(visitor.FormatterStatePHP).WithIndent(1) + f := formatter.NewFormatter().WithState(formatter.FormatterStatePHP).WithIndent(1) n.Accept(f) - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n.Accept(p) expected := `(array)$foo` @@ -6218,10 +6219,10 @@ func TestFormatter_ExprCastBool(t *testing.T) { }, } - f := visitor.NewFormatter().WithState(visitor.FormatterStatePHP).WithIndent(1) + f := formatter.NewFormatter().WithState(formatter.FormatterStatePHP).WithIndent(1) n.Accept(f) - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n.Accept(p) expected := `(bool)$foo` @@ -6243,10 +6244,10 @@ func TestFormatter_ExprCastDouble(t *testing.T) { }, } - f := visitor.NewFormatter().WithState(visitor.FormatterStatePHP).WithIndent(1) + f := formatter.NewFormatter().WithState(formatter.FormatterStatePHP).WithIndent(1) n.Accept(f) - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n.Accept(p) expected := `(float)$foo` @@ -6268,10 +6269,10 @@ func TestFormatter_ExprCastInt(t *testing.T) { }, } - f := visitor.NewFormatter().WithState(visitor.FormatterStatePHP).WithIndent(1) + f := formatter.NewFormatter().WithState(formatter.FormatterStatePHP).WithIndent(1) n.Accept(f) - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n.Accept(p) expected := `(int)$foo` @@ -6293,10 +6294,10 @@ func TestFormatter_ExprCastObject(t *testing.T) { }, } - f := visitor.NewFormatter().WithState(visitor.FormatterStatePHP).WithIndent(1) + f := formatter.NewFormatter().WithState(formatter.FormatterStatePHP).WithIndent(1) n.Accept(f) - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n.Accept(p) expected := `(object)$foo` @@ -6318,10 +6319,10 @@ func TestFormatter_ExprCastString(t *testing.T) { }, } - f := visitor.NewFormatter().WithState(visitor.FormatterStatePHP).WithIndent(1) + f := formatter.NewFormatter().WithState(formatter.FormatterStatePHP).WithIndent(1) n.Accept(f) - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n.Accept(p) expected := `(string)$foo` @@ -6343,10 +6344,10 @@ func TestFormatter_ExprCastUnset(t *testing.T) { }, } - f := visitor.NewFormatter().WithState(visitor.FormatterStatePHP).WithIndent(1) + f := formatter.NewFormatter().WithState(formatter.FormatterStatePHP).WithIndent(1) n.Accept(f) - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n.Accept(p) expected := `(unset)$foo` @@ -6364,10 +6365,10 @@ func TestFormatter_ScalarDnumber(t *testing.T) { Value: []byte("1234"), } - f := visitor.NewFormatter().WithState(visitor.FormatterStatePHP).WithIndent(1) + f := formatter.NewFormatter().WithState(formatter.FormatterStatePHP).WithIndent(1) n.Accept(f) - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n.Accept(p) expected := `1234` @@ -6383,10 +6384,10 @@ func TestFormatter_ScalarEncapsed(t *testing.T) { n := &ast.ScalarEncapsed{} - f := visitor.NewFormatter().WithState(visitor.FormatterStatePHP).WithIndent(1) + f := formatter.NewFormatter().WithState(formatter.FormatterStatePHP).WithIndent(1) n.Accept(f) - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n.Accept(p) expected := `""` @@ -6408,10 +6409,10 @@ func TestFormatter_ScalarEncapsed_Part(t *testing.T) { }, } - f := visitor.NewFormatter().WithState(visitor.FormatterStatePHP).WithIndent(1) + f := formatter.NewFormatter().WithState(formatter.FormatterStatePHP).WithIndent(1) n.Accept(f) - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n.Accept(p) expected := `"foo"` @@ -6441,10 +6442,10 @@ func TestFormatter_ScalarEncapsed_Parts(t *testing.T) { }, } - f := visitor.NewFormatter().WithState(visitor.FormatterStatePHP).WithIndent(1) + f := formatter.NewFormatter().WithState(formatter.FormatterStatePHP).WithIndent(1) n.Accept(f) - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n.Accept(p) expected := `"foo $bar baz"` @@ -6462,10 +6463,10 @@ func TestFormatter_ScalarEncapsedStringPart(t *testing.T) { Value: []byte("foo"), } - f := visitor.NewFormatter().WithState(visitor.FormatterStatePHP).WithIndent(1) + f := formatter.NewFormatter().WithState(formatter.FormatterStatePHP).WithIndent(1) n.Accept(f) - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n.Accept(p) expected := `foo` @@ -6485,10 +6486,10 @@ func TestFormatter_ScalarEncapsedStringVar(t *testing.T) { }, } - f := visitor.NewFormatter().WithState(visitor.FormatterStatePHP).WithIndent(1) + f := formatter.NewFormatter().WithState(formatter.FormatterStatePHP).WithIndent(1) n.Accept(f) - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n.Accept(p) expected := `${foo}` @@ -6511,10 +6512,10 @@ func TestFormatter_ScalarEncapsedStringVar_Dim(t *testing.T) { }, } - f := visitor.NewFormatter().WithState(visitor.FormatterStatePHP).WithIndent(1) + f := formatter.NewFormatter().WithState(formatter.FormatterStatePHP).WithIndent(1) n.Accept(f) - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n.Accept(p) expected := `${foo['bar']}` @@ -6536,10 +6537,10 @@ func TestFormatter_ScalarEncapsedStringBrackets(t *testing.T) { }, } - f := visitor.NewFormatter().WithState(visitor.FormatterStatePHP).WithIndent(1) + f := formatter.NewFormatter().WithState(formatter.FormatterStatePHP).WithIndent(1) n.Accept(f) - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n.Accept(p) expected := `{$foo}` @@ -6555,10 +6556,10 @@ func TestFormatter_ScalarHeredoc(t *testing.T) { n := &ast.ScalarHeredoc{} - f := visitor.NewFormatter().WithState(visitor.FormatterStatePHP).WithIndent(1) + f := formatter.NewFormatter().WithState(formatter.FormatterStatePHP).WithIndent(1) n.Accept(f) - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n.Accept(p) expected := `<<HTML")}, @@ -101,7 +101,7 @@ func TestPrinterPrintFileInlineHtml(t *testing.T) { func TestPrinterPrintIdentifier(t *testing.T) { o := bytes.NewBufferString("") - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n := &ast.Identifier{ Value: []byte("test"), } @@ -118,7 +118,7 @@ func TestPrinterPrintIdentifier(t *testing.T) { func TestPrinterPrintParameter(t *testing.T) { o := bytes.NewBufferString("") - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n := &ast.Parameter{ Type: &ast.NameFullyQualified{ Parts: []ast.Vertex{ @@ -150,7 +150,7 @@ func TestPrinterPrintParameter(t *testing.T) { func TestPrinterPrintNullable(t *testing.T) { o := bytes.NewBufferString("") - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n := &ast.Nullable{ Expr: &ast.Parameter{ Type: &ast.NameFullyQualified{ @@ -184,7 +184,7 @@ func TestPrinterPrintNullable(t *testing.T) { func TestPrinterPrintArgument(t *testing.T) { o := bytes.NewBufferString("") - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n := &ast.Argument{ VariadicTkn: &token.Token{ Value: []byte("..."), @@ -205,7 +205,7 @@ func TestPrinterPrintArgument(t *testing.T) { func TestPrinterPrintArgumentByRef(t *testing.T) { o := bytes.NewBufferString("") - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n := &ast.Argument{ AmpersandTkn: &token.Token{ Value: []byte("&"), @@ -229,7 +229,7 @@ func TestPrinterPrintArgumentByRef(t *testing.T) { func TestPrinterPrintNameNamePart(t *testing.T) { o := bytes.NewBufferString("") - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n := &ast.NameNamePart{ Value: []byte("foo"), } @@ -246,7 +246,7 @@ func TestPrinterPrintNameNamePart(t *testing.T) { func TestPrinterPrintNameName(t *testing.T) { o := bytes.NewBufferString("") - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n := &ast.NameName{ Parts: []ast.Vertex{ &ast.NameNamePart{ @@ -270,7 +270,7 @@ func TestPrinterPrintNameName(t *testing.T) { func TestPrinterPrintNameFullyQualified(t *testing.T) { o := bytes.NewBufferString("") - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n := &ast.NameFullyQualified{ Parts: []ast.Vertex{ &ast.NameNamePart{ @@ -294,7 +294,7 @@ func TestPrinterPrintNameFullyQualified(t *testing.T) { func TestPrinterPrintNameRelative(t *testing.T) { o := bytes.NewBufferString("") - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n := &ast.NameRelative{ Parts: []ast.Vertex{ &ast.NameNamePart{ @@ -320,7 +320,7 @@ func TestPrinterPrintNameRelative(t *testing.T) { func TestPrinterPrintScalarLNumber(t *testing.T) { o := bytes.NewBufferString("") - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n := &ast.ScalarLnumber{ Value: []byte("1"), } @@ -337,7 +337,7 @@ func TestPrinterPrintScalarLNumber(t *testing.T) { func TestPrinterPrintScalarDNumber(t *testing.T) { o := bytes.NewBufferString("") - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n := &ast.ScalarDnumber{ Value: []byte(".1"), } @@ -354,7 +354,7 @@ func TestPrinterPrintScalarDNumber(t *testing.T) { func TestPrinterPrintScalarString(t *testing.T) { o := bytes.NewBufferString("") - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n := &ast.ScalarString{ Value: []byte("'hello world'"), } @@ -371,7 +371,7 @@ func TestPrinterPrintScalarString(t *testing.T) { func TestPrinterPrintScalarEncapsedStringPart(t *testing.T) { o := bytes.NewBufferString("") - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n := &ast.ScalarEncapsedStringPart{ Value: []byte("hello world"), } @@ -388,7 +388,7 @@ func TestPrinterPrintScalarEncapsedStringPart(t *testing.T) { func TestPrinterPrintScalarEncapsed(t *testing.T) { o := bytes.NewBufferString("") - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n := &ast.ScalarEncapsed{ Parts: []ast.Vertex{ &ast.ScalarEncapsedStringPart{Value: []byte("hello ")}, @@ -411,7 +411,7 @@ func TestPrinterPrintScalarEncapsed(t *testing.T) { func TestPrinterPrintScalarHeredoc(t *testing.T) { o := bytes.NewBufferString("") - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n := &ast.ScalarHeredoc{ Parts: []ast.Vertex{ &ast.ScalarEncapsedStringPart{Value: []byte("hello ")}, @@ -436,7 +436,7 @@ EOT` func TestPrinterPrintScalarMagicConstant(t *testing.T) { o := bytes.NewBufferString("") - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n := &ast.ScalarMagicConstant{ Value: []byte("__DIR__"), } @@ -452,7 +452,7 @@ func TestPrinterPrintScalarMagicConstant(t *testing.T) { func TestPrinterPrintAssign(t *testing.T) { o := bytes.NewBufferString("") - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n := &ast.ExprAssign{ Var: &ast.ExprVariable{ VarName: &ast.Identifier{Value: []byte("$a")}, @@ -474,7 +474,7 @@ func TestPrinterPrintAssign(t *testing.T) { func TestPrinterPrintReference(t *testing.T) { o := bytes.NewBufferString("") - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n := &ast.ExprAssignReference{ Var: &ast.ExprVariable{ VarName: &ast.Identifier{Value: []byte("$a")}, @@ -496,7 +496,7 @@ func TestPrinterPrintReference(t *testing.T) { func TestPrinterPrintAssignBitwiseAnd(t *testing.T) { o := bytes.NewBufferString("") - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n := &ast.ExprAssignBitwiseAnd{ Var: &ast.ExprVariable{ VarName: &ast.Identifier{Value: []byte("$a")}, @@ -518,7 +518,7 @@ func TestPrinterPrintAssignBitwiseAnd(t *testing.T) { func TestPrinterPrintAssignBitwiseOr(t *testing.T) { o := bytes.NewBufferString("") - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n := &ast.ExprAssignBitwiseOr{ Var: &ast.ExprVariable{ VarName: &ast.Identifier{Value: []byte("$a")}, @@ -540,7 +540,7 @@ func TestPrinterPrintAssignBitwiseOr(t *testing.T) { func TestPrinterPrintAssignBitwiseXor(t *testing.T) { o := bytes.NewBufferString("") - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n := &ast.ExprAssignBitwiseXor{ Var: &ast.ExprVariable{ VarName: &ast.Identifier{Value: []byte("$a")}, @@ -562,7 +562,7 @@ func TestPrinterPrintAssignBitwiseXor(t *testing.T) { func TestPrinterPrintAssignCoalesce(t *testing.T) { o := bytes.NewBufferString("") - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n := &ast.ExprAssignCoalesce{ Var: &ast.ExprVariable{ VarName: &ast.Identifier{Value: []byte("$a")}, @@ -584,7 +584,7 @@ func TestPrinterPrintAssignCoalesce(t *testing.T) { func TestPrinterPrintAssignConcat(t *testing.T) { o := bytes.NewBufferString("") - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n := &ast.ExprAssignConcat{ Var: &ast.ExprVariable{ VarName: &ast.Identifier{Value: []byte("$a")}, @@ -606,7 +606,7 @@ func TestPrinterPrintAssignConcat(t *testing.T) { func TestPrinterPrintAssignDiv(t *testing.T) { o := bytes.NewBufferString("") - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n := &ast.ExprAssignDiv{ Var: &ast.ExprVariable{ VarName: &ast.Identifier{Value: []byte("$a")}, @@ -628,7 +628,7 @@ func TestPrinterPrintAssignDiv(t *testing.T) { func TestPrinterPrintAssignMinus(t *testing.T) { o := bytes.NewBufferString("") - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n := &ast.ExprAssignMinus{ Var: &ast.ExprVariable{ VarName: &ast.Identifier{Value: []byte("$a")}, @@ -650,7 +650,7 @@ func TestPrinterPrintAssignMinus(t *testing.T) { func TestPrinterPrintAssignMod(t *testing.T) { o := bytes.NewBufferString("") - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n := &ast.ExprAssignMod{ Var: &ast.ExprVariable{ VarName: &ast.Identifier{Value: []byte("$a")}, @@ -672,7 +672,7 @@ func TestPrinterPrintAssignMod(t *testing.T) { func TestPrinterPrintAssignMul(t *testing.T) { o := bytes.NewBufferString("") - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n := &ast.ExprAssignMul{ Var: &ast.ExprVariable{ VarName: &ast.Identifier{Value: []byte("$a")}, @@ -694,7 +694,7 @@ func TestPrinterPrintAssignMul(t *testing.T) { func TestPrinterPrintAssignPlus(t *testing.T) { o := bytes.NewBufferString("") - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n := &ast.ExprAssignPlus{ Var: &ast.ExprVariable{ VarName: &ast.Identifier{Value: []byte("$a")}, @@ -716,7 +716,7 @@ func TestPrinterPrintAssignPlus(t *testing.T) { func TestPrinterPrintAssignPow(t *testing.T) { o := bytes.NewBufferString("") - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n := &ast.ExprAssignPow{ Var: &ast.ExprVariable{ VarName: &ast.Identifier{Value: []byte("$a")}, @@ -738,7 +738,7 @@ func TestPrinterPrintAssignPow(t *testing.T) { func TestPrinterPrintAssignShiftLeft(t *testing.T) { o := bytes.NewBufferString("") - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n := &ast.ExprAssignShiftLeft{ Var: &ast.ExprVariable{ VarName: &ast.Identifier{Value: []byte("$a")}, @@ -760,7 +760,7 @@ func TestPrinterPrintAssignShiftLeft(t *testing.T) { func TestPrinterPrintAssignShiftRight(t *testing.T) { o := bytes.NewBufferString("") - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n := &ast.ExprAssignShiftRight{ Var: &ast.ExprVariable{ VarName: &ast.Identifier{Value: []byte("$a")}, @@ -784,7 +784,7 @@ func TestPrinterPrintAssignShiftRight(t *testing.T) { func TestPrinterPrintBinaryBitwiseAnd(t *testing.T) { o := bytes.NewBufferString("") - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n := &ast.ExprBinaryBitwiseAnd{ Left: &ast.ExprVariable{ VarName: &ast.Identifier{Value: []byte("$a")}, @@ -806,7 +806,7 @@ func TestPrinterPrintBinaryBitwiseAnd(t *testing.T) { func TestPrinterPrintBinaryBitwiseOr(t *testing.T) { o := bytes.NewBufferString("") - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n := &ast.ExprBinaryBitwiseOr{ Left: &ast.ExprVariable{ VarName: &ast.Identifier{Value: []byte("$a")}, @@ -828,7 +828,7 @@ func TestPrinterPrintBinaryBitwiseOr(t *testing.T) { func TestPrinterPrintBinaryBitwiseXor(t *testing.T) { o := bytes.NewBufferString("") - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n := &ast.ExprBinaryBitwiseXor{ Left: &ast.ExprVariable{ VarName: &ast.Identifier{Value: []byte("$a")}, @@ -850,7 +850,7 @@ func TestPrinterPrintBinaryBitwiseXor(t *testing.T) { func TestPrinterPrintBinaryBooleanAnd(t *testing.T) { o := bytes.NewBufferString("") - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n := &ast.ExprBinaryBooleanAnd{ Left: &ast.ExprVariable{ VarName: &ast.Identifier{Value: []byte("$a")}, @@ -872,7 +872,7 @@ func TestPrinterPrintBinaryBooleanAnd(t *testing.T) { func TestPrinterPrintBinaryBooleanOr(t *testing.T) { o := bytes.NewBufferString("") - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n := &ast.ExprBinaryBooleanOr{ Left: &ast.ExprVariable{ VarName: &ast.Identifier{Value: []byte("$a")}, @@ -894,7 +894,7 @@ func TestPrinterPrintBinaryBooleanOr(t *testing.T) { func TestPrinterPrintBinaryCoalesce(t *testing.T) { o := bytes.NewBufferString("") - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n := &ast.ExprBinaryCoalesce{ Left: &ast.ExprVariable{ VarName: &ast.Identifier{Value: []byte("$a")}, @@ -916,7 +916,7 @@ func TestPrinterPrintBinaryCoalesce(t *testing.T) { func TestPrinterPrintBinaryConcat(t *testing.T) { o := bytes.NewBufferString("") - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n := &ast.ExprBinaryConcat{ Left: &ast.ExprVariable{ VarName: &ast.Identifier{Value: []byte("$a")}, @@ -938,7 +938,7 @@ func TestPrinterPrintBinaryConcat(t *testing.T) { func TestPrinterPrintBinaryDiv(t *testing.T) { o := bytes.NewBufferString("") - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n := &ast.ExprBinaryDiv{ Left: &ast.ExprVariable{ VarName: &ast.Identifier{Value: []byte("$a")}, @@ -960,7 +960,7 @@ func TestPrinterPrintBinaryDiv(t *testing.T) { func TestPrinterPrintBinaryEqual(t *testing.T) { o := bytes.NewBufferString("") - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n := &ast.ExprBinaryEqual{ Left: &ast.ExprVariable{ VarName: &ast.Identifier{Value: []byte("$a")}, @@ -982,7 +982,7 @@ func TestPrinterPrintBinaryEqual(t *testing.T) { func TestPrinterPrintBinaryGreaterOrEqual(t *testing.T) { o := bytes.NewBufferString("") - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n := &ast.ExprBinaryGreaterOrEqual{ Left: &ast.ExprVariable{ VarName: &ast.Identifier{Value: []byte("$a")}, @@ -1004,7 +1004,7 @@ func TestPrinterPrintBinaryGreaterOrEqual(t *testing.T) { func TestPrinterPrintBinaryGreater(t *testing.T) { o := bytes.NewBufferString("") - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n := &ast.ExprBinaryGreater{ Left: &ast.ExprVariable{ VarName: &ast.Identifier{Value: []byte("$a")}, @@ -1026,7 +1026,7 @@ func TestPrinterPrintBinaryGreater(t *testing.T) { func TestPrinterPrintBinaryIdentical(t *testing.T) { o := bytes.NewBufferString("") - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n := &ast.ExprBinaryIdentical{ Left: &ast.ExprVariable{ VarName: &ast.Identifier{Value: []byte("$a")}, @@ -1048,7 +1048,7 @@ func TestPrinterPrintBinaryIdentical(t *testing.T) { func TestPrinterPrintBinaryLogicalAnd(t *testing.T) { o := bytes.NewBufferString("") - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n := &ast.ExprBinaryLogicalAnd{ Left: &ast.ExprVariable{ VarName: &ast.Identifier{Value: []byte("$a")}, @@ -1070,7 +1070,7 @@ func TestPrinterPrintBinaryLogicalAnd(t *testing.T) { func TestPrinterPrintBinaryLogicalOr(t *testing.T) { o := bytes.NewBufferString("") - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n := &ast.ExprBinaryLogicalOr{ Left: &ast.ExprVariable{ VarName: &ast.Identifier{Value: []byte("$a")}, @@ -1092,7 +1092,7 @@ func TestPrinterPrintBinaryLogicalOr(t *testing.T) { func TestPrinterPrintBinaryLogicalXor(t *testing.T) { o := bytes.NewBufferString("") - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n := &ast.ExprBinaryLogicalXor{ Left: &ast.ExprVariable{ VarName: &ast.Identifier{Value: []byte("$a")}, @@ -1114,7 +1114,7 @@ func TestPrinterPrintBinaryLogicalXor(t *testing.T) { func TestPrinterPrintBinaryMinus(t *testing.T) { o := bytes.NewBufferString("") - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n := &ast.ExprBinaryMinus{ Left: &ast.ExprVariable{ VarName: &ast.Identifier{Value: []byte("$a")}, @@ -1136,7 +1136,7 @@ func TestPrinterPrintBinaryMinus(t *testing.T) { func TestPrinterPrintBinaryMod(t *testing.T) { o := bytes.NewBufferString("") - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n := &ast.ExprBinaryMod{ Left: &ast.ExprVariable{ VarName: &ast.Identifier{Value: []byte("$a")}, @@ -1158,7 +1158,7 @@ func TestPrinterPrintBinaryMod(t *testing.T) { func TestPrinterPrintBinaryMul(t *testing.T) { o := bytes.NewBufferString("") - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n := &ast.ExprBinaryMul{ Left: &ast.ExprVariable{ VarName: &ast.Identifier{Value: []byte("$a")}, @@ -1180,7 +1180,7 @@ func TestPrinterPrintBinaryMul(t *testing.T) { func TestPrinterPrintBinaryNotEqual(t *testing.T) { o := bytes.NewBufferString("") - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n := &ast.ExprBinaryNotEqual{ Left: &ast.ExprVariable{ VarName: &ast.Identifier{Value: []byte("$a")}, @@ -1202,7 +1202,7 @@ func TestPrinterPrintBinaryNotEqual(t *testing.T) { func TestPrinterPrintBinaryNotIdentical(t *testing.T) { o := bytes.NewBufferString("") - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n := &ast.ExprBinaryNotIdentical{ Left: &ast.ExprVariable{ VarName: &ast.Identifier{Value: []byte("$a")}, @@ -1224,7 +1224,7 @@ func TestPrinterPrintBinaryNotIdentical(t *testing.T) { func TestPrinterPrintBinaryPlus(t *testing.T) { o := bytes.NewBufferString("") - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n := &ast.ExprBinaryPlus{ Left: &ast.ExprVariable{ VarName: &ast.Identifier{Value: []byte("$a")}, @@ -1246,7 +1246,7 @@ func TestPrinterPrintBinaryPlus(t *testing.T) { func TestPrinterPrintBinaryPow(t *testing.T) { o := bytes.NewBufferString("") - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n := &ast.ExprBinaryPow{ Left: &ast.ExprVariable{ VarName: &ast.Identifier{Value: []byte("$a")}, @@ -1268,7 +1268,7 @@ func TestPrinterPrintBinaryPow(t *testing.T) { func TestPrinterPrintBinaryShiftLeft(t *testing.T) { o := bytes.NewBufferString("") - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n := &ast.ExprBinaryShiftLeft{ Left: &ast.ExprVariable{ VarName: &ast.Identifier{Value: []byte("$a")}, @@ -1290,7 +1290,7 @@ func TestPrinterPrintBinaryShiftLeft(t *testing.T) { func TestPrinterPrintBinaryShiftRight(t *testing.T) { o := bytes.NewBufferString("") - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n := &ast.ExprBinaryShiftRight{ Left: &ast.ExprVariable{ VarName: &ast.Identifier{Value: []byte("$a")}, @@ -1312,7 +1312,7 @@ func TestPrinterPrintBinaryShiftRight(t *testing.T) { func TestPrinterPrintBinarySmallerOrEqual(t *testing.T) { o := bytes.NewBufferString("") - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n := &ast.ExprBinarySmallerOrEqual{ Left: &ast.ExprVariable{ VarName: &ast.Identifier{Value: []byte("$a")}, @@ -1334,7 +1334,7 @@ func TestPrinterPrintBinarySmallerOrEqual(t *testing.T) { func TestPrinterPrintBinarySmaller(t *testing.T) { o := bytes.NewBufferString("") - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n := &ast.ExprBinarySmaller{ Left: &ast.ExprVariable{ VarName: &ast.Identifier{Value: []byte("$a")}, @@ -1356,7 +1356,7 @@ func TestPrinterPrintBinarySmaller(t *testing.T) { func TestPrinterPrintBinarySpaceship(t *testing.T) { o := bytes.NewBufferString("") - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n := &ast.ExprBinarySpaceship{ Left: &ast.ExprVariable{ VarName: &ast.Identifier{Value: []byte("$a")}, @@ -1380,7 +1380,7 @@ func TestPrinterPrintBinarySpaceship(t *testing.T) { func TestPrinterPrintArray(t *testing.T) { o := bytes.NewBufferString("") - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n := &ast.ExprCastArray{ Expr: &ast.ExprVariable{ VarName: &ast.Identifier{Value: []byte("$var")}, @@ -1399,7 +1399,7 @@ func TestPrinterPrintArray(t *testing.T) { func TestPrinterPrintBool(t *testing.T) { o := bytes.NewBufferString("") - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n := &ast.ExprCastBool{ Expr: &ast.ExprVariable{ VarName: &ast.Identifier{Value: []byte("$var")}, @@ -1418,7 +1418,7 @@ func TestPrinterPrintBool(t *testing.T) { func TestPrinterPrintDouble(t *testing.T) { o := bytes.NewBufferString("") - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n := &ast.ExprCastDouble{ Expr: &ast.ExprVariable{ VarName: &ast.Identifier{Value: []byte("$var")}, @@ -1437,7 +1437,7 @@ func TestPrinterPrintDouble(t *testing.T) { func TestPrinterPrintInt(t *testing.T) { o := bytes.NewBufferString("") - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n := &ast.ExprCastInt{ Expr: &ast.ExprVariable{ VarName: &ast.Identifier{Value: []byte("$var")}, @@ -1456,7 +1456,7 @@ func TestPrinterPrintInt(t *testing.T) { func TestPrinterPrintObject(t *testing.T) { o := bytes.NewBufferString("") - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n := &ast.ExprCastObject{ Expr: &ast.ExprVariable{ VarName: &ast.Identifier{Value: []byte("$var")}, @@ -1475,7 +1475,7 @@ func TestPrinterPrintObject(t *testing.T) { func TestPrinterPrintString(t *testing.T) { o := bytes.NewBufferString("") - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n := &ast.ExprCastString{ Expr: &ast.ExprVariable{ VarName: &ast.Identifier{Value: []byte("$var")}, @@ -1494,7 +1494,7 @@ func TestPrinterPrintString(t *testing.T) { func TestPrinterPrintUnset(t *testing.T) { o := bytes.NewBufferString("") - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n := &ast.ExprCastUnset{ Expr: &ast.ExprVariable{ VarName: &ast.Identifier{Value: []byte("$var")}, @@ -1515,7 +1515,7 @@ func TestPrinterPrintUnset(t *testing.T) { func TestPrinterPrintExprArrayDimFetch(t *testing.T) { o := bytes.NewBufferString("") - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n := &ast.ExprArrayDimFetch{ Var: &ast.ExprVariable{ VarName: &ast.Identifier{Value: []byte("$var")}, @@ -1535,7 +1535,7 @@ func TestPrinterPrintExprArrayDimFetch(t *testing.T) { func TestPrinterPrintExprArrayItemWithKey(t *testing.T) { o := bytes.NewBufferString("") - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n := &ast.ExprArrayItem{ Key: &ast.ScalarString{Value: []byte("'Hello'")}, Val: &ast.ExprVariable{ @@ -1555,7 +1555,7 @@ func TestPrinterPrintExprArrayItemWithKey(t *testing.T) { func TestPrinterPrintExprArrayItem(t *testing.T) { o := bytes.NewBufferString("") - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n := &ast.ExprArrayItem{ Val: &ast.ExprVariable{ VarName: &ast.Identifier{Value: []byte("$world")}, @@ -1574,7 +1574,7 @@ func TestPrinterPrintExprArrayItem(t *testing.T) { func TestPrinterPrintExprArrayItem_Reference(t *testing.T) { o := bytes.NewBufferString("") - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n := &ast.ExprArrayItem{ AmpersandTkn: &token.Token{ Value: []byte("&"), @@ -1596,7 +1596,7 @@ func TestPrinterPrintExprArrayItem_Reference(t *testing.T) { func TestPrinterPrintExprArrayItemUnpack(t *testing.T) { o := bytes.NewBufferString("") - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n := &ast.ExprArrayItem{ EllipsisTkn: &token.Token{ Value: []byte("..."), @@ -1618,7 +1618,7 @@ func TestPrinterPrintExprArrayItemUnpack(t *testing.T) { func TestPrinterPrintExprArray(t *testing.T) { o := bytes.NewBufferString("") - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n := &ast.ExprArray{ ArrayTkn: &token.Token{ Value: []byte("array"), @@ -1659,7 +1659,7 @@ func TestPrinterPrintExprArray(t *testing.T) { func TestPrinterPrintExprBitwiseNot(t *testing.T) { o := bytes.NewBufferString("") - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n := &ast.ExprBitwiseNot{ Expr: &ast.ExprVariable{ VarName: &ast.Identifier{Value: []byte("$var")}, @@ -1678,7 +1678,7 @@ func TestPrinterPrintExprBitwiseNot(t *testing.T) { func TestPrinterPrintExprBooleanNot(t *testing.T) { o := bytes.NewBufferString("") - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n := &ast.ExprBooleanNot{ Expr: &ast.ExprVariable{ VarName: &ast.Identifier{Value: []byte("$var")}, @@ -1697,7 +1697,7 @@ func TestPrinterPrintExprBooleanNot(t *testing.T) { func TestPrinterPrintExprBracket(t *testing.T) { o := bytes.NewBufferString("") - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n := &ast.ExprBooleanNot{ Expr: &ast.ExprVariable{ VarName: &ast.Identifier{Value: []byte("$var")}, @@ -1716,7 +1716,7 @@ func TestPrinterPrintExprBracket(t *testing.T) { func TestPrinterPrintExprClassConstFetch(t *testing.T) { o := bytes.NewBufferString("") - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n := &ast.ExprClassConstFetch{ Class: &ast.ExprVariable{ VarName: &ast.Identifier{Value: []byte("$var")}, @@ -1738,7 +1738,7 @@ func TestPrinterPrintExprClassConstFetch(t *testing.T) { func TestPrinterPrintExprClone(t *testing.T) { o := bytes.NewBufferString("") - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n := &ast.ExprClone{ Expr: &ast.ExprVariable{ VarName: &ast.Identifier{Value: []byte("$var")}, @@ -1757,7 +1757,7 @@ func TestPrinterPrintExprClone(t *testing.T) { func TestPrinterPrintExprClosureUse(t *testing.T) { o := bytes.NewBufferString("") - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n := &ast.ExprClosureUse{ Var: &ast.ExprVariable{ VarName: &ast.Identifier{Value: []byte("$foo")}, @@ -1776,7 +1776,7 @@ func TestPrinterPrintExprClosureUse(t *testing.T) { func TestPrinterPrintExprClosureUse_Reference(t *testing.T) { o := bytes.NewBufferString("") - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n := &ast.ExprClosureUse{ AmpersandTkn: &token.Token{ Value: []byte("&"), @@ -1798,7 +1798,7 @@ func TestPrinterPrintExprClosureUse_Reference(t *testing.T) { func TestPrinterPrintExprClosure(t *testing.T) { o := bytes.NewBufferString("") - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n := &ast.ExprClosure{ StaticTkn: &token.Token{ Value: []byte("static"), @@ -1850,7 +1850,7 @@ func TestPrinterPrintExprClosure(t *testing.T) { func TestPrinterPrintExprArrowFunction(t *testing.T) { o := bytes.NewBufferString("") - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n := &ast.StmtExpression{ Expr: &ast.ExprArrowFunction{ StaticTkn: &token.Token{ @@ -1890,7 +1890,7 @@ func TestPrinterPrintExprArrowFunction(t *testing.T) { func TestPrinterPrintExprConstFetch(t *testing.T) { o := bytes.NewBufferString("") - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n := &ast.ExprConstFetch{ Const: &ast.NameName{Parts: []ast.Vertex{&ast.NameNamePart{Value: []byte("null")}}}, } @@ -1907,7 +1907,7 @@ func TestPrinterPrintExprConstFetch(t *testing.T) { func TestPrinterPrintEmpty(t *testing.T) { o := bytes.NewBufferString("") - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n := &ast.ExprEmpty{ Expr: &ast.ExprVariable{ VarName: &ast.Identifier{Value: []byte("$var")}, @@ -1926,7 +1926,7 @@ func TestPrinterPrintEmpty(t *testing.T) { func TestPrinterPrettyPrinterrorSuppress(t *testing.T) { o := bytes.NewBufferString("") - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n := &ast.ExprErrorSuppress{ Expr: &ast.ExprVariable{ VarName: &ast.Identifier{Value: []byte("$var")}, @@ -1945,7 +1945,7 @@ func TestPrinterPrettyPrinterrorSuppress(t *testing.T) { func TestPrinterPrintEval(t *testing.T) { o := bytes.NewBufferString("") - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n := &ast.ExprEval{ Expr: &ast.ExprVariable{ VarName: &ast.Identifier{Value: []byte("$var")}, @@ -1964,7 +1964,7 @@ func TestPrinterPrintEval(t *testing.T) { func TestPrinterPrintExit(t *testing.T) { o := bytes.NewBufferString("") - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n := &ast.ExprExit{ Expr: &ast.ExprVariable{ VarName: &ast.Identifier{Value: []byte("$var")}, @@ -1983,7 +1983,7 @@ func TestPrinterPrintExit(t *testing.T) { func TestPrinterPrintDie(t *testing.T) { o := bytes.NewBufferString("") - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n := &ast.ExprExit{ ExitTkn: &token.Token{ Value: []byte("die"), @@ -2005,7 +2005,7 @@ func TestPrinterPrintDie(t *testing.T) { func TestPrinterPrintFunctionCall(t *testing.T) { o := bytes.NewBufferString("") - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n := &ast.ExprFunctionCall{ Function: &ast.ExprVariable{ VarName: &ast.Identifier{Value: []byte("$var")}, @@ -2047,7 +2047,7 @@ func TestPrinterPrintFunctionCall(t *testing.T) { func TestPrinterPrintInclude(t *testing.T) { o := bytes.NewBufferString("") - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n := &ast.ExprInclude{ Expr: &ast.ScalarString{Value: []byte("'path'")}, } @@ -2064,7 +2064,7 @@ func TestPrinterPrintInclude(t *testing.T) { func TestPrinterPrintIncludeOnce(t *testing.T) { o := bytes.NewBufferString("") - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n := &ast.ExprIncludeOnce{ Expr: &ast.ScalarString{Value: []byte("'path'")}, } @@ -2081,7 +2081,7 @@ func TestPrinterPrintIncludeOnce(t *testing.T) { func TestPrinterPrintInstanceOf(t *testing.T) { o := bytes.NewBufferString("") - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n := &ast.ExprInstanceOf{ Expr: &ast.ExprVariable{ VarName: &ast.Identifier{Value: []byte("$var")}, @@ -2101,7 +2101,7 @@ func TestPrinterPrintInstanceOf(t *testing.T) { func TestPrinterPrintIsset(t *testing.T) { o := bytes.NewBufferString("") - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n := &ast.ExprIsset{ Vars: []ast.Vertex{ &ast.ExprVariable{ @@ -2125,7 +2125,7 @@ func TestPrinterPrintIsset(t *testing.T) { func TestPrinterPrintList(t *testing.T) { o := bytes.NewBufferString("") - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n := &ast.ExprList{ Items: []ast.Vertex{ &ast.ExprArrayItem{ @@ -2164,7 +2164,7 @@ func TestPrinterPrintList(t *testing.T) { func TestPrinterPrintMethodCall(t *testing.T) { o := bytes.NewBufferString("") - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n := &ast.ExprMethodCall{ Var: &ast.ExprVariable{ VarName: &ast.Identifier{Value: []byte("$foo")}, @@ -2196,7 +2196,7 @@ func TestPrinterPrintMethodCall(t *testing.T) { func TestPrinterPrintNew(t *testing.T) { o := bytes.NewBufferString("") - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n := &ast.ExprNew{ Class: &ast.NameName{ Parts: []ast.Vertex{ @@ -2231,7 +2231,7 @@ func TestPrinterPrintNew(t *testing.T) { func TestPrinterPrintPostDec(t *testing.T) { o := bytes.NewBufferString("") - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n := &ast.ExprPostDec{ Var: &ast.ExprVariable{ VarName: &ast.Identifier{Value: []byte("$var")}, @@ -2250,7 +2250,7 @@ func TestPrinterPrintPostDec(t *testing.T) { func TestPrinterPrintPostInc(t *testing.T) { o := bytes.NewBufferString("") - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n := &ast.ExprPostInc{ Var: &ast.ExprVariable{ VarName: &ast.Identifier{Value: []byte("$var")}, @@ -2269,7 +2269,7 @@ func TestPrinterPrintPostInc(t *testing.T) { func TestPrinterPrintPreDec(t *testing.T) { o := bytes.NewBufferString("") - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n := &ast.ExprPreDec{ Var: &ast.ExprVariable{ VarName: &ast.Identifier{Value: []byte("$var")}, @@ -2288,7 +2288,7 @@ func TestPrinterPrintPreDec(t *testing.T) { func TestPrinterPrintPreInc(t *testing.T) { o := bytes.NewBufferString("") - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n := &ast.ExprPreInc{ Var: &ast.ExprVariable{ VarName: &ast.Identifier{Value: []byte("$var")}, @@ -2307,7 +2307,7 @@ func TestPrinterPrintPreInc(t *testing.T) { func TestPrinterPrintPrint(t *testing.T) { o := bytes.NewBufferString("") - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n := &ast.ExprPrint{ Expr: &ast.ExprVariable{ VarName: &ast.Identifier{Value: []byte("$var")}, @@ -2326,7 +2326,7 @@ func TestPrinterPrintPrint(t *testing.T) { func TestPrinterPrintPropertyFetch(t *testing.T) { o := bytes.NewBufferString("") - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n := &ast.ExprPropertyFetch{ Var: &ast.ExprVariable{ VarName: &ast.Identifier{Value: []byte("$foo")}, @@ -2346,7 +2346,7 @@ func TestPrinterPrintPropertyFetch(t *testing.T) { func TestPrinterPrintRequire(t *testing.T) { o := bytes.NewBufferString("") - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n := &ast.ExprRequire{ Expr: &ast.ScalarString{Value: []byte("'path'")}, } @@ -2363,7 +2363,7 @@ func TestPrinterPrintRequire(t *testing.T) { func TestPrinterPrintRequireOnce(t *testing.T) { o := bytes.NewBufferString("") - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n := &ast.ExprRequireOnce{ Expr: &ast.ScalarString{Value: []byte("'path'")}, } @@ -2380,7 +2380,7 @@ func TestPrinterPrintRequireOnce(t *testing.T) { func TestPrinterPrintShellExec(t *testing.T) { o := bytes.NewBufferString("") - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n := &ast.ExprShellExec{ Parts: []ast.Vertex{ &ast.ScalarEncapsedStringPart{Value: []byte("hello ")}, @@ -2403,7 +2403,7 @@ func TestPrinterPrintShellExec(t *testing.T) { func TestPrinterPrintExprShortArray(t *testing.T) { o := bytes.NewBufferString("") - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n := &ast.ExprArray{ Items: []ast.Vertex{ &ast.ExprArrayItem{ @@ -2441,7 +2441,7 @@ func TestPrinterPrintExprShortArray(t *testing.T) { func TestPrinterPrintShortList(t *testing.T) { o := bytes.NewBufferString("") - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n := &ast.ExprList{ OpenBracketTkn: &token.Token{ Value: []byte("["), @@ -2486,7 +2486,7 @@ func TestPrinterPrintShortList(t *testing.T) { func TestPrinterPrintStaticCall(t *testing.T) { o := bytes.NewBufferString("") - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n := &ast.ExprStaticCall{ Class: &ast.Identifier{Value: []byte("Foo")}, Call: &ast.Identifier{Value: []byte("bar")}, @@ -2516,7 +2516,7 @@ func TestPrinterPrintStaticCall(t *testing.T) { func TestPrinterPrintStaticPropertyFetch(t *testing.T) { o := bytes.NewBufferString("") - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n := &ast.ExprStaticPropertyFetch{ Class: &ast.Identifier{Value: []byte("Foo")}, Property: &ast.ExprVariable{ @@ -2536,7 +2536,7 @@ func TestPrinterPrintStaticPropertyFetch(t *testing.T) { func TestPrinterPrintTernary(t *testing.T) { o := bytes.NewBufferString("") - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n := &ast.ExprTernary{ Condition: &ast.ExprVariable{ VarName: &ast.Identifier{Value: []byte("$a")}, @@ -2558,7 +2558,7 @@ func TestPrinterPrintTernary(t *testing.T) { func TestPrinterPrintTernaryFull(t *testing.T) { o := bytes.NewBufferString("") - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n := &ast.ExprTernary{ Condition: &ast.ExprVariable{ VarName: &ast.Identifier{Value: []byte("$a")}, @@ -2583,7 +2583,7 @@ func TestPrinterPrintTernaryFull(t *testing.T) { func TestPrinterPrintUnaryMinus(t *testing.T) { o := bytes.NewBufferString("") - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n := &ast.ExprUnaryMinus{ Expr: &ast.ExprVariable{ VarName: &ast.Identifier{Value: []byte("$var")}, @@ -2602,7 +2602,7 @@ func TestPrinterPrintUnaryMinus(t *testing.T) { func TestPrinterPrintUnaryPlus(t *testing.T) { o := bytes.NewBufferString("") - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n := &ast.ExprUnaryPlus{ Expr: &ast.ExprVariable{ VarName: &ast.Identifier{Value: []byte("$var")}, @@ -2621,7 +2621,7 @@ func TestPrinterPrintUnaryPlus(t *testing.T) { func TestPrinterPrintVariable(t *testing.T) { o := bytes.NewBufferString("") - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n := &ast.ExprVariable{ DollarTkn: &token.Token{ Value: []byte("$"), @@ -2649,7 +2649,7 @@ func TestPrinterPrintVariable(t *testing.T) { func TestPrinterPrintYieldFrom(t *testing.T) { o := bytes.NewBufferString("") - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n := &ast.ExprYieldFrom{ Expr: &ast.ExprVariable{ VarName: &ast.Identifier{Value: []byte("$var")}, @@ -2668,7 +2668,7 @@ func TestPrinterPrintYieldFrom(t *testing.T) { func TestPrinterPrintYield(t *testing.T) { o := bytes.NewBufferString("") - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n := &ast.ExprYield{ Value: &ast.ExprVariable{ VarName: &ast.Identifier{Value: []byte("$var")}, @@ -2687,7 +2687,7 @@ func TestPrinterPrintYield(t *testing.T) { func TestPrinterPrintYieldFull(t *testing.T) { o := bytes.NewBufferString("") - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n := &ast.ExprYield{ Key: &ast.ExprVariable{ VarName: &ast.Identifier{Value: []byte("$k")}, @@ -2711,7 +2711,7 @@ func TestPrinterPrintYieldFull(t *testing.T) { func TestPrinterPrintAltElseIf(t *testing.T) { o := bytes.NewBufferString("") - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n := &ast.StmtElseIf{ Cond: &ast.ExprVariable{ VarName: &ast.Identifier{Value: []byte("$a")}, @@ -2740,7 +2740,7 @@ func TestPrinterPrintAltElseIf(t *testing.T) { func TestPrinterPrintAltElseIfEmpty(t *testing.T) { o := bytes.NewBufferString("") - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n := &ast.StmtElseIf{ Cond: &ast.ExprVariable{ VarName: &ast.Identifier{Value: []byte("$a")}, @@ -2763,7 +2763,7 @@ func TestPrinterPrintAltElseIfEmpty(t *testing.T) { func TestPrinterPrintAltElse(t *testing.T) { o := bytes.NewBufferString("") - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n := &ast.StmtElse{ ColonTkn: &token.Token{ Value: []byte(":"), @@ -2789,7 +2789,7 @@ func TestPrinterPrintAltElse(t *testing.T) { func TestPrinterPrintAltElseEmpty(t *testing.T) { o := bytes.NewBufferString("") - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n := &ast.StmtElse{ ColonTkn: &token.Token{ Value: []byte(":"), @@ -2809,7 +2809,7 @@ func TestPrinterPrintAltElseEmpty(t *testing.T) { func TestPrinterPrintAltFor(t *testing.T) { o := bytes.NewBufferString("") - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n := &ast.StmtFor{ Init: []ast.Vertex{ &ast.ExprVariable{ @@ -2850,7 +2850,7 @@ func TestPrinterPrintAltFor(t *testing.T) { func TestPrinterPrintAltForeach(t *testing.T) { o := bytes.NewBufferString("") - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n := &ast.StmtForeach{ Expr: &ast.ExprVariable{ VarName: &ast.Identifier{Value: []byte("$var")}, @@ -2885,7 +2885,7 @@ func TestPrinterPrintAltForeach(t *testing.T) { func TestPrinterPrintAltForeach_Reference(t *testing.T) { o := bytes.NewBufferString("") - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n := &ast.StmtForeach{ Expr: &ast.ExprVariable{ VarName: &ast.Identifier{Value: []byte("$var")}, @@ -2923,7 +2923,7 @@ func TestPrinterPrintAltForeach_Reference(t *testing.T) { func TestPrinterPrintAltIf(t *testing.T) { o := bytes.NewBufferString("") - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n := &ast.StmtIf{ Cond: &ast.ExprVariable{ VarName: &ast.Identifier{Value: []byte("$a")}, @@ -2990,7 +2990,7 @@ func TestPrinterPrintAltIf(t *testing.T) { func TestPrinterPrintStmtAltSwitch(t *testing.T) { o := bytes.NewBufferString("") - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n := &ast.StmtSwitch{ Cond: &ast.ExprVariable{ VarName: &ast.Identifier{Value: []byte("$var")}, @@ -3030,7 +3030,7 @@ func TestPrinterPrintStmtAltSwitch(t *testing.T) { func TestPrinterPrintAltWhile(t *testing.T) { o := bytes.NewBufferString("") - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n := &ast.StmtWhile{ Cond: &ast.ExprVariable{ VarName: &ast.Identifier{Value: []byte("$a")}, @@ -3059,7 +3059,7 @@ func TestPrinterPrintAltWhile(t *testing.T) { func TestPrinterPrintStmtBreak(t *testing.T) { o := bytes.NewBufferString("") - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n := &ast.StmtBreak{ Expr: &ast.ScalarLnumber{ Value: []byte("1"), @@ -3078,7 +3078,7 @@ func TestPrinterPrintStmtBreak(t *testing.T) { func TestPrinterPrintStmtCase(t *testing.T) { o := bytes.NewBufferString("") - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n := &ast.StmtCase{ Cond: &ast.ExprVariable{ VarName: &ast.Identifier{Value: []byte("$a")}, @@ -3102,7 +3102,7 @@ func TestPrinterPrintStmtCase(t *testing.T) { func TestPrinterPrintStmtCaseEmpty(t *testing.T) { o := bytes.NewBufferString("") - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n := &ast.StmtCase{ Cond: &ast.ExprVariable{ VarName: &ast.Identifier{Value: []byte("$a")}, @@ -3122,7 +3122,7 @@ func TestPrinterPrintStmtCaseEmpty(t *testing.T) { func TestPrinterPrintStmtCatch(t *testing.T) { o := bytes.NewBufferString("") - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n := &ast.StmtCatch{ Types: []ast.Vertex{ &ast.NameName{Parts: []ast.Vertex{&ast.NameNamePart{Value: []byte("Exception")}}}, @@ -3150,7 +3150,7 @@ func TestPrinterPrintStmtCatch(t *testing.T) { func TestPrinterPrintStmtClassMethod(t *testing.T) { o := bytes.NewBufferString("") - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n := &ast.StmtClassMethod{ Modifiers: []ast.Vertex{&ast.Identifier{Value: []byte("public")}}, AmpersandTkn: &token.Token{ @@ -3201,7 +3201,7 @@ func TestPrinterPrintStmtClassMethod(t *testing.T) { func TestPrinterPrintStmtAbstractClassMethod(t *testing.T) { o := bytes.NewBufferString("") - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n := &ast.StmtClassMethod{ Modifiers: []ast.Vertex{ &ast.Identifier{Value: []byte("public")}, @@ -3249,7 +3249,7 @@ func TestPrinterPrintStmtAbstractClassMethod(t *testing.T) { func TestPrinterPrintStmtClass(t *testing.T) { o := bytes.NewBufferString("") - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n := &ast.StmtClass{ Modifiers: []ast.Vertex{&ast.Identifier{Value: []byte("abstract")}}, ClassName: &ast.Identifier{Value: []byte("Foo")}, @@ -3286,7 +3286,7 @@ func TestPrinterPrintStmtClass(t *testing.T) { func TestPrinterPrintStmtAnonymousClass(t *testing.T) { o := bytes.NewBufferString("") - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n := &ast.StmtClass{ Modifiers: []ast.Vertex{&ast.Identifier{Value: []byte("abstract")}}, Arguments: []ast.Vertex{ @@ -3331,7 +3331,7 @@ func TestPrinterPrintStmtAnonymousClass(t *testing.T) { func TestPrinterPrintStmtClassConstList(t *testing.T) { o := bytes.NewBufferString("") - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n := &ast.StmtClassConstList{ Modifiers: []ast.Vertex{&ast.Identifier{Value: []byte("public")}}, Consts: []ast.Vertex{ @@ -3358,7 +3358,7 @@ func TestPrinterPrintStmtClassConstList(t *testing.T) { func TestPrinterPrintStmtConstList(t *testing.T) { o := bytes.NewBufferString("") - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n := &ast.StmtConstList{ Consts: []ast.Vertex{ &ast.StmtConstant{ @@ -3384,7 +3384,7 @@ func TestPrinterPrintStmtConstList(t *testing.T) { func TestPrinterPrintStmtConstant(t *testing.T) { o := bytes.NewBufferString("") - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n := &ast.StmtConstant{ Name: &ast.Identifier{Value: []byte("FOO")}, Expr: &ast.ScalarString{Value: []byte("'BAR'")}, @@ -3402,7 +3402,7 @@ func TestPrinterPrintStmtConstant(t *testing.T) { func TestPrinterPrintStmtContinue(t *testing.T) { o := bytes.NewBufferString("") - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n := &ast.StmtContinue{ Expr: &ast.ScalarLnumber{ Value: []byte("1"), @@ -3421,7 +3421,7 @@ func TestPrinterPrintStmtContinue(t *testing.T) { func TestPrinterPrintStmtDeclareStmts(t *testing.T) { o := bytes.NewBufferString("") - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n := &ast.StmtDeclare{ Consts: []ast.Vertex{ &ast.StmtConstant{ @@ -3448,7 +3448,7 @@ func TestPrinterPrintStmtDeclareStmts(t *testing.T) { func TestPrinterPrintStmtDeclareExpr(t *testing.T) { o := bytes.NewBufferString("") - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n := &ast.StmtDeclare{ Consts: []ast.Vertex{ &ast.StmtConstant{ @@ -3471,7 +3471,7 @@ func TestPrinterPrintStmtDeclareExpr(t *testing.T) { func TestPrinterPrintStmtDeclareNop(t *testing.T) { o := bytes.NewBufferString("") - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n := &ast.StmtDeclare{ Consts: []ast.Vertex{ &ast.StmtConstant{ @@ -3494,7 +3494,7 @@ func TestPrinterPrintStmtDeclareNop(t *testing.T) { func TestPrinterPrintStmtDefalut(t *testing.T) { o := bytes.NewBufferString("") - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n := &ast.StmtDefault{ Stmts: []ast.Vertex{ &ast.StmtExpression{Expr: &ast.ExprVariable{ @@ -3515,7 +3515,7 @@ func TestPrinterPrintStmtDefalut(t *testing.T) { func TestPrinterPrintStmtDefalutEmpty(t *testing.T) { o := bytes.NewBufferString("") - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n := &ast.StmtDefault{ Stmts: []ast.Vertex{}, } @@ -3532,7 +3532,7 @@ func TestPrinterPrintStmtDefalutEmpty(t *testing.T) { func TestPrinterPrintStmtDo_Expression(t *testing.T) { o := bytes.NewBufferString("") - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n := &ast.StmtDo{ Cond: &ast.ScalarLnumber{Value: []byte("1")}, Stmt: &ast.StmtExpression{ @@ -3554,7 +3554,7 @@ func TestPrinterPrintStmtDo_Expression(t *testing.T) { func TestPrinterPrintStmtDo_StmtList(t *testing.T) { o := bytes.NewBufferString("") - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n := &ast.StmtDo{ Cond: &ast.ScalarLnumber{Value: []byte("1")}, Stmt: &ast.StmtStmtList{ @@ -3578,7 +3578,7 @@ func TestPrinterPrintStmtDo_StmtList(t *testing.T) { func TestPrinterPrintStmtEchoHtmlState(t *testing.T) { o := bytes.NewBufferString("") - p := visitor.NewPrinter(o) + p := printer.NewPrinter(o) n := &ast.Root{ Stmts: []ast.Vertex{ &ast.StmtEcho{ @@ -3606,7 +3606,7 @@ func TestPrinterPrintStmtEchoHtmlState(t *testing.T) { func TestPrinterPrintStmtEchoPhpState(t *testing.T) { o := bytes.NewBufferString("") - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n := &ast.StmtEcho{ Exprs: []ast.Vertex{ &ast.ExprVariable{ @@ -3630,7 +3630,7 @@ func TestPrinterPrintStmtEchoPhpState(t *testing.T) { func TestPrinterPrintStmtElseIfStmts(t *testing.T) { o := bytes.NewBufferString("") - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n := &ast.StmtElseIf{ Cond: &ast.ExprVariable{ VarName: &ast.Identifier{Value: []byte("$a")}, @@ -3654,7 +3654,7 @@ func TestPrinterPrintStmtElseIfStmts(t *testing.T) { func TestPrinterPrintStmtElseIfExpr(t *testing.T) { o := bytes.NewBufferString("") - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n := &ast.StmtElseIf{ Cond: &ast.ExprVariable{ VarName: &ast.Identifier{Value: []byte("$a")}, @@ -3674,7 +3674,7 @@ func TestPrinterPrintStmtElseIfExpr(t *testing.T) { func TestPrinterPrintStmtElseIfNop(t *testing.T) { o := bytes.NewBufferString("") - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n := &ast.StmtElseIf{ Cond: &ast.ExprVariable{ VarName: &ast.Identifier{Value: []byte("$a")}, @@ -3694,7 +3694,7 @@ func TestPrinterPrintStmtElseIfNop(t *testing.T) { func TestPrinterPrintStmtElseStmts(t *testing.T) { o := bytes.NewBufferString("") - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n := &ast.StmtElse{ Stmt: &ast.StmtStmtList{ Stmts: []ast.Vertex{ @@ -3715,7 +3715,7 @@ func TestPrinterPrintStmtElseStmts(t *testing.T) { func TestPrinterPrintStmtElseExpr(t *testing.T) { o := bytes.NewBufferString("") - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n := &ast.StmtElse{ Stmt: &ast.StmtExpression{Expr: &ast.ScalarString{Value: []byte("'bar'")}}, } @@ -3732,7 +3732,7 @@ func TestPrinterPrintStmtElseExpr(t *testing.T) { func TestPrinterPrintStmtElseNop(t *testing.T) { o := bytes.NewBufferString("") - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n := &ast.StmtElse{ Stmt: &ast.StmtNop{}, } @@ -3749,7 +3749,7 @@ func TestPrinterPrintStmtElseNop(t *testing.T) { func TestPrinterPrintExpression(t *testing.T) { o := bytes.NewBufferString("") - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n := &ast.StmtExpression{ Expr: &ast.ExprVariable{ VarName: &ast.Identifier{Value: []byte("$a")}, @@ -3768,7 +3768,7 @@ func TestPrinterPrintExpression(t *testing.T) { func TestPrinterPrintStmtFinally(t *testing.T) { o := bytes.NewBufferString("") - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n := &ast.StmtFinally{ Stmts: []ast.Vertex{ &ast.StmtNop{}, @@ -3787,7 +3787,7 @@ func TestPrinterPrintStmtFinally(t *testing.T) { func TestPrinterPrintStmtFor(t *testing.T) { o := bytes.NewBufferString("") - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n := &ast.StmtFor{ Init: []ast.Vertex{ &ast.ExprVariable{ @@ -3832,7 +3832,7 @@ func TestPrinterPrintStmtFor(t *testing.T) { func TestPrinterPrintStmtForeach(t *testing.T) { o := bytes.NewBufferString("") - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n := &ast.StmtForeach{ Expr: &ast.ExprVariable{ VarName: &ast.Identifier{Value: []byte("$a")}, @@ -3862,7 +3862,7 @@ func TestPrinterPrintStmtForeach(t *testing.T) { func TestPrinterPrintStmtForeach_Reference(t *testing.T) { o := bytes.NewBufferString("") - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n := &ast.StmtForeach{ Expr: &ast.ExprVariable{ VarName: &ast.Identifier{Value: []byte("$a")}, @@ -3895,7 +3895,7 @@ func TestPrinterPrintStmtForeach_Reference(t *testing.T) { func TestPrinterPrintStmtFunction(t *testing.T) { o := bytes.NewBufferString("") - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n := &ast.StmtFunction{ AmpersandTkn: &token.Token{ Value: []byte("&"), @@ -3931,7 +3931,7 @@ func TestPrinterPrintStmtFunction(t *testing.T) { func TestPrinterPrintStmtGlobal(t *testing.T) { o := bytes.NewBufferString("") - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n := &ast.StmtGlobal{ Vars: []ast.Vertex{ &ast.ExprVariable{ @@ -3955,7 +3955,7 @@ func TestPrinterPrintStmtGlobal(t *testing.T) { func TestPrinterPrintStmtGoto(t *testing.T) { o := bytes.NewBufferString("") - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n := &ast.StmtGoto{ Label: &ast.Identifier{Value: []byte("FOO")}, } @@ -3972,7 +3972,7 @@ func TestPrinterPrintStmtGoto(t *testing.T) { func TestPrinterPrintHaltCompiler(t *testing.T) { o := bytes.NewBufferString("") - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n := &ast.StmtHaltCompiler{} n.Accept(p) @@ -3987,7 +3987,7 @@ func TestPrinterPrintHaltCompiler(t *testing.T) { func TestPrinterPrintIfExpression(t *testing.T) { o := bytes.NewBufferString("") - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n := &ast.StmtIf{ Cond: &ast.ExprVariable{ VarName: &ast.Identifier{Value: []byte("$a")}, @@ -4040,7 +4040,7 @@ func TestPrinterPrintIfExpression(t *testing.T) { func TestPrinterPrintIfStmtList(t *testing.T) { o := bytes.NewBufferString("") - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n := &ast.StmtIf{ Cond: &ast.ExprVariable{ VarName: &ast.Identifier{Value: []byte("$a")}, @@ -4068,7 +4068,7 @@ func TestPrinterPrintIfStmtList(t *testing.T) { func TestPrinterPrintIfNop(t *testing.T) { o := bytes.NewBufferString("") - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n := &ast.StmtIf{ Cond: &ast.ExprVariable{ VarName: &ast.Identifier{Value: []byte("$a")}, @@ -4088,7 +4088,7 @@ func TestPrinterPrintIfNop(t *testing.T) { func TestPrinterPrintInlineHtml(t *testing.T) { o := bytes.NewBufferString("") - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n := &ast.Root{ Stmts: []ast.Vertex{ &ast.StmtInlineHtml{ @@ -4109,7 +4109,7 @@ func TestPrinterPrintInlineHtml(t *testing.T) { func TestPrinterPrintInterface(t *testing.T) { o := bytes.NewBufferString("") - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n := &ast.StmtInterface{ InterfaceName: &ast.NameName{Parts: []ast.Vertex{&ast.NameNamePart{Value: []byte("Foo")}}}, Extends: []ast.Vertex{ @@ -4144,7 +4144,7 @@ func TestPrinterPrintInterface(t *testing.T) { func TestPrinterPrintLabel(t *testing.T) { o := bytes.NewBufferString("") - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n := &ast.StmtLabel{ LabelName: &ast.Identifier{Value: []byte("FOO")}, } @@ -4161,7 +4161,7 @@ func TestPrinterPrintLabel(t *testing.T) { func TestPrinterPrintNamespace(t *testing.T) { o := bytes.NewBufferString("") - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n := &ast.StmtNamespace{ Name: &ast.NameName{Parts: []ast.Vertex{&ast.NameNamePart{Value: []byte("Foo")}}}, } @@ -4178,7 +4178,7 @@ func TestPrinterPrintNamespace(t *testing.T) { func TestPrinterPrintNamespaceWithStmts(t *testing.T) { o := bytes.NewBufferString("") - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n := &ast.StmtNamespace{ Name: &ast.NameName{Parts: []ast.Vertex{&ast.NameNamePart{Value: []byte("Foo")}}}, Stmts: []ast.Vertex{ @@ -4200,7 +4200,7 @@ func TestPrinterPrintNamespaceWithStmts(t *testing.T) { func TestPrinterPrintNop(t *testing.T) { o := bytes.NewBufferString("") - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n := &ast.StmtNop{} n.Accept(p) @@ -4215,7 +4215,7 @@ func TestPrinterPrintNop(t *testing.T) { func TestPrinterPrintPropertyList(t *testing.T) { o := bytes.NewBufferString("") - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n := &ast.StmtPropertyList{ Modifiers: []ast.Vertex{ &ast.Identifier{Value: []byte("public")}, @@ -4255,7 +4255,7 @@ func TestPrinterPrintPropertyList(t *testing.T) { func TestPrinterPrintProperty(t *testing.T) { o := bytes.NewBufferString("") - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n := &ast.StmtProperty{ Var: &ast.ExprVariable{ VarName: &ast.Identifier{Value: []byte("$a")}, @@ -4275,7 +4275,7 @@ func TestPrinterPrintProperty(t *testing.T) { func TestPrinterPrintReturn(t *testing.T) { o := bytes.NewBufferString("") - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n := &ast.StmtReturn{ Expr: &ast.ScalarLnumber{Value: []byte("1")}, } @@ -4292,7 +4292,7 @@ func TestPrinterPrintReturn(t *testing.T) { func TestPrinterPrintStaticVar(t *testing.T) { o := bytes.NewBufferString("") - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n := &ast.StmtStaticVar{ Var: &ast.ExprVariable{ VarName: &ast.Identifier{Value: []byte("$a")}, @@ -4312,7 +4312,7 @@ func TestPrinterPrintStaticVar(t *testing.T) { func TestPrinterPrintStatic(t *testing.T) { o := bytes.NewBufferString("") - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n := &ast.StmtStatic{ Vars: []ast.Vertex{ &ast.StmtStaticVar{ @@ -4340,7 +4340,7 @@ func TestPrinterPrintStatic(t *testing.T) { func TestPrinterPrintStmtList(t *testing.T) { o := bytes.NewBufferString("") - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n := &ast.StmtStmtList{ Stmts: []ast.Vertex{ &ast.StmtExpression{Expr: &ast.ExprVariable{ @@ -4364,7 +4364,7 @@ func TestPrinterPrintStmtList(t *testing.T) { func TestPrinterPrintStmtListNested(t *testing.T) { o := bytes.NewBufferString("") - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n := &ast.StmtStmtList{ Stmts: []ast.Vertex{ &ast.StmtExpression{Expr: &ast.ExprVariable{ @@ -4399,7 +4399,7 @@ func TestPrinterPrintStmtListNested(t *testing.T) { func TestPrinterPrintStmtSwitch(t *testing.T) { o := bytes.NewBufferString("") - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n := &ast.StmtSwitch{ Cond: &ast.ExprVariable{ VarName: &ast.Identifier{Value: []byte("$var")}, @@ -4436,7 +4436,7 @@ func TestPrinterPrintStmtSwitch(t *testing.T) { func TestPrinterPrintStmtThrow(t *testing.T) { o := bytes.NewBufferString("") - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n := &ast.StmtThrow{ Expr: &ast.ExprVariable{ VarName: &ast.Identifier{Value: []byte("$var")}, @@ -4455,7 +4455,7 @@ func TestPrinterPrintStmtThrow(t *testing.T) { func TestPrinterPrintStmtTraitUseAlias(t *testing.T) { o := bytes.NewBufferString("") - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n := &ast.StmtTraitUseAlias{ Trait: &ast.NameName{Parts: []ast.Vertex{&ast.NameNamePart{Value: []byte("Foo")}}}, Method: &ast.Identifier{Value: []byte("a")}, @@ -4475,7 +4475,7 @@ func TestPrinterPrintStmtTraitUseAlias(t *testing.T) { func TestPrinterPrintStmtTraitUsePrecedence(t *testing.T) { o := bytes.NewBufferString("") - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n := &ast.StmtTraitUsePrecedence{ Trait: &ast.NameName{Parts: []ast.Vertex{&ast.NameNamePart{Value: []byte("Foo")}}}, Method: &ast.Identifier{Value: []byte("a")}, @@ -4497,7 +4497,7 @@ func TestPrinterPrintStmtTraitUsePrecedence(t *testing.T) { func TestPrinterPrintStmtTraitUse(t *testing.T) { o := bytes.NewBufferString("") - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n := &ast.StmtTraitUse{ Traits: []ast.Vertex{ &ast.NameName{Parts: []ast.Vertex{&ast.NameNamePart{Value: []byte("Foo")}}}, @@ -4517,7 +4517,7 @@ func TestPrinterPrintStmtTraitUse(t *testing.T) { func TestPrinterPrintStmtTraitAdaptations(t *testing.T) { o := bytes.NewBufferString("") - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n := &ast.StmtTraitUse{ Traits: []ast.Vertex{ &ast.NameName{Parts: []ast.Vertex{&ast.NameNamePart{Value: []byte("Foo")}}}, @@ -4544,7 +4544,7 @@ func TestPrinterPrintStmtTraitAdaptations(t *testing.T) { func TestPrinterPrintTrait(t *testing.T) { o := bytes.NewBufferString("") - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n := &ast.StmtTrait{ TraitName: &ast.NameName{Parts: []ast.Vertex{&ast.NameNamePart{Value: []byte("Foo")}}}, Stmts: []ast.Vertex{ @@ -4575,7 +4575,7 @@ func TestPrinterPrintTrait(t *testing.T) { func TestPrinterPrintStmtTry(t *testing.T) { o := bytes.NewBufferString("") - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n := &ast.StmtTry{ Stmts: []ast.Vertex{ &ast.StmtExpression{Expr: &ast.ExprVariable{ @@ -4617,7 +4617,7 @@ func TestPrinterPrintStmtTry(t *testing.T) { func TestPrinterPrintStmtUnset(t *testing.T) { o := bytes.NewBufferString("") - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n := &ast.StmtUnset{ Vars: []ast.Vertex{ &ast.ExprVariable{ @@ -4641,7 +4641,7 @@ func TestPrinterPrintStmtUnset(t *testing.T) { func TestPrinterPrintUse(t *testing.T) { o := bytes.NewBufferString("") - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n := &ast.StmtUse{ Type: &ast.Identifier{Value: []byte("function")}, UseDeclarations: []ast.Vertex{ @@ -4667,7 +4667,7 @@ func TestPrinterPrintUse(t *testing.T) { func TestPrinterPrintStmtGroupUse(t *testing.T) { o := bytes.NewBufferString("") - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n := &ast.StmtGroupUse{ Type: &ast.Identifier{Value: []byte("function")}, Prefix: &ast.NameName{Parts: []ast.Vertex{&ast.NameNamePart{Value: []byte("Foo")}}}, @@ -4694,7 +4694,7 @@ func TestPrinterPrintStmtGroupUse(t *testing.T) { func TestPrinterPrintUseDeclaration(t *testing.T) { o := bytes.NewBufferString("") - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n := &ast.StmtUseDeclaration{ Type: &ast.Identifier{Value: []byte("function")}, Use: &ast.NameName{Parts: []ast.Vertex{&ast.NameNamePart{Value: []byte("Foo")}}}, @@ -4713,7 +4713,7 @@ func TestPrinterPrintUseDeclaration(t *testing.T) { func TestPrinterPrintWhileStmtList(t *testing.T) { o := bytes.NewBufferString("") - p := visitor.NewPrinter(o).WithState(visitor.PrinterStatePHP) + p := printer.NewPrinter(o).WithState(printer.PrinterStatePHP) n := &ast.StmtWhile{ Cond: &ast.ExprVariable{ VarName: &ast.Identifier{Value: []byte("$a")}, diff --git a/pkg/visitor/traverser/traverser.go b/pkg/visitor/traverser/traverser.go new file mode 100644 index 0000000..128f7ea --- /dev/null +++ b/pkg/visitor/traverser/traverser.go @@ -0,0 +1,1164 @@ +package traverser + +import ( + "github.com/z7zmey/php-parser/pkg/ast" +) + +type Traverser struct { + v ast.Visitor +} + +func NewTraverser(v ast.Visitor) *Traverser { + return &Traverser{ + v: v, + } +} + +func (t *Traverser) Traverse(n ast.Vertex) { + if n != nil { + n.Accept(t) + } +} + +func (t *Traverser) Root(n *ast.Root) { + n.Accept(t.v) + + for _, nn := range n.Stmts { + nn.Accept(t) + } +} + +func (t *Traverser) Nullable(n *ast.Nullable) { + n.Accept(t.v) + + t.Traverse(n.Expr) +} + +func (t *Traverser) Parameter(n *ast.Parameter) { + n.Accept(t.v) + + t.Traverse(n.Type) + t.Traverse(n.Var) + t.Traverse(n.DefaultValue) +} + +func (t *Traverser) Identifier(n *ast.Identifier) { + n.Accept(t.v) +} + +func (t *Traverser) Argument(n *ast.Argument) { + n.Accept(t.v) + + t.Traverse(n.Expr) +} + +func (t *Traverser) StmtBreak(n *ast.StmtBreak) { + n.Accept(t.v) + + t.Traverse(n.Expr) +} + +func (t *Traverser) StmtCase(n *ast.StmtCase) { + n.Accept(t.v) + + t.Traverse(n.Cond) + for _, nn := range n.Stmts { + nn.Accept(t) + } +} + +func (t *Traverser) StmtCatch(n *ast.StmtCatch) { + n.Accept(t.v) + + for _, nn := range n.Types { + nn.Accept(t) + } + t.Traverse(n.Var) + for _, nn := range n.Stmts { + nn.Accept(t) + } +} + +func (t *Traverser) StmtClass(n *ast.StmtClass) { + n.Accept(t.v) + + for _, nn := range n.Modifiers { + nn.Accept(t) + } + t.Traverse(n.ClassName) + for _, nn := range n.Arguments { + nn.Accept(t) + } + t.Traverse(n.Extends) + for _, nn := range n.Implements { + nn.Accept(t) + } + for _, nn := range n.Stmts { + nn.Accept(t) + } +} + +func (t *Traverser) StmtClassConstList(n *ast.StmtClassConstList) { + n.Accept(t.v) + + for _, nn := range n.Modifiers { + nn.Accept(t) + } + for _, nn := range n.Consts { + nn.Accept(t) + } +} + +func (t *Traverser) StmtClassMethod(n *ast.StmtClassMethod) { + n.Accept(t.v) + + for _, nn := range n.Modifiers { + nn.Accept(t) + } + t.Traverse(n.MethodName) + for _, nn := range n.Params { + nn.Accept(t) + } + t.Traverse(n.ReturnType) + t.Traverse(n.Stmt) +} + +func (t *Traverser) StmtConstList(n *ast.StmtConstList) { + n.Accept(t.v) + + for _, nn := range n.Consts { + nn.Accept(t) + } +} + +func (t *Traverser) StmtConstant(n *ast.StmtConstant) { + n.Accept(t.v) + + t.Traverse(n.Name) + t.Traverse(n.Expr) +} + +func (t *Traverser) StmtContinue(n *ast.StmtContinue) { + n.Accept(t.v) + + t.Traverse(n.Expr) +} + +func (t *Traverser) StmtDeclare(n *ast.StmtDeclare) { + n.Accept(t.v) + + for _, nn := range n.Consts { + nn.Accept(t) + } + t.Traverse(n.Stmt) +} + +func (t *Traverser) StmtDefault(n *ast.StmtDefault) { + n.Accept(t.v) + + for _, nn := range n.Stmts { + nn.Accept(t) + } +} + +func (t *Traverser) StmtDo(n *ast.StmtDo) { + n.Accept(t.v) + + t.Traverse(n.Stmt) + t.Traverse(n.Cond) +} + +func (t *Traverser) StmtEcho(n *ast.StmtEcho) { + n.Accept(t.v) + + for _, nn := range n.Exprs { + nn.Accept(t) + } +} + +func (t *Traverser) StmtElse(n *ast.StmtElse) { + n.Accept(t.v) + + t.Traverse(n.Stmt) +} + +func (t *Traverser) StmtElseIf(n *ast.StmtElseIf) { + n.Accept(t.v) + + t.Traverse(n.Cond) + t.Traverse(n.Stmt) +} + +func (t *Traverser) StmtExpression(n *ast.StmtExpression) { + n.Accept(t.v) + + t.Traverse(n.Expr) +} + +func (t *Traverser) StmtFinally(n *ast.StmtFinally) { + n.Accept(t.v) + + for _, nn := range n.Stmts { + nn.Accept(t) + } +} + +func (t *Traverser) StmtFor(n *ast.StmtFor) { + n.Accept(t.v) + + for _, nn := range n.Init { + nn.Accept(t) + } + for _, nn := range n.Cond { + nn.Accept(t) + } + for _, nn := range n.Loop { + nn.Accept(t) + } + t.Traverse(n.Stmt) +} + +func (t *Traverser) StmtForeach(n *ast.StmtForeach) { + n.Accept(t.v) + + t.Traverse(n.Expr) + t.Traverse(n.Key) + t.Traverse(n.Var) + t.Traverse(n.Stmt) +} + +func (t *Traverser) StmtFunction(n *ast.StmtFunction) { + n.Accept(t.v) + + t.Traverse(n.FunctionName) + for _, nn := range n.Params { + nn.Accept(t) + } + t.Traverse(n.ReturnType) + for _, nn := range n.Stmts { + nn.Accept(t) + } +} + +func (t *Traverser) StmtGlobal(n *ast.StmtGlobal) { + n.Accept(t.v) + + for _, nn := range n.Vars { + nn.Accept(t) + } +} + +func (t *Traverser) StmtGoto(n *ast.StmtGoto) { + n.Accept(t.v) + + t.Traverse(n.Label) +} + +func (t *Traverser) StmtHaltCompiler(n *ast.StmtHaltCompiler) { + n.Accept(t.v) +} + +func (t *Traverser) StmtIf(n *ast.StmtIf) { + n.Accept(t.v) + + t.Traverse(n.Cond) + t.Traverse(n.Stmt) + for _, nn := range n.ElseIf { + nn.Accept(t) + } + t.Traverse(n.Else) +} + +func (t *Traverser) StmtInlineHtml(n *ast.StmtInlineHtml) { + n.Accept(t.v) +} + +func (t *Traverser) StmtInterface(n *ast.StmtInterface) { + n.Accept(t.v) + + t.Traverse(n.InterfaceName) + for _, nn := range n.Extends { + nn.Accept(t) + } + for _, nn := range n.Stmts { + nn.Accept(t) + } +} + +func (t *Traverser) StmtLabel(n *ast.StmtLabel) { + n.Accept(t.v) + + t.Traverse(n.LabelName) +} + +func (t *Traverser) StmtNamespace(n *ast.StmtNamespace) { + n.Accept(t.v) + + t.Traverse(n.Name) + for _, nn := range n.Stmts { + nn.Accept(t) + } +} + +func (t *Traverser) StmtNop(n *ast.StmtNop) { + n.Accept(t.v) +} + +func (t *Traverser) StmtProperty(n *ast.StmtProperty) { + n.Accept(t.v) + + t.Traverse(n.Var) + t.Traverse(n.Expr) +} + +func (t *Traverser) StmtPropertyList(n *ast.StmtPropertyList) { + n.Accept(t.v) + + for _, nn := range n.Modifiers { + nn.Accept(t) + } + t.Traverse(n.Type) + for _, nn := range n.Properties { + nn.Accept(t) + } +} + +func (t *Traverser) StmtReturn(n *ast.StmtReturn) { + n.Accept(t.v) + + t.Traverse(n.Expr) +} + +func (t *Traverser) StmtStatic(n *ast.StmtStatic) { + n.Accept(t.v) + + for _, nn := range n.Vars { + nn.Accept(t) + } +} + +func (t *Traverser) StmtStaticVar(n *ast.StmtStaticVar) { + n.Accept(t.v) + + t.Traverse(n.Var) + t.Traverse(n.Expr) +} + +func (t *Traverser) StmtStmtList(n *ast.StmtStmtList) { + n.Accept(t.v) + + for _, nn := range n.Stmts { + nn.Accept(t) + } +} + +func (t *Traverser) StmtSwitch(n *ast.StmtSwitch) { + n.Accept(t.v) + + t.Traverse(n.Cond) + for _, nn := range n.CaseList { + nn.Accept(t) + } +} + +func (t *Traverser) StmtThrow(n *ast.StmtThrow) { + n.Accept(t.v) + + t.Traverse(n.Expr) +} + +func (t *Traverser) StmtTrait(n *ast.StmtTrait) { + n.Accept(t.v) + + t.Traverse(n.TraitName) + for _, nn := range n.Stmts { + nn.Accept(t) + } +} + +func (t *Traverser) StmtTraitUse(n *ast.StmtTraitUse) { + n.Accept(t.v) + + for _, nn := range n.Traits { + nn.Accept(t) + } + for _, nn := range n.Adaptations { + nn.Accept(t) + } +} + +func (t *Traverser) StmtTraitUseAlias(n *ast.StmtTraitUseAlias) { + n.Accept(t.v) + + t.Traverse(n.Trait) + t.Traverse(n.Method) + t.Traverse(n.Modifier) + t.Traverse(n.Alias) +} + +func (t *Traverser) StmtTraitUsePrecedence(n *ast.StmtTraitUsePrecedence) { + n.Accept(t.v) + + t.Traverse(n.Trait) + t.Traverse(n.Method) + for _, nn := range n.Insteadof { + nn.Accept(t) + } +} + +func (t *Traverser) StmtTry(n *ast.StmtTry) { + n.Accept(t.v) + + for _, nn := range n.Stmts { + nn.Accept(t) + } + for _, nn := range n.Catches { + nn.Accept(t) + } + t.Traverse(n.Finally) +} + +func (t *Traverser) StmtUnset(n *ast.StmtUnset) { + n.Accept(t.v) + + for _, nn := range n.Vars { + nn.Accept(t) + } +} + +func (t *Traverser) StmtUse(n *ast.StmtUse) { + n.Accept(t.v) + + t.Traverse(n.Type) + for _, nn := range n.UseDeclarations { + nn.Accept(t) + } +} + +func (t *Traverser) StmtGroupUse(n *ast.StmtGroupUse) { + n.Accept(t.v) + + t.Traverse(n.Type) + t.Traverse(n.Prefix) + for _, nn := range n.UseDeclarations { + nn.Accept(t) + } +} + +func (t *Traverser) StmtUseDeclaration(n *ast.StmtUseDeclaration) { + n.Accept(t.v) + + t.Traverse(n.Type) + t.Traverse(n.Use) + t.Traverse(n.Alias) +} + +func (t *Traverser) StmtWhile(n *ast.StmtWhile) { + n.Accept(t.v) + + t.Traverse(n.Cond) + t.Traverse(n.Stmt) +} + +func (t *Traverser) ExprArray(n *ast.ExprArray) { + n.Accept(t.v) + + for _, nn := range n.Items { + nn.Accept(t) + } +} + +func (t *Traverser) ExprArrayDimFetch(n *ast.ExprArrayDimFetch) { + n.Accept(t.v) + + t.Traverse(n.Var) + t.Traverse(n.Dim) +} + +func (t *Traverser) ExprArrayItem(n *ast.ExprArrayItem) { + n.Accept(t.v) + + t.Traverse(n.Key) + t.Traverse(n.Val) +} + +func (t *Traverser) ExprArrowFunction(n *ast.ExprArrowFunction) { + n.Accept(t.v) + + for _, nn := range n.Params { + nn.Accept(t) + } + t.Traverse(n.ReturnType) + t.Traverse(n.Expr) +} + +func (t *Traverser) ExprBitwiseNot(n *ast.ExprBitwiseNot) { + n.Accept(t.v) + + t.Traverse(n.Expr) +} + +func (t *Traverser) ExprBooleanNot(n *ast.ExprBooleanNot) { + n.Accept(t.v) + + t.Traverse(n.Expr) +} + +func (t *Traverser) ExprBrackets(n *ast.ExprBrackets) { + n.Accept(t.v) + + t.Traverse(n.Expr) +} + +func (t *Traverser) ExprClassConstFetch(n *ast.ExprClassConstFetch) { + n.Accept(t.v) + + t.Traverse(n.Class) + t.Traverse(n.ConstantName) +} + +func (t *Traverser) ExprClone(n *ast.ExprClone) { + n.Accept(t.v) + + t.Traverse(n.Expr) +} + +func (t *Traverser) ExprClosure(n *ast.ExprClosure) { + n.Accept(t.v) + + for _, nn := range n.Params { + nn.Accept(t) + } + for _, nn := range n.Use { + nn.Accept(t) + } + t.Traverse(n.ReturnType) + for _, nn := range n.Stmts { + nn.Accept(t) + } +} + +func (t *Traverser) ExprClosureUse(n *ast.ExprClosureUse) { + n.Accept(t.v) + + t.Traverse(n.Var) +} + +func (t *Traverser) ExprConstFetch(n *ast.ExprConstFetch) { + n.Accept(t.v) + + t.Traverse(n.Const) +} + +func (t *Traverser) ExprEmpty(n *ast.ExprEmpty) { + n.Accept(t.v) + + t.Traverse(n.Expr) +} + +func (t *Traverser) ExprErrorSuppress(n *ast.ExprErrorSuppress) { + n.Accept(t.v) + + t.Traverse(n.Expr) +} + +func (t *Traverser) ExprEval(n *ast.ExprEval) { + n.Accept(t.v) + + t.Traverse(n.Expr) +} + +func (t *Traverser) ExprExit(n *ast.ExprExit) { + n.Accept(t.v) + + t.Traverse(n.Expr) +} + +func (t *Traverser) ExprFunctionCall(n *ast.ExprFunctionCall) { + n.Accept(t.v) + + t.Traverse(n.Function) + for _, nn := range n.Arguments { + nn.Accept(t) + } +} + +func (t *Traverser) ExprInclude(n *ast.ExprInclude) { + n.Accept(t.v) + + t.Traverse(n.Expr) +} + +func (t *Traverser) ExprIncludeOnce(n *ast.ExprIncludeOnce) { + n.Accept(t.v) + + t.Traverse(n.Expr) +} + +func (t *Traverser) ExprInstanceOf(n *ast.ExprInstanceOf) { + n.Accept(t.v) + + t.Traverse(n.Expr) + t.Traverse(n.Class) +} + +func (t *Traverser) ExprIsset(n *ast.ExprIsset) { + n.Accept(t.v) + + for _, nn := range n.Vars { + nn.Accept(t) + } +} + +func (t *Traverser) ExprList(n *ast.ExprList) { + n.Accept(t.v) + + for _, nn := range n.Items { + nn.Accept(t) + } +} + +func (t *Traverser) ExprMethodCall(n *ast.ExprMethodCall) { + n.Accept(t.v) + + t.Traverse(n.Var) + t.Traverse(n.Method) + for _, nn := range n.Arguments { + nn.Accept(t) + } +} + +func (t *Traverser) ExprNew(n *ast.ExprNew) { + n.Accept(t.v) + + t.Traverse(n.Class) + for _, nn := range n.Arguments { + nn.Accept(t) + } +} + +func (t *Traverser) ExprPostDec(n *ast.ExprPostDec) { + n.Accept(t.v) + + t.Traverse(n.Var) +} + +func (t *Traverser) ExprPostInc(n *ast.ExprPostInc) { + n.Accept(t.v) + + t.Traverse(n.Var) +} + +func (t *Traverser) ExprPreDec(n *ast.ExprPreDec) { + n.Accept(t.v) + + t.Traverse(n.Var) +} + +func (t *Traverser) ExprPreInc(n *ast.ExprPreInc) { + n.Accept(t.v) + + t.Traverse(n.Var) +} + +func (t *Traverser) ExprPrint(n *ast.ExprPrint) { + n.Accept(t.v) + + t.Traverse(n.Expr) +} + +func (t *Traverser) ExprPropertyFetch(n *ast.ExprPropertyFetch) { + n.Accept(t.v) + + t.Traverse(n.Var) + t.Traverse(n.Property) +} + +func (t *Traverser) ExprRequire(n *ast.ExprRequire) { + n.Accept(t.v) + + t.Traverse(n.Expr) +} + +func (t *Traverser) ExprRequireOnce(n *ast.ExprRequireOnce) { + n.Accept(t.v) + + t.Traverse(n.Expr) +} + +func (t *Traverser) ExprShellExec(n *ast.ExprShellExec) { + n.Accept(t.v) + + for _, nn := range n.Parts { + nn.Accept(t) + } +} + +func (t *Traverser) ExprStaticCall(n *ast.ExprStaticCall) { + n.Accept(t.v) + + t.Traverse(n.Class) + t.Traverse(n.Call) + for _, nn := range n.Arguments { + nn.Accept(t) + } +} + +func (t *Traverser) ExprStaticPropertyFetch(n *ast.ExprStaticPropertyFetch) { + n.Accept(t.v) + + t.Traverse(n.Class) + t.Traverse(n.Property) +} + +func (t *Traverser) ExprTernary(n *ast.ExprTernary) { + n.Accept(t.v) + + t.Traverse(n.Condition) + t.Traverse(n.IfTrue) + t.Traverse(n.IfFalse) +} + +func (t *Traverser) ExprUnaryMinus(n *ast.ExprUnaryMinus) { + n.Accept(t.v) + + t.Traverse(n.Expr) +} + +func (t *Traverser) ExprUnaryPlus(n *ast.ExprUnaryPlus) { + n.Accept(t.v) + + t.Traverse(n.Expr) +} + +func (t *Traverser) ExprVariable(n *ast.ExprVariable) { + n.Accept(t.v) + + t.Traverse(n.VarName) +} + +func (t *Traverser) ExprYield(n *ast.ExprYield) { + n.Accept(t.v) + + t.Traverse(n.Key) + t.Traverse(n.Value) +} + +func (t *Traverser) ExprYieldFrom(n *ast.ExprYieldFrom) { + n.Accept(t.v) + + t.Traverse(n.Expr) +} + +func (t *Traverser) ExprAssign(n *ast.ExprAssign) { + n.Accept(t.v) + + t.Traverse(n.Var) + t.Traverse(n.Expr) +} + +func (t *Traverser) ExprAssignReference(n *ast.ExprAssignReference) { + n.Accept(t.v) + + t.Traverse(n.Var) + t.Traverse(n.Expr) +} + +func (t *Traverser) ExprAssignBitwiseAnd(n *ast.ExprAssignBitwiseAnd) { + n.Accept(t.v) + + t.Traverse(n.Var) + t.Traverse(n.Expr) +} + +func (t *Traverser) ExprAssignBitwiseOr(n *ast.ExprAssignBitwiseOr) { + n.Accept(t.v) + + t.Traverse(n.Var) + t.Traverse(n.Expr) +} + +func (t *Traverser) ExprAssignBitwiseXor(n *ast.ExprAssignBitwiseXor) { + n.Accept(t.v) + + t.Traverse(n.Var) + t.Traverse(n.Expr) +} + +func (t *Traverser) ExprAssignCoalesce(n *ast.ExprAssignCoalesce) { + n.Accept(t.v) + + t.Traverse(n.Var) + t.Traverse(n.Expr) +} + +func (t *Traverser) ExprAssignConcat(n *ast.ExprAssignConcat) { + n.Accept(t.v) + + t.Traverse(n.Var) + t.Traverse(n.Expr) +} + +func (t *Traverser) ExprAssignDiv(n *ast.ExprAssignDiv) { + n.Accept(t.v) + + t.Traverse(n.Var) + t.Traverse(n.Expr) +} + +func (t *Traverser) ExprAssignMinus(n *ast.ExprAssignMinus) { + n.Accept(t.v) + + t.Traverse(n.Var) + t.Traverse(n.Expr) +} + +func (t *Traverser) ExprAssignMod(n *ast.ExprAssignMod) { + n.Accept(t.v) + + t.Traverse(n.Var) + t.Traverse(n.Expr) +} + +func (t *Traverser) ExprAssignMul(n *ast.ExprAssignMul) { + n.Accept(t.v) + + t.Traverse(n.Var) + t.Traverse(n.Expr) +} + +func (t *Traverser) ExprAssignPlus(n *ast.ExprAssignPlus) { + n.Accept(t.v) + + t.Traverse(n.Var) + t.Traverse(n.Expr) +} + +func (t *Traverser) ExprAssignPow(n *ast.ExprAssignPow) { + n.Accept(t.v) + + t.Traverse(n.Var) + t.Traverse(n.Expr) +} + +func (t *Traverser) ExprAssignShiftLeft(n *ast.ExprAssignShiftLeft) { + n.Accept(t.v) + + t.Traverse(n.Var) + t.Traverse(n.Expr) +} + +func (t *Traverser) ExprAssignShiftRight(n *ast.ExprAssignShiftRight) { + n.Accept(t.v) + + t.Traverse(n.Var) + t.Traverse(n.Expr) +} + +func (t *Traverser) ExprBinaryBitwiseAnd(n *ast.ExprBinaryBitwiseAnd) { + n.Accept(t.v) + + t.Traverse(n.Left) + t.Traverse(n.Right) +} + +func (t *Traverser) ExprBinaryBitwiseOr(n *ast.ExprBinaryBitwiseOr) { + n.Accept(t.v) + + t.Traverse(n.Left) + t.Traverse(n.Right) +} + +func (t *Traverser) ExprBinaryBitwiseXor(n *ast.ExprBinaryBitwiseXor) { + n.Accept(t.v) + + t.Traverse(n.Left) + t.Traverse(n.Right) +} + +func (t *Traverser) ExprBinaryBooleanAnd(n *ast.ExprBinaryBooleanAnd) { + n.Accept(t.v) + + t.Traverse(n.Left) + t.Traverse(n.Right) +} + +func (t *Traverser) ExprBinaryBooleanOr(n *ast.ExprBinaryBooleanOr) { + n.Accept(t.v) + + t.Traverse(n.Left) + t.Traverse(n.Right) +} + +func (t *Traverser) ExprBinaryCoalesce(n *ast.ExprBinaryCoalesce) { + n.Accept(t.v) + + t.Traverse(n.Left) + t.Traverse(n.Right) +} + +func (t *Traverser) ExprBinaryConcat(n *ast.ExprBinaryConcat) { + n.Accept(t.v) + + t.Traverse(n.Left) + t.Traverse(n.Right) +} + +func (t *Traverser) ExprBinaryDiv(n *ast.ExprBinaryDiv) { + n.Accept(t.v) + + t.Traverse(n.Left) + t.Traverse(n.Right) +} + +func (t *Traverser) ExprBinaryEqual(n *ast.ExprBinaryEqual) { + n.Accept(t.v) + + t.Traverse(n.Left) + t.Traverse(n.Right) +} + +func (t *Traverser) ExprBinaryGreater(n *ast.ExprBinaryGreater) { + n.Accept(t.v) + + t.Traverse(n.Left) + t.Traverse(n.Right) +} + +func (t *Traverser) ExprBinaryGreaterOrEqual(n *ast.ExprBinaryGreaterOrEqual) { + n.Accept(t.v) + + t.Traverse(n.Left) + t.Traverse(n.Right) +} + +func (t *Traverser) ExprBinaryIdentical(n *ast.ExprBinaryIdentical) { + n.Accept(t.v) + + t.Traverse(n.Left) + t.Traverse(n.Right) +} + +func (t *Traverser) ExprBinaryLogicalAnd(n *ast.ExprBinaryLogicalAnd) { + n.Accept(t.v) + + t.Traverse(n.Left) + t.Traverse(n.Right) +} + +func (t *Traverser) ExprBinaryLogicalOr(n *ast.ExprBinaryLogicalOr) { + n.Accept(t.v) + + t.Traverse(n.Left) + t.Traverse(n.Right) +} + +func (t *Traverser) ExprBinaryLogicalXor(n *ast.ExprBinaryLogicalXor) { + n.Accept(t.v) + + t.Traverse(n.Left) + t.Traverse(n.Right) +} + +func (t *Traverser) ExprBinaryMinus(n *ast.ExprBinaryMinus) { + n.Accept(t.v) + + t.Traverse(n.Left) + t.Traverse(n.Right) +} + +func (t *Traverser) ExprBinaryMod(n *ast.ExprBinaryMod) { + n.Accept(t.v) + + t.Traverse(n.Left) + t.Traverse(n.Right) +} + +func (t *Traverser) ExprBinaryMul(n *ast.ExprBinaryMul) { + n.Accept(t.v) + + t.Traverse(n.Left) + t.Traverse(n.Right) +} + +func (t *Traverser) ExprBinaryNotEqual(n *ast.ExprBinaryNotEqual) { + n.Accept(t.v) + + t.Traverse(n.Left) + t.Traverse(n.Right) +} + +func (t *Traverser) ExprBinaryNotIdentical(n *ast.ExprBinaryNotIdentical) { + n.Accept(t.v) + + t.Traverse(n.Left) + t.Traverse(n.Right) +} + +func (t *Traverser) ExprBinaryPlus(n *ast.ExprBinaryPlus) { + n.Accept(t.v) + + t.Traverse(n.Left) + t.Traverse(n.Right) +} + +func (t *Traverser) ExprBinaryPow(n *ast.ExprBinaryPow) { + n.Accept(t.v) + + t.Traverse(n.Left) + t.Traverse(n.Right) +} + +func (t *Traverser) ExprBinaryShiftLeft(n *ast.ExprBinaryShiftLeft) { + n.Accept(t.v) + + t.Traverse(n.Left) + t.Traverse(n.Right) +} + +func (t *Traverser) ExprBinaryShiftRight(n *ast.ExprBinaryShiftRight) { + n.Accept(t.v) + + t.Traverse(n.Left) + t.Traverse(n.Right) +} + +func (t *Traverser) ExprBinarySmaller(n *ast.ExprBinarySmaller) { + n.Accept(t.v) + + t.Traverse(n.Left) + t.Traverse(n.Right) +} + +func (t *Traverser) ExprBinarySmallerOrEqual(n *ast.ExprBinarySmallerOrEqual) { + n.Accept(t.v) + + t.Traverse(n.Left) + t.Traverse(n.Right) +} + +func (t *Traverser) ExprBinarySpaceship(n *ast.ExprBinarySpaceship) { + n.Accept(t.v) + + t.Traverse(n.Left) + t.Traverse(n.Right) +} + +func (t *Traverser) ExprCastArray(n *ast.ExprCastArray) { + n.Accept(t.v) + + t.Traverse(n.Expr) +} + +func (t *Traverser) ExprCastBool(n *ast.ExprCastBool) { + n.Accept(t.v) + + t.Traverse(n.Expr) +} + +func (t *Traverser) ExprCastDouble(n *ast.ExprCastDouble) { + n.Accept(t.v) + + t.Traverse(n.Expr) +} + +func (t *Traverser) ExprCastInt(n *ast.ExprCastInt) { + n.Accept(t.v) + + t.Traverse(n.Expr) +} + +func (t *Traverser) ExprCastObject(n *ast.ExprCastObject) { + n.Accept(t.v) + + t.Traverse(n.Expr) +} + +func (t *Traverser) ExprCastString(n *ast.ExprCastString) { + n.Accept(t.v) + + t.Traverse(n.Expr) +} + +func (t *Traverser) ExprCastUnset(n *ast.ExprCastUnset) { + n.Accept(t.v) + + t.Traverse(n.Expr) +} + +func (t *Traverser) ScalarDnumber(n *ast.ScalarDnumber) { + n.Accept(t.v) +} + +func (t *Traverser) ScalarEncapsed(n *ast.ScalarEncapsed) { + n.Accept(t.v) + + for _, nn := range n.Parts { + nn.Accept(t) + } +} + +func (t *Traverser) ScalarEncapsedStringPart(n *ast.ScalarEncapsedStringPart) { + n.Accept(t.v) +} + +func (t *Traverser) ScalarEncapsedStringVar(n *ast.ScalarEncapsedStringVar) { + n.Accept(t.v) + + t.Traverse(n.VarName) + t.Traverse(n.Dim) +} + +func (t *Traverser) ScalarEncapsedStringBrackets(n *ast.ScalarEncapsedStringBrackets) { + n.Accept(t.v) + + t.Traverse(n.Var) +} + +func (t *Traverser) ScalarHeredoc(n *ast.ScalarHeredoc) { + n.Accept(t.v) + + for _, nn := range n.Parts { + nn.Accept(t) + } +} + +func (t *Traverser) ScalarLnumber(n *ast.ScalarLnumber) { + n.Accept(t.v) +} + +func (t *Traverser) ScalarMagicConstant(n *ast.ScalarMagicConstant) { + n.Accept(t.v) +} + +func (t *Traverser) ScalarString(n *ast.ScalarString) { + n.Accept(t.v) +} + +func (t *Traverser) NameName(n *ast.NameName) { + n.Accept(t.v) + + for _, nn := range n.Parts { + nn.Accept(t) + } +} + +func (t *Traverser) NameFullyQualified(n *ast.NameFullyQualified) { + n.Accept(t.v) + + for _, nn := range n.Parts { + nn.Accept(t) + } +} + +func (t *Traverser) NameRelative(n *ast.NameRelative) { + n.Accept(t.v) + + for _, nn := range n.Parts { + nn.Accept(t) + } +} + +func (t *Traverser) NameNamePart(n *ast.NameNamePart) { + n.Accept(t.v) +}