node attributes

This commit is contained in:
vadim 2017-12-29 17:20:24 +02:00
parent 722fa00fa3
commit 70a4ef18ab
159 changed files with 2214 additions and 1682 deletions

View File

@ -11,18 +11,19 @@ type dumper struct {
}
func (d dumper) EnterNode(n node.Node) bool {
fmt.Printf("%v[%v]:\n", d.indent, n.Name())
fmt.Printf("%v%v", d.indent, n.Name())
if a := n.Attributes(); a != nil {
fmt.Printf(" %v", a)
}
fmt.Println()
return true
}
func (d dumper) GetChildrenVisitor(key string) node.Visitor {
fmt.Printf("%v%v:\n", d.indent+". ", key)
return dumper{d.indent + ". . "}
}
func (d dumper) Scalar(key string, value interface{}) {
fmt.Printf("%v%v: %v\n", d.indent+". ", key, value)
fmt.Printf("%v%q:\n", d.indent+" ", key)
return dumper{d.indent + " "}
}
func (d dumper) LeaveNode(n node.Node) {

View File

@ -1,21 +1,29 @@
package node
type Argument struct {
name string
expr Node
variadic bool
name string
arguments map[string]interface{}
expr Node
variadic bool
}
func NewArgument(expression Node, variadic bool) Node {
return Argument{
"Argument",
map[string]interface{}{
"variadic": variadic,
},
expression,
variadic,
}
}
func (n Argument) Name() string {
return "Argument"
}
func NewArgument(expression Node, variadic bool) Node {
return Argument{
"Argument",
expression,
variadic,
}
func (n Argument) Attributes() map[string]interface{} {
return n.arguments
}
func (n Argument) Walk(v Visitor) {

View File

@ -2,27 +2,26 @@ package expr
import (
"github.com/z7zmey/php-parser/node"
"github.com/z7zmey/php-parser/token"
)
type Array struct {
name string
items []node.Node
}
func NewArray(items []node.Node) node.Node {
return Array{
"Array",
items,
}
}
func (n Array) Name() string {
return "Array"
}
type Array struct {
name string
opentToken token.Token
closeToken token.Token
items []node.Node
}
func NewArray(opentToken token.Token, closeToken token.Token, items []node.Node) node.Node {
return Array{
"Array",
opentToken,
closeToken,
items,
}
func (n Array) Attributes() map[string]interface{} {
return nil
}
func (n Array) Walk(v node.Visitor) {

View File

@ -4,10 +4,6 @@ import (
"github.com/z7zmey/php-parser/node"
)
func (n ArrayDimFetch) Name() string {
return "ArrayDimFetch"
}
type ArrayDimFetch struct {
name string
variable node.Node
@ -22,6 +18,14 @@ func NewArrayDimFetch(variable node.Node, dim node.Node) node.Node {
}
}
func (n ArrayDimFetch) Name() string {
return "ArrayDimFetch"
}
func (n ArrayDimFetch) Attributes() map[string]interface{} {
return nil
}
func (n ArrayDimFetch) Walk(v node.Visitor) {
if v.EnterNode(n) == false {
return

View File

@ -4,26 +4,32 @@ import (
"github.com/z7zmey/php-parser/node"
)
func (n ArrayItem) Name() string {
return "ArrayItem"
}
type ArrayItem struct {
name string
key node.Node
val node.Node
byRef bool
name string
attributes map[string]interface{}
key node.Node
val node.Node
}
func NewArrayItem(key node.Node, val node.Node, byRef bool) node.Node {
return ArrayItem{
"ArrayItem",
map[string]interface{}{
"byRef": byRef,
},
key,
val,
byRef,
}
}
func (n ArrayItem) Name() string {
return "ArrayItem"
}
func (n ArrayItem) Attributes() map[string]interface{} {
return nil
}
func (n ArrayItem) Walk(v node.Visitor) {
if v.EnterNode(n) == false {
return

View File

@ -4,10 +4,6 @@ import (
"github.com/z7zmey/php-parser/node"
)
func (n Assign) Name() string {
return "Assign"
}
type Assign struct {
AssignOp
}
@ -22,6 +18,14 @@ func NewAssign(variable node.Node, expression node.Node) node.Node {
}
}
func (n Assign) Name() string {
return "Assign"
}
func (n Assign) Attributes() map[string]interface{} {
return nil
}
func (n Assign) Walk(v node.Visitor) {
if v.EnterNode(n) == false {
return

View File

@ -4,10 +4,6 @@ import (
"github.com/z7zmey/php-parser/node"
)
func (n AssignRef) Name() string {
return "AssignRef"
}
type AssignRef struct {
AssignOp
}
@ -22,6 +18,14 @@ func NewAssignRef(variable node.Node, expression node.Node) node.Node {
}
}
func (n AssignRef) Name() string {
return "AssignRef"
}
func (n AssignRef) Attributes() map[string]interface{} {
return nil
}
func (n AssignRef) Walk(v node.Visitor) {
if v.EnterNode(n) == false {
return

View File

@ -4,10 +4,6 @@ import (
"github.com/z7zmey/php-parser/node"
)
func (n BitwiseAnd) Name() string {
return "BitwiseAnd"
}
type BitwiseAnd struct {
AssignOp
}
@ -22,6 +18,14 @@ func NewBitwiseAnd(variable node.Node, expression node.Node) node.Node {
}
}
func (n BitwiseAnd) Name() string {
return "BitwiseAnd"
}
func (n BitwiseAnd) Attributes() map[string]interface{} {
return nil
}
func (n BitwiseAnd) Walk(v node.Visitor) {
if v.EnterNode(n) == false {
return

View File

@ -4,10 +4,6 @@ import (
"github.com/z7zmey/php-parser/node"
)
func (n BitwiseOr) Name() string {
return "BitwiseOr"
}
type BitwiseOr struct {
AssignOp
}
@ -22,6 +18,14 @@ func NewBitwiseOr(variable node.Node, expression node.Node) node.Node {
}
}
func (n BitwiseOr) Name() string {
return "BitwiseOr"
}
func (n BitwiseOr) Attributes() map[string]interface{} {
return nil
}
func (n BitwiseOr) Walk(v node.Visitor) {
if v.EnterNode(n) == false {
return

View File

@ -18,6 +18,10 @@ func NewBitwiseXor(variable node.Node, expression node.Node) node.Node {
}
}
func (n BitwiseXor) Attributes() map[string]interface{} {
return nil
}
func (n BitwiseXor) Name() string {
return "BitwiseXor"
}

View File

@ -4,10 +4,6 @@ import (
"github.com/z7zmey/php-parser/node"
)
func (n Concat) Name() string {
return "Concat"
}
type Concat struct {
AssignOp
}
@ -22,6 +18,14 @@ func NewConcat(variable node.Node, expression node.Node) node.Node {
}
}
func (n Concat) Name() string {
return "Concat"
}
func (n Concat) Attributes() map[string]interface{} {
return nil
}
func (n Concat) Walk(v node.Visitor) {
if v.EnterNode(n) == false {
return

View File

@ -4,10 +4,6 @@ import (
"github.com/z7zmey/php-parser/node"
)
func (n Div) Name() string {
return "Div"
}
type Div struct {
AssignOp
}
@ -22,6 +18,14 @@ func NewDiv(variable node.Node, expression node.Node) node.Node {
}
}
func (n Div) Name() string {
return "Div"
}
func (n Div) Attributes() map[string]interface{} {
return nil
}
func (n Div) Walk(v node.Visitor) {
if v.EnterNode(n) == false {
return

View File

@ -4,10 +4,6 @@ import (
"github.com/z7zmey/php-parser/node"
)
func (n Minus) Name() string {
return "Minus"
}
type Minus struct {
AssignOp
}
@ -22,6 +18,14 @@ func NewMinus(variable node.Node, expression node.Node) node.Node {
}
}
func (n Minus) Name() string {
return "Minus"
}
func (n Minus) Attributes() map[string]interface{} {
return nil
}
func (n Minus) Walk(v node.Visitor) {
if v.EnterNode(n) == false {
return

View File

@ -4,10 +4,6 @@ import (
"github.com/z7zmey/php-parser/node"
)
func (n Mod) Name() string {
return "Mod"
}
type Mod struct {
AssignOp
}
@ -22,6 +18,14 @@ func NewMod(variable node.Node, expression node.Node) node.Node {
}
}
func (n Mod) Name() string {
return "Mod"
}
func (n Mod) Attributes() map[string]interface{} {
return nil
}
func (n Mod) Walk(v node.Visitor) {
if v.EnterNode(n) == false {
return

View File

@ -4,10 +4,6 @@ import (
"github.com/z7zmey/php-parser/node"
)
func (n Mul) Name() string {
return "Mul"
}
type Mul struct {
AssignOp
}
@ -22,6 +18,14 @@ func NewMul(variable node.Node, expression node.Node) node.Node {
}
}
func (n Mul) Name() string {
return "Mul"
}
func (n Mul) Attributes() map[string]interface{} {
return nil
}
func (n Mul) Walk(v node.Visitor) {
if v.EnterNode(n) == false {
return

View File

@ -4,10 +4,6 @@ import (
"github.com/z7zmey/php-parser/node"
)
func (n Plus) Name() string {
return "Plus"
}
type Plus struct {
AssignOp
}
@ -22,6 +18,14 @@ func NewPlus(variable node.Node, expression node.Node) node.Node {
}
}
func (n Plus) Name() string {
return "Plus"
}
func (n Plus) Attributes() map[string]interface{} {
return nil
}
func (n Plus) Walk(v node.Visitor) {
if v.EnterNode(n) == false {
return

View File

@ -4,10 +4,6 @@ import (
"github.com/z7zmey/php-parser/node"
)
func (n Pow) Name() string {
return "Pow"
}
type Pow struct {
AssignOp
}
@ -22,6 +18,14 @@ func NewPow(variable node.Node, expression node.Node) node.Node {
}
}
func (n Pow) Name() string {
return "Pow"
}
func (n Pow) Attributes() map[string]interface{} {
return nil
}
func (n Pow) Walk(v node.Visitor) {
if v.EnterNode(n) == false {
return

View File

@ -4,10 +4,6 @@ import (
"github.com/z7zmey/php-parser/node"
)
func (n ShiftLeft) Name() string {
return "ShiftLeft"
}
type ShiftLeft struct {
AssignOp
}
@ -22,6 +18,14 @@ func NewShiftLeft(variable node.Node, expression node.Node) node.Node {
}
}
func (n ShiftLeft) Name() string {
return "ShiftLeft"
}
func (n ShiftLeft) Attributes() map[string]interface{} {
return nil
}
func (n ShiftLeft) Walk(v node.Visitor) {
if v.EnterNode(n) == false {
return

View File

@ -4,10 +4,6 @@ import (
"github.com/z7zmey/php-parser/node"
)
func (n ShiftRight) Name() string {
return "ShiftRight"
}
type ShiftRight struct {
AssignOp
}
@ -22,6 +18,14 @@ func NewShiftRight(variable node.Node, expression node.Node) node.Node {
}
}
func (n ShiftRight) Name() string {
return "ShiftRight"
}
func (n ShiftRight) Attributes() map[string]interface{} {
return nil
}
func (n ShiftRight) Walk(v node.Visitor) {
if v.EnterNode(n) == false {
return

View File

@ -4,10 +4,6 @@ import (
"github.com/z7zmey/php-parser/node"
)
func (n BitwiseAnd) Name() string {
return "BitwiseAnd"
}
type BitwiseAnd struct {
BinaryOp
}
@ -22,6 +18,14 @@ func NewBitwiseAnd(variable node.Node, expression node.Node) node.Node {
}
}
func (n BitwiseAnd) Name() string {
return "BitwiseAnd"
}
func (n BitwiseAnd) Attributes() map[string]interface{} {
return nil
}
func (n BitwiseAnd) Walk(v node.Visitor) {
if v.EnterNode(n) == false {
return

View File

@ -18,6 +18,10 @@ func NewBitwiseOr(variable node.Node, expression node.Node) node.Node {
}
}
func (n BitwiseOr) Attributes() map[string]interface{} {
return nil
}
func (n BitwiseOr) Name() string {
return "BitwiseOr"
}

View File

@ -18,6 +18,10 @@ func NewBitwiseXor(variable node.Node, expression node.Node) node.Node {
}
}
func (n BitwiseXor) Attributes() map[string]interface{} {
return nil
}
func (n BitwiseXor) Name() string {
return "BitwiseXor"
}

View File

@ -4,10 +4,6 @@ import (
"github.com/z7zmey/php-parser/node"
)
func (n BooleanAnd) Name() string {
return "BooleanAnd"
}
type BooleanAnd struct {
BinaryOp
}
@ -22,6 +18,14 @@ func NewBooleanAnd(variable node.Node, expression node.Node) node.Node {
}
}
func (n BooleanAnd) Name() string {
return "BooleanAnd"
}
func (n BooleanAnd) Attributes() map[string]interface{} {
return nil
}
func (n BooleanAnd) Walk(v node.Visitor) {
if v.EnterNode(n) == false {
return

View File

@ -4,10 +4,6 @@ import (
"github.com/z7zmey/php-parser/node"
)
func (n BooleanOr) Name() string {
return "BooleanOr"
}
type BooleanOr struct {
BinaryOp
}
@ -22,6 +18,14 @@ func NewBooleanOr(variable node.Node, expression node.Node) node.Node {
}
}
func (n BooleanOr) Name() string {
return "BooleanOr"
}
func (n BooleanOr) Attributes() map[string]interface{} {
return nil
}
func (n BooleanOr) Walk(v node.Visitor) {
if v.EnterNode(n) == false {
return

View File

@ -4,10 +4,6 @@ import (
"github.com/z7zmey/php-parser/node"
)
func (n Coalesce) Name() string {
return "Coalesce"
}
type Coalesce struct {
BinaryOp
}
@ -22,6 +18,14 @@ func NewCoalesce(variable node.Node, expression node.Node) node.Node {
}
}
func (n Coalesce) Name() string {
return "Coalesce"
}
func (n Coalesce) Attributes() map[string]interface{} {
return nil
}
func (n Coalesce) Walk(v node.Visitor) {
if v.EnterNode(n) == false {
return

View File

@ -4,10 +4,6 @@ import (
"github.com/z7zmey/php-parser/node"
)
func (n Concat) Name() string {
return "Concat"
}
type Concat struct {
BinaryOp
}
@ -22,6 +18,14 @@ func NewConcat(variable node.Node, expression node.Node) node.Node {
}
}
func (n Concat) Name() string {
return "Concat"
}
func (n Concat) Attributes() map[string]interface{} {
return nil
}
func (n Concat) Walk(v node.Visitor) {
if v.EnterNode(n) == false {
return

View File

@ -4,10 +4,6 @@ import (
"github.com/z7zmey/php-parser/node"
)
func (n Div) Name() string {
return "Div"
}
type Div struct {
BinaryOp
}
@ -22,6 +18,14 @@ func NewDiv(variable node.Node, expression node.Node) node.Node {
}
}
func (n Div) Name() string {
return "Div"
}
func (n Div) Attributes() map[string]interface{} {
return nil
}
func (n Div) Walk(v node.Visitor) {
if v.EnterNode(n) == false {
return

View File

@ -4,10 +4,6 @@ import (
"github.com/z7zmey/php-parser/node"
)
func (n Equal) Name() string {
return "Equal"
}
type Equal struct {
BinaryOp
}
@ -22,6 +18,14 @@ func NewEqual(variable node.Node, expression node.Node) node.Node {
}
}
func (n Equal) Name() string {
return "Equal"
}
func (n Equal) Attributes() map[string]interface{} {
return nil
}
func (n Equal) Walk(v node.Visitor) {
if v.EnterNode(n) == false {
return

View File

@ -4,10 +4,6 @@ import (
"github.com/z7zmey/php-parser/node"
)
func (n Greater) Name() string {
return "Greater"
}
type Greater struct {
BinaryOp
}
@ -22,6 +18,14 @@ func NewGreater(variable node.Node, expression node.Node) node.Node {
}
}
func (n Greater) Name() string {
return "Greater"
}
func (n Greater) Attributes() map[string]interface{} {
return nil
}
func (n Greater) Walk(v node.Visitor) {
if v.EnterNode(n) == false {
return

View File

@ -4,10 +4,6 @@ import (
"github.com/z7zmey/php-parser/node"
)
func (n GreaterOrEqual) Name() string {
return "GreaterOrEqual"
}
type GreaterOrEqual struct {
BinaryOp
}
@ -22,6 +18,14 @@ func NewGreaterOrEqual(variable node.Node, expression node.Node) node.Node {
}
}
func (n GreaterOrEqual) Name() string {
return "GreaterOrEqual"
}
func (n GreaterOrEqual) Attributes() map[string]interface{} {
return nil
}
func (n GreaterOrEqual) Walk(v node.Visitor) {
if v.EnterNode(n) == false {
return

View File

@ -4,10 +4,6 @@ import (
"github.com/z7zmey/php-parser/node"
)
func (n Identical) Name() string {
return "Identical"
}
type Identical struct {
BinaryOp
}
@ -22,6 +18,14 @@ func NewIdentical(variable node.Node, expression node.Node) node.Node {
}
}
func (n Identical) Name() string {
return "Identical"
}
func (n Identical) Attributes() map[string]interface{} {
return nil
}
func (n Identical) Walk(v node.Visitor) {
if v.EnterNode(n) == false {
return

View File

@ -4,10 +4,6 @@ import (
"github.com/z7zmey/php-parser/node"
)
func (n LogicalAnd) Name() string {
return "LogicalAnd"
}
type LogicalAnd struct {
BinaryOp
}
@ -22,6 +18,14 @@ func NewLogicalAnd(variable node.Node, expression node.Node) node.Node {
}
}
func (n LogicalAnd) Name() string {
return "LogicalAnd"
}
func (n LogicalAnd) Attributes() map[string]interface{} {
return nil
}
func (n LogicalAnd) Walk(v node.Visitor) {
if v.EnterNode(n) == false {
return

View File

@ -4,10 +4,6 @@ import (
"github.com/z7zmey/php-parser/node"
)
func (n LogicalOr) Name() string {
return "LogicalOr"
}
type LogicalOr struct {
BinaryOp
}
@ -22,6 +18,14 @@ func NewLogicalOr(variable node.Node, expression node.Node) node.Node {
}
}
func (n LogicalOr) Name() string {
return "LogicalOr"
}
func (n LogicalOr) Attributes() map[string]interface{} {
return nil
}
func (n LogicalOr) Walk(v node.Visitor) {
if v.EnterNode(n) == false {
return

View File

@ -4,10 +4,6 @@ import (
"github.com/z7zmey/php-parser/node"
)
func (n LogicalXor) Name() string {
return "LogicalXor"
}
type LogicalXor struct {
BinaryOp
}
@ -22,6 +18,14 @@ func NewLogicalXor(variable node.Node, expression node.Node) node.Node {
}
}
func (n LogicalXor) Name() string {
return "LogicalXor"
}
func (n LogicalXor) Attributes() map[string]interface{} {
return nil
}
func (n LogicalXor) Walk(v node.Visitor) {
if v.EnterNode(n) == false {
return

View File

@ -4,10 +4,6 @@ import (
"github.com/z7zmey/php-parser/node"
)
func (n Minus) Name() string {
return "Minus"
}
type Minus struct {
BinaryOp
}
@ -22,6 +18,14 @@ func NewMinus(variable node.Node, expression node.Node) node.Node {
}
}
func (n Minus) Name() string {
return "Minus"
}
func (n Minus) Attributes() map[string]interface{} {
return nil
}
func (n Minus) Walk(v node.Visitor) {
if v.EnterNode(n) == false {
return

View File

@ -4,10 +4,6 @@ import (
"github.com/z7zmey/php-parser/node"
)
func (n Mod) Name() string {
return "Mod"
}
type Mod struct {
BinaryOp
}
@ -22,6 +18,14 @@ func NewMod(variable node.Node, expression node.Node) node.Node {
}
}
func (n Mod) Name() string {
return "Mod"
}
func (n Mod) Attributes() map[string]interface{} {
return nil
}
func (n Mod) Walk(v node.Visitor) {
if v.EnterNode(n) == false {
return

View File

@ -4,10 +4,6 @@ import (
"github.com/z7zmey/php-parser/node"
)
func (n Mul) Name() string {
return "Mul"
}
type Mul struct {
BinaryOp
}
@ -22,6 +18,14 @@ func NewMul(variable node.Node, expression node.Node) node.Node {
}
}
func (n Mul) Name() string {
return "Mul"
}
func (n Mul) Attributes() map[string]interface{} {
return nil
}
func (n Mul) Walk(v node.Visitor) {
if v.EnterNode(n) == false {
return

View File

@ -4,10 +4,6 @@ import (
"github.com/z7zmey/php-parser/node"
)
func (n NotEqual) Name() string {
return "NotEqual"
}
type NotEqual struct {
BinaryOp
}
@ -22,6 +18,14 @@ func NewNotEqual(variable node.Node, expression node.Node) node.Node {
}
}
func (n NotEqual) Name() string {
return "NotEqual"
}
func (n NotEqual) Attributes() map[string]interface{} {
return nil
}
func (n NotEqual) Walk(v node.Visitor) {
if v.EnterNode(n) == false {
return

View File

@ -4,10 +4,6 @@ import (
"github.com/z7zmey/php-parser/node"
)
func (n NotIdentical) Name() string {
return "NotIdentical"
}
type NotIdentical struct {
BinaryOp
}
@ -22,6 +18,14 @@ func NewNotIdentical(variable node.Node, expression node.Node) node.Node {
}
}
func (n NotIdentical) Name() string {
return "NotIdentical"
}
func (n NotIdentical) Attributes() map[string]interface{} {
return nil
}
func (n NotIdentical) Walk(v node.Visitor) {
if v.EnterNode(n) == false {
return

View File

@ -4,10 +4,6 @@ import (
"github.com/z7zmey/php-parser/node"
)
func (n Plus) Name() string {
return "Plus"
}
type Plus struct {
BinaryOp
}
@ -22,6 +18,14 @@ func NewPlus(variable node.Node, expression node.Node) node.Node {
}
}
func (n Plus) Name() string {
return "Plus"
}
func (n Plus) Attributes() map[string]interface{} {
return nil
}
func (n Plus) Walk(v node.Visitor) {
if v.EnterNode(n) == false {
return

View File

@ -4,10 +4,6 @@ import (
"github.com/z7zmey/php-parser/node"
)
func (n Pow) Name() string {
return "Pow"
}
type Pow struct {
BinaryOp
}
@ -22,6 +18,14 @@ func NewPow(variable node.Node, expression node.Node) node.Node {
}
}
func (n Pow) Name() string {
return "Pow"
}
func (n Pow) Attributes() map[string]interface{} {
return nil
}
func (n Pow) Walk(v node.Visitor) {
if v.EnterNode(n) == false {
return

View File

@ -4,10 +4,6 @@ import (
"github.com/z7zmey/php-parser/node"
)
func (n ShiftLeft) Name() string {
return "ShiftLeft"
}
type ShiftLeft struct {
BinaryOp
}
@ -22,6 +18,14 @@ func NewShiftLeft(variable node.Node, expression node.Node) node.Node {
}
}
func (n ShiftLeft) Name() string {
return "ShiftLeft"
}
func (n ShiftLeft) Attributes() map[string]interface{} {
return nil
}
func (n ShiftLeft) Walk(v node.Visitor) {
if v.EnterNode(n) == false {
return

View File

@ -4,10 +4,6 @@ import (
"github.com/z7zmey/php-parser/node"
)
func (n ShiftRight) Name() string {
return "ShiftRight"
}
type ShiftRight struct {
BinaryOp
}
@ -22,6 +18,14 @@ func NewShiftRight(variable node.Node, expression node.Node) node.Node {
}
}
func (n ShiftRight) Name() string {
return "ShiftRight"
}
func (n ShiftRight) Attributes() map[string]interface{} {
return nil
}
func (n ShiftRight) Walk(v node.Visitor) {
if v.EnterNode(n) == false {
return

View File

@ -4,10 +4,6 @@ import (
"github.com/z7zmey/php-parser/node"
)
func (n Smaller) Name() string {
return "Smaller"
}
type Smaller struct {
BinaryOp
}
@ -22,6 +18,14 @@ func NewSmaller(variable node.Node, expression node.Node) node.Node {
}
}
func (n Smaller) Name() string {
return "Smaller"
}
func (n Smaller) Attributes() map[string]interface{} {
return nil
}
func (n Smaller) Walk(v node.Visitor) {
if v.EnterNode(n) == false {
return

View File

@ -4,10 +4,6 @@ import (
"github.com/z7zmey/php-parser/node"
)
func (n SmallerOrEqual) Name() string {
return "SmallerOrEqual"
}
type SmallerOrEqual struct {
BinaryOp
}
@ -22,6 +18,14 @@ func NewSmallerOrEqual(variable node.Node, expression node.Node) node.Node {
}
}
func (n SmallerOrEqual) Name() string {
return "SmallerOrEqual"
}
func (n SmallerOrEqual) Attributes() map[string]interface{} {
return nil
}
func (n SmallerOrEqual) Walk(v node.Visitor) {
if v.EnterNode(n) == false {
return

View File

@ -4,10 +4,6 @@ import (
"github.com/z7zmey/php-parser/node"
)
func (n Spaceship) Name() string {
return "Spaceship"
}
type Spaceship struct {
BinaryOp
}
@ -22,6 +18,14 @@ func NewSpaceship(variable node.Node, expression node.Node) node.Node {
}
}
func (n Spaceship) Name() string {
return "Spaceship"
}
func (n Spaceship) Attributes() map[string]interface{} {
return nil
}
func (n Spaceship) Walk(v node.Visitor) {
if v.EnterNode(n) == false {
return

View File

@ -4,10 +4,6 @@ import (
"github.com/z7zmey/php-parser/node"
)
func (n BitwiseNot) Name() string {
return "BitwiseNot"
}
type BitwiseNot struct {
name string
expr node.Node
@ -20,6 +16,14 @@ func NewBitwiseNot(expression node.Node) node.Node {
}
}
func (n BitwiseNot) Name() string {
return "BitwiseNot"
}
func (n BitwiseNot) Attributes() map[string]interface{} {
return nil
}
func (n BitwiseNot) Walk(v node.Visitor) {
if v.EnterNode(n) == false {
return

View File

@ -4,10 +4,6 @@ import (
"github.com/z7zmey/php-parser/node"
)
func (n BooleanNot) Name() string {
return "BooleanNot"
}
type BooleanNot struct {
name string
expr node.Node
@ -20,6 +16,14 @@ func NewBooleanNot(expression node.Node) node.Node {
}
}
func (n BooleanNot) Name() string {
return "BooleanNot"
}
func (n BooleanNot) Attributes() map[string]interface{} {
return nil
}
func (n BooleanNot) Walk(v node.Visitor) {
if v.EnterNode(n) == false {
return

View File

@ -4,10 +4,6 @@ import (
"github.com/z7zmey/php-parser/node"
)
func (n CastArray) Name() string {
return "CastArray"
}
type CastArray struct {
Cast
}
@ -21,6 +17,14 @@ func NewCastArray(expr node.Node) node.Node {
}
}
func (n CastArray) Name() string {
return "CastArray"
}
func (n CastArray) Attributes() map[string]interface{} {
return nil
}
func (n CastArray) Walk(v node.Visitor) {
if v.EnterNode(n) == false {
return

View File

@ -4,10 +4,6 @@ import (
"github.com/z7zmey/php-parser/node"
)
func (n CastBool) Name() string {
return "CastBool"
}
type CastBool struct {
Cast
}
@ -21,6 +17,14 @@ func NewCastBool(expr node.Node) node.Node {
}
}
func (n CastBool) Name() string {
return "CastBool"
}
func (n CastBool) Attributes() map[string]interface{} {
return nil
}
func (n CastBool) Walk(v node.Visitor) {
if v.EnterNode(n) == false {
return

View File

@ -4,10 +4,6 @@ import (
"github.com/z7zmey/php-parser/node"
)
func (n CastDouble) Name() string {
return "CastDouble"
}
type CastDouble struct {
Cast
}
@ -21,6 +17,14 @@ func NewCastDouble(expr node.Node) node.Node {
}
}
func (n CastDouble) Name() string {
return "CastDouble"
}
func (n CastDouble) Attributes() map[string]interface{} {
return nil
}
func (n CastDouble) Walk(v node.Visitor) {
if v.EnterNode(n) == false {
return

View File

@ -4,10 +4,6 @@ import (
"github.com/z7zmey/php-parser/node"
)
func (n CastInt) Name() string {
return "CastInt"
}
type CastInt struct {
Cast
}
@ -21,6 +17,14 @@ func NewCastInt(expr node.Node) node.Node {
}
}
func (n CastInt) Name() string {
return "CastInt"
}
func (n CastInt) Attributes() map[string]interface{} {
return nil
}
func (n CastInt) Walk(v node.Visitor) {
if v.EnterNode(n) == false {
return

View File

@ -4,10 +4,6 @@ import (
"github.com/z7zmey/php-parser/node"
)
func (n CastObject) Name() string {
return "CastObject"
}
type CastObject struct {
Cast
}
@ -21,6 +17,14 @@ func NewCastObject(expr node.Node) node.Node {
}
}
func (n CastObject) Name() string {
return "CastObject"
}
func (n CastObject) Attributes() map[string]interface{} {
return nil
}
func (n CastObject) Walk(v node.Visitor) {
if v.EnterNode(n) == false {
return

View File

@ -4,10 +4,6 @@ import (
"github.com/z7zmey/php-parser/node"
)
func (n CastString) Name() string {
return "CastString"
}
type CastString struct {
Cast
}
@ -21,6 +17,14 @@ func NewCastString(expr node.Node) node.Node {
}
}
func (n CastString) Name() string {
return "CastString"
}
func (n CastString) Attributes() map[string]interface{} {
return nil
}
func (n CastString) Walk(v node.Visitor) {
if v.EnterNode(n) == false {
return

View File

@ -4,10 +4,6 @@ import (
"github.com/z7zmey/php-parser/node"
)
func (n CastUnset) Name() string {
return "CastUnset"
}
type CastUnset struct {
Cast
}
@ -21,6 +17,14 @@ func NewCastUnset(expr node.Node) node.Node {
}
}
func (n CastUnset) Name() string {
return "CastUnset"
}
func (n CastUnset) Attributes() map[string]interface{} {
return nil
}
func (n CastUnset) Walk(v node.Visitor) {
if v.EnterNode(n) == false {
return

View File

@ -2,25 +2,27 @@ package expr
import (
"github.com/z7zmey/php-parser/node"
"github.com/z7zmey/php-parser/token"
)
func (n ClassConstFetch) Attributes() map[string]interface{} {
return nil
}
func (n ClassConstFetch) Name() string {
return "ClassConstFetch"
}
type ClassConstFetch struct {
name string
class node.Node
constant token.Token
name string
class node.Node
constantName node.Node
}
// TODO: constant must be identifier
func NewClassConstFetch(class node.Node, constant token.Token) node.Node {
func NewClassConstFetch(class node.Node, constantName node.Node) node.Node {
return ClassConstFetch{
"ClassConstFetch",
class,
constant,
constantName,
}
}
@ -29,7 +31,10 @@ func (n ClassConstFetch) Walk(v node.Visitor) {
return
}
v.Scalar("constant", n.constant.Value)
if n.constantName != nil {
vv := v.GetChildrenVisitor("constantName")
n.constantName.Walk(vv)
}
if n.class != nil {
vv := v.GetChildrenVisitor("class")

View File

@ -4,10 +4,6 @@ import (
"github.com/z7zmey/php-parser/node"
)
func (n Clone) Name() string {
return "Clone"
}
type Clone struct {
name string
expr node.Node
@ -20,6 +16,14 @@ func NewClone(expression node.Node) node.Node {
}
}
func (n Clone) Name() string {
return "Clone"
}
func (n Clone) Attributes() map[string]interface{} {
return nil
}
func (n Clone) Walk(v node.Visitor) {
if v.EnterNode(n) == false {
return

View File

@ -4,40 +4,42 @@ import (
"github.com/z7zmey/php-parser/node"
)
func (n Closure) Name() string {
return "Closure"
}
type Closure struct {
name string
params []node.Node
uses []node.Node
returnType node.Node
stmts []node.Node
isReturnRef bool
isStatic bool
name string
attributes map[string]interface{}
params []node.Node
uses []node.Node
returnType node.Node
stmts []node.Node
}
func NewClosure(params []node.Node, uses []node.Node, returnType node.Node, stmts []node.Node, isStatic bool, isReturnRef bool) node.Node {
return Closure{
"Closure",
map[string]interface{}{
"isReturnRef": isReturnRef,
"isStatic": isStatic,
},
params,
uses,
returnType,
stmts,
isReturnRef,
isStatic,
}
}
func (n Closure) Name() string {
return "Closure"
}
func (n Closure) Attributes() map[string]interface{} {
return nil
}
func (n Closure) Walk(v node.Visitor) {
if v.EnterNode(n) == false {
return
}
v.Scalar("isStatic", n.isStatic)
v.Scalar("isReturnRef", n.isReturnRef)
if n.params != nil {
vv := v.GetChildrenVisitor("params")
for _, nn := range n.params {

View File

@ -4,31 +4,35 @@ import (
"github.com/z7zmey/php-parser/node"
)
func (n ClusureUse) Name() string {
return "ClusureUse"
}
type ClusureUse struct {
name string
variable node.Node
byRef bool
name string
attributes map[string]interface{}
variable node.Node
}
func NewClusureUse(variable node.Node, byRef bool) node.Node {
return ClusureUse{
"ClusureUse",
map[string]interface{}{
"byRef": byRef,
},
variable,
byRef,
}
}
func (n ClusureUse) Name() string {
return "ClusureUse"
}
func (n ClusureUse) Attributes() map[string]interface{} {
return nil
}
func (n ClusureUse) Walk(v node.Visitor) {
if v.EnterNode(n) == false {
return
}
v.Scalar("byRef", n.byRef)
if n.variable != nil {
vv := v.GetChildrenVisitor("variable")
n.variable.Walk(vv)

View File

@ -4,10 +4,6 @@ import (
"github.com/z7zmey/php-parser/node"
)
func (n ConstFetch) Name() string {
return "ConstFetch"
}
type ConstFetch struct {
name string
constant node.Node
@ -20,6 +16,14 @@ func NewConstFetch(constant node.Node) node.Node {
}
}
func (n ConstFetch) Name() string {
return "ConstFetch"
}
func (n ConstFetch) Attributes() map[string]interface{} {
return nil
}
func (n ConstFetch) Walk(v node.Visitor) {
if v.EnterNode(n) == false {
return

View File

@ -4,10 +4,6 @@ import (
"github.com/z7zmey/php-parser/node"
)
func (n Empty) Name() string {
return "Empty"
}
type Empty struct {
name string
expr node.Node
@ -20,6 +16,14 @@ func NewEmpty(expression node.Node) node.Node {
}
}
func (n Empty) Name() string {
return "Empty"
}
func (n Empty) Attributes() map[string]interface{} {
return nil
}
func (n Empty) Walk(v node.Visitor) {
if v.EnterNode(n) == false {
return

View File

@ -4,10 +4,6 @@ import (
"github.com/z7zmey/php-parser/node"
)
func (n ErrorSuppress) Name() string {
return "ErrorSuppress"
}
type ErrorSuppress struct {
name string
expr node.Node
@ -20,6 +16,14 @@ func NewErrorSuppress(expression node.Node) node.Node {
}
}
func (n ErrorSuppress) Name() string {
return "ErrorSuppress"
}
func (n ErrorSuppress) Attributes() map[string]interface{} {
return nil
}
func (n ErrorSuppress) Walk(v node.Visitor) {
if v.EnterNode(n) == false {
return

View File

@ -4,10 +4,6 @@ import (
"github.com/z7zmey/php-parser/node"
)
func (n Eval) Name() string {
return "Eval"
}
type Eval struct {
name string
expr node.Node
@ -20,6 +16,14 @@ func NewEval(expression node.Node) node.Node {
}
}
func (n Eval) Name() string {
return "Eval"
}
func (n Eval) Attributes() map[string]interface{} {
return nil
}
func (n Eval) Walk(v node.Visitor) {
if v.EnterNode(n) == false {
return

View File

@ -4,24 +4,30 @@ import (
"github.com/z7zmey/php-parser/node"
)
func (n Exit) Name() string {
return "Exit"
}
type Exit struct {
name string
expr node.Node
isDie bool
name string
attributes map[string]interface{}
expr node.Node
}
func NewExit(expr node.Node, isDie bool) node.Node {
return Exit{
"Exit",
map[string]interface{}{
"isDie": isDie,
},
expr,
isDie,
}
}
func (n Exit) Name() string {
return "Exit"
}
func (n Exit) Attributes() map[string]interface{} {
return nil
}
func (n Exit) Walk(v node.Visitor) {
if v.EnterNode(n) == false {
return

View File

@ -4,10 +4,6 @@ import (
"github.com/z7zmey/php-parser/node"
)
func (n FunctionCall) Name() string {
return "FunctionCall"
}
type FunctionCall struct {
name string
function node.Node
@ -22,6 +18,14 @@ func NewFunctionCall(function node.Node, arguments []node.Node) node.Node {
}
}
func (n FunctionCall) Name() string {
return "FunctionCall"
}
func (n FunctionCall) Attributes() map[string]interface{} {
return nil
}
func (n FunctionCall) Walk(v node.Visitor) {
if v.EnterNode(n) == false {
return

View File

@ -4,10 +4,6 @@ import (
"github.com/z7zmey/php-parser/node"
)
func (n Include) Name() string {
return "Include"
}
type Include struct {
name string
expr node.Node
@ -20,6 +16,14 @@ func NewInclude(expression node.Node) node.Node {
}
}
func (n Include) Name() string {
return "Include"
}
func (n Include) Attributes() map[string]interface{} {
return nil
}
func (n Include) Walk(v node.Visitor) {
if v.EnterNode(n) == false {
return

View File

@ -4,10 +4,6 @@ import (
"github.com/z7zmey/php-parser/node"
)
func (n IncludeOnce) Name() string {
return "IncludeOnce"
}
type IncludeOnce struct {
name string
expr node.Node
@ -20,6 +16,14 @@ func NewIncludeOnce(expression node.Node) node.Node {
}
}
func (n IncludeOnce) Name() string {
return "IncludeOnce"
}
func (n IncludeOnce) Attributes() map[string]interface{} {
return nil
}
func (n IncludeOnce) Walk(v node.Visitor) {
if v.EnterNode(n) == false {
return

View File

@ -4,10 +4,6 @@ import (
"github.com/z7zmey/php-parser/node"
)
func (n InstanceOf) Name() string {
return "InstanceOf"
}
type InstanceOf struct {
name string
expr node.Node
@ -22,6 +18,14 @@ func NewInstanceOf(expr node.Node, class node.Node) node.Node {
}
}
func (n InstanceOf) Name() string {
return "InstanceOf"
}
func (n InstanceOf) Attributes() map[string]interface{} {
return nil
}
func (n InstanceOf) Walk(v node.Visitor) {
if v.EnterNode(n) == false {
return

View File

@ -4,10 +4,6 @@ import (
"github.com/z7zmey/php-parser/node"
)
func (n Isset) Name() string {
return "Isset"
}
type Isset struct {
name string
variables []node.Node
@ -20,6 +16,14 @@ func NewIsset(variables []node.Node) node.Node {
}
}
func (n Isset) Name() string {
return "Isset"
}
func (n Isset) Attributes() map[string]interface{} {
return nil
}
func (n Isset) Walk(v node.Visitor) {
if v.EnterNode(n) == false {
return

View File

@ -4,10 +4,6 @@ import (
"github.com/z7zmey/php-parser/node"
)
func (n List) Name() string {
return "List"
}
type List struct {
name string
items []node.Node
@ -20,6 +16,14 @@ func NewList(items []node.Node) node.Node {
}
}
func (n List) Name() string {
return "List"
}
func (n List) Attributes() map[string]interface{} {
return nil
}
func (n List) Walk(v node.Visitor) {
if v.EnterNode(n) == false {
return

View File

@ -4,10 +4,6 @@ import (
"github.com/z7zmey/php-parser/node"
)
func (n MethodCall) Name() string {
return "MethodCall"
}
type MethodCall struct {
name string
variable node.Node
@ -24,6 +20,14 @@ func NewMethodCall(variable node.Node, method node.Node, arguments []node.Node)
}
}
func (n MethodCall) Name() string {
return "MethodCall"
}
func (n MethodCall) Attributes() map[string]interface{} {
return nil
}
func (n MethodCall) Walk(v node.Visitor) {
if v.EnterNode(n) == false {
return

View File

@ -4,10 +4,6 @@ import (
"github.com/z7zmey/php-parser/node"
)
func (n New) Name() string {
return "New"
}
type New struct {
name string
class node.Node
@ -22,6 +18,14 @@ func NewNew(class node.Node, arguments []node.Node) node.Node {
}
}
func (n New) Name() string {
return "New"
}
func (n New) Attributes() map[string]interface{} {
return nil
}
func (n New) Walk(v node.Visitor) {
if v.EnterNode(n) == false {
return

View File

@ -4,22 +4,26 @@ import (
"github.com/z7zmey/php-parser/node"
)
func (n PostDec) Name() string {
return "PostDec"
}
type PostDec struct {
name string
variable node.Node
}
func NewPostDec(variableession node.Node) node.Node {
func NewPostDec(variable node.Node) node.Node {
return PostDec{
"PostDec",
variableession,
variable,
}
}
func (n PostDec) Name() string {
return "PostDec"
}
func (n PostDec) Attributes() map[string]interface{} {
return nil
}
func (n PostDec) Walk(v node.Visitor) {
if v.EnterNode(n) == false {
return

View File

@ -4,22 +4,26 @@ import (
"github.com/z7zmey/php-parser/node"
)
func (n PostInc) Name() string {
return "PostInc"
}
type PostInc struct {
name string
variable node.Node
}
func NewPostInc(variableession node.Node) node.Node {
func NewPostInc(variable node.Node) node.Node {
return PostInc{
"PostInc",
variableession,
variable,
}
}
func (n PostInc) Name() string {
return "PostInc"
}
func (n PostInc) Attributes() map[string]interface{} {
return nil
}
func (n PostInc) Walk(v node.Visitor) {
if v.EnterNode(n) == false {
return

View File

@ -4,22 +4,26 @@ import (
"github.com/z7zmey/php-parser/node"
)
func (n PreDec) Name() string {
return "PreDec"
}
type PreDec struct {
name string
variable node.Node
}
func NewPreDec(variableession node.Node) node.Node {
func NewPreDec(variable node.Node) node.Node {
return PreDec{
"PreDec",
variableession,
variable,
}
}
func (n PreDec) Name() string {
return "PreDec"
}
func (n PreDec) Attributes() map[string]interface{} {
return nil
}
func (n PreDec) Walk(v node.Visitor) {
if v.EnterNode(n) == false {
return

View File

@ -4,22 +4,26 @@ import (
"github.com/z7zmey/php-parser/node"
)
func (n PreInc) Name() string {
return "PreInc"
}
type PreInc struct {
name string
variable node.Node
}
func NewPreInc(variableession node.Node) node.Node {
func NewPreInc(variable node.Node) node.Node {
return PreInc{
"PreInc",
variableession,
variable,
}
}
func (n PreInc) Name() string {
return "PreInc"
}
func (n PreInc) Attributes() map[string]interface{} {
return nil
}
func (n PreInc) Walk(v node.Visitor) {
if v.EnterNode(n) == false {
return

View File

@ -4,10 +4,6 @@ import (
"github.com/z7zmey/php-parser/node"
)
func (n Print) Name() string {
return "Print"
}
type Print struct {
name string
expr node.Node
@ -20,6 +16,14 @@ func NewPrint(expression node.Node) node.Node {
}
}
func (n Print) Name() string {
return "Print"
}
func (n Print) Attributes() map[string]interface{} {
return nil
}
func (n Print) Walk(v node.Visitor) {
if v.EnterNode(n) == false {
return

View File

@ -4,10 +4,6 @@ import (
"github.com/z7zmey/php-parser/node"
)
func (n PropertyFetch) Name() string {
return "PropertyFetch"
}
type PropertyFetch struct {
name string
variable node.Node
@ -22,6 +18,14 @@ func NewPropertyFetch(variable node.Node, property node.Node) node.Node {
}
}
func (n PropertyFetch) Name() string {
return "PropertyFetch"
}
func (n PropertyFetch) Attributes() map[string]interface{} {
return nil
}
func (n PropertyFetch) Walk(v node.Visitor) {
if v.EnterNode(n) == false {
return

View File

@ -4,10 +4,6 @@ import (
"github.com/z7zmey/php-parser/node"
)
func (n Require) Name() string {
return "Require"
}
type Require struct {
name string
expr node.Node
@ -20,6 +16,14 @@ func NewRequire(expression node.Node) node.Node {
}
}
func (n Require) Name() string {
return "Require"
}
func (n Require) Attributes() map[string]interface{} {
return nil
}
func (n Require) Walk(v node.Visitor) {
if v.EnterNode(n) == false {
return

View File

@ -4,10 +4,6 @@ import (
"github.com/z7zmey/php-parser/node"
)
func (n RequireOnce) Name() string {
return "RequireOnce"
}
type RequireOnce struct {
name string
expr node.Node
@ -20,6 +16,14 @@ func NewRequireOnce(expression node.Node) node.Node {
}
}
func (n RequireOnce) Name() string {
return "RequireOnce"
}
func (n RequireOnce) Attributes() map[string]interface{} {
return nil
}
func (n RequireOnce) Walk(v node.Visitor) {
if v.EnterNode(n) == false {
return

View File

@ -4,10 +4,6 @@ import (
"github.com/z7zmey/php-parser/node"
)
func (n ShellExec) Name() string {
return "ShellExec"
}
type ShellExec struct {
name string
parts []node.Node
@ -20,6 +16,14 @@ func NewShellExec(parts []node.Node) node.Node {
}
}
func (n ShellExec) Name() string {
return "ShellExec"
}
func (n ShellExec) Attributes() map[string]interface{} {
return nil
}
func (n ShellExec) Walk(v node.Visitor) {
if v.EnterNode(n) == false {
return

View File

@ -2,27 +2,26 @@ package expr
import (
"github.com/z7zmey/php-parser/node"
"github.com/z7zmey/php-parser/token"
)
type ShortArray struct {
name string
items []node.Node
}
func NewShortArray(items []node.Node) node.Node {
return ShortArray{
"ShortArray",
items,
}
}
func (n ShortArray) Name() string {
return "ShortArray"
}
type ShortArray struct {
name string
opentToken token.Token
closeToken token.Token
items []node.Node
}
func NewShortArray(opentToken token.Token, closeToken token.Token, items []node.Node) node.Node {
return ShortArray{
"ShortArray",
opentToken,
closeToken,
items,
}
func (n ShortArray) Attributes() map[string]interface{} {
return nil
}
func (n ShortArray) Walk(v node.Visitor) {

View File

@ -4,10 +4,6 @@ import (
"github.com/z7zmey/php-parser/node"
)
func (n ShortList) Name() string {
return "ShortList"
}
type ShortList struct {
name string
items []node.Node
@ -20,6 +16,14 @@ func NewShortList(items []node.Node) node.Node {
}
}
func (n ShortList) Name() string {
return "ShortList"
}
func (n ShortList) Attributes() map[string]interface{} {
return nil
}
func (n ShortList) Walk(v node.Visitor) {
if v.EnterNode(n) == false {
return

View File

@ -4,10 +4,6 @@ import (
"github.com/z7zmey/php-parser/node"
)
func (n StaticCall) Name() string {
return "StaticCall"
}
type StaticCall struct {
name string
class node.Node
@ -24,6 +20,14 @@ func NewStaticCall(class node.Node, call node.Node, arguments []node.Node) node.
}
}
func (n StaticCall) Name() string {
return "StaticCall"
}
func (n StaticCall) Attributes() map[string]interface{} {
return nil
}
func (n StaticCall) Walk(v node.Visitor) {
if v.EnterNode(n) == false {
return

View File

@ -4,10 +4,6 @@ import (
"github.com/z7zmey/php-parser/node"
)
func (n StaticPropertyFetch) Name() string {
return "StaticPropertyFetch"
}
type StaticPropertyFetch struct {
name string
class node.Node
@ -22,6 +18,14 @@ func NewStaticPropertyFetch(class node.Node, property node.Node) node.Node {
}
}
func (n StaticPropertyFetch) Name() string {
return "StaticPropertyFetch"
}
func (n StaticPropertyFetch) Attributes() map[string]interface{} {
return nil
}
func (n StaticPropertyFetch) Walk(v node.Visitor) {
if v.EnterNode(n) == false {
return

View File

@ -4,10 +4,6 @@ import (
"github.com/z7zmey/php-parser/node"
)
func (n Ternary) Name() string {
return "Ternary"
}
type Ternary struct {
name string
condition node.Node
@ -24,6 +20,14 @@ func NewTernary(condition node.Node, ifTrue node.Node, ifFalse node.Node) node.N
}
}
func (n Ternary) Name() string {
return "Ternary"
}
func (n Ternary) Attributes() map[string]interface{} {
return nil
}
func (n Ternary) Walk(v node.Visitor) {
if v.EnterNode(n) == false {
return

View File

@ -4,10 +4,6 @@ import (
"github.com/z7zmey/php-parser/node"
)
func (n UnaryMinus) Name() string {
return "UnaryMinus"
}
type UnaryMinus struct {
name string
expr node.Node
@ -20,6 +16,14 @@ func NewUnaryMinus(expression node.Node) node.Node {
}
}
func (n UnaryMinus) Name() string {
return "UnaryMinus"
}
func (n UnaryMinus) Attributes() map[string]interface{} {
return nil
}
func (n UnaryMinus) Walk(v node.Visitor) {
if v.EnterNode(n) == false {
return

View File

@ -4,10 +4,6 @@ import (
"github.com/z7zmey/php-parser/node"
)
func (n UnaryPlus) Name() string {
return "UnaryPlus"
}
type UnaryPlus struct {
name string
expr node.Node
@ -20,6 +16,14 @@ func NewUnaryPlus(expression node.Node) node.Node {
}
}
func (n UnaryPlus) Name() string {
return "UnaryPlus"
}
func (n UnaryPlus) Attributes() map[string]interface{} {
return nil
}
func (n UnaryPlus) Walk(v node.Visitor) {
if v.EnterNode(n) == false {
return

View File

@ -4,10 +4,6 @@ import (
"github.com/z7zmey/php-parser/node"
)
func (n Variable) Name() string {
return "Variable"
}
type Variable struct {
name string
varName node.Node
@ -20,6 +16,14 @@ func NewVariable(varName node.Node) node.Node {
}
}
func (n Variable) Name() string {
return "Variable"
}
func (n Variable) Attributes() map[string]interface{} {
return nil
}
func (n Variable) Walk(v node.Visitor) {
if v.EnterNode(n) == false {
return

View File

@ -4,10 +4,6 @@ import (
"github.com/z7zmey/php-parser/node"
)
func (n Yield) Name() string {
return "Yield"
}
type Yield struct {
name string
key node.Node
@ -22,6 +18,14 @@ func NewYield(key node.Node, value node.Node) node.Node {
}
}
func (n Yield) Name() string {
return "Yield"
}
func (n Yield) Attributes() map[string]interface{} {
return nil
}
func (n Yield) Walk(v node.Visitor) {
if v.EnterNode(n) == false {
return

View File

@ -4,10 +4,6 @@ import (
"github.com/z7zmey/php-parser/node"
)
func (n YieldFrom) Name() string {
return "YieldFrom"
}
type YieldFrom struct {
name string
expr node.Node
@ -20,6 +16,14 @@ func NewYieldFrom(expression node.Node) node.Node {
}
}
func (n YieldFrom) Name() string {
return "YieldFrom"
}
func (n YieldFrom) Attributes() map[string]interface{} {
return nil
}
func (n YieldFrom) Walk(v node.Visitor) {
if v.EnterNode(n) == false {
return

View File

@ -5,19 +5,25 @@ import (
)
type Identifier struct {
name string
token token.Token
name string
attributes map[string]interface{}
}
func NewIdentifier(token token.Token) Node {
return Identifier{
"Identifier",
map[string]interface{}{
"value": token.Value,
},
}
}
func (n Identifier) Name() string {
return "Identifier"
}
func NewIdentifier(token token.Token) Node {
return Identifier{
"Identifier",
token,
}
func (n Identifier) Attributes() map[string]interface{} {
return n.attributes
}
func (n Identifier) Walk(v Visitor) {
@ -25,7 +31,5 @@ func (n Identifier) Walk(v Visitor) {
return
}
v.Scalar("token", n.token.Value)
v.LeaveNode(n)
}

View File

@ -20,3 +20,7 @@ func NewFullyQualified(parts []node.Node) node.Node {
func (n FullyQualified) Name() string {
return "FullyQualified"
}
func (n FullyQualified) Attributes() map[string]interface{} {
return nil
}

View File

@ -4,10 +4,6 @@ import (
"github.com/z7zmey/php-parser/node"
)
func (n NameNode) Name() string {
return "Name"
}
type NameNode struct {
name string
parts []node.Node
@ -20,6 +16,14 @@ func NewName(parts []node.Node) node.Node {
}
}
func (n NameNode) Name() string {
return "Name"
}
func (n NameNode) Attributes() map[string]interface{} {
return nil
}
func (n NameNode) Walk(v node.Visitor) {
if v.EnterNode(n) == false {
return
@ -31,4 +35,6 @@ func (n NameNode) Walk(v node.Visitor) {
nn.Walk(vv)
}
}
v.LeaveNode(n)
}

View File

@ -2,23 +2,28 @@ package name
import (
"github.com/z7zmey/php-parser/node"
"github.com/z7zmey/php-parser/token"
)
type NamePart struct {
name string
attributes map[string]interface{}
}
func NewNamePart(value string) node.Node {
return NamePart{
"NamePart",
map[string]interface{}{
"value": value,
},
}
}
func (n NamePart) Name() string {
return "NamePart"
}
type NamePart struct {
name string
token token.Token
}
func NewNamePart(token token.Token) node.Node {
return NamePart{
"NamePart",
token,
}
func (n NamePart) Attributes() map[string]interface{} {
return n.attributes
}
func (n NamePart) Walk(v node.Visitor) {
@ -26,5 +31,5 @@ func (n NamePart) Walk(v node.Visitor) {
return
}
v.Scalar("token", n.token.Value)
v.LeaveNode(n)
}

View File

@ -20,3 +20,7 @@ func NewRelative(parts []node.Node) node.Node {
func (n Relative) Name() string {
return "Relative"
}
func (n Relative) Attributes() map[string]interface{} {
return nil
}

View File

@ -2,5 +2,6 @@ package node
type Node interface {
Name() string
Attributes() map[string]interface{}
Walk(v Visitor)
}

View File

@ -5,10 +5,6 @@ type Nullable struct {
expr Node
}
func (n Nullable) Name() string {
return "Nullable"
}
func NewNullable(expression Node) Node {
return Nullable{
"Nullable",
@ -16,6 +12,14 @@ func NewNullable(expression Node) Node {
}
}
func (n Nullable) Name() string {
return "Nullable"
}
func (n Nullable) Attributes() map[string]interface{} {
return nil
}
func (n Nullable) Walk(v Visitor) {
if v.EnterNode(n) == false {
return

View File

@ -2,26 +2,31 @@ package node
type Parameter struct {
name string
attributes map[string]interface{}
variableType Node
variable Node
defaultValue Node
byRef bool
variadic bool
}
func NewParameter(variableType Node, variable Node, defaultValue Node, byRef bool, variadic bool) Node {
return Parameter{
"Parameter",
map[string]interface{}{
"byRef": byRef,
"variadic": variadic,
},
variableType,
variable,
defaultValue,
}
}
func (n Parameter) Name() string {
return "Parameter"
}
func NewParameter(variableType Node, variable Node, defaultValue Node, byRef bool, variadic bool) Node {
return Parameter{
"Parameter",
variableType,
variable,
defaultValue,
byRef,
variadic,
}
func (n Parameter) Attributes() map[string]interface{} {
return n.attributes
}
func (n Parameter) Walk(v Visitor) {
@ -29,9 +34,6 @@ func (n Parameter) Walk(v Visitor) {
return
}
v.Scalar("byRef", n.byRef)
v.Scalar("variadic", n.variadic)
if n.variableType != nil {
vv := v.GetChildrenVisitor("variableType")
n.variableType.Walk(vv)

View File

@ -2,23 +2,28 @@ package scalar
import (
"github.com/z7zmey/php-parser/node"
"github.com/z7zmey/php-parser/token"
)
type Dnumber struct {
name string
attributes map[string]interface{}
}
func NewDnumber(value string) node.Node {
return Dnumber{
"Dnumber",
map[string]interface{}{
"value": value,
},
}
}
func (n Dnumber) Name() string {
return "Dnumber"
}
type Dnumber struct {
name string
token token.Token
}
func NewDnumber(token token.Token) node.Node {
return Dnumber{
"Dnumber",
token,
}
func (n Dnumber) Attributes() map[string]interface{} {
return nil
}
func (n Dnumber) Walk(v node.Visitor) {
@ -26,5 +31,5 @@ func (n Dnumber) Walk(v node.Visitor) {
return
}
v.Scalar("token", n.token.Value)
v.LeaveNode(n)
}

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