#25: save position within node
This commit is contained in:
@@ -2,11 +2,13 @@ package assign
|
||||
|
||||
import (
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
"github.com/z7zmey/php-parser/position"
|
||||
"github.com/z7zmey/php-parser/walker"
|
||||
)
|
||||
|
||||
// Assign node
|
||||
type Assign struct {
|
||||
Position *position.Position
|
||||
Variable node.Node
|
||||
Expression node.Node
|
||||
}
|
||||
@@ -14,11 +16,21 @@ type Assign struct {
|
||||
// NewAssign node constructor
|
||||
func NewAssign(Variable node.Node, Expression node.Node) *Assign {
|
||||
return &Assign{
|
||||
Variable,
|
||||
Expression,
|
||||
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
|
||||
}
|
||||
|
||||
// Attributes returns node attributes as map
|
||||
func (n *Assign) Attributes() map[string]interface{} {
|
||||
return nil
|
||||
|
||||
@@ -2,11 +2,13 @@ package assign
|
||||
|
||||
import (
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
"github.com/z7zmey/php-parser/position"
|
||||
"github.com/z7zmey/php-parser/walker"
|
||||
)
|
||||
|
||||
// Reference node
|
||||
type Reference struct {
|
||||
Position *position.Position
|
||||
Variable node.Node
|
||||
Expression node.Node
|
||||
}
|
||||
@@ -14,11 +16,21 @@ type Reference struct {
|
||||
// NewReference node constructor
|
||||
func NewReference(Variable node.Node, Expression node.Node) *Reference {
|
||||
return &Reference{
|
||||
Variable,
|
||||
Expression,
|
||||
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
|
||||
}
|
||||
|
||||
// Attributes returns node attributes as map
|
||||
func (n *Reference) Attributes() map[string]interface{} {
|
||||
return nil
|
||||
|
||||
@@ -2,11 +2,13 @@ package assign
|
||||
|
||||
import (
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
"github.com/z7zmey/php-parser/position"
|
||||
"github.com/z7zmey/php-parser/walker"
|
||||
)
|
||||
|
||||
// BitwiseAnd node
|
||||
type BitwiseAnd struct {
|
||||
Position *position.Position
|
||||
Variable node.Node
|
||||
Expression node.Node
|
||||
}
|
||||
@@ -14,11 +16,21 @@ type BitwiseAnd struct {
|
||||
// NewBitwiseAnd node constructor
|
||||
func NewBitwiseAnd(Variable node.Node, Expression node.Node) *BitwiseAnd {
|
||||
return &BitwiseAnd{
|
||||
Variable,
|
||||
Expression,
|
||||
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
|
||||
}
|
||||
|
||||
// Attributes returns node attributes as map
|
||||
func (n *BitwiseAnd) Attributes() map[string]interface{} {
|
||||
return nil
|
||||
|
||||
@@ -2,11 +2,13 @@ package assign
|
||||
|
||||
import (
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
"github.com/z7zmey/php-parser/position"
|
||||
"github.com/z7zmey/php-parser/walker"
|
||||
)
|
||||
|
||||
// BitwiseOr node
|
||||
type BitwiseOr struct {
|
||||
Position *position.Position
|
||||
Variable node.Node
|
||||
Expression node.Node
|
||||
}
|
||||
@@ -14,11 +16,21 @@ type BitwiseOr struct {
|
||||
// NewBitwiseOr node constructor
|
||||
func NewBitwiseOr(Variable node.Node, Expression node.Node) *BitwiseOr {
|
||||
return &BitwiseOr{
|
||||
Variable,
|
||||
Expression,
|
||||
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
|
||||
}
|
||||
|
||||
// Attributes returns node attributes as map
|
||||
func (n *BitwiseOr) Attributes() map[string]interface{} {
|
||||
return nil
|
||||
|
||||
@@ -2,11 +2,13 @@ package assign
|
||||
|
||||
import (
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
"github.com/z7zmey/php-parser/position"
|
||||
"github.com/z7zmey/php-parser/walker"
|
||||
)
|
||||
|
||||
// BitwiseXor node
|
||||
type BitwiseXor struct {
|
||||
Position *position.Position
|
||||
Variable node.Node
|
||||
Expression node.Node
|
||||
}
|
||||
@@ -14,11 +16,21 @@ type BitwiseXor struct {
|
||||
// NewBitwiseXor node constructor
|
||||
func NewBitwiseXor(Variable node.Node, Expression node.Node) *BitwiseXor {
|
||||
return &BitwiseXor{
|
||||
Variable,
|
||||
Expression,
|
||||
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
|
||||
}
|
||||
|
||||
// Attributes returns node attributes as map
|
||||
func (n *BitwiseXor) Attributes() map[string]interface{} {
|
||||
return nil
|
||||
|
||||
@@ -2,11 +2,13 @@ package assign
|
||||
|
||||
import (
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
"github.com/z7zmey/php-parser/position"
|
||||
"github.com/z7zmey/php-parser/walker"
|
||||
)
|
||||
|
||||
// Concat node
|
||||
type Concat struct {
|
||||
Position *position.Position
|
||||
Variable node.Node
|
||||
Expression node.Node
|
||||
}
|
||||
@@ -14,11 +16,21 @@ type Concat struct {
|
||||
// NewConcat node constructor
|
||||
func NewConcat(Variable node.Node, Expression node.Node) *Concat {
|
||||
return &Concat{
|
||||
Variable,
|
||||
Expression,
|
||||
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
|
||||
}
|
||||
|
||||
// Attributes returns node attributes as map
|
||||
func (n *Concat) Attributes() map[string]interface{} {
|
||||
return nil
|
||||
|
||||
@@ -2,11 +2,13 @@ package assign
|
||||
|
||||
import (
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
"github.com/z7zmey/php-parser/position"
|
||||
"github.com/z7zmey/php-parser/walker"
|
||||
)
|
||||
|
||||
// Div node
|
||||
type Div struct {
|
||||
Position *position.Position
|
||||
Variable node.Node
|
||||
Expression node.Node
|
||||
}
|
||||
@@ -14,11 +16,21 @@ type Div struct {
|
||||
// NewDiv node constructor
|
||||
func NewDiv(Variable node.Node, Expression node.Node) *Div {
|
||||
return &Div{
|
||||
Variable,
|
||||
Expression,
|
||||
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
|
||||
}
|
||||
|
||||
// Attributes returns node attributes as map
|
||||
func (n *Div) Attributes() map[string]interface{} {
|
||||
return nil
|
||||
|
||||
@@ -2,11 +2,13 @@ package assign
|
||||
|
||||
import (
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
"github.com/z7zmey/php-parser/position"
|
||||
"github.com/z7zmey/php-parser/walker"
|
||||
)
|
||||
|
||||
// Minus node
|
||||
type Minus struct {
|
||||
Position *position.Position
|
||||
Variable node.Node
|
||||
Expression node.Node
|
||||
}
|
||||
@@ -14,11 +16,21 @@ type Minus struct {
|
||||
// NewMinus node constructor
|
||||
func NewMinus(Variable node.Node, Expression node.Node) *Minus {
|
||||
return &Minus{
|
||||
Variable,
|
||||
Expression,
|
||||
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
|
||||
}
|
||||
|
||||
// Attributes returns node attributes as map
|
||||
func (n *Minus) Attributes() map[string]interface{} {
|
||||
return nil
|
||||
|
||||
@@ -2,11 +2,13 @@ package assign
|
||||
|
||||
import (
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
"github.com/z7zmey/php-parser/position"
|
||||
"github.com/z7zmey/php-parser/walker"
|
||||
)
|
||||
|
||||
// Mod node
|
||||
type Mod struct {
|
||||
Position *position.Position
|
||||
Variable node.Node
|
||||
Expression node.Node
|
||||
}
|
||||
@@ -14,11 +16,21 @@ type Mod struct {
|
||||
// NewMod node constructor
|
||||
func NewMod(Variable node.Node, Expression node.Node) *Mod {
|
||||
return &Mod{
|
||||
Variable,
|
||||
Expression,
|
||||
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
|
||||
}
|
||||
|
||||
// Attributes returns node attributes as map
|
||||
func (n *Mod) Attributes() map[string]interface{} {
|
||||
return nil
|
||||
|
||||
@@ -2,11 +2,13 @@ package assign
|
||||
|
||||
import (
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
"github.com/z7zmey/php-parser/position"
|
||||
"github.com/z7zmey/php-parser/walker"
|
||||
)
|
||||
|
||||
// Mul node
|
||||
type Mul struct {
|
||||
Position *position.Position
|
||||
Variable node.Node
|
||||
Expression node.Node
|
||||
}
|
||||
@@ -14,11 +16,21 @@ type Mul struct {
|
||||
// NewMul node constructor
|
||||
func NewMul(Variable node.Node, Expression node.Node) *Mul {
|
||||
return &Mul{
|
||||
Variable,
|
||||
Expression,
|
||||
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
|
||||
}
|
||||
|
||||
// Attributes returns node attributes as map
|
||||
func (n *Mul) Attributes() map[string]interface{} {
|
||||
return nil
|
||||
|
||||
@@ -2,11 +2,13 @@ package assign
|
||||
|
||||
import (
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
"github.com/z7zmey/php-parser/position"
|
||||
"github.com/z7zmey/php-parser/walker"
|
||||
)
|
||||
|
||||
// Plus node
|
||||
type Plus struct {
|
||||
Position *position.Position
|
||||
Variable node.Node
|
||||
Expression node.Node
|
||||
}
|
||||
@@ -14,11 +16,21 @@ type Plus struct {
|
||||
// NewPlus node constructor
|
||||
func NewPlus(Variable node.Node, Expression node.Node) *Plus {
|
||||
return &Plus{
|
||||
Variable,
|
||||
Expression,
|
||||
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
|
||||
}
|
||||
|
||||
// Attributes returns node attributes as map
|
||||
func (n *Plus) Attributes() map[string]interface{} {
|
||||
return nil
|
||||
|
||||
@@ -2,11 +2,13 @@ package assign
|
||||
|
||||
import (
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
"github.com/z7zmey/php-parser/position"
|
||||
"github.com/z7zmey/php-parser/walker"
|
||||
)
|
||||
|
||||
// Pow node
|
||||
type Pow struct {
|
||||
Position *position.Position
|
||||
Variable node.Node
|
||||
Expression node.Node
|
||||
}
|
||||
@@ -14,11 +16,21 @@ type Pow struct {
|
||||
// NewPow node constructor
|
||||
func NewPow(Variable node.Node, Expression node.Node) *Pow {
|
||||
return &Pow{
|
||||
Variable,
|
||||
Expression,
|
||||
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
|
||||
}
|
||||
|
||||
// Attributes returns node attributes as map
|
||||
func (n *Pow) Attributes() map[string]interface{} {
|
||||
return nil
|
||||
|
||||
@@ -2,11 +2,13 @@ package assign
|
||||
|
||||
import (
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
"github.com/z7zmey/php-parser/position"
|
||||
"github.com/z7zmey/php-parser/walker"
|
||||
)
|
||||
|
||||
// ShiftLeft node
|
||||
type ShiftLeft struct {
|
||||
Position *position.Position
|
||||
Variable node.Node
|
||||
Expression node.Node
|
||||
}
|
||||
@@ -14,11 +16,21 @@ type ShiftLeft struct {
|
||||
// NewShiftLeft node constructor
|
||||
func NewShiftLeft(Variable node.Node, Expression node.Node) *ShiftLeft {
|
||||
return &ShiftLeft{
|
||||
Variable,
|
||||
Expression,
|
||||
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
|
||||
}
|
||||
|
||||
// Attributes returns node attributes as map
|
||||
func (n *ShiftLeft) Attributes() map[string]interface{} {
|
||||
return nil
|
||||
|
||||
@@ -2,11 +2,13 @@ package assign
|
||||
|
||||
import (
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
"github.com/z7zmey/php-parser/position"
|
||||
"github.com/z7zmey/php-parser/walker"
|
||||
)
|
||||
|
||||
// ShiftRight node
|
||||
type ShiftRight struct {
|
||||
Position *position.Position
|
||||
Variable node.Node
|
||||
Expression node.Node
|
||||
}
|
||||
@@ -14,11 +16,21 @@ type ShiftRight struct {
|
||||
// NewShiftRight node constructor
|
||||
func NewShiftRight(Variable node.Node, Expression node.Node) *ShiftRight {
|
||||
return &ShiftRight{
|
||||
Variable,
|
||||
Expression,
|
||||
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
|
||||
}
|
||||
|
||||
// Attributes returns node attributes as map
|
||||
func (n *ShiftRight) Attributes() map[string]interface{} {
|
||||
return nil
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user