update tests
This commit is contained in:
parent
12086ef6b6
commit
50f8a47119
23147
internal/php5/parser_test.go
Normal file
23147
internal/php5/parser_test.go
Normal file
File diff suppressed because it is too large
Load Diff
25883
internal/php7/parser_test.go
Normal file
25883
internal/php7/parser_test.go
Normal file
File diff suppressed because it is too large
Load Diff
@ -1,66 +0,0 @@
|
||||
package assign
|
||||
|
||||
import (
|
||||
"github.com/z7zmey/php-parser/freefloating"
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
"github.com/z7zmey/php-parser/position"
|
||||
"github.com/z7zmey/php-parser/walker"
|
||||
)
|
||||
|
||||
// Assign node
|
||||
type Assign struct {
|
||||
FreeFloating freefloating.Collection
|
||||
Position *position.Position
|
||||
Variable node.Node
|
||||
Expression node.Node
|
||||
}
|
||||
|
||||
// NewAssign node constructor
|
||||
func NewAssign(Variable node.Node, Expression node.Node) *Assign {
|
||||
return &Assign{
|
||||
FreeFloating: nil,
|
||||
Variable: Variable,
|
||||
Expression: Expression,
|
||||
}
|
||||
}
|
||||
|
||||
// SetPosition sets node position
|
||||
func (n *Assign) SetPosition(p *position.Position) {
|
||||
n.Position = p
|
||||
}
|
||||
|
||||
// GetPosition returns node positions
|
||||
func (n *Assign) GetPosition() *position.Position {
|
||||
return n.Position
|
||||
}
|
||||
|
||||
func (n *Assign) GetFreeFloating() *freefloating.Collection {
|
||||
return &n.FreeFloating
|
||||
}
|
||||
|
||||
// Attributes returns node attributes as map
|
||||
func (n *Assign) Attributes() map[string]interface{} {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Walk traverses nodes
|
||||
// Walk is invoked recursively until v.EnterNode returns true
|
||||
func (n *Assign) Walk(v walker.Visitor) {
|
||||
if v.EnterNode(n) == false {
|
||||
return
|
||||
}
|
||||
|
||||
if n.Variable != nil {
|
||||
v.EnterChildNode("Variable", n)
|
||||
n.Variable.Walk(v)
|
||||
v.LeaveChildNode("Variable", n)
|
||||
}
|
||||
|
||||
if n.Expression != nil {
|
||||
v.EnterChildNode("Expression", n)
|
||||
n.Expression.Walk(v)
|
||||
v.LeaveChildNode("Expression", n)
|
||||
}
|
||||
|
||||
v.LeaveNode(n)
|
||||
}
|
@ -1,66 +0,0 @@
|
||||
package assign
|
||||
|
||||
import (
|
||||
"github.com/z7zmey/php-parser/freefloating"
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
"github.com/z7zmey/php-parser/position"
|
||||
"github.com/z7zmey/php-parser/walker"
|
||||
)
|
||||
|
||||
// Reference node
|
||||
type Reference struct {
|
||||
FreeFloating freefloating.Collection
|
||||
Position *position.Position
|
||||
Variable node.Node
|
||||
Expression node.Node
|
||||
}
|
||||
|
||||
// NewReference node constructor
|
||||
func NewReference(Variable node.Node, Expression node.Node) *Reference {
|
||||
return &Reference{
|
||||
FreeFloating: nil,
|
||||
Variable: Variable,
|
||||
Expression: Expression,
|
||||
}
|
||||
}
|
||||
|
||||
// SetPosition sets node position
|
||||
func (n *Reference) SetPosition(p *position.Position) {
|
||||
n.Position = p
|
||||
}
|
||||
|
||||
// GetPosition returns node positions
|
||||
func (n *Reference) GetPosition() *position.Position {
|
||||
return n.Position
|
||||
}
|
||||
|
||||
func (n *Reference) GetFreeFloating() *freefloating.Collection {
|
||||
return &n.FreeFloating
|
||||
}
|
||||
|
||||
// Attributes returns node attributes as map
|
||||
func (n *Reference) Attributes() map[string]interface{} {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Walk traverses nodes
|
||||
// Walk is invoked recursively until v.EnterNode returns true
|
||||
func (n *Reference) Walk(v walker.Visitor) {
|
||||
if v.EnterNode(n) == false {
|
||||
return
|
||||
}
|
||||
|
||||
if n.Variable != nil {
|
||||
v.EnterChildNode("Variable", n)
|
||||
n.Variable.Walk(v)
|
||||
v.LeaveChildNode("Variable", n)
|
||||
}
|
||||
|
||||
if n.Expression != nil {
|
||||
v.EnterChildNode("Expression", n)
|
||||
n.Expression.Walk(v)
|
||||
v.LeaveChildNode("Expression", n)
|
||||
}
|
||||
|
||||
v.LeaveNode(n)
|
||||
}
|
@ -1,66 +0,0 @@
|
||||
package assign
|
||||
|
||||
import (
|
||||
"github.com/z7zmey/php-parser/freefloating"
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
"github.com/z7zmey/php-parser/position"
|
||||
"github.com/z7zmey/php-parser/walker"
|
||||
)
|
||||
|
||||
// BitwiseAnd node
|
||||
type BitwiseAnd struct {
|
||||
FreeFloating freefloating.Collection
|
||||
Position *position.Position
|
||||
Variable node.Node
|
||||
Expression node.Node
|
||||
}
|
||||
|
||||
// NewBitwiseAnd node constructor
|
||||
func NewBitwiseAnd(Variable node.Node, Expression node.Node) *BitwiseAnd {
|
||||
return &BitwiseAnd{
|
||||
FreeFloating: nil,
|
||||
Variable: Variable,
|
||||
Expression: Expression,
|
||||
}
|
||||
}
|
||||
|
||||
// SetPosition sets node position
|
||||
func (n *BitwiseAnd) SetPosition(p *position.Position) {
|
||||
n.Position = p
|
||||
}
|
||||
|
||||
// GetPosition returns node positions
|
||||
func (n *BitwiseAnd) GetPosition() *position.Position {
|
||||
return n.Position
|
||||
}
|
||||
|
||||
func (n *BitwiseAnd) GetFreeFloating() *freefloating.Collection {
|
||||
return &n.FreeFloating
|
||||
}
|
||||
|
||||
// Attributes returns node attributes as map
|
||||
func (n *BitwiseAnd) Attributes() map[string]interface{} {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Walk traverses nodes
|
||||
// Walk is invoked recursively until v.EnterNode returns true
|
||||
func (n *BitwiseAnd) Walk(v walker.Visitor) {
|
||||
if v.EnterNode(n) == false {
|
||||
return
|
||||
}
|
||||
|
||||
if n.Variable != nil {
|
||||
v.EnterChildNode("Variable", n)
|
||||
n.Variable.Walk(v)
|
||||
v.LeaveChildNode("Variable", n)
|
||||
}
|
||||
|
||||
if n.Expression != nil {
|
||||
v.EnterChildNode("Expression", n)
|
||||
n.Expression.Walk(v)
|
||||
v.LeaveChildNode("Expression", n)
|
||||
}
|
||||
|
||||
v.LeaveNode(n)
|
||||
}
|
@ -1,66 +0,0 @@
|
||||
package assign
|
||||
|
||||
import (
|
||||
"github.com/z7zmey/php-parser/freefloating"
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
"github.com/z7zmey/php-parser/position"
|
||||
"github.com/z7zmey/php-parser/walker"
|
||||
)
|
||||
|
||||
// BitwiseOr node
|
||||
type BitwiseOr struct {
|
||||
FreeFloating freefloating.Collection
|
||||
Position *position.Position
|
||||
Variable node.Node
|
||||
Expression node.Node
|
||||
}
|
||||
|
||||
// NewBitwiseOr node constructor
|
||||
func NewBitwiseOr(Variable node.Node, Expression node.Node) *BitwiseOr {
|
||||
return &BitwiseOr{
|
||||
FreeFloating: nil,
|
||||
Variable: Variable,
|
||||
Expression: Expression,
|
||||
}
|
||||
}
|
||||
|
||||
// SetPosition sets node position
|
||||
func (n *BitwiseOr) SetPosition(p *position.Position) {
|
||||
n.Position = p
|
||||
}
|
||||
|
||||
// GetPosition returns node positions
|
||||
func (n *BitwiseOr) GetPosition() *position.Position {
|
||||
return n.Position
|
||||
}
|
||||
|
||||
func (n *BitwiseOr) GetFreeFloating() *freefloating.Collection {
|
||||
return &n.FreeFloating
|
||||
}
|
||||
|
||||
// Attributes returns node attributes as map
|
||||
func (n *BitwiseOr) Attributes() map[string]interface{} {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Walk traverses nodes
|
||||
// Walk is invoked recursively until v.EnterNode returns true
|
||||
func (n *BitwiseOr) Walk(v walker.Visitor) {
|
||||
if v.EnterNode(n) == false {
|
||||
return
|
||||
}
|
||||
|
||||
if n.Variable != nil {
|
||||
v.EnterChildNode("Variable", n)
|
||||
n.Variable.Walk(v)
|
||||
v.LeaveChildNode("Variable", n)
|
||||
}
|
||||
|
||||
if n.Expression != nil {
|
||||
v.EnterChildNode("Expression", n)
|
||||
n.Expression.Walk(v)
|
||||
v.LeaveChildNode("Expression", n)
|
||||
}
|
||||
|
||||
v.LeaveNode(n)
|
||||
}
|
@ -1,66 +0,0 @@
|
||||
package assign
|
||||
|
||||
import (
|
||||
"github.com/z7zmey/php-parser/freefloating"
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
"github.com/z7zmey/php-parser/position"
|
||||
"github.com/z7zmey/php-parser/walker"
|
||||
)
|
||||
|
||||
// BitwiseXor node
|
||||
type BitwiseXor struct {
|
||||
FreeFloating freefloating.Collection
|
||||
Position *position.Position
|
||||
Variable node.Node
|
||||
Expression node.Node
|
||||
}
|
||||
|
||||
// NewBitwiseXor node constructor
|
||||
func NewBitwiseXor(Variable node.Node, Expression node.Node) *BitwiseXor {
|
||||
return &BitwiseXor{
|
||||
FreeFloating: nil,
|
||||
Variable: Variable,
|
||||
Expression: Expression,
|
||||
}
|
||||
}
|
||||
|
||||
// SetPosition sets node position
|
||||
func (n *BitwiseXor) SetPosition(p *position.Position) {
|
||||
n.Position = p
|
||||
}
|
||||
|
||||
// GetPosition returns node positions
|
||||
func (n *BitwiseXor) GetPosition() *position.Position {
|
||||
return n.Position
|
||||
}
|
||||
|
||||
func (n *BitwiseXor) GetFreeFloating() *freefloating.Collection {
|
||||
return &n.FreeFloating
|
||||
}
|
||||
|
||||
// Attributes returns node attributes as map
|
||||
func (n *BitwiseXor) Attributes() map[string]interface{} {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Walk traverses nodes
|
||||
// Walk is invoked recursively until v.EnterNode returns true
|
||||
func (n *BitwiseXor) Walk(v walker.Visitor) {
|
||||
if v.EnterNode(n) == false {
|
||||
return
|
||||
}
|
||||
|
||||
if n.Variable != nil {
|
||||
v.EnterChildNode("Variable", n)
|
||||
n.Variable.Walk(v)
|
||||
v.LeaveChildNode("Variable", n)
|
||||
}
|
||||
|
||||
if n.Expression != nil {
|
||||
v.EnterChildNode("Expression", n)
|
||||
n.Expression.Walk(v)
|
||||
v.LeaveChildNode("Expression", n)
|
||||
}
|
||||
|
||||
v.LeaveNode(n)
|
||||
}
|
@ -1,66 +0,0 @@
|
||||
package assign
|
||||
|
||||
import (
|
||||
"github.com/z7zmey/php-parser/freefloating"
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
"github.com/z7zmey/php-parser/position"
|
||||
"github.com/z7zmey/php-parser/walker"
|
||||
)
|
||||
|
||||
// Coalesce node
|
||||
type Coalesce struct {
|
||||
FreeFloating freefloating.Collection
|
||||
Position *position.Position
|
||||
Variable node.Node
|
||||
Expression node.Node
|
||||
}
|
||||
|
||||
// NewCoalesce node constructor
|
||||
func NewCoalesce(Variable node.Node, Expression node.Node) *Coalesce {
|
||||
return &Coalesce{
|
||||
FreeFloating: nil,
|
||||
Variable: Variable,
|
||||
Expression: Expression,
|
||||
}
|
||||
}
|
||||
|
||||
// SetPosition sets node position
|
||||
func (n *Coalesce) SetPosition(p *position.Position) {
|
||||
n.Position = p
|
||||
}
|
||||
|
||||
// GetPosition returns node positions
|
||||
func (n *Coalesce) GetPosition() *position.Position {
|
||||
return n.Position
|
||||
}
|
||||
|
||||
func (n *Coalesce) GetFreeFloating() *freefloating.Collection {
|
||||
return &n.FreeFloating
|
||||
}
|
||||
|
||||
// Attributes returns node attributes as map
|
||||
func (n *Coalesce) Attributes() map[string]interface{} {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Walk traverses nodes
|
||||
// Walk is invoked recursively until v.EnterNode returns true
|
||||
func (n *Coalesce) Walk(v walker.Visitor) {
|
||||
if v.EnterNode(n) == false {
|
||||
return
|
||||
}
|
||||
|
||||
if n.Variable != nil {
|
||||
v.EnterChildNode("Variable", n)
|
||||
n.Variable.Walk(v)
|
||||
v.LeaveChildNode("Variable", n)
|
||||
}
|
||||
|
||||
if n.Expression != nil {
|
||||
v.EnterChildNode("Expression", n)
|
||||
n.Expression.Walk(v)
|
||||
v.LeaveChildNode("Expression", n)
|
||||
}
|
||||
|
||||
v.LeaveNode(n)
|
||||
}
|
@ -1,66 +0,0 @@
|
||||
package assign
|
||||
|
||||
import (
|
||||
"github.com/z7zmey/php-parser/freefloating"
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
"github.com/z7zmey/php-parser/position"
|
||||
"github.com/z7zmey/php-parser/walker"
|
||||
)
|
||||
|
||||
// Concat node
|
||||
type Concat struct {
|
||||
FreeFloating freefloating.Collection
|
||||
Position *position.Position
|
||||
Variable node.Node
|
||||
Expression node.Node
|
||||
}
|
||||
|
||||
// NewConcat node constructor
|
||||
func NewConcat(Variable node.Node, Expression node.Node) *Concat {
|
||||
return &Concat{
|
||||
FreeFloating: nil,
|
||||
Variable: Variable,
|
||||
Expression: Expression,
|
||||
}
|
||||
}
|
||||
|
||||
// SetPosition sets node position
|
||||
func (n *Concat) SetPosition(p *position.Position) {
|
||||
n.Position = p
|
||||
}
|
||||
|
||||
// GetPosition returns node positions
|
||||
func (n *Concat) GetPosition() *position.Position {
|
||||
return n.Position
|
||||
}
|
||||
|
||||
func (n *Concat) GetFreeFloating() *freefloating.Collection {
|
||||
return &n.FreeFloating
|
||||
}
|
||||
|
||||
// Attributes returns node attributes as map
|
||||
func (n *Concat) Attributes() map[string]interface{} {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Walk traverses nodes
|
||||
// Walk is invoked recursively until v.EnterNode returns true
|
||||
func (n *Concat) Walk(v walker.Visitor) {
|
||||
if v.EnterNode(n) == false {
|
||||
return
|
||||
}
|
||||
|
||||
if n.Variable != nil {
|
||||
v.EnterChildNode("Variable", n)
|
||||
n.Variable.Walk(v)
|
||||
v.LeaveChildNode("Variable", n)
|
||||
}
|
||||
|
||||
if n.Expression != nil {
|
||||
v.EnterChildNode("Expression", n)
|
||||
n.Expression.Walk(v)
|
||||
v.LeaveChildNode("Expression", n)
|
||||
}
|
||||
|
||||
v.LeaveNode(n)
|
||||
}
|
@ -1,66 +0,0 @@
|
||||
package assign
|
||||
|
||||
import (
|
||||
"github.com/z7zmey/php-parser/freefloating"
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
"github.com/z7zmey/php-parser/position"
|
||||
"github.com/z7zmey/php-parser/walker"
|
||||
)
|
||||
|
||||
// Div node
|
||||
type Div struct {
|
||||
FreeFloating freefloating.Collection
|
||||
Position *position.Position
|
||||
Variable node.Node
|
||||
Expression node.Node
|
||||
}
|
||||
|
||||
// NewDiv node constructor
|
||||
func NewDiv(Variable node.Node, Expression node.Node) *Div {
|
||||
return &Div{
|
||||
FreeFloating: nil,
|
||||
Variable: Variable,
|
||||
Expression: Expression,
|
||||
}
|
||||
}
|
||||
|
||||
// SetPosition sets node position
|
||||
func (n *Div) SetPosition(p *position.Position) {
|
||||
n.Position = p
|
||||
}
|
||||
|
||||
// GetPosition returns node positions
|
||||
func (n *Div) GetPosition() *position.Position {
|
||||
return n.Position
|
||||
}
|
||||
|
||||
func (n *Div) GetFreeFloating() *freefloating.Collection {
|
||||
return &n.FreeFloating
|
||||
}
|
||||
|
||||
// Attributes returns node attributes as map
|
||||
func (n *Div) Attributes() map[string]interface{} {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Walk traverses nodes
|
||||
// Walk is invoked recursively until v.EnterNode returns true
|
||||
func (n *Div) Walk(v walker.Visitor) {
|
||||
if v.EnterNode(n) == false {
|
||||
return
|
||||
}
|
||||
|
||||
if n.Variable != nil {
|
||||
v.EnterChildNode("Variable", n)
|
||||
n.Variable.Walk(v)
|
||||
v.LeaveChildNode("Variable", n)
|
||||
}
|
||||
|
||||
if n.Expression != nil {
|
||||
v.EnterChildNode("Expression", n)
|
||||
n.Expression.Walk(v)
|
||||
v.LeaveChildNode("Expression", n)
|
||||
}
|
||||
|
||||
v.LeaveNode(n)
|
||||
}
|
@ -1,66 +0,0 @@
|
||||
package assign
|
||||
|
||||
import (
|
||||
"github.com/z7zmey/php-parser/freefloating"
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
"github.com/z7zmey/php-parser/position"
|
||||
"github.com/z7zmey/php-parser/walker"
|
||||
)
|
||||
|
||||
// Minus node
|
||||
type Minus struct {
|
||||
FreeFloating freefloating.Collection
|
||||
Position *position.Position
|
||||
Variable node.Node
|
||||
Expression node.Node
|
||||
}
|
||||
|
||||
// NewMinus node constructor
|
||||
func NewMinus(Variable node.Node, Expression node.Node) *Minus {
|
||||
return &Minus{
|
||||
FreeFloating: nil,
|
||||
Variable: Variable,
|
||||
Expression: Expression,
|
||||
}
|
||||
}
|
||||
|
||||
// SetPosition sets node position
|
||||
func (n *Minus) SetPosition(p *position.Position) {
|
||||
n.Position = p
|
||||
}
|
||||
|
||||
// GetPosition returns node positions
|
||||
func (n *Minus) GetPosition() *position.Position {
|
||||
return n.Position
|
||||
}
|
||||
|
||||
func (n *Minus) GetFreeFloating() *freefloating.Collection {
|
||||
return &n.FreeFloating
|
||||
}
|
||||
|
||||
// Attributes returns node attributes as map
|
||||
func (n *Minus) Attributes() map[string]interface{} {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Walk traverses nodes
|
||||
// Walk is invoked recursively until v.EnterNode returns true
|
||||
func (n *Minus) Walk(v walker.Visitor) {
|
||||
if v.EnterNode(n) == false {
|
||||
return
|
||||
}
|
||||
|
||||
if n.Variable != nil {
|
||||
v.EnterChildNode("Variable", n)
|
||||
n.Variable.Walk(v)
|
||||
v.LeaveChildNode("Variable", n)
|
||||
}
|
||||
|
||||
if n.Expression != nil {
|
||||
v.EnterChildNode("Expression", n)
|
||||
n.Expression.Walk(v)
|
||||
v.LeaveChildNode("Expression", n)
|
||||
}
|
||||
|
||||
v.LeaveNode(n)
|
||||
}
|
@ -1,66 +0,0 @@
|
||||
package assign
|
||||
|
||||
import (
|
||||
"github.com/z7zmey/php-parser/freefloating"
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
"github.com/z7zmey/php-parser/position"
|
||||
"github.com/z7zmey/php-parser/walker"
|
||||
)
|
||||
|
||||
// Mod node
|
||||
type Mod struct {
|
||||
FreeFloating freefloating.Collection
|
||||
Position *position.Position
|
||||
Variable node.Node
|
||||
Expression node.Node
|
||||
}
|
||||
|
||||
// NewMod node constructor
|
||||
func NewMod(Variable node.Node, Expression node.Node) *Mod {
|
||||
return &Mod{
|
||||
FreeFloating: nil,
|
||||
Variable: Variable,
|
||||
Expression: Expression,
|
||||
}
|
||||
}
|
||||
|
||||
// SetPosition sets node position
|
||||
func (n *Mod) SetPosition(p *position.Position) {
|
||||
n.Position = p
|
||||
}
|
||||
|
||||
// GetPosition returns node positions
|
||||
func (n *Mod) GetPosition() *position.Position {
|
||||
return n.Position
|
||||
}
|
||||
|
||||
func (n *Mod) GetFreeFloating() *freefloating.Collection {
|
||||
return &n.FreeFloating
|
||||
}
|
||||
|
||||
// Attributes returns node attributes as map
|
||||
func (n *Mod) Attributes() map[string]interface{} {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Walk traverses nodes
|
||||
// Walk is invoked recursively until v.EnterNode returns true
|
||||
func (n *Mod) Walk(v walker.Visitor) {
|
||||
if v.EnterNode(n) == false {
|
||||
return
|
||||
}
|
||||
|
||||
if n.Variable != nil {
|
||||
v.EnterChildNode("Variable", n)
|
||||
n.Variable.Walk(v)
|
||||
v.LeaveChildNode("Variable", n)
|
||||
}
|
||||
|
||||
if n.Expression != nil {
|
||||
v.EnterChildNode("Expression", n)
|
||||
n.Expression.Walk(v)
|
||||
v.LeaveChildNode("Expression", n)
|
||||
}
|
||||
|
||||
v.LeaveNode(n)
|
||||
}
|
@ -1,66 +0,0 @@
|
||||
package assign
|
||||
|
||||
import (
|
||||
"github.com/z7zmey/php-parser/freefloating"
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
"github.com/z7zmey/php-parser/position"
|
||||
"github.com/z7zmey/php-parser/walker"
|
||||
)
|
||||
|
||||
// Mul node
|
||||
type Mul struct {
|
||||
FreeFloating freefloating.Collection
|
||||
Position *position.Position
|
||||
Variable node.Node
|
||||
Expression node.Node
|
||||
}
|
||||
|
||||
// NewMul node constructor
|
||||
func NewMul(Variable node.Node, Expression node.Node) *Mul {
|
||||
return &Mul{
|
||||
FreeFloating: nil,
|
||||
Variable: Variable,
|
||||
Expression: Expression,
|
||||
}
|
||||
}
|
||||
|
||||
// SetPosition sets node position
|
||||
func (n *Mul) SetPosition(p *position.Position) {
|
||||
n.Position = p
|
||||
}
|
||||
|
||||
// GetPosition returns node positions
|
||||
func (n *Mul) GetPosition() *position.Position {
|
||||
return n.Position
|
||||
}
|
||||
|
||||
func (n *Mul) GetFreeFloating() *freefloating.Collection {
|
||||
return &n.FreeFloating
|
||||
}
|
||||
|
||||
// Attributes returns node attributes as map
|
||||
func (n *Mul) Attributes() map[string]interface{} {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Walk traverses nodes
|
||||
// Walk is invoked recursively until v.EnterNode returns true
|
||||
func (n *Mul) Walk(v walker.Visitor) {
|
||||
if v.EnterNode(n) == false {
|
||||
return
|
||||
}
|
||||
|
||||
if n.Variable != nil {
|
||||
v.EnterChildNode("Variable", n)
|
||||
n.Variable.Walk(v)
|
||||
v.LeaveChildNode("Variable", n)
|
||||
}
|
||||
|
||||
if n.Expression != nil {
|
||||
v.EnterChildNode("Expression", n)
|
||||
n.Expression.Walk(v)
|
||||
v.LeaveChildNode("Expression", n)
|
||||
}
|
||||
|
||||
v.LeaveNode(n)
|
||||
}
|
@ -1,66 +0,0 @@
|
||||
package assign
|
||||
|
||||
import (
|
||||
"github.com/z7zmey/php-parser/freefloating"
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
"github.com/z7zmey/php-parser/position"
|
||||
"github.com/z7zmey/php-parser/walker"
|
||||
)
|
||||
|
||||
// Plus node
|
||||
type Plus struct {
|
||||
FreeFloating freefloating.Collection
|
||||
Position *position.Position
|
||||
Variable node.Node
|
||||
Expression node.Node
|
||||
}
|
||||
|
||||
// NewPlus node constructor
|
||||
func NewPlus(Variable node.Node, Expression node.Node) *Plus {
|
||||
return &Plus{
|
||||
FreeFloating: nil,
|
||||
Variable: Variable,
|
||||
Expression: Expression,
|
||||
}
|
||||
}
|
||||
|
||||
// SetPosition sets node position
|
||||
func (n *Plus) SetPosition(p *position.Position) {
|
||||
n.Position = p
|
||||
}
|
||||
|
||||
// GetPosition returns node positions
|
||||
func (n *Plus) GetPosition() *position.Position {
|
||||
return n.Position
|
||||
}
|
||||
|
||||
func (n *Plus) GetFreeFloating() *freefloating.Collection {
|
||||
return &n.FreeFloating
|
||||
}
|
||||
|
||||
// Attributes returns node attributes as map
|
||||
func (n *Plus) Attributes() map[string]interface{} {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Walk traverses nodes
|
||||
// Walk is invoked recursively until v.EnterNode returns true
|
||||
func (n *Plus) Walk(v walker.Visitor) {
|
||||
if v.EnterNode(n) == false {
|
||||
return
|
||||
}
|
||||
|
||||
if n.Variable != nil {
|
||||
v.EnterChildNode("Variable", n)
|
||||
n.Variable.Walk(v)
|
||||
v.LeaveChildNode("Variable", n)
|
||||
}
|
||||
|
||||
if n.Expression != nil {
|
||||
v.EnterChildNode("Expression", n)
|
||||
n.Expression.Walk(v)
|
||||
v.LeaveChildNode("Expression", n)
|
||||
}
|
||||
|
||||
v.LeaveNode(n)
|
||||
}
|
@ -1,66 +0,0 @@
|
||||
package assign
|
||||
|
||||
import (
|
||||
"github.com/z7zmey/php-parser/freefloating"
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
"github.com/z7zmey/php-parser/position"
|
||||
"github.com/z7zmey/php-parser/walker"
|
||||
)
|
||||
|
||||
// Pow node
|
||||
type Pow struct {
|
||||
FreeFloating freefloating.Collection
|
||||
Position *position.Position
|
||||
Variable node.Node
|
||||
Expression node.Node
|
||||
}
|
||||
|
||||
// NewPow node constructor
|
||||
func NewPow(Variable node.Node, Expression node.Node) *Pow {
|
||||
return &Pow{
|
||||
FreeFloating: nil,
|
||||
Variable: Variable,
|
||||
Expression: Expression,
|
||||
}
|
||||
}
|
||||
|
||||
// SetPosition sets node position
|
||||
func (n *Pow) SetPosition(p *position.Position) {
|
||||
n.Position = p
|
||||
}
|
||||
|
||||
// GetPosition returns node positions
|
||||
func (n *Pow) GetPosition() *position.Position {
|
||||
return n.Position
|
||||
}
|
||||
|
||||
func (n *Pow) GetFreeFloating() *freefloating.Collection {
|
||||
return &n.FreeFloating
|
||||
}
|
||||
|
||||
// Attributes returns node attributes as map
|
||||
func (n *Pow) Attributes() map[string]interface{} {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Walk traverses nodes
|
||||
// Walk is invoked recursively until v.EnterNode returns true
|
||||
func (n *Pow) Walk(v walker.Visitor) {
|
||||
if v.EnterNode(n) == false {
|
||||
return
|
||||
}
|
||||
|
||||
if n.Variable != nil {
|
||||
v.EnterChildNode("Variable", n)
|
||||
n.Variable.Walk(v)
|
||||
v.LeaveChildNode("Variable", n)
|
||||
}
|
||||
|
||||
if n.Expression != nil {
|
||||
v.EnterChildNode("Expression", n)
|
||||
n.Expression.Walk(v)
|
||||
v.LeaveChildNode("Expression", n)
|
||||
}
|
||||
|
||||
v.LeaveNode(n)
|
||||
}
|
@ -1,66 +0,0 @@
|
||||
package assign
|
||||
|
||||
import (
|
||||
"github.com/z7zmey/php-parser/freefloating"
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
"github.com/z7zmey/php-parser/position"
|
||||
"github.com/z7zmey/php-parser/walker"
|
||||
)
|
||||
|
||||
// ShiftLeft node
|
||||
type ShiftLeft struct {
|
||||
FreeFloating freefloating.Collection
|
||||
Position *position.Position
|
||||
Variable node.Node
|
||||
Expression node.Node
|
||||
}
|
||||
|
||||
// NewShiftLeft node constructor
|
||||
func NewShiftLeft(Variable node.Node, Expression node.Node) *ShiftLeft {
|
||||
return &ShiftLeft{
|
||||
FreeFloating: nil,
|
||||
Variable: Variable,
|
||||
Expression: Expression,
|
||||
}
|
||||
}
|
||||
|
||||
// SetPosition sets node position
|
||||
func (n *ShiftLeft) SetPosition(p *position.Position) {
|
||||
n.Position = p
|
||||
}
|
||||
|
||||
// GetPosition returns node positions
|
||||
func (n *ShiftLeft) GetPosition() *position.Position {
|
||||
return n.Position
|
||||
}
|
||||
|
||||
func (n *ShiftLeft) GetFreeFloating() *freefloating.Collection {
|
||||
return &n.FreeFloating
|
||||
}
|
||||
|
||||
// Attributes returns node attributes as map
|
||||
func (n *ShiftLeft) Attributes() map[string]interface{} {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Walk traverses nodes
|
||||
// Walk is invoked recursively until v.EnterNode returns true
|
||||
func (n *ShiftLeft) Walk(v walker.Visitor) {
|
||||
if v.EnterNode(n) == false {
|
||||
return
|
||||
}
|
||||
|
||||
if n.Variable != nil {
|
||||
v.EnterChildNode("Variable", n)
|
||||
n.Variable.Walk(v)
|
||||
v.LeaveChildNode("Variable", n)
|
||||
}
|
||||
|
||||
if n.Expression != nil {
|
||||
v.EnterChildNode("Expression", n)
|
||||
n.Expression.Walk(v)
|
||||
v.LeaveChildNode("Expression", n)
|
||||
}
|
||||
|
||||
v.LeaveNode(n)
|
||||
}
|
@ -1,66 +0,0 @@
|
||||
package assign
|
||||
|
||||
import (
|
||||
"github.com/z7zmey/php-parser/freefloating"
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
"github.com/z7zmey/php-parser/position"
|
||||
"github.com/z7zmey/php-parser/walker"
|
||||
)
|
||||
|
||||
// ShiftRight node
|
||||
type ShiftRight struct {
|
||||
FreeFloating freefloating.Collection
|
||||
Position *position.Position
|
||||
Variable node.Node
|
||||
Expression node.Node
|
||||
}
|
||||
|
||||
// NewShiftRight node constructor
|
||||
func NewShiftRight(Variable node.Node, Expression node.Node) *ShiftRight {
|
||||
return &ShiftRight{
|
||||
FreeFloating: nil,
|
||||
Variable: Variable,
|
||||
Expression: Expression,
|
||||
}
|
||||
}
|
||||
|
||||
// SetPosition sets node position
|
||||
func (n *ShiftRight) SetPosition(p *position.Position) {
|
||||
n.Position = p
|
||||
}
|
||||
|
||||
// GetPosition returns node positions
|
||||
func (n *ShiftRight) GetPosition() *position.Position {
|
||||
return n.Position
|
||||
}
|
||||
|
||||
func (n *ShiftRight) GetFreeFloating() *freefloating.Collection {
|
||||
return &n.FreeFloating
|
||||
}
|
||||
|
||||
// Attributes returns node attributes as map
|
||||
func (n *ShiftRight) Attributes() map[string]interface{} {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Walk traverses nodes
|
||||
// Walk is invoked recursively until v.EnterNode returns true
|
||||
func (n *ShiftRight) Walk(v walker.Visitor) {
|
||||
if v.EnterNode(n) == false {
|
||||
return
|
||||
}
|
||||
|
||||
if n.Variable != nil {
|
||||
v.EnterChildNode("Variable", n)
|
||||
n.Variable.Walk(v)
|
||||
v.LeaveChildNode("Variable", n)
|
||||
}
|
||||
|
||||
if n.Expression != nil {
|
||||
v.EnterChildNode("Expression", n)
|
||||
n.Expression.Walk(v)
|
||||
v.LeaveChildNode("Expression", n)
|
||||
}
|
||||
|
||||
v.LeaveNode(n)
|
||||
}
|
File diff suppressed because it is too large
Load Diff
@ -1,84 +0,0 @@
|
||||
package assign_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"gotest.tools/assert"
|
||||
|
||||
"github.com/z7zmey/php-parser/freefloating"
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
"github.com/z7zmey/php-parser/node/expr/assign"
|
||||
)
|
||||
|
||||
var expected freefloating.Collection = freefloating.Collection{
|
||||
freefloating.Start: []freefloating.String{
|
||||
{
|
||||
StringType: freefloating.WhiteSpaceType,
|
||||
Value: " ",
|
||||
Position: nil,
|
||||
},
|
||||
{
|
||||
StringType: freefloating.CommentType,
|
||||
Value: "//comment\n",
|
||||
Position: nil,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
var nodes = []node.Node{
|
||||
&assign.Reference{
|
||||
FreeFloating: expected,
|
||||
},
|
||||
&assign.Assign{
|
||||
FreeFloating: expected,
|
||||
},
|
||||
&assign.BitwiseAnd{
|
||||
FreeFloating: expected,
|
||||
},
|
||||
&assign.BitwiseOr{
|
||||
FreeFloating: expected,
|
||||
},
|
||||
&assign.BitwiseXor{
|
||||
FreeFloating: expected,
|
||||
},
|
||||
&assign.Coalesce{
|
||||
FreeFloating: expected,
|
||||
},
|
||||
&assign.Concat{
|
||||
FreeFloating: expected,
|
||||
},
|
||||
&assign.Div{
|
||||
FreeFloating: expected,
|
||||
},
|
||||
&assign.Minus{
|
||||
FreeFloating: expected,
|
||||
},
|
||||
&assign.Mod{
|
||||
FreeFloating: expected,
|
||||
},
|
||||
&assign.Mul{
|
||||
FreeFloating: expected,
|
||||
},
|
||||
&assign.Plus{
|
||||
FreeFloating: expected,
|
||||
},
|
||||
&assign.Pow{
|
||||
FreeFloating: expected,
|
||||
},
|
||||
&assign.ShiftLeft{
|
||||
FreeFloating: expected,
|
||||
},
|
||||
&assign.ShiftRight{
|
||||
FreeFloating: expected,
|
||||
},
|
||||
&assign.ShiftRight{
|
||||
FreeFloating: expected,
|
||||
},
|
||||
}
|
||||
|
||||
func TestMeta(t *testing.T) {
|
||||
for _, n := range nodes {
|
||||
actual := *n.GetFreeFloating()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
}
|
||||
}
|
@ -1,18 +0,0 @@
|
||||
package assign_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"gotest.tools/assert"
|
||||
|
||||
"github.com/z7zmey/php-parser/position"
|
||||
)
|
||||
|
||||
func TestPosition(t *testing.T) {
|
||||
expected := position.NewPosition(1, 1, 1, 1)
|
||||
for _, n := range nodes {
|
||||
n.SetPosition(expected)
|
||||
actual := n.GetPosition()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
}
|
||||
}
|
@ -1,190 +0,0 @@
|
||||
package assign_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"gotest.tools/assert"
|
||||
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
"github.com/z7zmey/php-parser/node/expr"
|
||||
"github.com/z7zmey/php-parser/node/expr/assign"
|
||||
"github.com/z7zmey/php-parser/walker"
|
||||
)
|
||||
|
||||
var nodesToTest = []struct {
|
||||
node node.Node // node
|
||||
expectedVisitedKeys []string // visited keys
|
||||
expectedAttributes map[string]interface{}
|
||||
}{
|
||||
{
|
||||
&assign.Reference{
|
||||
Variable: &expr.Variable{},
|
||||
Expression: &expr.Variable{},
|
||||
},
|
||||
[]string{"Variable", "Expression"},
|
||||
nil,
|
||||
},
|
||||
{
|
||||
&assign.Assign{
|
||||
Variable: &expr.Variable{},
|
||||
Expression: &expr.Variable{},
|
||||
},
|
||||
[]string{"Variable", "Expression"},
|
||||
nil,
|
||||
},
|
||||
{
|
||||
&assign.BitwiseAnd{
|
||||
Variable: &expr.Variable{},
|
||||
Expression: &expr.Variable{},
|
||||
},
|
||||
[]string{"Variable", "Expression"},
|
||||
nil,
|
||||
},
|
||||
{
|
||||
&assign.BitwiseOr{
|
||||
Variable: &expr.Variable{},
|
||||
Expression: &expr.Variable{},
|
||||
},
|
||||
[]string{"Variable", "Expression"},
|
||||
nil,
|
||||
},
|
||||
{
|
||||
&assign.BitwiseXor{
|
||||
Variable: &expr.Variable{},
|
||||
Expression: &expr.Variable{},
|
||||
},
|
||||
[]string{"Variable", "Expression"},
|
||||
nil,
|
||||
},
|
||||
{
|
||||
&assign.Coalesce{
|
||||
Variable: &expr.Variable{},
|
||||
Expression: &expr.Variable{},
|
||||
},
|
||||
[]string{"Variable", "Expression"},
|
||||
nil,
|
||||
},
|
||||
{
|
||||
&assign.Concat{
|
||||
Variable: &expr.Variable{},
|
||||
Expression: &expr.Variable{},
|
||||
},
|
||||
[]string{"Variable", "Expression"},
|
||||
nil,
|
||||
},
|
||||
{
|
||||
&assign.Div{
|
||||
Variable: &expr.Variable{},
|
||||
Expression: &expr.Variable{},
|
||||
},
|
||||
[]string{"Variable", "Expression"},
|
||||
nil,
|
||||
},
|
||||
{
|
||||
&assign.Minus{
|
||||
Variable: &expr.Variable{},
|
||||
Expression: &expr.Variable{},
|
||||
},
|
||||
[]string{"Variable", "Expression"},
|
||||
nil,
|
||||
},
|
||||
{
|
||||
&assign.Mod{
|
||||
Variable: &expr.Variable{},
|
||||
Expression: &expr.Variable{},
|
||||
},
|
||||
[]string{"Variable", "Expression"},
|
||||
nil,
|
||||
},
|
||||
{
|
||||
&assign.Mul{
|
||||
Variable: &expr.Variable{},
|
||||
Expression: &expr.Variable{},
|
||||
},
|
||||
[]string{"Variable", "Expression"},
|
||||
nil,
|
||||
},
|
||||
{
|
||||
&assign.Plus{
|
||||
Variable: &expr.Variable{},
|
||||
Expression: &expr.Variable{},
|
||||
},
|
||||
[]string{"Variable", "Expression"},
|
||||
nil,
|
||||
},
|
||||
{
|
||||
&assign.Pow{
|
||||
Variable: &expr.Variable{},
|
||||
Expression: &expr.Variable{},
|
||||
},
|
||||
[]string{"Variable", "Expression"},
|
||||
nil,
|
||||
},
|
||||
{
|
||||
&assign.ShiftLeft{
|
||||
Variable: &expr.Variable{},
|
||||
Expression: &expr.Variable{},
|
||||
},
|
||||
[]string{"Variable", "Expression"},
|
||||
nil,
|
||||
},
|
||||
{
|
||||
&assign.ShiftRight{
|
||||
Variable: &expr.Variable{},
|
||||
Expression: &expr.Variable{},
|
||||
},
|
||||
[]string{"Variable", "Expression"},
|
||||
nil,
|
||||
},
|
||||
}
|
||||
|
||||
type visitorMock struct {
|
||||
visitChildren bool
|
||||
visitedKeys []string
|
||||
}
|
||||
|
||||
func (v *visitorMock) EnterNode(n walker.Walkable) bool { return v.visitChildren }
|
||||
func (v *visitorMock) LeaveNode(n walker.Walkable) {}
|
||||
func (v *visitorMock) EnterChildNode(key string, w walker.Walkable) {
|
||||
v.visitedKeys = append(v.visitedKeys, key)
|
||||
}
|
||||
func (v *visitorMock) LeaveChildNode(key string, w walker.Walkable) {}
|
||||
func (v *visitorMock) EnterChildList(key string, w walker.Walkable) {
|
||||
v.visitedKeys = append(v.visitedKeys, key)
|
||||
}
|
||||
func (v *visitorMock) LeaveChildList(key string, w walker.Walkable) {}
|
||||
|
||||
func TestVisitorDisableChildren(t *testing.T) {
|
||||
for _, tt := range nodesToTest {
|
||||
v := &visitorMock{false, []string{}}
|
||||
tt.node.Walk(v)
|
||||
|
||||
expected := []string{}
|
||||
actual := v.visitedKeys
|
||||
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
}
|
||||
}
|
||||
|
||||
func TestVisitor(t *testing.T) {
|
||||
for _, tt := range nodesToTest {
|
||||
v := &visitorMock{true, []string{}}
|
||||
tt.node.Walk(v)
|
||||
|
||||
expected := tt.expectedVisitedKeys
|
||||
actual := v.visitedKeys
|
||||
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
}
|
||||
}
|
||||
|
||||
// test Attributes()
|
||||
|
||||
func TestNameAttributes(t *testing.T) {
|
||||
for _, tt := range nodesToTest {
|
||||
expected := tt.expectedAttributes
|
||||
actual := tt.node.Attributes()
|
||||
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
}
|
||||
}
|
@ -1,66 +0,0 @@
|
||||
package binary
|
||||
|
||||
import (
|
||||
"github.com/z7zmey/php-parser/freefloating"
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
"github.com/z7zmey/php-parser/position"
|
||||
"github.com/z7zmey/php-parser/walker"
|
||||
)
|
||||
|
||||
// BitwiseAnd node
|
||||
type BitwiseAnd struct {
|
||||
FreeFloating freefloating.Collection
|
||||
Position *position.Position
|
||||
Left node.Node
|
||||
Right node.Node
|
||||
}
|
||||
|
||||
// NewBitwiseAnd node constructor
|
||||
func NewBitwiseAnd(Variable node.Node, Expression node.Node) *BitwiseAnd {
|
||||
return &BitwiseAnd{
|
||||
FreeFloating: nil,
|
||||
Left: Variable,
|
||||
Right: Expression,
|
||||
}
|
||||
}
|
||||
|
||||
// SetPosition sets node position
|
||||
func (n *BitwiseAnd) SetPosition(p *position.Position) {
|
||||
n.Position = p
|
||||
}
|
||||
|
||||
// GetPosition returns node positions
|
||||
func (n *BitwiseAnd) GetPosition() *position.Position {
|
||||
return n.Position
|
||||
}
|
||||
|
||||
func (n *BitwiseAnd) GetFreeFloating() *freefloating.Collection {
|
||||
return &n.FreeFloating
|
||||
}
|
||||
|
||||
// Attributes returns node attributes as map
|
||||
func (n *BitwiseAnd) Attributes() map[string]interface{} {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Walk traverses nodes
|
||||
// Walk is invoked recursively until v.EnterNode returns true
|
||||
func (n *BitwiseAnd) Walk(v walker.Visitor) {
|
||||
if v.EnterNode(n) == false {
|
||||
return
|
||||
}
|
||||
|
||||
if n.Left != nil {
|
||||
v.EnterChildNode("Left", n)
|
||||
n.Left.Walk(v)
|
||||
v.LeaveChildNode("Left", n)
|
||||
}
|
||||
|
||||
if n.Right != nil {
|
||||
v.EnterChildNode("Right", n)
|
||||
n.Right.Walk(v)
|
||||
v.LeaveChildNode("Right", n)
|
||||
}
|
||||
|
||||
v.LeaveNode(n)
|
||||
}
|
@ -1,66 +0,0 @@
|
||||
package binary
|
||||
|
||||
import (
|
||||
"github.com/z7zmey/php-parser/freefloating"
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
"github.com/z7zmey/php-parser/position"
|
||||
"github.com/z7zmey/php-parser/walker"
|
||||
)
|
||||
|
||||
// BitwiseOr node
|
||||
type BitwiseOr struct {
|
||||
FreeFloating freefloating.Collection
|
||||
Position *position.Position
|
||||
Left node.Node
|
||||
Right node.Node
|
||||
}
|
||||
|
||||
// NewBitwiseOr node constructor
|
||||
func NewBitwiseOr(Variable node.Node, Expression node.Node) *BitwiseOr {
|
||||
return &BitwiseOr{
|
||||
FreeFloating: nil,
|
||||
Left: Variable,
|
||||
Right: Expression,
|
||||
}
|
||||
}
|
||||
|
||||
// SetPosition sets node position
|
||||
func (n *BitwiseOr) SetPosition(p *position.Position) {
|
||||
n.Position = p
|
||||
}
|
||||
|
||||
// GetPosition returns node positions
|
||||
func (n *BitwiseOr) GetPosition() *position.Position {
|
||||
return n.Position
|
||||
}
|
||||
|
||||
func (n *BitwiseOr) GetFreeFloating() *freefloating.Collection {
|
||||
return &n.FreeFloating
|
||||
}
|
||||
|
||||
// Attributes returns node attributes as map
|
||||
func (n *BitwiseOr) Attributes() map[string]interface{} {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Walk traverses nodes
|
||||
// Walk is invoked recursively until v.EnterNode returns true
|
||||
func (n *BitwiseOr) Walk(v walker.Visitor) {
|
||||
if v.EnterNode(n) == false {
|
||||
return
|
||||
}
|
||||
|
||||
if n.Left != nil {
|
||||
v.EnterChildNode("Left", n)
|
||||
n.Left.Walk(v)
|
||||
v.LeaveChildNode("Left", n)
|
||||
}
|
||||
|
||||
if n.Right != nil {
|
||||
v.EnterChildNode("Right", n)
|
||||
n.Right.Walk(v)
|
||||
v.LeaveChildNode("Right", n)
|
||||
}
|
||||
|
||||
v.LeaveNode(n)
|
||||
}
|
@ -1,66 +0,0 @@
|
||||
package binary
|
||||
|
||||
import (
|
||||
"github.com/z7zmey/php-parser/freefloating"
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
"github.com/z7zmey/php-parser/position"
|
||||
"github.com/z7zmey/php-parser/walker"
|
||||
)
|
||||
|
||||
// BitwiseXor node
|
||||
type BitwiseXor struct {
|
||||
FreeFloating freefloating.Collection
|
||||
Position *position.Position
|
||||
Left node.Node
|
||||
Right node.Node
|
||||
}
|
||||
|
||||
// NewBitwiseXor node constructor
|
||||
func NewBitwiseXor(Variable node.Node, Expression node.Node) *BitwiseXor {
|
||||
return &BitwiseXor{
|
||||
FreeFloating: nil,
|
||||
Left: Variable,
|
||||
Right: Expression,
|
||||
}
|
||||
}
|
||||
|
||||
// SetPosition sets node position
|
||||
func (n *BitwiseXor) SetPosition(p *position.Position) {
|
||||
n.Position = p
|
||||
}
|
||||
|
||||
// GetPosition returns node positions
|
||||
func (n *BitwiseXor) GetPosition() *position.Position {
|
||||
return n.Position
|
||||
}
|
||||
|
||||
func (n *BitwiseXor) GetFreeFloating() *freefloating.Collection {
|
||||
return &n.FreeFloating
|
||||
}
|
||||
|
||||
// Attributes returns node attributes as map
|
||||
func (n *BitwiseXor) Attributes() map[string]interface{} {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Walk traverses nodes
|
||||
// Walk is invoked recursively until v.EnterNode returns true
|
||||
func (n *BitwiseXor) Walk(v walker.Visitor) {
|
||||
if v.EnterNode(n) == false {
|
||||
return
|
||||
}
|
||||
|
||||
if n.Left != nil {
|
||||
v.EnterChildNode("Left", n)
|
||||
n.Left.Walk(v)
|
||||
v.LeaveChildNode("Left", n)
|
||||
}
|
||||
|
||||
if n.Right != nil {
|
||||
v.EnterChildNode("Right", n)
|
||||
n.Right.Walk(v)
|
||||
v.LeaveChildNode("Right", n)
|
||||
}
|
||||
|
||||
v.LeaveNode(n)
|
||||
}
|
@ -1,66 +0,0 @@
|
||||
package binary
|
||||
|
||||
import (
|
||||
"github.com/z7zmey/php-parser/freefloating"
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
"github.com/z7zmey/php-parser/position"
|
||||
"github.com/z7zmey/php-parser/walker"
|
||||
)
|
||||
|
||||
// BooleanAnd node
|
||||
type BooleanAnd struct {
|
||||
FreeFloating freefloating.Collection
|
||||
Position *position.Position
|
||||
Left node.Node
|
||||
Right node.Node
|
||||
}
|
||||
|
||||
// NewBooleanAnd node constructor
|
||||
func NewBooleanAnd(Variable node.Node, Expression node.Node) *BooleanAnd {
|
||||
return &BooleanAnd{
|
||||
FreeFloating: nil,
|
||||
Left: Variable,
|
||||
Right: Expression,
|
||||
}
|
||||
}
|
||||
|
||||
// SetPosition sets node position
|
||||
func (n *BooleanAnd) SetPosition(p *position.Position) {
|
||||
n.Position = p
|
||||
}
|
||||
|
||||
// GetPosition returns node positions
|
||||
func (n *BooleanAnd) GetPosition() *position.Position {
|
||||
return n.Position
|
||||
}
|
||||
|
||||
func (n *BooleanAnd) GetFreeFloating() *freefloating.Collection {
|
||||
return &n.FreeFloating
|
||||
}
|
||||
|
||||
// Attributes returns node attributes as map
|
||||
func (n *BooleanAnd) Attributes() map[string]interface{} {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Walk traverses nodes
|
||||
// Walk is invoked recursively until v.EnterNode returns true
|
||||
func (n *BooleanAnd) Walk(v walker.Visitor) {
|
||||
if v.EnterNode(n) == false {
|
||||
return
|
||||
}
|
||||
|
||||
if n.Left != nil {
|
||||
v.EnterChildNode("Left", n)
|
||||
n.Left.Walk(v)
|
||||
v.LeaveChildNode("Left", n)
|
||||
}
|
||||
|
||||
if n.Right != nil {
|
||||
v.EnterChildNode("Right", n)
|
||||
n.Right.Walk(v)
|
||||
v.LeaveChildNode("Right", n)
|
||||
}
|
||||
|
||||
v.LeaveNode(n)
|
||||
}
|
@ -1,66 +0,0 @@
|
||||
package binary
|
||||
|
||||
import (
|
||||
"github.com/z7zmey/php-parser/freefloating"
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
"github.com/z7zmey/php-parser/position"
|
||||
"github.com/z7zmey/php-parser/walker"
|
||||
)
|
||||
|
||||
// BooleanOr node
|
||||
type BooleanOr struct {
|
||||
FreeFloating freefloating.Collection
|
||||
Position *position.Position
|
||||
Left node.Node
|
||||
Right node.Node
|
||||
}
|
||||
|
||||
// NewBooleanOr node constructor
|
||||
func NewBooleanOr(Variable node.Node, Expression node.Node) *BooleanOr {
|
||||
return &BooleanOr{
|
||||
FreeFloating: nil,
|
||||
Left: Variable,
|
||||
Right: Expression,
|
||||
}
|
||||
}
|
||||
|
||||
// SetPosition sets node position
|
||||
func (n *BooleanOr) SetPosition(p *position.Position) {
|
||||
n.Position = p
|
||||
}
|
||||
|
||||
// GetPosition returns node positions
|
||||
func (n *BooleanOr) GetPosition() *position.Position {
|
||||
return n.Position
|
||||
}
|
||||
|
||||
func (n *BooleanOr) GetFreeFloating() *freefloating.Collection {
|
||||
return &n.FreeFloating
|
||||
}
|
||||
|
||||
// Attributes returns node attributes as map
|
||||
func (n *BooleanOr) Attributes() map[string]interface{} {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Walk traverses nodes
|
||||
// Walk is invoked recursively until v.EnterNode returns true
|
||||
func (n *BooleanOr) Walk(v walker.Visitor) {
|
||||
if v.EnterNode(n) == false {
|
||||
return
|
||||
}
|
||||
|
||||
if n.Left != nil {
|
||||
v.EnterChildNode("Left", n)
|
||||
n.Left.Walk(v)
|
||||
v.LeaveChildNode("Left", n)
|
||||
}
|
||||
|
||||
if n.Right != nil {
|
||||
v.EnterChildNode("Right", n)
|
||||
n.Right.Walk(v)
|
||||
v.LeaveChildNode("Right", n)
|
||||
}
|
||||
|
||||
v.LeaveNode(n)
|
||||
}
|
@ -1,66 +0,0 @@
|
||||
package binary
|
||||
|
||||
import (
|
||||
"github.com/z7zmey/php-parser/freefloating"
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
"github.com/z7zmey/php-parser/position"
|
||||
"github.com/z7zmey/php-parser/walker"
|
||||
)
|
||||
|
||||
// Coalesce node
|
||||
type Coalesce struct {
|
||||
FreeFloating freefloating.Collection
|
||||
Position *position.Position
|
||||
Left node.Node
|
||||
Right node.Node
|
||||
}
|
||||
|
||||
// NewCoalesce node constructor
|
||||
func NewCoalesce(Variable node.Node, Expression node.Node) *Coalesce {
|
||||
return &Coalesce{
|
||||
FreeFloating: nil,
|
||||
Left: Variable,
|
||||
Right: Expression,
|
||||
}
|
||||
}
|
||||
|
||||
// SetPosition sets node position
|
||||
func (n *Coalesce) SetPosition(p *position.Position) {
|
||||
n.Position = p
|
||||
}
|
||||
|
||||
// GetPosition returns node positions
|
||||
func (n *Coalesce) GetPosition() *position.Position {
|
||||
return n.Position
|
||||
}
|
||||
|
||||
func (n *Coalesce) GetFreeFloating() *freefloating.Collection {
|
||||
return &n.FreeFloating
|
||||
}
|
||||
|
||||
// Attributes returns node attributes as map
|
||||
func (n *Coalesce) Attributes() map[string]interface{} {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Walk traverses nodes
|
||||
// Walk is invoked recursively until v.EnterNode returns true
|
||||
func (n *Coalesce) Walk(v walker.Visitor) {
|
||||
if v.EnterNode(n) == false {
|
||||
return
|
||||
}
|
||||
|
||||
if n.Left != nil {
|
||||
v.EnterChildNode("Left", n)
|
||||
n.Left.Walk(v)
|
||||
v.LeaveChildNode("Left", n)
|
||||
}
|
||||
|
||||
if n.Right != nil {
|
||||
v.EnterChildNode("Right", n)
|
||||
n.Right.Walk(v)
|
||||
v.LeaveChildNode("Right", n)
|
||||
}
|
||||
|
||||
v.LeaveNode(n)
|
||||
}
|
@ -1,66 +0,0 @@
|
||||
package binary
|
||||
|
||||
import (
|
||||
"github.com/z7zmey/php-parser/freefloating"
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
"github.com/z7zmey/php-parser/position"
|
||||
"github.com/z7zmey/php-parser/walker"
|
||||
)
|
||||
|
||||
// Concat node
|
||||
type Concat struct {
|
||||
FreeFloating freefloating.Collection
|
||||
Position *position.Position
|
||||
Left node.Node
|
||||
Right node.Node
|
||||
}
|
||||
|
||||
// NewConcat node constructor
|
||||
func NewConcat(Variable node.Node, Expression node.Node) *Concat {
|
||||
return &Concat{
|
||||
FreeFloating: nil,
|
||||
Left: Variable,
|
||||
Right: Expression,
|
||||
}
|
||||
}
|
||||
|
||||
// SetPosition sets node position
|
||||
func (n *Concat) SetPosition(p *position.Position) {
|
||||
n.Position = p
|
||||
}
|
||||
|
||||
// GetPosition returns node positions
|
||||
func (n *Concat) GetPosition() *position.Position {
|
||||
return n.Position
|
||||
}
|
||||
|
||||
func (n *Concat) GetFreeFloating() *freefloating.Collection {
|
||||
return &n.FreeFloating
|
||||
}
|
||||
|
||||
// Attributes returns node attributes as map
|
||||
func (n *Concat) Attributes() map[string]interface{} {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Walk traverses nodes
|
||||
// Walk is invoked recursively until v.EnterNode returns true
|
||||
func (n *Concat) Walk(v walker.Visitor) {
|
||||
if v.EnterNode(n) == false {
|
||||
return
|
||||
}
|
||||
|
||||
if n.Left != nil {
|
||||
v.EnterChildNode("Left", n)
|
||||
n.Left.Walk(v)
|
||||
v.LeaveChildNode("Left", n)
|
||||
}
|
||||
|
||||
if n.Right != nil {
|
||||
v.EnterChildNode("Right", n)
|
||||
n.Right.Walk(v)
|
||||
v.LeaveChildNode("Right", n)
|
||||
}
|
||||
|
||||
v.LeaveNode(n)
|
||||
}
|
@ -1,66 +0,0 @@
|
||||
package binary
|
||||
|
||||
import (
|
||||
"github.com/z7zmey/php-parser/freefloating"
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
"github.com/z7zmey/php-parser/position"
|
||||
"github.com/z7zmey/php-parser/walker"
|
||||
)
|
||||
|
||||
// Div node
|
||||
type Div struct {
|
||||
FreeFloating freefloating.Collection
|
||||
Position *position.Position
|
||||
Left node.Node
|
||||
Right node.Node
|
||||
}
|
||||
|
||||
// NewDiv node constructor
|
||||
func NewDiv(Variable node.Node, Expression node.Node) *Div {
|
||||
return &Div{
|
||||
FreeFloating: nil,
|
||||
Left: Variable,
|
||||
Right: Expression,
|
||||
}
|
||||
}
|
||||
|
||||
// SetPosition sets node position
|
||||
func (n *Div) SetPosition(p *position.Position) {
|
||||
n.Position = p
|
||||
}
|
||||
|
||||
// GetPosition returns node positions
|
||||
func (n *Div) GetPosition() *position.Position {
|
||||
return n.Position
|
||||
}
|
||||
|
||||
func (n *Div) GetFreeFloating() *freefloating.Collection {
|
||||
return &n.FreeFloating
|
||||
}
|
||||
|
||||
// Attributes returns node attributes as map
|
||||
func (n *Div) Attributes() map[string]interface{} {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Walk traverses nodes
|
||||
// Walk is invoked recursively until v.EnterNode returns true
|
||||
func (n *Div) Walk(v walker.Visitor) {
|
||||
if v.EnterNode(n) == false {
|
||||
return
|
||||
}
|
||||
|
||||
if n.Left != nil {
|
||||
v.EnterChildNode("Left", n)
|
||||
n.Left.Walk(v)
|
||||
v.LeaveChildNode("Left", n)
|
||||
}
|
||||
|
||||
if n.Right != nil {
|
||||
v.EnterChildNode("Right", n)
|
||||
n.Right.Walk(v)
|
||||
v.LeaveChildNode("Right", n)
|
||||
}
|
||||
|
||||
v.LeaveNode(n)
|
||||
}
|
@ -1,66 +0,0 @@
|
||||
package binary
|
||||
|
||||
import (
|
||||
"github.com/z7zmey/php-parser/freefloating"
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
"github.com/z7zmey/php-parser/position"
|
||||
"github.com/z7zmey/php-parser/walker"
|
||||
)
|
||||
|
||||
// Equal node
|
||||
type Equal struct {
|
||||
FreeFloating freefloating.Collection
|
||||
Position *position.Position
|
||||
Left node.Node
|
||||
Right node.Node
|
||||
}
|
||||
|
||||
// NewEqual node constructor
|
||||
func NewEqual(Variable node.Node, Expression node.Node) *Equal {
|
||||
return &Equal{
|
||||
FreeFloating: nil,
|
||||
Left: Variable,
|
||||
Right: Expression,
|
||||
}
|
||||
}
|
||||
|
||||
// SetPosition sets node position
|
||||
func (n *Equal) SetPosition(p *position.Position) {
|
||||
n.Position = p
|
||||
}
|
||||
|
||||
// GetPosition returns node positions
|
||||
func (n *Equal) GetPosition() *position.Position {
|
||||
return n.Position
|
||||
}
|
||||
|
||||
func (n *Equal) GetFreeFloating() *freefloating.Collection {
|
||||
return &n.FreeFloating
|
||||
}
|
||||
|
||||
// Attributes returns node attributes as map
|
||||
func (n *Equal) Attributes() map[string]interface{} {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Walk traverses nodes
|
||||
// Walk is invoked recursively until v.EnterNode returns true
|
||||
func (n *Equal) Walk(v walker.Visitor) {
|
||||
if v.EnterNode(n) == false {
|
||||
return
|
||||
}
|
||||
|
||||
if n.Left != nil {
|
||||
v.EnterChildNode("Left", n)
|
||||
n.Left.Walk(v)
|
||||
v.LeaveChildNode("Left", n)
|
||||
}
|
||||
|
||||
if n.Right != nil {
|
||||
v.EnterChildNode("Right", n)
|
||||
n.Right.Walk(v)
|
||||
v.LeaveChildNode("Right", n)
|
||||
}
|
||||
|
||||
v.LeaveNode(n)
|
||||
}
|
@ -1,66 +0,0 @@
|
||||
package binary
|
||||
|
||||
import (
|
||||
"github.com/z7zmey/php-parser/freefloating"
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
"github.com/z7zmey/php-parser/position"
|
||||
"github.com/z7zmey/php-parser/walker"
|
||||
)
|
||||
|
||||
// Greater node
|
||||
type Greater struct {
|
||||
FreeFloating freefloating.Collection
|
||||
Position *position.Position
|
||||
Left node.Node
|
||||
Right node.Node
|
||||
}
|
||||
|
||||
// NewGreater node constructor
|
||||
func NewGreater(Variable node.Node, Expression node.Node) *Greater {
|
||||
return &Greater{
|
||||
FreeFloating: nil,
|
||||
Left: Variable,
|
||||
Right: Expression,
|
||||
}
|
||||
}
|
||||
|
||||
// SetPosition sets node position
|
||||
func (n *Greater) SetPosition(p *position.Position) {
|
||||
n.Position = p
|
||||
}
|
||||
|
||||
// GetPosition returns node positions
|
||||
func (n *Greater) GetPosition() *position.Position {
|
||||
return n.Position
|
||||
}
|
||||
|
||||
func (n *Greater) GetFreeFloating() *freefloating.Collection {
|
||||
return &n.FreeFloating
|
||||
}
|
||||
|
||||
// Attributes returns node attributes as map
|
||||
func (n *Greater) Attributes() map[string]interface{} {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Walk traverses nodes
|
||||
// Walk is invoked recursively until v.EnterNode returns true
|
||||
func (n *Greater) Walk(v walker.Visitor) {
|
||||
if v.EnterNode(n) == false {
|
||||
return
|
||||
}
|
||||
|
||||
if n.Left != nil {
|
||||
v.EnterChildNode("Left", n)
|
||||
n.Left.Walk(v)
|
||||
v.LeaveChildNode("Left", n)
|
||||
}
|
||||
|
||||
if n.Right != nil {
|
||||
v.EnterChildNode("Right", n)
|
||||
n.Right.Walk(v)
|
||||
v.LeaveChildNode("Right", n)
|
||||
}
|
||||
|
||||
v.LeaveNode(n)
|
||||
}
|
@ -1,66 +0,0 @@
|
||||
package binary
|
||||
|
||||
import (
|
||||
"github.com/z7zmey/php-parser/freefloating"
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
"github.com/z7zmey/php-parser/position"
|
||||
"github.com/z7zmey/php-parser/walker"
|
||||
)
|
||||
|
||||
// GreaterOrEqual node
|
||||
type GreaterOrEqual struct {
|
||||
FreeFloating freefloating.Collection
|
||||
Position *position.Position
|
||||
Left node.Node
|
||||
Right node.Node
|
||||
}
|
||||
|
||||
// NewGreaterOrEqual node constructor
|
||||
func NewGreaterOrEqual(Variable node.Node, Expression node.Node) *GreaterOrEqual {
|
||||
return &GreaterOrEqual{
|
||||
FreeFloating: nil,
|
||||
Left: Variable,
|
||||
Right: Expression,
|
||||
}
|
||||
}
|
||||
|
||||
// SetPosition sets node position
|
||||
func (n *GreaterOrEqual) SetPosition(p *position.Position) {
|
||||
n.Position = p
|
||||
}
|
||||
|
||||
// GetPosition returns node positions
|
||||
func (n *GreaterOrEqual) GetPosition() *position.Position {
|
||||
return n.Position
|
||||
}
|
||||
|
||||
func (n *GreaterOrEqual) GetFreeFloating() *freefloating.Collection {
|
||||
return &n.FreeFloating
|
||||
}
|
||||
|
||||
// Attributes returns node attributes as map
|
||||
func (n *GreaterOrEqual) Attributes() map[string]interface{} {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Walk traverses nodes
|
||||
// Walk is invoked recursively until v.EnterNode returns true
|
||||
func (n *GreaterOrEqual) Walk(v walker.Visitor) {
|
||||
if v.EnterNode(n) == false {
|
||||
return
|
||||
}
|
||||
|
||||
if n.Left != nil {
|
||||
v.EnterChildNode("Left", n)
|
||||
n.Left.Walk(v)
|
||||
v.LeaveChildNode("Left", n)
|
||||
}
|
||||
|
||||
if n.Right != nil {
|
||||
v.EnterChildNode("Right", n)
|
||||
n.Right.Walk(v)
|
||||
v.LeaveChildNode("Right", n)
|
||||
}
|
||||
|
||||
v.LeaveNode(n)
|
||||
}
|
@ -1,66 +0,0 @@
|
||||
package binary
|
||||
|
||||
import (
|
||||
"github.com/z7zmey/php-parser/freefloating"
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
"github.com/z7zmey/php-parser/position"
|
||||
"github.com/z7zmey/php-parser/walker"
|
||||
)
|
||||
|
||||
// Identical node
|
||||
type Identical struct {
|
||||
FreeFloating freefloating.Collection
|
||||
Position *position.Position
|
||||
Left node.Node
|
||||
Right node.Node
|
||||
}
|
||||
|
||||
// NewIdentical node constructor
|
||||
func NewIdentical(Variable node.Node, Expression node.Node) *Identical {
|
||||
return &Identical{
|
||||
FreeFloating: nil,
|
||||
Left: Variable,
|
||||
Right: Expression,
|
||||
}
|
||||
}
|
||||
|
||||
// SetPosition sets node position
|
||||
func (n *Identical) SetPosition(p *position.Position) {
|
||||
n.Position = p
|
||||
}
|
||||
|
||||
// GetPosition returns node positions
|
||||
func (n *Identical) GetPosition() *position.Position {
|
||||
return n.Position
|
||||
}
|
||||
|
||||
func (n *Identical) GetFreeFloating() *freefloating.Collection {
|
||||
return &n.FreeFloating
|
||||
}
|
||||
|
||||
// Attributes returns node attributes as map
|
||||
func (n *Identical) Attributes() map[string]interface{} {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Walk traverses nodes
|
||||
// Walk is invoked recursively until v.EnterNode returns true
|
||||
func (n *Identical) Walk(v walker.Visitor) {
|
||||
if v.EnterNode(n) == false {
|
||||
return
|
||||
}
|
||||
|
||||
if n.Left != nil {
|
||||
v.EnterChildNode("Left", n)
|
||||
n.Left.Walk(v)
|
||||
v.LeaveChildNode("Left", n)
|
||||
}
|
||||
|
||||
if n.Right != nil {
|
||||
v.EnterChildNode("Right", n)
|
||||
n.Right.Walk(v)
|
||||
v.LeaveChildNode("Right", n)
|
||||
}
|
||||
|
||||
v.LeaveNode(n)
|
||||
}
|
@ -1,66 +0,0 @@
|
||||
package binary
|
||||
|
||||
import (
|
||||
"github.com/z7zmey/php-parser/freefloating"
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
"github.com/z7zmey/php-parser/position"
|
||||
"github.com/z7zmey/php-parser/walker"
|
||||
)
|
||||
|
||||
// LogicalAnd node
|
||||
type LogicalAnd struct {
|
||||
FreeFloating freefloating.Collection
|
||||
Position *position.Position
|
||||
Left node.Node
|
||||
Right node.Node
|
||||
}
|
||||
|
||||
// NewLogicalAnd node constructor
|
||||
func NewLogicalAnd(Variable node.Node, Expression node.Node) *LogicalAnd {
|
||||
return &LogicalAnd{
|
||||
FreeFloating: nil,
|
||||
Left: Variable,
|
||||
Right: Expression,
|
||||
}
|
||||
}
|
||||
|
||||
// SetPosition sets node position
|
||||
func (n *LogicalAnd) SetPosition(p *position.Position) {
|
||||
n.Position = p
|
||||
}
|
||||
|
||||
// GetPosition returns node positions
|
||||
func (n *LogicalAnd) GetPosition() *position.Position {
|
||||
return n.Position
|
||||
}
|
||||
|
||||
func (n *LogicalAnd) GetFreeFloating() *freefloating.Collection {
|
||||
return &n.FreeFloating
|
||||
}
|
||||
|
||||
// Attributes returns node attributes as map
|
||||
func (n *LogicalAnd) Attributes() map[string]interface{} {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Walk traverses nodes
|
||||
// Walk is invoked recursively until v.EnterNode returns true
|
||||
func (n *LogicalAnd) Walk(v walker.Visitor) {
|
||||
if v.EnterNode(n) == false {
|
||||
return
|
||||
}
|
||||
|
||||
if n.Left != nil {
|
||||
v.EnterChildNode("Left", n)
|
||||
n.Left.Walk(v)
|
||||
v.LeaveChildNode("Left", n)
|
||||
}
|
||||
|
||||
if n.Right != nil {
|
||||
v.EnterChildNode("Right", n)
|
||||
n.Right.Walk(v)
|
||||
v.LeaveChildNode("Right", n)
|
||||
}
|
||||
|
||||
v.LeaveNode(n)
|
||||
}
|
@ -1,66 +0,0 @@
|
||||
package binary
|
||||
|
||||
import (
|
||||
"github.com/z7zmey/php-parser/freefloating"
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
"github.com/z7zmey/php-parser/position"
|
||||
"github.com/z7zmey/php-parser/walker"
|
||||
)
|
||||
|
||||
// LogicalOr node
|
||||
type LogicalOr struct {
|
||||
FreeFloating freefloating.Collection
|
||||
Position *position.Position
|
||||
Left node.Node
|
||||
Right node.Node
|
||||
}
|
||||
|
||||
// NewLogicalOr node constructor
|
||||
func NewLogicalOr(Variable node.Node, Expression node.Node) *LogicalOr {
|
||||
return &LogicalOr{
|
||||
FreeFloating: nil,
|
||||
Left: Variable,
|
||||
Right: Expression,
|
||||
}
|
||||
}
|
||||
|
||||
// SetPosition sets node position
|
||||
func (n *LogicalOr) SetPosition(p *position.Position) {
|
||||
n.Position = p
|
||||
}
|
||||
|
||||
// GetPosition returns node positions
|
||||
func (n *LogicalOr) GetPosition() *position.Position {
|
||||
return n.Position
|
||||
}
|
||||
|
||||
func (n *LogicalOr) GetFreeFloating() *freefloating.Collection {
|
||||
return &n.FreeFloating
|
||||
}
|
||||
|
||||
// Attributes returns node attributes as map
|
||||
func (n *LogicalOr) Attributes() map[string]interface{} {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Walk traverses nodes
|
||||
// Walk is invoked recursively until v.EnterNode returns true
|
||||
func (n *LogicalOr) Walk(v walker.Visitor) {
|
||||
if v.EnterNode(n) == false {
|
||||
return
|
||||
}
|
||||
|
||||
if n.Left != nil {
|
||||
v.EnterChildNode("Left", n)
|
||||
n.Left.Walk(v)
|
||||
v.LeaveChildNode("Left", n)
|
||||
}
|
||||
|
||||
if n.Right != nil {
|
||||
v.EnterChildNode("Right", n)
|
||||
n.Right.Walk(v)
|
||||
v.LeaveChildNode("Right", n)
|
||||
}
|
||||
|
||||
v.LeaveNode(n)
|
||||
}
|
@ -1,66 +0,0 @@
|
||||
package binary
|
||||
|
||||
import (
|
||||
"github.com/z7zmey/php-parser/freefloating"
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
"github.com/z7zmey/php-parser/position"
|
||||
"github.com/z7zmey/php-parser/walker"
|
||||
)
|
||||
|
||||
// LogicalXor node
|
||||
type LogicalXor struct {
|
||||
FreeFloating freefloating.Collection
|
||||
Position *position.Position
|
||||
Left node.Node
|
||||
Right node.Node
|
||||
}
|
||||
|
||||
// NewLogicalXor node constructor
|
||||
func NewLogicalXor(Variable node.Node, Expression node.Node) *LogicalXor {
|
||||
return &LogicalXor{
|
||||
FreeFloating: nil,
|
||||
Left: Variable,
|
||||
Right: Expression,
|
||||
}
|
||||
}
|
||||
|
||||
// SetPosition sets node position
|
||||
func (n *LogicalXor) SetPosition(p *position.Position) {
|
||||
n.Position = p
|
||||
}
|
||||
|
||||
// GetPosition returns node positions
|
||||
func (n *LogicalXor) GetPosition() *position.Position {
|
||||
return n.Position
|
||||
}
|
||||
|
||||
func (n *LogicalXor) GetFreeFloating() *freefloating.Collection {
|
||||
return &n.FreeFloating
|
||||
}
|
||||
|
||||
// Attributes returns node attributes as map
|
||||
func (n *LogicalXor) Attributes() map[string]interface{} {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Walk traverses nodes
|
||||
// Walk is invoked recursively until v.EnterNode returns true
|
||||
func (n *LogicalXor) Walk(v walker.Visitor) {
|
||||
if v.EnterNode(n) == false {
|
||||
return
|
||||
}
|
||||
|
||||
if n.Left != nil {
|
||||
v.EnterChildNode("Left", n)
|
||||
n.Left.Walk(v)
|
||||
v.LeaveChildNode("Left", n)
|
||||
}
|
||||
|
||||
if n.Right != nil {
|
||||
v.EnterChildNode("Right", n)
|
||||
n.Right.Walk(v)
|
||||
v.LeaveChildNode("Right", n)
|
||||
}
|
||||
|
||||
v.LeaveNode(n)
|
||||
}
|
@ -1,66 +0,0 @@
|
||||
package binary
|
||||
|
||||
import (
|
||||
"github.com/z7zmey/php-parser/freefloating"
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
"github.com/z7zmey/php-parser/position"
|
||||
"github.com/z7zmey/php-parser/walker"
|
||||
)
|
||||
|
||||
// Minus node
|
||||
type Minus struct {
|
||||
FreeFloating freefloating.Collection
|
||||
Position *position.Position
|
||||
Left node.Node
|
||||
Right node.Node
|
||||
}
|
||||
|
||||
// NewMinus node constructor
|
||||
func NewMinus(Variable node.Node, Expression node.Node) *Minus {
|
||||
return &Minus{
|
||||
FreeFloating: nil,
|
||||
Left: Variable,
|
||||
Right: Expression,
|
||||
}
|
||||
}
|
||||
|
||||
// SetPosition sets node position
|
||||
func (n *Minus) SetPosition(p *position.Position) {
|
||||
n.Position = p
|
||||
}
|
||||
|
||||
// GetPosition returns node positions
|
||||
func (n *Minus) GetPosition() *position.Position {
|
||||
return n.Position
|
||||
}
|
||||
|
||||
func (n *Minus) GetFreeFloating() *freefloating.Collection {
|
||||
return &n.FreeFloating
|
||||
}
|
||||
|
||||
// Attributes returns node attributes as map
|
||||
func (n *Minus) Attributes() map[string]interface{} {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Walk traverses nodes
|
||||
// Walk is invoked recursively until v.EnterNode returns true
|
||||
func (n *Minus) Walk(v walker.Visitor) {
|
||||
if v.EnterNode(n) == false {
|
||||
return
|
||||
}
|
||||
|
||||
if n.Left != nil {
|
||||
v.EnterChildNode("Left", n)
|
||||
n.Left.Walk(v)
|
||||
v.LeaveChildNode("Left", n)
|
||||
}
|
||||
|
||||
if n.Right != nil {
|
||||
v.EnterChildNode("Right", n)
|
||||
n.Right.Walk(v)
|
||||
v.LeaveChildNode("Right", n)
|
||||
}
|
||||
|
||||
v.LeaveNode(n)
|
||||
}
|
@ -1,66 +0,0 @@
|
||||
package binary
|
||||
|
||||
import (
|
||||
"github.com/z7zmey/php-parser/freefloating"
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
"github.com/z7zmey/php-parser/position"
|
||||
"github.com/z7zmey/php-parser/walker"
|
||||
)
|
||||
|
||||
// Mod node
|
||||
type Mod struct {
|
||||
FreeFloating freefloating.Collection
|
||||
Position *position.Position
|
||||
Left node.Node
|
||||
Right node.Node
|
||||
}
|
||||
|
||||
// NewMod node constructor
|
||||
func NewMod(Variable node.Node, Expression node.Node) *Mod {
|
||||
return &Mod{
|
||||
FreeFloating: nil,
|
||||
Left: Variable,
|
||||
Right: Expression,
|
||||
}
|
||||
}
|
||||
|
||||
// SetPosition sets node position
|
||||
func (n *Mod) SetPosition(p *position.Position) {
|
||||
n.Position = p
|
||||
}
|
||||
|
||||
// GetPosition returns node positions
|
||||
func (n *Mod) GetPosition() *position.Position {
|
||||
return n.Position
|
||||
}
|
||||
|
||||
func (n *Mod) GetFreeFloating() *freefloating.Collection {
|
||||
return &n.FreeFloating
|
||||
}
|
||||
|
||||
// Attributes returns node attributes as map
|
||||
func (n *Mod) Attributes() map[string]interface{} {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Walk traverses nodes
|
||||
// Walk is invoked recursively until v.EnterNode returns true
|
||||
func (n *Mod) Walk(v walker.Visitor) {
|
||||
if v.EnterNode(n) == false {
|
||||
return
|
||||
}
|
||||
|
||||
if n.Left != nil {
|
||||
v.EnterChildNode("Left", n)
|
||||
n.Left.Walk(v)
|
||||
v.LeaveChildNode("Left", n)
|
||||
}
|
||||
|
||||
if n.Right != nil {
|
||||
v.EnterChildNode("Right", n)
|
||||
n.Right.Walk(v)
|
||||
v.LeaveChildNode("Right", n)
|
||||
}
|
||||
|
||||
v.LeaveNode(n)
|
||||
}
|
@ -1,66 +0,0 @@
|
||||
package binary
|
||||
|
||||
import (
|
||||
"github.com/z7zmey/php-parser/freefloating"
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
"github.com/z7zmey/php-parser/position"
|
||||
"github.com/z7zmey/php-parser/walker"
|
||||
)
|
||||
|
||||
// Mul node
|
||||
type Mul struct {
|
||||
FreeFloating freefloating.Collection
|
||||
Position *position.Position
|
||||
Left node.Node
|
||||
Right node.Node
|
||||
}
|
||||
|
||||
// NewMul node constructor
|
||||
func NewMul(Variable node.Node, Expression node.Node) *Mul {
|
||||
return &Mul{
|
||||
FreeFloating: nil,
|
||||
Left: Variable,
|
||||
Right: Expression,
|
||||
}
|
||||
}
|
||||
|
||||
// SetPosition sets node position
|
||||
func (n *Mul) SetPosition(p *position.Position) {
|
||||
n.Position = p
|
||||
}
|
||||
|
||||
// GetPosition returns node positions
|
||||
func (n *Mul) GetPosition() *position.Position {
|
||||
return n.Position
|
||||
}
|
||||
|
||||
func (n *Mul) GetFreeFloating() *freefloating.Collection {
|
||||
return &n.FreeFloating
|
||||
}
|
||||
|
||||
// Attributes returns node attributes as map
|
||||
func (n *Mul) Attributes() map[string]interface{} {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Walk traverses nodes
|
||||
// Walk is invoked recursively until v.EnterNode returns true
|
||||
func (n *Mul) Walk(v walker.Visitor) {
|
||||
if v.EnterNode(n) == false {
|
||||
return
|
||||
}
|
||||
|
||||
if n.Left != nil {
|
||||
v.EnterChildNode("Left", n)
|
||||
n.Left.Walk(v)
|
||||
v.LeaveChildNode("Left", n)
|
||||
}
|
||||
|
||||
if n.Right != nil {
|
||||
v.EnterChildNode("Right", n)
|
||||
n.Right.Walk(v)
|
||||
v.LeaveChildNode("Right", n)
|
||||
}
|
||||
|
||||
v.LeaveNode(n)
|
||||
}
|
@ -1,66 +0,0 @@
|
||||
package binary
|
||||
|
||||
import (
|
||||
"github.com/z7zmey/php-parser/freefloating"
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
"github.com/z7zmey/php-parser/position"
|
||||
"github.com/z7zmey/php-parser/walker"
|
||||
)
|
||||
|
||||
// NotEqual node
|
||||
type NotEqual struct {
|
||||
FreeFloating freefloating.Collection
|
||||
Position *position.Position
|
||||
Left node.Node
|
||||
Right node.Node
|
||||
}
|
||||
|
||||
// NewNotEqual node constructor
|
||||
func NewNotEqual(Variable node.Node, Expression node.Node) *NotEqual {
|
||||
return &NotEqual{
|
||||
FreeFloating: nil,
|
||||
Left: Variable,
|
||||
Right: Expression,
|
||||
}
|
||||
}
|
||||
|
||||
// SetPosition sets node position
|
||||
func (n *NotEqual) SetPosition(p *position.Position) {
|
||||
n.Position = p
|
||||
}
|
||||
|
||||
// GetPosition returns node positions
|
||||
func (n *NotEqual) GetPosition() *position.Position {
|
||||
return n.Position
|
||||
}
|
||||
|
||||
func (n *NotEqual) GetFreeFloating() *freefloating.Collection {
|
||||
return &n.FreeFloating
|
||||
}
|
||||
|
||||
// Attributes returns node attributes as map
|
||||
func (n *NotEqual) Attributes() map[string]interface{} {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Walk traverses nodes
|
||||
// Walk is invoked recursively until v.EnterNode returns true
|
||||
func (n *NotEqual) Walk(v walker.Visitor) {
|
||||
if v.EnterNode(n) == false {
|
||||
return
|
||||
}
|
||||
|
||||
if n.Left != nil {
|
||||
v.EnterChildNode("Left", n)
|
||||
n.Left.Walk(v)
|
||||
v.LeaveChildNode("Left", n)
|
||||
}
|
||||
|
||||
if n.Right != nil {
|
||||
v.EnterChildNode("Right", n)
|
||||
n.Right.Walk(v)
|
||||
v.LeaveChildNode("Right", n)
|
||||
}
|
||||
|
||||
v.LeaveNode(n)
|
||||
}
|
@ -1,66 +0,0 @@
|
||||
package binary
|
||||
|
||||
import (
|
||||
"github.com/z7zmey/php-parser/freefloating"
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
"github.com/z7zmey/php-parser/position"
|
||||
"github.com/z7zmey/php-parser/walker"
|
||||
)
|
||||
|
||||
// NotIdentical node
|
||||
type NotIdentical struct {
|
||||
FreeFloating freefloating.Collection
|
||||
Position *position.Position
|
||||
Left node.Node
|
||||
Right node.Node
|
||||
}
|
||||
|
||||
// NewNotIdentical node constructor
|
||||
func NewNotIdentical(Variable node.Node, Expression node.Node) *NotIdentical {
|
||||
return &NotIdentical{
|
||||
FreeFloating: nil,
|
||||
Left: Variable,
|
||||
Right: Expression,
|
||||
}
|
||||
}
|
||||
|
||||
// SetPosition sets node position
|
||||
func (n *NotIdentical) SetPosition(p *position.Position) {
|
||||
n.Position = p
|
||||
}
|
||||
|
||||
// GetPosition returns node positions
|
||||
func (n *NotIdentical) GetPosition() *position.Position {
|
||||
return n.Position
|
||||
}
|
||||
|
||||
func (n *NotIdentical) GetFreeFloating() *freefloating.Collection {
|
||||
return &n.FreeFloating
|
||||
}
|
||||
|
||||
// Attributes returns node attributes as map
|
||||
func (n *NotIdentical) Attributes() map[string]interface{} {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Walk traverses nodes
|
||||
// Walk is invoked recursively until v.EnterNode returns true
|
||||
func (n *NotIdentical) Walk(v walker.Visitor) {
|
||||
if v.EnterNode(n) == false {
|
||||
return
|
||||
}
|
||||
|
||||
if n.Left != nil {
|
||||
v.EnterChildNode("Left", n)
|
||||
n.Left.Walk(v)
|
||||
v.LeaveChildNode("Left", n)
|
||||
}
|
||||
|
||||
if n.Right != nil {
|
||||
v.EnterChildNode("Right", n)
|
||||
n.Right.Walk(v)
|
||||
v.LeaveChildNode("Right", n)
|
||||
}
|
||||
|
||||
v.LeaveNode(n)
|
||||
}
|
@ -1,66 +0,0 @@
|
||||
package binary
|
||||
|
||||
import (
|
||||
"github.com/z7zmey/php-parser/freefloating"
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
"github.com/z7zmey/php-parser/position"
|
||||
"github.com/z7zmey/php-parser/walker"
|
||||
)
|
||||
|
||||
// Plus node
|
||||
type Plus struct {
|
||||
FreeFloating freefloating.Collection
|
||||
Position *position.Position
|
||||
Left node.Node
|
||||
Right node.Node
|
||||
}
|
||||
|
||||
// NewPlus node constructor
|
||||
func NewPlus(Variable node.Node, Expression node.Node) *Plus {
|
||||
return &Plus{
|
||||
FreeFloating: nil,
|
||||
Left: Variable,
|
||||
Right: Expression,
|
||||
}
|
||||
}
|
||||
|
||||
// SetPosition sets node position
|
||||
func (n *Plus) SetPosition(p *position.Position) {
|
||||
n.Position = p
|
||||
}
|
||||
|
||||
// GetPosition returns node positions
|
||||
func (n *Plus) GetPosition() *position.Position {
|
||||
return n.Position
|
||||
}
|
||||
|
||||
func (n *Plus) GetFreeFloating() *freefloating.Collection {
|
||||
return &n.FreeFloating
|
||||
}
|
||||
|
||||
// Attributes returns node attributes as map
|
||||
func (n *Plus) Attributes() map[string]interface{} {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Walk traverses nodes
|
||||
// Walk is invoked recursively until v.EnterNode returns true
|
||||
func (n *Plus) Walk(v walker.Visitor) {
|
||||
if v.EnterNode(n) == false {
|
||||
return
|
||||
}
|
||||
|
||||
if n.Left != nil {
|
||||
v.EnterChildNode("Left", n)
|
||||
n.Left.Walk(v)
|
||||
v.LeaveChildNode("Left", n)
|
||||
}
|
||||
|
||||
if n.Right != nil {
|
||||
v.EnterChildNode("Right", n)
|
||||
n.Right.Walk(v)
|
||||
v.LeaveChildNode("Right", n)
|
||||
}
|
||||
|
||||
v.LeaveNode(n)
|
||||
}
|
@ -1,66 +0,0 @@
|
||||
package binary
|
||||
|
||||
import (
|
||||
"github.com/z7zmey/php-parser/freefloating"
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
"github.com/z7zmey/php-parser/position"
|
||||
"github.com/z7zmey/php-parser/walker"
|
||||
)
|
||||
|
||||
// Pow node
|
||||
type Pow struct {
|
||||
FreeFloating freefloating.Collection
|
||||
Position *position.Position
|
||||
Left node.Node
|
||||
Right node.Node
|
||||
}
|
||||
|
||||
// NewPow node constructor
|
||||
func NewPow(Variable node.Node, Expression node.Node) *Pow {
|
||||
return &Pow{
|
||||
FreeFloating: nil,
|
||||
Left: Variable,
|
||||
Right: Expression,
|
||||
}
|
||||
}
|
||||
|
||||
// SetPosition sets node position
|
||||
func (n *Pow) SetPosition(p *position.Position) {
|
||||
n.Position = p
|
||||
}
|
||||
|
||||
// GetPosition returns node positions
|
||||
func (n *Pow) GetPosition() *position.Position {
|
||||
return n.Position
|
||||
}
|
||||
|
||||
func (n *Pow) GetFreeFloating() *freefloating.Collection {
|
||||
return &n.FreeFloating
|
||||
}
|
||||
|
||||
// Attributes returns node attributes as map
|
||||
func (n *Pow) Attributes() map[string]interface{} {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Walk traverses nodes
|
||||
// Walk is invoked recursively until v.EnterNode returns true
|
||||
func (n *Pow) Walk(v walker.Visitor) {
|
||||
if v.EnterNode(n) == false {
|
||||
return
|
||||
}
|
||||
|
||||
if n.Left != nil {
|
||||
v.EnterChildNode("Left", n)
|
||||
n.Left.Walk(v)
|
||||
v.LeaveChildNode("Left", n)
|
||||
}
|
||||
|
||||
if n.Right != nil {
|
||||
v.EnterChildNode("Right", n)
|
||||
n.Right.Walk(v)
|
||||
v.LeaveChildNode("Right", n)
|
||||
}
|
||||
|
||||
v.LeaveNode(n)
|
||||
}
|
@ -1,66 +0,0 @@
|
||||
package binary
|
||||
|
||||
import (
|
||||
"github.com/z7zmey/php-parser/freefloating"
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
"github.com/z7zmey/php-parser/position"
|
||||
"github.com/z7zmey/php-parser/walker"
|
||||
)
|
||||
|
||||
// ShiftLeft node
|
||||
type ShiftLeft struct {
|
||||
FreeFloating freefloating.Collection
|
||||
Position *position.Position
|
||||
Left node.Node
|
||||
Right node.Node
|
||||
}
|
||||
|
||||
// NewShiftLeft node constructor
|
||||
func NewShiftLeft(Variable node.Node, Expression node.Node) *ShiftLeft {
|
||||
return &ShiftLeft{
|
||||
FreeFloating: nil,
|
||||
Left: Variable,
|
||||
Right: Expression,
|
||||
}
|
||||
}
|
||||
|
||||
// SetPosition sets node position
|
||||
func (n *ShiftLeft) SetPosition(p *position.Position) {
|
||||
n.Position = p
|
||||
}
|
||||
|
||||
// GetPosition returns node positions
|
||||
func (n *ShiftLeft) GetPosition() *position.Position {
|
||||
return n.Position
|
||||
}
|
||||
|
||||
func (n *ShiftLeft) GetFreeFloating() *freefloating.Collection {
|
||||
return &n.FreeFloating
|
||||
}
|
||||
|
||||
// Attributes returns node attributes as map
|
||||
func (n *ShiftLeft) Attributes() map[string]interface{} {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Walk traverses nodes
|
||||
// Walk is invoked recursively until v.EnterNode returns true
|
||||
func (n *ShiftLeft) Walk(v walker.Visitor) {
|
||||
if v.EnterNode(n) == false {
|
||||
return
|
||||
}
|
||||
|
||||
if n.Left != nil {
|
||||
v.EnterChildNode("Left", n)
|
||||
n.Left.Walk(v)
|
||||
v.LeaveChildNode("Left", n)
|
||||
}
|
||||
|
||||
if n.Right != nil {
|
||||
v.EnterChildNode("Right", n)
|
||||
n.Right.Walk(v)
|
||||
v.LeaveChildNode("Right", n)
|
||||
}
|
||||
|
||||
v.LeaveNode(n)
|
||||
}
|
@ -1,66 +0,0 @@
|
||||
package binary
|
||||
|
||||
import (
|
||||
"github.com/z7zmey/php-parser/freefloating"
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
"github.com/z7zmey/php-parser/position"
|
||||
"github.com/z7zmey/php-parser/walker"
|
||||
)
|
||||
|
||||
// ShiftRight node
|
||||
type ShiftRight struct {
|
||||
FreeFloating freefloating.Collection
|
||||
Position *position.Position
|
||||
Left node.Node
|
||||
Right node.Node
|
||||
}
|
||||
|
||||
// NewShiftRight node constructor
|
||||
func NewShiftRight(Variable node.Node, Expression node.Node) *ShiftRight {
|
||||
return &ShiftRight{
|
||||
FreeFloating: nil,
|
||||
Left: Variable,
|
||||
Right: Expression,
|
||||
}
|
||||
}
|
||||
|
||||
// SetPosition sets node position
|
||||
func (n *ShiftRight) SetPosition(p *position.Position) {
|
||||
n.Position = p
|
||||
}
|
||||
|
||||
// GetPosition returns node positions
|
||||
func (n *ShiftRight) GetPosition() *position.Position {
|
||||
return n.Position
|
||||
}
|
||||
|
||||
func (n *ShiftRight) GetFreeFloating() *freefloating.Collection {
|
||||
return &n.FreeFloating
|
||||
}
|
||||
|
||||
// Attributes returns node attributes as map
|
||||
func (n *ShiftRight) Attributes() map[string]interface{} {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Walk traverses nodes
|
||||
// Walk is invoked recursively until v.EnterNode returns true
|
||||
func (n *ShiftRight) Walk(v walker.Visitor) {
|
||||
if v.EnterNode(n) == false {
|
||||
return
|
||||
}
|
||||
|
||||
if n.Left != nil {
|
||||
v.EnterChildNode("Left", n)
|
||||
n.Left.Walk(v)
|
||||
v.LeaveChildNode("Left", n)
|
||||
}
|
||||
|
||||
if n.Right != nil {
|
||||
v.EnterChildNode("Right", n)
|
||||
n.Right.Walk(v)
|
||||
v.LeaveChildNode("Right", n)
|
||||
}
|
||||
|
||||
v.LeaveNode(n)
|
||||
}
|
@ -1,66 +0,0 @@
|
||||
package binary
|
||||
|
||||
import (
|
||||
"github.com/z7zmey/php-parser/freefloating"
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
"github.com/z7zmey/php-parser/position"
|
||||
"github.com/z7zmey/php-parser/walker"
|
||||
)
|
||||
|
||||
// Smaller node
|
||||
type Smaller struct {
|
||||
FreeFloating freefloating.Collection
|
||||
Position *position.Position
|
||||
Left node.Node
|
||||
Right node.Node
|
||||
}
|
||||
|
||||
// NewSmaller node constructor
|
||||
func NewSmaller(Variable node.Node, Expression node.Node) *Smaller {
|
||||
return &Smaller{
|
||||
FreeFloating: nil,
|
||||
Left: Variable,
|
||||
Right: Expression,
|
||||
}
|
||||
}
|
||||
|
||||
// SetPosition sets node position
|
||||
func (n *Smaller) SetPosition(p *position.Position) {
|
||||
n.Position = p
|
||||
}
|
||||
|
||||
// GetPosition returns node positions
|
||||
func (n *Smaller) GetPosition() *position.Position {
|
||||
return n.Position
|
||||
}
|
||||
|
||||
func (n *Smaller) GetFreeFloating() *freefloating.Collection {
|
||||
return &n.FreeFloating
|
||||
}
|
||||
|
||||
// Attributes returns node attributes as map
|
||||
func (n *Smaller) Attributes() map[string]interface{} {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Walk traverses nodes
|
||||
// Walk is invoked recursively until v.EnterNode returns true
|
||||
func (n *Smaller) Walk(v walker.Visitor) {
|
||||
if v.EnterNode(n) == false {
|
||||
return
|
||||
}
|
||||
|
||||
if n.Left != nil {
|
||||
v.EnterChildNode("Left", n)
|
||||
n.Left.Walk(v)
|
||||
v.LeaveChildNode("Left", n)
|
||||
}
|
||||
|
||||
if n.Right != nil {
|
||||
v.EnterChildNode("Right", n)
|
||||
n.Right.Walk(v)
|
||||
v.LeaveChildNode("Right", n)
|
||||
}
|
||||
|
||||
v.LeaveNode(n)
|
||||
}
|
@ -1,66 +0,0 @@
|
||||
package binary
|
||||
|
||||
import (
|
||||
"github.com/z7zmey/php-parser/freefloating"
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
"github.com/z7zmey/php-parser/position"
|
||||
"github.com/z7zmey/php-parser/walker"
|
||||
)
|
||||
|
||||
// SmallerOrEqual node
|
||||
type SmallerOrEqual struct {
|
||||
FreeFloating freefloating.Collection
|
||||
Position *position.Position
|
||||
Left node.Node
|
||||
Right node.Node
|
||||
}
|
||||
|
||||
// NewSmallerOrEqual node constructor
|
||||
func NewSmallerOrEqual(Variable node.Node, Expression node.Node) *SmallerOrEqual {
|
||||
return &SmallerOrEqual{
|
||||
FreeFloating: nil,
|
||||
Left: Variable,
|
||||
Right: Expression,
|
||||
}
|
||||
}
|
||||
|
||||
// SetPosition sets node position
|
||||
func (n *SmallerOrEqual) SetPosition(p *position.Position) {
|
||||
n.Position = p
|
||||
}
|
||||
|
||||
// GetPosition returns node positions
|
||||
func (n *SmallerOrEqual) GetPosition() *position.Position {
|
||||
return n.Position
|
||||
}
|
||||
|
||||
func (n *SmallerOrEqual) GetFreeFloating() *freefloating.Collection {
|
||||
return &n.FreeFloating
|
||||
}
|
||||
|
||||
// Attributes returns node attributes as map
|
||||
func (n *SmallerOrEqual) Attributes() map[string]interface{} {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Walk traverses nodes
|
||||
// Walk is invoked recursively until v.EnterNode returns true
|
||||
func (n *SmallerOrEqual) Walk(v walker.Visitor) {
|
||||
if v.EnterNode(n) == false {
|
||||
return
|
||||
}
|
||||
|
||||
if n.Left != nil {
|
||||
v.EnterChildNode("Left", n)
|
||||
n.Left.Walk(v)
|
||||
v.LeaveChildNode("Left", n)
|
||||
}
|
||||
|
||||
if n.Right != nil {
|
||||
v.EnterChildNode("Right", n)
|
||||
n.Right.Walk(v)
|
||||
v.LeaveChildNode("Right", n)
|
||||
}
|
||||
|
||||
v.LeaveNode(n)
|
||||
}
|
@ -1,66 +0,0 @@
|
||||
package binary
|
||||
|
||||
import (
|
||||
"github.com/z7zmey/php-parser/freefloating"
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
"github.com/z7zmey/php-parser/position"
|
||||
"github.com/z7zmey/php-parser/walker"
|
||||
)
|
||||
|
||||
// Spaceship node
|
||||
type Spaceship struct {
|
||||
FreeFloating freefloating.Collection
|
||||
Position *position.Position
|
||||
Left node.Node
|
||||
Right node.Node
|
||||
}
|
||||
|
||||
// NewSpaceship node constructor
|
||||
func NewSpaceship(Variable node.Node, Expression node.Node) *Spaceship {
|
||||
return &Spaceship{
|
||||
FreeFloating: nil,
|
||||
Left: Variable,
|
||||
Right: Expression,
|
||||
}
|
||||
}
|
||||
|
||||
// SetPosition sets node position
|
||||
func (n *Spaceship) SetPosition(p *position.Position) {
|
||||
n.Position = p
|
||||
}
|
||||
|
||||
// GetPosition returns node positions
|
||||
func (n *Spaceship) GetPosition() *position.Position {
|
||||
return n.Position
|
||||
}
|
||||
|
||||
func (n *Spaceship) GetFreeFloating() *freefloating.Collection {
|
||||
return &n.FreeFloating
|
||||
}
|
||||
|
||||
// Attributes returns node attributes as map
|
||||
func (n *Spaceship) Attributes() map[string]interface{} {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Walk traverses nodes
|
||||
// Walk is invoked recursively until v.EnterNode returns true
|
||||
func (n *Spaceship) Walk(v walker.Visitor) {
|
||||
if v.EnterNode(n) == false {
|
||||
return
|
||||
}
|
||||
|
||||
if n.Left != nil {
|
||||
v.EnterChildNode("Left", n)
|
||||
n.Left.Walk(v)
|
||||
v.LeaveChildNode("Left", n)
|
||||
}
|
||||
|
||||
if n.Right != nil {
|
||||
v.EnterChildNode("Right", n)
|
||||
n.Right.Walk(v)
|
||||
v.LeaveChildNode("Right", n)
|
||||
}
|
||||
|
||||
v.LeaveNode(n)
|
||||
}
|
File diff suppressed because it is too large
Load Diff
@ -1,117 +0,0 @@
|
||||
package binary_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"gotest.tools/assert"
|
||||
|
||||
"github.com/z7zmey/php-parser/freefloating"
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
"github.com/z7zmey/php-parser/node/expr/binary"
|
||||
)
|
||||
|
||||
var expected freefloating.Collection = freefloating.Collection{
|
||||
freefloating.Start: []freefloating.String{
|
||||
{
|
||||
StringType: freefloating.WhiteSpaceType,
|
||||
Value: " ",
|
||||
Position: nil,
|
||||
},
|
||||
{
|
||||
StringType: freefloating.CommentType,
|
||||
Value: "//comment\n",
|
||||
Position: nil,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
var nodes = []node.Node{
|
||||
&binary.BitwiseAnd{
|
||||
FreeFloating: expected,
|
||||
},
|
||||
&binary.BitwiseOr{
|
||||
FreeFloating: expected,
|
||||
},
|
||||
&binary.BitwiseXor{
|
||||
FreeFloating: expected,
|
||||
},
|
||||
&binary.BooleanAnd{
|
||||
FreeFloating: expected,
|
||||
},
|
||||
&binary.BooleanOr{
|
||||
FreeFloating: expected,
|
||||
},
|
||||
&binary.Coalesce{
|
||||
FreeFloating: expected,
|
||||
},
|
||||
&binary.Concat{
|
||||
FreeFloating: expected,
|
||||
},
|
||||
&binary.Div{
|
||||
FreeFloating: expected,
|
||||
},
|
||||
&binary.Equal{
|
||||
FreeFloating: expected,
|
||||
},
|
||||
&binary.GreaterOrEqual{
|
||||
FreeFloating: expected,
|
||||
},
|
||||
&binary.Greater{
|
||||
FreeFloating: expected,
|
||||
},
|
||||
&binary.Identical{
|
||||
FreeFloating: expected,
|
||||
},
|
||||
&binary.LogicalAnd{
|
||||
FreeFloating: expected,
|
||||
},
|
||||
&binary.LogicalOr{
|
||||
FreeFloating: expected,
|
||||
},
|
||||
&binary.LogicalXor{
|
||||
FreeFloating: expected,
|
||||
},
|
||||
&binary.Minus{
|
||||
FreeFloating: expected,
|
||||
},
|
||||
&binary.Mod{
|
||||
FreeFloating: expected,
|
||||
},
|
||||
&binary.Mul{
|
||||
FreeFloating: expected,
|
||||
},
|
||||
&binary.NotEqual{
|
||||
FreeFloating: expected,
|
||||
},
|
||||
&binary.NotIdentical{
|
||||
FreeFloating: expected,
|
||||
},
|
||||
&binary.Plus{
|
||||
FreeFloating: expected,
|
||||
},
|
||||
&binary.Pow{
|
||||
FreeFloating: expected,
|
||||
},
|
||||
&binary.ShiftLeft{
|
||||
FreeFloating: expected,
|
||||
},
|
||||
&binary.ShiftRight{
|
||||
FreeFloating: expected,
|
||||
},
|
||||
&binary.SmallerOrEqual{
|
||||
FreeFloating: expected,
|
||||
},
|
||||
&binary.Smaller{
|
||||
FreeFloating: expected,
|
||||
},
|
||||
&binary.Spaceship{
|
||||
FreeFloating: expected,
|
||||
},
|
||||
}
|
||||
|
||||
func TestMeta(t *testing.T) {
|
||||
for _, n := range nodes {
|
||||
actual := *n.GetFreeFloating()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
}
|
||||
}
|
@ -1,18 +0,0 @@
|
||||
package binary_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"gotest.tools/assert"
|
||||
|
||||
"github.com/z7zmey/php-parser/position"
|
||||
)
|
||||
|
||||
func TestPosition(t *testing.T) {
|
||||
expected := position.NewPosition(1, 1, 1, 1)
|
||||
for _, n := range nodes {
|
||||
n.SetPosition(expected)
|
||||
actual := n.GetPosition()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
}
|
||||
}
|
@ -1,285 +0,0 @@
|
||||
package binary_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
"github.com/z7zmey/php-parser/node/expr"
|
||||
"github.com/z7zmey/php-parser/node/expr/binary"
|
||||
"github.com/z7zmey/php-parser/walker"
|
||||
"gotest.tools/assert"
|
||||
)
|
||||
|
||||
var nodesToTest = []struct {
|
||||
node node.Node // node
|
||||
expectedVisitedKeys []string // visited keys
|
||||
expectedAttributes map[string]interface{}
|
||||
}{
|
||||
{
|
||||
&binary.BitwiseAnd{
|
||||
Left: &expr.Variable{},
|
||||
Right: &expr.Variable{},
|
||||
},
|
||||
[]string{"Left", "Right"},
|
||||
nil,
|
||||
},
|
||||
{
|
||||
&binary.BitwiseOr{
|
||||
Left: &expr.Variable{},
|
||||
Right: &expr.Variable{},
|
||||
},
|
||||
[]string{"Left", "Right"},
|
||||
nil,
|
||||
},
|
||||
{
|
||||
&binary.BitwiseXor{
|
||||
Left: &expr.Variable{},
|
||||
Right: &expr.Variable{},
|
||||
},
|
||||
[]string{"Left", "Right"},
|
||||
nil,
|
||||
},
|
||||
{
|
||||
&binary.BooleanAnd{
|
||||
Left: &expr.Variable{},
|
||||
Right: &expr.Variable{},
|
||||
},
|
||||
[]string{"Left", "Right"},
|
||||
nil,
|
||||
},
|
||||
{
|
||||
&binary.BooleanOr{
|
||||
Left: &expr.Variable{},
|
||||
Right: &expr.Variable{},
|
||||
},
|
||||
[]string{"Left", "Right"},
|
||||
nil,
|
||||
},
|
||||
{
|
||||
&binary.Coalesce{
|
||||
Left: &expr.Variable{},
|
||||
Right: &expr.Variable{},
|
||||
},
|
||||
[]string{"Left", "Right"},
|
||||
nil,
|
||||
},
|
||||
{
|
||||
&binary.Concat{
|
||||
Left: &expr.Variable{},
|
||||
Right: &expr.Variable{},
|
||||
},
|
||||
[]string{"Left", "Right"},
|
||||
nil,
|
||||
},
|
||||
{
|
||||
&binary.Div{
|
||||
Left: &expr.Variable{},
|
||||
Right: &expr.Variable{},
|
||||
},
|
||||
[]string{"Left", "Right"},
|
||||
nil,
|
||||
},
|
||||
{
|
||||
&binary.Equal{
|
||||
Left: &expr.Variable{},
|
||||
Right: &expr.Variable{},
|
||||
},
|
||||
[]string{"Left", "Right"},
|
||||
nil,
|
||||
},
|
||||
{
|
||||
&binary.GreaterOrEqual{
|
||||
Left: &expr.Variable{},
|
||||
Right: &expr.Variable{},
|
||||
},
|
||||
[]string{"Left", "Right"},
|
||||
nil,
|
||||
},
|
||||
{
|
||||
&binary.Greater{
|
||||
Left: &expr.Variable{},
|
||||
Right: &expr.Variable{},
|
||||
},
|
||||
[]string{"Left", "Right"},
|
||||
nil,
|
||||
},
|
||||
{
|
||||
&binary.Identical{
|
||||
Left: &expr.Variable{},
|
||||
Right: &expr.Variable{},
|
||||
},
|
||||
[]string{"Left", "Right"},
|
||||
nil,
|
||||
},
|
||||
{
|
||||
&binary.LogicalAnd{
|
||||
Left: &expr.Variable{},
|
||||
Right: &expr.Variable{},
|
||||
},
|
||||
[]string{"Left", "Right"},
|
||||
nil,
|
||||
},
|
||||
{
|
||||
&binary.LogicalOr{
|
||||
Left: &expr.Variable{},
|
||||
Right: &expr.Variable{},
|
||||
},
|
||||
[]string{"Left", "Right"},
|
||||
nil,
|
||||
},
|
||||
{
|
||||
&binary.LogicalXor{
|
||||
Left: &expr.Variable{},
|
||||
Right: &expr.Variable{},
|
||||
},
|
||||
[]string{"Left", "Right"},
|
||||
nil,
|
||||
},
|
||||
{
|
||||
&binary.Minus{
|
||||
Left: &expr.Variable{},
|
||||
Right: &expr.Variable{},
|
||||
},
|
||||
[]string{"Left", "Right"},
|
||||
nil,
|
||||
},
|
||||
{
|
||||
&binary.Mod{
|
||||
Left: &expr.Variable{},
|
||||
Right: &expr.Variable{},
|
||||
},
|
||||
[]string{"Left", "Right"},
|
||||
nil,
|
||||
},
|
||||
{
|
||||
&binary.Mul{
|
||||
Left: &expr.Variable{},
|
||||
Right: &expr.Variable{},
|
||||
},
|
||||
[]string{"Left", "Right"},
|
||||
nil,
|
||||
},
|
||||
{
|
||||
&binary.NotEqual{
|
||||
Left: &expr.Variable{},
|
||||
Right: &expr.Variable{},
|
||||
},
|
||||
[]string{"Left", "Right"},
|
||||
nil,
|
||||
},
|
||||
{
|
||||
&binary.NotIdentical{
|
||||
Left: &expr.Variable{},
|
||||
Right: &expr.Variable{},
|
||||
},
|
||||
[]string{"Left", "Right"},
|
||||
nil,
|
||||
},
|
||||
{
|
||||
&binary.Plus{
|
||||
Left: &expr.Variable{},
|
||||
Right: &expr.Variable{},
|
||||
},
|
||||
[]string{"Left", "Right"},
|
||||
nil,
|
||||
},
|
||||
{
|
||||
&binary.Pow{
|
||||
Left: &expr.Variable{},
|
||||
Right: &expr.Variable{},
|
||||
},
|
||||
[]string{"Left", "Right"},
|
||||
nil,
|
||||
},
|
||||
{
|
||||
&binary.ShiftLeft{
|
||||
Left: &expr.Variable{},
|
||||
Right: &expr.Variable{},
|
||||
},
|
||||
[]string{"Left", "Right"},
|
||||
nil,
|
||||
},
|
||||
{
|
||||
&binary.ShiftRight{
|
||||
Left: &expr.Variable{},
|
||||
Right: &expr.Variable{},
|
||||
},
|
||||
[]string{"Left", "Right"},
|
||||
nil,
|
||||
},
|
||||
{
|
||||
&binary.SmallerOrEqual{
|
||||
Left: &expr.Variable{},
|
||||
Right: &expr.Variable{},
|
||||
},
|
||||
[]string{"Left", "Right"},
|
||||
nil,
|
||||
},
|
||||
{
|
||||
&binary.Smaller{
|
||||
Left: &expr.Variable{},
|
||||
Right: &expr.Variable{},
|
||||
},
|
||||
[]string{"Left", "Right"},
|
||||
nil,
|
||||
},
|
||||
{
|
||||
&binary.Spaceship{
|
||||
Left: &expr.Variable{},
|
||||
Right: &expr.Variable{},
|
||||
},
|
||||
[]string{"Left", "Right"},
|
||||
nil,
|
||||
},
|
||||
}
|
||||
|
||||
type visitorMock struct {
|
||||
visitChildren bool
|
||||
visitedKeys []string
|
||||
}
|
||||
|
||||
func (v *visitorMock) EnterNode(n walker.Walkable) bool { return v.visitChildren }
|
||||
func (v *visitorMock) LeaveNode(n walker.Walkable) {}
|
||||
func (v *visitorMock) EnterChildNode(key string, w walker.Walkable) {
|
||||
v.visitedKeys = append(v.visitedKeys, key)
|
||||
}
|
||||
func (v *visitorMock) LeaveChildNode(key string, w walker.Walkable) {}
|
||||
func (v *visitorMock) EnterChildList(key string, w walker.Walkable) {
|
||||
v.visitedKeys = append(v.visitedKeys, key)
|
||||
}
|
||||
func (v *visitorMock) LeaveChildList(key string, w walker.Walkable) {}
|
||||
|
||||
func TestVisitorDisableChildren(t *testing.T) {
|
||||
for _, tt := range nodesToTest {
|
||||
v := &visitorMock{false, []string{}}
|
||||
tt.node.Walk(v)
|
||||
|
||||
expected := []string{}
|
||||
actual := v.visitedKeys
|
||||
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
}
|
||||
}
|
||||
|
||||
func TestVisitor(t *testing.T) {
|
||||
for _, tt := range nodesToTest {
|
||||
v := &visitorMock{true, []string{}}
|
||||
tt.node.Walk(v)
|
||||
|
||||
expected := tt.expectedVisitedKeys
|
||||
actual := v.visitedKeys
|
||||
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
}
|
||||
}
|
||||
|
||||
// test Attributes()
|
||||
|
||||
func TestNameAttributes(t *testing.T) {
|
||||
for _, tt := range nodesToTest {
|
||||
expected := tt.expectedAttributes
|
||||
actual := tt.node.Attributes()
|
||||
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
}
|
||||
}
|
@ -1,58 +0,0 @@
|
||||
package cast
|
||||
|
||||
import (
|
||||
"github.com/z7zmey/php-parser/freefloating"
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
"github.com/z7zmey/php-parser/position"
|
||||
"github.com/z7zmey/php-parser/walker"
|
||||
)
|
||||
|
||||
// Array node
|
||||
type Array struct {
|
||||
FreeFloating freefloating.Collection
|
||||
Position *position.Position
|
||||
Expr node.Node
|
||||
}
|
||||
|
||||
// NewArray node constructor
|
||||
func NewArray(Expr node.Node) *Array {
|
||||
return &Array{
|
||||
FreeFloating: nil,
|
||||
Expr: Expr,
|
||||
}
|
||||
}
|
||||
|
||||
// SetPosition sets node position
|
||||
func (n *Array) SetPosition(p *position.Position) {
|
||||
n.Position = p
|
||||
}
|
||||
|
||||
// GetPosition returns node positions
|
||||
func (n *Array) GetPosition() *position.Position {
|
||||
return n.Position
|
||||
}
|
||||
|
||||
func (n *Array) GetFreeFloating() *freefloating.Collection {
|
||||
return &n.FreeFloating
|
||||
}
|
||||
|
||||
// Attributes returns node attributes as map
|
||||
func (n *Array) Attributes() map[string]interface{} {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Walk traverses nodes
|
||||
// Walk is invoked recursively until v.EnterNode returns true
|
||||
func (n *Array) Walk(v walker.Visitor) {
|
||||
if v.EnterNode(n) == false {
|
||||
return
|
||||
}
|
||||
|
||||
if n.Expr != nil {
|
||||
v.EnterChildNode("Expr", n)
|
||||
n.Expr.Walk(v)
|
||||
v.LeaveChildNode("Expr", n)
|
||||
}
|
||||
|
||||
v.LeaveNode(n)
|
||||
}
|
@ -1,58 +0,0 @@
|
||||
package cast
|
||||
|
||||
import (
|
||||
"github.com/z7zmey/php-parser/freefloating"
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
"github.com/z7zmey/php-parser/position"
|
||||
"github.com/z7zmey/php-parser/walker"
|
||||
)
|
||||
|
||||
// Bool node
|
||||
type Bool struct {
|
||||
FreeFloating freefloating.Collection
|
||||
Position *position.Position
|
||||
Expr node.Node
|
||||
}
|
||||
|
||||
// NewBool node constructor
|
||||
func NewBool(Expr node.Node) *Bool {
|
||||
return &Bool{
|
||||
FreeFloating: nil,
|
||||
Expr: Expr,
|
||||
}
|
||||
}
|
||||
|
||||
// SetPosition sets node position
|
||||
func (n *Bool) SetPosition(p *position.Position) {
|
||||
n.Position = p
|
||||
}
|
||||
|
||||
// GetPosition returns node positions
|
||||
func (n *Bool) GetPosition() *position.Position {
|
||||
return n.Position
|
||||
}
|
||||
|
||||
func (n *Bool) GetFreeFloating() *freefloating.Collection {
|
||||
return &n.FreeFloating
|
||||
}
|
||||
|
||||
// Attributes returns node attributes as map
|
||||
func (n *Bool) Attributes() map[string]interface{} {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Walk traverses nodes
|
||||
// Walk is invoked recursively until v.EnterNode returns true
|
||||
func (n *Bool) Walk(v walker.Visitor) {
|
||||
if v.EnterNode(n) == false {
|
||||
return
|
||||
}
|
||||
|
||||
if n.Expr != nil {
|
||||
v.EnterChildNode("Expr", n)
|
||||
n.Expr.Walk(v)
|
||||
v.LeaveChildNode("Expr", n)
|
||||
}
|
||||
|
||||
v.LeaveNode(n)
|
||||
}
|
@ -1,58 +0,0 @@
|
||||
package cast
|
||||
|
||||
import (
|
||||
"github.com/z7zmey/php-parser/freefloating"
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
"github.com/z7zmey/php-parser/position"
|
||||
"github.com/z7zmey/php-parser/walker"
|
||||
)
|
||||
|
||||
// Double node
|
||||
type Double struct {
|
||||
FreeFloating freefloating.Collection
|
||||
Position *position.Position
|
||||
Expr node.Node
|
||||
}
|
||||
|
||||
// NewDouble node constructor
|
||||
func NewDouble(Expr node.Node) *Double {
|
||||
return &Double{
|
||||
FreeFloating: nil,
|
||||
Expr: Expr,
|
||||
}
|
||||
}
|
||||
|
||||
// SetPosition sets node position
|
||||
func (n *Double) SetPosition(p *position.Position) {
|
||||
n.Position = p
|
||||
}
|
||||
|
||||
// GetPosition returns node positions
|
||||
func (n *Double) GetPosition() *position.Position {
|
||||
return n.Position
|
||||
}
|
||||
|
||||
func (n *Double) GetFreeFloating() *freefloating.Collection {
|
||||
return &n.FreeFloating
|
||||
}
|
||||
|
||||
// Attributes returns node attributes as map
|
||||
func (n *Double) Attributes() map[string]interface{} {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Walk traverses nodes
|
||||
// Walk is invoked recursively until v.EnterNode returns true
|
||||
func (n *Double) Walk(v walker.Visitor) {
|
||||
if v.EnterNode(n) == false {
|
||||
return
|
||||
}
|
||||
|
||||
if n.Expr != nil {
|
||||
v.EnterChildNode("Expr", n)
|
||||
n.Expr.Walk(v)
|
||||
v.LeaveChildNode("Expr", n)
|
||||
}
|
||||
|
||||
v.LeaveNode(n)
|
||||
}
|
@ -1,58 +0,0 @@
|
||||
package cast
|
||||
|
||||
import (
|
||||
"github.com/z7zmey/php-parser/freefloating"
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
"github.com/z7zmey/php-parser/position"
|
||||
"github.com/z7zmey/php-parser/walker"
|
||||
)
|
||||
|
||||
// Int node
|
||||
type Int struct {
|
||||
FreeFloating freefloating.Collection
|
||||
Position *position.Position
|
||||
Expr node.Node
|
||||
}
|
||||
|
||||
// NewInt node constructor
|
||||
func NewInt(Expr node.Node) *Int {
|
||||
return &Int{
|
||||
FreeFloating: nil,
|
||||
Expr: Expr,
|
||||
}
|
||||
}
|
||||
|
||||
// SetPosition sets node position
|
||||
func (n *Int) SetPosition(p *position.Position) {
|
||||
n.Position = p
|
||||
}
|
||||
|
||||
// GetPosition returns node positions
|
||||
func (n *Int) GetPosition() *position.Position {
|
||||
return n.Position
|
||||
}
|
||||
|
||||
func (n *Int) GetFreeFloating() *freefloating.Collection {
|
||||
return &n.FreeFloating
|
||||
}
|
||||
|
||||
// Attributes returns node attributes as map
|
||||
func (n *Int) Attributes() map[string]interface{} {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Walk traverses nodes
|
||||
// Walk is invoked recursively until v.EnterNode returns true
|
||||
func (n *Int) Walk(v walker.Visitor) {
|
||||
if v.EnterNode(n) == false {
|
||||
return
|
||||
}
|
||||
|
||||
if n.Expr != nil {
|
||||
v.EnterChildNode("Expr", n)
|
||||
n.Expr.Walk(v)
|
||||
v.LeaveChildNode("Expr", n)
|
||||
}
|
||||
|
||||
v.LeaveNode(n)
|
||||
}
|
@ -1,58 +0,0 @@
|
||||
package cast
|
||||
|
||||
import (
|
||||
"github.com/z7zmey/php-parser/freefloating"
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
"github.com/z7zmey/php-parser/position"
|
||||
"github.com/z7zmey/php-parser/walker"
|
||||
)
|
||||
|
||||
// Object node
|
||||
type Object struct {
|
||||
FreeFloating freefloating.Collection
|
||||
Position *position.Position
|
||||
Expr node.Node
|
||||
}
|
||||
|
||||
// NewObject node constructor
|
||||
func NewObject(Expr node.Node) *Object {
|
||||
return &Object{
|
||||
FreeFloating: nil,
|
||||
Expr: Expr,
|
||||
}
|
||||
}
|
||||
|
||||
// SetPosition sets node position
|
||||
func (n *Object) SetPosition(p *position.Position) {
|
||||
n.Position = p
|
||||
}
|
||||
|
||||
// GetPosition returns node positions
|
||||
func (n *Object) GetPosition() *position.Position {
|
||||
return n.Position
|
||||
}
|
||||
|
||||
func (n *Object) GetFreeFloating() *freefloating.Collection {
|
||||
return &n.FreeFloating
|
||||
}
|
||||
|
||||
// Attributes returns node attributes as map
|
||||
func (n *Object) Attributes() map[string]interface{} {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Walk traverses nodes
|
||||
// Walk is invoked recursively until v.EnterNode returns true
|
||||
func (n *Object) Walk(v walker.Visitor) {
|
||||
if v.EnterNode(n) == false {
|
||||
return
|
||||
}
|
||||
|
||||
if n.Expr != nil {
|
||||
v.EnterChildNode("Expr", n)
|
||||
n.Expr.Walk(v)
|
||||
v.LeaveChildNode("Expr", n)
|
||||
}
|
||||
|
||||
v.LeaveNode(n)
|
||||
}
|
@ -1,58 +0,0 @@
|
||||
package cast
|
||||
|
||||
import (
|
||||
"github.com/z7zmey/php-parser/freefloating"
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
"github.com/z7zmey/php-parser/position"
|
||||
"github.com/z7zmey/php-parser/walker"
|
||||
)
|
||||
|
||||
// String node
|
||||
type String struct {
|
||||
FreeFloating freefloating.Collection
|
||||
Position *position.Position
|
||||
Expr node.Node
|
||||
}
|
||||
|
||||
// NewString node constructor
|
||||
func NewString(Expr node.Node) *String {
|
||||
return &String{
|
||||
FreeFloating: nil,
|
||||
Expr: Expr,
|
||||
}
|
||||
}
|
||||
|
||||
// SetPosition sets node position
|
||||
func (n *String) SetPosition(p *position.Position) {
|
||||
n.Position = p
|
||||
}
|
||||
|
||||
// GetPosition returns node positions
|
||||
func (n *String) GetPosition() *position.Position {
|
||||
return n.Position
|
||||
}
|
||||
|
||||
func (n *String) GetFreeFloating() *freefloating.Collection {
|
||||
return &n.FreeFloating
|
||||
}
|
||||
|
||||
// Attributes returns node attributes as map
|
||||
func (n *String) Attributes() map[string]interface{} {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Walk traverses nodes
|
||||
// Walk is invoked recursively until v.EnterNode returns true
|
||||
func (n *String) Walk(v walker.Visitor) {
|
||||
if v.EnterNode(n) == false {
|
||||
return
|
||||
}
|
||||
|
||||
if n.Expr != nil {
|
||||
v.EnterChildNode("Expr", n)
|
||||
n.Expr.Walk(v)
|
||||
v.LeaveChildNode("Expr", n)
|
||||
}
|
||||
|
||||
v.LeaveNode(n)
|
||||
}
|
@ -1,58 +0,0 @@
|
||||
package cast
|
||||
|
||||
import (
|
||||
"github.com/z7zmey/php-parser/freefloating"
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
"github.com/z7zmey/php-parser/position"
|
||||
"github.com/z7zmey/php-parser/walker"
|
||||
)
|
||||
|
||||
// Unset node
|
||||
type Unset struct {
|
||||
FreeFloating freefloating.Collection
|
||||
Position *position.Position
|
||||
Expr node.Node
|
||||
}
|
||||
|
||||
// NewUnset node constructor
|
||||
func NewUnset(Expr node.Node) *Unset {
|
||||
return &Unset{
|
||||
FreeFloating: nil,
|
||||
Expr: Expr,
|
||||
}
|
||||
}
|
||||
|
||||
// SetPosition sets node position
|
||||
func (n *Unset) SetPosition(p *position.Position) {
|
||||
n.Position = p
|
||||
}
|
||||
|
||||
// GetPosition returns node positions
|
||||
func (n *Unset) GetPosition() *position.Position {
|
||||
return n.Position
|
||||
}
|
||||
|
||||
func (n *Unset) GetFreeFloating() *freefloating.Collection {
|
||||
return &n.FreeFloating
|
||||
}
|
||||
|
||||
// Attributes returns node attributes as map
|
||||
func (n *Unset) Attributes() map[string]interface{} {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Walk traverses nodes
|
||||
// Walk is invoked recursively until v.EnterNode returns true
|
||||
func (n *Unset) Walk(v walker.Visitor) {
|
||||
if v.EnterNode(n) == false {
|
||||
return
|
||||
}
|
||||
|
||||
if n.Expr != nil {
|
||||
v.EnterChildNode("Expr", n)
|
||||
n.Expr.Walk(v)
|
||||
v.LeaveChildNode("Expr", n)
|
||||
}
|
||||
|
||||
v.LeaveNode(n)
|
||||
}
|
@ -1,653 +0,0 @@
|
||||
package cast_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"gotest.tools/assert"
|
||||
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
"github.com/z7zmey/php-parser/node/expr"
|
||||
"github.com/z7zmey/php-parser/node/expr/cast"
|
||||
"github.com/z7zmey/php-parser/node/stmt"
|
||||
"github.com/z7zmey/php-parser/php5"
|
||||
"github.com/z7zmey/php-parser/php7"
|
||||
"github.com/z7zmey/php-parser/position"
|
||||
)
|
||||
|
||||
func TestArray(t *testing.T) {
|
||||
src := `<? (array)$a;`
|
||||
|
||||
expected := &node.Root{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 3,
|
||||
EndPos: 13,
|
||||
},
|
||||
Stmts: []node.Node{
|
||||
&stmt.Expression{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 3,
|
||||
EndPos: 13,
|
||||
},
|
||||
Expr: &cast.Array{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 3,
|
||||
EndPos: 12,
|
||||
},
|
||||
Expr: &expr.Variable{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 10,
|
||||
EndPos: 12,
|
||||
},
|
||||
VarName: &node.Identifier{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 10,
|
||||
EndPos: 12,
|
||||
},
|
||||
Value: "a",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
php7parser := php7.NewParser([]byte(src), "7.4")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
php5parser := php5.NewParser([]byte(src), "5.6")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
func TestBool(t *testing.T) {
|
||||
src := `<? (boolean)$a;`
|
||||
|
||||
expected := &node.Root{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 3,
|
||||
EndPos: 15,
|
||||
},
|
||||
Stmts: []node.Node{
|
||||
&stmt.Expression{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 3,
|
||||
EndPos: 15,
|
||||
},
|
||||
Expr: &cast.Bool{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 3,
|
||||
EndPos: 14,
|
||||
},
|
||||
Expr: &expr.Variable{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 12,
|
||||
EndPos: 14,
|
||||
},
|
||||
VarName: &node.Identifier{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 12,
|
||||
EndPos: 14,
|
||||
},
|
||||
Value: "a",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
php7parser := php7.NewParser([]byte(src), "7.4")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
php5parser := php5.NewParser([]byte(src), "5.6")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
func TestBoolShort(t *testing.T) {
|
||||
src := `<? (bool)$a;`
|
||||
|
||||
expected := &node.Root{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 3,
|
||||
EndPos: 12,
|
||||
},
|
||||
Stmts: []node.Node{
|
||||
&stmt.Expression{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 3,
|
||||
EndPos: 12,
|
||||
},
|
||||
Expr: &cast.Bool{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 3,
|
||||
EndPos: 11,
|
||||
},
|
||||
Expr: &expr.Variable{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 9,
|
||||
EndPos: 11,
|
||||
},
|
||||
VarName: &node.Identifier{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 9,
|
||||
EndPos: 11,
|
||||
},
|
||||
Value: "a",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
php7parser := php7.NewParser([]byte(src), "7.4")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
php5parser := php5.NewParser([]byte(src), "5.6")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
func TestDouble(t *testing.T) {
|
||||
src := `<? (double)$a;`
|
||||
|
||||
expected := &node.Root{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 3,
|
||||
EndPos: 14,
|
||||
},
|
||||
Stmts: []node.Node{
|
||||
&stmt.Expression{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 3,
|
||||
EndPos: 14,
|
||||
},
|
||||
Expr: &cast.Double{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 3,
|
||||
EndPos: 13,
|
||||
},
|
||||
Expr: &expr.Variable{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 11,
|
||||
EndPos: 13,
|
||||
},
|
||||
VarName: &node.Identifier{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 11,
|
||||
EndPos: 13,
|
||||
},
|
||||
Value: "a",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
php7parser := php7.NewParser([]byte(src), "7.4")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
php5parser := php5.NewParser([]byte(src), "5.6")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
func TestCastFloat(t *testing.T) {
|
||||
src := `<? (float)$a;`
|
||||
|
||||
expected := &node.Root{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 3,
|
||||
EndPos: 13,
|
||||
},
|
||||
Stmts: []node.Node{
|
||||
&stmt.Expression{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 3,
|
||||
EndPos: 13,
|
||||
},
|
||||
Expr: &cast.Double{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 3,
|
||||
EndPos: 12,
|
||||
},
|
||||
Expr: &expr.Variable{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 10,
|
||||
EndPos: 12,
|
||||
},
|
||||
VarName: &node.Identifier{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 10,
|
||||
EndPos: 12,
|
||||
},
|
||||
Value: "a",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
php7parser := php7.NewParser([]byte(src), "7.4")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
php5parser := php5.NewParser([]byte(src), "5.6")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
func TestInt(t *testing.T) {
|
||||
src := `<? (integer)$a;`
|
||||
|
||||
expected := &node.Root{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 3,
|
||||
EndPos: 15,
|
||||
},
|
||||
Stmts: []node.Node{
|
||||
&stmt.Expression{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 3,
|
||||
EndPos: 15,
|
||||
},
|
||||
Expr: &cast.Int{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 3,
|
||||
EndPos: 14,
|
||||
},
|
||||
Expr: &expr.Variable{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 12,
|
||||
EndPos: 14,
|
||||
},
|
||||
VarName: &node.Identifier{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 12,
|
||||
EndPos: 14,
|
||||
},
|
||||
Value: "a",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
php7parser := php7.NewParser([]byte(src), "7.4")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
php5parser := php5.NewParser([]byte(src), "5.6")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
func TestIntShort(t *testing.T) {
|
||||
src := `<? (int)$a;`
|
||||
|
||||
expected := &node.Root{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 3,
|
||||
EndPos: 11,
|
||||
},
|
||||
Stmts: []node.Node{
|
||||
&stmt.Expression{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 3,
|
||||
EndPos: 11,
|
||||
},
|
||||
Expr: &cast.Int{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 3,
|
||||
EndPos: 10,
|
||||
},
|
||||
Expr: &expr.Variable{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 8,
|
||||
EndPos: 10,
|
||||
},
|
||||
VarName: &node.Identifier{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 8,
|
||||
EndPos: 10,
|
||||
},
|
||||
Value: "a",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
php7parser := php7.NewParser([]byte(src), "7.4")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
php5parser := php5.NewParser([]byte(src), "5.6")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
func TestObject(t *testing.T) {
|
||||
src := `<? (object)$a;`
|
||||
|
||||
expected := &node.Root{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 3,
|
||||
EndPos: 14,
|
||||
},
|
||||
Stmts: []node.Node{
|
||||
&stmt.Expression{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 3,
|
||||
EndPos: 14,
|
||||
},
|
||||
Expr: &cast.Object{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 3,
|
||||
EndPos: 13,
|
||||
},
|
||||
Expr: &expr.Variable{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 11,
|
||||
EndPos: 13,
|
||||
},
|
||||
VarName: &node.Identifier{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 11,
|
||||
EndPos: 13,
|
||||
},
|
||||
Value: "a",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
php7parser := php7.NewParser([]byte(src), "7.4")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
php5parser := php5.NewParser([]byte(src), "5.6")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
func TestString(t *testing.T) {
|
||||
src := `<? (string)$a;`
|
||||
|
||||
expected := &node.Root{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 3,
|
||||
EndPos: 14,
|
||||
},
|
||||
Stmts: []node.Node{
|
||||
&stmt.Expression{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 3,
|
||||
EndPos: 14,
|
||||
},
|
||||
Expr: &cast.String{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 3,
|
||||
EndPos: 13,
|
||||
},
|
||||
Expr: &expr.Variable{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 11,
|
||||
EndPos: 13,
|
||||
},
|
||||
VarName: &node.Identifier{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 11,
|
||||
EndPos: 13,
|
||||
},
|
||||
Value: "a",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
php7parser := php7.NewParser([]byte(src), "7.4")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
php5parser := php5.NewParser([]byte(src), "5.6")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
func TestBinaryString(t *testing.T) {
|
||||
src := `<? (binary)$a;`
|
||||
|
||||
expected := &node.Root{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 3,
|
||||
EndPos: 14,
|
||||
},
|
||||
Stmts: []node.Node{
|
||||
&stmt.Expression{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 3,
|
||||
EndPos: 14,
|
||||
},
|
||||
Expr: &cast.String{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 3,
|
||||
EndPos: 13,
|
||||
},
|
||||
Expr: &expr.Variable{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 11,
|
||||
EndPos: 13,
|
||||
},
|
||||
VarName: &node.Identifier{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 11,
|
||||
EndPos: 13,
|
||||
},
|
||||
Value: "a",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
php7parser := php7.NewParser([]byte(src), "7.4")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
php5parser := php5.NewParser([]byte(src), "5.6")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
func TestUnset(t *testing.T) {
|
||||
src := `<? (unset)$a;`
|
||||
|
||||
expected := &node.Root{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 3,
|
||||
EndPos: 13,
|
||||
},
|
||||
Stmts: []node.Node{
|
||||
&stmt.Expression{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 3,
|
||||
EndPos: 13,
|
||||
},
|
||||
Expr: &cast.Unset{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 3,
|
||||
EndPos: 12,
|
||||
},
|
||||
Expr: &expr.Variable{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 10,
|
||||
EndPos: 12,
|
||||
},
|
||||
VarName: &node.Identifier{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 10,
|
||||
EndPos: 12,
|
||||
},
|
||||
Value: "a",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
php7parser := php7.NewParser([]byte(src), "7.4")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
php5parser := php5.NewParser([]byte(src), "5.6")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
}
|
@ -1,57 +0,0 @@
|
||||
package cast_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"gotest.tools/assert"
|
||||
|
||||
"github.com/z7zmey/php-parser/freefloating"
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
"github.com/z7zmey/php-parser/node/expr/cast"
|
||||
)
|
||||
|
||||
var expected freefloating.Collection = freefloating.Collection{
|
||||
freefloating.Start: []freefloating.String{
|
||||
{
|
||||
StringType: freefloating.WhiteSpaceType,
|
||||
Value: " ",
|
||||
Position: nil,
|
||||
},
|
||||
{
|
||||
StringType: freefloating.CommentType,
|
||||
Value: "//comment\n",
|
||||
Position: nil,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
var nodes = []node.Node{
|
||||
&cast.Array{
|
||||
FreeFloating: expected,
|
||||
},
|
||||
&cast.Bool{
|
||||
FreeFloating: expected,
|
||||
},
|
||||
&cast.Double{
|
||||
FreeFloating: expected,
|
||||
},
|
||||
&cast.Int{
|
||||
FreeFloating: expected,
|
||||
},
|
||||
&cast.Object{
|
||||
FreeFloating: expected,
|
||||
},
|
||||
&cast.String{
|
||||
FreeFloating: expected,
|
||||
},
|
||||
&cast.Unset{
|
||||
FreeFloating: expected,
|
||||
},
|
||||
}
|
||||
|
||||
func TestMeta(t *testing.T) {
|
||||
for _, n := range nodes {
|
||||
actual := *n.GetFreeFloating()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
}
|
||||
}
|
@ -1,18 +0,0 @@
|
||||
package cast_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"gotest.tools/assert"
|
||||
|
||||
"github.com/z7zmey/php-parser/position"
|
||||
)
|
||||
|
||||
func TestPosition(t *testing.T) {
|
||||
expected := position.NewPosition(1, 1, 1, 1)
|
||||
for _, n := range nodes {
|
||||
n.SetPosition(expected)
|
||||
actual := n.GetPosition()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
}
|
||||
}
|
@ -1,119 +0,0 @@
|
||||
package cast_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"gotest.tools/assert"
|
||||
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
"github.com/z7zmey/php-parser/node/expr"
|
||||
"github.com/z7zmey/php-parser/node/expr/cast"
|
||||
"github.com/z7zmey/php-parser/walker"
|
||||
)
|
||||
|
||||
var nodesToTest = []struct {
|
||||
node node.Node // node
|
||||
expectedVisitedKeys []string // visited keys
|
||||
expectedAttributes map[string]interface{}
|
||||
}{
|
||||
{
|
||||
&cast.Array{
|
||||
Expr: &expr.Variable{},
|
||||
},
|
||||
[]string{"Expr"},
|
||||
nil,
|
||||
},
|
||||
{
|
||||
&cast.Bool{
|
||||
Expr: &expr.Variable{},
|
||||
},
|
||||
[]string{"Expr"},
|
||||
nil,
|
||||
},
|
||||
{
|
||||
&cast.Double{
|
||||
Expr: &expr.Variable{},
|
||||
},
|
||||
[]string{"Expr"},
|
||||
nil,
|
||||
},
|
||||
{
|
||||
&cast.Int{
|
||||
Expr: &expr.Variable{},
|
||||
},
|
||||
[]string{"Expr"},
|
||||
nil,
|
||||
},
|
||||
{
|
||||
&cast.Object{
|
||||
Expr: &expr.Variable{},
|
||||
},
|
||||
[]string{"Expr"},
|
||||
nil,
|
||||
},
|
||||
{
|
||||
&cast.String{
|
||||
Expr: &expr.Variable{},
|
||||
},
|
||||
[]string{"Expr"},
|
||||
nil,
|
||||
},
|
||||
{
|
||||
&cast.Unset{
|
||||
Expr: &expr.Variable{},
|
||||
},
|
||||
[]string{"Expr"},
|
||||
nil,
|
||||
},
|
||||
}
|
||||
|
||||
type visitorMock struct {
|
||||
visitChildren bool
|
||||
visitedKeys []string
|
||||
}
|
||||
|
||||
func (v *visitorMock) EnterNode(n walker.Walkable) bool { return v.visitChildren }
|
||||
func (v *visitorMock) LeaveNode(n walker.Walkable) {}
|
||||
func (v *visitorMock) EnterChildNode(key string, w walker.Walkable) {
|
||||
v.visitedKeys = append(v.visitedKeys, key)
|
||||
}
|
||||
func (v *visitorMock) LeaveChildNode(key string, w walker.Walkable) {}
|
||||
func (v *visitorMock) EnterChildList(key string, w walker.Walkable) {
|
||||
v.visitedKeys = append(v.visitedKeys, key)
|
||||
}
|
||||
func (v *visitorMock) LeaveChildList(key string, w walker.Walkable) {}
|
||||
|
||||
func TestVisitorDisableChildren(t *testing.T) {
|
||||
for _, tt := range nodesToTest {
|
||||
v := &visitorMock{false, []string{}}
|
||||
tt.node.Walk(v)
|
||||
|
||||
expected := []string{}
|
||||
actual := v.visitedKeys
|
||||
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
}
|
||||
}
|
||||
|
||||
func TestVisitor(t *testing.T) {
|
||||
for _, tt := range nodesToTest {
|
||||
v := &visitorMock{true, []string{}}
|
||||
tt.node.Walk(v)
|
||||
|
||||
expected := tt.expectedVisitedKeys
|
||||
actual := v.visitedKeys
|
||||
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
}
|
||||
}
|
||||
|
||||
// test Attributes()
|
||||
|
||||
func TestNameAttributes(t *testing.T) {
|
||||
for _, tt := range nodesToTest {
|
||||
expected := tt.expectedAttributes
|
||||
actual := tt.node.Attributes()
|
||||
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
}
|
||||
}
|
@ -1,62 +0,0 @@
|
||||
package expr
|
||||
|
||||
import (
|
||||
"github.com/z7zmey/php-parser/freefloating"
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
"github.com/z7zmey/php-parser/position"
|
||||
"github.com/z7zmey/php-parser/walker"
|
||||
)
|
||||
|
||||
// Array node
|
||||
type Array struct {
|
||||
FreeFloating freefloating.Collection
|
||||
Position *position.Position
|
||||
Items []node.Node
|
||||
}
|
||||
|
||||
// NewArray node constructor
|
||||
func NewArray(Items []node.Node) *Array {
|
||||
return &Array{
|
||||
FreeFloating: nil,
|
||||
Items: Items,
|
||||
}
|
||||
}
|
||||
|
||||
// SetPosition sets node position
|
||||
func (n *Array) SetPosition(p *position.Position) {
|
||||
n.Position = p
|
||||
}
|
||||
|
||||
// GetPosition returns node positions
|
||||
func (n *Array) GetPosition() *position.Position {
|
||||
return n.Position
|
||||
}
|
||||
|
||||
func (n *Array) GetFreeFloating() *freefloating.Collection {
|
||||
return &n.FreeFloating
|
||||
}
|
||||
|
||||
// Attributes returns node attributes as map
|
||||
func (n *Array) Attributes() map[string]interface{} {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Walk traverses nodes
|
||||
// Walk is invoked recursively until v.EnterNode returns true
|
||||
func (n *Array) Walk(v walker.Visitor) {
|
||||
if v.EnterNode(n) == false {
|
||||
return
|
||||
}
|
||||
|
||||
if n.Items != nil {
|
||||
v.EnterChildList("Items", n)
|
||||
for _, nn := range n.Items {
|
||||
if nn != nil {
|
||||
nn.Walk(v)
|
||||
}
|
||||
}
|
||||
v.LeaveChildList("Items", n)
|
||||
}
|
||||
|
||||
v.LeaveNode(n)
|
||||
}
|
@ -1,66 +0,0 @@
|
||||
package expr
|
||||
|
||||
import (
|
||||
"github.com/z7zmey/php-parser/freefloating"
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
"github.com/z7zmey/php-parser/position"
|
||||
"github.com/z7zmey/php-parser/walker"
|
||||
)
|
||||
|
||||
// ArrayDimFetch node
|
||||
type ArrayDimFetch struct {
|
||||
FreeFloating freefloating.Collection
|
||||
Position *position.Position
|
||||
Variable node.Node
|
||||
Dim node.Node
|
||||
}
|
||||
|
||||
// NewArrayDimFetch node constructor
|
||||
func NewArrayDimFetch(Variable node.Node, Dim node.Node) *ArrayDimFetch {
|
||||
return &ArrayDimFetch{
|
||||
FreeFloating: nil,
|
||||
Variable: Variable,
|
||||
Dim: Dim,
|
||||
}
|
||||
}
|
||||
|
||||
// SetPosition sets node position
|
||||
func (n *ArrayDimFetch) SetPosition(p *position.Position) {
|
||||
n.Position = p
|
||||
}
|
||||
|
||||
// GetPosition returns node positions
|
||||
func (n *ArrayDimFetch) GetPosition() *position.Position {
|
||||
return n.Position
|
||||
}
|
||||
|
||||
func (n *ArrayDimFetch) GetFreeFloating() *freefloating.Collection {
|
||||
return &n.FreeFloating
|
||||
}
|
||||
|
||||
// Attributes returns node attributes as map
|
||||
func (n *ArrayDimFetch) Attributes() map[string]interface{} {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Walk traverses nodes
|
||||
// Walk is invoked recursively until v.EnterNode returns true
|
||||
func (n *ArrayDimFetch) Walk(v walker.Visitor) {
|
||||
if v.EnterNode(n) == false {
|
||||
return
|
||||
}
|
||||
|
||||
if n.Variable != nil {
|
||||
v.EnterChildNode("Variable", n)
|
||||
n.Variable.Walk(v)
|
||||
v.LeaveChildNode("Variable", n)
|
||||
}
|
||||
|
||||
if n.Dim != nil {
|
||||
v.EnterChildNode("Dim", n)
|
||||
n.Dim.Walk(v)
|
||||
v.LeaveChildNode("Dim", n)
|
||||
}
|
||||
|
||||
v.LeaveNode(n)
|
||||
}
|
@ -1,70 +0,0 @@
|
||||
package expr
|
||||
|
||||
import (
|
||||
"github.com/z7zmey/php-parser/freefloating"
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
"github.com/z7zmey/php-parser/position"
|
||||
"github.com/z7zmey/php-parser/walker"
|
||||
)
|
||||
|
||||
// ArrayItem node
|
||||
type ArrayItem struct {
|
||||
FreeFloating freefloating.Collection
|
||||
Position *position.Position
|
||||
Key node.Node
|
||||
Val node.Node
|
||||
Unpack bool
|
||||
}
|
||||
|
||||
// NewArrayItem node constructor
|
||||
func NewArrayItem(Key node.Node, Val node.Node, Unpack bool) *ArrayItem {
|
||||
return &ArrayItem{
|
||||
FreeFloating: nil,
|
||||
Key: Key,
|
||||
Val: Val,
|
||||
Unpack: Unpack,
|
||||
}
|
||||
}
|
||||
|
||||
// SetPosition sets node position
|
||||
func (n *ArrayItem) SetPosition(p *position.Position) {
|
||||
n.Position = p
|
||||
}
|
||||
|
||||
// GetPosition returns node positions
|
||||
func (n *ArrayItem) GetPosition() *position.Position {
|
||||
return n.Position
|
||||
}
|
||||
|
||||
func (n *ArrayItem) GetFreeFloating() *freefloating.Collection {
|
||||
return &n.FreeFloating
|
||||
}
|
||||
|
||||
// Attributes returns node attributes as map
|
||||
func (n *ArrayItem) Attributes() map[string]interface{} {
|
||||
return map[string]interface{}{
|
||||
"Unpack": n.Unpack,
|
||||
}
|
||||
}
|
||||
|
||||
// Walk traverses nodes
|
||||
// Walk is invoked recursively until v.EnterNode returns true
|
||||
func (n *ArrayItem) Walk(v walker.Visitor) {
|
||||
if v.EnterNode(n) == false {
|
||||
return
|
||||
}
|
||||
|
||||
if n.Key != nil {
|
||||
v.EnterChildNode("Key", n)
|
||||
n.Key.Walk(v)
|
||||
v.LeaveChildNode("Key", n)
|
||||
}
|
||||
|
||||
if n.Val != nil {
|
||||
v.EnterChildNode("Val", n)
|
||||
n.Val.Walk(v)
|
||||
v.LeaveChildNode("Val", n)
|
||||
}
|
||||
|
||||
v.LeaveNode(n)
|
||||
}
|
@ -1,88 +0,0 @@
|
||||
package expr
|
||||
|
||||
import (
|
||||
"github.com/z7zmey/php-parser/freefloating"
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
"github.com/z7zmey/php-parser/position"
|
||||
"github.com/z7zmey/php-parser/walker"
|
||||
)
|
||||
|
||||
// ArrowFunction node
|
||||
type ArrowFunction struct {
|
||||
FreeFloating freefloating.Collection
|
||||
Position *position.Position
|
||||
ReturnsRef bool
|
||||
Static bool
|
||||
PhpDocComment string
|
||||
Params []node.Node
|
||||
ReturnType node.Node
|
||||
Expr node.Node
|
||||
}
|
||||
|
||||
// NewArrowFunction node constructor
|
||||
func NewArrowFunction(Params []node.Node, ReturnType node.Node, Stmt node.Node, Static bool, ReturnsRef bool, PhpDocComment string) *ArrowFunction {
|
||||
return &ArrowFunction{
|
||||
FreeFloating: nil,
|
||||
ReturnsRef: ReturnsRef,
|
||||
Static: Static,
|
||||
PhpDocComment: PhpDocComment,
|
||||
Params: Params,
|
||||
ReturnType: ReturnType,
|
||||
Expr: Stmt,
|
||||
}
|
||||
}
|
||||
|
||||
// SetPosition sets node position
|
||||
func (n *ArrowFunction) SetPosition(p *position.Position) {
|
||||
n.Position = p
|
||||
}
|
||||
|
||||
// GetPosition returns node positions
|
||||
func (n *ArrowFunction) GetPosition() *position.Position {
|
||||
return n.Position
|
||||
}
|
||||
|
||||
func (n *ArrowFunction) GetFreeFloating() *freefloating.Collection {
|
||||
return &n.FreeFloating
|
||||
}
|
||||
|
||||
// Attributes returns node attributes as map
|
||||
func (n *ArrowFunction) Attributes() map[string]interface{} {
|
||||
return map[string]interface{}{
|
||||
"ReturnsRef": n.ReturnsRef,
|
||||
"Static": n.Static,
|
||||
"PhpDocComment": n.PhpDocComment,
|
||||
}
|
||||
}
|
||||
|
||||
// Walk traverses nodes
|
||||
// Walk is invoked recursively until v.EnterNode returns true
|
||||
func (n *ArrowFunction) Walk(v walker.Visitor) {
|
||||
if v.EnterNode(n) == false {
|
||||
return
|
||||
}
|
||||
|
||||
if n.Params != nil {
|
||||
v.EnterChildList("Params", n)
|
||||
for _, nn := range n.Params {
|
||||
if nn != nil {
|
||||
nn.Walk(v)
|
||||
}
|
||||
}
|
||||
v.LeaveChildList("Params", n)
|
||||
}
|
||||
|
||||
if n.ReturnType != nil {
|
||||
v.EnterChildNode("ReturnType", n)
|
||||
n.ReturnType.Walk(v)
|
||||
v.LeaveChildNode("ReturnType", n)
|
||||
}
|
||||
|
||||
if n.Expr != nil {
|
||||
v.EnterChildNode("Expr", n)
|
||||
n.Expr.Walk(v)
|
||||
v.LeaveChildNode("Expr", n)
|
||||
}
|
||||
|
||||
v.LeaveNode(n)
|
||||
}
|
@ -1,58 +0,0 @@
|
||||
package expr
|
||||
|
||||
import (
|
||||
"github.com/z7zmey/php-parser/freefloating"
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
"github.com/z7zmey/php-parser/position"
|
||||
"github.com/z7zmey/php-parser/walker"
|
||||
)
|
||||
|
||||
// BitwiseNot node
|
||||
type BitwiseNot struct {
|
||||
FreeFloating freefloating.Collection
|
||||
Position *position.Position
|
||||
Expr node.Node
|
||||
}
|
||||
|
||||
// NewBitwiseNot node constructor
|
||||
func NewBitwiseNot(Expression node.Node) *BitwiseNot {
|
||||
return &BitwiseNot{
|
||||
FreeFloating: nil,
|
||||
Expr: Expression,
|
||||
}
|
||||
}
|
||||
|
||||
// SetPosition sets node position
|
||||
func (n *BitwiseNot) SetPosition(p *position.Position) {
|
||||
n.Position = p
|
||||
}
|
||||
|
||||
// GetPosition returns node positions
|
||||
func (n *BitwiseNot) GetPosition() *position.Position {
|
||||
return n.Position
|
||||
}
|
||||
|
||||
func (n *BitwiseNot) GetFreeFloating() *freefloating.Collection {
|
||||
return &n.FreeFloating
|
||||
}
|
||||
|
||||
// Attributes returns node attributes as map
|
||||
func (n *BitwiseNot) Attributes() map[string]interface{} {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Walk traverses nodes
|
||||
// Walk is invoked recursively until v.EnterNode returns true
|
||||
func (n *BitwiseNot) Walk(v walker.Visitor) {
|
||||
if v.EnterNode(n) == false {
|
||||
return
|
||||
}
|
||||
|
||||
if n.Expr != nil {
|
||||
v.EnterChildNode("Expr", n)
|
||||
n.Expr.Walk(v)
|
||||
v.LeaveChildNode("Expr", n)
|
||||
}
|
||||
|
||||
v.LeaveNode(n)
|
||||
}
|
@ -1,58 +0,0 @@
|
||||
package expr
|
||||
|
||||
import (
|
||||
"github.com/z7zmey/php-parser/freefloating"
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
"github.com/z7zmey/php-parser/position"
|
||||
"github.com/z7zmey/php-parser/walker"
|
||||
)
|
||||
|
||||
// BooleanNot node
|
||||
type BooleanNot struct {
|
||||
FreeFloating freefloating.Collection
|
||||
Position *position.Position
|
||||
Expr node.Node
|
||||
}
|
||||
|
||||
// NewBooleanNot node constructor
|
||||
func NewBooleanNot(Expression node.Node) *BooleanNot {
|
||||
return &BooleanNot{
|
||||
FreeFloating: nil,
|
||||
Expr: Expression,
|
||||
}
|
||||
}
|
||||
|
||||
// SetPosition sets node position
|
||||
func (n *BooleanNot) SetPosition(p *position.Position) {
|
||||
n.Position = p
|
||||
}
|
||||
|
||||
// GetPosition returns node positions
|
||||
func (n *BooleanNot) GetPosition() *position.Position {
|
||||
return n.Position
|
||||
}
|
||||
|
||||
func (n *BooleanNot) GetFreeFloating() *freefloating.Collection {
|
||||
return &n.FreeFloating
|
||||
}
|
||||
|
||||
// Attributes returns node attributes as map
|
||||
func (n *BooleanNot) Attributes() map[string]interface{} {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Walk traverses nodes
|
||||
// Walk is invoked recursively until v.EnterNode returns true
|
||||
func (n *BooleanNot) Walk(v walker.Visitor) {
|
||||
if v.EnterNode(n) == false {
|
||||
return
|
||||
}
|
||||
|
||||
if n.Expr != nil {
|
||||
v.EnterChildNode("Expr", n)
|
||||
n.Expr.Walk(v)
|
||||
v.LeaveChildNode("Expr", n)
|
||||
}
|
||||
|
||||
v.LeaveNode(n)
|
||||
}
|
@ -1,66 +0,0 @@
|
||||
package expr
|
||||
|
||||
import (
|
||||
"github.com/z7zmey/php-parser/freefloating"
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
"github.com/z7zmey/php-parser/position"
|
||||
"github.com/z7zmey/php-parser/walker"
|
||||
)
|
||||
|
||||
// ClassConstFetch node
|
||||
type ClassConstFetch struct {
|
||||
FreeFloating freefloating.Collection
|
||||
Position *position.Position
|
||||
Class node.Node
|
||||
ConstantName node.Node
|
||||
}
|
||||
|
||||
// NewClassConstFetch node constructor
|
||||
func NewClassConstFetch(Class node.Node, ConstantName node.Node) *ClassConstFetch {
|
||||
return &ClassConstFetch{
|
||||
FreeFloating: nil,
|
||||
Class: Class,
|
||||
ConstantName: ConstantName,
|
||||
}
|
||||
}
|
||||
|
||||
// SetPosition sets node position
|
||||
func (n *ClassConstFetch) SetPosition(p *position.Position) {
|
||||
n.Position = p
|
||||
}
|
||||
|
||||
// GetPosition returns node positions
|
||||
func (n *ClassConstFetch) GetPosition() *position.Position {
|
||||
return n.Position
|
||||
}
|
||||
|
||||
func (n *ClassConstFetch) GetFreeFloating() *freefloating.Collection {
|
||||
return &n.FreeFloating
|
||||
}
|
||||
|
||||
// Attributes returns node attributes as map
|
||||
func (n *ClassConstFetch) Attributes() map[string]interface{} {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Walk traverses nodes
|
||||
// Walk is invoked recursively until v.EnterNode returns true
|
||||
func (n *ClassConstFetch) Walk(v walker.Visitor) {
|
||||
if v.EnterNode(n) == false {
|
||||
return
|
||||
}
|
||||
|
||||
if n.Class != nil {
|
||||
v.EnterChildNode("Class", n)
|
||||
n.Class.Walk(v)
|
||||
v.LeaveChildNode("Class", n)
|
||||
}
|
||||
|
||||
if n.ConstantName != nil {
|
||||
v.EnterChildNode("ConstantName", n)
|
||||
n.ConstantName.Walk(v)
|
||||
v.LeaveChildNode("ConstantName", n)
|
||||
}
|
||||
|
||||
v.LeaveNode(n)
|
||||
}
|
@ -1,58 +0,0 @@
|
||||
package expr
|
||||
|
||||
import (
|
||||
"github.com/z7zmey/php-parser/freefloating"
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
"github.com/z7zmey/php-parser/position"
|
||||
"github.com/z7zmey/php-parser/walker"
|
||||
)
|
||||
|
||||
// Clone node
|
||||
type Clone struct {
|
||||
FreeFloating freefloating.Collection
|
||||
Position *position.Position
|
||||
Expr node.Node
|
||||
}
|
||||
|
||||
// NewClone node constructor
|
||||
func NewClone(Expression node.Node) *Clone {
|
||||
return &Clone{
|
||||
FreeFloating: nil,
|
||||
Expr: Expression,
|
||||
}
|
||||
}
|
||||
|
||||
// SetPosition sets node position
|
||||
func (n *Clone) SetPosition(p *position.Position) {
|
||||
n.Position = p
|
||||
}
|
||||
|
||||
// GetPosition returns node positions
|
||||
func (n *Clone) GetPosition() *position.Position {
|
||||
return n.Position
|
||||
}
|
||||
|
||||
func (n *Clone) GetFreeFloating() *freefloating.Collection {
|
||||
return &n.FreeFloating
|
||||
}
|
||||
|
||||
// Attributes returns node attributes as map
|
||||
func (n *Clone) Attributes() map[string]interface{} {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Walk traverses nodes
|
||||
// Walk is invoked recursively until v.EnterNode returns true
|
||||
func (n *Clone) Walk(v walker.Visitor) {
|
||||
if v.EnterNode(n) == false {
|
||||
return
|
||||
}
|
||||
|
||||
if n.Expr != nil {
|
||||
v.EnterChildNode("Expr", n)
|
||||
n.Expr.Walk(v)
|
||||
v.LeaveChildNode("Expr", n)
|
||||
}
|
||||
|
||||
v.LeaveNode(n)
|
||||
}
|
@ -1,100 +0,0 @@
|
||||
package expr
|
||||
|
||||
import (
|
||||
"github.com/z7zmey/php-parser/freefloating"
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
"github.com/z7zmey/php-parser/position"
|
||||
"github.com/z7zmey/php-parser/walker"
|
||||
)
|
||||
|
||||
// Closure node
|
||||
type Closure struct {
|
||||
FreeFloating freefloating.Collection
|
||||
Position *position.Position
|
||||
ReturnsRef bool
|
||||
Static bool
|
||||
PhpDocComment string
|
||||
Params []node.Node
|
||||
ClosureUse *ClosureUse
|
||||
ReturnType node.Node
|
||||
Stmts []node.Node
|
||||
}
|
||||
|
||||
// NewClosure node constructor
|
||||
func NewClosure(Params []node.Node, ClosureUse *ClosureUse, ReturnType node.Node, Stmts []node.Node, Static bool, ReturnsRef bool, PhpDocComment string) *Closure {
|
||||
return &Closure{
|
||||
FreeFloating: nil,
|
||||
ReturnsRef: ReturnsRef,
|
||||
Static: Static,
|
||||
PhpDocComment: PhpDocComment,
|
||||
Params: Params,
|
||||
ClosureUse: ClosureUse,
|
||||
ReturnType: ReturnType,
|
||||
Stmts: Stmts,
|
||||
}
|
||||
}
|
||||
|
||||
// SetPosition sets node position
|
||||
func (n *Closure) SetPosition(p *position.Position) {
|
||||
n.Position = p
|
||||
}
|
||||
|
||||
// GetPosition returns node positions
|
||||
func (n *Closure) GetPosition() *position.Position {
|
||||
return n.Position
|
||||
}
|
||||
|
||||
func (n *Closure) GetFreeFloating() *freefloating.Collection {
|
||||
return &n.FreeFloating
|
||||
}
|
||||
|
||||
// Attributes returns node attributes as map
|
||||
func (n *Closure) Attributes() map[string]interface{} {
|
||||
return map[string]interface{}{
|
||||
"ReturnsRef": n.ReturnsRef,
|
||||
"Static": n.Static,
|
||||
"PhpDocComment": n.PhpDocComment,
|
||||
}
|
||||
}
|
||||
|
||||
// Walk traverses nodes
|
||||
// Walk is invoked recursively until v.EnterNode returns true
|
||||
func (n *Closure) Walk(v walker.Visitor) {
|
||||
if v.EnterNode(n) == false {
|
||||
return
|
||||
}
|
||||
|
||||
if n.Params != nil {
|
||||
v.EnterChildList("Params", n)
|
||||
for _, nn := range n.Params {
|
||||
if nn != nil {
|
||||
nn.Walk(v)
|
||||
}
|
||||
}
|
||||
v.LeaveChildList("Params", n)
|
||||
}
|
||||
|
||||
if n.ClosureUse != nil {
|
||||
v.EnterChildNode("ClosureUse", n)
|
||||
n.ClosureUse.Walk(v)
|
||||
v.LeaveChildNode("ClosureUse", n)
|
||||
}
|
||||
|
||||
if n.ReturnType != nil {
|
||||
v.EnterChildNode("ReturnType", n)
|
||||
n.ReturnType.Walk(v)
|
||||
v.LeaveChildNode("ReturnType", n)
|
||||
}
|
||||
|
||||
if n.Stmts != nil {
|
||||
v.EnterChildList("Stmts", n)
|
||||
for _, nn := range n.Stmts {
|
||||
if nn != nil {
|
||||
nn.Walk(v)
|
||||
}
|
||||
}
|
||||
v.LeaveChildList("Stmts", n)
|
||||
}
|
||||
|
||||
v.LeaveNode(n)
|
||||
}
|
@ -1,62 +0,0 @@
|
||||
package expr
|
||||
|
||||
import (
|
||||
"github.com/z7zmey/php-parser/freefloating"
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
"github.com/z7zmey/php-parser/position"
|
||||
"github.com/z7zmey/php-parser/walker"
|
||||
)
|
||||
|
||||
// ClosureUse node
|
||||
type ClosureUse struct {
|
||||
FreeFloating freefloating.Collection
|
||||
Position *position.Position
|
||||
Uses []node.Node
|
||||
}
|
||||
|
||||
// NewClosureUse node constructor
|
||||
func NewClosureUse(Uses []node.Node) *ClosureUse {
|
||||
return &ClosureUse{
|
||||
FreeFloating: nil,
|
||||
Uses: Uses,
|
||||
}
|
||||
}
|
||||
|
||||
// SetPosition sets node position
|
||||
func (n *ClosureUse) SetPosition(p *position.Position) {
|
||||
n.Position = p
|
||||
}
|
||||
|
||||
// GetPosition returns node positions
|
||||
func (n *ClosureUse) GetPosition() *position.Position {
|
||||
return n.Position
|
||||
}
|
||||
|
||||
func (n *ClosureUse) GetFreeFloating() *freefloating.Collection {
|
||||
return &n.FreeFloating
|
||||
}
|
||||
|
||||
// Attributes returns node attributes as map
|
||||
func (n *ClosureUse) Attributes() map[string]interface{} {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Walk traverses nodes
|
||||
// Walk is invoked recursively until v.EnterNode returns true
|
||||
func (n *ClosureUse) Walk(v walker.Visitor) {
|
||||
if v.EnterNode(n) == false {
|
||||
return
|
||||
}
|
||||
|
||||
if n.Uses != nil {
|
||||
v.EnterChildList("Uses", n)
|
||||
for _, nn := range n.Uses {
|
||||
if nn != nil {
|
||||
nn.Walk(v)
|
||||
}
|
||||
}
|
||||
v.LeaveChildList("Uses", n)
|
||||
}
|
||||
|
||||
v.LeaveNode(n)
|
||||
}
|
@ -1,58 +0,0 @@
|
||||
package expr
|
||||
|
||||
import (
|
||||
"github.com/z7zmey/php-parser/freefloating"
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
"github.com/z7zmey/php-parser/position"
|
||||
"github.com/z7zmey/php-parser/walker"
|
||||
)
|
||||
|
||||
// ConstFetch node
|
||||
type ConstFetch struct {
|
||||
FreeFloating freefloating.Collection
|
||||
Position *position.Position
|
||||
Constant node.Node
|
||||
}
|
||||
|
||||
// NewConstFetch node constructor
|
||||
func NewConstFetch(Constant node.Node) *ConstFetch {
|
||||
return &ConstFetch{
|
||||
FreeFloating: nil,
|
||||
Constant: Constant,
|
||||
}
|
||||
}
|
||||
|
||||
// SetPosition sets node position
|
||||
func (n *ConstFetch) SetPosition(p *position.Position) {
|
||||
n.Position = p
|
||||
}
|
||||
|
||||
// GetPosition returns node positions
|
||||
func (n *ConstFetch) GetPosition() *position.Position {
|
||||
return n.Position
|
||||
}
|
||||
|
||||
func (n *ConstFetch) GetFreeFloating() *freefloating.Collection {
|
||||
return &n.FreeFloating
|
||||
}
|
||||
|
||||
// Attributes returns node attributes as map
|
||||
func (n *ConstFetch) Attributes() map[string]interface{} {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Walk traverses nodes
|
||||
// Walk is invoked recursively until v.EnterNode returns true
|
||||
func (n *ConstFetch) Walk(v walker.Visitor) {
|
||||
if v.EnterNode(n) == false {
|
||||
return
|
||||
}
|
||||
|
||||
if n.Constant != nil {
|
||||
v.EnterChildNode("Constant", n)
|
||||
n.Constant.Walk(v)
|
||||
v.LeaveChildNode("Constant", n)
|
||||
}
|
||||
|
||||
v.LeaveNode(n)
|
||||
}
|
@ -1,58 +0,0 @@
|
||||
package expr
|
||||
|
||||
import (
|
||||
"github.com/z7zmey/php-parser/freefloating"
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
"github.com/z7zmey/php-parser/position"
|
||||
"github.com/z7zmey/php-parser/walker"
|
||||
)
|
||||
|
||||
// Empty node
|
||||
type Empty struct {
|
||||
FreeFloating freefloating.Collection
|
||||
Position *position.Position
|
||||
Expr node.Node
|
||||
}
|
||||
|
||||
// NewEmpty node constructor
|
||||
func NewEmpty(Expression node.Node) *Empty {
|
||||
return &Empty{
|
||||
FreeFloating: nil,
|
||||
Expr: Expression,
|
||||
}
|
||||
}
|
||||
|
||||
// SetPosition sets node position
|
||||
func (n *Empty) SetPosition(p *position.Position) {
|
||||
n.Position = p
|
||||
}
|
||||
|
||||
// GetPosition returns node positions
|
||||
func (n *Empty) GetPosition() *position.Position {
|
||||
return n.Position
|
||||
}
|
||||
|
||||
func (n *Empty) GetFreeFloating() *freefloating.Collection {
|
||||
return &n.FreeFloating
|
||||
}
|
||||
|
||||
// Attributes returns node attributes as map
|
||||
func (n *Empty) Attributes() map[string]interface{} {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Walk traverses nodes
|
||||
// Walk is invoked recursively until v.EnterNode returns true
|
||||
func (n *Empty) Walk(v walker.Visitor) {
|
||||
if v.EnterNode(n) == false {
|
||||
return
|
||||
}
|
||||
|
||||
if n.Expr != nil {
|
||||
v.EnterChildNode("Expr", n)
|
||||
n.Expr.Walk(v)
|
||||
v.LeaveChildNode("Expr", n)
|
||||
}
|
||||
|
||||
v.LeaveNode(n)
|
||||
}
|
@ -1,58 +0,0 @@
|
||||
package expr
|
||||
|
||||
import (
|
||||
"github.com/z7zmey/php-parser/freefloating"
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
"github.com/z7zmey/php-parser/position"
|
||||
"github.com/z7zmey/php-parser/walker"
|
||||
)
|
||||
|
||||
// ErrorSuppress node
|
||||
type ErrorSuppress struct {
|
||||
FreeFloating freefloating.Collection
|
||||
Position *position.Position
|
||||
Expr node.Node
|
||||
}
|
||||
|
||||
// NewErrorSuppress node constructor
|
||||
func NewErrorSuppress(Expression node.Node) *ErrorSuppress {
|
||||
return &ErrorSuppress{
|
||||
FreeFloating: nil,
|
||||
Expr: Expression,
|
||||
}
|
||||
}
|
||||
|
||||
// SetPosition sets node position
|
||||
func (n *ErrorSuppress) SetPosition(p *position.Position) {
|
||||
n.Position = p
|
||||
}
|
||||
|
||||
// GetPosition returns node positions
|
||||
func (n *ErrorSuppress) GetPosition() *position.Position {
|
||||
return n.Position
|
||||
}
|
||||
|
||||
func (n *ErrorSuppress) GetFreeFloating() *freefloating.Collection {
|
||||
return &n.FreeFloating
|
||||
}
|
||||
|
||||
// Attributes returns node attributes as map
|
||||
func (n *ErrorSuppress) Attributes() map[string]interface{} {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Walk traverses nodes
|
||||
// Walk is invoked recursively until v.EnterNode returns true
|
||||
func (n *ErrorSuppress) Walk(v walker.Visitor) {
|
||||
if v.EnterNode(n) == false {
|
||||
return
|
||||
}
|
||||
|
||||
if n.Expr != nil {
|
||||
v.EnterChildNode("Expr", n)
|
||||
n.Expr.Walk(v)
|
||||
v.LeaveChildNode("Expr", n)
|
||||
}
|
||||
|
||||
v.LeaveNode(n)
|
||||
}
|
@ -1,58 +0,0 @@
|
||||
package expr
|
||||
|
||||
import (
|
||||
"github.com/z7zmey/php-parser/freefloating"
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
"github.com/z7zmey/php-parser/position"
|
||||
"github.com/z7zmey/php-parser/walker"
|
||||
)
|
||||
|
||||
// Eval node
|
||||
type Eval struct {
|
||||
FreeFloating freefloating.Collection
|
||||
Position *position.Position
|
||||
Expr node.Node
|
||||
}
|
||||
|
||||
// NewEval node constructor
|
||||
func NewEval(Expression node.Node) *Eval {
|
||||
return &Eval{
|
||||
FreeFloating: nil,
|
||||
Expr: Expression,
|
||||
}
|
||||
}
|
||||
|
||||
// SetPosition sets node position
|
||||
func (n *Eval) SetPosition(p *position.Position) {
|
||||
n.Position = p
|
||||
}
|
||||
|
||||
// GetPosition returns node positions
|
||||
func (n *Eval) GetPosition() *position.Position {
|
||||
return n.Position
|
||||
}
|
||||
|
||||
func (n *Eval) GetFreeFloating() *freefloating.Collection {
|
||||
return &n.FreeFloating
|
||||
}
|
||||
|
||||
// Attributes returns node attributes as map
|
||||
func (n *Eval) Attributes() map[string]interface{} {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Walk traverses nodes
|
||||
// Walk is invoked recursively until v.EnterNode returns true
|
||||
func (n *Eval) Walk(v walker.Visitor) {
|
||||
if v.EnterNode(n) == false {
|
||||
return
|
||||
}
|
||||
|
||||
if n.Expr != nil {
|
||||
v.EnterChildNode("Expr", n)
|
||||
n.Expr.Walk(v)
|
||||
v.LeaveChildNode("Expr", n)
|
||||
}
|
||||
|
||||
v.LeaveNode(n)
|
||||
}
|
@ -1,61 +0,0 @@
|
||||
package expr
|
||||
|
||||
import (
|
||||
"github.com/z7zmey/php-parser/freefloating"
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
"github.com/z7zmey/php-parser/position"
|
||||
"github.com/z7zmey/php-parser/walker"
|
||||
)
|
||||
|
||||
// Exit node
|
||||
type Exit struct {
|
||||
FreeFloating freefloating.Collection
|
||||
Die bool
|
||||
Position *position.Position
|
||||
Expr node.Node
|
||||
}
|
||||
|
||||
// NewExit node constructor
|
||||
func NewExit(Expr node.Node) *Exit {
|
||||
return &Exit{
|
||||
FreeFloating: nil,
|
||||
Expr: Expr,
|
||||
}
|
||||
}
|
||||
|
||||
// SetPosition sets node position
|
||||
func (n *Exit) SetPosition(p *position.Position) {
|
||||
n.Position = p
|
||||
}
|
||||
|
||||
// GetPosition returns node positions
|
||||
func (n *Exit) GetPosition() *position.Position {
|
||||
return n.Position
|
||||
}
|
||||
|
||||
func (n *Exit) GetFreeFloating() *freefloating.Collection {
|
||||
return &n.FreeFloating
|
||||
}
|
||||
|
||||
// Attributes returns node attributes as map
|
||||
func (n *Exit) Attributes() map[string]interface{} {
|
||||
return map[string]interface{}{
|
||||
"Die": n.Die,
|
||||
}
|
||||
}
|
||||
|
||||
// Walk traverses nodes
|
||||
// Walk is invoked recursively until v.EnterNode returns true
|
||||
func (n *Exit) Walk(v walker.Visitor) {
|
||||
if v.EnterNode(n) == false {
|
||||
return
|
||||
}
|
||||
|
||||
if n.Expr != nil {
|
||||
v.EnterChildNode("Expr", n)
|
||||
n.Expr.Walk(v)
|
||||
v.LeaveChildNode("Expr", n)
|
||||
}
|
||||
|
||||
v.LeaveNode(n)
|
||||
}
|
@ -1,66 +0,0 @@
|
||||
package expr
|
||||
|
||||
import (
|
||||
"github.com/z7zmey/php-parser/freefloating"
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
"github.com/z7zmey/php-parser/position"
|
||||
"github.com/z7zmey/php-parser/walker"
|
||||
)
|
||||
|
||||
// FunctionCall node
|
||||
type FunctionCall struct {
|
||||
FreeFloating freefloating.Collection
|
||||
Position *position.Position
|
||||
Function node.Node
|
||||
ArgumentList *node.ArgumentList
|
||||
}
|
||||
|
||||
// NewFunctionCall node constructor
|
||||
func NewFunctionCall(Function node.Node, ArgumentList *node.ArgumentList) *FunctionCall {
|
||||
return &FunctionCall{
|
||||
FreeFloating: nil,
|
||||
Function: Function,
|
||||
ArgumentList: ArgumentList,
|
||||
}
|
||||
}
|
||||
|
||||
// SetPosition sets node position
|
||||
func (n *FunctionCall) SetPosition(p *position.Position) {
|
||||
n.Position = p
|
||||
}
|
||||
|
||||
// GetPosition returns node positions
|
||||
func (n *FunctionCall) GetPosition() *position.Position {
|
||||
return n.Position
|
||||
}
|
||||
|
||||
func (n *FunctionCall) GetFreeFloating() *freefloating.Collection {
|
||||
return &n.FreeFloating
|
||||
}
|
||||
|
||||
// Attributes returns node attributes as map
|
||||
func (n *FunctionCall) Attributes() map[string]interface{} {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Walk traverses nodes
|
||||
// Walk is invoked recursively until v.EnterNode returns true
|
||||
func (n *FunctionCall) Walk(v walker.Visitor) {
|
||||
if v.EnterNode(n) == false {
|
||||
return
|
||||
}
|
||||
|
||||
if n.Function != nil {
|
||||
v.EnterChildNode("Function", n)
|
||||
n.Function.Walk(v)
|
||||
v.LeaveChildNode("Function", n)
|
||||
}
|
||||
|
||||
if n.ArgumentList != nil {
|
||||
v.EnterChildNode("ArgumentList", n)
|
||||
n.ArgumentList.Walk(v)
|
||||
v.LeaveChildNode("ArgumentList", n)
|
||||
}
|
||||
|
||||
v.LeaveNode(n)
|
||||
}
|
@ -1,58 +0,0 @@
|
||||
package expr
|
||||
|
||||
import (
|
||||
"github.com/z7zmey/php-parser/freefloating"
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
"github.com/z7zmey/php-parser/position"
|
||||
"github.com/z7zmey/php-parser/walker"
|
||||
)
|
||||
|
||||
// Include node
|
||||
type Include struct {
|
||||
FreeFloating freefloating.Collection
|
||||
Position *position.Position
|
||||
Expr node.Node
|
||||
}
|
||||
|
||||
// NewInclude node constructor
|
||||
func NewInclude(Expression node.Node) *Include {
|
||||
return &Include{
|
||||
FreeFloating: nil,
|
||||
Expr: Expression,
|
||||
}
|
||||
}
|
||||
|
||||
// SetPosition sets node position
|
||||
func (n *Include) SetPosition(p *position.Position) {
|
||||
n.Position = p
|
||||
}
|
||||
|
||||
// GetPosition returns node positions
|
||||
func (n *Include) GetPosition() *position.Position {
|
||||
return n.Position
|
||||
}
|
||||
|
||||
func (n *Include) GetFreeFloating() *freefloating.Collection {
|
||||
return &n.FreeFloating
|
||||
}
|
||||
|
||||
// Attributes returns node attributes as map
|
||||
func (n *Include) Attributes() map[string]interface{} {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Walk traverses nodes
|
||||
// Walk is invoked recursively until v.EnterNode returns true
|
||||
func (n *Include) Walk(v walker.Visitor) {
|
||||
if v.EnterNode(n) == false {
|
||||
return
|
||||
}
|
||||
|
||||
if n.Expr != nil {
|
||||
v.EnterChildNode("Expr", n)
|
||||
n.Expr.Walk(v)
|
||||
v.LeaveChildNode("Expr", n)
|
||||
}
|
||||
|
||||
v.LeaveNode(n)
|
||||
}
|
@ -1,58 +0,0 @@
|
||||
package expr
|
||||
|
||||
import (
|
||||
"github.com/z7zmey/php-parser/freefloating"
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
"github.com/z7zmey/php-parser/position"
|
||||
"github.com/z7zmey/php-parser/walker"
|
||||
)
|
||||
|
||||
// IncludeOnce node
|
||||
type IncludeOnce struct {
|
||||
FreeFloating freefloating.Collection
|
||||
Position *position.Position
|
||||
Expr node.Node
|
||||
}
|
||||
|
||||
// NewIncludeOnce node constructor
|
||||
func NewIncludeOnce(Expression node.Node) *IncludeOnce {
|
||||
return &IncludeOnce{
|
||||
FreeFloating: nil,
|
||||
Expr: Expression,
|
||||
}
|
||||
}
|
||||
|
||||
// SetPosition sets node position
|
||||
func (n *IncludeOnce) SetPosition(p *position.Position) {
|
||||
n.Position = p
|
||||
}
|
||||
|
||||
// GetPosition returns node positions
|
||||
func (n *IncludeOnce) GetPosition() *position.Position {
|
||||
return n.Position
|
||||
}
|
||||
|
||||
func (n *IncludeOnce) GetFreeFloating() *freefloating.Collection {
|
||||
return &n.FreeFloating
|
||||
}
|
||||
|
||||
// Attributes returns node attributes as map
|
||||
func (n *IncludeOnce) Attributes() map[string]interface{} {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Walk traverses nodes
|
||||
// Walk is invoked recursively until v.EnterNode returns true
|
||||
func (n *IncludeOnce) Walk(v walker.Visitor) {
|
||||
if v.EnterNode(n) == false {
|
||||
return
|
||||
}
|
||||
|
||||
if n.Expr != nil {
|
||||
v.EnterChildNode("Expr", n)
|
||||
n.Expr.Walk(v)
|
||||
v.LeaveChildNode("Expr", n)
|
||||
}
|
||||
|
||||
v.LeaveNode(n)
|
||||
}
|
@ -1,66 +0,0 @@
|
||||
package expr
|
||||
|
||||
import (
|
||||
"github.com/z7zmey/php-parser/freefloating"
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
"github.com/z7zmey/php-parser/position"
|
||||
"github.com/z7zmey/php-parser/walker"
|
||||
)
|
||||
|
||||
// InstanceOf node
|
||||
type InstanceOf struct {
|
||||
FreeFloating freefloating.Collection
|
||||
Position *position.Position
|
||||
Expr node.Node
|
||||
Class node.Node
|
||||
}
|
||||
|
||||
// NewInstanceOf node constructor
|
||||
func NewInstanceOf(Expr node.Node, Class node.Node) *InstanceOf {
|
||||
return &InstanceOf{
|
||||
FreeFloating: nil,
|
||||
Expr: Expr,
|
||||
Class: Class,
|
||||
}
|
||||
}
|
||||
|
||||
// SetPosition sets node position
|
||||
func (n *InstanceOf) SetPosition(p *position.Position) {
|
||||
n.Position = p
|
||||
}
|
||||
|
||||
// GetPosition returns node positions
|
||||
func (n *InstanceOf) GetPosition() *position.Position {
|
||||
return n.Position
|
||||
}
|
||||
|
||||
func (n *InstanceOf) GetFreeFloating() *freefloating.Collection {
|
||||
return &n.FreeFloating
|
||||
}
|
||||
|
||||
// Attributes returns node attributes as map
|
||||
func (n *InstanceOf) Attributes() map[string]interface{} {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Walk traverses nodes
|
||||
// Walk is invoked recursively until v.EnterNode returns true
|
||||
func (n *InstanceOf) Walk(v walker.Visitor) {
|
||||
if v.EnterNode(n) == false {
|
||||
return
|
||||
}
|
||||
|
||||
if n.Expr != nil {
|
||||
v.EnterChildNode("Expr", n)
|
||||
n.Expr.Walk(v)
|
||||
v.LeaveChildNode("Expr", n)
|
||||
}
|
||||
|
||||
if n.Class != nil {
|
||||
v.EnterChildNode("Class", n)
|
||||
n.Class.Walk(v)
|
||||
v.LeaveChildNode("Class", n)
|
||||
}
|
||||
|
||||
v.LeaveNode(n)
|
||||
}
|
@ -1,62 +0,0 @@
|
||||
package expr
|
||||
|
||||
import (
|
||||
"github.com/z7zmey/php-parser/freefloating"
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
"github.com/z7zmey/php-parser/position"
|
||||
"github.com/z7zmey/php-parser/walker"
|
||||
)
|
||||
|
||||
// Isset node
|
||||
type Isset struct {
|
||||
FreeFloating freefloating.Collection
|
||||
Position *position.Position
|
||||
Variables []node.Node
|
||||
}
|
||||
|
||||
// NewIsset node constructor
|
||||
func NewIsset(Variables []node.Node) *Isset {
|
||||
return &Isset{
|
||||
FreeFloating: nil,
|
||||
Variables: Variables,
|
||||
}
|
||||
}
|
||||
|
||||
// SetPosition sets node position
|
||||
func (n *Isset) SetPosition(p *position.Position) {
|
||||
n.Position = p
|
||||
}
|
||||
|
||||
// GetPosition returns node positions
|
||||
func (n *Isset) GetPosition() *position.Position {
|
||||
return n.Position
|
||||
}
|
||||
|
||||
func (n *Isset) GetFreeFloating() *freefloating.Collection {
|
||||
return &n.FreeFloating
|
||||
}
|
||||
|
||||
// Attributes returns node attributes as map
|
||||
func (n *Isset) Attributes() map[string]interface{} {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Walk traverses nodes
|
||||
// Walk is invoked recursively until v.EnterNode returns true
|
||||
func (n *Isset) Walk(v walker.Visitor) {
|
||||
if v.EnterNode(n) == false {
|
||||
return
|
||||
}
|
||||
|
||||
if n.Variables != nil {
|
||||
v.EnterChildList("Variables", n)
|
||||
for _, nn := range n.Variables {
|
||||
if nn != nil {
|
||||
nn.Walk(v)
|
||||
}
|
||||
}
|
||||
v.LeaveChildList("Variables", n)
|
||||
}
|
||||
|
||||
v.LeaveNode(n)
|
||||
}
|
@ -1,62 +0,0 @@
|
||||
package expr
|
||||
|
||||
import (
|
||||
"github.com/z7zmey/php-parser/freefloating"
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
"github.com/z7zmey/php-parser/position"
|
||||
"github.com/z7zmey/php-parser/walker"
|
||||
)
|
||||
|
||||
// List node
|
||||
type List struct {
|
||||
FreeFloating freefloating.Collection
|
||||
Position *position.Position
|
||||
Items []node.Node
|
||||
}
|
||||
|
||||
// NewList node constructor
|
||||
func NewList(Items []node.Node) *List {
|
||||
return &List{
|
||||
FreeFloating: nil,
|
||||
Items: Items,
|
||||
}
|
||||
}
|
||||
|
||||
// SetPosition sets node position
|
||||
func (n *List) SetPosition(p *position.Position) {
|
||||
n.Position = p
|
||||
}
|
||||
|
||||
// GetPosition returns node positions
|
||||
func (n *List) GetPosition() *position.Position {
|
||||
return n.Position
|
||||
}
|
||||
|
||||
func (n *List) GetFreeFloating() *freefloating.Collection {
|
||||
return &n.FreeFloating
|
||||
}
|
||||
|
||||
// Attributes returns node attributes as map
|
||||
func (n *List) Attributes() map[string]interface{} {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Walk traverses nodes
|
||||
// Walk is invoked recursively until v.EnterNode returns true
|
||||
func (n *List) Walk(v walker.Visitor) {
|
||||
if v.EnterNode(n) == false {
|
||||
return
|
||||
}
|
||||
|
||||
if n.Items != nil {
|
||||
v.EnterChildList("Items", n)
|
||||
for _, nn := range n.Items {
|
||||
if nn != nil {
|
||||
nn.Walk(v)
|
||||
}
|
||||
}
|
||||
v.LeaveChildList("Items", n)
|
||||
}
|
||||
|
||||
v.LeaveNode(n)
|
||||
}
|
@ -1,74 +0,0 @@
|
||||
package expr
|
||||
|
||||
import (
|
||||
"github.com/z7zmey/php-parser/freefloating"
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
"github.com/z7zmey/php-parser/position"
|
||||
"github.com/z7zmey/php-parser/walker"
|
||||
)
|
||||
|
||||
// MethodCall node
|
||||
type MethodCall struct {
|
||||
FreeFloating freefloating.Collection
|
||||
Position *position.Position
|
||||
Variable node.Node
|
||||
Method node.Node
|
||||
ArgumentList *node.ArgumentList
|
||||
}
|
||||
|
||||
// NewMethodCall node constructor
|
||||
func NewMethodCall(Variable node.Node, Method node.Node, ArgumentList *node.ArgumentList) *MethodCall {
|
||||
return &MethodCall{
|
||||
FreeFloating: nil,
|
||||
Variable: Variable,
|
||||
Method: Method,
|
||||
ArgumentList: ArgumentList,
|
||||
}
|
||||
}
|
||||
|
||||
// SetPosition sets node position
|
||||
func (n *MethodCall) SetPosition(p *position.Position) {
|
||||
n.Position = p
|
||||
}
|
||||
|
||||
// GetPosition returns node positions
|
||||
func (n *MethodCall) GetPosition() *position.Position {
|
||||
return n.Position
|
||||
}
|
||||
|
||||
func (n *MethodCall) GetFreeFloating() *freefloating.Collection {
|
||||
return &n.FreeFloating
|
||||
}
|
||||
|
||||
// Attributes returns node attributes as map
|
||||
func (n *MethodCall) Attributes() map[string]interface{} {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Walk traverses nodes
|
||||
// Walk is invoked recursively until v.EnterNode returns true
|
||||
func (n *MethodCall) Walk(v walker.Visitor) {
|
||||
if v.EnterNode(n) == false {
|
||||
return
|
||||
}
|
||||
|
||||
if n.Variable != nil {
|
||||
v.EnterChildNode("Variable", n)
|
||||
n.Variable.Walk(v)
|
||||
v.LeaveChildNode("Variable", n)
|
||||
}
|
||||
|
||||
if n.Method != nil {
|
||||
v.EnterChildNode("Method", n)
|
||||
n.Method.Walk(v)
|
||||
v.LeaveChildNode("Method", n)
|
||||
}
|
||||
|
||||
if n.ArgumentList != nil {
|
||||
v.EnterChildNode("ArgumentList", n)
|
||||
n.ArgumentList.Walk(v)
|
||||
v.LeaveChildNode("ArgumentList", n)
|
||||
}
|
||||
|
||||
v.LeaveNode(n)
|
||||
}
|
@ -1,66 +0,0 @@
|
||||
package expr
|
||||
|
||||
import (
|
||||
"github.com/z7zmey/php-parser/freefloating"
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
"github.com/z7zmey/php-parser/position"
|
||||
"github.com/z7zmey/php-parser/walker"
|
||||
)
|
||||
|
||||
// New node
|
||||
type New struct {
|
||||
FreeFloating freefloating.Collection
|
||||
Position *position.Position
|
||||
Class node.Node
|
||||
ArgumentList *node.ArgumentList
|
||||
}
|
||||
|
||||
// NewNew node constructor
|
||||
func NewNew(Class node.Node, ArgumentList *node.ArgumentList) *New {
|
||||
return &New{
|
||||
FreeFloating: nil,
|
||||
Class: Class,
|
||||
ArgumentList: ArgumentList,
|
||||
}
|
||||
}
|
||||
|
||||
// SetPosition sets node position
|
||||
func (n *New) SetPosition(p *position.Position) {
|
||||
n.Position = p
|
||||
}
|
||||
|
||||
// GetPosition returns node positions
|
||||
func (n *New) GetPosition() *position.Position {
|
||||
return n.Position
|
||||
}
|
||||
|
||||
func (n *New) GetFreeFloating() *freefloating.Collection {
|
||||
return &n.FreeFloating
|
||||
}
|
||||
|
||||
// Attributes returns node attributes as map
|
||||
func (n *New) Attributes() map[string]interface{} {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Walk traverses nodes
|
||||
// Walk is invoked recursively until v.EnterNode returns true
|
||||
func (n *New) Walk(v walker.Visitor) {
|
||||
if v.EnterNode(n) == false {
|
||||
return
|
||||
}
|
||||
|
||||
if n.Class != nil {
|
||||
v.EnterChildNode("Class", n)
|
||||
n.Class.Walk(v)
|
||||
v.LeaveChildNode("Class", n)
|
||||
}
|
||||
|
||||
if n.ArgumentList != nil {
|
||||
v.EnterChildNode("ArgumentList", n)
|
||||
n.ArgumentList.Walk(v)
|
||||
v.LeaveChildNode("ArgumentList", n)
|
||||
}
|
||||
|
||||
v.LeaveNode(n)
|
||||
}
|
@ -1,58 +0,0 @@
|
||||
package expr
|
||||
|
||||
import (
|
||||
"github.com/z7zmey/php-parser/freefloating"
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
"github.com/z7zmey/php-parser/position"
|
||||
"github.com/z7zmey/php-parser/walker"
|
||||
)
|
||||
|
||||
// PostDec node
|
||||
type PostDec struct {
|
||||
FreeFloating freefloating.Collection
|
||||
Position *position.Position
|
||||
Variable node.Node
|
||||
}
|
||||
|
||||
// NewPostDec node constructor
|
||||
func NewPostDec(Variable node.Node) *PostDec {
|
||||
return &PostDec{
|
||||
FreeFloating: nil,
|
||||
Variable: Variable,
|
||||
}
|
||||
}
|
||||
|
||||
// SetPosition sets node position
|
||||
func (n *PostDec) SetPosition(p *position.Position) {
|
||||
n.Position = p
|
||||
}
|
||||
|
||||
// GetPosition returns node positions
|
||||
func (n *PostDec) GetPosition() *position.Position {
|
||||
return n.Position
|
||||
}
|
||||
|
||||
func (n *PostDec) GetFreeFloating() *freefloating.Collection {
|
||||
return &n.FreeFloating
|
||||
}
|
||||
|
||||
// Attributes returns node attributes as map
|
||||
func (n *PostDec) Attributes() map[string]interface{} {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Walk traverses nodes
|
||||
// Walk is invoked recursively until v.EnterNode returns true
|
||||
func (n *PostDec) Walk(v walker.Visitor) {
|
||||
if v.EnterNode(n) == false {
|
||||
return
|
||||
}
|
||||
|
||||
if n.Variable != nil {
|
||||
v.EnterChildNode("Variable", n)
|
||||
n.Variable.Walk(v)
|
||||
v.LeaveChildNode("Variable", n)
|
||||
}
|
||||
|
||||
v.LeaveNode(n)
|
||||
}
|
@ -1,58 +0,0 @@
|
||||
package expr
|
||||
|
||||
import (
|
||||
"github.com/z7zmey/php-parser/freefloating"
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
"github.com/z7zmey/php-parser/position"
|
||||
"github.com/z7zmey/php-parser/walker"
|
||||
)
|
||||
|
||||
// PostInc node
|
||||
type PostInc struct {
|
||||
FreeFloating freefloating.Collection
|
||||
Position *position.Position
|
||||
Variable node.Node
|
||||
}
|
||||
|
||||
// NewPostInc node constructor
|
||||
func NewPostInc(Variable node.Node) *PostInc {
|
||||
return &PostInc{
|
||||
FreeFloating: nil,
|
||||
Variable: Variable,
|
||||
}
|
||||
}
|
||||
|
||||
// SetPosition sets node position
|
||||
func (n *PostInc) SetPosition(p *position.Position) {
|
||||
n.Position = p
|
||||
}
|
||||
|
||||
// GetPosition returns node positions
|
||||
func (n *PostInc) GetPosition() *position.Position {
|
||||
return n.Position
|
||||
}
|
||||
|
||||
func (n *PostInc) GetFreeFloating() *freefloating.Collection {
|
||||
return &n.FreeFloating
|
||||
}
|
||||
|
||||
// Attributes returns node attributes as map
|
||||
func (n *PostInc) Attributes() map[string]interface{} {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Walk traverses nodes
|
||||
// Walk is invoked recursively until v.EnterNode returns true
|
||||
func (n *PostInc) Walk(v walker.Visitor) {
|
||||
if v.EnterNode(n) == false {
|
||||
return
|
||||
}
|
||||
|
||||
if n.Variable != nil {
|
||||
v.EnterChildNode("Variable", n)
|
||||
n.Variable.Walk(v)
|
||||
v.LeaveChildNode("Variable", n)
|
||||
}
|
||||
|
||||
v.LeaveNode(n)
|
||||
}
|
@ -1,58 +0,0 @@
|
||||
package expr
|
||||
|
||||
import (
|
||||
"github.com/z7zmey/php-parser/freefloating"
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
"github.com/z7zmey/php-parser/position"
|
||||
"github.com/z7zmey/php-parser/walker"
|
||||
)
|
||||
|
||||
// PreDec node
|
||||
type PreDec struct {
|
||||
FreeFloating freefloating.Collection
|
||||
Position *position.Position
|
||||
Variable node.Node
|
||||
}
|
||||
|
||||
// NewPreDec node constructor
|
||||
func NewPreDec(Variable node.Node) *PreDec {
|
||||
return &PreDec{
|
||||
FreeFloating: nil,
|
||||
Variable: Variable,
|
||||
}
|
||||
}
|
||||
|
||||
// SetPosition sets node position
|
||||
func (n *PreDec) SetPosition(p *position.Position) {
|
||||
n.Position = p
|
||||
}
|
||||
|
||||
// GetPosition returns node positions
|
||||
func (n *PreDec) GetPosition() *position.Position {
|
||||
return n.Position
|
||||
}
|
||||
|
||||
func (n *PreDec) GetFreeFloating() *freefloating.Collection {
|
||||
return &n.FreeFloating
|
||||
}
|
||||
|
||||
// Attributes returns node attributes as map
|
||||
func (n *PreDec) Attributes() map[string]interface{} {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Walk traverses nodes
|
||||
// Walk is invoked recursively until v.EnterNode returns true
|
||||
func (n *PreDec) Walk(v walker.Visitor) {
|
||||
if v.EnterNode(n) == false {
|
||||
return
|
||||
}
|
||||
|
||||
if n.Variable != nil {
|
||||
v.EnterChildNode("Variable", n)
|
||||
n.Variable.Walk(v)
|
||||
v.LeaveChildNode("Variable", n)
|
||||
}
|
||||
|
||||
v.LeaveNode(n)
|
||||
}
|
@ -1,58 +0,0 @@
|
||||
package expr
|
||||
|
||||
import (
|
||||
"github.com/z7zmey/php-parser/freefloating"
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
"github.com/z7zmey/php-parser/position"
|
||||
"github.com/z7zmey/php-parser/walker"
|
||||
)
|
||||
|
||||
// PreInc node
|
||||
type PreInc struct {
|
||||
FreeFloating freefloating.Collection
|
||||
Position *position.Position
|
||||
Variable node.Node
|
||||
}
|
||||
|
||||
// NewPreInc node constructor
|
||||
func NewPreInc(Variable node.Node) *PreInc {
|
||||
return &PreInc{
|
||||
FreeFloating: nil,
|
||||
Variable: Variable,
|
||||
}
|
||||
}
|
||||
|
||||
// SetPosition sets node position
|
||||
func (n *PreInc) SetPosition(p *position.Position) {
|
||||
n.Position = p
|
||||
}
|
||||
|
||||
// GetPosition returns node positions
|
||||
func (n *PreInc) GetPosition() *position.Position {
|
||||
return n.Position
|
||||
}
|
||||
|
||||
func (n *PreInc) GetFreeFloating() *freefloating.Collection {
|
||||
return &n.FreeFloating
|
||||
}
|
||||
|
||||
// Attributes returns node attributes as map
|
||||
func (n *PreInc) Attributes() map[string]interface{} {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Walk traverses nodes
|
||||
// Walk is invoked recursively until v.EnterNode returns true
|
||||
func (n *PreInc) Walk(v walker.Visitor) {
|
||||
if v.EnterNode(n) == false {
|
||||
return
|
||||
}
|
||||
|
||||
if n.Variable != nil {
|
||||
v.EnterChildNode("Variable", n)
|
||||
n.Variable.Walk(v)
|
||||
v.LeaveChildNode("Variable", n)
|
||||
}
|
||||
|
||||
v.LeaveNode(n)
|
||||
}
|
@ -1,58 +0,0 @@
|
||||
package expr
|
||||
|
||||
import (
|
||||
"github.com/z7zmey/php-parser/freefloating"
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
"github.com/z7zmey/php-parser/position"
|
||||
"github.com/z7zmey/php-parser/walker"
|
||||
)
|
||||
|
||||
// Print node
|
||||
type Print struct {
|
||||
FreeFloating freefloating.Collection
|
||||
Position *position.Position
|
||||
Expr node.Node
|
||||
}
|
||||
|
||||
// NewPrint node constructor
|
||||
func NewPrint(Expression node.Node) *Print {
|
||||
return &Print{
|
||||
FreeFloating: nil,
|
||||
Expr: Expression,
|
||||
}
|
||||
}
|
||||
|
||||
// SetPosition sets node position
|
||||
func (n *Print) SetPosition(p *position.Position) {
|
||||
n.Position = p
|
||||
}
|
||||
|
||||
// GetPosition returns node positions
|
||||
func (n *Print) GetPosition() *position.Position {
|
||||
return n.Position
|
||||
}
|
||||
|
||||
func (n *Print) GetFreeFloating() *freefloating.Collection {
|
||||
return &n.FreeFloating
|
||||
}
|
||||
|
||||
// Attributes returns node attributes as map
|
||||
func (n *Print) Attributes() map[string]interface{} {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Walk traverses nodes
|
||||
// Walk is invoked recursively until v.EnterNode returns true
|
||||
func (n *Print) Walk(v walker.Visitor) {
|
||||
if v.EnterNode(n) == false {
|
||||
return
|
||||
}
|
||||
|
||||
if n.Expr != nil {
|
||||
v.EnterChildNode("Expr", n)
|
||||
n.Expr.Walk(v)
|
||||
v.LeaveChildNode("Expr", n)
|
||||
}
|
||||
|
||||
v.LeaveNode(n)
|
||||
}
|
@ -1,66 +0,0 @@
|
||||
package expr
|
||||
|
||||
import (
|
||||
"github.com/z7zmey/php-parser/freefloating"
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
"github.com/z7zmey/php-parser/position"
|
||||
"github.com/z7zmey/php-parser/walker"
|
||||
)
|
||||
|
||||
// PropertyFetch node
|
||||
type PropertyFetch struct {
|
||||
FreeFloating freefloating.Collection
|
||||
Position *position.Position
|
||||
Variable node.Node
|
||||
Property node.Node
|
||||
}
|
||||
|
||||
// NewPropertyFetch node constructor
|
||||
func NewPropertyFetch(Variable node.Node, Property node.Node) *PropertyFetch {
|
||||
return &PropertyFetch{
|
||||
FreeFloating: nil,
|
||||
Variable: Variable,
|
||||
Property: Property,
|
||||
}
|
||||
}
|
||||
|
||||
// SetPosition sets node position
|
||||
func (n *PropertyFetch) SetPosition(p *position.Position) {
|
||||
n.Position = p
|
||||
}
|
||||
|
||||
// GetPosition returns node positions
|
||||
func (n *PropertyFetch) GetPosition() *position.Position {
|
||||
return n.Position
|
||||
}
|
||||
|
||||
func (n *PropertyFetch) GetFreeFloating() *freefloating.Collection {
|
||||
return &n.FreeFloating
|
||||
}
|
||||
|
||||
// Attributes returns node attributes as map
|
||||
func (n *PropertyFetch) Attributes() map[string]interface{} {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Walk traverses nodes
|
||||
// Walk is invoked recursively until v.EnterNode returns true
|
||||
func (n *PropertyFetch) Walk(v walker.Visitor) {
|
||||
if v.EnterNode(n) == false {
|
||||
return
|
||||
}
|
||||
|
||||
if n.Variable != nil {
|
||||
v.EnterChildNode("Variable", n)
|
||||
n.Variable.Walk(v)
|
||||
v.LeaveChildNode("Variable", n)
|
||||
}
|
||||
|
||||
if n.Property != nil {
|
||||
v.EnterChildNode("Property", n)
|
||||
n.Property.Walk(v)
|
||||
v.LeaveChildNode("Property", n)
|
||||
}
|
||||
|
||||
v.LeaveNode(n)
|
||||
}
|
@ -1,58 +0,0 @@
|
||||
package expr
|
||||
|
||||
import (
|
||||
"github.com/z7zmey/php-parser/freefloating"
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
"github.com/z7zmey/php-parser/position"
|
||||
"github.com/z7zmey/php-parser/walker"
|
||||
)
|
||||
|
||||
// Reference node
|
||||
type Reference struct {
|
||||
FreeFloating freefloating.Collection
|
||||
Position *position.Position
|
||||
Variable node.Node
|
||||
}
|
||||
|
||||
// NewReference node constructor
|
||||
func NewReference(Variable node.Node) *Reference {
|
||||
return &Reference{
|
||||
FreeFloating: nil,
|
||||
Variable: Variable,
|
||||
}
|
||||
}
|
||||
|
||||
// SetPosition sets node position
|
||||
func (n *Reference) SetPosition(p *position.Position) {
|
||||
n.Position = p
|
||||
}
|
||||
|
||||
// GetPosition returns node positions
|
||||
func (n *Reference) GetPosition() *position.Position {
|
||||
return n.Position
|
||||
}
|
||||
|
||||
func (n *Reference) GetFreeFloating() *freefloating.Collection {
|
||||
return &n.FreeFloating
|
||||
}
|
||||
|
||||
// Attributes returns node attributes as map
|
||||
func (n *Reference) Attributes() map[string]interface{} {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Walk traverses nodes
|
||||
// Walk is invoked recursively until v.EnterNode returns true
|
||||
func (n *Reference) Walk(v walker.Visitor) {
|
||||
if v.EnterNode(n) == false {
|
||||
return
|
||||
}
|
||||
|
||||
if n.Variable != nil {
|
||||
v.EnterChildNode("Variable", n)
|
||||
n.Variable.Walk(v)
|
||||
v.LeaveChildNode("Variable", n)
|
||||
}
|
||||
|
||||
v.LeaveNode(n)
|
||||
}
|
@ -1,58 +0,0 @@
|
||||
package expr
|
||||
|
||||
import (
|
||||
"github.com/z7zmey/php-parser/freefloating"
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
"github.com/z7zmey/php-parser/position"
|
||||
"github.com/z7zmey/php-parser/walker"
|
||||
)
|
||||
|
||||
// Require node
|
||||
type Require struct {
|
||||
FreeFloating freefloating.Collection
|
||||
Position *position.Position
|
||||
Expr node.Node
|
||||
}
|
||||
|
||||
// NewRequire node constructor
|
||||
func NewRequire(Expression node.Node) *Require {
|
||||
return &Require{
|
||||
FreeFloating: nil,
|
||||
Expr: Expression,
|
||||
}
|
||||
}
|
||||
|
||||
// SetPosition sets node position
|
||||
func (n *Require) SetPosition(p *position.Position) {
|
||||
n.Position = p
|
||||
}
|
||||
|
||||
// GetPosition returns node positions
|
||||
func (n *Require) GetPosition() *position.Position {
|
||||
return n.Position
|
||||
}
|
||||
|
||||
func (n *Require) GetFreeFloating() *freefloating.Collection {
|
||||
return &n.FreeFloating
|
||||
}
|
||||
|
||||
// Attributes returns node attributes as map
|
||||
func (n *Require) Attributes() map[string]interface{} {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Walk traverses nodes
|
||||
// Walk is invoked recursively until v.EnterNode returns true
|
||||
func (n *Require) Walk(v walker.Visitor) {
|
||||
if v.EnterNode(n) == false {
|
||||
return
|
||||
}
|
||||
|
||||
if n.Expr != nil {
|
||||
v.EnterChildNode("Expr", n)
|
||||
n.Expr.Walk(v)
|
||||
v.LeaveChildNode("Expr", n)
|
||||
}
|
||||
|
||||
v.LeaveNode(n)
|
||||
}
|
@ -1,58 +0,0 @@
|
||||
package expr
|
||||
|
||||
import (
|
||||
"github.com/z7zmey/php-parser/freefloating"
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
"github.com/z7zmey/php-parser/position"
|
||||
"github.com/z7zmey/php-parser/walker"
|
||||
)
|
||||
|
||||
// RequireOnce node
|
||||
type RequireOnce struct {
|
||||
FreeFloating freefloating.Collection
|
||||
Position *position.Position
|
||||
Expr node.Node
|
||||
}
|
||||
|
||||
// NewRequireOnce node constructor
|
||||
func NewRequireOnce(Expression node.Node) *RequireOnce {
|
||||
return &RequireOnce{
|
||||
FreeFloating: nil,
|
||||
Expr: Expression,
|
||||
}
|
||||
}
|
||||
|
||||
// SetPosition sets node position
|
||||
func (n *RequireOnce) SetPosition(p *position.Position) {
|
||||
n.Position = p
|
||||
}
|
||||
|
||||
// GetPosition returns node positions
|
||||
func (n *RequireOnce) GetPosition() *position.Position {
|
||||
return n.Position
|
||||
}
|
||||
|
||||
func (n *RequireOnce) GetFreeFloating() *freefloating.Collection {
|
||||
return &n.FreeFloating
|
||||
}
|
||||
|
||||
// Attributes returns node attributes as map
|
||||
func (n *RequireOnce) Attributes() map[string]interface{} {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Walk traverses nodes
|
||||
// Walk is invoked recursively until v.EnterNode returns true
|
||||
func (n *RequireOnce) Walk(v walker.Visitor) {
|
||||
if v.EnterNode(n) == false {
|
||||
return
|
||||
}
|
||||
|
||||
if n.Expr != nil {
|
||||
v.EnterChildNode("Expr", n)
|
||||
n.Expr.Walk(v)
|
||||
v.LeaveChildNode("Expr", n)
|
||||
}
|
||||
|
||||
v.LeaveNode(n)
|
||||
}
|
@ -1,62 +0,0 @@
|
||||
package expr
|
||||
|
||||
import (
|
||||
"github.com/z7zmey/php-parser/freefloating"
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
"github.com/z7zmey/php-parser/position"
|
||||
"github.com/z7zmey/php-parser/walker"
|
||||
)
|
||||
|
||||
// ShellExec node
|
||||
type ShellExec struct {
|
||||
FreeFloating freefloating.Collection
|
||||
Position *position.Position
|
||||
Parts []node.Node
|
||||
}
|
||||
|
||||
// NewShellExec node constructor
|
||||
func NewShellExec(Parts []node.Node) *ShellExec {
|
||||
return &ShellExec{
|
||||
FreeFloating: nil,
|
||||
Parts: Parts,
|
||||
}
|
||||
}
|
||||
|
||||
// SetPosition sets node position
|
||||
func (n *ShellExec) SetPosition(p *position.Position) {
|
||||
n.Position = p
|
||||
}
|
||||
|
||||
// GetPosition returns node positions
|
||||
func (n *ShellExec) GetPosition() *position.Position {
|
||||
return n.Position
|
||||
}
|
||||
|
||||
func (n *ShellExec) GetFreeFloating() *freefloating.Collection {
|
||||
return &n.FreeFloating
|
||||
}
|
||||
|
||||
// Attributes returns node attributes as map
|
||||
func (n *ShellExec) Attributes() map[string]interface{} {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Walk traverses nodes
|
||||
// Walk is invoked recursively until v.EnterNode returns true
|
||||
func (n *ShellExec) Walk(v walker.Visitor) {
|
||||
if v.EnterNode(n) == false {
|
||||
return
|
||||
}
|
||||
|
||||
if n.Parts != nil {
|
||||
v.EnterChildList("Parts", n)
|
||||
for _, nn := range n.Parts {
|
||||
if nn != nil {
|
||||
nn.Walk(v)
|
||||
}
|
||||
}
|
||||
v.LeaveChildList("Parts", n)
|
||||
}
|
||||
|
||||
v.LeaveNode(n)
|
||||
}
|
@ -1,62 +0,0 @@
|
||||
package expr
|
||||
|
||||
import (
|
||||
"github.com/z7zmey/php-parser/freefloating"
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
"github.com/z7zmey/php-parser/position"
|
||||
"github.com/z7zmey/php-parser/walker"
|
||||
)
|
||||
|
||||
// ShortArray node
|
||||
type ShortArray struct {
|
||||
FreeFloating freefloating.Collection
|
||||
Position *position.Position
|
||||
Items []node.Node
|
||||
}
|
||||
|
||||
// NewShortArray node constructor
|
||||
func NewShortArray(Items []node.Node) *ShortArray {
|
||||
return &ShortArray{
|
||||
FreeFloating: nil,
|
||||
Items: Items,
|
||||
}
|
||||
}
|
||||
|
||||
// SetPosition sets node position
|
||||
func (n *ShortArray) SetPosition(p *position.Position) {
|
||||
n.Position = p
|
||||
}
|
||||
|
||||
// GetPosition returns node positions
|
||||
func (n *ShortArray) GetPosition() *position.Position {
|
||||
return n.Position
|
||||
}
|
||||
|
||||
func (n *ShortArray) GetFreeFloating() *freefloating.Collection {
|
||||
return &n.FreeFloating
|
||||
}
|
||||
|
||||
// Attributes returns node attributes as map
|
||||
func (n *ShortArray) Attributes() map[string]interface{} {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Walk traverses nodes
|
||||
// Walk is invoked recursively until v.EnterNode returns true
|
||||
func (n *ShortArray) Walk(v walker.Visitor) {
|
||||
if v.EnterNode(n) == false {
|
||||
return
|
||||
}
|
||||
|
||||
if n.Items != nil {
|
||||
v.EnterChildList("Items", n)
|
||||
for _, nn := range n.Items {
|
||||
if nn != nil {
|
||||
nn.Walk(v)
|
||||
}
|
||||
}
|
||||
v.LeaveChildList("Items", n)
|
||||
}
|
||||
|
||||
v.LeaveNode(n)
|
||||
}
|
@ -1,62 +0,0 @@
|
||||
package expr
|
||||
|
||||
import (
|
||||
"github.com/z7zmey/php-parser/freefloating"
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
"github.com/z7zmey/php-parser/position"
|
||||
"github.com/z7zmey/php-parser/walker"
|
||||
)
|
||||
|
||||
// ShortList node
|
||||
type ShortList struct {
|
||||
FreeFloating freefloating.Collection
|
||||
Position *position.Position
|
||||
Items []node.Node
|
||||
}
|
||||
|
||||
// NewShortList node constructor
|
||||
func NewShortList(Items []node.Node) *ShortList {
|
||||
return &ShortList{
|
||||
FreeFloating: nil,
|
||||
Items: Items,
|
||||
}
|
||||
}
|
||||
|
||||
// SetPosition sets node position
|
||||
func (n *ShortList) SetPosition(p *position.Position) {
|
||||
n.Position = p
|
||||
}
|
||||
|
||||
// GetPosition returns node positions
|
||||
func (n *ShortList) GetPosition() *position.Position {
|
||||
return n.Position
|
||||
}
|
||||
|
||||
func (n *ShortList) GetFreeFloating() *freefloating.Collection {
|
||||
return &n.FreeFloating
|
||||
}
|
||||
|
||||
// Attributes returns node attributes as map
|
||||
func (n *ShortList) Attributes() map[string]interface{} {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Walk traverses nodes
|
||||
// Walk is invoked recursively until v.EnterNode returns true
|
||||
func (n *ShortList) Walk(v walker.Visitor) {
|
||||
if v.EnterNode(n) == false {
|
||||
return
|
||||
}
|
||||
|
||||
if n.Items != nil {
|
||||
v.EnterChildList("Items", n)
|
||||
for _, nn := range n.Items {
|
||||
if nn != nil {
|
||||
nn.Walk(v)
|
||||
}
|
||||
}
|
||||
v.LeaveChildList("Items", n)
|
||||
}
|
||||
|
||||
v.LeaveNode(n)
|
||||
}
|
@ -1,74 +0,0 @@
|
||||
package expr
|
||||
|
||||
import (
|
||||
"github.com/z7zmey/php-parser/freefloating"
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
"github.com/z7zmey/php-parser/position"
|
||||
"github.com/z7zmey/php-parser/walker"
|
||||
)
|
||||
|
||||
// StaticCall node
|
||||
type StaticCall struct {
|
||||
FreeFloating freefloating.Collection
|
||||
Position *position.Position
|
||||
Class node.Node
|
||||
Call node.Node
|
||||
ArgumentList *node.ArgumentList
|
||||
}
|
||||
|
||||
// NewStaticCall node constructor
|
||||
func NewStaticCall(Class node.Node, Call node.Node, ArgumentList *node.ArgumentList) *StaticCall {
|
||||
return &StaticCall{
|
||||
FreeFloating: nil,
|
||||
Class: Class,
|
||||
Call: Call,
|
||||
ArgumentList: ArgumentList,
|
||||
}
|
||||
}
|
||||
|
||||
// SetPosition sets node position
|
||||
func (n *StaticCall) SetPosition(p *position.Position) {
|
||||
n.Position = p
|
||||
}
|
||||
|
||||
// GetPosition returns node positions
|
||||
func (n *StaticCall) GetPosition() *position.Position {
|
||||
return n.Position
|
||||
}
|
||||
|
||||
func (n *StaticCall) GetFreeFloating() *freefloating.Collection {
|
||||
return &n.FreeFloating
|
||||
}
|
||||
|
||||
// Attributes returns node attributes as map
|
||||
func (n *StaticCall) Attributes() map[string]interface{} {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Walk traverses nodes
|
||||
// Walk is invoked recursively until v.EnterNode returns true
|
||||
func (n *StaticCall) Walk(v walker.Visitor) {
|
||||
if v.EnterNode(n) == false {
|
||||
return
|
||||
}
|
||||
|
||||
if n.Class != nil {
|
||||
v.EnterChildNode("Class", n)
|
||||
n.Class.Walk(v)
|
||||
v.LeaveChildNode("Class", n)
|
||||
}
|
||||
|
||||
if n.Call != nil {
|
||||
v.EnterChildNode("Call", n)
|
||||
n.Call.Walk(v)
|
||||
v.LeaveChildNode("Call", n)
|
||||
}
|
||||
|
||||
if n.ArgumentList != nil {
|
||||
v.EnterChildNode("ArgumentList", n)
|
||||
n.ArgumentList.Walk(v)
|
||||
v.LeaveChildNode("ArgumentList", n)
|
||||
}
|
||||
|
||||
v.LeaveNode(n)
|
||||
}
|
@ -1,66 +0,0 @@
|
||||
package expr
|
||||
|
||||
import (
|
||||
"github.com/z7zmey/php-parser/freefloating"
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
"github.com/z7zmey/php-parser/position"
|
||||
"github.com/z7zmey/php-parser/walker"
|
||||
)
|
||||
|
||||
// StaticPropertyFetch node
|
||||
type StaticPropertyFetch struct {
|
||||
FreeFloating freefloating.Collection
|
||||
Position *position.Position
|
||||
Class node.Node
|
||||
Property node.Node
|
||||
}
|
||||
|
||||
// NewStaticPropertyFetch node constructor
|
||||
func NewStaticPropertyFetch(Class node.Node, Property node.Node) *StaticPropertyFetch {
|
||||
return &StaticPropertyFetch{
|
||||
FreeFloating: nil,
|
||||
Class: Class,
|
||||
Property: Property,
|
||||
}
|
||||
}
|
||||
|
||||
// SetPosition sets node position
|
||||
func (n *StaticPropertyFetch) SetPosition(p *position.Position) {
|
||||
n.Position = p
|
||||
}
|
||||
|
||||
// GetPosition returns node positions
|
||||
func (n *StaticPropertyFetch) GetPosition() *position.Position {
|
||||
return n.Position
|
||||
}
|
||||
|
||||
func (n *StaticPropertyFetch) GetFreeFloating() *freefloating.Collection {
|
||||
return &n.FreeFloating
|
||||
}
|
||||
|
||||
// Attributes returns node attributes as map
|
||||
func (n *StaticPropertyFetch) Attributes() map[string]interface{} {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Walk traverses nodes
|
||||
// Walk is invoked recursively until v.EnterNode returns true
|
||||
func (n *StaticPropertyFetch) Walk(v walker.Visitor) {
|
||||
if v.EnterNode(n) == false {
|
||||
return
|
||||
}
|
||||
|
||||
if n.Class != nil {
|
||||
v.EnterChildNode("Class", n)
|
||||
n.Class.Walk(v)
|
||||
v.LeaveChildNode("Class", n)
|
||||
}
|
||||
|
||||
if n.Property != nil {
|
||||
v.EnterChildNode("Property", n)
|
||||
n.Property.Walk(v)
|
||||
v.LeaveChildNode("Property", n)
|
||||
}
|
||||
|
||||
v.LeaveNode(n)
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user