New AST structure

This commit is contained in:
Vadym Slizov 2020-03-13 00:20:48 +02:00
parent d7e0c8f6da
commit 10e2a3f3f7
7 changed files with 4425 additions and 0 deletions

200
pkg/ast/ast.go Normal file
View File

@ -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)
}

191
pkg/ast/ast_test.go Normal file
View File

@ -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")
}

1814
pkg/ast/node.go Normal file

File diff suppressed because it is too large Load Diff

491
pkg/ast/traverser/dfs.go Normal file
View File

@ -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)
}

1003
pkg/ast/visitor/dump.go Normal file

File diff suppressed because it is too large Load Diff

View File

@ -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",
// },
// },
//}
}

683
pkg/ast/visitor/null.go Normal file
View File

@ -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
}