remove SimpleNode
This commit is contained in:
parent
e83ab79344
commit
32a285b437
@ -6,21 +6,25 @@ import (
|
||||
)
|
||||
|
||||
type Argument struct {
|
||||
SimpleNode
|
||||
name string
|
||||
expr Node
|
||||
variadic bool
|
||||
}
|
||||
|
||||
func (n Argument) Name() string {
|
||||
return "Argument"
|
||||
}
|
||||
|
||||
func NewArgument(expression Node, variadic bool) Node {
|
||||
return Argument{
|
||||
SimpleNode{Name: "Argument", Attributes: make(map[string]string)},
|
||||
"Argument",
|
||||
expression,
|
||||
variadic,
|
||||
}
|
||||
}
|
||||
|
||||
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)
|
||||
|
||||
if n.expr != nil {
|
||||
|
@ -8,8 +8,12 @@ import (
|
||||
"github.com/z7zmey/php-parser/token"
|
||||
)
|
||||
|
||||
func (n Array) Name() string {
|
||||
return "Array"
|
||||
}
|
||||
|
||||
type Array struct {
|
||||
node.SimpleNode
|
||||
name string
|
||||
opentToken token.Token
|
||||
closeToken token.Token
|
||||
items []node.Node
|
||||
@ -17,7 +21,7 @@ type Array struct {
|
||||
|
||||
func NewArray(opentToken token.Token, closeToken token.Token, items []node.Node) node.Node {
|
||||
return Array{
|
||||
node.SimpleNode{Name: "Array", Attributes: make(map[string]string)},
|
||||
"Array",
|
||||
opentToken,
|
||||
closeToken,
|
||||
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) {
|
||||
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 {
|
||||
fmt.Fprintf(out, "\n%vitems:", indent+" ")
|
||||
|
@ -7,15 +7,19 @@ import (
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
)
|
||||
|
||||
func (n ArrayDimFetch) Name() string {
|
||||
return "ArrayDimFetch"
|
||||
}
|
||||
|
||||
type ArrayDimFetch struct {
|
||||
node.SimpleNode
|
||||
name string
|
||||
variable node.Node
|
||||
dim node.Node
|
||||
}
|
||||
|
||||
func NewArrayDimFetch(variable node.Node, dim node.Node) node.Node {
|
||||
return ArrayDimFetch{
|
||||
node.SimpleNode{Name: "ArrayDimFetch", Attributes: make(map[string]string)},
|
||||
"ArrayDimFetch",
|
||||
variable,
|
||||
dim,
|
||||
}
|
||||
|
@ -7,8 +7,12 @@ import (
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
)
|
||||
|
||||
func (n ArrayItem) Name() string {
|
||||
return "ArrayItem"
|
||||
}
|
||||
|
||||
type ArrayItem struct {
|
||||
node.SimpleNode
|
||||
name string
|
||||
key node.Node
|
||||
val node.Node
|
||||
byRef bool
|
||||
@ -16,7 +20,7 @@ type ArrayItem struct {
|
||||
|
||||
func NewArrayItem(key node.Node, val node.Node, byRef bool) node.Node {
|
||||
return ArrayItem{
|
||||
node.SimpleNode{Name: "ArrayItem", Attributes: make(map[string]string)},
|
||||
"ArrayItem",
|
||||
key,
|
||||
val,
|
||||
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) {
|
||||
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)
|
||||
|
||||
if n.key != nil {
|
||||
|
@ -4,6 +4,10 @@ import (
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
)
|
||||
|
||||
func (n Assign) Name() string {
|
||||
return "Assign"
|
||||
}
|
||||
|
||||
type Assign struct {
|
||||
AssignOp
|
||||
}
|
||||
@ -11,7 +15,7 @@ type Assign struct {
|
||||
func NewAssign(variable node.Node, expression node.Node) node.Node {
|
||||
return Assign{
|
||||
AssignOp{
|
||||
node.SimpleNode{Name: "Assign", Attributes: make(map[string]string)},
|
||||
"Assign",
|
||||
variable,
|
||||
expression,
|
||||
},
|
||||
|
@ -8,13 +8,13 @@ import (
|
||||
)
|
||||
|
||||
type AssignOp struct {
|
||||
node.SimpleNode
|
||||
name string
|
||||
variable node.Node
|
||||
expression node.Node
|
||||
}
|
||||
|
||||
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 {
|
||||
fmt.Fprintf(out, "\n%vvariable:", indent+" ")
|
||||
|
@ -4,6 +4,10 @@ import (
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
)
|
||||
|
||||
func (n AssignRef) Name() string {
|
||||
return "AssignRef"
|
||||
}
|
||||
|
||||
type AssignRef struct {
|
||||
AssignOp
|
||||
}
|
||||
@ -11,7 +15,7 @@ type AssignRef struct {
|
||||
func NewAssignRef(variable node.Node, expression node.Node) node.Node {
|
||||
return AssignRef{
|
||||
AssignOp{
|
||||
node.SimpleNode{Name: "AssignRef", Attributes: make(map[string]string)},
|
||||
"AssignRef",
|
||||
variable,
|
||||
expression,
|
||||
},
|
||||
|
@ -4,6 +4,10 @@ import (
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
)
|
||||
|
||||
func (n BitwiseAnd) Name() string {
|
||||
return "BitwiseAnd"
|
||||
}
|
||||
|
||||
type BitwiseAnd struct {
|
||||
AssignOp
|
||||
}
|
||||
@ -11,7 +15,7 @@ type BitwiseAnd struct {
|
||||
func NewBitwiseAnd(variable node.Node, expression node.Node) node.Node {
|
||||
return BitwiseAnd{
|
||||
AssignOp{
|
||||
node.SimpleNode{Name: "AssignBitwiseAnd", Attributes: make(map[string]string)},
|
||||
"AssignBitwiseAnd",
|
||||
variable,
|
||||
expression,
|
||||
},
|
||||
|
@ -4,6 +4,10 @@ import (
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
)
|
||||
|
||||
func (n BitwiseOr) Name() string {
|
||||
return "BitwiseOr"
|
||||
}
|
||||
|
||||
type BitwiseOr struct {
|
||||
AssignOp
|
||||
}
|
||||
@ -11,7 +15,7 @@ type BitwiseOr struct {
|
||||
func NewBitwiseOr(variable node.Node, expression node.Node) node.Node {
|
||||
return BitwiseOr{
|
||||
AssignOp{
|
||||
node.SimpleNode{Name: "AssignBitwiseOr", Attributes: make(map[string]string)},
|
||||
"AssignBitwiseOr",
|
||||
variable,
|
||||
expression,
|
||||
},
|
||||
|
@ -11,9 +11,13 @@ type BitwiseXor struct {
|
||||
func NewBitwiseXor(variable node.Node, expression node.Node) node.Node {
|
||||
return BitwiseXor{
|
||||
AssignOp{
|
||||
node.SimpleNode{Name: "AssignBitwiseXor", Attributes: make(map[string]string)},
|
||||
"AssignBitwiseXor",
|
||||
variable,
|
||||
expression,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func (n BitwiseXor) Name() string {
|
||||
return "BitwiseXor"
|
||||
}
|
||||
|
@ -4,6 +4,10 @@ import (
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
)
|
||||
|
||||
func (n Concat) Name() string {
|
||||
return "Concat"
|
||||
}
|
||||
|
||||
type Concat struct {
|
||||
AssignOp
|
||||
}
|
||||
@ -11,7 +15,7 @@ type Concat struct {
|
||||
func NewConcat(variable node.Node, expression node.Node) node.Node {
|
||||
return Concat{
|
||||
AssignOp{
|
||||
node.SimpleNode{Name: "AssignConcat", Attributes: make(map[string]string)},
|
||||
"AssignConcat",
|
||||
variable,
|
||||
expression,
|
||||
},
|
||||
|
@ -4,6 +4,10 @@ import (
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
)
|
||||
|
||||
func (n Div) Name() string {
|
||||
return "Div"
|
||||
}
|
||||
|
||||
type Div struct {
|
||||
AssignOp
|
||||
}
|
||||
@ -11,7 +15,7 @@ type Div struct {
|
||||
func NewDiv(variable node.Node, expression node.Node) node.Node {
|
||||
return Div{
|
||||
AssignOp{
|
||||
node.SimpleNode{Name: "AssignDiv", Attributes: make(map[string]string)},
|
||||
"AssignDiv",
|
||||
variable,
|
||||
expression,
|
||||
},
|
||||
|
@ -4,6 +4,10 @@ import (
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
)
|
||||
|
||||
func (n Minus) Name() string {
|
||||
return "Minus"
|
||||
}
|
||||
|
||||
type Minus struct {
|
||||
AssignOp
|
||||
}
|
||||
@ -11,7 +15,7 @@ type Minus struct {
|
||||
func NewMinus(variable node.Node, expression node.Node) node.Node {
|
||||
return Minus{
|
||||
AssignOp{
|
||||
node.SimpleNode{Name: "AssignMinus", Attributes: make(map[string]string)},
|
||||
"AssignMinus",
|
||||
variable,
|
||||
expression,
|
||||
},
|
||||
|
@ -4,6 +4,10 @@ import (
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
)
|
||||
|
||||
func (n Mod) Name() string {
|
||||
return "Mod"
|
||||
}
|
||||
|
||||
type Mod struct {
|
||||
AssignOp
|
||||
}
|
||||
@ -11,7 +15,7 @@ type Mod struct {
|
||||
func NewMod(variable node.Node, expression node.Node) node.Node {
|
||||
return Mod{
|
||||
AssignOp{
|
||||
node.SimpleNode{Name: "AssignMod", Attributes: make(map[string]string)},
|
||||
"AssignMod",
|
||||
variable,
|
||||
expression,
|
||||
},
|
||||
|
@ -4,6 +4,10 @@ import (
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
)
|
||||
|
||||
func (n Mul) Name() string {
|
||||
return "Mul"
|
||||
}
|
||||
|
||||
type Mul struct {
|
||||
AssignOp
|
||||
}
|
||||
@ -11,7 +15,7 @@ type Mul struct {
|
||||
func NewMul(variable node.Node, expression node.Node) node.Node {
|
||||
return Mul{
|
||||
AssignOp{
|
||||
node.SimpleNode{Name: "AssignMul", Attributes: make(map[string]string)},
|
||||
"AssignMul",
|
||||
variable,
|
||||
expression,
|
||||
},
|
||||
|
@ -4,6 +4,10 @@ import (
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
)
|
||||
|
||||
func (n Plus) Name() string {
|
||||
return "Plus"
|
||||
}
|
||||
|
||||
type Plus struct {
|
||||
AssignOp
|
||||
}
|
||||
@ -11,7 +15,7 @@ type Plus struct {
|
||||
func NewPlus(variable node.Node, expression node.Node) node.Node {
|
||||
return Plus{
|
||||
AssignOp{
|
||||
node.SimpleNode{Name: "AssignPlus", Attributes: make(map[string]string)},
|
||||
"AssignPlus",
|
||||
variable,
|
||||
expression,
|
||||
},
|
||||
|
@ -4,6 +4,10 @@ import (
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
)
|
||||
|
||||
func (n Pow) Name() string {
|
||||
return "Pow"
|
||||
}
|
||||
|
||||
type Pow struct {
|
||||
AssignOp
|
||||
}
|
||||
@ -11,7 +15,7 @@ type Pow struct {
|
||||
func NewPow(variable node.Node, expression node.Node) node.Node {
|
||||
return Pow{
|
||||
AssignOp{
|
||||
node.SimpleNode{Name: "AssignPow", Attributes: make(map[string]string)},
|
||||
"AssignPow",
|
||||
variable,
|
||||
expression,
|
||||
},
|
||||
|
@ -4,6 +4,10 @@ import (
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
)
|
||||
|
||||
func (n ShiftLeft) Name() string {
|
||||
return "ShiftLeft"
|
||||
}
|
||||
|
||||
type ShiftLeft struct {
|
||||
AssignOp
|
||||
}
|
||||
@ -11,7 +15,7 @@ type ShiftLeft struct {
|
||||
func NewShiftLeft(variable node.Node, expression node.Node) node.Node {
|
||||
return ShiftLeft{
|
||||
AssignOp{
|
||||
node.SimpleNode{Name: "AssignShiftLeft", Attributes: make(map[string]string)},
|
||||
"AssignShiftLeft",
|
||||
variable,
|
||||
expression,
|
||||
},
|
||||
|
@ -4,6 +4,10 @@ import (
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
)
|
||||
|
||||
func (n ShiftRight) Name() string {
|
||||
return "ShiftRight"
|
||||
}
|
||||
|
||||
type ShiftRight struct {
|
||||
AssignOp
|
||||
}
|
||||
@ -11,7 +15,7 @@ type ShiftRight struct {
|
||||
func NewShiftRight(variable node.Node, expression node.Node) node.Node {
|
||||
return ShiftRight{
|
||||
AssignOp{
|
||||
node.SimpleNode{Name: "AssignShiftRight", Attributes: make(map[string]string)},
|
||||
"AssignShiftRight",
|
||||
variable,
|
||||
expression,
|
||||
},
|
||||
|
@ -8,21 +8,13 @@ import (
|
||||
)
|
||||
|
||||
type BinaryOp struct {
|
||||
node.SimpleNode
|
||||
name string
|
||||
left 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) {
|
||||
fmt.Fprintf(out, "\n%v%v [- -]", indent, n.Name)
|
||||
fmt.Fprintf(out, "\n%v%v [- -]", indent, n.name)
|
||||
|
||||
if n.left != nil {
|
||||
fmt.Fprintf(out, "\n%vleft:", indent+" ")
|
||||
|
@ -4,6 +4,10 @@ import (
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
)
|
||||
|
||||
func (n BitwiseAnd) Name() string {
|
||||
return "BitwiseAnd"
|
||||
}
|
||||
|
||||
type BitwiseAnd struct {
|
||||
BinaryOp
|
||||
}
|
||||
@ -11,7 +15,7 @@ type BitwiseAnd struct {
|
||||
func NewBitwiseAnd(variable node.Node, expression node.Node) node.Node {
|
||||
return BitwiseAnd{
|
||||
BinaryOp{
|
||||
node.SimpleNode{Name: "BinaryBitwiseAnd", Attributes: make(map[string]string)},
|
||||
"BinaryBitwiseAnd",
|
||||
variable,
|
||||
expression,
|
||||
},
|
||||
|
@ -11,9 +11,13 @@ type BitwiseOr struct {
|
||||
func NewBitwiseOr(variable node.Node, expression node.Node) node.Node {
|
||||
return BitwiseOr{
|
||||
BinaryOp{
|
||||
node.SimpleNode{Name: "BinaryBitwiseOr", Attributes: make(map[string]string)},
|
||||
"BinaryBitwiseOr",
|
||||
variable,
|
||||
expression,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func (n BitwiseOr) Name() string {
|
||||
return "BitwiseOr"
|
||||
}
|
||||
|
@ -11,9 +11,13 @@ type BitwiseXor struct {
|
||||
func NewBitwiseXor(variable node.Node, expression node.Node) node.Node {
|
||||
return BitwiseXor{
|
||||
BinaryOp{
|
||||
node.SimpleNode{Name: "BinaryBitwiseXor", Attributes: make(map[string]string)},
|
||||
"BinaryBitwiseXor",
|
||||
variable,
|
||||
expression,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func (n BitwiseXor) Name() string {
|
||||
return "BitwiseXor"
|
||||
}
|
||||
|
@ -4,6 +4,10 @@ import (
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
)
|
||||
|
||||
func (n BooleanAnd) Name() string {
|
||||
return "BooleanAnd"
|
||||
}
|
||||
|
||||
type BooleanAnd struct {
|
||||
BinaryOp
|
||||
}
|
||||
@ -11,7 +15,7 @@ type BooleanAnd struct {
|
||||
func NewBooleanAnd(variable node.Node, expression node.Node) node.Node {
|
||||
return BooleanAnd{
|
||||
BinaryOp{
|
||||
node.SimpleNode{Name: "BinaryBooleanAnd", Attributes: make(map[string]string)},
|
||||
"BinaryBooleanAnd",
|
||||
variable,
|
||||
expression,
|
||||
},
|
||||
|
@ -4,6 +4,10 @@ import (
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
)
|
||||
|
||||
func (n BooleanOr) Name() string {
|
||||
return "BooleanOr"
|
||||
}
|
||||
|
||||
type BooleanOr struct {
|
||||
BinaryOp
|
||||
}
|
||||
@ -11,7 +15,7 @@ type BooleanOr struct {
|
||||
func NewBooleanOr(variable node.Node, expression node.Node) node.Node {
|
||||
return BooleanOr{
|
||||
BinaryOp{
|
||||
node.SimpleNode{Name: "BinaryBooleanOr", Attributes: make(map[string]string)},
|
||||
"BinaryBooleanOr",
|
||||
variable,
|
||||
expression,
|
||||
},
|
||||
|
@ -4,6 +4,10 @@ import (
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
)
|
||||
|
||||
func (n Coalesce) Name() string {
|
||||
return "Coalesce"
|
||||
}
|
||||
|
||||
type Coalesce struct {
|
||||
BinaryOp
|
||||
}
|
||||
@ -11,7 +15,7 @@ type Coalesce struct {
|
||||
func NewCoalesce(variable node.Node, expression node.Node) node.Node {
|
||||
return Coalesce{
|
||||
BinaryOp{
|
||||
node.SimpleNode{Name: "BinaryCoalesce", Attributes: make(map[string]string)},
|
||||
"BinaryCoalesce",
|
||||
variable,
|
||||
expression,
|
||||
},
|
||||
|
@ -4,6 +4,10 @@ import (
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
)
|
||||
|
||||
func (n Concat) Name() string {
|
||||
return "Concat"
|
||||
}
|
||||
|
||||
type Concat struct {
|
||||
BinaryOp
|
||||
}
|
||||
@ -11,7 +15,7 @@ type Concat struct {
|
||||
func NewConcat(variable node.Node, expression node.Node) node.Node {
|
||||
return Concat{
|
||||
BinaryOp{
|
||||
node.SimpleNode{Name: "BinaryConcat", Attributes: make(map[string]string)},
|
||||
"BinaryConcat",
|
||||
variable,
|
||||
expression,
|
||||
},
|
||||
|
@ -4,6 +4,10 @@ import (
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
)
|
||||
|
||||
func (n Div) Name() string {
|
||||
return "Div"
|
||||
}
|
||||
|
||||
type Div struct {
|
||||
BinaryOp
|
||||
}
|
||||
@ -11,7 +15,7 @@ type Div struct {
|
||||
func NewDiv(variable node.Node, expression node.Node) node.Node {
|
||||
return Div{
|
||||
BinaryOp{
|
||||
node.SimpleNode{Name: "BinaryDiv", Attributes: make(map[string]string)},
|
||||
"BinaryDiv",
|
||||
variable,
|
||||
expression,
|
||||
},
|
||||
|
@ -4,6 +4,10 @@ import (
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
)
|
||||
|
||||
func (n Equal) Name() string {
|
||||
return "Equal"
|
||||
}
|
||||
|
||||
type Equal struct {
|
||||
BinaryOp
|
||||
}
|
||||
@ -11,7 +15,7 @@ type Equal struct {
|
||||
func NewEqual(variable node.Node, expression node.Node) node.Node {
|
||||
return Equal{
|
||||
BinaryOp{
|
||||
node.SimpleNode{Name: "BinaryEqual", Attributes: make(map[string]string)},
|
||||
"BinaryEqual",
|
||||
variable,
|
||||
expression,
|
||||
},
|
||||
|
@ -4,6 +4,10 @@ import (
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
)
|
||||
|
||||
func (n Greater) Name() string {
|
||||
return "Greater"
|
||||
}
|
||||
|
||||
type Greater struct {
|
||||
BinaryOp
|
||||
}
|
||||
@ -11,7 +15,7 @@ type Greater struct {
|
||||
func NewGreater(variable node.Node, expression node.Node) node.Node {
|
||||
return Greater{
|
||||
BinaryOp{
|
||||
node.SimpleNode{Name: "BinaryGreater", Attributes: make(map[string]string)},
|
||||
"BinaryGreater",
|
||||
variable,
|
||||
expression,
|
||||
},
|
||||
|
@ -4,6 +4,10 @@ import (
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
)
|
||||
|
||||
func (n GreaterOrEqual) Name() string {
|
||||
return "GreaterOrEqual"
|
||||
}
|
||||
|
||||
type GreaterOrEqual struct {
|
||||
BinaryOp
|
||||
}
|
||||
@ -11,7 +15,7 @@ type GreaterOrEqual struct {
|
||||
func NewGreaterOrEqual(variable node.Node, expression node.Node) node.Node {
|
||||
return GreaterOrEqual{
|
||||
BinaryOp{
|
||||
node.SimpleNode{Name: "BinaryGreaterOrEqual", Attributes: make(map[string]string)},
|
||||
"BinaryGreaterOrEqual",
|
||||
variable,
|
||||
expression,
|
||||
},
|
||||
|
@ -4,6 +4,10 @@ import (
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
)
|
||||
|
||||
func (n Identical) Name() string {
|
||||
return "Identical"
|
||||
}
|
||||
|
||||
type Identical struct {
|
||||
BinaryOp
|
||||
}
|
||||
@ -11,7 +15,7 @@ type Identical struct {
|
||||
func NewIdentical(variable node.Node, expression node.Node) node.Node {
|
||||
return Identical{
|
||||
BinaryOp{
|
||||
node.SimpleNode{Name: "BinaryIdentical", Attributes: make(map[string]string)},
|
||||
"BinaryIdentical",
|
||||
variable,
|
||||
expression,
|
||||
},
|
||||
|
@ -4,6 +4,10 @@ import (
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
)
|
||||
|
||||
func (n LogicalAnd) Name() string {
|
||||
return "LogicalAnd"
|
||||
}
|
||||
|
||||
type LogicalAnd struct {
|
||||
BinaryOp
|
||||
}
|
||||
@ -11,7 +15,7 @@ type LogicalAnd struct {
|
||||
func NewLogicalAnd(variable node.Node, expression node.Node) node.Node {
|
||||
return LogicalAnd{
|
||||
BinaryOp{
|
||||
node.SimpleNode{Name: "BinaryLogicalAnd", Attributes: make(map[string]string)},
|
||||
"BinaryLogicalAnd",
|
||||
variable,
|
||||
expression,
|
||||
},
|
||||
|
@ -4,6 +4,10 @@ import (
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
)
|
||||
|
||||
func (n LogicalOr) Name() string {
|
||||
return "LogicalOr"
|
||||
}
|
||||
|
||||
type LogicalOr struct {
|
||||
BinaryOp
|
||||
}
|
||||
@ -11,7 +15,7 @@ type LogicalOr struct {
|
||||
func NewLogicalOr(variable node.Node, expression node.Node) node.Node {
|
||||
return LogicalOr{
|
||||
BinaryOp{
|
||||
node.SimpleNode{Name: "BinaryLogicalOr", Attributes: make(map[string]string)},
|
||||
"BinaryLogicalOr",
|
||||
variable,
|
||||
expression,
|
||||
},
|
||||
|
@ -4,6 +4,10 @@ import (
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
)
|
||||
|
||||
func (n LogicalXor) Name() string {
|
||||
return "LogicalXor"
|
||||
}
|
||||
|
||||
type LogicalXor struct {
|
||||
BinaryOp
|
||||
}
|
||||
@ -11,7 +15,7 @@ type LogicalXor struct {
|
||||
func NewLogicalXor(variable node.Node, expression node.Node) node.Node {
|
||||
return LogicalXor{
|
||||
BinaryOp{
|
||||
node.SimpleNode{Name: "BinaryLogicalXor", Attributes: make(map[string]string)},
|
||||
"BinaryLogicalXor",
|
||||
variable,
|
||||
expression,
|
||||
},
|
||||
|
@ -4,6 +4,10 @@ import (
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
)
|
||||
|
||||
func (n Minus) Name() string {
|
||||
return "Minus"
|
||||
}
|
||||
|
||||
type Minus struct {
|
||||
BinaryOp
|
||||
}
|
||||
@ -11,7 +15,7 @@ type Minus struct {
|
||||
func NewMinus(variable node.Node, expression node.Node) node.Node {
|
||||
return Minus{
|
||||
BinaryOp{
|
||||
node.SimpleNode{Name: "BinaryMinus", Attributes: make(map[string]string)},
|
||||
"BinaryMinus",
|
||||
variable,
|
||||
expression,
|
||||
},
|
||||
|
@ -4,6 +4,10 @@ import (
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
)
|
||||
|
||||
func(n Mod) Name() string {
|
||||
return "Mod"
|
||||
}
|
||||
|
||||
type Mod struct {
|
||||
BinaryOp
|
||||
}
|
||||
@ -11,7 +15,7 @@ type Mod struct {
|
||||
func NewMod(variable node.Node, expression node.Node) node.Node {
|
||||
return Mod{
|
||||
BinaryOp{
|
||||
node.SimpleNode{Name: "BinaryMod", Attributes: make(map[string]string)},
|
||||
"BinaryMod",
|
||||
variable,
|
||||
expression,
|
||||
},
|
||||
|
@ -4,6 +4,10 @@ import (
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
)
|
||||
|
||||
func(n Mul) Name() string {
|
||||
return "Mul"
|
||||
}
|
||||
|
||||
type Mul struct {
|
||||
BinaryOp
|
||||
}
|
||||
@ -11,7 +15,7 @@ type Mul struct {
|
||||
func NewMul(variable node.Node, expression node.Node) node.Node {
|
||||
return Mul{
|
||||
BinaryOp{
|
||||
node.SimpleNode{Name: "BinaryMul", Attributes: make(map[string]string)},
|
||||
"BinaryMul",
|
||||
variable,
|
||||
expression,
|
||||
},
|
||||
|
@ -4,6 +4,10 @@ import (
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
)
|
||||
|
||||
func(n NotEqual) Name() string {
|
||||
return "NotEqual"
|
||||
}
|
||||
|
||||
type NotEqual struct {
|
||||
BinaryOp
|
||||
}
|
||||
@ -11,7 +15,7 @@ type NotEqual struct {
|
||||
func NewNotEqual(variable node.Node, expression node.Node) node.Node {
|
||||
return NotEqual{
|
||||
BinaryOp{
|
||||
node.SimpleNode{Name: "BinaryNotEqual", Attributes: make(map[string]string)},
|
||||
"BinaryNotEqual",
|
||||
variable,
|
||||
expression,
|
||||
},
|
||||
|
@ -4,6 +4,10 @@ import (
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
)
|
||||
|
||||
func(n NotIdentical) Name() string {
|
||||
return "NotIdentical"
|
||||
}
|
||||
|
||||
type NotIdentical struct {
|
||||
BinaryOp
|
||||
}
|
||||
@ -11,7 +15,7 @@ type NotIdentical struct {
|
||||
func NewNotIdentical(variable node.Node, expression node.Node) node.Node {
|
||||
return NotIdentical{
|
||||
BinaryOp{
|
||||
node.SimpleNode{Name: "BinaryNotIdentical", Attributes: make(map[string]string)},
|
||||
"BinaryNotIdentical",
|
||||
variable,
|
||||
expression,
|
||||
},
|
||||
|
@ -4,6 +4,10 @@ import (
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
)
|
||||
|
||||
func(n Plus) Name() string {
|
||||
return "Plus"
|
||||
}
|
||||
|
||||
type Plus struct {
|
||||
BinaryOp
|
||||
}
|
||||
@ -11,7 +15,7 @@ type Plus struct {
|
||||
func NewPlus(variable node.Node, expression node.Node) node.Node {
|
||||
return Plus{
|
||||
BinaryOp{
|
||||
node.SimpleNode{Name: "BinaryPlus", Attributes: make(map[string]string)},
|
||||
"BinaryPlus",
|
||||
variable,
|
||||
expression,
|
||||
},
|
||||
|
@ -4,6 +4,10 @@ import (
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
)
|
||||
|
||||
func(n Pow) Name() string {
|
||||
return "Pow"
|
||||
}
|
||||
|
||||
type Pow struct {
|
||||
BinaryOp
|
||||
}
|
||||
@ -11,7 +15,7 @@ type Pow struct {
|
||||
func NewPow(variable node.Node, expression node.Node) node.Node {
|
||||
return Pow{
|
||||
BinaryOp{
|
||||
node.SimpleNode{Name: "BinaryPow", Attributes: make(map[string]string)},
|
||||
"BinaryPow",
|
||||
variable,
|
||||
expression,
|
||||
},
|
||||
|
@ -4,6 +4,10 @@ import (
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
)
|
||||
|
||||
func(n ShiftLeft) Name() string {
|
||||
return "ShiftLeft"
|
||||
}
|
||||
|
||||
type ShiftLeft struct {
|
||||
BinaryOp
|
||||
}
|
||||
@ -11,7 +15,7 @@ type ShiftLeft struct {
|
||||
func NewShiftLeft(variable node.Node, expression node.Node) node.Node {
|
||||
return ShiftLeft{
|
||||
BinaryOp{
|
||||
node.SimpleNode{Name: "BinaryShiftLeft", Attributes: make(map[string]string)},
|
||||
"BinaryShiftLeft",
|
||||
variable,
|
||||
expression,
|
||||
},
|
||||
|
@ -4,6 +4,10 @@ import (
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
)
|
||||
|
||||
func(n ShiftRight) Name() string {
|
||||
return "ShiftRight"
|
||||
}
|
||||
|
||||
type ShiftRight struct {
|
||||
BinaryOp
|
||||
}
|
||||
@ -11,7 +15,7 @@ type ShiftRight struct {
|
||||
func NewShiftRight(variable node.Node, expression node.Node) node.Node {
|
||||
return ShiftRight{
|
||||
BinaryOp{
|
||||
node.SimpleNode{Name: "BinaryShiftRight", Attributes: make(map[string]string)},
|
||||
"BinaryShiftRight",
|
||||
variable,
|
||||
expression,
|
||||
},
|
||||
|
@ -4,6 +4,10 @@ import (
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
)
|
||||
|
||||
func(n Smaller) Name() string {
|
||||
return "Smaller"
|
||||
}
|
||||
|
||||
type Smaller struct {
|
||||
BinaryOp
|
||||
}
|
||||
@ -11,7 +15,7 @@ type Smaller struct {
|
||||
func NewSmaller(variable node.Node, expression node.Node) node.Node {
|
||||
return Smaller{
|
||||
BinaryOp{
|
||||
node.SimpleNode{Name: "BinarySmaller", Attributes: make(map[string]string)},
|
||||
"BinarySmaller",
|
||||
variable,
|
||||
expression,
|
||||
},
|
||||
|
@ -4,6 +4,10 @@ import (
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
)
|
||||
|
||||
func(n SmallerOrEqual) Name() string {
|
||||
return "SmallerOrEqual"
|
||||
}
|
||||
|
||||
type SmallerOrEqual struct {
|
||||
BinaryOp
|
||||
}
|
||||
@ -11,7 +15,7 @@ type SmallerOrEqual struct {
|
||||
func NewSmallerOrEqual(variable node.Node, expression node.Node) node.Node {
|
||||
return SmallerOrEqual{
|
||||
BinaryOp{
|
||||
node.SimpleNode{Name: "BinarySmallerOrEqual", Attributes: make(map[string]string)},
|
||||
"BinarySmallerOrEqual",
|
||||
variable,
|
||||
expression,
|
||||
},
|
||||
|
@ -4,6 +4,10 @@ import (
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
)
|
||||
|
||||
func(n Spaceship) Name() string {
|
||||
return "Spaceship"
|
||||
}
|
||||
|
||||
type Spaceship struct {
|
||||
BinaryOp
|
||||
}
|
||||
@ -11,7 +15,7 @@ type Spaceship struct {
|
||||
func NewSpaceship(variable node.Node, expression node.Node) node.Node {
|
||||
return Spaceship{
|
||||
BinaryOp{
|
||||
node.SimpleNode{Name: "BinarySpaceship", Attributes: make(map[string]string)},
|
||||
"BinarySpaceship",
|
||||
variable,
|
||||
expression,
|
||||
},
|
||||
|
@ -7,20 +7,24 @@ import (
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
)
|
||||
|
||||
func (n BitwiseNot) Name() string {
|
||||
return "BitwiseNot"
|
||||
}
|
||||
|
||||
type BitwiseNot struct {
|
||||
node.SimpleNode
|
||||
name string
|
||||
expr node.Node
|
||||
}
|
||||
|
||||
func NewBitwiseNot(expression node.Node) node.Node {
|
||||
return BitwiseNot{
|
||||
node.SimpleNode{Name: "BitwiseNot", Attributes: make(map[string]string)},
|
||||
"BitwiseNot",
|
||||
expression,
|
||||
}
|
||||
}
|
||||
|
||||
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 {
|
||||
fmt.Fprintf(out, "\n%vexpr:", indent+" ")
|
||||
|
@ -7,20 +7,24 @@ import (
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
)
|
||||
|
||||
func (n BooleanNot) Name() string {
|
||||
return "BooleanNot"
|
||||
}
|
||||
|
||||
type BooleanNot struct {
|
||||
node.SimpleNode
|
||||
name string
|
||||
expr node.Node
|
||||
}
|
||||
|
||||
func NewBooleanNot(expression node.Node) node.Node {
|
||||
return BooleanNot{
|
||||
node.SimpleNode{Name: "BooleanNot", Attributes: make(map[string]string)},
|
||||
"BooleanNot",
|
||||
expression,
|
||||
}
|
||||
}
|
||||
|
||||
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 {
|
||||
fmt.Fprintf(out, "\n%vexpr:", indent+" ")
|
||||
|
@ -8,19 +8,12 @@ import (
|
||||
)
|
||||
|
||||
type Cast struct {
|
||||
node.SimpleNode
|
||||
name string
|
||||
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) {
|
||||
fmt.Fprintf(out, "\n%v%v [- -]", indent, n.Name)
|
||||
fmt.Fprintf(out, "\n%v%v [- -]", indent, n.name)
|
||||
|
||||
if n.expr != nil {
|
||||
fmt.Fprintf(out, "\n%vexpr:", indent+" ")
|
||||
|
@ -4,6 +4,10 @@ import (
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
)
|
||||
|
||||
func (n CastArray) Name() string {
|
||||
return "CastArray"
|
||||
}
|
||||
|
||||
type CastArray struct {
|
||||
Cast
|
||||
}
|
||||
@ -11,7 +15,7 @@ type CastArray struct {
|
||||
func NewCastArray(expr node.Node) node.Node {
|
||||
return CastArray{
|
||||
Cast{
|
||||
node.SimpleNode{Name: "CastArray", Attributes: make(map[string]string)},
|
||||
"CastArray",
|
||||
expr,
|
||||
},
|
||||
}
|
||||
|
@ -4,6 +4,10 @@ import (
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
)
|
||||
|
||||
func (n CastBool) Name() string {
|
||||
return "CastBool"
|
||||
}
|
||||
|
||||
type CastBool struct {
|
||||
Cast
|
||||
}
|
||||
@ -11,7 +15,7 @@ type CastBool struct {
|
||||
func NewCastBool(expr node.Node) node.Node {
|
||||
return CastBool{
|
||||
Cast{
|
||||
node.SimpleNode{Name: "CastBool", Attributes: make(map[string]string)},
|
||||
"CastBool",
|
||||
expr,
|
||||
},
|
||||
}
|
||||
|
@ -4,6 +4,10 @@ import (
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
)
|
||||
|
||||
func (n CastDouble) Name() string {
|
||||
return "CastDouble"
|
||||
}
|
||||
|
||||
type CastDouble struct {
|
||||
Cast
|
||||
}
|
||||
@ -11,7 +15,7 @@ type CastDouble struct {
|
||||
func NewCastDouble(expr node.Node) node.Node {
|
||||
return CastDouble{
|
||||
Cast{
|
||||
node.SimpleNode{Name: "CastDouble", Attributes: make(map[string]string)},
|
||||
"CastDouble",
|
||||
expr,
|
||||
},
|
||||
}
|
||||
|
@ -4,6 +4,10 @@ import (
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
)
|
||||
|
||||
func (n CastInt) Name() string {
|
||||
return "CastInt"
|
||||
}
|
||||
|
||||
type CastInt struct {
|
||||
Cast
|
||||
}
|
||||
@ -11,7 +15,7 @@ type CastInt struct {
|
||||
func NewCastInt(expr node.Node) node.Node {
|
||||
return CastInt{
|
||||
Cast{
|
||||
node.SimpleNode{Name: "CastInt", Attributes: make(map[string]string)},
|
||||
"CastInt",
|
||||
expr,
|
||||
},
|
||||
}
|
||||
|
@ -4,6 +4,10 @@ import (
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
)
|
||||
|
||||
func (n CastObject) Name() string {
|
||||
return "CastObject"
|
||||
}
|
||||
|
||||
type CastObject struct {
|
||||
Cast
|
||||
}
|
||||
@ -11,7 +15,7 @@ type CastObject struct {
|
||||
func NewCastObject(expr node.Node) node.Node {
|
||||
return CastObject{
|
||||
Cast{
|
||||
node.SimpleNode{Name: "CastObject", Attributes: make(map[string]string)},
|
||||
"CastObject",
|
||||
expr,
|
||||
},
|
||||
}
|
||||
|
@ -4,6 +4,10 @@ import (
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
)
|
||||
|
||||
func (n CastString) Name() string {
|
||||
return "CastString"
|
||||
}
|
||||
|
||||
type CastString struct {
|
||||
Cast
|
||||
}
|
||||
@ -11,7 +15,7 @@ type CastString struct {
|
||||
func NewCastString(expr node.Node) node.Node {
|
||||
return CastString{
|
||||
Cast{
|
||||
node.SimpleNode{Name: "CastString", Attributes: make(map[string]string)},
|
||||
"CastString",
|
||||
expr,
|
||||
},
|
||||
}
|
||||
|
@ -4,6 +4,10 @@ import (
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
)
|
||||
|
||||
func (n CastUnset) Name() string {
|
||||
return "CastUnset"
|
||||
}
|
||||
|
||||
type CastUnset struct {
|
||||
Cast
|
||||
}
|
||||
@ -11,7 +15,7 @@ type CastUnset struct {
|
||||
func NewCastUnset(expr node.Node) node.Node {
|
||||
return CastUnset{
|
||||
Cast{
|
||||
node.SimpleNode{Name: "CastUnset", Attributes: make(map[string]string)},
|
||||
"CastUnset",
|
||||
expr,
|
||||
},
|
||||
}
|
||||
|
@ -8,23 +8,27 @@ import (
|
||||
"github.com/z7zmey/php-parser/token"
|
||||
)
|
||||
|
||||
type ClassConstFetch struct {
|
||||
node.SimpleNode
|
||||
class node.Node
|
||||
name token.Token
|
||||
func (n ClassConstFetch) Name() string {
|
||||
return "ClassConstFetch"
|
||||
}
|
||||
|
||||
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{
|
||||
node.SimpleNode{Name: "ClassConstFetch", Attributes: make(map[string]string)},
|
||||
"ClassConstFetch",
|
||||
class,
|
||||
name,
|
||||
constant,
|
||||
}
|
||||
}
|
||||
|
||||
func (n ClassConstFetch) Print(out io.Writer, indent string) {
|
||||
fmt.Fprintf(out, "\n%v%v [- -]", indent, n.Name)
|
||||
fmt.Fprintf(out, "\n%vname: %q", indent+" ", n.name)
|
||||
fmt.Fprintf(out, "\n%v%v [- -]", indent, n.name)
|
||||
fmt.Fprintf(out, "\n%vname: %q", indent+" ", n.constant.Value)
|
||||
|
||||
if n.class != nil {
|
||||
fmt.Fprintf(out, "\n%vclass:", indent+" ")
|
||||
|
@ -7,20 +7,24 @@ import (
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
)
|
||||
|
||||
func (n Clone) Name() string {
|
||||
return "Clone"
|
||||
}
|
||||
|
||||
type Clone struct {
|
||||
node.SimpleNode
|
||||
name string
|
||||
expr node.Node
|
||||
}
|
||||
|
||||
func NewClone(expression node.Node) node.Node {
|
||||
return Clone{
|
||||
node.SimpleNode{Name: "Clone", Attributes: make(map[string]string)},
|
||||
"Clone",
|
||||
expression,
|
||||
}
|
||||
}
|
||||
|
||||
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 {
|
||||
fmt.Fprintf(out, "\n%vexpr:", indent+" ")
|
||||
|
@ -7,8 +7,12 @@ import (
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
)
|
||||
|
||||
func (n Closure) Name() string {
|
||||
return "Closure"
|
||||
}
|
||||
|
||||
type Closure struct {
|
||||
node.SimpleNode
|
||||
name string
|
||||
params []node.Node
|
||||
uses []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 {
|
||||
return Closure{
|
||||
node.SimpleNode{Name: "Closure", Attributes: make(map[string]string)},
|
||||
"Closure",
|
||||
params,
|
||||
uses,
|
||||
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) {
|
||||
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 return ref: %t", indent+" ", n.isReturnRef)
|
||||
|
@ -7,22 +7,26 @@ import (
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
)
|
||||
|
||||
func (n ClusureUse) Name() string {
|
||||
return "ClusureUse"
|
||||
}
|
||||
|
||||
type ClusureUse struct {
|
||||
node.SimpleNode
|
||||
name string
|
||||
variable node.Node
|
||||
byRef bool
|
||||
}
|
||||
|
||||
func NewClusureUse(variable node.Node, byRef bool) node.Node {
|
||||
return ClusureUse{
|
||||
node.SimpleNode{Name: "ClusureUse", Attributes: make(map[string]string)},
|
||||
"ClusureUse",
|
||||
variable,
|
||||
byRef,
|
||||
}
|
||||
}
|
||||
|
||||
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)
|
||||
|
||||
if n.variable != nil {
|
||||
|
@ -7,23 +7,27 @@ import (
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
)
|
||||
|
||||
type ConstFetch struct {
|
||||
node.SimpleNode
|
||||
name node.Node
|
||||
func (n ConstFetch) Name() string {
|
||||
return "ConstFetch"
|
||||
}
|
||||
|
||||
func NewConstFetch(name node.Node) node.Node {
|
||||
type ConstFetch struct {
|
||||
name string
|
||||
constant node.Node
|
||||
}
|
||||
|
||||
func NewConstFetch(constant node.Node) node.Node {
|
||||
return ConstFetch{
|
||||
node.SimpleNode{Name: "ConstFetch", Attributes: make(map[string]string)},
|
||||
name,
|
||||
"ConstFetch",
|
||||
constant,
|
||||
}
|
||||
}
|
||||
|
||||
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 {
|
||||
fmt.Fprintf(out, "\n%vname:", indent+" ")
|
||||
n.name.Print(out, indent+" ")
|
||||
if n.constant != nil {
|
||||
fmt.Fprintf(out, "\n%vconstant:", indent+" ")
|
||||
n.constant.Print(out, indent+" ")
|
||||
}
|
||||
}
|
||||
|
@ -7,20 +7,24 @@ import (
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
)
|
||||
|
||||
func (n Empty) Name() string {
|
||||
return "Empty"
|
||||
}
|
||||
|
||||
type Empty struct {
|
||||
node.SimpleNode
|
||||
name string
|
||||
expr node.Node
|
||||
}
|
||||
|
||||
func NewEmpty(expression node.Node) node.Node {
|
||||
return Empty{
|
||||
node.SimpleNode{Name: "Empty", Attributes: make(map[string]string)},
|
||||
"Empty",
|
||||
expression,
|
||||
}
|
||||
}
|
||||
|
||||
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 {
|
||||
fmt.Fprintf(out, "\n%vexpr:", indent+" ")
|
||||
|
@ -7,20 +7,24 @@ import (
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
)
|
||||
|
||||
func (n ErrorSuppress) Name() string {
|
||||
return "ErrorSuppress"
|
||||
}
|
||||
|
||||
type ErrorSuppress struct {
|
||||
node.SimpleNode
|
||||
name string
|
||||
expr node.Node
|
||||
}
|
||||
|
||||
func NewErrorSuppress(expression node.Node) node.Node {
|
||||
return ErrorSuppress{
|
||||
node.SimpleNode{Name: "ErrorSuppress", Attributes: make(map[string]string)},
|
||||
"ErrorSuppress",
|
||||
expression,
|
||||
}
|
||||
}
|
||||
|
||||
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 {
|
||||
fmt.Fprintf(out, "\n%vexpr:", indent+" ")
|
||||
|
@ -7,20 +7,24 @@ import (
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
)
|
||||
|
||||
func (n Eval) Name() string {
|
||||
return "Eval"
|
||||
}
|
||||
|
||||
type Eval struct {
|
||||
node.SimpleNode
|
||||
name string
|
||||
expr node.Node
|
||||
}
|
||||
|
||||
func NewEval(expression node.Node) node.Node {
|
||||
return Eval{
|
||||
node.SimpleNode{Name: "Eval", Attributes: make(map[string]string)},
|
||||
"Eval",
|
||||
expression,
|
||||
}
|
||||
}
|
||||
|
||||
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 {
|
||||
fmt.Fprintf(out, "\n%vexpr:", indent+" ")
|
||||
|
@ -7,22 +7,26 @@ import (
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
)
|
||||
|
||||
func (n Exit) Name() string {
|
||||
return "Exit"
|
||||
}
|
||||
|
||||
type Exit struct {
|
||||
node.SimpleNode
|
||||
name string
|
||||
expr node.Node
|
||||
isDie bool
|
||||
}
|
||||
|
||||
func NewExit(expr node.Node, isDie bool) node.Node {
|
||||
return Exit{
|
||||
node.SimpleNode{Name: "Exit", Attributes: make(map[string]string)},
|
||||
"Exit",
|
||||
expr,
|
||||
isDie,
|
||||
}
|
||||
}
|
||||
|
||||
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)
|
||||
|
||||
if n.expr != nil {
|
||||
|
@ -7,22 +7,26 @@ import (
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
)
|
||||
|
||||
func (n FunctionCall) Name() string {
|
||||
return "FunctionCall"
|
||||
}
|
||||
|
||||
type FunctionCall struct {
|
||||
node.SimpleNode
|
||||
name string
|
||||
function node.Node
|
||||
arguments []node.Node
|
||||
}
|
||||
|
||||
func NewFunctionCall(function node.Node, arguments []node.Node) node.Node {
|
||||
return FunctionCall{
|
||||
node.SimpleNode{Name: "FunctionCall", Attributes: make(map[string]string)},
|
||||
"FunctionCall",
|
||||
function,
|
||||
arguments,
|
||||
}
|
||||
}
|
||||
|
||||
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 {
|
||||
fmt.Fprintf(out, "\n%vfunction:", indent+" ")
|
||||
|
@ -7,20 +7,24 @@ import (
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
)
|
||||
|
||||
func (n Include) Name() string {
|
||||
return "Include"
|
||||
}
|
||||
|
||||
type Include struct {
|
||||
node.SimpleNode
|
||||
name string
|
||||
expr node.Node
|
||||
}
|
||||
|
||||
func NewInclude(expression node.Node) node.Node {
|
||||
return Include{
|
||||
node.SimpleNode{Name: "Include", Attributes: make(map[string]string)},
|
||||
"Include",
|
||||
expression,
|
||||
}
|
||||
}
|
||||
|
||||
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 {
|
||||
fmt.Fprintf(out, "\n%vexpr:", indent+" ")
|
||||
|
@ -7,20 +7,24 @@ import (
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
)
|
||||
|
||||
func (n IncludeOnce) Name() string {
|
||||
return "IncludeOnce"
|
||||
}
|
||||
|
||||
type IncludeOnce struct {
|
||||
node.SimpleNode
|
||||
name string
|
||||
expr node.Node
|
||||
}
|
||||
|
||||
func NewIncludeOnce(expression node.Node) node.Node {
|
||||
return IncludeOnce{
|
||||
node.SimpleNode{Name: "IncludeOnce", Attributes: make(map[string]string)},
|
||||
"IncludeOnce",
|
||||
expression,
|
||||
}
|
||||
}
|
||||
|
||||
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 {
|
||||
fmt.Fprintf(out, "\n%vexpr:", indent+" ")
|
||||
|
@ -7,22 +7,26 @@ import (
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
)
|
||||
|
||||
func (n InstanceOf) Name() string {
|
||||
return "InstanceOf"
|
||||
}
|
||||
|
||||
type InstanceOf struct {
|
||||
node.SimpleNode
|
||||
name string
|
||||
expr node.Node
|
||||
class node.Node
|
||||
}
|
||||
|
||||
func NewInstanceOf(expr node.Node, class node.Node) node.Node {
|
||||
return InstanceOf{
|
||||
node.SimpleNode{Name: "InstanceOf", Attributes: make(map[string]string)},
|
||||
"InstanceOf",
|
||||
expr,
|
||||
class,
|
||||
}
|
||||
}
|
||||
|
||||
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 {
|
||||
fmt.Fprintf(out, "\n%vexpr:", indent+" ")
|
||||
|
@ -7,20 +7,24 @@ import (
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
)
|
||||
|
||||
func (n Isset) Name() string {
|
||||
return "Isset"
|
||||
}
|
||||
|
||||
type Isset struct {
|
||||
node.SimpleNode
|
||||
name string
|
||||
variables []node.Node
|
||||
}
|
||||
|
||||
func NewIsset(variables []node.Node) node.Node {
|
||||
return Isset{
|
||||
node.SimpleNode{Name: "Isset", Attributes: make(map[string]string)},
|
||||
"Isset",
|
||||
variables,
|
||||
}
|
||||
}
|
||||
|
||||
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 {
|
||||
fmt.Fprintf(out, "\n%vvariables:", indent+" ")
|
||||
|
@ -7,20 +7,24 @@ import (
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
)
|
||||
|
||||
func (n List) Name() string {
|
||||
return "List"
|
||||
}
|
||||
|
||||
type List struct {
|
||||
node.SimpleNode
|
||||
name string
|
||||
items []node.Node
|
||||
}
|
||||
|
||||
func NewList(items []node.Node) node.Node {
|
||||
return List{
|
||||
node.SimpleNode{Name: "List", Attributes: make(map[string]string)},
|
||||
"List",
|
||||
items,
|
||||
}
|
||||
}
|
||||
|
||||
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 {
|
||||
fmt.Fprintf(out, "\n%vitems:", indent+" ")
|
||||
|
@ -7,33 +7,37 @@ import (
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
)
|
||||
|
||||
func (n MethodCall) Name() string {
|
||||
return "MethodCall"
|
||||
}
|
||||
|
||||
type MethodCall struct {
|
||||
node.SimpleNode
|
||||
name string
|
||||
variable node.Node
|
||||
name node.Node
|
||||
method 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{
|
||||
node.SimpleNode{Name: "MethodCall", Attributes: make(map[string]string)},
|
||||
"MethodCall",
|
||||
variable,
|
||||
name,
|
||||
method,
|
||||
arguments,
|
||||
}
|
||||
}
|
||||
|
||||
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 {
|
||||
fmt.Fprintf(out, "\n%vvariable:", indent+" ")
|
||||
n.variable.Print(out, indent+" ")
|
||||
}
|
||||
|
||||
if n.name != nil {
|
||||
fmt.Fprintf(out, "\n%vname:", indent+" ")
|
||||
n.name.Print(out, indent+" ")
|
||||
if n.method != nil {
|
||||
fmt.Fprintf(out, "\n%vmethod:", indent+" ")
|
||||
n.method.Print(out, indent+" ")
|
||||
}
|
||||
|
||||
if n.arguments != nil {
|
||||
|
@ -7,22 +7,26 @@ import (
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
)
|
||||
|
||||
func (n New) Name() string {
|
||||
return "New"
|
||||
}
|
||||
|
||||
type New struct {
|
||||
node.SimpleNode
|
||||
name string
|
||||
class node.Node
|
||||
arguments []node.Node
|
||||
}
|
||||
|
||||
func NewNew(class node.Node, arguments []node.Node) node.Node {
|
||||
return New{
|
||||
node.SimpleNode{Name: "New", Attributes: make(map[string]string)},
|
||||
"New",
|
||||
class,
|
||||
arguments,
|
||||
}
|
||||
}
|
||||
|
||||
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 {
|
||||
fmt.Fprintf(out, "\n%vclass:", indent+" ")
|
||||
|
@ -7,20 +7,24 @@ import (
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
)
|
||||
|
||||
func (n PostDec) Name() string {
|
||||
return "PostDec"
|
||||
}
|
||||
|
||||
type PostDec struct {
|
||||
node.SimpleNode
|
||||
name string
|
||||
variable node.Node
|
||||
}
|
||||
|
||||
func NewPostDec(variableession node.Node) node.Node {
|
||||
return PostDec{
|
||||
node.SimpleNode{Name: "PostDec", Attributes: make(map[string]string)},
|
||||
"PostDec",
|
||||
variableession,
|
||||
}
|
||||
}
|
||||
|
||||
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 {
|
||||
fmt.Fprintf(out, "\n%vvariable:", indent+" ")
|
||||
|
@ -7,20 +7,24 @@ import (
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
)
|
||||
|
||||
func (n PostInc) Name() string {
|
||||
return "PostInc"
|
||||
}
|
||||
|
||||
type PostInc struct {
|
||||
node.SimpleNode
|
||||
name string
|
||||
variable node.Node
|
||||
}
|
||||
|
||||
func NewPostInc(variableession node.Node) node.Node {
|
||||
return PostInc{
|
||||
node.SimpleNode{Name: "PostInc", Attributes: make(map[string]string)},
|
||||
"PostInc",
|
||||
variableession,
|
||||
}
|
||||
}
|
||||
|
||||
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 {
|
||||
fmt.Fprintf(out, "\n%vvariable:", indent+" ")
|
||||
|
@ -7,20 +7,24 @@ import (
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
)
|
||||
|
||||
func (n PreDec) Name() string {
|
||||
return "PreDec"
|
||||
}
|
||||
|
||||
type PreDec struct {
|
||||
node.SimpleNode
|
||||
name string
|
||||
variable node.Node
|
||||
}
|
||||
|
||||
func NewPreDec(variableession node.Node) node.Node {
|
||||
return PreDec{
|
||||
node.SimpleNode{Name: "PreDec", Attributes: make(map[string]string)},
|
||||
"PreDec",
|
||||
variableession,
|
||||
}
|
||||
}
|
||||
|
||||
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 {
|
||||
fmt.Fprintf(out, "\n%vvariable:", indent+" ")
|
||||
|
@ -7,20 +7,24 @@ import (
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
)
|
||||
|
||||
func (n PreInc) Name() string {
|
||||
return "PreInc"
|
||||
}
|
||||
|
||||
type PreInc struct {
|
||||
node.SimpleNode
|
||||
name string
|
||||
variable node.Node
|
||||
}
|
||||
|
||||
func NewPreInc(variableession node.Node) node.Node {
|
||||
return PreInc{
|
||||
node.SimpleNode{Name: "PreInc", Attributes: make(map[string]string)},
|
||||
"PreInc",
|
||||
variableession,
|
||||
}
|
||||
}
|
||||
|
||||
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 {
|
||||
fmt.Fprintf(out, "\n%vvariable:", indent+" ")
|
||||
|
@ -7,20 +7,24 @@ import (
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
)
|
||||
|
||||
func (n Print) Name() string {
|
||||
return "Print"
|
||||
}
|
||||
|
||||
type Print struct {
|
||||
node.SimpleNode
|
||||
name string
|
||||
expr node.Node
|
||||
}
|
||||
|
||||
func NewPrint(expression node.Node) node.Node {
|
||||
return Print{
|
||||
node.SimpleNode{Name: "Print", Attributes: make(map[string]string)},
|
||||
"Print",
|
||||
expression,
|
||||
}
|
||||
}
|
||||
|
||||
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 {
|
||||
fmt.Fprintf(out, "\n%vexpr:", indent+" ")
|
||||
|
@ -7,30 +7,34 @@ import (
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
)
|
||||
|
||||
type PropertyFetch struct {
|
||||
node.SimpleNode
|
||||
variable node.Node
|
||||
name node.Node
|
||||
func (n PropertyFetch) Name() string {
|
||||
return "PropertyFetch"
|
||||
}
|
||||
|
||||
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{
|
||||
node.SimpleNode{Name: "PropertyFetch", Attributes: make(map[string]string)},
|
||||
"PropertyFetch",
|
||||
variable,
|
||||
name,
|
||||
property,
|
||||
}
|
||||
}
|
||||
|
||||
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 {
|
||||
fmt.Fprintf(out, "\n%vvariable:", indent+" ")
|
||||
n.variable.Print(out, indent+" ")
|
||||
}
|
||||
|
||||
if n.name != nil {
|
||||
fmt.Fprintf(out, "\n%vname:", indent+" ")
|
||||
n.name.Print(out, indent+" ")
|
||||
if n.property != nil {
|
||||
fmt.Fprintf(out, "\n%vproperty:", indent+" ")
|
||||
n.property.Print(out, indent+" ")
|
||||
}
|
||||
}
|
||||
|
@ -7,20 +7,24 @@ import (
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
)
|
||||
|
||||
func(n Require) Name() string {
|
||||
return "Require"
|
||||
}
|
||||
|
||||
type Require struct {
|
||||
node.SimpleNode
|
||||
name string
|
||||
expr node.Node
|
||||
}
|
||||
|
||||
func NewRequire(expression node.Node) node.Node {
|
||||
return Require{
|
||||
node.SimpleNode{Name: "Require", Attributes: make(map[string]string)},
|
||||
"Require",
|
||||
expression,
|
||||
}
|
||||
}
|
||||
|
||||
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 {
|
||||
fmt.Fprintf(out, "\n%vexpr:", indent+" ")
|
||||
|
@ -7,20 +7,24 @@ import (
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
)
|
||||
|
||||
func (n RequireOnce) Name() string {
|
||||
return "RequireOnce"
|
||||
}
|
||||
|
||||
type RequireOnce struct {
|
||||
node.SimpleNode
|
||||
name string
|
||||
expr node.Node
|
||||
}
|
||||
|
||||
func NewRequireOnce(expression node.Node) node.Node {
|
||||
return RequireOnce{
|
||||
node.SimpleNode{Name: "RequireOnce", Attributes: make(map[string]string)},
|
||||
"RequireOnce",
|
||||
expression,
|
||||
}
|
||||
}
|
||||
|
||||
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 {
|
||||
fmt.Fprintf(out, "\n%vexpr:", indent+" ")
|
||||
|
@ -7,20 +7,24 @@ import (
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
)
|
||||
|
||||
func (n ShellExec) Name() string {
|
||||
return "ShellExec"
|
||||
}
|
||||
|
||||
type ShellExec struct {
|
||||
node.SimpleNode
|
||||
name string
|
||||
parts []node.Node
|
||||
}
|
||||
|
||||
func NewShellExec(parts []node.Node) node.Node {
|
||||
return ShellExec{
|
||||
node.SimpleNode{Name: "ShellExec", Attributes: make(map[string]string)},
|
||||
"ShellExec",
|
||||
parts,
|
||||
}
|
||||
}
|
||||
|
||||
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 {
|
||||
fmt.Fprintf(out, "\n%vparts:", indent+" ")
|
||||
|
@ -8,8 +8,12 @@ import (
|
||||
"github.com/z7zmey/php-parser/token"
|
||||
)
|
||||
|
||||
func (n ShortArray) Name() string {
|
||||
return "ShortArray"
|
||||
}
|
||||
|
||||
type ShortArray struct {
|
||||
node.SimpleNode
|
||||
name string
|
||||
opentToken token.Token
|
||||
closeToken token.Token
|
||||
items []node.Node
|
||||
@ -17,7 +21,7 @@ type ShortArray struct {
|
||||
|
||||
func NewShortArray(opentToken token.Token, closeToken token.Token, items []node.Node) node.Node {
|
||||
return ShortArray{
|
||||
node.SimpleNode{Name: "ShortArray", Attributes: make(map[string]string)},
|
||||
"ShortArray",
|
||||
opentToken,
|
||||
closeToken,
|
||||
items,
|
||||
@ -25,7 +29,7 @@ func NewShortArray(opentToken token.Token, closeToken token.Token, items []node.
|
||||
}
|
||||
|
||||
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 {
|
||||
fmt.Fprintf(out, "\n%vitems:", indent+" ")
|
||||
|
@ -7,20 +7,24 @@ import (
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
)
|
||||
|
||||
func (n ShortList) Name() string {
|
||||
return "ShortList"
|
||||
}
|
||||
|
||||
type ShortList struct {
|
||||
node.SimpleNode
|
||||
name string
|
||||
items []node.Node
|
||||
}
|
||||
|
||||
func NewShortList(items []node.Node) node.Node {
|
||||
return ShortList{
|
||||
node.SimpleNode{Name: "ShortList", Attributes: make(map[string]string)},
|
||||
"ShortList",
|
||||
items,
|
||||
}
|
||||
}
|
||||
|
||||
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 {
|
||||
fmt.Fprintf(out, "\n%vitems:", indent+" ")
|
||||
|
@ -7,33 +7,37 @@ import (
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
)
|
||||
|
||||
func (n StaticCall) Name() string {
|
||||
return "StaticCall"
|
||||
}
|
||||
|
||||
type StaticCall struct {
|
||||
node.SimpleNode
|
||||
name string
|
||||
class node.Node
|
||||
name node.Node
|
||||
call 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{
|
||||
node.SimpleNode{Name: "StaticCall", Attributes: make(map[string]string)},
|
||||
"StaticCall",
|
||||
class,
|
||||
name,
|
||||
call,
|
||||
arguments,
|
||||
}
|
||||
}
|
||||
|
||||
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 {
|
||||
fmt.Fprintf(out, "\n%vclass:", indent+" ")
|
||||
n.class.Print(out, indent+" ")
|
||||
}
|
||||
|
||||
if n.name != nil {
|
||||
fmt.Fprintf(out, "\n%vname:", indent+" ")
|
||||
n.name.Print(out, indent+" ")
|
||||
if n.call != nil {
|
||||
fmt.Fprintf(out, "\n%vcall:", indent+" ")
|
||||
n.call.Print(out, indent+" ")
|
||||
}
|
||||
|
||||
if n.arguments != nil {
|
||||
|
@ -7,30 +7,34 @@ import (
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
)
|
||||
|
||||
type StaticPropertyFetch struct {
|
||||
node.SimpleNode
|
||||
class node.Node
|
||||
name node.Node
|
||||
func (n StaticPropertyFetch) Name() string {
|
||||
return "StaticPropertyFetch"
|
||||
}
|
||||
|
||||
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{
|
||||
node.SimpleNode{Name: "StaticPropertyFetch", Attributes: make(map[string]string)},
|
||||
"StaticPropertyFetch",
|
||||
class,
|
||||
name,
|
||||
property,
|
||||
}
|
||||
}
|
||||
|
||||
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 {
|
||||
fmt.Fprintf(out, "\n%vclass:", indent+" ")
|
||||
n.class.Print(out, indent+" ")
|
||||
}
|
||||
|
||||
if n.name != nil {
|
||||
fmt.Fprintf(out, "\n%vname:", indent+" ")
|
||||
n.name.Print(out, indent+" ")
|
||||
if n.property != nil {
|
||||
fmt.Fprintf(out, "\n%vproperty:", indent+" ")
|
||||
n.property.Print(out, indent+" ")
|
||||
}
|
||||
}
|
||||
|
@ -7,8 +7,12 @@ import (
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
)
|
||||
|
||||
func (n Ternary) Name() string {
|
||||
return "Ternary"
|
||||
}
|
||||
|
||||
type Ternary struct {
|
||||
node.SimpleNode
|
||||
name string
|
||||
condition node.Node
|
||||
ifTrue 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 {
|
||||
return Ternary{
|
||||
node.SimpleNode{Name: "Ternary", Attributes: make(map[string]string)},
|
||||
"Ternary",
|
||||
condition,
|
||||
ifTrue,
|
||||
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) {
|
||||
fmt.Fprintf(out, "\n%v%v [- -]", indent, n.Name)
|
||||
fmt.Fprintf(out, "\n%v%v [- -]", indent, n.name)
|
||||
|
||||
if n.condition != nil {
|
||||
fmt.Fprintf(out, "\n%vcondition:", indent+" ")
|
||||
|
@ -7,20 +7,24 @@ import (
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
)
|
||||
|
||||
func (n UnaryMinus) Name() string {
|
||||
return "UnaryMinus"
|
||||
}
|
||||
|
||||
type UnaryMinus struct {
|
||||
node.SimpleNode
|
||||
name string
|
||||
expr node.Node
|
||||
}
|
||||
|
||||
func NewUnaryMinus(expression node.Node) node.Node {
|
||||
return UnaryMinus{
|
||||
node.SimpleNode{Name: "UnaryMinus", Attributes: make(map[string]string)},
|
||||
"UnaryMinus",
|
||||
expression,
|
||||
}
|
||||
}
|
||||
|
||||
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 {
|
||||
fmt.Fprintf(out, "\n%vexpr:", indent+" ")
|
||||
|
@ -7,20 +7,24 @@ import (
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
)
|
||||
|
||||
func (n UnaryPlus) Name() string {
|
||||
return "UnaryPlus"
|
||||
}
|
||||
|
||||
type UnaryPlus struct {
|
||||
node.SimpleNode
|
||||
name string
|
||||
expr node.Node
|
||||
}
|
||||
|
||||
func NewUnaryPlus(expression node.Node) node.Node {
|
||||
return UnaryPlus{
|
||||
node.SimpleNode{Name: "UnaryPlus", Attributes: make(map[string]string)},
|
||||
"UnaryPlus",
|
||||
expression,
|
||||
}
|
||||
}
|
||||
|
||||
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 {
|
||||
fmt.Fprintf(out, "\n%vexpr:", indent+" ")
|
||||
|
@ -7,23 +7,27 @@ import (
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
)
|
||||
|
||||
type Variable struct {
|
||||
node.SimpleNode
|
||||
name node.Node
|
||||
func (n Variable) Name() string {
|
||||
return "Variable"
|
||||
}
|
||||
|
||||
func NewVariable(name node.Node) node.Node {
|
||||
type Variable struct {
|
||||
name string
|
||||
variable node.Node
|
||||
}
|
||||
|
||||
func NewVariable(variable node.Node) node.Node {
|
||||
return Variable{
|
||||
node.SimpleNode{Name: "Variable", Attributes: make(map[string]string)},
|
||||
name,
|
||||
"Variable",
|
||||
variable,
|
||||
}
|
||||
}
|
||||
|
||||
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 {
|
||||
fmt.Fprintf(out, "\n%vname:", indent+" ")
|
||||
n.name.Print(out, indent+" ")
|
||||
if n.variable != nil {
|
||||
fmt.Fprintf(out, "\n%vvariable:", indent+" ")
|
||||
n.variable.Print(out, indent+" ")
|
||||
}
|
||||
}
|
||||
|
@ -7,22 +7,26 @@ import (
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
)
|
||||
|
||||
func (n Yield) Name() string {
|
||||
return "Yield"
|
||||
}
|
||||
|
||||
type Yield struct {
|
||||
node.SimpleNode
|
||||
name string
|
||||
key node.Node
|
||||
value node.Node
|
||||
}
|
||||
|
||||
func NewYield(key node.Node, value node.Node) node.Node {
|
||||
return Yield{
|
||||
node.SimpleNode{Name: "Yield", Attributes: make(map[string]string)},
|
||||
"Yield",
|
||||
key,
|
||||
value,
|
||||
}
|
||||
}
|
||||
|
||||
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 {
|
||||
fmt.Fprintf(out, "\n%vkey:", indent+" ")
|
||||
|
@ -7,20 +7,24 @@ import (
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
)
|
||||
|
||||
func (n YieldFrom) Name() string {
|
||||
return "YieldFrom"
|
||||
}
|
||||
|
||||
type YieldFrom struct {
|
||||
node.SimpleNode
|
||||
name string
|
||||
expr node.Node
|
||||
}
|
||||
|
||||
func NewYieldFrom(expression node.Node) node.Node {
|
||||
return YieldFrom{
|
||||
node.SimpleNode{Name: "YieldFrom", Attributes: make(map[string]string)},
|
||||
"YieldFrom",
|
||||
expression,
|
||||
}
|
||||
}
|
||||
|
||||
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 {
|
||||
fmt.Fprintf(out, "\n%vexpr:", indent+" ")
|
||||
|
@ -8,18 +8,22 @@ import (
|
||||
)
|
||||
|
||||
type Identifier struct {
|
||||
SimpleNode
|
||||
name token.Token
|
||||
name string
|
||||
token token.Token
|
||||
}
|
||||
|
||||
func NewIdentifier(name token.Token) Node {
|
||||
func (n Identifier) Name() string {
|
||||
return "Identifier"
|
||||
}
|
||||
|
||||
func NewIdentifier(token token.Token) Node {
|
||||
return Identifier{
|
||||
SimpleNode{Name: "Identifier", Attributes: make(map[string]string)},
|
||||
name,
|
||||
"Identifier",
|
||||
token,
|
||||
}
|
||||
}
|
||||
|
||||
func (n Identifier) Print(out io.Writer, indent string) {
|
||||
fmt.Fprintf(out, "\n%v%v [- -]", indent, n.Name)
|
||||
fmt.Fprintf(out, "\n%vname: %q", indent+" ", n.name.Value)
|
||||
fmt.Fprintf(out, "\n%v%v [- -]", indent, n.name)
|
||||
fmt.Fprintf(out, "\n%vname: %q", indent+" ", n.token.Value)
|
||||
}
|
||||
|
@ -5,14 +5,18 @@ import (
|
||||
)
|
||||
|
||||
type FullyQualified struct {
|
||||
Name
|
||||
NameNode
|
||||
}
|
||||
|
||||
func NewFullyQualified(parts []node.Node) node.Node {
|
||||
return FullyQualified{
|
||||
Name{
|
||||
node.SimpleNode{Name: "FullyQualifiedName", Attributes: make(map[string]string)},
|
||||
NameNode{
|
||||
"FullyQualifiedName",
|
||||
parts,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func (n FullyQualified) Name() string {
|
||||
return "FullyQualified"
|
||||
}
|
||||
|
@ -2,26 +2,34 @@ package name
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
"io"
|
||||
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
)
|
||||
|
||||
type Name struct {
|
||||
node.SimpleNode
|
||||
func (n NameNode) Name() string {
|
||||
return "Name"
|
||||
}
|
||||
|
||||
type NameNode struct {
|
||||
name string
|
||||
parts []node.Node
|
||||
}
|
||||
|
||||
func NewName(parts []node.Node) node.Node {
|
||||
return Name{
|
||||
node.SimpleNode{Name: "Name", Attributes: make(map[string]string)},
|
||||
return NameNode{
|
||||
"Name",
|
||||
parts,
|
||||
}
|
||||
}
|
||||
|
||||
func (n Name) Print(out io.Writer, indent string) {
|
||||
fmt.Fprintf(out, "\n%v%v", indent, n.Name)
|
||||
fmt.Fprintf(out, "\n%vparts:", indent+" ",)
|
||||
func (n NameNode) Print(out io.Writer, indent string) {
|
||||
fmt.Fprintf(out, "\n%v%v", indent, n.name)
|
||||
|
||||
if n.parts != nil {
|
||||
fmt.Fprintf(out, "\n%vparts:", indent+" ")
|
||||
for _, nn := range n.parts {
|
||||
nn.Print(out, indent+" ")
|
||||
}
|
||||
}
|
||||
}
|
@ -2,26 +2,28 @@ package name
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/z7zmey/php-parser/token"
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
"io"
|
||||
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
"github.com/z7zmey/php-parser/token"
|
||||
)
|
||||
|
||||
func(n NamePart) Name() string {
|
||||
return "NamePart"
|
||||
}
|
||||
|
||||
type NamePart struct {
|
||||
node.SimpleNode
|
||||
name string
|
||||
token token.Token
|
||||
}
|
||||
|
||||
func NewNamePart(token token.Token) node.Node {
|
||||
return NamePart{
|
||||
node.SimpleNode{Name: "NamePart", Attributes: make(map[string]string)},
|
||||
"NamePart",
|
||||
token,
|
||||
}
|
||||
}
|
||||
|
||||
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)
|
||||
for _, nn := range n.Children {
|
||||
nn.Print(out, indent+" ")
|
||||
}
|
||||
fmt.Fprintf(out, "\n%v%v [%d %d] %q", indent, n.name, n.token.StartLine, n.token.EndLine, n.token.Value)
|
||||
}
|
||||
|
@ -5,15 +5,18 @@ import (
|
||||
)
|
||||
|
||||
type Relative struct {
|
||||
Name
|
||||
NameNode
|
||||
}
|
||||
|
||||
func NewRelative(parts []node.Node) node.Node {
|
||||
return Relative{
|
||||
Name{
|
||||
node.SimpleNode{Name: "RelativeName", Attributes: make(map[string]string)},
|
||||
NameNode{
|
||||
"RelativeName",
|
||||
parts,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func (n Relative) Name() string {
|
||||
return "Relative"
|
||||
}
|
||||
|
42
node/node.go
42
node/node.go
@ -1,50 +1,10 @@
|
||||
package node
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"io"
|
||||
)
|
||||
|
||||
type Node interface {
|
||||
Name() 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
|
||||
}
|
||||
|
@ -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
Loading…
Reference in New Issue
Block a user