remove SimpleNode

This commit is contained in:
vadim 2017-12-27 19:55:58 +02:00
parent e83ab79344
commit 32a285b437
159 changed files with 1195 additions and 622 deletions

View File

@ -6,21 +6,25 @@ import (
) )
type Argument struct { type Argument struct {
SimpleNode name string
expr Node expr Node
variadic bool variadic bool
} }
func (n Argument) Name() string {
return "Argument"
}
func NewArgument(expression Node, variadic bool) Node { func NewArgument(expression Node, variadic bool) Node {
return Argument{ return Argument{
SimpleNode{Name: "Argument", Attributes: make(map[string]string)}, "Argument",
expression, expression,
variadic, variadic,
} }
} }
func (n Argument) Print(out io.Writer, indent string) { func (n Argument) Print(out io.Writer, indent string) {
fmt.Fprintf(out, "\n%v%v [- -]", indent, n.Name) fmt.Fprintf(out, "\n%v%v [- -]", indent, n.name)
fmt.Fprintf(out, "\n%vvariadic: %t", indent+" ", n.variadic) fmt.Fprintf(out, "\n%vvariadic: %t", indent+" ", n.variadic)
if n.expr != nil { if n.expr != nil {

View File

@ -8,8 +8,12 @@ import (
"github.com/z7zmey/php-parser/token" "github.com/z7zmey/php-parser/token"
) )
func (n Array) Name() string {
return "Array"
}
type Array struct { type Array struct {
node.SimpleNode name string
opentToken token.Token opentToken token.Token
closeToken token.Token closeToken token.Token
items []node.Node items []node.Node
@ -17,7 +21,7 @@ type Array struct {
func NewArray(opentToken token.Token, closeToken token.Token, items []node.Node) node.Node { func NewArray(opentToken token.Token, closeToken token.Token, items []node.Node) node.Node {
return Array{ return Array{
node.SimpleNode{Name: "Array", Attributes: make(map[string]string)}, "Array",
opentToken, opentToken,
closeToken, closeToken,
items, items,
@ -25,7 +29,7 @@ func NewArray(opentToken token.Token, closeToken token.Token, items []node.Node)
} }
func (n Array) Print(out io.Writer, indent string) { func (n Array) Print(out io.Writer, indent string) {
fmt.Fprintf(out, "\n%v%v [%d %d]", indent, n.Name, n.opentToken.StartLine, n.closeToken.EndLine) fmt.Fprintf(out, "\n%v%v [%d %d]", indent, n.name, n.opentToken.StartLine, n.closeToken.EndLine)
if n.items != nil { if n.items != nil {
fmt.Fprintf(out, "\n%vitems:", indent+" ") fmt.Fprintf(out, "\n%vitems:", indent+" ")

View File

@ -7,15 +7,19 @@ import (
"github.com/z7zmey/php-parser/node" "github.com/z7zmey/php-parser/node"
) )
func (n ArrayDimFetch) Name() string {
return "ArrayDimFetch"
}
type ArrayDimFetch struct { type ArrayDimFetch struct {
node.SimpleNode name string
variable node.Node variable node.Node
dim node.Node dim node.Node
} }
func NewArrayDimFetch(variable node.Node, dim node.Node) node.Node { func NewArrayDimFetch(variable node.Node, dim node.Node) node.Node {
return ArrayDimFetch{ return ArrayDimFetch{
node.SimpleNode{Name: "ArrayDimFetch", Attributes: make(map[string]string)}, "ArrayDimFetch",
variable, variable,
dim, dim,
} }

View File

@ -7,8 +7,12 @@ import (
"github.com/z7zmey/php-parser/node" "github.com/z7zmey/php-parser/node"
) )
func (n ArrayItem) Name() string {
return "ArrayItem"
}
type ArrayItem struct { type ArrayItem struct {
node.SimpleNode name string
key node.Node key node.Node
val node.Node val node.Node
byRef bool byRef bool
@ -16,7 +20,7 @@ type ArrayItem struct {
func NewArrayItem(key node.Node, val node.Node, byRef bool) node.Node { func NewArrayItem(key node.Node, val node.Node, byRef bool) node.Node {
return ArrayItem{ return ArrayItem{
node.SimpleNode{Name: "ArrayItem", Attributes: make(map[string]string)}, "ArrayItem",
key, key,
val, val,
byRef, byRef,
@ -24,7 +28,7 @@ func NewArrayItem(key node.Node, val node.Node, byRef bool) node.Node {
} }
func (n ArrayItem) Print(out io.Writer, indent string) { func (n ArrayItem) Print(out io.Writer, indent string) {
fmt.Fprintf(out, "\n%v%v [- -]", indent, n.Name) fmt.Fprintf(out, "\n%v%v [- -]", indent, n.name)
fmt.Fprintf(out, "\n%vbyRef: %t", indent+" ", n.byRef) fmt.Fprintf(out, "\n%vbyRef: %t", indent+" ", n.byRef)
if n.key != nil { if n.key != nil {

View File

@ -4,6 +4,10 @@ import (
"github.com/z7zmey/php-parser/node" "github.com/z7zmey/php-parser/node"
) )
func (n Assign) Name() string {
return "Assign"
}
type Assign struct { type Assign struct {
AssignOp AssignOp
} }
@ -11,7 +15,7 @@ type Assign struct {
func NewAssign(variable node.Node, expression node.Node) node.Node { func NewAssign(variable node.Node, expression node.Node) node.Node {
return Assign{ return Assign{
AssignOp{ AssignOp{
node.SimpleNode{Name: "Assign", Attributes: make(map[string]string)}, "Assign",
variable, variable,
expression, expression,
}, },

View File

@ -8,13 +8,13 @@ import (
) )
type AssignOp struct { type AssignOp struct {
node.SimpleNode name string
variable node.Node variable node.Node
expression node.Node expression node.Node
} }
func (n AssignOp) Print(out io.Writer, indent string) { func (n AssignOp) Print(out io.Writer, indent string) {
fmt.Fprintf(out, "\n%v%v [- -]", indent, n.Name) fmt.Fprintf(out, "\n%v%v [- -]", indent, n.name)
if n.variable != nil { if n.variable != nil {
fmt.Fprintf(out, "\n%vvariable:", indent+" ") fmt.Fprintf(out, "\n%vvariable:", indent+" ")

View File

@ -4,6 +4,10 @@ import (
"github.com/z7zmey/php-parser/node" "github.com/z7zmey/php-parser/node"
) )
func (n AssignRef) Name() string {
return "AssignRef"
}
type AssignRef struct { type AssignRef struct {
AssignOp AssignOp
} }
@ -11,7 +15,7 @@ type AssignRef struct {
func NewAssignRef(variable node.Node, expression node.Node) node.Node { func NewAssignRef(variable node.Node, expression node.Node) node.Node {
return AssignRef{ return AssignRef{
AssignOp{ AssignOp{
node.SimpleNode{Name: "AssignRef", Attributes: make(map[string]string)}, "AssignRef",
variable, variable,
expression, expression,
}, },

View File

@ -4,6 +4,10 @@ import (
"github.com/z7zmey/php-parser/node" "github.com/z7zmey/php-parser/node"
) )
func (n BitwiseAnd) Name() string {
return "BitwiseAnd"
}
type BitwiseAnd struct { type BitwiseAnd struct {
AssignOp AssignOp
} }
@ -11,7 +15,7 @@ type BitwiseAnd struct {
func NewBitwiseAnd(variable node.Node, expression node.Node) node.Node { func NewBitwiseAnd(variable node.Node, expression node.Node) node.Node {
return BitwiseAnd{ return BitwiseAnd{
AssignOp{ AssignOp{
node.SimpleNode{Name: "AssignBitwiseAnd", Attributes: make(map[string]string)}, "AssignBitwiseAnd",
variable, variable,
expression, expression,
}, },

View File

@ -4,6 +4,10 @@ import (
"github.com/z7zmey/php-parser/node" "github.com/z7zmey/php-parser/node"
) )
func (n BitwiseOr) Name() string {
return "BitwiseOr"
}
type BitwiseOr struct { type BitwiseOr struct {
AssignOp AssignOp
} }
@ -11,7 +15,7 @@ type BitwiseOr struct {
func NewBitwiseOr(variable node.Node, expression node.Node) node.Node { func NewBitwiseOr(variable node.Node, expression node.Node) node.Node {
return BitwiseOr{ return BitwiseOr{
AssignOp{ AssignOp{
node.SimpleNode{Name: "AssignBitwiseOr", Attributes: make(map[string]string)}, "AssignBitwiseOr",
variable, variable,
expression, expression,
}, },

View File

@ -11,9 +11,13 @@ type BitwiseXor struct {
func NewBitwiseXor(variable node.Node, expression node.Node) node.Node { func NewBitwiseXor(variable node.Node, expression node.Node) node.Node {
return BitwiseXor{ return BitwiseXor{
AssignOp{ AssignOp{
node.SimpleNode{Name: "AssignBitwiseXor", Attributes: make(map[string]string)}, "AssignBitwiseXor",
variable, variable,
expression, expression,
}, },
} }
} }
func (n BitwiseXor) Name() string {
return "BitwiseXor"
}

View File

@ -4,6 +4,10 @@ import (
"github.com/z7zmey/php-parser/node" "github.com/z7zmey/php-parser/node"
) )
func (n Concat) Name() string {
return "Concat"
}
type Concat struct { type Concat struct {
AssignOp AssignOp
} }
@ -11,7 +15,7 @@ type Concat struct {
func NewConcat(variable node.Node, expression node.Node) node.Node { func NewConcat(variable node.Node, expression node.Node) node.Node {
return Concat{ return Concat{
AssignOp{ AssignOp{
node.SimpleNode{Name: "AssignConcat", Attributes: make(map[string]string)}, "AssignConcat",
variable, variable,
expression, expression,
}, },

View File

@ -4,6 +4,10 @@ import (
"github.com/z7zmey/php-parser/node" "github.com/z7zmey/php-parser/node"
) )
func (n Div) Name() string {
return "Div"
}
type Div struct { type Div struct {
AssignOp AssignOp
} }
@ -11,7 +15,7 @@ type Div struct {
func NewDiv(variable node.Node, expression node.Node) node.Node { func NewDiv(variable node.Node, expression node.Node) node.Node {
return Div{ return Div{
AssignOp{ AssignOp{
node.SimpleNode{Name: "AssignDiv", Attributes: make(map[string]string)}, "AssignDiv",
variable, variable,
expression, expression,
}, },

View File

@ -4,6 +4,10 @@ import (
"github.com/z7zmey/php-parser/node" "github.com/z7zmey/php-parser/node"
) )
func (n Minus) Name() string {
return "Minus"
}
type Minus struct { type Minus struct {
AssignOp AssignOp
} }
@ -11,7 +15,7 @@ type Minus struct {
func NewMinus(variable node.Node, expression node.Node) node.Node { func NewMinus(variable node.Node, expression node.Node) node.Node {
return Minus{ return Minus{
AssignOp{ AssignOp{
node.SimpleNode{Name: "AssignMinus", Attributes: make(map[string]string)}, "AssignMinus",
variable, variable,
expression, expression,
}, },

View File

@ -4,6 +4,10 @@ import (
"github.com/z7zmey/php-parser/node" "github.com/z7zmey/php-parser/node"
) )
func (n Mod) Name() string {
return "Mod"
}
type Mod struct { type Mod struct {
AssignOp AssignOp
} }
@ -11,7 +15,7 @@ type Mod struct {
func NewMod(variable node.Node, expression node.Node) node.Node { func NewMod(variable node.Node, expression node.Node) node.Node {
return Mod{ return Mod{
AssignOp{ AssignOp{
node.SimpleNode{Name: "AssignMod", Attributes: make(map[string]string)}, "AssignMod",
variable, variable,
expression, expression,
}, },

View File

@ -4,6 +4,10 @@ import (
"github.com/z7zmey/php-parser/node" "github.com/z7zmey/php-parser/node"
) )
func (n Mul) Name() string {
return "Mul"
}
type Mul struct { type Mul struct {
AssignOp AssignOp
} }
@ -11,7 +15,7 @@ type Mul struct {
func NewMul(variable node.Node, expression node.Node) node.Node { func NewMul(variable node.Node, expression node.Node) node.Node {
return Mul{ return Mul{
AssignOp{ AssignOp{
node.SimpleNode{Name: "AssignMul", Attributes: make(map[string]string)}, "AssignMul",
variable, variable,
expression, expression,
}, },

View File

@ -4,6 +4,10 @@ import (
"github.com/z7zmey/php-parser/node" "github.com/z7zmey/php-parser/node"
) )
func (n Plus) Name() string {
return "Plus"
}
type Plus struct { type Plus struct {
AssignOp AssignOp
} }
@ -11,7 +15,7 @@ type Plus struct {
func NewPlus(variable node.Node, expression node.Node) node.Node { func NewPlus(variable node.Node, expression node.Node) node.Node {
return Plus{ return Plus{
AssignOp{ AssignOp{
node.SimpleNode{Name: "AssignPlus", Attributes: make(map[string]string)}, "AssignPlus",
variable, variable,
expression, expression,
}, },

View File

@ -4,6 +4,10 @@ import (
"github.com/z7zmey/php-parser/node" "github.com/z7zmey/php-parser/node"
) )
func (n Pow) Name() string {
return "Pow"
}
type Pow struct { type Pow struct {
AssignOp AssignOp
} }
@ -11,7 +15,7 @@ type Pow struct {
func NewPow(variable node.Node, expression node.Node) node.Node { func NewPow(variable node.Node, expression node.Node) node.Node {
return Pow{ return Pow{
AssignOp{ AssignOp{
node.SimpleNode{Name: "AssignPow", Attributes: make(map[string]string)}, "AssignPow",
variable, variable,
expression, expression,
}, },

View File

@ -4,6 +4,10 @@ import (
"github.com/z7zmey/php-parser/node" "github.com/z7zmey/php-parser/node"
) )
func (n ShiftLeft) Name() string {
return "ShiftLeft"
}
type ShiftLeft struct { type ShiftLeft struct {
AssignOp AssignOp
} }
@ -11,7 +15,7 @@ type ShiftLeft struct {
func NewShiftLeft(variable node.Node, expression node.Node) node.Node { func NewShiftLeft(variable node.Node, expression node.Node) node.Node {
return ShiftLeft{ return ShiftLeft{
AssignOp{ AssignOp{
node.SimpleNode{Name: "AssignShiftLeft", Attributes: make(map[string]string)}, "AssignShiftLeft",
variable, variable,
expression, expression,
}, },

View File

@ -4,6 +4,10 @@ import (
"github.com/z7zmey/php-parser/node" "github.com/z7zmey/php-parser/node"
) )
func (n ShiftRight) Name() string {
return "ShiftRight"
}
type ShiftRight struct { type ShiftRight struct {
AssignOp AssignOp
} }
@ -11,7 +15,7 @@ type ShiftRight struct {
func NewShiftRight(variable node.Node, expression node.Node) node.Node { func NewShiftRight(variable node.Node, expression node.Node) node.Node {
return ShiftRight{ return ShiftRight{
AssignOp{ AssignOp{
node.SimpleNode{Name: "AssignShiftRight", Attributes: make(map[string]string)}, "AssignShiftRight",
variable, variable,
expression, expression,
}, },

View File

@ -8,21 +8,13 @@ import (
) )
type BinaryOp struct { type BinaryOp struct {
node.SimpleNode name string
left node.Node left node.Node
right node.Node right node.Node
} }
func NewBinaryOp(left node.Node, right node.Node) node.Node {
return BinaryOp{
node.SimpleNode{Name: "BinaryOp", Attributes: make(map[string]string)},
left,
right,
}
}
func (n BinaryOp) Print(out io.Writer, indent string) { func (n BinaryOp) Print(out io.Writer, indent string) {
fmt.Fprintf(out, "\n%v%v [- -]", indent, n.Name) fmt.Fprintf(out, "\n%v%v [- -]", indent, n.name)
if n.left != nil { if n.left != nil {
fmt.Fprintf(out, "\n%vleft:", indent+" ") fmt.Fprintf(out, "\n%vleft:", indent+" ")

View File

@ -4,6 +4,10 @@ import (
"github.com/z7zmey/php-parser/node" "github.com/z7zmey/php-parser/node"
) )
func (n BitwiseAnd) Name() string {
return "BitwiseAnd"
}
type BitwiseAnd struct { type BitwiseAnd struct {
BinaryOp BinaryOp
} }
@ -11,7 +15,7 @@ type BitwiseAnd struct {
func NewBitwiseAnd(variable node.Node, expression node.Node) node.Node { func NewBitwiseAnd(variable node.Node, expression node.Node) node.Node {
return BitwiseAnd{ return BitwiseAnd{
BinaryOp{ BinaryOp{
node.SimpleNode{Name: "BinaryBitwiseAnd", Attributes: make(map[string]string)}, "BinaryBitwiseAnd",
variable, variable,
expression, expression,
}, },

View File

@ -11,9 +11,13 @@ type BitwiseOr struct {
func NewBitwiseOr(variable node.Node, expression node.Node) node.Node { func NewBitwiseOr(variable node.Node, expression node.Node) node.Node {
return BitwiseOr{ return BitwiseOr{
BinaryOp{ BinaryOp{
node.SimpleNode{Name: "BinaryBitwiseOr", Attributes: make(map[string]string)}, "BinaryBitwiseOr",
variable, variable,
expression, expression,
}, },
} }
} }
func (n BitwiseOr) Name() string {
return "BitwiseOr"
}

View File

@ -11,9 +11,13 @@ type BitwiseXor struct {
func NewBitwiseXor(variable node.Node, expression node.Node) node.Node { func NewBitwiseXor(variable node.Node, expression node.Node) node.Node {
return BitwiseXor{ return BitwiseXor{
BinaryOp{ BinaryOp{
node.SimpleNode{Name: "BinaryBitwiseXor", Attributes: make(map[string]string)}, "BinaryBitwiseXor",
variable, variable,
expression, expression,
}, },
} }
} }
func (n BitwiseXor) Name() string {
return "BitwiseXor"
}

View File

@ -4,6 +4,10 @@ import (
"github.com/z7zmey/php-parser/node" "github.com/z7zmey/php-parser/node"
) )
func (n BooleanAnd) Name() string {
return "BooleanAnd"
}
type BooleanAnd struct { type BooleanAnd struct {
BinaryOp BinaryOp
} }
@ -11,7 +15,7 @@ type BooleanAnd struct {
func NewBooleanAnd(variable node.Node, expression node.Node) node.Node { func NewBooleanAnd(variable node.Node, expression node.Node) node.Node {
return BooleanAnd{ return BooleanAnd{
BinaryOp{ BinaryOp{
node.SimpleNode{Name: "BinaryBooleanAnd", Attributes: make(map[string]string)}, "BinaryBooleanAnd",
variable, variable,
expression, expression,
}, },

View File

@ -4,6 +4,10 @@ import (
"github.com/z7zmey/php-parser/node" "github.com/z7zmey/php-parser/node"
) )
func (n BooleanOr) Name() string {
return "BooleanOr"
}
type BooleanOr struct { type BooleanOr struct {
BinaryOp BinaryOp
} }
@ -11,7 +15,7 @@ type BooleanOr struct {
func NewBooleanOr(variable node.Node, expression node.Node) node.Node { func NewBooleanOr(variable node.Node, expression node.Node) node.Node {
return BooleanOr{ return BooleanOr{
BinaryOp{ BinaryOp{
node.SimpleNode{Name: "BinaryBooleanOr", Attributes: make(map[string]string)}, "BinaryBooleanOr",
variable, variable,
expression, expression,
}, },

View File

@ -4,6 +4,10 @@ import (
"github.com/z7zmey/php-parser/node" "github.com/z7zmey/php-parser/node"
) )
func (n Coalesce) Name() string {
return "Coalesce"
}
type Coalesce struct { type Coalesce struct {
BinaryOp BinaryOp
} }
@ -11,7 +15,7 @@ type Coalesce struct {
func NewCoalesce(variable node.Node, expression node.Node) node.Node { func NewCoalesce(variable node.Node, expression node.Node) node.Node {
return Coalesce{ return Coalesce{
BinaryOp{ BinaryOp{
node.SimpleNode{Name: "BinaryCoalesce", Attributes: make(map[string]string)}, "BinaryCoalesce",
variable, variable,
expression, expression,
}, },

View File

@ -4,6 +4,10 @@ import (
"github.com/z7zmey/php-parser/node" "github.com/z7zmey/php-parser/node"
) )
func (n Concat) Name() string {
return "Concat"
}
type Concat struct { type Concat struct {
BinaryOp BinaryOp
} }
@ -11,7 +15,7 @@ type Concat struct {
func NewConcat(variable node.Node, expression node.Node) node.Node { func NewConcat(variable node.Node, expression node.Node) node.Node {
return Concat{ return Concat{
BinaryOp{ BinaryOp{
node.SimpleNode{Name: "BinaryConcat", Attributes: make(map[string]string)}, "BinaryConcat",
variable, variable,
expression, expression,
}, },

View File

@ -4,6 +4,10 @@ import (
"github.com/z7zmey/php-parser/node" "github.com/z7zmey/php-parser/node"
) )
func (n Div) Name() string {
return "Div"
}
type Div struct { type Div struct {
BinaryOp BinaryOp
} }
@ -11,7 +15,7 @@ type Div struct {
func NewDiv(variable node.Node, expression node.Node) node.Node { func NewDiv(variable node.Node, expression node.Node) node.Node {
return Div{ return Div{
BinaryOp{ BinaryOp{
node.SimpleNode{Name: "BinaryDiv", Attributes: make(map[string]string)}, "BinaryDiv",
variable, variable,
expression, expression,
}, },

View File

@ -4,6 +4,10 @@ import (
"github.com/z7zmey/php-parser/node" "github.com/z7zmey/php-parser/node"
) )
func (n Equal) Name() string {
return "Equal"
}
type Equal struct { type Equal struct {
BinaryOp BinaryOp
} }
@ -11,7 +15,7 @@ type Equal struct {
func NewEqual(variable node.Node, expression node.Node) node.Node { func NewEqual(variable node.Node, expression node.Node) node.Node {
return Equal{ return Equal{
BinaryOp{ BinaryOp{
node.SimpleNode{Name: "BinaryEqual", Attributes: make(map[string]string)}, "BinaryEqual",
variable, variable,
expression, expression,
}, },

View File

@ -4,6 +4,10 @@ import (
"github.com/z7zmey/php-parser/node" "github.com/z7zmey/php-parser/node"
) )
func (n Greater) Name() string {
return "Greater"
}
type Greater struct { type Greater struct {
BinaryOp BinaryOp
} }
@ -11,7 +15,7 @@ type Greater struct {
func NewGreater(variable node.Node, expression node.Node) node.Node { func NewGreater(variable node.Node, expression node.Node) node.Node {
return Greater{ return Greater{
BinaryOp{ BinaryOp{
node.SimpleNode{Name: "BinaryGreater", Attributes: make(map[string]string)}, "BinaryGreater",
variable, variable,
expression, expression,
}, },

View File

@ -4,6 +4,10 @@ import (
"github.com/z7zmey/php-parser/node" "github.com/z7zmey/php-parser/node"
) )
func (n GreaterOrEqual) Name() string {
return "GreaterOrEqual"
}
type GreaterOrEqual struct { type GreaterOrEqual struct {
BinaryOp BinaryOp
} }
@ -11,7 +15,7 @@ type GreaterOrEqual struct {
func NewGreaterOrEqual(variable node.Node, expression node.Node) node.Node { func NewGreaterOrEqual(variable node.Node, expression node.Node) node.Node {
return GreaterOrEqual{ return GreaterOrEqual{
BinaryOp{ BinaryOp{
node.SimpleNode{Name: "BinaryGreaterOrEqual", Attributes: make(map[string]string)}, "BinaryGreaterOrEqual",
variable, variable,
expression, expression,
}, },

View File

@ -4,6 +4,10 @@ import (
"github.com/z7zmey/php-parser/node" "github.com/z7zmey/php-parser/node"
) )
func (n Identical) Name() string {
return "Identical"
}
type Identical struct { type Identical struct {
BinaryOp BinaryOp
} }
@ -11,7 +15,7 @@ type Identical struct {
func NewIdentical(variable node.Node, expression node.Node) node.Node { func NewIdentical(variable node.Node, expression node.Node) node.Node {
return Identical{ return Identical{
BinaryOp{ BinaryOp{
node.SimpleNode{Name: "BinaryIdentical", Attributes: make(map[string]string)}, "BinaryIdentical",
variable, variable,
expression, expression,
}, },

View File

@ -4,6 +4,10 @@ import (
"github.com/z7zmey/php-parser/node" "github.com/z7zmey/php-parser/node"
) )
func (n LogicalAnd) Name() string {
return "LogicalAnd"
}
type LogicalAnd struct { type LogicalAnd struct {
BinaryOp BinaryOp
} }
@ -11,7 +15,7 @@ type LogicalAnd struct {
func NewLogicalAnd(variable node.Node, expression node.Node) node.Node { func NewLogicalAnd(variable node.Node, expression node.Node) node.Node {
return LogicalAnd{ return LogicalAnd{
BinaryOp{ BinaryOp{
node.SimpleNode{Name: "BinaryLogicalAnd", Attributes: make(map[string]string)}, "BinaryLogicalAnd",
variable, variable,
expression, expression,
}, },

View File

@ -4,6 +4,10 @@ import (
"github.com/z7zmey/php-parser/node" "github.com/z7zmey/php-parser/node"
) )
func (n LogicalOr) Name() string {
return "LogicalOr"
}
type LogicalOr struct { type LogicalOr struct {
BinaryOp BinaryOp
} }
@ -11,7 +15,7 @@ type LogicalOr struct {
func NewLogicalOr(variable node.Node, expression node.Node) node.Node { func NewLogicalOr(variable node.Node, expression node.Node) node.Node {
return LogicalOr{ return LogicalOr{
BinaryOp{ BinaryOp{
node.SimpleNode{Name: "BinaryLogicalOr", Attributes: make(map[string]string)}, "BinaryLogicalOr",
variable, variable,
expression, expression,
}, },

View File

@ -4,6 +4,10 @@ import (
"github.com/z7zmey/php-parser/node" "github.com/z7zmey/php-parser/node"
) )
func (n LogicalXor) Name() string {
return "LogicalXor"
}
type LogicalXor struct { type LogicalXor struct {
BinaryOp BinaryOp
} }
@ -11,7 +15,7 @@ type LogicalXor struct {
func NewLogicalXor(variable node.Node, expression node.Node) node.Node { func NewLogicalXor(variable node.Node, expression node.Node) node.Node {
return LogicalXor{ return LogicalXor{
BinaryOp{ BinaryOp{
node.SimpleNode{Name: "BinaryLogicalXor", Attributes: make(map[string]string)}, "BinaryLogicalXor",
variable, variable,
expression, expression,
}, },

View File

@ -4,6 +4,10 @@ import (
"github.com/z7zmey/php-parser/node" "github.com/z7zmey/php-parser/node"
) )
func (n Minus) Name() string {
return "Minus"
}
type Minus struct { type Minus struct {
BinaryOp BinaryOp
} }
@ -11,7 +15,7 @@ type Minus struct {
func NewMinus(variable node.Node, expression node.Node) node.Node { func NewMinus(variable node.Node, expression node.Node) node.Node {
return Minus{ return Minus{
BinaryOp{ BinaryOp{
node.SimpleNode{Name: "BinaryMinus", Attributes: make(map[string]string)}, "BinaryMinus",
variable, variable,
expression, expression,
}, },

View File

@ -4,6 +4,10 @@ import (
"github.com/z7zmey/php-parser/node" "github.com/z7zmey/php-parser/node"
) )
func(n Mod) Name() string {
return "Mod"
}
type Mod struct { type Mod struct {
BinaryOp BinaryOp
} }
@ -11,7 +15,7 @@ type Mod struct {
func NewMod(variable node.Node, expression node.Node) node.Node { func NewMod(variable node.Node, expression node.Node) node.Node {
return Mod{ return Mod{
BinaryOp{ BinaryOp{
node.SimpleNode{Name: "BinaryMod", Attributes: make(map[string]string)}, "BinaryMod",
variable, variable,
expression, expression,
}, },

View File

@ -4,6 +4,10 @@ import (
"github.com/z7zmey/php-parser/node" "github.com/z7zmey/php-parser/node"
) )
func(n Mul) Name() string {
return "Mul"
}
type Mul struct { type Mul struct {
BinaryOp BinaryOp
} }
@ -11,7 +15,7 @@ type Mul struct {
func NewMul(variable node.Node, expression node.Node) node.Node { func NewMul(variable node.Node, expression node.Node) node.Node {
return Mul{ return Mul{
BinaryOp{ BinaryOp{
node.SimpleNode{Name: "BinaryMul", Attributes: make(map[string]string)}, "BinaryMul",
variable, variable,
expression, expression,
}, },

View File

@ -4,6 +4,10 @@ import (
"github.com/z7zmey/php-parser/node" "github.com/z7zmey/php-parser/node"
) )
func(n NotEqual) Name() string {
return "NotEqual"
}
type NotEqual struct { type NotEqual struct {
BinaryOp BinaryOp
} }
@ -11,7 +15,7 @@ type NotEqual struct {
func NewNotEqual(variable node.Node, expression node.Node) node.Node { func NewNotEqual(variable node.Node, expression node.Node) node.Node {
return NotEqual{ return NotEqual{
BinaryOp{ BinaryOp{
node.SimpleNode{Name: "BinaryNotEqual", Attributes: make(map[string]string)}, "BinaryNotEqual",
variable, variable,
expression, expression,
}, },

View File

@ -4,6 +4,10 @@ import (
"github.com/z7zmey/php-parser/node" "github.com/z7zmey/php-parser/node"
) )
func(n NotIdentical) Name() string {
return "NotIdentical"
}
type NotIdentical struct { type NotIdentical struct {
BinaryOp BinaryOp
} }
@ -11,7 +15,7 @@ type NotIdentical struct {
func NewNotIdentical(variable node.Node, expression node.Node) node.Node { func NewNotIdentical(variable node.Node, expression node.Node) node.Node {
return NotIdentical{ return NotIdentical{
BinaryOp{ BinaryOp{
node.SimpleNode{Name: "BinaryNotIdentical", Attributes: make(map[string]string)}, "BinaryNotIdentical",
variable, variable,
expression, expression,
}, },

View File

@ -4,6 +4,10 @@ import (
"github.com/z7zmey/php-parser/node" "github.com/z7zmey/php-parser/node"
) )
func(n Plus) Name() string {
return "Plus"
}
type Plus struct { type Plus struct {
BinaryOp BinaryOp
} }
@ -11,7 +15,7 @@ type Plus struct {
func NewPlus(variable node.Node, expression node.Node) node.Node { func NewPlus(variable node.Node, expression node.Node) node.Node {
return Plus{ return Plus{
BinaryOp{ BinaryOp{
node.SimpleNode{Name: "BinaryPlus", Attributes: make(map[string]string)}, "BinaryPlus",
variable, variable,
expression, expression,
}, },

View File

@ -4,6 +4,10 @@ import (
"github.com/z7zmey/php-parser/node" "github.com/z7zmey/php-parser/node"
) )
func(n Pow) Name() string {
return "Pow"
}
type Pow struct { type Pow struct {
BinaryOp BinaryOp
} }
@ -11,7 +15,7 @@ type Pow struct {
func NewPow(variable node.Node, expression node.Node) node.Node { func NewPow(variable node.Node, expression node.Node) node.Node {
return Pow{ return Pow{
BinaryOp{ BinaryOp{
node.SimpleNode{Name: "BinaryPow", Attributes: make(map[string]string)}, "BinaryPow",
variable, variable,
expression, expression,
}, },

View File

@ -4,6 +4,10 @@ import (
"github.com/z7zmey/php-parser/node" "github.com/z7zmey/php-parser/node"
) )
func(n ShiftLeft) Name() string {
return "ShiftLeft"
}
type ShiftLeft struct { type ShiftLeft struct {
BinaryOp BinaryOp
} }
@ -11,7 +15,7 @@ type ShiftLeft struct {
func NewShiftLeft(variable node.Node, expression node.Node) node.Node { func NewShiftLeft(variable node.Node, expression node.Node) node.Node {
return ShiftLeft{ return ShiftLeft{
BinaryOp{ BinaryOp{
node.SimpleNode{Name: "BinaryShiftLeft", Attributes: make(map[string]string)}, "BinaryShiftLeft",
variable, variable,
expression, expression,
}, },

View File

@ -4,6 +4,10 @@ import (
"github.com/z7zmey/php-parser/node" "github.com/z7zmey/php-parser/node"
) )
func(n ShiftRight) Name() string {
return "ShiftRight"
}
type ShiftRight struct { type ShiftRight struct {
BinaryOp BinaryOp
} }
@ -11,7 +15,7 @@ type ShiftRight struct {
func NewShiftRight(variable node.Node, expression node.Node) node.Node { func NewShiftRight(variable node.Node, expression node.Node) node.Node {
return ShiftRight{ return ShiftRight{
BinaryOp{ BinaryOp{
node.SimpleNode{Name: "BinaryShiftRight", Attributes: make(map[string]string)}, "BinaryShiftRight",
variable, variable,
expression, expression,
}, },

View File

@ -4,6 +4,10 @@ import (
"github.com/z7zmey/php-parser/node" "github.com/z7zmey/php-parser/node"
) )
func(n Smaller) Name() string {
return "Smaller"
}
type Smaller struct { type Smaller struct {
BinaryOp BinaryOp
} }
@ -11,7 +15,7 @@ type Smaller struct {
func NewSmaller(variable node.Node, expression node.Node) node.Node { func NewSmaller(variable node.Node, expression node.Node) node.Node {
return Smaller{ return Smaller{
BinaryOp{ BinaryOp{
node.SimpleNode{Name: "BinarySmaller", Attributes: make(map[string]string)}, "BinarySmaller",
variable, variable,
expression, expression,
}, },

View File

@ -4,6 +4,10 @@ import (
"github.com/z7zmey/php-parser/node" "github.com/z7zmey/php-parser/node"
) )
func(n SmallerOrEqual) Name() string {
return "SmallerOrEqual"
}
type SmallerOrEqual struct { type SmallerOrEqual struct {
BinaryOp BinaryOp
} }
@ -11,7 +15,7 @@ type SmallerOrEqual struct {
func NewSmallerOrEqual(variable node.Node, expression node.Node) node.Node { func NewSmallerOrEqual(variable node.Node, expression node.Node) node.Node {
return SmallerOrEqual{ return SmallerOrEqual{
BinaryOp{ BinaryOp{
node.SimpleNode{Name: "BinarySmallerOrEqual", Attributes: make(map[string]string)}, "BinarySmallerOrEqual",
variable, variable,
expression, expression,
}, },

View File

@ -4,6 +4,10 @@ import (
"github.com/z7zmey/php-parser/node" "github.com/z7zmey/php-parser/node"
) )
func(n Spaceship) Name() string {
return "Spaceship"
}
type Spaceship struct { type Spaceship struct {
BinaryOp BinaryOp
} }
@ -11,7 +15,7 @@ type Spaceship struct {
func NewSpaceship(variable node.Node, expression node.Node) node.Node { func NewSpaceship(variable node.Node, expression node.Node) node.Node {
return Spaceship{ return Spaceship{
BinaryOp{ BinaryOp{
node.SimpleNode{Name: "BinarySpaceship", Attributes: make(map[string]string)}, "BinarySpaceship",
variable, variable,
expression, expression,
}, },

View File

@ -7,20 +7,24 @@ import (
"github.com/z7zmey/php-parser/node" "github.com/z7zmey/php-parser/node"
) )
func (n BitwiseNot) Name() string {
return "BitwiseNot"
}
type BitwiseNot struct { type BitwiseNot struct {
node.SimpleNode name string
expr node.Node expr node.Node
} }
func NewBitwiseNot(expression node.Node) node.Node { func NewBitwiseNot(expression node.Node) node.Node {
return BitwiseNot{ return BitwiseNot{
node.SimpleNode{Name: "BitwiseNot", Attributes: make(map[string]string)}, "BitwiseNot",
expression, expression,
} }
} }
func (n BitwiseNot) Print(out io.Writer, indent string) { func (n BitwiseNot) Print(out io.Writer, indent string) {
fmt.Fprintf(out, "\n%v%v [- -]", indent, n.Name) fmt.Fprintf(out, "\n%v%v [- -]", indent, n.name)
if n.expr != nil { if n.expr != nil {
fmt.Fprintf(out, "\n%vexpr:", indent+" ") fmt.Fprintf(out, "\n%vexpr:", indent+" ")

View File

@ -7,20 +7,24 @@ import (
"github.com/z7zmey/php-parser/node" "github.com/z7zmey/php-parser/node"
) )
func (n BooleanNot) Name() string {
return "BooleanNot"
}
type BooleanNot struct { type BooleanNot struct {
node.SimpleNode name string
expr node.Node expr node.Node
} }
func NewBooleanNot(expression node.Node) node.Node { func NewBooleanNot(expression node.Node) node.Node {
return BooleanNot{ return BooleanNot{
node.SimpleNode{Name: "BooleanNot", Attributes: make(map[string]string)}, "BooleanNot",
expression, expression,
} }
} }
func (n BooleanNot) Print(out io.Writer, indent string) { func (n BooleanNot) Print(out io.Writer, indent string) {
fmt.Fprintf(out, "\n%v%v [- -]", indent, n.Name) fmt.Fprintf(out, "\n%v%v [- -]", indent, n.name)
if n.expr != nil { if n.expr != nil {
fmt.Fprintf(out, "\n%vexpr:", indent+" ") fmt.Fprintf(out, "\n%vexpr:", indent+" ")

View File

@ -8,19 +8,12 @@ import (
) )
type Cast struct { type Cast struct {
node.SimpleNode name string
expr node.Node expr node.Node
} }
func NewCast(expr node.Node) node.Node {
return Cast{
node.SimpleNode{Name: "Cast", Attributes: make(map[string]string)},
expr,
}
}
func (n Cast) Print(out io.Writer, indent string) { func (n Cast) Print(out io.Writer, indent string) {
fmt.Fprintf(out, "\n%v%v [- -]", indent, n.Name) fmt.Fprintf(out, "\n%v%v [- -]", indent, n.name)
if n.expr != nil { if n.expr != nil {
fmt.Fprintf(out, "\n%vexpr:", indent+" ") fmt.Fprintf(out, "\n%vexpr:", indent+" ")

View File

@ -4,6 +4,10 @@ import (
"github.com/z7zmey/php-parser/node" "github.com/z7zmey/php-parser/node"
) )
func (n CastArray) Name() string {
return "CastArray"
}
type CastArray struct { type CastArray struct {
Cast Cast
} }
@ -11,7 +15,7 @@ type CastArray struct {
func NewCastArray(expr node.Node) node.Node { func NewCastArray(expr node.Node) node.Node {
return CastArray{ return CastArray{
Cast{ Cast{
node.SimpleNode{Name: "CastArray", Attributes: make(map[string]string)}, "CastArray",
expr, expr,
}, },
} }

View File

@ -4,6 +4,10 @@ import (
"github.com/z7zmey/php-parser/node" "github.com/z7zmey/php-parser/node"
) )
func (n CastBool) Name() string {
return "CastBool"
}
type CastBool struct { type CastBool struct {
Cast Cast
} }
@ -11,7 +15,7 @@ type CastBool struct {
func NewCastBool(expr node.Node) node.Node { func NewCastBool(expr node.Node) node.Node {
return CastBool{ return CastBool{
Cast{ Cast{
node.SimpleNode{Name: "CastBool", Attributes: make(map[string]string)}, "CastBool",
expr, expr,
}, },
} }

View File

@ -4,6 +4,10 @@ import (
"github.com/z7zmey/php-parser/node" "github.com/z7zmey/php-parser/node"
) )
func (n CastDouble) Name() string {
return "CastDouble"
}
type CastDouble struct { type CastDouble struct {
Cast Cast
} }
@ -11,7 +15,7 @@ type CastDouble struct {
func NewCastDouble(expr node.Node) node.Node { func NewCastDouble(expr node.Node) node.Node {
return CastDouble{ return CastDouble{
Cast{ Cast{
node.SimpleNode{Name: "CastDouble", Attributes: make(map[string]string)}, "CastDouble",
expr, expr,
}, },
} }

View File

@ -4,6 +4,10 @@ import (
"github.com/z7zmey/php-parser/node" "github.com/z7zmey/php-parser/node"
) )
func (n CastInt) Name() string {
return "CastInt"
}
type CastInt struct { type CastInt struct {
Cast Cast
} }
@ -11,7 +15,7 @@ type CastInt struct {
func NewCastInt(expr node.Node) node.Node { func NewCastInt(expr node.Node) node.Node {
return CastInt{ return CastInt{
Cast{ Cast{
node.SimpleNode{Name: "CastInt", Attributes: make(map[string]string)}, "CastInt",
expr, expr,
}, },
} }

View File

@ -4,6 +4,10 @@ import (
"github.com/z7zmey/php-parser/node" "github.com/z7zmey/php-parser/node"
) )
func (n CastObject) Name() string {
return "CastObject"
}
type CastObject struct { type CastObject struct {
Cast Cast
} }
@ -11,7 +15,7 @@ type CastObject struct {
func NewCastObject(expr node.Node) node.Node { func NewCastObject(expr node.Node) node.Node {
return CastObject{ return CastObject{
Cast{ Cast{
node.SimpleNode{Name: "CastObject", Attributes: make(map[string]string)}, "CastObject",
expr, expr,
}, },
} }

View File

@ -4,6 +4,10 @@ import (
"github.com/z7zmey/php-parser/node" "github.com/z7zmey/php-parser/node"
) )
func (n CastString) Name() string {
return "CastString"
}
type CastString struct { type CastString struct {
Cast Cast
} }
@ -11,7 +15,7 @@ type CastString struct {
func NewCastString(expr node.Node) node.Node { func NewCastString(expr node.Node) node.Node {
return CastString{ return CastString{
Cast{ Cast{
node.SimpleNode{Name: "CastString", Attributes: make(map[string]string)}, "CastString",
expr, expr,
}, },
} }

View File

@ -4,6 +4,10 @@ import (
"github.com/z7zmey/php-parser/node" "github.com/z7zmey/php-parser/node"
) )
func (n CastUnset) Name() string {
return "CastUnset"
}
type CastUnset struct { type CastUnset struct {
Cast Cast
} }
@ -11,7 +15,7 @@ type CastUnset struct {
func NewCastUnset(expr node.Node) node.Node { func NewCastUnset(expr node.Node) node.Node {
return CastUnset{ return CastUnset{
Cast{ Cast{
node.SimpleNode{Name: "CastUnset", Attributes: make(map[string]string)}, "CastUnset",
expr, expr,
}, },
} }

View File

@ -8,23 +8,27 @@ import (
"github.com/z7zmey/php-parser/token" "github.com/z7zmey/php-parser/token"
) )
type ClassConstFetch struct { func (n ClassConstFetch) Name() string {
node.SimpleNode return "ClassConstFetch"
class node.Node
name token.Token
} }
func NewClassConstFetch(class node.Node, name token.Token) node.Node { type ClassConstFetch struct {
name string
class node.Node
constant token.Token
}
func NewClassConstFetch(class node.Node, constant token.Token) node.Node {
return ClassConstFetch{ return ClassConstFetch{
node.SimpleNode{Name: "ClassConstFetch", Attributes: make(map[string]string)}, "ClassConstFetch",
class, class,
name, constant,
} }
} }
func (n ClassConstFetch) Print(out io.Writer, indent string) { func (n ClassConstFetch) Print(out io.Writer, indent string) {
fmt.Fprintf(out, "\n%v%v [- -]", indent, n.Name) fmt.Fprintf(out, "\n%v%v [- -]", indent, n.name)
fmt.Fprintf(out, "\n%vname: %q", indent+" ", n.name) fmt.Fprintf(out, "\n%vname: %q", indent+" ", n.constant.Value)
if n.class != nil { if n.class != nil {
fmt.Fprintf(out, "\n%vclass:", indent+" ") fmt.Fprintf(out, "\n%vclass:", indent+" ")

View File

@ -7,20 +7,24 @@ import (
"github.com/z7zmey/php-parser/node" "github.com/z7zmey/php-parser/node"
) )
func (n Clone) Name() string {
return "Clone"
}
type Clone struct { type Clone struct {
node.SimpleNode name string
expr node.Node expr node.Node
} }
func NewClone(expression node.Node) node.Node { func NewClone(expression node.Node) node.Node {
return Clone{ return Clone{
node.SimpleNode{Name: "Clone", Attributes: make(map[string]string)}, "Clone",
expression, expression,
} }
} }
func (n Clone) Print(out io.Writer, indent string) { func (n Clone) Print(out io.Writer, indent string) {
fmt.Fprintf(out, "\n%v%v [- -]", indent, n.Name) fmt.Fprintf(out, "\n%v%v [- -]", indent, n.name)
if n.expr != nil { if n.expr != nil {
fmt.Fprintf(out, "\n%vexpr:", indent+" ") fmt.Fprintf(out, "\n%vexpr:", indent+" ")

View File

@ -7,8 +7,12 @@ import (
"github.com/z7zmey/php-parser/node" "github.com/z7zmey/php-parser/node"
) )
func (n Closure) Name() string {
return "Closure"
}
type Closure struct { type Closure struct {
node.SimpleNode name string
params []node.Node params []node.Node
uses []node.Node uses []node.Node
returnType node.Node returnType node.Node
@ -19,7 +23,7 @@ type Closure struct {
func NewClosure(params []node.Node, uses []node.Node, returnType node.Node, stmts []node.Node, isStatic bool, isReturnRef bool) node.Node { func NewClosure(params []node.Node, uses []node.Node, returnType node.Node, stmts []node.Node, isStatic bool, isReturnRef bool) node.Node {
return Closure{ return Closure{
node.SimpleNode{Name: "Closure", Attributes: make(map[string]string)}, "Closure",
params, params,
uses, uses,
returnType, returnType,
@ -30,7 +34,7 @@ func NewClosure(params []node.Node, uses []node.Node, returnType node.Node, stmt
} }
func (n Closure) Print(out io.Writer, indent string) { func (n Closure) Print(out io.Writer, indent string) {
fmt.Fprintf(out, "\n%v%v [- -]", indent, n.Name) fmt.Fprintf(out, "\n%v%v [- -]", indent, n.name)
fmt.Fprintf(out, "\n%vis static: %t", indent+" ", n.isStatic) fmt.Fprintf(out, "\n%vis static: %t", indent+" ", n.isStatic)
fmt.Fprintf(out, "\n%vis return ref: %t", indent+" ", n.isReturnRef) fmt.Fprintf(out, "\n%vis return ref: %t", indent+" ", n.isReturnRef)

View File

@ -7,22 +7,26 @@ import (
"github.com/z7zmey/php-parser/node" "github.com/z7zmey/php-parser/node"
) )
func (n ClusureUse) Name() string {
return "ClusureUse"
}
type ClusureUse struct { type ClusureUse struct {
node.SimpleNode name string
variable node.Node variable node.Node
byRef bool byRef bool
} }
func NewClusureUse(variable node.Node, byRef bool) node.Node { func NewClusureUse(variable node.Node, byRef bool) node.Node {
return ClusureUse{ return ClusureUse{
node.SimpleNode{Name: "ClusureUse", Attributes: make(map[string]string)}, "ClusureUse",
variable, variable,
byRef, byRef,
} }
} }
func (n ClusureUse) Print(out io.Writer, indent string) { func (n ClusureUse) Print(out io.Writer, indent string) {
fmt.Fprintf(out, "\n%v%v [- -]", indent, n.Name) fmt.Fprintf(out, "\n%v%v [- -]", indent, n.name)
fmt.Fprintf(out, "\n%vby ref: %t", indent+" ", n.byRef) fmt.Fprintf(out, "\n%vby ref: %t", indent+" ", n.byRef)
if n.variable != nil { if n.variable != nil {

View File

@ -7,23 +7,27 @@ import (
"github.com/z7zmey/php-parser/node" "github.com/z7zmey/php-parser/node"
) )
type ConstFetch struct { func (n ConstFetch) Name() string {
node.SimpleNode return "ConstFetch"
name node.Node
} }
func NewConstFetch(name node.Node) node.Node { type ConstFetch struct {
name string
constant node.Node
}
func NewConstFetch(constant node.Node) node.Node {
return ConstFetch{ return ConstFetch{
node.SimpleNode{Name: "ConstFetch", Attributes: make(map[string]string)}, "ConstFetch",
name, constant,
} }
} }
func (n ConstFetch) Print(out io.Writer, indent string) { func (n ConstFetch) Print(out io.Writer, indent string) {
fmt.Fprintf(out, "\n%v%v [- -]", indent, n.Name) fmt.Fprintf(out, "\n%v%v [- -]", indent, n.name)
if n.name != nil { if n.constant != nil {
fmt.Fprintf(out, "\n%vname:", indent+" ") fmt.Fprintf(out, "\n%vconstant:", indent+" ")
n.name.Print(out, indent+" ") n.constant.Print(out, indent+" ")
} }
} }

View File

@ -7,20 +7,24 @@ import (
"github.com/z7zmey/php-parser/node" "github.com/z7zmey/php-parser/node"
) )
func (n Empty) Name() string {
return "Empty"
}
type Empty struct { type Empty struct {
node.SimpleNode name string
expr node.Node expr node.Node
} }
func NewEmpty(expression node.Node) node.Node { func NewEmpty(expression node.Node) node.Node {
return Empty{ return Empty{
node.SimpleNode{Name: "Empty", Attributes: make(map[string]string)}, "Empty",
expression, expression,
} }
} }
func (n Empty) Print(out io.Writer, indent string) { func (n Empty) Print(out io.Writer, indent string) {
fmt.Fprintf(out, "\n%v%v [- -]", indent, n.Name) fmt.Fprintf(out, "\n%v%v [- -]", indent, n.name)
if n.expr != nil { if n.expr != nil {
fmt.Fprintf(out, "\n%vexpr:", indent+" ") fmt.Fprintf(out, "\n%vexpr:", indent+" ")

View File

@ -7,20 +7,24 @@ import (
"github.com/z7zmey/php-parser/node" "github.com/z7zmey/php-parser/node"
) )
func (n ErrorSuppress) Name() string {
return "ErrorSuppress"
}
type ErrorSuppress struct { type ErrorSuppress struct {
node.SimpleNode name string
expr node.Node expr node.Node
} }
func NewErrorSuppress(expression node.Node) node.Node { func NewErrorSuppress(expression node.Node) node.Node {
return ErrorSuppress{ return ErrorSuppress{
node.SimpleNode{Name: "ErrorSuppress", Attributes: make(map[string]string)}, "ErrorSuppress",
expression, expression,
} }
} }
func (n ErrorSuppress) Print(out io.Writer, indent string) { func (n ErrorSuppress) Print(out io.Writer, indent string) {
fmt.Fprintf(out, "\n%v%v [- -]", indent, n.Name) fmt.Fprintf(out, "\n%v%v [- -]", indent, n.name)
if n.expr != nil { if n.expr != nil {
fmt.Fprintf(out, "\n%vexpr:", indent+" ") fmt.Fprintf(out, "\n%vexpr:", indent+" ")

View File

@ -7,20 +7,24 @@ import (
"github.com/z7zmey/php-parser/node" "github.com/z7zmey/php-parser/node"
) )
func (n Eval) Name() string {
return "Eval"
}
type Eval struct { type Eval struct {
node.SimpleNode name string
expr node.Node expr node.Node
} }
func NewEval(expression node.Node) node.Node { func NewEval(expression node.Node) node.Node {
return Eval{ return Eval{
node.SimpleNode{Name: "Eval", Attributes: make(map[string]string)}, "Eval",
expression, expression,
} }
} }
func (n Eval) Print(out io.Writer, indent string) { func (n Eval) Print(out io.Writer, indent string) {
fmt.Fprintf(out, "\n%v%v [- -]", indent, n.Name) fmt.Fprintf(out, "\n%v%v [- -]", indent, n.name)
if n.expr != nil { if n.expr != nil {
fmt.Fprintf(out, "\n%vexpr:", indent+" ") fmt.Fprintf(out, "\n%vexpr:", indent+" ")

View File

@ -7,22 +7,26 @@ import (
"github.com/z7zmey/php-parser/node" "github.com/z7zmey/php-parser/node"
) )
func (n Exit) Name() string {
return "Exit"
}
type Exit struct { type Exit struct {
node.SimpleNode name string
expr node.Node expr node.Node
isDie bool isDie bool
} }
func NewExit(expr node.Node, isDie bool) node.Node { func NewExit(expr node.Node, isDie bool) node.Node {
return Exit{ return Exit{
node.SimpleNode{Name: "Exit", Attributes: make(map[string]string)}, "Exit",
expr, expr,
isDie, isDie,
} }
} }
func (n Exit) Print(out io.Writer, indent string) { func (n Exit) Print(out io.Writer, indent string) {
fmt.Fprintf(out, "\n%v%v [- -]", indent, n.Name) fmt.Fprintf(out, "\n%v%v [- -]", indent, n.name)
fmt.Fprintf(out, "\n%vis die: %t", indent+" ", n.isDie) fmt.Fprintf(out, "\n%vis die: %t", indent+" ", n.isDie)
if n.expr != nil { if n.expr != nil {

View File

@ -7,22 +7,26 @@ import (
"github.com/z7zmey/php-parser/node" "github.com/z7zmey/php-parser/node"
) )
func (n FunctionCall) Name() string {
return "FunctionCall"
}
type FunctionCall struct { type FunctionCall struct {
node.SimpleNode name string
function node.Node function node.Node
arguments []node.Node arguments []node.Node
} }
func NewFunctionCall(function node.Node, arguments []node.Node) node.Node { func NewFunctionCall(function node.Node, arguments []node.Node) node.Node {
return FunctionCall{ return FunctionCall{
node.SimpleNode{Name: "FunctionCall", Attributes: make(map[string]string)}, "FunctionCall",
function, function,
arguments, arguments,
} }
} }
func (n FunctionCall) Print(out io.Writer, indent string) { func (n FunctionCall) Print(out io.Writer, indent string) {
fmt.Fprintf(out, "\n%v%v [- -]", indent, n.Name) fmt.Fprintf(out, "\n%v%v [- -]", indent, n.name)
if n.function != nil { if n.function != nil {
fmt.Fprintf(out, "\n%vfunction:", indent+" ") fmt.Fprintf(out, "\n%vfunction:", indent+" ")

View File

@ -7,20 +7,24 @@ import (
"github.com/z7zmey/php-parser/node" "github.com/z7zmey/php-parser/node"
) )
func (n Include) Name() string {
return "Include"
}
type Include struct { type Include struct {
node.SimpleNode name string
expr node.Node expr node.Node
} }
func NewInclude(expression node.Node) node.Node { func NewInclude(expression node.Node) node.Node {
return Include{ return Include{
node.SimpleNode{Name: "Include", Attributes: make(map[string]string)}, "Include",
expression, expression,
} }
} }
func (n Include) Print(out io.Writer, indent string) { func (n Include) Print(out io.Writer, indent string) {
fmt.Fprintf(out, "\n%v%v [- -]", indent, n.Name) fmt.Fprintf(out, "\n%v%v [- -]", indent, n.name)
if n.expr != nil { if n.expr != nil {
fmt.Fprintf(out, "\n%vexpr:", indent+" ") fmt.Fprintf(out, "\n%vexpr:", indent+" ")

View File

@ -7,20 +7,24 @@ import (
"github.com/z7zmey/php-parser/node" "github.com/z7zmey/php-parser/node"
) )
func (n IncludeOnce) Name() string {
return "IncludeOnce"
}
type IncludeOnce struct { type IncludeOnce struct {
node.SimpleNode name string
expr node.Node expr node.Node
} }
func NewIncludeOnce(expression node.Node) node.Node { func NewIncludeOnce(expression node.Node) node.Node {
return IncludeOnce{ return IncludeOnce{
node.SimpleNode{Name: "IncludeOnce", Attributes: make(map[string]string)}, "IncludeOnce",
expression, expression,
} }
} }
func (n IncludeOnce) Print(out io.Writer, indent string) { func (n IncludeOnce) Print(out io.Writer, indent string) {
fmt.Fprintf(out, "\n%v%v [- -]", indent, n.Name) fmt.Fprintf(out, "\n%v%v [- -]", indent, n.name)
if n.expr != nil { if n.expr != nil {
fmt.Fprintf(out, "\n%vexpr:", indent+" ") fmt.Fprintf(out, "\n%vexpr:", indent+" ")

View File

@ -7,22 +7,26 @@ import (
"github.com/z7zmey/php-parser/node" "github.com/z7zmey/php-parser/node"
) )
func (n InstanceOf) Name() string {
return "InstanceOf"
}
type InstanceOf struct { type InstanceOf struct {
node.SimpleNode name string
expr node.Node expr node.Node
class node.Node class node.Node
} }
func NewInstanceOf(expr node.Node, class node.Node) node.Node { func NewInstanceOf(expr node.Node, class node.Node) node.Node {
return InstanceOf{ return InstanceOf{
node.SimpleNode{Name: "InstanceOf", Attributes: make(map[string]string)}, "InstanceOf",
expr, expr,
class, class,
} }
} }
func (n InstanceOf) Print(out io.Writer, indent string) { func (n InstanceOf) Print(out io.Writer, indent string) {
fmt.Fprintf(out, "\n%v%v [- -]", indent, n.Name) fmt.Fprintf(out, "\n%v%v [- -]", indent, n.name)
if n.expr != nil { if n.expr != nil {
fmt.Fprintf(out, "\n%vexpr:", indent+" ") fmt.Fprintf(out, "\n%vexpr:", indent+" ")

View File

@ -7,20 +7,24 @@ import (
"github.com/z7zmey/php-parser/node" "github.com/z7zmey/php-parser/node"
) )
func (n Isset) Name() string {
return "Isset"
}
type Isset struct { type Isset struct {
node.SimpleNode name string
variables []node.Node variables []node.Node
} }
func NewIsset(variables []node.Node) node.Node { func NewIsset(variables []node.Node) node.Node {
return Isset{ return Isset{
node.SimpleNode{Name: "Isset", Attributes: make(map[string]string)}, "Isset",
variables, variables,
} }
} }
func (n Isset) Print(out io.Writer, indent string) { func (n Isset) Print(out io.Writer, indent string) {
fmt.Fprintf(out, "\n%v%v [- -]", indent, n.Name) fmt.Fprintf(out, "\n%v%v [- -]", indent, n.name)
if n.variables != nil { if n.variables != nil {
fmt.Fprintf(out, "\n%vvariables:", indent+" ") fmt.Fprintf(out, "\n%vvariables:", indent+" ")

View File

@ -7,20 +7,24 @@ import (
"github.com/z7zmey/php-parser/node" "github.com/z7zmey/php-parser/node"
) )
func (n List) Name() string {
return "List"
}
type List struct { type List struct {
node.SimpleNode name string
items []node.Node items []node.Node
} }
func NewList(items []node.Node) node.Node { func NewList(items []node.Node) node.Node {
return List{ return List{
node.SimpleNode{Name: "List", Attributes: make(map[string]string)}, "List",
items, items,
} }
} }
func (n List) Print(out io.Writer, indent string) { func (n List) Print(out io.Writer, indent string) {
fmt.Fprintf(out, "\n%v%v [- -]", indent, n.Name) fmt.Fprintf(out, "\n%v%v [- -]", indent, n.name)
if n.items != nil { if n.items != nil {
fmt.Fprintf(out, "\n%vitems:", indent+" ") fmt.Fprintf(out, "\n%vitems:", indent+" ")

View File

@ -7,33 +7,37 @@ import (
"github.com/z7zmey/php-parser/node" "github.com/z7zmey/php-parser/node"
) )
func (n MethodCall) Name() string {
return "MethodCall"
}
type MethodCall struct { type MethodCall struct {
node.SimpleNode name string
variable node.Node variable node.Node
name node.Node method node.Node
arguments []node.Node arguments []node.Node
} }
func NewMethodCall(variable node.Node, name node.Node, arguments []node.Node) node.Node { func NewMethodCall(variable node.Node, method node.Node, arguments []node.Node) node.Node {
return MethodCall{ return MethodCall{
node.SimpleNode{Name: "MethodCall", Attributes: make(map[string]string)}, "MethodCall",
variable, variable,
name, method,
arguments, arguments,
} }
} }
func (n MethodCall) Print(out io.Writer, indent string) { func (n MethodCall) Print(out io.Writer, indent string) {
fmt.Fprintf(out, "\n%v%v [- -]", indent, n.Name) fmt.Fprintf(out, "\n%v%v [- -]", indent, n.name)
if n.variable != nil { if n.variable != nil {
fmt.Fprintf(out, "\n%vvariable:", indent+" ") fmt.Fprintf(out, "\n%vvariable:", indent+" ")
n.variable.Print(out, indent+" ") n.variable.Print(out, indent+" ")
} }
if n.name != nil { if n.method != nil {
fmt.Fprintf(out, "\n%vname:", indent+" ") fmt.Fprintf(out, "\n%vmethod:", indent+" ")
n.name.Print(out, indent+" ") n.method.Print(out, indent+" ")
} }
if n.arguments != nil { if n.arguments != nil {

View File

@ -7,22 +7,26 @@ import (
"github.com/z7zmey/php-parser/node" "github.com/z7zmey/php-parser/node"
) )
func (n New) Name() string {
return "New"
}
type New struct { type New struct {
node.SimpleNode name string
class node.Node class node.Node
arguments []node.Node arguments []node.Node
} }
func NewNew(class node.Node, arguments []node.Node) node.Node { func NewNew(class node.Node, arguments []node.Node) node.Node {
return New{ return New{
node.SimpleNode{Name: "New", Attributes: make(map[string]string)}, "New",
class, class,
arguments, arguments,
} }
} }
func (n New) Print(out io.Writer, indent string) { func (n New) Print(out io.Writer, indent string) {
fmt.Fprintf(out, "\n%v%v [- -]", indent, n.Name) fmt.Fprintf(out, "\n%v%v [- -]", indent, n.name)
if n.class != nil { if n.class != nil {
fmt.Fprintf(out, "\n%vclass:", indent+" ") fmt.Fprintf(out, "\n%vclass:", indent+" ")

View File

@ -7,20 +7,24 @@ import (
"github.com/z7zmey/php-parser/node" "github.com/z7zmey/php-parser/node"
) )
func (n PostDec) Name() string {
return "PostDec"
}
type PostDec struct { type PostDec struct {
node.SimpleNode name string
variable node.Node variable node.Node
} }
func NewPostDec(variableession node.Node) node.Node { func NewPostDec(variableession node.Node) node.Node {
return PostDec{ return PostDec{
node.SimpleNode{Name: "PostDec", Attributes: make(map[string]string)}, "PostDec",
variableession, variableession,
} }
} }
func (n PostDec) Print(out io.Writer, indent string) { func (n PostDec) Print(out io.Writer, indent string) {
fmt.Fprintf(out, "\n%v%v [- -]", indent, n.Name) fmt.Fprintf(out, "\n%v%v [- -]", indent, n.name)
if n.variable != nil { if n.variable != nil {
fmt.Fprintf(out, "\n%vvariable:", indent+" ") fmt.Fprintf(out, "\n%vvariable:", indent+" ")

View File

@ -7,20 +7,24 @@ import (
"github.com/z7zmey/php-parser/node" "github.com/z7zmey/php-parser/node"
) )
func (n PostInc) Name() string {
return "PostInc"
}
type PostInc struct { type PostInc struct {
node.SimpleNode name string
variable node.Node variable node.Node
} }
func NewPostInc(variableession node.Node) node.Node { func NewPostInc(variableession node.Node) node.Node {
return PostInc{ return PostInc{
node.SimpleNode{Name: "PostInc", Attributes: make(map[string]string)}, "PostInc",
variableession, variableession,
} }
} }
func (n PostInc) Print(out io.Writer, indent string) { func (n PostInc) Print(out io.Writer, indent string) {
fmt.Fprintf(out, "\n%v%v [- -]", indent, n.Name) fmt.Fprintf(out, "\n%v%v [- -]", indent, n.name)
if n.variable != nil { if n.variable != nil {
fmt.Fprintf(out, "\n%vvariable:", indent+" ") fmt.Fprintf(out, "\n%vvariable:", indent+" ")

View File

@ -7,20 +7,24 @@ import (
"github.com/z7zmey/php-parser/node" "github.com/z7zmey/php-parser/node"
) )
func (n PreDec) Name() string {
return "PreDec"
}
type PreDec struct { type PreDec struct {
node.SimpleNode name string
variable node.Node variable node.Node
} }
func NewPreDec(variableession node.Node) node.Node { func NewPreDec(variableession node.Node) node.Node {
return PreDec{ return PreDec{
node.SimpleNode{Name: "PreDec", Attributes: make(map[string]string)}, "PreDec",
variableession, variableession,
} }
} }
func (n PreDec) Print(out io.Writer, indent string) { func (n PreDec) Print(out io.Writer, indent string) {
fmt.Fprintf(out, "\n%v%v [- -]", indent, n.Name) fmt.Fprintf(out, "\n%v%v [- -]", indent, n.name)
if n.variable != nil { if n.variable != nil {
fmt.Fprintf(out, "\n%vvariable:", indent+" ") fmt.Fprintf(out, "\n%vvariable:", indent+" ")

View File

@ -7,20 +7,24 @@ import (
"github.com/z7zmey/php-parser/node" "github.com/z7zmey/php-parser/node"
) )
func (n PreInc) Name() string {
return "PreInc"
}
type PreInc struct { type PreInc struct {
node.SimpleNode name string
variable node.Node variable node.Node
} }
func NewPreInc(variableession node.Node) node.Node { func NewPreInc(variableession node.Node) node.Node {
return PreInc{ return PreInc{
node.SimpleNode{Name: "PreInc", Attributes: make(map[string]string)}, "PreInc",
variableession, variableession,
} }
} }
func (n PreInc) Print(out io.Writer, indent string) { func (n PreInc) Print(out io.Writer, indent string) {
fmt.Fprintf(out, "\n%v%v [- -]", indent, n.Name) fmt.Fprintf(out, "\n%v%v [- -]", indent, n.name)
if n.variable != nil { if n.variable != nil {
fmt.Fprintf(out, "\n%vvariable:", indent+" ") fmt.Fprintf(out, "\n%vvariable:", indent+" ")

View File

@ -7,20 +7,24 @@ import (
"github.com/z7zmey/php-parser/node" "github.com/z7zmey/php-parser/node"
) )
func (n Print) Name() string {
return "Print"
}
type Print struct { type Print struct {
node.SimpleNode name string
expr node.Node expr node.Node
} }
func NewPrint(expression node.Node) node.Node { func NewPrint(expression node.Node) node.Node {
return Print{ return Print{
node.SimpleNode{Name: "Print", Attributes: make(map[string]string)}, "Print",
expression, expression,
} }
} }
func (n Print) Print(out io.Writer, indent string) { func (n Print) Print(out io.Writer, indent string) {
fmt.Fprintf(out, "\n%v%v [- -]", indent, n.Name) fmt.Fprintf(out, "\n%v%v [- -]", indent, n.name)
if n.expr != nil { if n.expr != nil {
fmt.Fprintf(out, "\n%vexpr:", indent+" ") fmt.Fprintf(out, "\n%vexpr:", indent+" ")

View File

@ -7,30 +7,34 @@ import (
"github.com/z7zmey/php-parser/node" "github.com/z7zmey/php-parser/node"
) )
type PropertyFetch struct { func (n PropertyFetch) Name() string {
node.SimpleNode return "PropertyFetch"
variable node.Node
name node.Node
} }
func NewPropertyFetch(variable node.Node, name node.Node) node.Node { type PropertyFetch struct {
name string
variable node.Node
property node.Node
}
func NewPropertyFetch(variable node.Node, property node.Node) node.Node {
return PropertyFetch{ return PropertyFetch{
node.SimpleNode{Name: "PropertyFetch", Attributes: make(map[string]string)}, "PropertyFetch",
variable, variable,
name, property,
} }
} }
func (n PropertyFetch) Print(out io.Writer, indent string) { func (n PropertyFetch) Print(out io.Writer, indent string) {
fmt.Fprintf(out, "\n%v%v [- -]", indent, n.Name) fmt.Fprintf(out, "\n%v%v [- -]", indent, n.name)
if n.variable != nil { if n.variable != nil {
fmt.Fprintf(out, "\n%vvariable:", indent+" ") fmt.Fprintf(out, "\n%vvariable:", indent+" ")
n.variable.Print(out, indent+" ") n.variable.Print(out, indent+" ")
} }
if n.name != nil { if n.property != nil {
fmt.Fprintf(out, "\n%vname:", indent+" ") fmt.Fprintf(out, "\n%vproperty:", indent+" ")
n.name.Print(out, indent+" ") n.property.Print(out, indent+" ")
} }
} }

View File

@ -7,20 +7,24 @@ import (
"github.com/z7zmey/php-parser/node" "github.com/z7zmey/php-parser/node"
) )
func(n Require) Name() string {
return "Require"
}
type Require struct { type Require struct {
node.SimpleNode name string
expr node.Node expr node.Node
} }
func NewRequire(expression node.Node) node.Node { func NewRequire(expression node.Node) node.Node {
return Require{ return Require{
node.SimpleNode{Name: "Require", Attributes: make(map[string]string)}, "Require",
expression, expression,
} }
} }
func (n Require) Print(out io.Writer, indent string) { func (n Require) Print(out io.Writer, indent string) {
fmt.Fprintf(out, "\n%v%v [- -]", indent, n.Name) fmt.Fprintf(out, "\n%v%v [- -]", indent, n.name)
if n.expr != nil { if n.expr != nil {
fmt.Fprintf(out, "\n%vexpr:", indent+" ") fmt.Fprintf(out, "\n%vexpr:", indent+" ")

View File

@ -7,20 +7,24 @@ import (
"github.com/z7zmey/php-parser/node" "github.com/z7zmey/php-parser/node"
) )
func (n RequireOnce) Name() string {
return "RequireOnce"
}
type RequireOnce struct { type RequireOnce struct {
node.SimpleNode name string
expr node.Node expr node.Node
} }
func NewRequireOnce(expression node.Node) node.Node { func NewRequireOnce(expression node.Node) node.Node {
return RequireOnce{ return RequireOnce{
node.SimpleNode{Name: "RequireOnce", Attributes: make(map[string]string)}, "RequireOnce",
expression, expression,
} }
} }
func (n RequireOnce) Print(out io.Writer, indent string) { func (n RequireOnce) Print(out io.Writer, indent string) {
fmt.Fprintf(out, "\n%v%v [- -]", indent, n.Name) fmt.Fprintf(out, "\n%v%v [- -]", indent, n.name)
if n.expr != nil { if n.expr != nil {
fmt.Fprintf(out, "\n%vexpr:", indent+" ") fmt.Fprintf(out, "\n%vexpr:", indent+" ")

View File

@ -7,20 +7,24 @@ import (
"github.com/z7zmey/php-parser/node" "github.com/z7zmey/php-parser/node"
) )
func (n ShellExec) Name() string {
return "ShellExec"
}
type ShellExec struct { type ShellExec struct {
node.SimpleNode name string
parts []node.Node parts []node.Node
} }
func NewShellExec(parts []node.Node) node.Node { func NewShellExec(parts []node.Node) node.Node {
return ShellExec{ return ShellExec{
node.SimpleNode{Name: "ShellExec", Attributes: make(map[string]string)}, "ShellExec",
parts, parts,
} }
} }
func (n ShellExec) Print(out io.Writer, indent string) { func (n ShellExec) Print(out io.Writer, indent string) {
fmt.Fprintf(out, "\n%v%v [- -]", indent, n.Name) fmt.Fprintf(out, "\n%v%v [- -]", indent, n.name)
if n.parts != nil { if n.parts != nil {
fmt.Fprintf(out, "\n%vparts:", indent+" ") fmt.Fprintf(out, "\n%vparts:", indent+" ")

View File

@ -8,8 +8,12 @@ import (
"github.com/z7zmey/php-parser/token" "github.com/z7zmey/php-parser/token"
) )
func (n ShortArray) Name() string {
return "ShortArray"
}
type ShortArray struct { type ShortArray struct {
node.SimpleNode name string
opentToken token.Token opentToken token.Token
closeToken token.Token closeToken token.Token
items []node.Node items []node.Node
@ -17,7 +21,7 @@ type ShortArray struct {
func NewShortArray(opentToken token.Token, closeToken token.Token, items []node.Node) node.Node { func NewShortArray(opentToken token.Token, closeToken token.Token, items []node.Node) node.Node {
return ShortArray{ return ShortArray{
node.SimpleNode{Name: "ShortArray", Attributes: make(map[string]string)}, "ShortArray",
opentToken, opentToken,
closeToken, closeToken,
items, items,
@ -25,7 +29,7 @@ func NewShortArray(opentToken token.Token, closeToken token.Token, items []node.
} }
func (n ShortArray) Print(out io.Writer, indent string) { func (n ShortArray) Print(out io.Writer, indent string) {
fmt.Fprintf(out, "\n%v%v [%d %d]", indent, n.Name, n.opentToken.StartLine, n.closeToken.EndLine) fmt.Fprintf(out, "\n%v%v [%d %d]", indent, n.name, n.opentToken.StartLine, n.closeToken.EndLine)
if n.items != nil { if n.items != nil {
fmt.Fprintf(out, "\n%vitems:", indent+" ") fmt.Fprintf(out, "\n%vitems:", indent+" ")

View File

@ -7,20 +7,24 @@ import (
"github.com/z7zmey/php-parser/node" "github.com/z7zmey/php-parser/node"
) )
func (n ShortList) Name() string {
return "ShortList"
}
type ShortList struct { type ShortList struct {
node.SimpleNode name string
items []node.Node items []node.Node
} }
func NewShortList(items []node.Node) node.Node { func NewShortList(items []node.Node) node.Node {
return ShortList{ return ShortList{
node.SimpleNode{Name: "ShortList", Attributes: make(map[string]string)}, "ShortList",
items, items,
} }
} }
func (n ShortList) Print(out io.Writer, indent string) { func (n ShortList) Print(out io.Writer, indent string) {
fmt.Fprintf(out, "\n%v%v [- -]", indent, n.Name) fmt.Fprintf(out, "\n%v%v [- -]", indent, n.name)
if n.items != nil { if n.items != nil {
fmt.Fprintf(out, "\n%vitems:", indent+" ") fmt.Fprintf(out, "\n%vitems:", indent+" ")

View File

@ -7,33 +7,37 @@ import (
"github.com/z7zmey/php-parser/node" "github.com/z7zmey/php-parser/node"
) )
func (n StaticCall) Name() string {
return "StaticCall"
}
type StaticCall struct { type StaticCall struct {
node.SimpleNode name string
class node.Node class node.Node
name node.Node call node.Node
arguments []node.Node arguments []node.Node
} }
func NewStaticCall(class node.Node, name node.Node, arguments []node.Node) node.Node { func NewStaticCall(class node.Node, call node.Node, arguments []node.Node) node.Node {
return StaticCall{ return StaticCall{
node.SimpleNode{Name: "StaticCall", Attributes: make(map[string]string)}, "StaticCall",
class, class,
name, call,
arguments, arguments,
} }
} }
func (n StaticCall) Print(out io.Writer, indent string) { func (n StaticCall) Print(out io.Writer, indent string) {
fmt.Fprintf(out, "\n%v%v [- -]", indent, n.Name) fmt.Fprintf(out, "\n%v%v [- -]", indent, n.name)
if n.class != nil { if n.class != nil {
fmt.Fprintf(out, "\n%vclass:", indent+" ") fmt.Fprintf(out, "\n%vclass:", indent+" ")
n.class.Print(out, indent+" ") n.class.Print(out, indent+" ")
} }
if n.name != nil { if n.call != nil {
fmt.Fprintf(out, "\n%vname:", indent+" ") fmt.Fprintf(out, "\n%vcall:", indent+" ")
n.name.Print(out, indent+" ") n.call.Print(out, indent+" ")
} }
if n.arguments != nil { if n.arguments != nil {

View File

@ -7,30 +7,34 @@ import (
"github.com/z7zmey/php-parser/node" "github.com/z7zmey/php-parser/node"
) )
type StaticPropertyFetch struct { func (n StaticPropertyFetch) Name() string {
node.SimpleNode return "StaticPropertyFetch"
class node.Node
name node.Node
} }
func NewStaticPropertyFetch(class node.Node, name node.Node) node.Node { type StaticPropertyFetch struct {
name string
class node.Node
property node.Node
}
func NewStaticPropertyFetch(class node.Node, property node.Node) node.Node {
return StaticPropertyFetch{ return StaticPropertyFetch{
node.SimpleNode{Name: "StaticPropertyFetch", Attributes: make(map[string]string)}, "StaticPropertyFetch",
class, class,
name, property,
} }
} }
func (n StaticPropertyFetch) Print(out io.Writer, indent string) { func (n StaticPropertyFetch) Print(out io.Writer, indent string) {
fmt.Fprintf(out, "\n%v%v [- -]", indent, n.Name) fmt.Fprintf(out, "\n%v%v [- -]", indent, n.name)
if n.class != nil { if n.class != nil {
fmt.Fprintf(out, "\n%vclass:", indent+" ") fmt.Fprintf(out, "\n%vclass:", indent+" ")
n.class.Print(out, indent+" ") n.class.Print(out, indent+" ")
} }
if n.name != nil { if n.property != nil {
fmt.Fprintf(out, "\n%vname:", indent+" ") fmt.Fprintf(out, "\n%vproperty:", indent+" ")
n.name.Print(out, indent+" ") n.property.Print(out, indent+" ")
} }
} }

View File

@ -7,8 +7,12 @@ import (
"github.com/z7zmey/php-parser/node" "github.com/z7zmey/php-parser/node"
) )
func (n Ternary) Name() string {
return "Ternary"
}
type Ternary struct { type Ternary struct {
node.SimpleNode name string
condition node.Node condition node.Node
ifTrue node.Node ifTrue node.Node
ifFalse node.Node ifFalse node.Node
@ -16,7 +20,7 @@ type Ternary struct {
func NewTernary(condition node.Node, ifTrue node.Node, ifFalse node.Node) node.Node { func NewTernary(condition node.Node, ifTrue node.Node, ifFalse node.Node) node.Node {
return Ternary{ return Ternary{
node.SimpleNode{Name: "Ternary", Attributes: make(map[string]string)}, "Ternary",
condition, condition,
ifTrue, ifTrue,
ifFalse, ifFalse,
@ -24,7 +28,7 @@ func NewTernary(condition node.Node, ifTrue node.Node, ifFalse node.Node) node.N
} }
func (n Ternary) Print(out io.Writer, indent string) { func (n Ternary) Print(out io.Writer, indent string) {
fmt.Fprintf(out, "\n%v%v [- -]", indent, n.Name) fmt.Fprintf(out, "\n%v%v [- -]", indent, n.name)
if n.condition != nil { if n.condition != nil {
fmt.Fprintf(out, "\n%vcondition:", indent+" ") fmt.Fprintf(out, "\n%vcondition:", indent+" ")

View File

@ -7,20 +7,24 @@ import (
"github.com/z7zmey/php-parser/node" "github.com/z7zmey/php-parser/node"
) )
func (n UnaryMinus) Name() string {
return "UnaryMinus"
}
type UnaryMinus struct { type UnaryMinus struct {
node.SimpleNode name string
expr node.Node expr node.Node
} }
func NewUnaryMinus(expression node.Node) node.Node { func NewUnaryMinus(expression node.Node) node.Node {
return UnaryMinus{ return UnaryMinus{
node.SimpleNode{Name: "UnaryMinus", Attributes: make(map[string]string)}, "UnaryMinus",
expression, expression,
} }
} }
func (n UnaryMinus) Print(out io.Writer, indent string) { func (n UnaryMinus) Print(out io.Writer, indent string) {
fmt.Fprintf(out, "\n%v%v [- -]", indent, n.Name) fmt.Fprintf(out, "\n%v%v [- -]", indent, n.name)
if n.expr != nil { if n.expr != nil {
fmt.Fprintf(out, "\n%vexpr:", indent+" ") fmt.Fprintf(out, "\n%vexpr:", indent+" ")

View File

@ -7,20 +7,24 @@ import (
"github.com/z7zmey/php-parser/node" "github.com/z7zmey/php-parser/node"
) )
func (n UnaryPlus) Name() string {
return "UnaryPlus"
}
type UnaryPlus struct { type UnaryPlus struct {
node.SimpleNode name string
expr node.Node expr node.Node
} }
func NewUnaryPlus(expression node.Node) node.Node { func NewUnaryPlus(expression node.Node) node.Node {
return UnaryPlus{ return UnaryPlus{
node.SimpleNode{Name: "UnaryPlus", Attributes: make(map[string]string)}, "UnaryPlus",
expression, expression,
} }
} }
func (n UnaryPlus) Print(out io.Writer, indent string) { func (n UnaryPlus) Print(out io.Writer, indent string) {
fmt.Fprintf(out, "\n%v%v [- -]", indent, n.Name) fmt.Fprintf(out, "\n%v%v [- -]", indent, n.name)
if n.expr != nil { if n.expr != nil {
fmt.Fprintf(out, "\n%vexpr:", indent+" ") fmt.Fprintf(out, "\n%vexpr:", indent+" ")

View File

@ -7,23 +7,27 @@ import (
"github.com/z7zmey/php-parser/node" "github.com/z7zmey/php-parser/node"
) )
type Variable struct { func (n Variable) Name() string {
node.SimpleNode return "Variable"
name node.Node
} }
func NewVariable(name node.Node) node.Node { type Variable struct {
name string
variable node.Node
}
func NewVariable(variable node.Node) node.Node {
return Variable{ return Variable{
node.SimpleNode{Name: "Variable", Attributes: make(map[string]string)}, "Variable",
name, variable,
} }
} }
func (n Variable) Print(out io.Writer, indent string) { func (n Variable) Print(out io.Writer, indent string) {
fmt.Fprintf(out, "\n%v%v [- -]", indent, n.Name) fmt.Fprintf(out, "\n%v%v [- -]", indent, n.name)
if n.name != nil { if n.variable != nil {
fmt.Fprintf(out, "\n%vname:", indent+" ") fmt.Fprintf(out, "\n%vvariable:", indent+" ")
n.name.Print(out, indent+" ") n.variable.Print(out, indent+" ")
} }
} }

View File

@ -7,22 +7,26 @@ import (
"github.com/z7zmey/php-parser/node" "github.com/z7zmey/php-parser/node"
) )
func (n Yield) Name() string {
return "Yield"
}
type Yield struct { type Yield struct {
node.SimpleNode name string
key node.Node key node.Node
value node.Node value node.Node
} }
func NewYield(key node.Node, value node.Node) node.Node { func NewYield(key node.Node, value node.Node) node.Node {
return Yield{ return Yield{
node.SimpleNode{Name: "Yield", Attributes: make(map[string]string)}, "Yield",
key, key,
value, value,
} }
} }
func (n Yield) Print(out io.Writer, indent string) { func (n Yield) Print(out io.Writer, indent string) {
fmt.Fprintf(out, "\n%v%v [- -]", indent, n.Name) fmt.Fprintf(out, "\n%v%v [- -]", indent, n.name)
if n.key != nil { if n.key != nil {
fmt.Fprintf(out, "\n%vkey:", indent+" ") fmt.Fprintf(out, "\n%vkey:", indent+" ")

View File

@ -7,20 +7,24 @@ import (
"github.com/z7zmey/php-parser/node" "github.com/z7zmey/php-parser/node"
) )
func (n YieldFrom) Name() string {
return "YieldFrom"
}
type YieldFrom struct { type YieldFrom struct {
node.SimpleNode name string
expr node.Node expr node.Node
} }
func NewYieldFrom(expression node.Node) node.Node { func NewYieldFrom(expression node.Node) node.Node {
return YieldFrom{ return YieldFrom{
node.SimpleNode{Name: "YieldFrom", Attributes: make(map[string]string)}, "YieldFrom",
expression, expression,
} }
} }
func (n YieldFrom) Print(out io.Writer, indent string) { func (n YieldFrom) Print(out io.Writer, indent string) {
fmt.Fprintf(out, "\n%v%v [- -]", indent, n.Name) fmt.Fprintf(out, "\n%v%v [- -]", indent, n.name)
if n.expr != nil { if n.expr != nil {
fmt.Fprintf(out, "\n%vexpr:", indent+" ") fmt.Fprintf(out, "\n%vexpr:", indent+" ")

View File

@ -8,18 +8,22 @@ import (
) )
type Identifier struct { type Identifier struct {
SimpleNode name string
name token.Token token token.Token
} }
func NewIdentifier(name token.Token) Node { func (n Identifier) Name() string {
return "Identifier"
}
func NewIdentifier(token token.Token) Node {
return Identifier{ return Identifier{
SimpleNode{Name: "Identifier", Attributes: make(map[string]string)}, "Identifier",
name, token,
} }
} }
func (n Identifier) Print(out io.Writer, indent string) { func (n Identifier) Print(out io.Writer, indent string) {
fmt.Fprintf(out, "\n%v%v [- -]", indent, n.Name) fmt.Fprintf(out, "\n%v%v [- -]", indent, n.name)
fmt.Fprintf(out, "\n%vname: %q", indent+" ", n.name.Value) fmt.Fprintf(out, "\n%vname: %q", indent+" ", n.token.Value)
} }

View File

@ -5,14 +5,18 @@ import (
) )
type FullyQualified struct { type FullyQualified struct {
Name NameNode
} }
func NewFullyQualified(parts []node.Node) node.Node { func NewFullyQualified(parts []node.Node) node.Node {
return FullyQualified{ return FullyQualified{
Name{ NameNode{
node.SimpleNode{Name: "FullyQualifiedName", Attributes: make(map[string]string)}, "FullyQualifiedName",
parts, parts,
}, },
} }
} }
func (n FullyQualified) Name() string {
return "FullyQualified"
}

View File

@ -2,26 +2,34 @@ package name
import ( import (
"fmt" "fmt"
"github.com/z7zmey/php-parser/node"
"io" "io"
"github.com/z7zmey/php-parser/node"
) )
type Name struct { func (n NameNode) Name() string {
node.SimpleNode return "Name"
}
type NameNode struct {
name string
parts []node.Node parts []node.Node
} }
func NewName(parts []node.Node) node.Node { func NewName(parts []node.Node) node.Node {
return Name{ return NameNode{
node.SimpleNode{Name: "Name", Attributes: make(map[string]string)}, "Name",
parts, parts,
} }
} }
func (n Name) Print(out io.Writer, indent string) { func (n NameNode) Print(out io.Writer, indent string) {
fmt.Fprintf(out, "\n%v%v", indent, n.Name) fmt.Fprintf(out, "\n%v%v", indent, n.name)
fmt.Fprintf(out, "\n%vparts:", indent+" ",)
if n.parts != nil {
fmt.Fprintf(out, "\n%vparts:", indent+" ")
for _, nn := range n.parts { for _, nn := range n.parts {
nn.Print(out, indent+" ") nn.Print(out, indent+" ")
} }
}
} }

View File

@ -2,26 +2,28 @@ package name
import ( import (
"fmt" "fmt"
"github.com/z7zmey/php-parser/token"
"github.com/z7zmey/php-parser/node"
"io" "io"
"github.com/z7zmey/php-parser/node"
"github.com/z7zmey/php-parser/token"
) )
func(n NamePart) Name() string {
return "NamePart"
}
type NamePart struct { type NamePart struct {
node.SimpleNode name string
token token.Token token token.Token
} }
func NewNamePart(token token.Token) node.Node { func NewNamePart(token token.Token) node.Node {
return NamePart{ return NamePart{
node.SimpleNode{Name: "NamePart", Attributes: make(map[string]string)}, "NamePart",
token, token,
} }
} }
func (n NamePart) Print(out io.Writer, indent string) { func (n NamePart) Print(out io.Writer, indent string) {
fmt.Fprintf(out, "\n%v%v [%d %d] %q", indent, n.Name, n.token.StartLine, n.token.EndLine, n.token.Value) fmt.Fprintf(out, "\n%v%v [%d %d] %q", indent, n.name, n.token.StartLine, n.token.EndLine, n.token.Value)
for _, nn := range n.Children {
nn.Print(out, indent+" ")
}
} }

View File

@ -5,15 +5,18 @@ import (
) )
type Relative struct { type Relative struct {
Name NameNode
} }
func NewRelative(parts []node.Node) node.Node { func NewRelative(parts []node.Node) node.Node {
return Relative{ return Relative{
Name{ NameNode{
node.SimpleNode{Name: "RelativeName", Attributes: make(map[string]string)}, "RelativeName",
parts, parts,
}, },
} }
} }
func (n Relative) Name() string {
return "Relative"
}

View File

@ -1,50 +1,10 @@
package node package node
import ( import (
"bytes"
"fmt"
"io" "io"
) )
type Node interface { type Node interface {
Name() string
Print(out io.Writer, indent string) Print(out io.Writer, indent string)
Append(nn ...Node) Node
Attribute(key string, value string) Node
}
type SimpleNode struct {
Name string
Children []Node
Attributes map[string]string
}
func (n SimpleNode) String() string {
buf := new(bytes.Buffer)
n.Print(buf, " ")
return buf.String()
}
func (n SimpleNode) Print(out io.Writer, indent string) {
if len(n.Attributes) > 0 {
fmt.Fprintf(out, "\n%v%v %s", indent, n.Name, n.Attributes)
} else {
fmt.Fprintf(out, "\n%v%v", indent, n.Name)
}
for _, nn := range n.Children {
nn.Print(out, indent+" ")
}
}
func NewSimpleNode(name string) Node {
return SimpleNode{Name: name, Attributes: make(map[string]string)}
}
func (n SimpleNode) Append(nn ...Node) Node {
n.Children = append(n.Children, nn...)
return n
}
func (n SimpleNode) Attribute(key string, value string) Node {
n.Attributes[key] = value
return n
} }

View File

@ -1,33 +0,0 @@
package node
import (
"fmt"
"github.com/z7zmey/php-parser/token"
"io"
)
type NodeExprShellExec struct {
*SimpleNode
startToken token.Token
endToken token.Token
parts []Node
}
func NewNodeExprShellExec(startToken token.Token, parts []Node, endToken token.Token) Node {
return NodeExprShellExec{
&SimpleNode{Name: "NodeExprShellExec", Attributes: make(map[string]string)},
startToken,
endToken,
parts,
}
}
func (n NodeExprShellExec) Print(out io.Writer, indent string) {
fmt.Fprintf(out, "\n%v%v [%d %d]", indent, n.Name, n.startToken.StartLine, n.endToken.EndLine)
fmt.Fprintf(out, "\n%vparts:", indent+" ",)
for _, nn := range n.parts {
nn.Print(out, indent+" ")
}
}

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