diff --git a/pkg/ast/ast.go b/pkg/ast/ast.go new file mode 100644 index 0000000..a7a1da6 --- /dev/null +++ b/pkg/ast/ast.go @@ -0,0 +1,200 @@ +package ast + +import ( + "github.com/z7zmey/php-parser/freefloating" + "github.com/z7zmey/php-parser/position" +) + +type Vertex interface { + Accept(v NodeVisitor) + + SetPosition(p *position.Position) + GetPosition() *position.Position + GetFreeFloating() *freefloating.Collection +} + +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) + Identifier(n *Identifier) + ArgumentList(n *ArgumentList) + Argument(n *Argument) + + StmtAltElse(n *StmtAltElse) + StmtAltElseIf(n *StmtAltElseIf) + StmtAltFor(n *StmtAltFor) + StmtAltForeach(n *StmtAltForeach) + StmtAltIf(n *StmtAltIf) + StmtAltSwitch(n *StmtAltSwitch) + StmtAltWhile(n *StmtAltWhile) + StmtBreak(n *StmtBreak) + StmtCase(n *StmtCase) + StmtCaseList(n *StmtCaseList) + StmtCatch(n *StmtCatch) + StmtClass(n *StmtClass) + StmtClassConstList(n *StmtClassConstList) + StmtClassExtends(n *StmtClassExtends) + StmtClassImplements(n *StmtClassImplements) + StmtClassMethod(n *StmtClassMethod) + StmtConstList(n *StmtConstList) + StmtConstant(n *StmtConstant) + StmtContinue(n *StmtContinue) + StmtDeclare(n *StmtDeclare) + StmtDefault(n *StmtDefault) + StmtDo(n *StmtDo) + StmtEcho(n *StmtEcho) + StmtElse(n *StmtElse) + StmtElseIf(n *StmtElseIf) + StmtExpression(n *StmtExpression) + StmtFinally(n *StmtFinally) + StmtFor(n *StmtFor) + StmtForeach(n *StmtForeach) + StmtFunction(n *StmtFunction) + StmtGlobal(n *StmtGlobal) + StmtGoto(n *StmtGoto) + StmtGroupUse(n *StmtGroupUse) + StmtHaltCompiler(n *StmtHaltCompiler) + StmtIf(n *StmtIf) + StmtInlineHtml(n *StmtInlineHtml) + StmtInterface(n *StmtInterface) + StmtInterfaceExtends(n *StmtInterfaceExtends) + StmtLabel(n *StmtLabel) + StmtNamespace(n *StmtNamespace) + StmtNop(n *StmtNop) + StmtProperty(n *StmtProperty) + StmtPropertyList(n *StmtPropertyList) + StmtReturn(n *StmtReturn) + StmtStatic(n *StmtStatic) + StmtStaticVar(n *StmtStaticVar) + StmtStmtList(n *StmtStmtList) + StmtSwitch(n *StmtSwitch) + StmtThrow(n *StmtThrow) + StmtTrait(n *StmtTrait) + StmtTraitAdaptationList(n *StmtTraitAdaptationList) + StmtTraitMethodRef(n *StmtTraitMethodRef) + StmtTraitUse(n *StmtTraitUse) + StmtTraitUseAlias(n *StmtTraitUseAlias) + StmtTraitUsePrecedence(n *StmtTraitUsePrecedence) + StmtTry(n *StmtTry) + StmtUnset(n *StmtUnset) + StmtUse(n *StmtUse) + StmtUseList(n *StmtUseList) + StmtWhile(n *StmtWhile) + + ExprArray(n *ExprArray) + ExprArrayDimFetch(n *ExprArrayDimFetch) + ExprArrayItem(n *ExprArrayItem) + ExprArrowFunction(n *ExprArrowFunction) + ExprBitwiseNot(n *ExprBitwiseNot) + ExprBooleanNot(n *ExprBooleanNot) + ExprClassConstFetch(n *ExprClassConstFetch) + ExprClone(n *ExprClone) + ExprClosure(n *ExprClosure) + ExprClosureUse(n *ExprClosureUse) + ExprConstFetch(n *ExprConstFetch) + ExprEmpty(n *ExprEmpty) + ExprErrorSuppress(n *ExprErrorSuppress) + ExprEval(n *ExprEval) + ExprExit(n *ExprExit) + ExprFunctionCall(n *ExprFunctionCall) + ExprInclude(n *ExprInclude) + ExprIncludeOnce(n *ExprIncludeOnce) + ExprInstanceOf(n *ExprInstanceOf) + ExprIsset(n *ExprIsset) + ExprList(n *ExprList) + ExprMethodCall(n *ExprMethodCall) + ExprNew(n *ExprNew) + ExprPostDec(n *ExprPostDec) + ExprPostInc(n *ExprPostInc) + ExprPreDec(n *ExprPreDec) + ExprPreInc(n *ExprPreInc) + ExprPrint(n *ExprPrint) + ExprPropertyFetch(n *ExprPropertyFetch) + ExprReference(n *ExprReference) + ExprRequire(n *ExprRequire) + ExprRequireOnce(n *ExprRequireOnce) + ExprShellExec(n *ExprShellExec) + ExprShortArray(n *ExprShortArray) + ExprShortList(n *ExprShortList) + ExprStaticCall(n *ExprStaticCall) + ExprStaticPropertyFetch(n *ExprStaticPropertyFetch) + ExprTernary(n *ExprTernary) + ExprUnaryMinus(n *ExprUnaryMinus) + ExprUnaryPlus(n *ExprUnaryPlus) + ExprVariable(n *ExprVariable) + ExprYield(n *ExprYield) + ExprYieldFrom(n *ExprYieldFrom) + + ExprAssign(n *ExprAssign) + ExprAssignReference(n *ExprAssignReference) + ExprAssignBitwiseAnd(n *ExprAssignBitwiseAnd) + ExprAssignBitwiseOr(n *ExprAssignBitwiseOr) + ExprAssignBitwiseXor(n *ExprAssignBitwiseXor) + ExprAssignCoalesce(n *ExprAssignCoalesce) + ExprAssignConcat(n *ExprAssignConcat) + ExprAssignDiv(n *ExprAssignDiv) + ExprAssignMinus(n *ExprAssignMinus) + ExprAssignMod(n *ExprAssignMod) + ExprAssignMul(n *ExprAssignMul) + ExprAssignPlus(n *ExprAssignPlus) + ExprAssignPow(n *ExprAssignPow) + ExprAssignShiftLeft(n *ExprAssignShiftLeft) + ExprAssignShiftRight(n *ExprAssignShiftRight) + + ExprBinaryBitwiseAnd(n *ExprBinaryBitwiseAnd) + ExprBinaryBitwiseOr(n *ExprBinaryBitwiseOr) + ExprBinaryBitwiseXor(n *ExprBinaryBitwiseXor) + ExprBinaryBooleanAnd(n *ExprBinaryBooleanAnd) + ExprBinaryBooleanOr(n *ExprBinaryBooleanOr) + ExprBinaryCoalesce(n *ExprBinaryCoalesce) + ExprBinaryConcat(n *ExprBinaryConcat) + ExprBinaryDiv(n *ExprBinaryDiv) + ExprBinaryEqual(n *ExprBinaryEqual) + ExprBinaryGreater(n *ExprBinaryGreater) + ExprBinaryGreaterOrEqual(n *ExprBinaryGreaterOrEqual) + ExprBinaryIdentical(n *ExprBinaryIdentical) + ExprBinaryLogicalAnd(n *ExprBinaryLogicalAnd) + ExprBinaryLogicalOr(n *ExprBinaryLogicalOr) + ExprBinaryLogicalXor(n *ExprBinaryLogicalXor) + ExprBinaryMinus(n *ExprBinaryMinus) + ExprBinaryMod(n *ExprBinaryMod) + ExprBinaryMul(n *ExprBinaryMul) + ExprBinaryNotEqual(n *ExprBinaryNotEqual) + ExprBinaryNotIdentical(n *ExprBinaryNotIdentical) + ExprBinaryPlus(n *ExprBinaryPlus) + ExprBinaryPow(n *ExprBinaryPow) + ExprBinaryShiftLeft(n *ExprBinaryShiftLeft) + ExprBinaryShiftRight(n *ExprBinaryShiftRight) + ExprBinarySmaller(n *ExprBinarySmaller) + ExprBinarySmallerOrEqual(n *ExprBinarySmallerOrEqual) + ExprBinarySpaceship(n *ExprBinarySpaceship) + + ExprCastArray(n *ExprCastArray) + ExprCastBool(n *ExprCastBool) + ExprCastDouble(n *ExprCastDouble) + ExprCastInt(n *ExprCastInt) + ExprCastObject(n *ExprCastObject) + ExprCastString(n *ExprCastString) + ExprCastUnset(n *ExprCastUnset) + + ScalarDnumber(n *ScalarDnumber) + ScalarEncapsed(n *ScalarEncapsed) + ScalarEncapsedStringPart(n *ScalarEncapsedStringPart) + ScalarHeredoc(n *ScalarHeredoc) + ScalarLnumber(n *ScalarLnumber) + ScalarMagicConstant(n *ScalarMagicConstant) + ScalarString(n *ScalarString) +} diff --git a/pkg/ast/ast_test.go b/pkg/ast/ast_test.go new file mode 100644 index 0000000..bb98e9f --- /dev/null +++ b/pkg/ast/ast_test.go @@ -0,0 +1,191 @@ +package ast_test + +import ( + "bytes" + "encoding/json" + "fmt" + "github.com/z7zmey/php-parser/pkg/ast" + "github.com/z7zmey/php-parser/pkg/ast/traverser" + "github.com/z7zmey/php-parser/pkg/ast/visitor" + "os" + "strings" +) + +func ExampleJSON() { + stxTree := &ast.Root{ + Stmts: []ast.Vertex{ + &ast.Nullable{ + Expr: &ast.Parameter{ + Type: nil, + Var: nil, + DefaultValue: nil, + }, + }, + &ast.Identifier{}, + &ast.ArgumentList{ + Arguments: []ast.Vertex{ + &ast.Argument{}, + &ast.Argument{ + Expr: &ast.ScalarDnumber{}, + }, + }, + }, + }, + } + + jsonStxTree, err := json.Marshal(stxTree) + if err != nil { + panic(err) + } + + buf := bytes.NewBuffer(nil) + err = json.Indent(buf, jsonStxTree, "", " ") + if err != nil { + panic(err) + } + + fmt.Fprint(os.Stdout, buf.String()) + + // output: + // { + // "FreeFloating": null, + // "Position": null, + // "Stmts": [ + // { + // "FreeFloating": null, + // "Position": null, + // "Expr": { + // "FreeFloating": null, + // "Position": null, + // "ByRef": false, + // "Variadic": false, + // "Type": null, + // "Var": null, + // "DefaultValue": null + // } + // }, + // { + // "FreeFloating": null, + // "Position": null, + // "Value": "" + // }, + // { + // "FreeFloating": null, + // "Position": null, + // "Arguments": [ + // { + // "FreeFloating": null, + // "Position": null, + // "Variadic": false, + // "IsReference": false, + // "Expr": null + // }, + // { + // "FreeFloating": null, + // "Position": null, + // "Variadic": false, + // "IsReference": false, + // "Expr": { + // "FreeFloating": null, + // "Position": null, + // "Value": "" + // } + // } + // ] + // } + // ] + // } +} + +func ExampleStxTree() { + stxTree := &ast.Root{ + Stmts: []ast.Vertex{ + &ast.Nullable{ + Expr: &ast.Parameter{ + Type: nil, + Var: nil, + DefaultValue: nil, + }, + }, + &ast.Identifier{}, + &ast.ArgumentList{ + Arguments: []ast.Vertex{ + &ast.Argument{}, + &ast.Argument{ + Expr: &ast.ScalarDnumber{}, + }, + }, + }, + }, + } + + traverser.NewDFS(&testVisitor{}).Traverse(stxTree) + + //output: + //=> *ast.Root + //=> Stmts: + //=> *ast.Nullable + //=> Expr: + //=> *ast.Parameter + //=> *ast.Identifier + //=> *ast.ArgumentList + //=> Arguments: + //=> *ast.Argument + //=> *ast.Argument + //=> Expr: + //=> *ast.ScalarDnumber +} + +type testVisitor struct { + visitor.Null + depth int +} + + +func (v *testVisitor) Enter(key string, _ bool) { + v.depth++ + fmt.Fprint(os.Stdout, "=>", strings.Repeat(" ", v.depth), key, ":\n") +} + +func (v *testVisitor) Leave(key string, _ bool) { + v.depth-- +} + +func (v *testVisitor) EnterNode(n ast.Vertex) bool { + v.depth++ + n.Accept(v) + + return true +} + +func (v *testVisitor) LeaveNode(_ ast.Vertex) { + v.depth-- +} + +func (v *testVisitor) Root(_ *ast.Root) { + fmt.Fprintln(os.Stdout, "=>", strings.Repeat(" ", v.depth-1), "*ast.Root") +} + +func (v *testVisitor) Nullable(_ *ast.Nullable) { + fmt.Fprintln(os.Stdout, "=>", strings.Repeat(" ", v.depth-1), "*ast.Nullable") +} + +func (v *testVisitor) Parameter(_ *ast.Parameter) { + fmt.Fprintln(os.Stdout, "=>", strings.Repeat(" ", v.depth-1), "*ast.Parameter") +} + +func (v *testVisitor) Identifier(_ *ast.Identifier) { + fmt.Fprintln(os.Stdout, "=>", strings.Repeat(" ", v.depth-1), "*ast.Identifier") +} + +func (v *testVisitor) ArgumentList(_ *ast.ArgumentList) { + fmt.Fprintln(os.Stdout, "=>", strings.Repeat(" ", v.depth-1), "*ast.ArgumentList") +} + +func (v *testVisitor) Argument(_ *ast.Argument) { + fmt.Fprintln(os.Stdout, "=>", strings.Repeat(" ", v.depth-1), "*ast.Argument") +} + +func (v *testVisitor) ScalarDnumber(_ *ast.ScalarDnumber) { + fmt.Fprintln(os.Stdout, "=>", strings.Repeat(" ", v.depth-1), "*ast.ScalarDnumber") +} diff --git a/pkg/ast/node.go b/pkg/ast/node.go new file mode 100644 index 0000000..65c2d98 --- /dev/null +++ b/pkg/ast/node.go @@ -0,0 +1,1814 @@ +package ast + +import ( + "github.com/z7zmey/php-parser/freefloating" + "github.com/z7zmey/php-parser/position" +) + +type Node struct { + FreeFloating freefloating.Collection + Position *position.Position +} + +// SetPosition sets node position +func (n *Node) SetPosition(p *position.Position) { + n.Position = p +} + +// GetPosition returns node positions +func (n *Node) GetPosition() *position.Position { + return n.Position +} + +func (n *Node) GetFreeFloating() *freefloating.Collection { + return &n.FreeFloating +} + +// Root node +type Root struct { + Node + Stmts []Vertex +} + +func (n *Root) Accept(v NodeVisitor) { + v.Root(n) +} + +// Nullable node +type Nullable struct { + Node + Expr Vertex +} + +func (n *Nullable) Accept(v NodeVisitor) { + v.Nullable(n) +} + +// Parameter node +type Parameter struct { + Node + ByRef bool + Variadic bool + Type Vertex + Var Vertex + DefaultValue Vertex +} + +func (n *Parameter) Accept(v NodeVisitor) { + v.Parameter(n) +} + +// Identifier node +type Identifier struct { + Node + Value string +} + +func (n *Identifier) Accept(v NodeVisitor) { + v.Identifier(n) +} + +// ArgumentList node +type ArgumentList struct { + Node + Arguments []Vertex +} + +func (n *ArgumentList) Accept(v NodeVisitor) { + v.ArgumentList(n) +} + +// Argument node +type Argument struct { + Node + Variadic bool + IsReference bool + Expr Vertex +} + +func (n *Argument) Accept(v NodeVisitor) { + v.Argument(n) +} + +// ScalarDnumber node +type ScalarDnumber struct { + Node + Value string +} + +func (n *ScalarDnumber) Accept(v NodeVisitor) { + v.ScalarDnumber(n) +} + +// ScalarEncapsed node +type ScalarEncapsed struct { + Node + Parts []Vertex +} + +func (n *ScalarEncapsed) Accept(v NodeVisitor) { + v.ScalarEncapsed(n) +} + +// ScalarEncapsedStringPart node +type ScalarEncapsedStringPart struct { + Node + Value string +} + +func (n *ScalarEncapsedStringPart) Accept(v NodeVisitor) { + v.ScalarEncapsedStringPart(n) +} + +// ScalarHeredoc node +type ScalarHeredoc struct { + Node + Label string + Parts []Vertex +} + +func (n *ScalarHeredoc) Accept(v NodeVisitor) { + v.ScalarHeredoc(n) +} + +// ScalarLnumber node +type ScalarLnumber struct { + Node + Value string +} + +func (n *ScalarLnumber) Accept(v NodeVisitor) { + v.ScalarLnumber(n) +} + +// ScalarMagicConstant node +type ScalarMagicConstant struct { + Node + Value string +} + +func (n *ScalarMagicConstant) Accept(v NodeVisitor) { + v.ScalarMagicConstant(n) +} + +// ScalarString node +type ScalarString struct { + Node + Value string +} + +func (n *ScalarString) Accept(v NodeVisitor) { + v.ScalarString(n) +} + +// StmtAltElse node +type StmtAltElse struct { + Node + Stmt Vertex +} + +func (n *StmtAltElse) Accept(v NodeVisitor) { + v.StmtAltElse(n) +} + +// StmtAltElseIf node +type StmtAltElseIf struct { + Node + Cond Vertex + Stmt Vertex +} + +func (n *StmtAltElseIf) Accept(v NodeVisitor) { + v.StmtAltElseIf(n) +} + +// StmtAltFor node +type StmtAltFor struct { + Node + Init []Vertex + Cond []Vertex + Loop []Vertex + Stmt Vertex +} + +func (n *StmtAltFor) Accept(v NodeVisitor) { + v.StmtAltFor(n) +} + +// StmtAltForeach node +type StmtAltForeach struct { + Node + Expr Vertex + Key Vertex + Var Vertex + Stmt Vertex +} + +func (n *StmtAltForeach) Accept(v NodeVisitor) { + v.StmtAltForeach(n) +} + +// StmtAltIf node +type StmtAltIf struct { + Node + Cond Vertex + Stmt Vertex + ElseIf []Vertex + Else Vertex +} + +func (n *StmtAltIf) Accept(v NodeVisitor) { + v.StmtAltIf(n) +} + +// StmtAltSwitch node +type StmtAltSwitch struct { + Node + Cond Vertex + CaseList *StmtCaseList +} + +func (n *StmtAltSwitch) Accept(v NodeVisitor) { + v.StmtAltSwitch(n) +} + +// StmtAltWhile node +type StmtAltWhile struct { + Node + Cond Vertex + Stmt Vertex +} + +func (n *StmtAltWhile) Accept(v NodeVisitor) { + v.StmtAltWhile(n) +} + +// StmtBreak node +type StmtBreak struct { + Node + Expr Vertex +} + +func (n *StmtBreak) Accept(v NodeVisitor) { + v.StmtBreak(n) +} + +// StmtCase node +type StmtCase struct { + Node + Cond Vertex + Stmts []Vertex +} + +func (n *StmtCase) Accept(v NodeVisitor) { + v.StmtCase(n) +} + +// StmtCaseList node +type StmtCaseList struct { + Node + Cases []Vertex +} + +func (n *StmtCaseList) Accept(v NodeVisitor) { + v.StmtCaseList(n) +} + +// StmtCatch node +type StmtCatch struct { + Node + Types []Vertex + Var Vertex + Stmts []Vertex +} + +func (n *StmtCatch) Accept(v NodeVisitor) { + v.StmtCatch(n) +} + +// StmtClass node +type StmtClass struct { + Node + ClassName Vertex + Modifiers []Vertex + ArgumentList *ArgumentList + Extends *StmtClassExtends + Implements *StmtClassImplements + Stmts []Vertex +} + +func (n *StmtClass) Accept(v NodeVisitor) { + v.StmtClass(n) +} + +// StmtClassConstList node +type StmtClassConstList struct { + Node + Modifiers []Vertex + Consts []Vertex +} + +func (n *StmtClassConstList) Accept(v NodeVisitor) { + v.StmtClassConstList(n) +} + +// StmtClassExtends node +type StmtClassExtends struct { + Node + ClassName Vertex +} + +func (n *StmtClassExtends) Accept(v NodeVisitor) { + v.StmtClassExtends(n) +} + +// StmtClassImplements node +type StmtClassImplements struct { + Node + InterfaceNames []Vertex +} + +func (n *StmtClassImplements) Accept(v NodeVisitor) { + v.StmtClassImplements(n) +} + +// StmtClassMethod node +type StmtClassMethod struct { + Node + ReturnsRef bool + MethodName Vertex + Modifiers []Vertex + Params []Vertex + ReturnType Vertex + Stmt Vertex +} + +func (n *StmtClassMethod) Accept(v NodeVisitor) { + v.StmtClassMethod(n) +} + +// StmtConstList node +type StmtConstList struct { + Node + Consts []Vertex +} + +func (n *StmtConstList) Accept(v NodeVisitor) { + v.StmtConstList(n) +} + +// StmtConstant node +type StmtConstant struct { + Node + ConstantName Vertex + Expr Vertex +} + +func (n *StmtConstant) Accept(v NodeVisitor) { + v.StmtConstant(n) +} + +// StmtContinue node +type StmtContinue struct { + Node + Expr Vertex +} + +func (n *StmtContinue) Accept(v NodeVisitor) { + v.StmtContinue(n) +} + +// StmtDeclare node +type StmtDeclare struct { + Node + Alt bool + Consts []Vertex + Stmt Vertex +} + +func (n *StmtDeclare) Accept(v NodeVisitor) { + v.StmtDeclare(n) +} + +// StmtDefault node +type StmtDefault struct { + Node + Stmts []Vertex +} + +func (n *StmtDefault) Accept(v NodeVisitor) { + v.StmtDefault(n) +} + +// StmtDo node +type StmtDo struct { + Node + Stmt Vertex + Cond Vertex +} + +func (n *StmtDo) Accept(v NodeVisitor) { + v.StmtDo(n) +} + +// StmtEcho node +type StmtEcho struct { + Node + Exprs []Vertex +} + +func (n *StmtEcho) Accept(v NodeVisitor) { + v.StmtEcho(n) +} + +// StmtElse node +type StmtElse struct { + Node + Stmt Vertex +} + +func (n *StmtElse) Accept(v NodeVisitor) { + v.StmtElse(n) +} + +// StmtElseIf node +type StmtElseIf struct { + Node + Cond Vertex + Stmt Vertex +} + +func (n *StmtElseIf) Accept(v NodeVisitor) { + v.StmtElseIf(n) +} + +// StmtExpression node +type StmtExpression struct { + Node + Expr Vertex +} + +func (n *StmtExpression) Accept(v NodeVisitor) { + v.StmtExpression(n) +} + +// StmtFinally node +type StmtFinally struct { + Node + Stmts []Vertex +} + +func (n *StmtFinally) Accept(v NodeVisitor) { + v.StmtFinally(n) +} + +// StmtFor node +type StmtFor struct { + Node + Init []Vertex + Cond []Vertex + Loop []Vertex + Stmt Vertex +} + +func (n *StmtFor) Accept(v NodeVisitor) { + v.StmtFor(n) +} + +// StmtForeach node +type StmtForeach struct { + Node + Expr Vertex + Key Vertex + Var Vertex + Stmt Vertex +} + +func (n *StmtForeach) Accept(v NodeVisitor) { + v.StmtForeach(n) +} + +// StmtFunction node +type StmtFunction struct { + Node + ReturnsRef bool + FunctionName Vertex + Params []Vertex + ReturnType Vertex + Stmts []Vertex +} + +func (n *StmtFunction) Accept(v NodeVisitor) { + v.StmtFunction(n) +} + +// StmtGlobal node +type StmtGlobal struct { + Node + Vars []Vertex +} + +func (n *StmtGlobal) Accept(v NodeVisitor) { + v.StmtGlobal(n) +} + +// StmtGoto node +type StmtGoto struct { + Node + Label Vertex +} + +func (n *StmtGoto) Accept(v NodeVisitor) { + v.StmtGoto(n) +} + +// StmtGroupUse node +type StmtGroupUse struct { + Node + UseType Vertex + Prefix Vertex + UseList []Vertex +} + +func (n *StmtGroupUse) Accept(v NodeVisitor) { + v.StmtGroupUse(n) +} + +// StmtHaltCompiler node +type StmtHaltCompiler struct { + Node +} + +func (n *StmtHaltCompiler) Accept(v NodeVisitor) { + v.StmtHaltCompiler(n) +} + +// StmtIf node +type StmtIf struct { + Node + Cond Vertex + Stmt Vertex + ElseIf []Vertex + Else Vertex +} + +func (n *StmtIf) Accept(v NodeVisitor) { + v.StmtIf(n) +} + +// StmtInlineHtml node +type StmtInlineHtml struct { + Node + Value string +} + +func (n *StmtInlineHtml) Accept(v NodeVisitor) { + v.StmtInlineHtml(n) +} + +// StmtInterface node +type StmtInterface struct { + Node + InterfaceName Vertex + Extends *StmtInterfaceExtends + Stmts []Vertex +} + +func (n *StmtInterface) Accept(v NodeVisitor) { + v.StmtInterface(n) +} + +// StmtInterfaceExtends node +type StmtInterfaceExtends struct { + Node + InterfaceNames []Vertex +} + +func (n *StmtInterfaceExtends) Accept(v NodeVisitor) { + v.StmtInterfaceExtends(n) +} + +// StmtLabel node +type StmtLabel struct { + Node + LabelName Vertex +} + +func (n *StmtLabel) Accept(v NodeVisitor) { + v.StmtLabel(n) +} + +// StmtNamespace node +type StmtNamespace struct { + Node + NamespaceName Vertex + Stmts []Vertex +} + +func (n *StmtNamespace) Accept(v NodeVisitor) { + v.StmtNamespace(n) +} + +// StmtNop node +type StmtNop struct { + Node +} + +func (n *StmtNop) Accept(v NodeVisitor) { + v.StmtNop(n) +} + +// StmtProperty node +type StmtProperty struct { + Node + Var Vertex + Expr Vertex +} + +func (n *StmtProperty) Accept(v NodeVisitor) { + v.StmtProperty(n) +} + +// StmtPropertyList node +type StmtPropertyList struct { + Node + Modifiers []Vertex + Type Vertex + Properties []Vertex +} + +func (n *StmtPropertyList) Accept(v NodeVisitor) { + v.StmtPropertyList(n) +} + +// StmtReturn node +type StmtReturn struct { + Node + Expr Vertex +} + +func (n *StmtReturn) Accept(v NodeVisitor) { + v.StmtReturn(n) +} + +// StmtStatic node +type StmtStatic struct { + Node + Vars []Vertex +} + +func (n *StmtStatic) Accept(v NodeVisitor) { + v.StmtStatic(n) +} + +// StmtStaticVar node +type StmtStaticVar struct { + Node + Var Vertex + Expr Vertex +} + +func (n *StmtStaticVar) Accept(v NodeVisitor) { + v.StmtStaticVar(n) +} + +// StmtStmtList node +type StmtStmtList struct { + Node + Stmts []Vertex +} + +func (n *StmtStmtList) Accept(v NodeVisitor) { + v.StmtStmtList(n) +} + +// StmtSwitch node +type StmtSwitch struct { + Node + Cond Vertex + CaseList *StmtCaseList +} + +func (n *StmtSwitch) Accept(v NodeVisitor) { + v.StmtSwitch(n) +} + +// StmtThrow node +type StmtThrow struct { + Node + Expr Vertex +} + +func (n *StmtThrow) Accept(v NodeVisitor) { + v.StmtThrow(n) +} + +// StmtTrait node +type StmtTrait struct { + Node + TraitName Vertex + Stmts []Vertex +} + +func (n *StmtTrait) Accept(v NodeVisitor) { + v.StmtTrait(n) +} + +// StmtTraitAdaptationList node +type StmtTraitAdaptationList struct { + Node + Adaptations []Vertex +} + +func (n *StmtTraitAdaptationList) Accept(v NodeVisitor) { + v.StmtTraitAdaptationList(n) +} + +// StmtTraitMethodRef node +type StmtTraitMethodRef struct { + Node + Trait Vertex + Method Vertex +} + +func (n *StmtTraitMethodRef) Accept(v NodeVisitor) { + v.StmtTraitMethodRef(n) +} + +// StmtTraitUse node +type StmtTraitUse struct { + Node + Traits []Vertex + TraitAdaptationList Vertex +} + +func (n *StmtTraitUse) Accept(v NodeVisitor) { + v.StmtTraitUse(n) +} + +// StmtTraitUseAlias node +type StmtTraitUseAlias struct { + Node + Ref Vertex + Modifier Vertex + Alias Vertex +} + +func (n *StmtTraitUseAlias) Accept(v NodeVisitor) { + v.StmtTraitUseAlias(n) +} + +// StmtTraitUsePrecedence node +type StmtTraitUsePrecedence struct { + Node + Ref Vertex + Insteadof []Vertex +} + +func (n *StmtTraitUsePrecedence) Accept(v NodeVisitor) { + v.StmtTraitUsePrecedence(n) +} + +// StmtTry node +type StmtTry struct { + Node + Stmts []Vertex + Catches []Vertex + Finally Vertex +} + +func (n *StmtTry) Accept(v NodeVisitor) { + v.StmtTry(n) +} + +// StmtUnset node +type StmtUnset struct { + Node + Vars []Vertex +} + +func (n *StmtUnset) Accept(v NodeVisitor) { + v.StmtUnset(n) +} + +// StmtUse node +type StmtUse struct { + Node + UseType Vertex + Use Vertex + Alias Vertex +} + +func (n *StmtUse) Accept(v NodeVisitor) { + v.StmtUse(n) +} + +// StmtUseList node +type StmtUseList struct { + Node + UseType Vertex + Uses []Vertex +} + +func (n *StmtUseList) Accept(v NodeVisitor) { + v.StmtUseList(n) +} + +// StmtWhile node +type StmtWhile struct { + Node + Cond Vertex + Stmt Vertex +} + +func (n *StmtWhile) Accept(v NodeVisitor) { + v.StmtWhile(n) +} + +// ExprArray node +type ExprArray struct { + Node + Items []Vertex +} + +func (n *ExprArray) Accept(v NodeVisitor) { + v.ExprArray(n) +} + +// ExprArrayDimFetch node +type ExprArrayDimFetch struct { + Node + Var Vertex + Dim Vertex +} + +func (n *ExprArrayDimFetch) Accept(v NodeVisitor) { + v.ExprArrayDimFetch(n) +} + +// ExprArrayItem node +type ExprArrayItem struct { + Node + Unpack bool + Key Vertex + Val Vertex +} + +func (n *ExprArrayItem) Accept(v NodeVisitor) { + v.ExprArrayItem(n) +} + +// ExprArrowFunction node +type ExprArrowFunction struct { + Node + ReturnsRef bool + Static bool + Params []Vertex + ReturnType Vertex + Expr Vertex +} + +func (n *ExprArrowFunction) Accept(v NodeVisitor) { + v.ExprArrowFunction(n) +} + +// ExprBitwiseNot node +type ExprBitwiseNot struct { + Node + Expr Vertex +} + +func (n *ExprBitwiseNot) Accept(v NodeVisitor) { + v.ExprBitwiseNot(n) +} + +// ExprBooleanNot node +type ExprBooleanNot struct { + Node + Expr Vertex +} + +func (n *ExprBooleanNot) Accept(v NodeVisitor) { + v.ExprBooleanNot(n) +} + +// ExprClassConstFetch node +type ExprClassConstFetch struct { + Node + Class Vertex + ConstantName Vertex +} + +func (n *ExprClassConstFetch) Accept(v NodeVisitor) { + v.ExprClassConstFetch(n) +} + +// ExprClone node +type ExprClone struct { + Node + Expr Vertex +} + +func (n *ExprClone) Accept(v NodeVisitor) { + v.ExprClone(n) +} + +// ExprClosure node +type ExprClosure struct { + Node + ReturnsRef bool + Static bool + Params []Vertex + ClosureUse *ExprClosureUse + ReturnType Vertex + Stmts []Vertex +} + +func (n *ExprClosure) Accept(v NodeVisitor) { + v.ExprClosure(n) +} + +// ExprClosureUse node +type ExprClosureUse struct { + Node + Uses []Vertex +} + +func (n *ExprClosureUse) Accept(v NodeVisitor) { + v.ExprClosureUse(n) +} + +// ExprConstFetch node +type ExprConstFetch struct { + Node + Const Vertex +} + +func (n *ExprConstFetch) Accept(v NodeVisitor) { + v.ExprConstFetch(n) +} + +// ExprEmpty node +type ExprEmpty struct { + Node + Expr Vertex +} + +func (n *ExprEmpty) Accept(v NodeVisitor) { + v.ExprEmpty(n) +} + +// ExprErrorSuppress node +type ExprErrorSuppress struct { + Node + Expr Vertex +} + +func (n *ExprErrorSuppress) Accept(v NodeVisitor) { + v.ExprErrorSuppress(n) +} + +// ExprEval node +type ExprEval struct { + Node + Expr Vertex +} + +func (n *ExprEval) Accept(v NodeVisitor) { + v.ExprEval(n) +} + +// ExprExit node +type ExprExit struct { + Node + Die bool + Expr Vertex +} + +func (n *ExprExit) Accept(v NodeVisitor) { + v.ExprExit(n) +} + +// ExprFunctionCall node +type ExprFunctionCall struct { + Node + Function Vertex + ArgumentList *ArgumentList +} + +func (n *ExprFunctionCall) Accept(v NodeVisitor) { + v.ExprFunctionCall(n) +} + +// ExprInclude node +type ExprInclude struct { + Node + Expr Vertex +} + +func (n *ExprInclude) Accept(v NodeVisitor) { + v.ExprInclude(n) +} + +// ExprIncludeOnce node +type ExprIncludeOnce struct { + Node + Expr Vertex +} + +func (n *ExprIncludeOnce) Accept(v NodeVisitor) { + v.ExprIncludeOnce(n) +} + +// ExprInstanceOf node +type ExprInstanceOf struct { + Node + Expr Vertex + Class Vertex +} + +func (n *ExprInstanceOf) Accept(v NodeVisitor) { + v.ExprInstanceOf(n) +} + +// ExprIsset node +type ExprIsset struct { + Node + Vars []Vertex +} + +func (n *ExprIsset) Accept(v NodeVisitor) { + v.ExprIsset(n) +} + +// ExprList node +type ExprList struct { + Node + Items []Vertex +} + +func (n *ExprList) Accept(v NodeVisitor) { + v.ExprList(n) +} + +// ExprMethodCall node +type ExprMethodCall struct { + Node + Var Vertex + Method Vertex + ArgumentList *ArgumentList +} + +func (n *ExprMethodCall) Accept(v NodeVisitor) { + v.ExprMethodCall(n) +} + +// ExprNew node +type ExprNew struct { + Node + Class Vertex + ArgumentList *ArgumentList +} + +func (n *ExprNew) Accept(v NodeVisitor) { + v.ExprNew(n) +} + +// ExprPostDec node +type ExprPostDec struct { + Node + Var Vertex +} + +func (n *ExprPostDec) Accept(v NodeVisitor) { + v.ExprPostDec(n) +} + +// ExprPostInc node +type ExprPostInc struct { + Node + Var Vertex +} + +func (n *ExprPostInc) Accept(v NodeVisitor) { + v.ExprPostInc(n) +} + +// ExprPreDec node +type ExprPreDec struct { + Node + Var Vertex +} + +func (n *ExprPreDec) Accept(v NodeVisitor) { + v.ExprPreDec(n) +} + +// ExprPreInc node +type ExprPreInc struct { + Node + Var Vertex +} + +func (n *ExprPreInc) Accept(v NodeVisitor) { + v.ExprPreInc(n) +} + +// ExprPrint node +type ExprPrint struct { + Node + Expr Vertex +} + +func (n *ExprPrint) Accept(v NodeVisitor) { + v.ExprPrint(n) +} + +// ExprPropertyFetch node +type ExprPropertyFetch struct { + Node + Var Vertex + Property Vertex +} + +func (n *ExprPropertyFetch) Accept(v NodeVisitor) { + v.ExprPropertyFetch(n) +} + +// ExprReference node +type ExprReference struct { + Node + Var Vertex +} + +func (n *ExprReference) Accept(v NodeVisitor) { + v.ExprReference(n) +} + +// ExprRequire node +type ExprRequire struct { + Node + Expr Vertex +} + +func (n *ExprRequire) Accept(v NodeVisitor) { + v.ExprRequire(n) +} + +// ExprRequireOnce node +type ExprRequireOnce struct { + Node + Expr Vertex +} + +func (n *ExprRequireOnce) Accept(v NodeVisitor) { + v.ExprRequireOnce(n) +} + +// ExprShellExec node +type ExprShellExec struct { + Node + Parts []Vertex +} + +func (n *ExprShellExec) Accept(v NodeVisitor) { + v.ExprShellExec(n) +} + +// ExprShortArray node +type ExprShortArray struct { + Node + Items []Vertex +} + +func (n *ExprShortArray) Accept(v NodeVisitor) { + v.ExprShortArray(n) +} + +// ExprShortList node +type ExprShortList struct { + Node + Items []Vertex +} + +func (n *ExprShortList) Accept(v NodeVisitor) { + v.ExprShortList(n) +} + +// ExprStaticCall node +type ExprStaticCall struct { + Node + Class Vertex + Call Vertex + ArgumentList *ArgumentList +} + +func (n *ExprStaticCall) Accept(v NodeVisitor) { + v.ExprStaticCall(n) +} + +// ExprStaticPropertyFetch node +type ExprStaticPropertyFetch struct { + Node + Class Vertex + Property Vertex +} + +func (n *ExprStaticPropertyFetch) Accept(v NodeVisitor) { + v.ExprStaticPropertyFetch(n) +} + +// ExprTernary node +type ExprTernary struct { + Node + Condition Vertex + IfTrue Vertex + IfFalse Vertex +} + +func (n *ExprTernary) Accept(v NodeVisitor) { + v.ExprTernary(n) +} + +// ExprUnaryMinus node +type ExprUnaryMinus struct { + Node + Expr Vertex +} + +func (n *ExprUnaryMinus) Accept(v NodeVisitor) { + v.ExprUnaryMinus(n) +} + +// ExprUnaryPlus node +type ExprUnaryPlus struct { + Node + Expr Vertex +} + +func (n *ExprUnaryPlus) Accept(v NodeVisitor) { + v.ExprUnaryPlus(n) +} + +// ExprVariable node +type ExprVariable struct { + Node + VarName Vertex +} + +func (n *ExprVariable) Accept(v NodeVisitor) { + v.ExprVariable(n) +} + +// ExprYield node +type ExprYield struct { + Node + Key Vertex + Value Vertex +} + +func (n *ExprYield) Accept(v NodeVisitor) { + v.ExprYield(n) +} + +// ExprYieldFrom node +type ExprYieldFrom struct { + Node + Expr Vertex +} + +func (n *ExprYieldFrom) Accept(v NodeVisitor) { + v.ExprYieldFrom(n) +} + +// ExprCastArray node +type ExprCastArray struct { + Node + Expr Vertex +} + +func (n *ExprCastArray) Accept(v NodeVisitor) { + v.ExprCastArray(n) +} + +// ExprCastBool node +type ExprCastBool struct { + Node + Expr Vertex +} + +func (n *ExprCastBool) Accept(v NodeVisitor) { + v.ExprCastBool(n) +} + +// ExprCastDouble node +type ExprCastDouble struct { + Node + Expr Vertex +} + +func (n *ExprCastDouble) Accept(v NodeVisitor) { + v.ExprCastDouble(n) +} + +// ExprCastInt node +type ExprCastInt struct { + Node + Expr Vertex +} + +func (n *ExprCastInt) Accept(v NodeVisitor) { + v.ExprCastInt(n) +} + +// ExprCastObject node +type ExprCastObject struct { + Node + Expr Vertex +} + +func (n *ExprCastObject) Accept(v NodeVisitor) { + v.ExprCastObject(n) +} + +// ExprCastString node +type ExprCastString struct { + Node + Expr Vertex +} + +func (n *ExprCastString) Accept(v NodeVisitor) { + v.ExprCastString(n) +} + +// ExprCastUnset node +type ExprCastUnset struct { + Node + Expr Vertex +} + +func (n *ExprCastUnset) Accept(v NodeVisitor) { + v.ExprCastUnset(n) +} + +// ExprAssign node +type ExprAssign struct { + Node + Var Vertex + Expr Vertex +} + +func (n *ExprAssign) Accept(v NodeVisitor) { + v.ExprAssign(n) +} + +// ExprAssignReference node +type ExprAssignReference struct { + Node + Var Vertex + Expr Vertex +} + +func (n *ExprAssignReference) Accept(v NodeVisitor) { + v.ExprAssignReference(n) +} + +// ExprAssignBitwiseAnd node +type ExprAssignBitwiseAnd struct { + Node + Var Vertex + Expr Vertex +} + +func (n *ExprAssignBitwiseAnd) Accept(v NodeVisitor) { + v.ExprAssignBitwiseAnd(n) +} + +// ExprAssignBitwiseOr node +type ExprAssignBitwiseOr struct { + Node + Var Vertex + Expr Vertex +} + +func (n *ExprAssignBitwiseOr) Accept(v NodeVisitor) { + v.ExprAssignBitwiseOr(n) +} + +// ExprAssignBitwiseXor node +type ExprAssignBitwiseXor struct { + Node + Var Vertex + Expr Vertex +} + +func (n *ExprAssignBitwiseXor) Accept(v NodeVisitor) { + v.ExprAssignBitwiseXor(n) +} + +// ExprAssignCoalesce node +type ExprAssignCoalesce struct { + Node + Var Vertex + Expr Vertex +} + +func (n *ExprAssignCoalesce) Accept(v NodeVisitor) { + v.ExprAssignCoalesce(n) +} + +// ExprAssignConcat node +type ExprAssignConcat struct { + Node + Var Vertex + Expr Vertex +} + +func (n *ExprAssignConcat) Accept(v NodeVisitor) { + v.ExprAssignConcat(n) +} + +// ExprAssignDiv node +type ExprAssignDiv struct { + Node + Var Vertex + Expr Vertex +} + +func (n *ExprAssignDiv) Accept(v NodeVisitor) { + v.ExprAssignDiv(n) +} + +// ExprAssignMinus node +type ExprAssignMinus struct { + Node + Var Vertex + Expr Vertex +} + +func (n *ExprAssignMinus) Accept(v NodeVisitor) { + v.ExprAssignMinus(n) +} + +// ExprAssignMod node +type ExprAssignMod struct { + Node + Var Vertex + Expr Vertex +} + +func (n *ExprAssignMod) Accept(v NodeVisitor) { + v.ExprAssignMod(n) +} + +// ExprAssignMul node +type ExprAssignMul struct { + Node + Var Vertex + Expr Vertex +} + +func (n *ExprAssignMul) Accept(v NodeVisitor) { + v.ExprAssignMul(n) +} + +// ExprAssignPlus node +type ExprAssignPlus struct { + Node + Var Vertex + Expr Vertex +} + +func (n *ExprAssignPlus) Accept(v NodeVisitor) { + v.ExprAssignPlus(n) +} + +// ExprAssignPow node +type ExprAssignPow struct { + Node + Var Vertex + Expr Vertex +} + +func (n *ExprAssignPow) Accept(v NodeVisitor) { + v.ExprAssignPow(n) +} + +// ExprAssignShiftLeft node +type ExprAssignShiftLeft struct { + Node + Var Vertex + Expr Vertex +} + +func (n *ExprAssignShiftLeft) Accept(v NodeVisitor) { + v.ExprAssignShiftLeft(n) +} + +// ExprAssignShiftRight node +type ExprAssignShiftRight struct { + Node + Var Vertex + Expr Vertex +} + +func (n *ExprAssignShiftRight) Accept(v NodeVisitor) { + v.ExprAssignShiftRight(n) +} + +// ExprBinaryBitwiseAnd node +type ExprBinaryBitwiseAnd struct { + Node + Left Vertex + Right Vertex +} + +func (n *ExprBinaryBitwiseAnd) Accept(v NodeVisitor) { + v.ExprBinaryBitwiseAnd(n) +} + +// ExprBinaryBitwiseOr node +type ExprBinaryBitwiseOr struct { + Node + Left Vertex + Right Vertex +} + +func (n *ExprBinaryBitwiseOr) Accept(v NodeVisitor) { + v.ExprBinaryBitwiseOr(n) +} + +// ExprBinaryBitwiseXor node +type ExprBinaryBitwiseXor struct { + Node + Left Vertex + Right Vertex +} + +func (n *ExprBinaryBitwiseXor) Accept(v NodeVisitor) { + v.ExprBinaryBitwiseXor(n) +} + +// ExprBinaryBooleanAnd node +type ExprBinaryBooleanAnd struct { + Node + Left Vertex + Right Vertex +} + +func (n *ExprBinaryBooleanAnd) Accept(v NodeVisitor) { + v.ExprBinaryBooleanAnd(n) +} + +// ExprBinaryBooleanOr node +type ExprBinaryBooleanOr struct { + Node + Left Vertex + Right Vertex +} + +func (n *ExprBinaryBooleanOr) Accept(v NodeVisitor) { + v.ExprBinaryBooleanOr(n) +} + +// ExprBinaryCoalesce node +type ExprBinaryCoalesce struct { + Node + Left Vertex + Right Vertex +} + +func (n *ExprBinaryCoalesce) Accept(v NodeVisitor) { + v.ExprBinaryCoalesce(n) +} + +// ExprBinaryConcat node +type ExprBinaryConcat struct { + Node + Left Vertex + Right Vertex +} + +func (n *ExprBinaryConcat) Accept(v NodeVisitor) { + v.ExprBinaryConcat(n) +} + +// ExprBinaryDiv node +type ExprBinaryDiv struct { + Node + Left Vertex + Right Vertex +} + +func (n *ExprBinaryDiv) Accept(v NodeVisitor) { + v.ExprBinaryDiv(n) +} + +// ExprBinaryEqual node +type ExprBinaryEqual struct { + Node + Left Vertex + Right Vertex +} + +func (n *ExprBinaryEqual) Accept(v NodeVisitor) { + v.ExprBinaryEqual(n) +} + +// ExprBinaryGreater node +type ExprBinaryGreater struct { + Node + Left Vertex + Right Vertex +} + +func (n *ExprBinaryGreater) Accept(v NodeVisitor) { + v.ExprBinaryGreater(n) +} + +// ExprBinaryGreaterOrEqual node +type ExprBinaryGreaterOrEqual struct { + Node + Left Vertex + Right Vertex +} + +func (n *ExprBinaryGreaterOrEqual) Accept(v NodeVisitor) { + v.ExprBinaryGreaterOrEqual(n) +} + +// ExprBinaryIdentical node +type ExprBinaryIdentical struct { + Node + Left Vertex + Right Vertex +} + +func (n *ExprBinaryIdentical) Accept(v NodeVisitor) { + v.ExprBinaryIdentical(n) +} + +// ExprBinaryLogicalAnd node +type ExprBinaryLogicalAnd struct { + Node + Left Vertex + Right Vertex +} + +func (n *ExprBinaryLogicalAnd) Accept(v NodeVisitor) { + v.ExprBinaryLogicalAnd(n) +} + +// ExprBinaryLogicalOr node +type ExprBinaryLogicalOr struct { + Node + Left Vertex + Right Vertex +} + +func (n *ExprBinaryLogicalOr) Accept(v NodeVisitor) { + v.ExprBinaryLogicalOr(n) +} + +// ExprBinaryLogicalXor node +type ExprBinaryLogicalXor struct { + Node + Left Vertex + Right Vertex +} + +func (n *ExprBinaryLogicalXor) Accept(v NodeVisitor) { + v.ExprBinaryLogicalXor(n) +} + +// ExprBinaryMinus node +type ExprBinaryMinus struct { + Node + Left Vertex + Right Vertex +} + +func (n *ExprBinaryMinus) Accept(v NodeVisitor) { + v.ExprBinaryMinus(n) +} + +// ExprBinaryMod node +type ExprBinaryMod struct { + Node + Left Vertex + Right Vertex +} + +func (n *ExprBinaryMod) Accept(v NodeVisitor) { + v.ExprBinaryMod(n) +} + +// ExprBinaryMul node +type ExprBinaryMul struct { + Node + Left Vertex + Right Vertex +} + +func (n *ExprBinaryMul) Accept(v NodeVisitor) { + v.ExprBinaryMul(n) +} + +// ExprBinaryNotEqual node +type ExprBinaryNotEqual struct { + Node + Left Vertex + Right Vertex +} + +func (n *ExprBinaryNotEqual) Accept(v NodeVisitor) { + v.ExprBinaryNotEqual(n) +} + +// ExprBinaryNotIdentical node +type ExprBinaryNotIdentical struct { + Node + Left Vertex + Right Vertex +} + +func (n *ExprBinaryNotIdentical) Accept(v NodeVisitor) { + v.ExprBinaryNotIdentical(n) +} + +// ExprBinaryPlus node +type ExprBinaryPlus struct { + Node + Left Vertex + Right Vertex +} + +func (n *ExprBinaryPlus) Accept(v NodeVisitor) { + v.ExprBinaryPlus(n) +} + +// ExprBinaryPow node +type ExprBinaryPow struct { + Node + Left Vertex + Right Vertex +} + +func (n *ExprBinaryPow) Accept(v NodeVisitor) { + v.ExprBinaryPow(n) +} + +// ExprBinaryShiftLeft node +type ExprBinaryShiftLeft struct { + Node + Left Vertex + Right Vertex +} + +func (n *ExprBinaryShiftLeft) Accept(v NodeVisitor) { + v.ExprBinaryShiftLeft(n) +} + +// ExprBinaryShiftRight node +type ExprBinaryShiftRight struct { + Node + Left Vertex + Right Vertex +} + +func (n *ExprBinaryShiftRight) Accept(v NodeVisitor) { + v.ExprBinaryShiftRight(n) +} + +// ExprBinarySmaller node +type ExprBinarySmaller struct { + Node + Left Vertex + Right Vertex +} + +func (n *ExprBinarySmaller) Accept(v NodeVisitor) { + v.ExprBinarySmaller(n) +} + +// ExprBinarySmallerOrEqual node +type ExprBinarySmallerOrEqual struct { + Node + Left Vertex + Right Vertex +} + +func (n *ExprBinarySmallerOrEqual) Accept(v NodeVisitor) { + v.ExprBinarySmallerOrEqual(n) +} + +// ExprBinarySpaceship node +type ExprBinarySpaceship struct { + Node + Left Vertex + Right Vertex +} + +func (n *ExprBinarySpaceship) Accept(v NodeVisitor) { + v.ExprBinarySpaceship(n) +} diff --git a/pkg/ast/traverser/dfs.go b/pkg/ast/traverser/dfs.go new file mode 100644 index 0000000..f3d745e --- /dev/null +++ b/pkg/ast/traverser/dfs.go @@ -0,0 +1,491 @@ +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) { + if n == nil { + return + } + + if !t.visitor.EnterNode(n) { + return + } + + switch nn := n.(type) { + case *ast.Root: + t.traverseArray("Stmts", nn.Stmts) + case *ast.Nullable: + t.traverseSingle("Expr", nn.Expr) + case *ast.Parameter: + t.traverseSingle("Type", nn.Type) + t.traverseSingle("Var", nn.Var) + t.traverseSingle("DefaultValue", nn.DefaultValue) + case *ast.Identifier: + case *ast.ArgumentList: + t.traverseArray("Arguments", nn.Arguments) + case *ast.Argument: + t.traverseSingle("Expr", nn.Expr) + case *ast.StmtAltElse: + t.traverseSingle("Stmt", nn.Stmt) + case *ast.StmtAltElseIf: + t.traverseSingle("Cond", nn.Cond) + t.traverseSingle("Stmt", nn.Stmt) + case *ast.StmtAltFor: + t.traverseArray("Init", nn.Init) + t.traverseArray("Cond", nn.Cond) + t.traverseArray("Loop", nn.Loop) + t.traverseSingle("Stmt", nn.Stmt) + case *ast.StmtAltForeach: + t.traverseSingle("Expr", nn.Expr) + t.traverseSingle("Key", nn.Key) + t.traverseSingle("Var", nn.Var) + t.traverseSingle("Stmt", nn.Stmt) + case *ast.StmtAltIf: + t.traverseSingle("Cond", nn.Cond) + t.traverseSingle("Stmt", nn.Stmt) + t.traverseArray("ElseIf", nn.ElseIf) + t.traverseSingle("Else", nn.Else) + case *ast.StmtAltSwitch: + t.traverseSingle("Cond", nn.Cond) + t.traverseSingle("CaseList", nn.CaseList) + case *ast.StmtAltWhile: + t.traverseSingle("Cond", nn.Cond) + t.traverseSingle("Stmt", nn.Stmt) + case *ast.StmtBreak: + t.traverseSingle("Expr", nn.Expr) + case *ast.StmtCase: + t.traverseSingle("Cond", nn.Cond) + t.traverseArray("Stmts", nn.Stmts) + case *ast.StmtCaseList: + t.traverseArray("Cases", nn.Cases) + case *ast.StmtCatch: + t.traverseArray("Types", nn.Types) + t.traverseSingle("Var", nn.Var) + t.traverseArray("Stmts", nn.Stmts) + case *ast.StmtClass: + t.traverseSingle("ClassName", nn.ClassName) + t.traverseArray("Modifiers", nn.Modifiers) + t.traverseArray("Stmts", nn.Stmts) + case *ast.StmtClassConstList: + t.traverseArray("Modifiers", nn.Modifiers) + t.traverseArray("Consts", nn.Consts) + case *ast.StmtClassExtends: + t.traverseSingle("ClassName", nn.ClassName) + case *ast.StmtClassImplements: + t.traverseArray("InterfaceNames", nn.InterfaceNames) + case *ast.StmtClassMethod: + t.traverseSingle("MethodName", nn.MethodName) + t.traverseArray("Modifiers", nn.Modifiers) + t.traverseArray("Params", nn.Params) + t.traverseSingle("ReturnType", nn.ReturnType) + t.traverseSingle("Stmt", nn.Stmt) + case *ast.StmtConstList: + t.traverseArray("Consts", nn.Consts) + case *ast.StmtConstant: + t.traverseSingle("ConstantName", nn.ConstantName) + t.traverseSingle("Expr", nn.Expr) + case *ast.StmtContinue: + t.traverseSingle("Expr", nn.Expr) + case *ast.StmtDeclare: + t.traverseArray("Consts", nn.Consts) + t.traverseSingle("Stmt", nn.Stmt) + case *ast.StmtDefault: + t.traverseArray("Stmts", nn.Stmts) + case *ast.StmtDo: + t.traverseSingle("Stmt", nn.Stmt) + t.traverseSingle("Cond", nn.Cond) + case *ast.StmtEcho: + t.traverseArray("Exprs", nn.Exprs) + case *ast.StmtElse: + t.traverseSingle("Stmt", nn.Stmt) + case *ast.StmtElseIf: + t.traverseSingle("Cond", nn.Cond) + t.traverseSingle("Stmt", nn.Stmt) + case *ast.StmtExpression: + t.traverseSingle("Expr", nn.Expr) + case *ast.StmtFinally: + t.traverseArray("Stmts", nn.Stmts) + case *ast.StmtFor: + t.traverseArray("Init", nn.Init) + t.traverseArray("Cond", nn.Cond) + t.traverseArray("Loop", nn.Loop) + t.traverseSingle("Stmt", nn.Stmt) + case *ast.StmtForeach: + t.traverseSingle("Expr", nn.Expr) + t.traverseSingle("Key", nn.Key) + t.traverseSingle("Var", nn.Var) + t.traverseSingle("Stmt", nn.Stmt) + case *ast.StmtFunction: + t.traverseSingle("FunctionName", nn.FunctionName) + t.traverseArray("Params", nn.Params) + t.traverseSingle("ReturnType", nn.ReturnType) + t.traverseArray("Stmts", nn.Stmts) + case *ast.StmtGlobal: + t.traverseArray("Vars", nn.Vars) + case *ast.StmtGoto: + t.traverseSingle("Label", nn.Label) + case *ast.StmtGroupUse: + t.traverseSingle("UseType", nn.UseType) + t.traverseSingle("Prefix", nn.Prefix) + t.traverseArray("UseList", nn.UseList) + case *ast.StmtHaltCompiler: + case *ast.StmtIf: + t.traverseSingle("Cond", nn.Cond) + t.traverseSingle("Stmt", nn.Stmt) + t.traverseArray("ElseIf", nn.ElseIf) + t.traverseSingle("Else", nn.Else) + case *ast.StmtInlineHtml: + case *ast.StmtInterface: + t.traverseSingle("InterfaceName", nn.InterfaceName) + t.traverseArray("Stmts", nn.Stmts) + case *ast.StmtInterfaceExtends: + t.traverseArray("InterfaceNames", nn.InterfaceNames) + case *ast.StmtLabel: + t.traverseSingle("LabelName", nn.LabelName) + case *ast.StmtNamespace: + t.traverseSingle("NamespaceName", nn.NamespaceName) + t.traverseArray("Stmts", nn.Stmts) + case *ast.StmtNop: + case *ast.StmtProperty: + t.traverseSingle("Var", nn.Var) + t.traverseSingle("Expr", nn.Expr) + case *ast.StmtPropertyList: + t.traverseArray("Modifiers", nn.Modifiers) + t.traverseSingle("Type", nn.Type) + t.traverseArray("Properties", nn.Properties) + case *ast.StmtReturn: + t.traverseSingle("Expr", nn.Expr) + case *ast.StmtStatic: + t.traverseArray("Vars", nn.Vars) + case *ast.StmtStaticVar: + t.traverseSingle("Var", nn.Var) + t.traverseSingle("Expr", nn.Expr) + case *ast.StmtStmtList: + t.traverseArray("Stmts", nn.Stmts) + case *ast.StmtSwitch: + t.traverseSingle("Cond", nn.Cond) + case *ast.StmtThrow: + t.traverseSingle("Expr", nn.Expr) + case *ast.StmtTrait: + t.traverseSingle("TraitName", nn.TraitName) + t.traverseArray("Stmts", nn.Stmts) + case *ast.StmtTraitAdaptationList: + t.traverseArray("Adaptations", nn.Adaptations) + case *ast.StmtTraitMethodRef: + t.traverseSingle("Trait", nn.Trait) + t.traverseSingle("Method", nn.Method) + case *ast.StmtTraitUse: + t.traverseArray("Traits", nn.Traits) + t.traverseSingle("TraitAdaptationList", nn.TraitAdaptationList) + case *ast.StmtTraitUseAlias: + t.traverseSingle("Ref", nn.Ref) + t.traverseSingle("Modifier", nn.Modifier) + t.traverseSingle("Alias", nn.Alias) + case *ast.StmtTraitUsePrecedence: + t.traverseSingle("Ref", nn.Ref) + t.traverseArray("Insteadof", nn.Insteadof) + case *ast.StmtTry: + t.traverseArray("Stmts", nn.Stmts) + t.traverseArray("Catches", nn.Catches) + t.traverseSingle("Finally", nn.Finally) + case *ast.StmtUnset: + t.traverseArray("Vars", nn.Vars) + case *ast.StmtUse: + t.traverseSingle("UseType", nn.UseType) + t.traverseSingle("Use", nn.Use) + t.traverseSingle("Alias", nn.Alias) + case *ast.StmtUseList: + t.traverseSingle("UseType", nn.UseType) + t.traverseArray("Uses", nn.Uses) + case *ast.StmtWhile: + t.traverseSingle("Cond", nn.Cond) + t.traverseSingle("Stmt", nn.Stmt) + case *ast.ExprArray: + t.traverseArray("Items", nn.Items) + case *ast.ExprArrayDimFetch: + t.traverseSingle("Var", nn.Var) + t.traverseSingle("Dim", nn.Dim) + case *ast.ExprArrayItem: + t.traverseSingle("Key", nn.Key) + t.traverseSingle("Val", nn.Val) + case *ast.ExprArrowFunction: + t.traverseArray("Params", nn.Params) + t.traverseSingle("ReturnType", nn.ReturnType) + t.traverseSingle("Expr", nn.Expr) + case *ast.ExprBitwiseNot: + t.traverseSingle("Expr", nn.Expr) + case *ast.ExprBooleanNot: + t.traverseSingle("Expr", nn.Expr) + case *ast.ExprClassConstFetch: + t.traverseSingle("Class", nn.Class) + t.traverseSingle("ConstantName", nn.ConstantName) + case *ast.ExprClone: + t.traverseSingle("Expr", nn.Expr) + case *ast.ExprClosure: + t.traverseArray("Params", nn.Params) + t.traverseSingle("ClosureUse", nn.ClosureUse) + t.traverseSingle("ReturnType", nn.ReturnType) + t.traverseArray("Stmts", nn.Stmts) + case *ast.ExprClosureUse: + t.traverseArray("Uses", nn.Uses) + case *ast.ExprConstFetch: + t.traverseSingle("Const", nn.Const) + case *ast.ExprEmpty: + t.traverseSingle("Expr", nn.Expr) + case *ast.ExprErrorSuppress: + t.traverseSingle("Expr", nn.Expr) + case *ast.ExprEval: + t.traverseSingle("Expr", nn.Expr) + case *ast.ExprExit: + t.traverseSingle("Expr", nn.Expr) + case *ast.ExprFunctionCall: + t.traverseSingle("Function", nn.Function) + t.traverseSingle("ArgumentList", nn.ArgumentList) + case *ast.ExprInclude: + t.traverseSingle("Expr", nn.Expr) + case *ast.ExprIncludeOnce: + t.traverseSingle("Expr", nn.Expr) + case *ast.ExprInstanceOf: + t.traverseSingle("Expr", nn.Expr) + t.traverseSingle("Class", nn.Class) + case *ast.ExprIsset: + t.traverseArray("Vars", nn.Vars) + case *ast.ExprList: + t.traverseArray("Items", nn.Items) + case *ast.ExprMethodCall: + t.traverseSingle("Var", nn.Var) + t.traverseSingle("Method", nn.Method) + case *ast.ExprNew: + t.traverseSingle("Class", nn.Class) + case *ast.ExprPostDec: + t.traverseSingle("Var", nn.Var) + case *ast.ExprPostInc: + t.traverseSingle("Var", nn.Var) + case *ast.ExprPreDec: + t.traverseSingle("Var", nn.Var) + case *ast.ExprPreInc: + t.traverseSingle("Var", nn.Var) + case *ast.ExprPrint: + t.traverseSingle("Expr", nn.Expr) + case *ast.ExprPropertyFetch: + t.traverseSingle("Var", nn.Var) + t.traverseSingle("Property", nn.Property) + case *ast.ExprReference: + t.traverseSingle("Var", nn.Var) + case *ast.ExprRequire: + t.traverseSingle("Expr", nn.Expr) + case *ast.ExprRequireOnce: + t.traverseSingle("Expr", nn.Expr) + case *ast.ExprShellExec: + t.traverseArray("Parts", nn.Parts) + case *ast.ExprShortArray: + t.traverseArray("Items", nn.Items) + case *ast.ExprShortList: + t.traverseArray("Items", nn.Items) + case *ast.ExprStaticCall: + t.traverseSingle("Class", nn.Class) + t.traverseSingle("Call", nn.Call) + t.traverseSingle("ArgumentList", nn.ArgumentList) + case *ast.ExprStaticPropertyFetch: + t.traverseSingle("Class", nn.Class) + t.traverseSingle("Property", nn.Property) + case *ast.ExprTernary: + t.traverseSingle("Condition", nn.Condition) + t.traverseSingle("IfTrue", nn.IfTrue) + t.traverseSingle("IfFalse", nn.IfFalse) + case *ast.ExprUnaryMinus: + t.traverseSingle("Expr", nn.Expr) + case *ast.ExprUnaryPlus: + t.traverseSingle("Expr", nn.Expr) + case *ast.ExprVariable: + t.traverseSingle("VarName", nn.VarName) + case *ast.ExprYield: + t.traverseSingle("Key", nn.Key) + t.traverseSingle("Value", nn.Value) + case *ast.ExprYieldFrom: + t.traverseSingle("Expr", nn.Expr) + case *ast.ExprAssign: + t.traverseSingle("Var", nn.Var) + t.traverseSingle("Expr", nn.Expr) + case *ast.ExprAssignReference: + t.traverseSingle("Var", nn.Var) + t.traverseSingle("Expr", nn.Expr) + case *ast.ExprAssignBitwiseAnd: + t.traverseSingle("Var", nn.Var) + t.traverseSingle("Expr", nn.Expr) + case *ast.ExprAssignBitwiseOr: + t.traverseSingle("Var", nn.Var) + t.traverseSingle("Expr", nn.Expr) + case *ast.ExprAssignBitwiseXor: + t.traverseSingle("Var", nn.Var) + t.traverseSingle("Expr", nn.Expr) + case *ast.ExprAssignCoalesce: + t.traverseSingle("Var", nn.Var) + t.traverseSingle("Expr", nn.Expr) + case *ast.ExprAssignConcat: + t.traverseSingle("Var", nn.Var) + t.traverseSingle("Expr", nn.Expr) + case *ast.ExprAssignDiv: + t.traverseSingle("Var", nn.Var) + t.traverseSingle("Expr", nn.Expr) + case *ast.ExprAssignMinus: + t.traverseSingle("Var", nn.Var) + t.traverseSingle("Expr", nn.Expr) + case *ast.ExprAssignMod: + t.traverseSingle("Var", nn.Var) + t.traverseSingle("Expr", nn.Expr) + case *ast.ExprAssignMul: + t.traverseSingle("Var", nn.Var) + t.traverseSingle("Expr", nn.Expr) + case *ast.ExprAssignPlus: + t.traverseSingle("Var", nn.Var) + t.traverseSingle("Expr", nn.Expr) + case *ast.ExprAssignPow: + t.traverseSingle("Var", nn.Var) + t.traverseSingle("Expr", nn.Expr) + case *ast.ExprAssignShiftLeft: + t.traverseSingle("Var", nn.Var) + t.traverseSingle("Expr", nn.Expr) + case *ast.ExprAssignShiftRight: + t.traverseSingle("Var", nn.Var) + t.traverseSingle("Expr", nn.Expr) + case *ast.ExprBinaryBitwiseAnd: + t.traverseSingle("Left", nn.Left) + t.traverseSingle("Right", nn.Right) + case *ast.ExprBinaryBitwiseOr: + t.traverseSingle("Left", nn.Left) + t.traverseSingle("Right", nn.Right) + case *ast.ExprBinaryBitwiseXor: + t.traverseSingle("Left", nn.Left) + t.traverseSingle("Right", nn.Right) + case *ast.ExprBinaryBooleanAnd: + t.traverseSingle("Left", nn.Left) + t.traverseSingle("Right", nn.Right) + case *ast.ExprBinaryBooleanOr: + t.traverseSingle("Left", nn.Left) + t.traverseSingle("Right", nn.Right) + case *ast.ExprBinaryCoalesce: + t.traverseSingle("Left", nn.Left) + t.traverseSingle("Right", nn.Right) + case *ast.ExprBinaryConcat: + t.traverseSingle("Left", nn.Left) + t.traverseSingle("Right", nn.Right) + case *ast.ExprBinaryDiv: + t.traverseSingle("Left", nn.Left) + t.traverseSingle("Right", nn.Right) + case *ast.ExprBinaryEqual: + t.traverseSingle("Left", nn.Left) + t.traverseSingle("Right", nn.Right) + case *ast.ExprBinaryGreater: + t.traverseSingle("Left", nn.Left) + t.traverseSingle("Right", nn.Right) + case *ast.ExprBinaryGreaterOrEqual: + t.traverseSingle("Left", nn.Left) + t.traverseSingle("Right", nn.Right) + case *ast.ExprBinaryIdentical: + t.traverseSingle("Left", nn.Left) + t.traverseSingle("Right", nn.Right) + case *ast.ExprBinaryLogicalAnd: + t.traverseSingle("Left", nn.Left) + t.traverseSingle("Right", nn.Right) + case *ast.ExprBinaryLogicalOr: + t.traverseSingle("Left", nn.Left) + t.traverseSingle("Right", nn.Right) + case *ast.ExprBinaryLogicalXor: + t.traverseSingle("Left", nn.Left) + t.traverseSingle("Right", nn.Right) + case *ast.ExprBinaryMinus: + t.traverseSingle("Left", nn.Left) + t.traverseSingle("Right", nn.Right) + case *ast.ExprBinaryMod: + t.traverseSingle("Left", nn.Left) + t.traverseSingle("Right", nn.Right) + case *ast.ExprBinaryMul: + t.traverseSingle("Left", nn.Left) + t.traverseSingle("Right", nn.Right) + case *ast.ExprBinaryNotEqual: + t.traverseSingle("Left", nn.Left) + t.traverseSingle("Right", nn.Right) + case *ast.ExprBinaryNotIdentical: + t.traverseSingle("Left", nn.Left) + t.traverseSingle("Right", nn.Right) + case *ast.ExprBinaryPlus: + t.traverseSingle("Left", nn.Left) + t.traverseSingle("Right", nn.Right) + case *ast.ExprBinaryPow: + t.traverseSingle("Left", nn.Left) + t.traverseSingle("Right", nn.Right) + case *ast.ExprBinaryShiftLeft: + t.traverseSingle("Left", nn.Left) + t.traverseSingle("Right", nn.Right) + case *ast.ExprBinaryShiftRight: + t.traverseSingle("Left", nn.Left) + t.traverseSingle("Right", nn.Right) + case *ast.ExprBinarySmaller: + t.traverseSingle("Left", nn.Left) + t.traverseSingle("Right", nn.Right) + case *ast.ExprBinarySmallerOrEqual: + t.traverseSingle("Left", nn.Left) + t.traverseSingle("Right", nn.Right) + case *ast.ExprBinarySpaceship: + t.traverseSingle("Left", nn.Left) + t.traverseSingle("Right", nn.Right) + case *ast.ExprCastArray: + t.traverseSingle("Expr", nn.Expr) + case *ast.ExprCastBool: + t.traverseSingle("Expr", nn.Expr) + case *ast.ExprCastDouble: + t.traverseSingle("Expr", nn.Expr) + case *ast.ExprCastInt: + t.traverseSingle("Expr", nn.Expr) + case *ast.ExprCastObject: + t.traverseSingle("Expr", nn.Expr) + case *ast.ExprCastString: + t.traverseSingle("Expr", nn.Expr) + case *ast.ExprCastUnset: + t.traverseSingle("Expr", nn.Expr) + case *ast.ScalarDnumber: + case *ast.ScalarEncapsed: + t.traverseArray("Parts", nn.Parts) + case *ast.ScalarEncapsedStringPart: + case *ast.ScalarHeredoc: + t.traverseArray("Parts", nn.Parts) + case *ast.ScalarLnumber: + case *ast.ScalarMagicConstant: + case *ast.ScalarString: + } + + t.visitor.LeaveNode(n) +} + +func (t *DFS) traverseSingle(key string, n ast.Vertex) { + if n == nil { + return + } + + t.visitor.Enter(key, true) + t.Traverse(n) + t.visitor.Leave(key, true) +} + +func (t *DFS) traverseArray(key string, nn []ast.Vertex) { + if nn == nil { + return + } + + t.visitor.Enter(key, false) + for _, c := range nn { + t.Traverse(c) + } + t.visitor.Leave(key, false) +} diff --git a/pkg/ast/visitor/dump.go b/pkg/ast/visitor/dump.go new file mode 100644 index 0000000..b013607 --- /dev/null +++ b/pkg/ast/visitor/dump.go @@ -0,0 +1,1003 @@ +package visitor + +import ( + "fmt" + "github.com/z7zmey/php-parser/pkg/ast" + "io" + "strings" +) + +type meta struct { + singleNode bool +} + +type Dump struct { + writer io.Writer + indent int + depth int + stack []meta +} + +func NewDump(writer io.Writer) *Dump { + return &Dump{writer: writer} +} + +func (v *Dump) print(str string) { + _, err := io.WriteString(v.writer, str) + if err != nil { + panic(err) + } +} + +func (v *Dump) printIndent(indentDepth int) { + v.print(strings.Repeat("\t", indentDepth)) +} + +func (v *Dump) printIndentIfNotSingle(indentDepth int) { + if !v.stack[v.depth-1].singleNode { + v.print(strings.Repeat("\t", indentDepth)) + } +} + +func (v *Dump) Enter(key string, singleNode bool) { + if len(v.stack) < v.depth+1 { + v.stack = append(v.stack, meta{}) + } + + v.stack[v.depth].singleNode = singleNode + + v.printIndent(v.indent) + v.print(key) + v.print(": ") + + if !singleNode { + v.print("[]ast.Vertex{\n") + v.indent++ + } +} + +func (v *Dump) Leave(_ string, singleNode bool) { + if !singleNode { + v.indent-- + v.printIndent(v.indent) + v.print("},\n") + } +} + +func (v *Dump) EnterNode(n ast.Vertex) bool { + v.indent++ + v.depth++ + + if len(v.stack) < v.depth { + v.stack = append(v.stack, meta{}) + } + + n.Accept(v) + + return true +} + +func (v *Dump) LeaveNode(_ ast.Vertex) { + v.indent-- + v.depth-- + v.printIndent(v.indent) + v.print("}") + if v.depth != 0 { + v.print(",") + } + v.print("\n") +} + +func (v *Dump) Root(_ *ast.Root) { + v.printIndentIfNotSingle(v.indent - 1) + v.print("&ast.Root{\n") +} + +func (v *Dump) Nullable(_ *ast.Nullable) { + v.printIndentIfNotSingle(v.indent - 1) + v.print("&ast.Nullable{\n") +} + +func (v *Dump) Parameter(n *ast.Parameter) { + v.printIndent(v.indent - 1) + v.print("&ast.Parameter{\n") + + if n.ByRef { + v.printIndent(v.indent) + v.print("ByRef: true,\n") + } + + if n.Variadic { + v.printIndent(v.indent) + v.print("Variadic: true,\n") + } +} + +func (v *Dump) Identifier(n *ast.Identifier) { + v.printIndentIfNotSingle(v.indent - 1) + v.print("&ast.Identifier{\n") + + v.printIndentIfNotSingle(v.indent) + v.print(fmt.Sprintf("Value: %q,\n", n.Value)) +} + +func (v *Dump) ArgumentList(_ *ast.ArgumentList) { + v.printIndentIfNotSingle(v.indent - 1) + v.print("&ast.ArgumentList{\n") +} + +func (v *Dump) Argument(n *ast.Argument) { + v.printIndentIfNotSingle(v.indent - 1) + v.print("&ast.Argument{\n") + + if n.Variadic { + v.printIndent(v.indent) + v.print("Variadic: true,\n") + } + + if n.IsReference { + v.printIndent(v.indent) + v.print("IsReference: true,\n") + } +} + +func (v *Dump) StmtAltElse(_ *ast.StmtAltElse) { + v.printIndentIfNotSingle(v.indent - 1) + v.print("&ast.StmtAltElse{\n") +} + +func (v *Dump) StmtAltElseIf(_ *ast.StmtAltElseIf) { + v.printIndentIfNotSingle(v.indent - 1) + v.print("&ast.StmtAltElseIf{\n") +} + +func (v *Dump) StmtAltFor(_ *ast.StmtAltFor) { + v.printIndentIfNotSingle(v.indent - 1) + v.print("&ast.StmtAltFor{\n") +} + +func (v *Dump) StmtAltForeach(_ *ast.StmtAltForeach) { + v.printIndentIfNotSingle(v.indent - 1) + v.print("&ast.StmtAltForeach{\n") +} + +func (v *Dump) StmtAltIf(_ *ast.StmtAltIf) { + v.printIndentIfNotSingle(v.indent - 1) + v.print("&ast.StmtAltIf{\n") +} + +func (v *Dump) StmtAltSwitch(_ *ast.StmtAltSwitch) { + v.printIndentIfNotSingle(v.indent - 1) + v.print("&ast.StmtAltSwitch{\n") +} + +func (v *Dump) StmtAltWhile(_ *ast.StmtAltWhile) { + v.printIndentIfNotSingle(v.indent - 1) + v.print("&ast.StmtAltWhile{\n") +} + +func (v *Dump) StmtBreak(_ *ast.StmtBreak) { + v.printIndentIfNotSingle(v.indent - 1) + v.print("&ast.StmtBreak{\n") +} + +func (v *Dump) StmtCase(_ *ast.StmtCase) { + v.printIndentIfNotSingle(v.indent - 1) + v.print("&ast.StmtCase{\n") +} + +func (v *Dump) StmtCaseList(_ *ast.StmtCaseList) { + v.printIndentIfNotSingle(v.indent - 1) + v.print("&ast.StmtCaseList{\n") +} + +func (v *Dump) StmtCatch(_ *ast.StmtCatch) { + v.printIndentIfNotSingle(v.indent - 1) + v.print("&ast.StmtCatch{\n") +} + +func (v *Dump) StmtClass(_ *ast.StmtClass) { + v.printIndentIfNotSingle(v.indent - 1) + v.print("&ast.StmtClass{\n") +} + +func (v *Dump) StmtClassConstList(_ *ast.StmtClassConstList) { + v.printIndentIfNotSingle(v.indent - 1) + v.print("&ast.StmtClassConstList{\n") +} + +func (v *Dump) StmtClassExtends(_ *ast.StmtClassExtends) { + v.printIndentIfNotSingle(v.indent - 1) + v.print("&ast.StmtClassExtends{\n") +} + +func (v *Dump) StmtClassImplements(_ *ast.StmtClassImplements) { + v.printIndentIfNotSingle(v.indent - 1) + v.print("&ast.StmtClassImplements{\n") +} + +func (v *Dump) StmtClassMethod(n *ast.StmtClassMethod) { + v.printIndentIfNotSingle(v.indent - 1) + v.print("&ast.StmtClassMethod{\n") + + if n.ReturnsRef { + v.printIndent(v.indent) + v.print("ReturnsRef: true,\n") + } +} + +func (v *Dump) StmtConstList(_ *ast.StmtConstList) { + v.printIndentIfNotSingle(v.indent - 1) + v.print("&ast.StmtConstList{\n") +} + +func (v *Dump) StmtConstant(_ *ast.StmtConstant) { + v.printIndentIfNotSingle(v.indent - 1) + v.print("&ast.StmtConstant{\n") +} + +func (v *Dump) StmtContinue(_ *ast.StmtContinue) { + v.printIndentIfNotSingle(v.indent - 1) + v.print("&ast.StmtContinue{\n") +} + +func (v *Dump) StmtDeclare(n *ast.StmtDeclare) { + v.printIndentIfNotSingle(v.indent - 1) + v.print("&ast.StmtDeclare{\n") + + if n.Alt { + v.printIndent(v.indent) + v.print("Alt: true,\n") + } +} + +func (v *Dump) StmtDefault(_ *ast.StmtDefault) { + v.printIndentIfNotSingle(v.indent - 1) + v.print("&ast.StmtDefault{\n") +} + +func (v *Dump) StmtDo(_ *ast.StmtDo) { + v.printIndentIfNotSingle(v.indent - 1) + v.print("&ast.StmtDo{\n") +} + +func (v *Dump) StmtEcho(_ *ast.StmtEcho) { + v.printIndentIfNotSingle(v.indent - 1) + v.print("&ast.StmtEcho{\n") +} + +func (v *Dump) StmtElse(_ *ast.StmtElse) { + v.printIndentIfNotSingle(v.indent - 1) + v.print("&ast.StmtElse{\n") +} + +func (v *Dump) StmtElseIf(_ *ast.StmtElseIf) { + v.printIndentIfNotSingle(v.indent - 1) + v.print("&ast.StmtElseIf{\n") +} + +func (v *Dump) StmtExpression(_ *ast.StmtExpression) { + v.printIndentIfNotSingle(v.indent - 1) + v.print("&ast.StmtExpression{\n") +} + +func (v *Dump) StmtFinally(_ *ast.StmtFinally) { + v.printIndentIfNotSingle(v.indent - 1) + v.print("&ast.StmtFinally{\n") +} + +func (v *Dump) StmtFor(_ *ast.StmtFor) { + v.printIndentIfNotSingle(v.indent - 1) + v.print("&ast.StmtFor{\n") +} + +func (v *Dump) StmtForeach(_ *ast.StmtForeach) { + v.printIndentIfNotSingle(v.indent - 1) + v.print("&ast.StmtForeach{\n") +} + +func (v *Dump) StmtFunction(n *ast.StmtFunction) { + v.printIndentIfNotSingle(v.indent - 1) + v.print("&ast.StmtFunction{\n") + + if n.ReturnsRef { + v.printIndent(v.indent) + v.print("ReturnsRef: true,\n") + } +} + +func (v *Dump) StmtGlobal(_ *ast.StmtGlobal) { + v.printIndentIfNotSingle(v.indent - 1) + v.print("&ast.StmtGlobal{\n") +} + +func (v *Dump) StmtGoto(_ *ast.StmtGoto) { + v.printIndentIfNotSingle(v.indent - 1) + v.print("&ast.StmtGoto{\n") +} + +func (v *Dump) StmtGroupUse(_ *ast.StmtGroupUse) { + v.printIndentIfNotSingle(v.indent - 1) + v.print("&ast.StmtGroupUse{\n") +} + +func (v *Dump) StmtHaltCompiler(_ *ast.StmtHaltCompiler) { + v.printIndentIfNotSingle(v.indent - 1) + v.print("&ast.StmtHaltCompiler{\n") +} + +func (v *Dump) StmtIf(_ *ast.StmtIf) { + v.printIndentIfNotSingle(v.indent - 1) + v.print("&ast.StmtIf{\n") +} + +func (v *Dump) StmtInlineHtml(n *ast.StmtInlineHtml) { + v.printIndentIfNotSingle(v.indent - 1) + v.print("&ast.StmtInlineHtml{\n") + + v.printIndentIfNotSingle(v.indent) + v.print(fmt.Sprintf("Value: %q,\n", n.Value)) +} + +func (v *Dump) StmtInterface(_ *ast.StmtInterface) { + v.printIndentIfNotSingle(v.indent - 1) + v.print("&ast.StmtInterface{\n") +} + +func (v *Dump) StmtInterfaceExtends(_ *ast.StmtInterfaceExtends) { + v.printIndentIfNotSingle(v.indent - 1) + v.print("&ast.StmtInterfaceExtends{\n") +} + +func (v *Dump) StmtLabel(_ *ast.StmtLabel) { + v.printIndentIfNotSingle(v.indent - 1) + v.print("&ast.StmtLabel{\n") +} + +func (v *Dump) StmtNamespace(_ *ast.StmtNamespace) { + v.printIndentIfNotSingle(v.indent - 1) + v.print("&ast.StmtNamespace{\n") +} + +func (v *Dump) StmtNop(_ *ast.StmtNop) { + v.printIndentIfNotSingle(v.indent - 1) + v.print("&ast.StmtNop{\n") +} + +func (v *Dump) StmtProperty(_ *ast.StmtProperty) { + v.printIndentIfNotSingle(v.indent - 1) + v.print("&ast.StmtProperty{\n") +} + +func (v *Dump) StmtPropertyList(_ *ast.StmtPropertyList) { + v.printIndentIfNotSingle(v.indent - 1) + v.print("&ast.StmtPropertyList{\n") +} + +func (v *Dump) StmtReturn(_ *ast.StmtReturn) { + v.printIndentIfNotSingle(v.indent - 1) + v.print("&ast.StmtReturn{\n") +} + +func (v *Dump) StmtStatic(_ *ast.StmtStatic) { + v.printIndentIfNotSingle(v.indent - 1) + v.print("&ast.StmtStatic{\n") +} + +func (v *Dump) StmtStaticVar(_ *ast.StmtStaticVar) { + v.printIndentIfNotSingle(v.indent - 1) + v.print("&ast.StmtStaticVar{\n") +} + +func (v *Dump) StmtStmtList(_ *ast.StmtStmtList) { + v.printIndentIfNotSingle(v.indent - 1) + v.print("&ast.StmtStmtList{\n") +} + +func (v *Dump) StmtSwitch(_ *ast.StmtSwitch) { + v.printIndentIfNotSingle(v.indent - 1) + v.print("&ast.StmtSwitch{\n") +} + +func (v *Dump) StmtThrow(_ *ast.StmtThrow) { + v.printIndentIfNotSingle(v.indent - 1) + v.print("&ast.StmtThrow{\n") +} + +func (v *Dump) StmtTrait(_ *ast.StmtTrait) { + v.printIndentIfNotSingle(v.indent - 1) + v.print("&ast.StmtTrait{\n") +} + +func (v *Dump) StmtTraitAdaptationList(_ *ast.StmtTraitAdaptationList) { + v.printIndentIfNotSingle(v.indent - 1) + v.print("&ast.StmtTraitAdaptationList{\n") +} + +func (v *Dump) StmtTraitMethodRef(_ *ast.StmtTraitMethodRef) { + v.printIndentIfNotSingle(v.indent - 1) + v.print("&ast.StmtTraitMethodRef{\n") +} + +func (v *Dump) StmtTraitUse(_ *ast.StmtTraitUse) { + v.printIndentIfNotSingle(v.indent - 1) + v.print("&ast.StmtTraitUse{\n") +} + +func (v *Dump) StmtTraitUseAlias(_ *ast.StmtTraitUseAlias) { + v.printIndentIfNotSingle(v.indent - 1) + v.print("&ast.StmtTraitUseAlias{\n") +} + +func (v *Dump) StmtTraitUsePrecedence(_ *ast.StmtTraitUsePrecedence) { + v.printIndentIfNotSingle(v.indent - 1) + v.print("&ast.StmtTraitUsePrecedence{\n") +} + +func (v *Dump) StmtTry(_ *ast.StmtTry) { + v.printIndentIfNotSingle(v.indent - 1) + v.print("&ast.StmtTry{\n") +} + +func (v *Dump) StmtUnset(_ *ast.StmtUnset) { + v.printIndentIfNotSingle(v.indent - 1) + v.print("&ast.StmtUnset{\n") +} + +func (v *Dump) StmtUse(_ *ast.StmtUse) { + v.printIndentIfNotSingle(v.indent - 1) + v.print("&ast.StmtUse{\n") +} + +func (v *Dump) StmtUseList(_ *ast.StmtUseList) { + v.printIndentIfNotSingle(v.indent - 1) + v.print("&ast.StmtUseList{\n") +} + +func (v *Dump) StmtWhile(_ *ast.StmtWhile) { + v.printIndentIfNotSingle(v.indent - 1) + v.print("&ast.StmtWhile{\n") +} + +func (v *Dump) ExprArray(_ *ast.ExprArray) { + v.printIndentIfNotSingle(v.indent - 1) + v.print("&ast.ExprArray{\n") +} + +func (v *Dump) ExprArrayDimFetch(_ *ast.ExprArrayDimFetch) { + v.printIndentIfNotSingle(v.indent - 1) + v.print("&ast.ExprArrayDimFetch{\n") +} + +func (v *Dump) ExprArrayItem(n *ast.ExprArrayItem) { + v.printIndentIfNotSingle(v.indent - 1) + v.print("&ast.ExprArrayItem{\n") + + if n.Unpack { + v.printIndent(v.indent) + v.print("Unpack: true,\n") + } +} + +func (v *Dump) ExprArrowFunction(n *ast.ExprArrowFunction) { + v.printIndentIfNotSingle(v.indent - 1) + v.print("&ast.ExprArrowFunction{\n") + + if n.ReturnsRef { + v.printIndent(v.indent) + v.print("ReturnsRef: true,\n") + } + + if n.Static { + v.printIndent(v.indent) + v.print("Static: true,\n") + } +} + +func (v *Dump) ExprBitwiseNot(_ *ast.ExprBitwiseNot) { + v.printIndentIfNotSingle(v.indent - 1) + v.print("&ast.ExprBitwiseNot{\n") +} + +func (v *Dump) ExprBooleanNot(_ *ast.ExprBooleanNot) { + v.printIndentIfNotSingle(v.indent - 1) + v.print("&ast.ExprBooleanNot{\n") +} + +func (v *Dump) ExprClassConstFetch(_ *ast.ExprClassConstFetch) { + v.printIndentIfNotSingle(v.indent - 1) + v.print("&ast.ExprClassConstFetch{\n") +} + +func (v *Dump) ExprClone(_ *ast.ExprClone) { + v.printIndentIfNotSingle(v.indent - 1) + v.print("&ast.ExprClone{\n") +} + +func (v *Dump) ExprClosure(n *ast.ExprClosure) { + v.printIndentIfNotSingle(v.indent - 1) + v.print("&ast.ExprClosure{\n") + + if n.ReturnsRef { + v.printIndent(v.indent) + v.print("ReturnsRef: true,\n") + } + + if n.Static { + v.printIndent(v.indent) + v.print("Static: true,\n") + } +} + +func (v *Dump) ExprClosureUse(_ *ast.ExprClosureUse) { + v.printIndentIfNotSingle(v.indent - 1) + v.print("&ast.ExprClosureUse{\n") +} + +func (v *Dump) ExprConstFetch(_ *ast.ExprConstFetch) { + v.printIndentIfNotSingle(v.indent - 1) + v.print("&ast.ExprConstFetch{\n") +} + +func (v *Dump) ExprEmpty(_ *ast.ExprEmpty) { + v.printIndentIfNotSingle(v.indent - 1) + v.print("&ast.ExprEmpty{\n") +} + +func (v *Dump) ExprErrorSuppress(_ *ast.ExprErrorSuppress) { + v.printIndentIfNotSingle(v.indent - 1) + v.print("&ast.ExprErrorSuppress{\n") +} + +func (v *Dump) ExprEval(_ *ast.ExprEval) { + v.printIndentIfNotSingle(v.indent - 1) + v.print("&ast.ExprEval{\n") +} + +func (v *Dump) ExprExit(n *ast.ExprExit) { + v.printIndentIfNotSingle(v.indent - 1) + v.print("&ast.ExprExit{\n") + + if n.Die { + v.printIndent(v.indent) + v.print("Die: true,\n") + } +} + +func (v *Dump) ExprFunctionCall(_ *ast.ExprFunctionCall) { + v.printIndentIfNotSingle(v.indent - 1) + v.print("&ast.ExprFunctionCall{\n") +} + +func (v *Dump) ExprInclude(_ *ast.ExprInclude) { + v.printIndentIfNotSingle(v.indent - 1) + v.print("&ast.ExprInclude{\n") +} + +func (v *Dump) ExprIncludeOnce(_ *ast.ExprIncludeOnce) { + v.printIndentIfNotSingle(v.indent - 1) + v.print("&ast.ExprIncludeOnce{\n") +} + +func (v *Dump) ExprInstanceOf(_ *ast.ExprInstanceOf) { + v.printIndentIfNotSingle(v.indent - 1) + v.print("&ast.ExprInstanceOf{\n") +} + +func (v *Dump) ExprIsset(_ *ast.ExprIsset) { + v.printIndentIfNotSingle(v.indent - 1) + v.print("&ast.ExprIsset{\n") +} + +func (v *Dump) ExprList(_ *ast.ExprList) { + v.printIndentIfNotSingle(v.indent - 1) + v.print("&ast.ExprList{\n") +} + +func (v *Dump) ExprMethodCall(_ *ast.ExprMethodCall) { + v.printIndentIfNotSingle(v.indent - 1) + v.print("&ast.ExprMethodCall{\n") +} + +func (v *Dump) ExprNew(_ *ast.ExprNew) { + v.printIndentIfNotSingle(v.indent - 1) + v.print("&ast.ExprNew{\n") +} + +func (v *Dump) ExprPostDec(_ *ast.ExprPostDec) { + v.printIndentIfNotSingle(v.indent - 1) + v.print("&ast.ExprPostDec{\n") +} + +func (v *Dump) ExprPostInc(_ *ast.ExprPostInc) { + v.printIndentIfNotSingle(v.indent - 1) + v.print("&ast.ExprPostInc{\n") +} + +func (v *Dump) ExprPreDec(_ *ast.ExprPreDec) { + v.printIndentIfNotSingle(v.indent - 1) + v.print("&ast.ExprPreDec{\n") +} + +func (v *Dump) ExprPreInc(_ *ast.ExprPreInc) { + v.printIndentIfNotSingle(v.indent - 1) + v.print("&ast.ExprPreInc{\n") +} + +func (v *Dump) ExprPrint(_ *ast.ExprPrint) { + v.printIndentIfNotSingle(v.indent - 1) + v.print("&ast.ExprPrint{\n") +} + +func (v *Dump) ExprPropertyFetch(_ *ast.ExprPropertyFetch) { + v.printIndentIfNotSingle(v.indent - 1) + v.print("&ast.ExprPropertyFetch{\n") +} + +func (v *Dump) ExprReference(_ *ast.ExprReference) { + v.printIndentIfNotSingle(v.indent - 1) + v.print("&ast.ExprReference{\n") +} + +func (v *Dump) ExprRequire(_ *ast.ExprRequire) { + v.printIndentIfNotSingle(v.indent - 1) + v.print("&ast.ExprRequire{\n") +} + +func (v *Dump) ExprRequireOnce(_ *ast.ExprRequireOnce) { + v.printIndentIfNotSingle(v.indent - 1) + v.print("&ast.ExprRequireOnce{\n") +} + +func (v *Dump) ExprShellExec(_ *ast.ExprShellExec) { + v.printIndentIfNotSingle(v.indent - 1) + v.print("&ast.ExprShellExec{\n") +} + +func (v *Dump) ExprShortArray(_ *ast.ExprShortArray) { + v.printIndentIfNotSingle(v.indent - 1) + v.print("&ast.ExprShortArray{\n") +} + +func (v *Dump) ExprShortList(_ *ast.ExprShortList) { + v.printIndentIfNotSingle(v.indent - 1) + v.print("&ast.ExprShortList{\n") +} + +func (v *Dump) ExprStaticCall(_ *ast.ExprStaticCall) { + v.printIndentIfNotSingle(v.indent - 1) + v.print("&ast.ExprStaticCall{\n") +} + +func (v *Dump) ExprStaticPropertyFetch(_ *ast.ExprStaticPropertyFetch) { + v.printIndentIfNotSingle(v.indent - 1) + v.print("&ast.ExprStaticPropertyFetch{\n") +} + +func (v *Dump) ExprTernary(_ *ast.ExprTernary) { + v.printIndentIfNotSingle(v.indent - 1) + v.print("&ast.ExprTernary{\n") +} + +func (v *Dump) ExprUnaryMinus(_ *ast.ExprUnaryMinus) { + v.printIndentIfNotSingle(v.indent - 1) + v.print("&ast.ExprUnaryMinus{\n") +} + +func (v *Dump) ExprUnaryPlus(_ *ast.ExprUnaryPlus) { + v.printIndentIfNotSingle(v.indent - 1) + v.print("&ast.ExprUnaryPlus{\n") +} + +func (v *Dump) ExprVariable(_ *ast.ExprVariable) { + v.printIndentIfNotSingle(v.indent - 1) + v.print("&ast.ExprVariable{\n") +} + +func (v *Dump) ExprYield(_ *ast.ExprYield) { + v.printIndentIfNotSingle(v.indent - 1) + v.print("&ast.ExprYield{\n") +} + +func (v *Dump) ExprYieldFrom(_ *ast.ExprYieldFrom) { + v.printIndentIfNotSingle(v.indent - 1) + v.print("&ast.ExprYieldFrom{\n") +} + +func (v *Dump) ExprAssign(_ *ast.ExprAssign) { + v.printIndentIfNotSingle(v.indent - 1) + v.print("&ast.ExprAssign{\n") +} + +func (v *Dump) ExprAssignReference(_ *ast.ExprAssignReference) { + v.printIndentIfNotSingle(v.indent - 1) + v.print("&ast.ExprAssignReference{\n") +} + +func (v *Dump) ExprAssignBitwiseAnd(_ *ast.ExprAssignBitwiseAnd) { + v.printIndentIfNotSingle(v.indent - 1) + v.print("&ast.ExprAssignBitwiseAnd{\n") +} + +func (v *Dump) ExprAssignBitwiseOr(_ *ast.ExprAssignBitwiseOr) { + v.printIndentIfNotSingle(v.indent - 1) + v.print("&ast.ExprAssignBitwiseOr{\n") +} + +func (v *Dump) ExprAssignBitwiseXor(_ *ast.ExprAssignBitwiseXor) { + v.printIndentIfNotSingle(v.indent - 1) + v.print("&ast.ExprAssignBitwiseXor{\n") +} + +func (v *Dump) ExprAssignCoalesce(_ *ast.ExprAssignCoalesce) { + v.printIndentIfNotSingle(v.indent - 1) + v.print("&ast.ExprAssignCoalesce{\n") +} + +func (v *Dump) ExprAssignConcat(_ *ast.ExprAssignConcat) { + v.printIndentIfNotSingle(v.indent - 1) + v.print("&ast.ExprAssignConcat{\n") +} + +func (v *Dump) ExprAssignDiv(_ *ast.ExprAssignDiv) { + v.printIndentIfNotSingle(v.indent - 1) + v.print("&ast.ExprAssignDiv{\n") +} + +func (v *Dump) ExprAssignMinus(_ *ast.ExprAssignMinus) { + v.printIndentIfNotSingle(v.indent - 1) + v.print("&ast.ExprAssignMinus{\n") +} + +func (v *Dump) ExprAssignMod(_ *ast.ExprAssignMod) { + v.printIndentIfNotSingle(v.indent - 1) + v.print("&ast.ExprAssignMod{\n") +} + +func (v *Dump) ExprAssignMul(_ *ast.ExprAssignMul) { + v.printIndentIfNotSingle(v.indent - 1) + v.print("&ast.ExprAssignMul{\n") +} + +func (v *Dump) ExprAssignPlus(_ *ast.ExprAssignPlus) { + v.printIndentIfNotSingle(v.indent - 1) + v.print("&ast.ExprAssignPlus{\n") +} + +func (v *Dump) ExprAssignPow(_ *ast.ExprAssignPow) { + v.printIndentIfNotSingle(v.indent - 1) + v.print("&ast.ExprAssignPow{\n") +} + +func (v *Dump) ExprAssignShiftLeft(_ *ast.ExprAssignShiftLeft) { + v.printIndentIfNotSingle(v.indent - 1) + v.print("&ast.ExprAssignShiftLeft{\n") +} + +func (v *Dump) ExprAssignShiftRight(_ *ast.ExprAssignShiftRight) { + v.printIndentIfNotSingle(v.indent - 1) + v.print("&ast.ExprAssignShiftRight{\n") +} + +func (v *Dump) ExprBinaryBitwiseAnd(_ *ast.ExprBinaryBitwiseAnd) { + v.printIndentIfNotSingle(v.indent - 1) + v.print("&ast.ExprBinaryBitwiseAnd{\n") +} + +func (v *Dump) ExprBinaryBitwiseOr(_ *ast.ExprBinaryBitwiseOr) { + v.printIndentIfNotSingle(v.indent - 1) + v.print("&ast.ExprBinaryBitwiseOr{\n") +} + +func (v *Dump) ExprBinaryBitwiseXor(_ *ast.ExprBinaryBitwiseXor) { + v.printIndentIfNotSingle(v.indent - 1) + v.print("&ast.ExprBinaryBitwiseXor{\n") +} + +func (v *Dump) ExprBinaryBooleanAnd(_ *ast.ExprBinaryBooleanAnd) { + v.printIndentIfNotSingle(v.indent - 1) + v.print("&ast.ExprBinaryBooleanAnd{\n") +} + +func (v *Dump) ExprBinaryBooleanOr(_ *ast.ExprBinaryBooleanOr) { + v.printIndentIfNotSingle(v.indent - 1) + v.print("&ast.ExprBinaryBooleanOr{\n") +} + +func (v *Dump) ExprBinaryCoalesce(_ *ast.ExprBinaryCoalesce) { + v.printIndentIfNotSingle(v.indent - 1) + v.print("&ast.ExprBinaryCoalesce{\n") +} + +func (v *Dump) ExprBinaryConcat(_ *ast.ExprBinaryConcat) { + v.printIndentIfNotSingle(v.indent - 1) + v.print("&ast.ExprBinaryConcat{\n") +} + +func (v *Dump) ExprBinaryDiv(_ *ast.ExprBinaryDiv) { + v.printIndentIfNotSingle(v.indent - 1) + v.print("&ast.ExprBinaryDiv{\n") +} + +func (v *Dump) ExprBinaryEqual(_ *ast.ExprBinaryEqual) { + v.printIndentIfNotSingle(v.indent - 1) + v.print("&ast.ExprBinaryEqual{\n") +} + +func (v *Dump) ExprBinaryGreater(_ *ast.ExprBinaryGreater) { + v.printIndentIfNotSingle(v.indent - 1) + v.print("&ast.ExprBinaryGreater{\n") +} + +func (v *Dump) ExprBinaryGreaterOrEqual(_ *ast.ExprBinaryGreaterOrEqual) { + v.printIndentIfNotSingle(v.indent - 1) + v.print("&ast.ExprBinaryGreaterOrEqual{\n") +} + +func (v *Dump) ExprBinaryIdentical(_ *ast.ExprBinaryIdentical) { + v.printIndentIfNotSingle(v.indent - 1) + v.print("&ast.ExprBinaryIdentical{\n") +} + +func (v *Dump) ExprBinaryLogicalAnd(_ *ast.ExprBinaryLogicalAnd) { + v.printIndentIfNotSingle(v.indent - 1) + v.print("&ast.ExprBinaryLogicalAnd{\n") +} + +func (v *Dump) ExprBinaryLogicalOr(_ *ast.ExprBinaryLogicalOr) { + v.printIndentIfNotSingle(v.indent - 1) + v.print("&ast.ExprBinaryLogicalOr{\n") +} + +func (v *Dump) ExprBinaryLogicalXor(_ *ast.ExprBinaryLogicalXor) { + v.printIndentIfNotSingle(v.indent - 1) + v.print("&ast.ExprBinaryLogicalXor{\n") +} + +func (v *Dump) ExprBinaryMinus(_ *ast.ExprBinaryMinus) { + v.printIndentIfNotSingle(v.indent - 1) + v.print("&ast.ExprBinaryMinus{\n") +} + +func (v *Dump) ExprBinaryMod(_ *ast.ExprBinaryMod) { + v.printIndentIfNotSingle(v.indent - 1) + v.print("&ast.ExprBinaryMod{\n") +} + +func (v *Dump) ExprBinaryMul(_ *ast.ExprBinaryMul) { + v.printIndentIfNotSingle(v.indent - 1) + v.print("&ast.ExprBinaryMul{\n") +} + +func (v *Dump) ExprBinaryNotEqual(_ *ast.ExprBinaryNotEqual) { + v.printIndentIfNotSingle(v.indent - 1) + v.print("&ast.ExprBinaryNotEqual{\n") +} + +func (v *Dump) ExprBinaryNotIdentical(_ *ast.ExprBinaryNotIdentical) { + v.printIndentIfNotSingle(v.indent - 1) + v.print("&ast.ExprBinaryNotIdentical{\n") +} + +func (v *Dump) ExprBinaryPlus(_ *ast.ExprBinaryPlus) { + v.printIndentIfNotSingle(v.indent - 1) + v.print("&ast.ExprBinaryPlus{\n") +} + +func (v *Dump) ExprBinaryPow(_ *ast.ExprBinaryPow) { + v.printIndentIfNotSingle(v.indent - 1) + v.print("&ast.ExprBinaryPow{\n") +} + +func (v *Dump) ExprBinaryShiftLeft(_ *ast.ExprBinaryShiftLeft) { + v.printIndentIfNotSingle(v.indent - 1) + v.print("&ast.ExprBinaryShiftLeft{\n") +} + +func (v *Dump) ExprBinaryShiftRight(_ *ast.ExprBinaryShiftRight) { + v.printIndentIfNotSingle(v.indent - 1) + v.print("&ast.ExprBinaryShiftRight{\n") +} + +func (v *Dump) ExprBinarySmaller(_ *ast.ExprBinarySmaller) { + v.printIndentIfNotSingle(v.indent - 1) + v.print("&ast.ExprBinarySmaller{\n") +} + +func (v *Dump) ExprBinarySmallerOrEqual(_ *ast.ExprBinarySmallerOrEqual) { + v.printIndentIfNotSingle(v.indent - 1) + v.print("&ast.ExprBinarySmallerOrEqual{\n") +} + +func (v *Dump) ExprBinarySpaceship(_ *ast.ExprBinarySpaceship) { + v.printIndentIfNotSingle(v.indent - 1) + v.print("&ast.ExprBinarySpaceship{\n") +} + +func (v *Dump) ExprCastArray(_ *ast.ExprCastArray) { + v.printIndentIfNotSingle(v.indent - 1) + v.print("&ast.ExprCastArray{\n") +} + +func (v *Dump) ExprCastBool(_ *ast.ExprCastBool) { + v.printIndentIfNotSingle(v.indent - 1) + v.print("&ast.ExprCastBool{\n") +} + +func (v *Dump) ExprCastDouble(_ *ast.ExprCastDouble) { + v.printIndentIfNotSingle(v.indent - 1) + v.print("&ast.ExprCastDouble{\n") +} + +func (v *Dump) ExprCastInt(_ *ast.ExprCastInt) { + v.printIndentIfNotSingle(v.indent - 1) + v.print("&ast.ExprCastInt{\n") +} + +func (v *Dump) ExprCastObject(_ *ast.ExprCastObject) { + v.printIndentIfNotSingle(v.indent - 1) + v.print("&ast.ExprCastObject{\n") +} + +func (v *Dump) ExprCastString(_ *ast.ExprCastString) { + v.printIndentIfNotSingle(v.indent - 1) + v.print("&ast.ExprCastString{\n") +} + +func (v *Dump) ExprCastUnset(_ *ast.ExprCastUnset) { + v.printIndentIfNotSingle(v.indent - 1) + v.print("&ast.ExprCastUnset{\n") +} + +func (v *Dump) ScalarDnumber(n *ast.ScalarDnumber) { + v.printIndentIfNotSingle(v.indent - 1) + v.print("&ast.ScalarDnumber{\n") + + v.printIndentIfNotSingle(v.indent) + v.print(fmt.Sprintf("Value: %q,\n", n.Value)) +} + +func (v *Dump) ScalarEncapsed(_ *ast.ScalarEncapsed) { + v.printIndentIfNotSingle(v.indent - 1) + v.print("&ast.ScalarEncapsed{\n") +} + +func (v *Dump) ScalarEncapsedStringPart(n *ast.ScalarEncapsedStringPart) { + v.printIndentIfNotSingle(v.indent - 1) + v.print("&ast.ScalarEncapsedStringPart{\n") + + v.printIndentIfNotSingle(v.indent) + v.print(fmt.Sprintf("Value: %q,\n", n.Value)) +} + +func (v *Dump) ScalarHeredoc(n *ast.ScalarHeredoc) { + v.printIndentIfNotSingle(v.indent - 1) + v.print("&ast.ScalarHeredoc{\n") + + v.printIndentIfNotSingle(v.indent) + v.print(fmt.Sprintf("Label: %q,\n", n.Label)) +} + +func (v *Dump) ScalarLnumber(n *ast.ScalarLnumber) { + v.printIndentIfNotSingle(v.indent - 1) + v.print("&ast.ScalarLnumber{\n") + + v.printIndentIfNotSingle(v.indent) + v.print(fmt.Sprintf("Value: %q,\n", n.Value)) +} + +func (v *Dump) ScalarMagicConstant(n *ast.ScalarMagicConstant) { + v.printIndentIfNotSingle(v.indent - 1) + v.print("&ast.ScalarMagicConstant{\n") + + v.printIndentIfNotSingle(v.indent) + v.print(fmt.Sprintf("Value: %q,\n", n.Value)) +} + +func (v *Dump) ScalarString(n *ast.ScalarString) { + v.printIndentIfNotSingle(v.indent - 1) + v.print("&ast.ScalarString{\n") + + v.printIndentIfNotSingle(v.indent) + v.print(fmt.Sprintf("Value: %q,\n", n.Value)) +} diff --git a/pkg/ast/visitor/dump_test.go b/pkg/ast/visitor/dump_test.go new file mode 100644 index 0000000..5d2277d --- /dev/null +++ b/pkg/ast/visitor/dump_test.go @@ -0,0 +1,43 @@ +package visitor_test + +import ( + "github.com/z7zmey/php-parser/pkg/ast" + "github.com/z7zmey/php-parser/pkg/ast/traverser" + "github.com/z7zmey/php-parser/pkg/ast/visitor" + "os" +) + +func ExampleDump() { + stxTree := &ast.Root{ + Stmts: []ast.Vertex{ + &ast.Identifier{}, + &ast.Parameter{ + Variadic: true, + Var: &ast.ExprVariable{ + }, + }, + &ast.StmtInlineHtml{ + Value: "foo", + }, + }, + } + + traverser.NewDFS(visitor.NewDump(os.Stdout)).Traverse(stxTree) + + //output: + //&ast.Root{ + // Stmts: []ast.Vertex{ + // &ast.Identifier{ + // Value: "", + // }, + // &ast.Parameter{ + // Variadic: true, + // Var: &ast.ExprVariable{ + // }, + // }, + // &ast.StmtInlineHtml{ + // Value: "foo", + // }, + // }, + //} +} diff --git a/pkg/ast/visitor/null.go b/pkg/ast/visitor/null.go new file mode 100644 index 0000000..41ab67b --- /dev/null +++ b/pkg/ast/visitor/null.go @@ -0,0 +1,683 @@ +package visitor + +import ( + "github.com/z7zmey/php-parser/pkg/ast" +) + +type Null struct { +} + +func (v *Null) Enter(_ string, _ bool) { + // do nothing +} +func (v *Null) Leave(_ string, _ bool) { + // do nothing +} + +func (v *Null) EnterNode(_ ast.Vertex) bool { + return true +} + +func (v *Null) LeaveNode(_ ast.Vertex) { + // do nothing +} + +func (v *Null) Root(_ *ast.Root) { + // do nothing +} + +func (v *Null) Nullable(_ *ast.Nullable) { + // do nothing +} + +func (v *Null) Parameter(_ *ast.Parameter) { + // do nothing +} + +func (v *Null) Identifier(_ *ast.Identifier) { + // do nothing +} + +func (v *Null) ArgumentList(_ *ast.ArgumentList) { + // do nothing +} + +func (v *Null) Argument(_ *ast.Argument) { + // do nothing +} + +func (v *Null) StmtAltElse(_ *ast.StmtAltElse) { + // do nothing +} + +func (v *Null) StmtAltElseIf(_ *ast.StmtAltElseIf) { + // do nothing +} + +func (v *Null) StmtAltFor(_ *ast.StmtAltFor) { + // do nothing +} + +func (v *Null) StmtAltForeach(_ *ast.StmtAltForeach) { + // do nothing +} + +func (v *Null) StmtAltIf(_ *ast.StmtAltIf) { + // do nothing +} + +func (v *Null) StmtAltSwitch(_ *ast.StmtAltSwitch) { + // do nothing +} + +func (v *Null) StmtAltWhile(_ *ast.StmtAltWhile) { + // do nothing +} + +func (v *Null) StmtBreak(_ *ast.StmtBreak) { + // do nothing +} + +func (v *Null) StmtCase(_ *ast.StmtCase) { + // do nothing +} + +func (v *Null) StmtCaseList(_ *ast.StmtCaseList) { + // do nothing +} + +func (v *Null) StmtCatch(_ *ast.StmtCatch) { + // do nothing +} + +func (v *Null) StmtClass(_ *ast.StmtClass) { + // do nothing +} + +func (v *Null) StmtClassConstList(_ *ast.StmtClassConstList) { + // do nothing +} + +func (v *Null) StmtClassExtends(_ *ast.StmtClassExtends) { + // do nothing +} + +func (v *Null) StmtClassImplements(_ *ast.StmtClassImplements) { + // do nothing +} + +func (v *Null) StmtClassMethod(_ *ast.StmtClassMethod) { + // do nothing +} + +func (v *Null) StmtConstList(_ *ast.StmtConstList) { + // do nothing +} + +func (v *Null) StmtConstant(_ *ast.StmtConstant) { + // do nothing +} + +func (v *Null) StmtContinue(_ *ast.StmtContinue) { + // do nothing +} + +func (v *Null) StmtDeclare(_ *ast.StmtDeclare) { + // do nothing +} + +func (v *Null) StmtDefault(_ *ast.StmtDefault) { + // do nothing +} + +func (v *Null) StmtDo(_ *ast.StmtDo) { + // do nothing +} + +func (v *Null) StmtEcho(_ *ast.StmtEcho) { + // do nothing +} + +func (v *Null) StmtElse(_ *ast.StmtElse) { + // do nothing +} + +func (v *Null) StmtElseIf(_ *ast.StmtElseIf) { + // do nothing +} + +func (v *Null) StmtExpression(_ *ast.StmtExpression) { + // do nothing +} + +func (v *Null) StmtFinally(_ *ast.StmtFinally) { + // do nothing +} + +func (v *Null) StmtFor(_ *ast.StmtFor) { + // do nothing +} + +func (v *Null) StmtForeach(_ *ast.StmtForeach) { + // do nothing +} + +func (v *Null) StmtFunction(_ *ast.StmtFunction) { + // do nothing +} + +func (v *Null) StmtGlobal(_ *ast.StmtGlobal) { + // do nothing +} + +func (v *Null) StmtGoto(_ *ast.StmtGoto) { + // do nothing +} + +func (v *Null) StmtGroupUse(_ *ast.StmtGroupUse) { + // do nothing +} + +func (v *Null) StmtHaltCompiler(_ *ast.StmtHaltCompiler) { + // do nothing +} + +func (v *Null) StmtIf(_ *ast.StmtIf) { + // do nothing +} + +func (v *Null) StmtInlineHtml(_ *ast.StmtInlineHtml) { + // do nothing +} + +func (v *Null) StmtInterface(_ *ast.StmtInterface) { + // do nothing +} + +func (v *Null) StmtInterfaceExtends(_ *ast.StmtInterfaceExtends) { + // do nothing +} + +func (v *Null) StmtLabel(_ *ast.StmtLabel) { + // do nothing +} + +func (v *Null) StmtNamespace(_ *ast.StmtNamespace) { + // do nothing +} + +func (v *Null) StmtNop(_ *ast.StmtNop) { + // do nothing +} + +func (v *Null) StmtProperty(_ *ast.StmtProperty) { + // do nothing +} + +func (v *Null) StmtPropertyList(_ *ast.StmtPropertyList) { + // do nothing +} + +func (v *Null) StmtReturn(_ *ast.StmtReturn) { + // do nothing +} + +func (v *Null) StmtStatic(_ *ast.StmtStatic) { + // do nothing +} + +func (v *Null) StmtStaticVar(_ *ast.StmtStaticVar) { + // do nothing +} + +func (v *Null) StmtStmtList(_ *ast.StmtStmtList) { + // do nothing +} + +func (v *Null) StmtSwitch(_ *ast.StmtSwitch) { + // do nothing +} + +func (v *Null) StmtThrow(_ *ast.StmtThrow) { + // do nothing +} + +func (v *Null) StmtTrait(_ *ast.StmtTrait) { + // do nothing +} + +func (v *Null) StmtTraitAdaptationList(_ *ast.StmtTraitAdaptationList) { + // do nothing +} + +func (v *Null) StmtTraitMethodRef(_ *ast.StmtTraitMethodRef) { + // do nothing +} + +func (v *Null) StmtTraitUse(_ *ast.StmtTraitUse) { + // do nothing +} + +func (v *Null) StmtTraitUseAlias(_ *ast.StmtTraitUseAlias) { + // do nothing +} + +func (v *Null) StmtTraitUsePrecedence(_ *ast.StmtTraitUsePrecedence) { + // do nothing +} + +func (v *Null) StmtTry(_ *ast.StmtTry) { + // do nothing +} + +func (v *Null) StmtUnset(_ *ast.StmtUnset) { + // do nothing +} + +func (v *Null) StmtUse(_ *ast.StmtUse) { + // do nothing +} + +func (v *Null) StmtUseList(_ *ast.StmtUseList) { + // do nothing +} + +func (v *Null) StmtWhile(_ *ast.StmtWhile) { + // do nothing +} + +func (v *Null) ExprArray(_ *ast.ExprArray) { + // do nothing +} + +func (v *Null) ExprArrayDimFetch(_ *ast.ExprArrayDimFetch) { + // do nothing +} + +func (v *Null) ExprArrayItem(_ *ast.ExprArrayItem) { + // do nothing +} + +func (v *Null) ExprArrowFunction(_ *ast.ExprArrowFunction) { + // do nothing +} + +func (v *Null) ExprBitwiseNot(_ *ast.ExprBitwiseNot) { + // do nothing +} + +func (v *Null) ExprBooleanNot(_ *ast.ExprBooleanNot) { + // do nothing +} + +func (v *Null) ExprClassConstFetch(_ *ast.ExprClassConstFetch) { + // do nothing +} + +func (v *Null) ExprClone(_ *ast.ExprClone) { + // do nothing +} + +func (v *Null) ExprClosure(_ *ast.ExprClosure) { + // do nothing +} + +func (v *Null) ExprClosureUse(_ *ast.ExprClosureUse) { + // do nothing +} + +func (v *Null) ExprConstFetch(_ *ast.ExprConstFetch) { + // do nothing +} + +func (v *Null) ExprEmpty(_ *ast.ExprEmpty) { + // do nothing +} + +func (v *Null) ExprErrorSuppress(_ *ast.ExprErrorSuppress) { + // do nothing +} + +func (v *Null) ExprEval(_ *ast.ExprEval) { + // do nothing +} + +func (v *Null) ExprExit(_ *ast.ExprExit) { + // do nothing +} + +func (v *Null) ExprFunctionCall(_ *ast.ExprFunctionCall) { + // do nothing +} + +func (v *Null) ExprInclude(_ *ast.ExprInclude) { + // do nothing +} + +func (v *Null) ExprIncludeOnce(_ *ast.ExprIncludeOnce) { + // do nothing +} + +func (v *Null) ExprInstanceOf(_ *ast.ExprInstanceOf) { + // do nothing +} + +func (v *Null) ExprIsset(_ *ast.ExprIsset) { + // do nothing +} + +func (v *Null) ExprList(_ *ast.ExprList) { + // do nothing +} + +func (v *Null) ExprMethodCall(_ *ast.ExprMethodCall) { + // do nothing +} + +func (v *Null) ExprNew(_ *ast.ExprNew) { + // do nothing +} + +func (v *Null) ExprPostDec(_ *ast.ExprPostDec) { + // do nothing +} + +func (v *Null) ExprPostInc(_ *ast.ExprPostInc) { + // do nothing +} + +func (v *Null) ExprPreDec(_ *ast.ExprPreDec) { + // do nothing +} + +func (v *Null) ExprPreInc(_ *ast.ExprPreInc) { + // do nothing +} + +func (v *Null) ExprPrint(_ *ast.ExprPrint) { + // do nothing +} + +func (v *Null) ExprPropertyFetch(_ *ast.ExprPropertyFetch) { + // do nothing +} + +func (v *Null) ExprReference(_ *ast.ExprReference) { + // do nothing +} + +func (v *Null) ExprRequire(_ *ast.ExprRequire) { + // do nothing +} + +func (v *Null) ExprRequireOnce(_ *ast.ExprRequireOnce) { + // do nothing +} + +func (v *Null) ExprShellExec(_ *ast.ExprShellExec) { + // do nothing +} + +func (v *Null) ExprShortArray(_ *ast.ExprShortArray) { + // do nothing +} + +func (v *Null) ExprShortList(_ *ast.ExprShortList) { + // do nothing +} + +func (v *Null) ExprStaticCall(_ *ast.ExprStaticCall) { + // do nothing +} + +func (v *Null) ExprStaticPropertyFetch(_ *ast.ExprStaticPropertyFetch) { + // do nothing +} + +func (v *Null) ExprTernary(_ *ast.ExprTernary) { + // do nothing +} + +func (v *Null) ExprUnaryMinus(_ *ast.ExprUnaryMinus) { + // do nothing +} + +func (v *Null) ExprUnaryPlus(_ *ast.ExprUnaryPlus) { + // do nothing +} + +func (v *Null) ExprVariable(_ *ast.ExprVariable) { + // do nothing +} + +func (v *Null) ExprYield(_ *ast.ExprYield) { + // do nothing +} + +func (v *Null) ExprYieldFrom(_ *ast.ExprYieldFrom) { + // do nothing +} + +func (v *Null) ExprAssign(_ *ast.ExprAssign) { + // do nothing +} + +func (v *Null) ExprAssignReference(_ *ast.ExprAssignReference) { + // do nothing +} + +func (v *Null) ExprAssignBitwiseAnd(_ *ast.ExprAssignBitwiseAnd) { + // do nothing +} + +func (v *Null) ExprAssignBitwiseOr(_ *ast.ExprAssignBitwiseOr) { + // do nothing +} + +func (v *Null) ExprAssignBitwiseXor(_ *ast.ExprAssignBitwiseXor) { + // do nothing +} + +func (v *Null) ExprAssignCoalesce(_ *ast.ExprAssignCoalesce) { + // do nothing +} + +func (v *Null) ExprAssignConcat(_ *ast.ExprAssignConcat) { + // do nothing +} + +func (v *Null) ExprAssignDiv(_ *ast.ExprAssignDiv) { + // do nothing +} + +func (v *Null) ExprAssignMinus(_ *ast.ExprAssignMinus) { + // do nothing +} + +func (v *Null) ExprAssignMod(_ *ast.ExprAssignMod) { + // do nothing +} + +func (v *Null) ExprAssignMul(_ *ast.ExprAssignMul) { + // do nothing +} + +func (v *Null) ExprAssignPlus(_ *ast.ExprAssignPlus) { + // do nothing +} + +func (v *Null) ExprAssignPow(_ *ast.ExprAssignPow) { + // do nothing +} + +func (v *Null) ExprAssignShiftLeft(_ *ast.ExprAssignShiftLeft) { + // do nothing +} + +func (v *Null) ExprAssignShiftRight(_ *ast.ExprAssignShiftRight) { + // do nothing +} + +func (v *Null) ExprBinaryBitwiseAnd(_ *ast.ExprBinaryBitwiseAnd) { + // do nothing +} + +func (v *Null) ExprBinaryBitwiseOr(_ *ast.ExprBinaryBitwiseOr) { + // do nothing +} + +func (v *Null) ExprBinaryBitwiseXor(_ *ast.ExprBinaryBitwiseXor) { + // do nothing +} + +func (v *Null) ExprBinaryBooleanAnd(_ *ast.ExprBinaryBooleanAnd) { + // do nothing +} + +func (v *Null) ExprBinaryBooleanOr(_ *ast.ExprBinaryBooleanOr) { + // do nothing +} + +func (v *Null) ExprBinaryCoalesce(_ *ast.ExprBinaryCoalesce) { + // do nothing +} + +func (v *Null) ExprBinaryConcat(_ *ast.ExprBinaryConcat) { + // do nothing +} + +func (v *Null) ExprBinaryDiv(_ *ast.ExprBinaryDiv) { + // do nothing +} + +func (v *Null) ExprBinaryEqual(_ *ast.ExprBinaryEqual) { + // do nothing +} + +func (v *Null) ExprBinaryGreater(_ *ast.ExprBinaryGreater) { + // do nothing +} + +func (v *Null) ExprBinaryGreaterOrEqual(_ *ast.ExprBinaryGreaterOrEqual) { + // do nothing +} + +func (v *Null) ExprBinaryIdentical(_ *ast.ExprBinaryIdentical) { + // do nothing +} + +func (v *Null) ExprBinaryLogicalAnd(_ *ast.ExprBinaryLogicalAnd) { + // do nothing +} + +func (v *Null) ExprBinaryLogicalOr(_ *ast.ExprBinaryLogicalOr) { + // do nothing +} + +func (v *Null) ExprBinaryLogicalXor(_ *ast.ExprBinaryLogicalXor) { + // do nothing +} + +func (v *Null) ExprBinaryMinus(_ *ast.ExprBinaryMinus) { + // do nothing +} + +func (v *Null) ExprBinaryMod(_ *ast.ExprBinaryMod) { + // do nothing +} + +func (v *Null) ExprBinaryMul(_ *ast.ExprBinaryMul) { + // do nothing +} + +func (v *Null) ExprBinaryNotEqual(_ *ast.ExprBinaryNotEqual) { + // do nothing +} + +func (v *Null) ExprBinaryNotIdentical(_ *ast.ExprBinaryNotIdentical) { + // do nothing +} + +func (v *Null) ExprBinaryPlus(_ *ast.ExprBinaryPlus) { + // do nothing +} + +func (v *Null) ExprBinaryPow(_ *ast.ExprBinaryPow) { + // do nothing +} + +func (v *Null) ExprBinaryShiftLeft(_ *ast.ExprBinaryShiftLeft) { + // do nothing +} + +func (v *Null) ExprBinaryShiftRight(_ *ast.ExprBinaryShiftRight) { + // do nothing +} + +func (v *Null) ExprBinarySmaller(_ *ast.ExprBinarySmaller) { + // do nothing +} + +func (v *Null) ExprBinarySmallerOrEqual(_ *ast.ExprBinarySmallerOrEqual) { + // do nothing +} + +func (v *Null) ExprBinarySpaceship(_ *ast.ExprBinarySpaceship) { + // do nothing +} + +func (v *Null) ExprCastArray(_ *ast.ExprCastArray) { + // do nothing +} + +func (v *Null) ExprCastBool(_ *ast.ExprCastBool) { + // do nothing +} + +func (v *Null) ExprCastDouble(_ *ast.ExprCastDouble) { + // do nothing +} + +func (v *Null) ExprCastInt(_ *ast.ExprCastInt) { + // do nothing +} + +func (v *Null) ExprCastObject(_ *ast.ExprCastObject) { + // do nothing +} + +func (v *Null) ExprCastString(_ *ast.ExprCastString) { + // do nothing +} + +func (v *Null) ExprCastUnset(_ *ast.ExprCastUnset) { + // do nothing +} + +func (v *Null) ScalarDnumber(_ *ast.ScalarDnumber) { + // do nothing +} + +func (v *Null) ScalarEncapsed(_ *ast.ScalarEncapsed) { + // do nothing +} + +func (v *Null) ScalarEncapsedStringPart(_ *ast.ScalarEncapsedStringPart) { + // do nothing +} + +func (v *Null) ScalarHeredoc(_ *ast.ScalarHeredoc) { + // do nothing +} + +func (v *Null) ScalarLnumber(_ *ast.ScalarLnumber) { + // do nothing +} + +func (v *Null) ScalarMagicConstant(_ *ast.ScalarMagicConstant) { + // do nothing +} + +func (v *Null) ScalarString(_ *ast.ScalarString) { + // do nothing +}