walker pakage

This commit is contained in:
z7zmey 2018-01-17 18:58:45 +02:00
parent 6d90e1258f
commit 76df2ba69b
164 changed files with 368 additions and 210 deletions

View File

@ -33,8 +33,8 @@ func main() {
src := bytes.NewBufferString(`<? echo "Hello world";`)
nodes, comments, positions := parser.Parse(src, "example.php")
dumper := visitor.Dumper{"", comments, positions}
nodes.Walk(dumper)
visitor := Dumper{"", comments, positions}
nodes.Walk(visitor)
}
```

View File

@ -1,15 +1,25 @@
package visitor
package main
import (
"fmt"
"reflect"
"github.com/z7zmey/php-parser/node"
"github.com/z7zmey/php-parser/position"
"github.com/z7zmey/php-parser/comment"
"github.com/z7zmey/php-parser/node"
"github.com/z7zmey/php-parser/walker"
)
func isWalkerImplementsNodeInterface(w walker.Walker) bool {
switch w.(type) {
case node.Node:
return true
default:
return false
}
}
// Dumper prints ast hierarchy to stdout
// Also prints comments and positions attached to nodes
type Dumper struct {
@ -19,7 +29,12 @@ type Dumper struct {
}
// EnterNode is invoked at every node in heirerchy
func (d Dumper) EnterNode(n node.Node) bool {
func (d Dumper) EnterNode(w walker.Walker) bool {
if !isWalkerImplementsNodeInterface(w) {
return false
}
n := w.(node.Node)
fmt.Printf("%v%v", d.Indent, reflect.TypeOf(n))
if p := d.Positions[n]; p != nil {
@ -41,12 +56,12 @@ func (d Dumper) EnterNode(n node.Node) bool {
}
// GetChildrenVisitor is invoked at every node parameter that contains children nodes
func (d Dumper) GetChildrenVisitor(key string) node.Visitor {
func (d Dumper) GetChildrenVisitor(key string) walker.Visitor {
fmt.Printf("%v%q:\n", d.Indent+" ", key)
return Dumper{d.Indent + " ", d.Comments, d.Positions}
}
// LeaveNode is invoked after node process
func (d Dumper) LeaveNode(n node.Node) {
func (d Dumper) LeaveNode(n walker.Walker) {
// do nothing
}

View File

@ -9,7 +9,6 @@ import (
"github.com/yookoala/realpath"
"github.com/z7zmey/php-parser/parser"
"github.com/z7zmey/php-parser/visitor"
)
func main() {
@ -26,7 +25,7 @@ func main() {
src, _ := os.Open(string(path))
nodes, comments, positions := parser.Parse(src, path)
visitor := visitor.Dumper{
visitor := Dumper{
Indent: " | ",
Comments: comments,
Positions: positions,

View File

@ -1,5 +1,7 @@
package node
import "github.com/z7zmey/php-parser/walker"
// Argument node
type Argument struct {
Variadic bool // if ... before variable
@ -23,7 +25,7 @@ func (n *Argument) Attributes() map[string]interface{} {
// Walk traverses nodes
// Walk is invoked recursively until v.EnterNode returns true
func (n *Argument) Walk(v Visitor) {
func (n *Argument) Walk(v walker.Visitor) {
if v.EnterNode(n) == false {
return
}

View File

@ -2,6 +2,7 @@ package expr
import (
"github.com/z7zmey/php-parser/node"
"github.com/z7zmey/php-parser/walker"
)
// Array node
@ -23,7 +24,7 @@ func (n *Array) Attributes() map[string]interface{} {
// Walk traverses nodes
// Walk is invoked recursively until v.EnterNode returns true
func (n *Array) Walk(v node.Visitor) {
func (n *Array) Walk(v walker.Visitor) {
if v.EnterNode(n) == false {
return
}

View File

@ -2,6 +2,7 @@ package expr
import (
"github.com/z7zmey/php-parser/node"
"github.com/z7zmey/php-parser/walker"
)
// ArrayDimFetch node
@ -25,7 +26,7 @@ func (n *ArrayDimFetch) Attributes() map[string]interface{} {
// Walk traverses nodes
// Walk is invoked recursively until v.EnterNode returns true
func (n *ArrayDimFetch) Walk(v node.Visitor) {
func (n *ArrayDimFetch) Walk(v walker.Visitor) {
if v.EnterNode(n) == false {
return
}

View File

@ -2,6 +2,7 @@ package expr
import (
"github.com/z7zmey/php-parser/node"
"github.com/z7zmey/php-parser/walker"
)
// ArrayItem node
@ -29,7 +30,7 @@ func (n *ArrayItem) Attributes() map[string]interface{} {
// Walk traverses nodes
// Walk is invoked recursively until v.EnterNode returns true
func (n *ArrayItem) Walk(v node.Visitor) {
func (n *ArrayItem) Walk(v walker.Visitor) {
if v.EnterNode(n) == false {
return
}

View File

@ -2,6 +2,7 @@ package assign_op
import (
"github.com/z7zmey/php-parser/node"
"github.com/z7zmey/php-parser/walker"
)
// Assign node
@ -26,7 +27,7 @@ func (n *Assign) Attributes() map[string]interface{} {
// Walk traverses nodes
// Walk is invoked recursively until v.EnterNode returns true
func (n *Assign) Walk(v node.Visitor) {
func (n *Assign) Walk(v walker.Visitor) {
if v.EnterNode(n) == false {
return
}

View File

@ -2,6 +2,7 @@ package assign_op
import (
"github.com/z7zmey/php-parser/node"
"github.com/z7zmey/php-parser/walker"
)
// AssignRef node
@ -26,7 +27,7 @@ func (n *AssignRef) Attributes() map[string]interface{} {
// Walk traverses nodes
// Walk is invoked recursively until v.EnterNode returns true
func (n *AssignRef) Walk(v node.Visitor) {
func (n *AssignRef) Walk(v walker.Visitor) {
if v.EnterNode(n) == false {
return
}

View File

@ -2,6 +2,7 @@ package assign_op
import (
"github.com/z7zmey/php-parser/node"
"github.com/z7zmey/php-parser/walker"
)
// BitwiseAnd node
@ -26,7 +27,7 @@ func (n *BitwiseAnd) Attributes() map[string]interface{} {
// Walk traverses nodes
// Walk is invoked recursively until v.EnterNode returns true
func (n *BitwiseAnd) Walk(v node.Visitor) {
func (n *BitwiseAnd) Walk(v walker.Visitor) {
if v.EnterNode(n) == false {
return
}

View File

@ -2,6 +2,7 @@ package assign_op
import (
"github.com/z7zmey/php-parser/node"
"github.com/z7zmey/php-parser/walker"
)
// BitwiseOr node
@ -26,7 +27,7 @@ func (n *BitwiseOr) Attributes() map[string]interface{} {
// Walk traverses nodes
// Walk is invoked recursively until v.EnterNode returns true
func (n *BitwiseOr) Walk(v node.Visitor) {
func (n *BitwiseOr) Walk(v walker.Visitor) {
if v.EnterNode(n) == false {
return
}

View File

@ -2,6 +2,7 @@ package assign_op
import (
"github.com/z7zmey/php-parser/node"
"github.com/z7zmey/php-parser/walker"
)
// BitwiseXor node
@ -26,7 +27,7 @@ func (n *BitwiseXor) Attributes() map[string]interface{} {
// Walk traverses nodes
// Walk is invoked recursively until v.EnterNode returns true
func (n *BitwiseXor) Walk(v node.Visitor) {
func (n *BitwiseXor) Walk(v walker.Visitor) {
if v.EnterNode(n) == false {
return
}

View File

@ -2,6 +2,7 @@ package assign_op
import (
"github.com/z7zmey/php-parser/node"
"github.com/z7zmey/php-parser/walker"
)
// Concat node
@ -26,7 +27,7 @@ func (n *Concat) Attributes() map[string]interface{} {
// Walk traverses nodes
// Walk is invoked recursively until v.EnterNode returns true
func (n *Concat) Walk(v node.Visitor) {
func (n *Concat) Walk(v walker.Visitor) {
if v.EnterNode(n) == false {
return
}

View File

@ -2,6 +2,7 @@ package assign_op
import (
"github.com/z7zmey/php-parser/node"
"github.com/z7zmey/php-parser/walker"
)
// Div node
@ -26,7 +27,7 @@ func (n *Div) Attributes() map[string]interface{} {
// Walk traverses nodes
// Walk is invoked recursively until v.EnterNode returns true
func (n *Div) Walk(v node.Visitor) {
func (n *Div) Walk(v walker.Visitor) {
if v.EnterNode(n) == false {
return
}

View File

@ -2,6 +2,7 @@ package assign_op
import (
"github.com/z7zmey/php-parser/node"
"github.com/z7zmey/php-parser/walker"
)
// Minus node
@ -26,7 +27,7 @@ func (n *Minus) Attributes() map[string]interface{} {
// Walk traverses nodes
// Walk is invoked recursively until v.EnterNode returns true
func (n *Minus) Walk(v node.Visitor) {
func (n *Minus) Walk(v walker.Visitor) {
if v.EnterNode(n) == false {
return
}

View File

@ -2,6 +2,7 @@ package assign_op
import (
"github.com/z7zmey/php-parser/node"
"github.com/z7zmey/php-parser/walker"
)
// Mod node
@ -26,7 +27,7 @@ func (n *Mod) Attributes() map[string]interface{} {
// Walk traverses nodes
// Walk is invoked recursively until v.EnterNode returns true
func (n *Mod) Walk(v node.Visitor) {
func (n *Mod) Walk(v walker.Visitor) {
if v.EnterNode(n) == false {
return
}

View File

@ -2,6 +2,7 @@ package assign_op
import (
"github.com/z7zmey/php-parser/node"
"github.com/z7zmey/php-parser/walker"
)
// Mul node
@ -26,7 +27,7 @@ func (n *Mul) Attributes() map[string]interface{} {
// Walk traverses nodes
// Walk is invoked recursively until v.EnterNode returns true
func (n *Mul) Walk(v node.Visitor) {
func (n *Mul) Walk(v walker.Visitor) {
if v.EnterNode(n) == false {
return
}

View File

@ -2,6 +2,7 @@ package assign_op
import (
"github.com/z7zmey/php-parser/node"
"github.com/z7zmey/php-parser/walker"
)
// Plus node
@ -26,7 +27,7 @@ func (n *Plus) Attributes() map[string]interface{} {
// Walk traverses nodes
// Walk is invoked recursively until v.EnterNode returns true
func (n *Plus) Walk(v node.Visitor) {
func (n *Plus) Walk(v walker.Visitor) {
if v.EnterNode(n) == false {
return
}

View File

@ -2,6 +2,7 @@ package assign_op
import (
"github.com/z7zmey/php-parser/node"
"github.com/z7zmey/php-parser/walker"
)
// Pow node
@ -26,7 +27,7 @@ func (n *Pow) Attributes() map[string]interface{} {
// Walk traverses nodes
// Walk is invoked recursively until v.EnterNode returns true
func (n *Pow) Walk(v node.Visitor) {
func (n *Pow) Walk(v walker.Visitor) {
if v.EnterNode(n) == false {
return
}

View File

@ -2,6 +2,7 @@ package assign_op
import (
"github.com/z7zmey/php-parser/node"
"github.com/z7zmey/php-parser/walker"
)
// ShiftLeft node
@ -26,7 +27,7 @@ func (n *ShiftLeft) Attributes() map[string]interface{} {
// Walk traverses nodes
// Walk is invoked recursively until v.EnterNode returns true
func (n *ShiftLeft) Walk(v node.Visitor) {
func (n *ShiftLeft) Walk(v walker.Visitor) {
if v.EnterNode(n) == false {
return
}

View File

@ -2,6 +2,7 @@ package assign_op
import (
"github.com/z7zmey/php-parser/node"
"github.com/z7zmey/php-parser/walker"
)
// ShiftRight node
@ -26,7 +27,7 @@ func (n *ShiftRight) Attributes() map[string]interface{} {
// Walk traverses nodes
// Walk is invoked recursively until v.EnterNode returns true
func (n *ShiftRight) Walk(v node.Visitor) {
func (n *ShiftRight) Walk(v walker.Visitor) {
if v.EnterNode(n) == false {
return
}

View File

@ -2,6 +2,7 @@ package binary_op
import (
"github.com/z7zmey/php-parser/node"
"github.com/z7zmey/php-parser/walker"
)
// BitwiseAnd node
@ -26,7 +27,7 @@ func (n *BitwiseAnd) Attributes() map[string]interface{} {
// Walk traverses nodes
// Walk is invoked recursively until v.EnterNode returns true
func (n *BitwiseAnd) Walk(v node.Visitor) {
func (n *BitwiseAnd) Walk(v walker.Visitor) {
if v.EnterNode(n) == false {
return
}

View File

@ -2,6 +2,7 @@ package binary_op
import (
"github.com/z7zmey/php-parser/node"
"github.com/z7zmey/php-parser/walker"
)
// BitwiseOr node
@ -26,7 +27,7 @@ func (n *BitwiseOr) Attributes() map[string]interface{} {
// Walk traverses nodes
// Walk is invoked recursively until v.EnterNode returns true
func (n *BitwiseOr) Walk(v node.Visitor) {
func (n *BitwiseOr) Walk(v walker.Visitor) {
if v.EnterNode(n) == false {
return
}

View File

@ -2,6 +2,7 @@ package binary_op
import (
"github.com/z7zmey/php-parser/node"
"github.com/z7zmey/php-parser/walker"
)
// BitwiseXor node
@ -26,7 +27,7 @@ func (n *BitwiseXor) Attributes() map[string]interface{} {
// Walk traverses nodes
// Walk is invoked recursively until v.EnterNode returns true
func (n *BitwiseXor) Walk(v node.Visitor) {
func (n *BitwiseXor) Walk(v walker.Visitor) {
if v.EnterNode(n) == false {
return
}

View File

@ -2,6 +2,7 @@ package binary_op
import (
"github.com/z7zmey/php-parser/node"
"github.com/z7zmey/php-parser/walker"
)
// BooleanAnd node
@ -26,7 +27,7 @@ func (n *BooleanAnd) Attributes() map[string]interface{} {
// Walk traverses nodes
// Walk is invoked recursively until v.EnterNode returns true
func (n *BooleanAnd) Walk(v node.Visitor) {
func (n *BooleanAnd) Walk(v walker.Visitor) {
if v.EnterNode(n) == false {
return
}

View File

@ -2,6 +2,7 @@ package binary_op
import (
"github.com/z7zmey/php-parser/node"
"github.com/z7zmey/php-parser/walker"
)
// BooleanOr node
@ -26,7 +27,7 @@ func (n *BooleanOr) Attributes() map[string]interface{} {
// Walk traverses nodes
// Walk is invoked recursively until v.EnterNode returns true
func (n *BooleanOr) Walk(v node.Visitor) {
func (n *BooleanOr) Walk(v walker.Visitor) {
if v.EnterNode(n) == false {
return
}

View File

@ -2,6 +2,7 @@ package binary_op
import (
"github.com/z7zmey/php-parser/node"
"github.com/z7zmey/php-parser/walker"
)
// Coalesce node
@ -26,7 +27,7 @@ func (n *Coalesce) Attributes() map[string]interface{} {
// Walk traverses nodes
// Walk is invoked recursively until v.EnterNode returns true
func (n *Coalesce) Walk(v node.Visitor) {
func (n *Coalesce) Walk(v walker.Visitor) {
if v.EnterNode(n) == false {
return
}

View File

@ -2,6 +2,7 @@ package binary_op
import (
"github.com/z7zmey/php-parser/node"
"github.com/z7zmey/php-parser/walker"
)
// Concat node
@ -26,7 +27,7 @@ func (n *Concat) Attributes() map[string]interface{} {
// Walk traverses nodes
// Walk is invoked recursively until v.EnterNode returns true
func (n *Concat) Walk(v node.Visitor) {
func (n *Concat) Walk(v walker.Visitor) {
if v.EnterNode(n) == false {
return
}

View File

@ -2,6 +2,7 @@ package binary_op
import (
"github.com/z7zmey/php-parser/node"
"github.com/z7zmey/php-parser/walker"
)
// Div node
@ -26,7 +27,7 @@ func (n *Div) Attributes() map[string]interface{} {
// Walk traverses nodes
// Walk is invoked recursively until v.EnterNode returns true
func (n *Div) Walk(v node.Visitor) {
func (n *Div) Walk(v walker.Visitor) {
if v.EnterNode(n) == false {
return
}

View File

@ -2,6 +2,7 @@ package binary_op
import (
"github.com/z7zmey/php-parser/node"
"github.com/z7zmey/php-parser/walker"
)
// Equal node
@ -26,7 +27,7 @@ func (n *Equal) Attributes() map[string]interface{} {
// Walk traverses nodes
// Walk is invoked recursively until v.EnterNode returns true
func (n *Equal) Walk(v node.Visitor) {
func (n *Equal) Walk(v walker.Visitor) {
if v.EnterNode(n) == false {
return
}

View File

@ -2,6 +2,7 @@ package binary_op
import (
"github.com/z7zmey/php-parser/node"
"github.com/z7zmey/php-parser/walker"
)
// Greater node
@ -26,7 +27,7 @@ func (n *Greater) Attributes() map[string]interface{} {
// Walk traverses nodes
// Walk is invoked recursively until v.EnterNode returns true
func (n *Greater) Walk(v node.Visitor) {
func (n *Greater) Walk(v walker.Visitor) {
if v.EnterNode(n) == false {
return
}

View File

@ -2,6 +2,7 @@ package binary_op
import (
"github.com/z7zmey/php-parser/node"
"github.com/z7zmey/php-parser/walker"
)
// GreaterOrEqual node
@ -26,7 +27,7 @@ func (n *GreaterOrEqual) Attributes() map[string]interface{} {
// Walk traverses nodes
// Walk is invoked recursively until v.EnterNode returns true
func (n *GreaterOrEqual) Walk(v node.Visitor) {
func (n *GreaterOrEqual) Walk(v walker.Visitor) {
if v.EnterNode(n) == false {
return
}

View File

@ -2,6 +2,7 @@ package binary_op
import (
"github.com/z7zmey/php-parser/node"
"github.com/z7zmey/php-parser/walker"
)
// Identical node
@ -26,7 +27,7 @@ func (n *Identical) Attributes() map[string]interface{} {
// Walk traverses nodes
// Walk is invoked recursively until v.EnterNode returns true
func (n *Identical) Walk(v node.Visitor) {
func (n *Identical) Walk(v walker.Visitor) {
if v.EnterNode(n) == false {
return
}

View File

@ -2,6 +2,7 @@ package binary_op
import (
"github.com/z7zmey/php-parser/node"
"github.com/z7zmey/php-parser/walker"
)
// LogicalAnd node
@ -26,7 +27,7 @@ func (n *LogicalAnd) Attributes() map[string]interface{} {
// Walk traverses nodes
// Walk is invoked recursively until v.EnterNode returns true
func (n *LogicalAnd) Walk(v node.Visitor) {
func (n *LogicalAnd) Walk(v walker.Visitor) {
if v.EnterNode(n) == false {
return
}

View File

@ -2,6 +2,7 @@ package binary_op
import (
"github.com/z7zmey/php-parser/node"
"github.com/z7zmey/php-parser/walker"
)
// LogicalOr node
@ -26,7 +27,7 @@ func (n *LogicalOr) Attributes() map[string]interface{} {
// Walk traverses nodes
// Walk is invoked recursively until v.EnterNode returns true
func (n *LogicalOr) Walk(v node.Visitor) {
func (n *LogicalOr) Walk(v walker.Visitor) {
if v.EnterNode(n) == false {
return
}

View File

@ -2,6 +2,7 @@ package binary_op
import (
"github.com/z7zmey/php-parser/node"
"github.com/z7zmey/php-parser/walker"
)
// LogicalXor node
@ -26,7 +27,7 @@ func (n *LogicalXor) Attributes() map[string]interface{} {
// Walk traverses nodes
// Walk is invoked recursively until v.EnterNode returns true
func (n *LogicalXor) Walk(v node.Visitor) {
func (n *LogicalXor) Walk(v walker.Visitor) {
if v.EnterNode(n) == false {
return
}

View File

@ -2,6 +2,7 @@ package binary_op
import (
"github.com/z7zmey/php-parser/node"
"github.com/z7zmey/php-parser/walker"
)
// Minus node
@ -26,7 +27,7 @@ func (n *Minus) Attributes() map[string]interface{} {
// Walk traverses nodes
// Walk is invoked recursively until v.EnterNode returns true
func (n *Minus) Walk(v node.Visitor) {
func (n *Minus) Walk(v walker.Visitor) {
if v.EnterNode(n) == false {
return
}

View File

@ -2,6 +2,7 @@ package binary_op
import (
"github.com/z7zmey/php-parser/node"
"github.com/z7zmey/php-parser/walker"
)
// Mod node
@ -26,7 +27,7 @@ func (n *Mod) Attributes() map[string]interface{} {
// Walk traverses nodes
// Walk is invoked recursively until v.EnterNode returns true
func (n *Mod) Walk(v node.Visitor) {
func (n *Mod) Walk(v walker.Visitor) {
if v.EnterNode(n) == false {
return
}

View File

@ -2,6 +2,7 @@ package binary_op
import (
"github.com/z7zmey/php-parser/node"
"github.com/z7zmey/php-parser/walker"
)
// Mul node
@ -26,7 +27,7 @@ func (n *Mul) Attributes() map[string]interface{} {
// Walk traverses nodes
// Walk is invoked recursively until v.EnterNode returns true
func (n *Mul) Walk(v node.Visitor) {
func (n *Mul) Walk(v walker.Visitor) {
if v.EnterNode(n) == false {
return
}

View File

@ -2,6 +2,7 @@ package binary_op
import (
"github.com/z7zmey/php-parser/node"
"github.com/z7zmey/php-parser/walker"
)
// NotEqual node
@ -26,7 +27,7 @@ func (n *NotEqual) Attributes() map[string]interface{} {
// Walk traverses nodes
// Walk is invoked recursively until v.EnterNode returns true
func (n *NotEqual) Walk(v node.Visitor) {
func (n *NotEqual) Walk(v walker.Visitor) {
if v.EnterNode(n) == false {
return
}

View File

@ -2,6 +2,7 @@ package binary_op
import (
"github.com/z7zmey/php-parser/node"
"github.com/z7zmey/php-parser/walker"
)
// NotIdentical node
@ -26,7 +27,7 @@ func (n *NotIdentical) Attributes() map[string]interface{} {
// Walk traverses nodes
// Walk is invoked recursively until v.EnterNode returns true
func (n *NotIdentical) Walk(v node.Visitor) {
func (n *NotIdentical) Walk(v walker.Visitor) {
if v.EnterNode(n) == false {
return
}

View File

@ -2,6 +2,7 @@ package binary_op
import (
"github.com/z7zmey/php-parser/node"
"github.com/z7zmey/php-parser/walker"
)
// Plus node
@ -26,7 +27,7 @@ func (n *Plus) Attributes() map[string]interface{} {
// Walk traverses nodes
// Walk is invoked recursively until v.EnterNode returns true
func (n *Plus) Walk(v node.Visitor) {
func (n *Plus) Walk(v walker.Visitor) {
if v.EnterNode(n) == false {
return
}

View File

@ -2,6 +2,7 @@ package binary_op
import (
"github.com/z7zmey/php-parser/node"
"github.com/z7zmey/php-parser/walker"
)
// Pow node
@ -26,7 +27,7 @@ func (n *Pow) Attributes() map[string]interface{} {
// Walk traverses nodes
// Walk is invoked recursively until v.EnterNode returns true
func (n *Pow) Walk(v node.Visitor) {
func (n *Pow) Walk(v walker.Visitor) {
if v.EnterNode(n) == false {
return
}

View File

@ -2,6 +2,7 @@ package binary_op
import (
"github.com/z7zmey/php-parser/node"
"github.com/z7zmey/php-parser/walker"
)
// ShiftLeft node
@ -26,7 +27,7 @@ func (n *ShiftLeft) Attributes() map[string]interface{} {
// Walk traverses nodes
// Walk is invoked recursively until v.EnterNode returns true
func (n *ShiftLeft) Walk(v node.Visitor) {
func (n *ShiftLeft) Walk(v walker.Visitor) {
if v.EnterNode(n) == false {
return
}

View File

@ -2,6 +2,7 @@ package binary_op
import (
"github.com/z7zmey/php-parser/node"
"github.com/z7zmey/php-parser/walker"
)
// ShiftRight node
@ -26,7 +27,7 @@ func (n *ShiftRight) Attributes() map[string]interface{} {
// Walk traverses nodes
// Walk is invoked recursively until v.EnterNode returns true
func (n *ShiftRight) Walk(v node.Visitor) {
func (n *ShiftRight) Walk(v walker.Visitor) {
if v.EnterNode(n) == false {
return
}

View File

@ -2,6 +2,7 @@ package binary_op
import (
"github.com/z7zmey/php-parser/node"
"github.com/z7zmey/php-parser/walker"
)
// Smaller node
@ -26,7 +27,7 @@ func (n *Smaller) Attributes() map[string]interface{} {
// Walk traverses nodes
// Walk is invoked recursively until v.EnterNode returns true
func (n *Smaller) Walk(v node.Visitor) {
func (n *Smaller) Walk(v walker.Visitor) {
if v.EnterNode(n) == false {
return
}

View File

@ -2,6 +2,7 @@ package binary_op
import (
"github.com/z7zmey/php-parser/node"
"github.com/z7zmey/php-parser/walker"
)
// SmallerOrEqual node
@ -26,7 +27,7 @@ func (n *SmallerOrEqual) Attributes() map[string]interface{} {
// Walk traverses nodes
// Walk is invoked recursively until v.EnterNode returns true
func (n *SmallerOrEqual) Walk(v node.Visitor) {
func (n *SmallerOrEqual) Walk(v walker.Visitor) {
if v.EnterNode(n) == false {
return
}

View File

@ -2,6 +2,7 @@ package binary_op
import (
"github.com/z7zmey/php-parser/node"
"github.com/z7zmey/php-parser/walker"
)
// Spaceship node
@ -26,7 +27,7 @@ func (n *Spaceship) Attributes() map[string]interface{} {
// Walk traverses nodes
// Walk is invoked recursively until v.EnterNode returns true
func (n *Spaceship) Walk(v node.Visitor) {
func (n *Spaceship) Walk(v walker.Visitor) {
if v.EnterNode(n) == false {
return
}

View File

@ -2,6 +2,7 @@ package expr
import (
"github.com/z7zmey/php-parser/node"
"github.com/z7zmey/php-parser/walker"
)
// BitwiseNot node
@ -23,7 +24,7 @@ func (n *BitwiseNot) Attributes() map[string]interface{} {
// Walk traverses nodes
// Walk is invoked recursively until v.EnterNode returns true
func (n *BitwiseNot) Walk(v node.Visitor) {
func (n *BitwiseNot) Walk(v walker.Visitor) {
if v.EnterNode(n) == false {
return
}

View File

@ -2,6 +2,7 @@ package expr
import (
"github.com/z7zmey/php-parser/node"
"github.com/z7zmey/php-parser/walker"
)
// BooleanNot node
@ -23,7 +24,7 @@ func (n *BooleanNot) Attributes() map[string]interface{} {
// Walk traverses nodes
// Walk is invoked recursively until v.EnterNode returns true
func (n *BooleanNot) Walk(v node.Visitor) {
func (n *BooleanNot) Walk(v walker.Visitor) {
if v.EnterNode(n) == false {
return
}

View File

@ -2,6 +2,7 @@ package cast
import (
"github.com/z7zmey/php-parser/node"
"github.com/z7zmey/php-parser/walker"
)
// CastArray node
@ -25,7 +26,7 @@ func (n *CastArray) Attributes() map[string]interface{} {
// Walk traverses nodes
// Walk is invoked recursively until v.EnterNode returns true
func (n *CastArray) Walk(v node.Visitor) {
func (n *CastArray) Walk(v walker.Visitor) {
if v.EnterNode(n) == false {
return
}

View File

@ -2,6 +2,7 @@ package cast
import (
"github.com/z7zmey/php-parser/node"
"github.com/z7zmey/php-parser/walker"
)
// CastBool node
@ -25,7 +26,7 @@ func (n *CastBool) Attributes() map[string]interface{} {
// Walk traverses nodes
// Walk is invoked recursively until v.EnterNode returns true
func (n *CastBool) Walk(v node.Visitor) {
func (n *CastBool) Walk(v walker.Visitor) {
if v.EnterNode(n) == false {
return
}

View File

@ -2,6 +2,7 @@ package cast
import (
"github.com/z7zmey/php-parser/node"
"github.com/z7zmey/php-parser/walker"
)
// CastDouble node
@ -25,7 +26,7 @@ func (n *CastDouble) Attributes() map[string]interface{} {
// Walk traverses nodes
// Walk is invoked recursively until v.EnterNode returns true
func (n *CastDouble) Walk(v node.Visitor) {
func (n *CastDouble) Walk(v walker.Visitor) {
if v.EnterNode(n) == false {
return
}

View File

@ -2,6 +2,7 @@ package cast
import (
"github.com/z7zmey/php-parser/node"
"github.com/z7zmey/php-parser/walker"
)
// CastInt node
@ -25,7 +26,7 @@ func (n *CastInt) Attributes() map[string]interface{} {
// Walk traverses nodes
// Walk is invoked recursively until v.EnterNode returns true
func (n *CastInt) Walk(v node.Visitor) {
func (n *CastInt) Walk(v walker.Visitor) {
if v.EnterNode(n) == false {
return
}

View File

@ -2,6 +2,7 @@ package cast
import (
"github.com/z7zmey/php-parser/node"
"github.com/z7zmey/php-parser/walker"
)
// CastObject node
@ -25,7 +26,7 @@ func (n *CastObject) Attributes() map[string]interface{} {
// Walk traverses nodes
// Walk is invoked recursively until v.EnterNode returns true
func (n *CastObject) Walk(v node.Visitor) {
func (n *CastObject) Walk(v walker.Visitor) {
if v.EnterNode(n) == false {
return
}

View File

@ -2,6 +2,7 @@ package cast
import (
"github.com/z7zmey/php-parser/node"
"github.com/z7zmey/php-parser/walker"
)
// CastString node
@ -25,7 +26,7 @@ func (n *CastString) Attributes() map[string]interface{} {
// Walk traverses nodes
// Walk is invoked recursively until v.EnterNode returns true
func (n *CastString) Walk(v node.Visitor) {
func (n *CastString) Walk(v walker.Visitor) {
if v.EnterNode(n) == false {
return
}

View File

@ -2,6 +2,7 @@ package cast
import (
"github.com/z7zmey/php-parser/node"
"github.com/z7zmey/php-parser/walker"
)
// CastUnset node
@ -25,7 +26,7 @@ func (n *CastUnset) Attributes() map[string]interface{} {
// Walk traverses nodes
// Walk is invoked recursively until v.EnterNode returns true
func (n *CastUnset) Walk(v node.Visitor) {
func (n *CastUnset) Walk(v walker.Visitor) {
if v.EnterNode(n) == false {
return
}

View File

@ -2,6 +2,7 @@ package expr
import (
"github.com/z7zmey/php-parser/node"
"github.com/z7zmey/php-parser/walker"
)
// ClassConstFetch node
@ -25,7 +26,7 @@ func (n *ClassConstFetch) Attributes() map[string]interface{} {
// Walk traverses nodes
// Walk is invoked recursively until v.EnterNode returns true
func (n *ClassConstFetch) Walk(v node.Visitor) {
func (n *ClassConstFetch) Walk(v walker.Visitor) {
if v.EnterNode(n) == false {
return
}

View File

@ -2,6 +2,7 @@ package expr
import (
"github.com/z7zmey/php-parser/node"
"github.com/z7zmey/php-parser/walker"
)
// Clone node
@ -23,7 +24,7 @@ func (n *Clone) Attributes() map[string]interface{} {
// Walk traverses nodes
// Walk is invoked recursively until v.EnterNode returns true
func (n *Clone) Walk(v node.Visitor) {
func (n *Clone) Walk(v walker.Visitor) {
if v.EnterNode(n) == false {
return
}

View File

@ -2,6 +2,7 @@ package expr
import (
"github.com/z7zmey/php-parser/node"
"github.com/z7zmey/php-parser/walker"
)
// Closure node
@ -39,7 +40,7 @@ func (n *Closure) Attributes() map[string]interface{} {
// Walk traverses nodes
// Walk is invoked recursively until v.EnterNode returns true
func (n *Closure) Walk(v node.Visitor) {
func (n *Closure) Walk(v walker.Visitor) {
if v.EnterNode(n) == false {
return
}

View File

@ -2,6 +2,7 @@ package expr
import (
"github.com/z7zmey/php-parser/node"
"github.com/z7zmey/php-parser/walker"
)
// ClusureUse node
@ -27,7 +28,7 @@ func (n *ClusureUse) Attributes() map[string]interface{} {
// Walk traverses nodes
// Walk is invoked recursively until v.EnterNode returns true
func (n *ClusureUse) Walk(v node.Visitor) {
func (n *ClusureUse) Walk(v walker.Visitor) {
if v.EnterNode(n) == false {
return
}

View File

@ -2,6 +2,7 @@ package expr
import (
"github.com/z7zmey/php-parser/node"
"github.com/z7zmey/php-parser/walker"
)
// ConstFetch node
@ -23,7 +24,7 @@ func (n *ConstFetch) Attributes() map[string]interface{} {
// Walk traverses nodes
// Walk is invoked recursively until v.EnterNode returns true
func (n *ConstFetch) Walk(v node.Visitor) {
func (n *ConstFetch) Walk(v walker.Visitor) {
if v.EnterNode(n) == false {
return
}

View File

@ -2,6 +2,7 @@ package expr
import (
"github.com/z7zmey/php-parser/node"
"github.com/z7zmey/php-parser/walker"
)
// Empty node
@ -23,7 +24,7 @@ func (n *Empty) Attributes() map[string]interface{} {
// Walk traverses nodes
// Walk is invoked recursively until v.EnterNode returns true
func (n *Empty) Walk(v node.Visitor) {
func (n *Empty) Walk(v walker.Visitor) {
if v.EnterNode(n) == false {
return
}

View File

@ -2,6 +2,7 @@ package expr
import (
"github.com/z7zmey/php-parser/node"
"github.com/z7zmey/php-parser/walker"
)
// ErrorSuppress node
@ -23,7 +24,7 @@ func (n *ErrorSuppress) Attributes() map[string]interface{} {
// Walk traverses nodes
// Walk is invoked recursively until v.EnterNode returns true
func (n *ErrorSuppress) Walk(v node.Visitor) {
func (n *ErrorSuppress) Walk(v walker.Visitor) {
if v.EnterNode(n) == false {
return
}

View File

@ -2,6 +2,7 @@ package expr
import (
"github.com/z7zmey/php-parser/node"
"github.com/z7zmey/php-parser/walker"
)
// Eval node
@ -23,7 +24,7 @@ func (n *Eval) Attributes() map[string]interface{} {
// Walk traverses nodes
// Walk is invoked recursively until v.EnterNode returns true
func (n *Eval) Walk(v node.Visitor) {
func (n *Eval) Walk(v walker.Visitor) {
if v.EnterNode(n) == false {
return
}

View File

@ -2,6 +2,7 @@ package expr
import (
"github.com/z7zmey/php-parser/node"
"github.com/z7zmey/php-parser/walker"
)
// Exit node
@ -27,7 +28,7 @@ func (n *Exit) Attributes() map[string]interface{} {
// Walk traverses nodes
// Walk is invoked recursively until v.EnterNode returns true
func (n *Exit) Walk(v node.Visitor) {
func (n *Exit) Walk(v walker.Visitor) {
if v.EnterNode(n) == false {
return
}

View File

@ -2,6 +2,7 @@ package expr
import (
"github.com/z7zmey/php-parser/node"
"github.com/z7zmey/php-parser/walker"
)
// FunctionCall node
@ -25,7 +26,7 @@ func (n *FunctionCall) Attributes() map[string]interface{} {
// Walk traverses nodes
// Walk is invoked recursively until v.EnterNode returns true
func (n *FunctionCall) Walk(v node.Visitor) {
func (n *FunctionCall) Walk(v walker.Visitor) {
if v.EnterNode(n) == false {
return
}

View File

@ -2,6 +2,7 @@ package expr
import (
"github.com/z7zmey/php-parser/node"
"github.com/z7zmey/php-parser/walker"
)
// Include node
@ -23,7 +24,7 @@ func (n *Include) Attributes() map[string]interface{} {
// Walk traverses nodes
// Walk is invoked recursively until v.EnterNode returns true
func (n *Include) Walk(v node.Visitor) {
func (n *Include) Walk(v walker.Visitor) {
if v.EnterNode(n) == false {
return
}

View File

@ -2,6 +2,7 @@ package expr
import (
"github.com/z7zmey/php-parser/node"
"github.com/z7zmey/php-parser/walker"
)
// IncludeOnce node
@ -23,7 +24,7 @@ func (n *IncludeOnce) Attributes() map[string]interface{} {
// Walk traverses nodes
// Walk is invoked recursively until v.EnterNode returns true
func (n *IncludeOnce) Walk(v node.Visitor) {
func (n *IncludeOnce) Walk(v walker.Visitor) {
if v.EnterNode(n) == false {
return
}

View File

@ -2,6 +2,7 @@ package expr
import (
"github.com/z7zmey/php-parser/node"
"github.com/z7zmey/php-parser/walker"
)
// InstanceOf node
@ -25,7 +26,7 @@ func (n *InstanceOf) Attributes() map[string]interface{} {
// Walk traverses nodes
// Walk is invoked recursively until v.EnterNode returns true
func (n *InstanceOf) Walk(v node.Visitor) {
func (n *InstanceOf) Walk(v walker.Visitor) {
if v.EnterNode(n) == false {
return
}

View File

@ -2,6 +2,7 @@ package expr
import (
"github.com/z7zmey/php-parser/node"
"github.com/z7zmey/php-parser/walker"
)
// Isset node
@ -23,7 +24,7 @@ func (n *Isset) Attributes() map[string]interface{} {
// Walk traverses nodes
// Walk is invoked recursively until v.EnterNode returns true
func (n *Isset) Walk(v node.Visitor) {
func (n *Isset) Walk(v walker.Visitor) {
if v.EnterNode(n) == false {
return
}

View File

@ -2,6 +2,7 @@ package expr
import (
"github.com/z7zmey/php-parser/node"
"github.com/z7zmey/php-parser/walker"
)
// List node
@ -23,7 +24,7 @@ func (n *List) Attributes() map[string]interface{} {
// Walk traverses nodes
// Walk is invoked recursively until v.EnterNode returns true
func (n *List) Walk(v node.Visitor) {
func (n *List) Walk(v walker.Visitor) {
if v.EnterNode(n) == false {
return
}

View File

@ -2,6 +2,7 @@ package expr
import (
"github.com/z7zmey/php-parser/node"
"github.com/z7zmey/php-parser/walker"
)
// MethodCall node
@ -27,7 +28,7 @@ func (n *MethodCall) Attributes() map[string]interface{} {
// Walk traverses nodes
// Walk is invoked recursively until v.EnterNode returns true
func (n *MethodCall) Walk(v node.Visitor) {
func (n *MethodCall) Walk(v walker.Visitor) {
if v.EnterNode(n) == false {
return
}

View File

@ -2,6 +2,7 @@ package expr
import (
"github.com/z7zmey/php-parser/node"
"github.com/z7zmey/php-parser/walker"
)
// New node
@ -25,7 +26,7 @@ func (n *New) Attributes() map[string]interface{} {
// Walk traverses nodes
// Walk is invoked recursively until v.EnterNode returns true
func (n *New) Walk(v node.Visitor) {
func (n *New) Walk(v walker.Visitor) {
if v.EnterNode(n) == false {
return
}

View File

@ -2,6 +2,7 @@ package expr
import (
"github.com/z7zmey/php-parser/node"
"github.com/z7zmey/php-parser/walker"
)
// PostDec node
@ -23,7 +24,7 @@ func (n *PostDec) Attributes() map[string]interface{} {
// Walk traverses nodes
// Walk is invoked recursively until v.EnterNode returns true
func (n *PostDec) Walk(v node.Visitor) {
func (n *PostDec) Walk(v walker.Visitor) {
if v.EnterNode(n) == false {
return
}

View File

@ -2,6 +2,7 @@ package expr
import (
"github.com/z7zmey/php-parser/node"
"github.com/z7zmey/php-parser/walker"
)
// PostInc node
@ -23,7 +24,7 @@ func (n *PostInc) Attributes() map[string]interface{} {
// Walk traverses nodes
// Walk is invoked recursively until v.EnterNode returns true
func (n *PostInc) Walk(v node.Visitor) {
func (n *PostInc) Walk(v walker.Visitor) {
if v.EnterNode(n) == false {
return
}

View File

@ -2,6 +2,7 @@ package expr
import (
"github.com/z7zmey/php-parser/node"
"github.com/z7zmey/php-parser/walker"
)
// PreDec node
@ -23,7 +24,7 @@ func (n *PreDec) Attributes() map[string]interface{} {
// Walk traverses nodes
// Walk is invoked recursively until v.EnterNode returns true
func (n *PreDec) Walk(v node.Visitor) {
func (n *PreDec) Walk(v walker.Visitor) {
if v.EnterNode(n) == false {
return
}

View File

@ -2,6 +2,7 @@ package expr
import (
"github.com/z7zmey/php-parser/node"
"github.com/z7zmey/php-parser/walker"
)
// PreInc node
@ -23,7 +24,7 @@ func (n *PreInc) Attributes() map[string]interface{} {
// Walk traverses nodes
// Walk is invoked recursively until v.EnterNode returns true
func (n *PreInc) Walk(v node.Visitor) {
func (n *PreInc) Walk(v walker.Visitor) {
if v.EnterNode(n) == false {
return
}

View File

@ -2,6 +2,7 @@ package expr
import (
"github.com/z7zmey/php-parser/node"
"github.com/z7zmey/php-parser/walker"
)
// Print node
@ -23,7 +24,7 @@ func (n *Print) Attributes() map[string]interface{} {
// Walk traverses nodes
// Walk is invoked recursively until v.EnterNode returns true
func (n *Print) Walk(v node.Visitor) {
func (n *Print) Walk(v walker.Visitor) {
if v.EnterNode(n) == false {
return
}

View File

@ -2,6 +2,7 @@ package expr
import (
"github.com/z7zmey/php-parser/node"
"github.com/z7zmey/php-parser/walker"
)
// PropertyFetch node
@ -25,7 +26,7 @@ func (n *PropertyFetch) Attributes() map[string]interface{} {
// Walk traverses nodes
// Walk is invoked recursively until v.EnterNode returns true
func (n *PropertyFetch) Walk(v node.Visitor) {
func (n *PropertyFetch) Walk(v walker.Visitor) {
if v.EnterNode(n) == false {
return
}

View File

@ -2,6 +2,7 @@ package expr
import (
"github.com/z7zmey/php-parser/node"
"github.com/z7zmey/php-parser/walker"
)
// Require node
@ -23,7 +24,7 @@ func (n *Require) Attributes() map[string]interface{} {
// Walk traverses nodes
// Walk is invoked recursively until v.EnterNode returns true
func (n *Require) Walk(v node.Visitor) {
func (n *Require) Walk(v walker.Visitor) {
if v.EnterNode(n) == false {
return
}

View File

@ -2,6 +2,7 @@ package expr
import (
"github.com/z7zmey/php-parser/node"
"github.com/z7zmey/php-parser/walker"
)
// RequireOnce node
@ -23,7 +24,7 @@ func (n *RequireOnce) Attributes() map[string]interface{} {
// Walk traverses nodes
// Walk is invoked recursively until v.EnterNode returns true
func (n *RequireOnce) Walk(v node.Visitor) {
func (n *RequireOnce) Walk(v walker.Visitor) {
if v.EnterNode(n) == false {
return
}

View File

@ -2,6 +2,7 @@ package expr
import (
"github.com/z7zmey/php-parser/node"
"github.com/z7zmey/php-parser/walker"
)
// ShellExec node
@ -23,7 +24,7 @@ func (n *ShellExec) Attributes() map[string]interface{} {
// Walk traverses nodes
// Walk is invoked recursively until v.EnterNode returns true
func (n *ShellExec) Walk(v node.Visitor) {
func (n *ShellExec) Walk(v walker.Visitor) {
if v.EnterNode(n) == false {
return
}

View File

@ -2,6 +2,7 @@ package expr
import (
"github.com/z7zmey/php-parser/node"
"github.com/z7zmey/php-parser/walker"
)
// ShortArray node
@ -23,7 +24,7 @@ func (n *ShortArray) Attributes() map[string]interface{} {
// Walk traverses nodes
// Walk is invoked recursively until v.EnterNode returns true
func (n *ShortArray) Walk(v node.Visitor) {
func (n *ShortArray) Walk(v walker.Visitor) {
if v.EnterNode(n) == false {
return
}

View File

@ -2,6 +2,7 @@ package expr
import (
"github.com/z7zmey/php-parser/node"
"github.com/z7zmey/php-parser/walker"
)
// ShortList node
@ -23,7 +24,7 @@ func (n *ShortList) Attributes() map[string]interface{} {
// Walk traverses nodes
// Walk is invoked recursively until v.EnterNode returns true
func (n *ShortList) Walk(v node.Visitor) {
func (n *ShortList) Walk(v walker.Visitor) {
if v.EnterNode(n) == false {
return
}

View File

@ -2,6 +2,7 @@ package expr
import (
"github.com/z7zmey/php-parser/node"
"github.com/z7zmey/php-parser/walker"
)
// StaticCall node
@ -27,7 +28,7 @@ func (n *StaticCall) Attributes() map[string]interface{} {
// Walk traverses nodes
// Walk is invoked recursively until v.EnterNode returns true
func (n *StaticCall) Walk(v node.Visitor) {
func (n *StaticCall) Walk(v walker.Visitor) {
if v.EnterNode(n) == false {
return
}

View File

@ -2,6 +2,7 @@ package expr
import (
"github.com/z7zmey/php-parser/node"
"github.com/z7zmey/php-parser/walker"
)
// StaticPropertyFetch node
@ -25,7 +26,7 @@ func (n *StaticPropertyFetch) Attributes() map[string]interface{} {
// Walk traverses nodes
// Walk is invoked recursively until v.EnterNode returns true
func (n *StaticPropertyFetch) Walk(v node.Visitor) {
func (n *StaticPropertyFetch) Walk(v walker.Visitor) {
if v.EnterNode(n) == false {
return
}

View File

@ -2,6 +2,7 @@ package expr
import (
"github.com/z7zmey/php-parser/node"
"github.com/z7zmey/php-parser/walker"
)
// Ternary node
@ -27,7 +28,7 @@ func (n *Ternary) Attributes() map[string]interface{} {
// Walk traverses nodes
// Walk is invoked recursively until v.EnterNode returns true
func (n *Ternary) Walk(v node.Visitor) {
func (n *Ternary) Walk(v walker.Visitor) {
if v.EnterNode(n) == false {
return
}

View File

@ -2,6 +2,7 @@ package expr
import (
"github.com/z7zmey/php-parser/node"
"github.com/z7zmey/php-parser/walker"
)
// UnaryMinus node
@ -23,7 +24,7 @@ func (n *UnaryMinus) Attributes() map[string]interface{} {
// Walk traverses nodes
// Walk is invoked recursively until v.EnterNode returns true
func (n *UnaryMinus) Walk(v node.Visitor) {
func (n *UnaryMinus) Walk(v walker.Visitor) {
if v.EnterNode(n) == false {
return
}

View File

@ -2,6 +2,7 @@ package expr
import (
"github.com/z7zmey/php-parser/node"
"github.com/z7zmey/php-parser/walker"
)
// UnaryPlus node
@ -23,7 +24,7 @@ func (n *UnaryPlus) Attributes() map[string]interface{} {
// Walk traverses nodes
// Walk is invoked recursively until v.EnterNode returns true
func (n *UnaryPlus) Walk(v node.Visitor) {
func (n *UnaryPlus) Walk(v walker.Visitor) {
if v.EnterNode(n) == false {
return
}

View File

@ -2,6 +2,7 @@ package expr
import (
"github.com/z7zmey/php-parser/node"
"github.com/z7zmey/php-parser/walker"
)
// Variable node
@ -23,7 +24,7 @@ func (n *Variable) Attributes() map[string]interface{} {
// Walk traverses nodes
// Walk is invoked recursively until v.EnterNode returns true
func (n *Variable) Walk(v node.Visitor) {
func (n *Variable) Walk(v walker.Visitor) {
if v.EnterNode(n) == false {
return
}

View File

@ -2,6 +2,7 @@ package expr
import (
"github.com/z7zmey/php-parser/node"
"github.com/z7zmey/php-parser/walker"
)
// Yield node
@ -25,7 +26,7 @@ func (n *Yield) Attributes() map[string]interface{} {
// Walk traverses nodes
// Walk is invoked recursively until v.EnterNode returns true
func (n *Yield) Walk(v node.Visitor) {
func (n *Yield) Walk(v walker.Visitor) {
if v.EnterNode(n) == false {
return
}

View File

@ -2,6 +2,7 @@ package expr
import (
"github.com/z7zmey/php-parser/node"
"github.com/z7zmey/php-parser/walker"
)
// YieldFrom node
@ -23,7 +24,7 @@ func (n *YieldFrom) Attributes() map[string]interface{} {
// Walk traverses nodes
// Walk is invoked recursively until v.EnterNode returns true
func (n *YieldFrom) Walk(v node.Visitor) {
func (n *YieldFrom) Walk(v walker.Visitor) {
if v.EnterNode(n) == false {
return
}

View File

@ -1,5 +1,7 @@
package node
import "github.com/z7zmey/php-parser/walker"
// Identifier node
type Identifier struct {
Value string
@ -21,7 +23,7 @@ func (n *Identifier) Attributes() map[string]interface{} {
// Walk traverses nodes
// Walk is invoked recursively until v.EnterNode returns true
func (n *Identifier) Walk(v Visitor) {
func (n *Identifier) Walk(v walker.Visitor) {
if v.EnterNode(n) == false {
return
}

View File

@ -2,6 +2,7 @@ package name
import (
"github.com/z7zmey/php-parser/node"
"github.com/z7zmey/php-parser/walker"
)
// FullyQualified node
@ -23,7 +24,7 @@ func (n *FullyQualified) Attributes() map[string]interface{} {
// Walk traverses nodes
// Walk is invoked recursively until v.EnterNode returns true
func (n *FullyQualified) Walk(v node.Visitor) {
func (n *FullyQualified) Walk(v walker.Visitor) {
if v.EnterNode(n) == false {
return
}

View File

@ -2,6 +2,7 @@ package name
import (
"github.com/z7zmey/php-parser/node"
"github.com/z7zmey/php-parser/walker"
)
// Name node
@ -23,7 +24,7 @@ func (n *Name) Attributes() map[string]interface{} {
// Walk traverses nodes
// Walk is invoked recursively until v.EnterNode returns true
func (n *Name) Walk(v node.Visitor) {
func (n *Name) Walk(v walker.Visitor) {
if v.EnterNode(n) == false {
return
}

View File

@ -1,8 +1,6 @@
package name
import (
"github.com/z7zmey/php-parser/node"
)
import "github.com/z7zmey/php-parser/walker"
// NamePart node
type NamePart struct {
@ -25,7 +23,7 @@ func (n *NamePart) Attributes() map[string]interface{} {
// Walk traverses nodes
// Walk is invoked recursively until v.EnterNode returns true
func (n *NamePart) Walk(v node.Visitor) {
func (n *NamePart) Walk(v walker.Visitor) {
if v.EnterNode(n) == false {
return
}

View File

@ -7,6 +7,7 @@ import (
"github.com/z7zmey/php-parser/node/expr"
"github.com/z7zmey/php-parser/node/name"
"github.com/z7zmey/php-parser/walker"
"github.com/kylelemons/godebug/pretty"
"github.com/z7zmey/php-parser/node"
@ -124,12 +125,12 @@ type visitorMock struct {
visitedKeys []string
}
func (v *visitorMock) EnterNode(n node.Node) bool { return v.visitChildren }
func (v *visitorMock) GetChildrenVisitor(key string) node.Visitor {
func (v *visitorMock) EnterNode(n walker.Walker) bool { return v.visitChildren }
func (v *visitorMock) GetChildrenVisitor(key string) walker.Visitor {
v.visitedKeys = append(v.visitedKeys, key)
return &visitorMock{v.visitChildren, nil}
}
func (v *visitorMock) LeaveNode(n node.Node) {}
func (v *visitorMock) LeaveNode(n walker.Walker) {}
func TestNameVisitorDisableChildren(t *testing.T) {
for _, tt := range nameNodesTests {

View File

@ -2,6 +2,7 @@ package name
import (
"github.com/z7zmey/php-parser/node"
"github.com/z7zmey/php-parser/walker"
)
// Relative node
@ -23,7 +24,7 @@ func (n *Relative) Attributes() map[string]interface{} {
// Walk traverses nodes
// Walk is invoked recursively until v.EnterNode returns true
func (n *Relative) Walk(v node.Visitor) {
func (n *Relative) Walk(v walker.Visitor) {
if v.EnterNode(n) == false {
return
}

View File

@ -1,14 +1,9 @@
package node
import "github.com/z7zmey/php-parser/walker"
// Node interface
type Node interface {
walker.Walker
Attributes() map[string]interface{} // Attributes returns node attributes as map
Walk(v Visitor) // Walk traverses nodes
}
// Visitor interface
type Visitor interface {
EnterNode(node Node) bool // EnterNode invoked for each node encountered by Walk.
GetChildrenVisitor(Key string) Visitor // GetChildrenVisitor returns visitor for children nodes
LeaveNode(node Node) // LeaveNode invoked after process node
}

Some files were not shown because too many files have changed in this diff Show More