#25: save position within node
This commit is contained in:
		
							parent
							
								
									6ac67675d5
								
							
						
					
					
						commit
						1ebb0c6fad
					
				| @ -17,7 +17,12 @@ type Error struct { | ||||
| func NewError(msg string, t *scanner.Token) *Error { | ||||
| 	return &Error{ | ||||
| 		Msg: msg, | ||||
| 		Pos: t.Position, | ||||
| 		Pos: &position.Position{ | ||||
| 			StartLine: t.StartLine, | ||||
| 			EndLine:   t.EndLine, | ||||
| 			StartPos:  t.StartPos, | ||||
| 			EndPos:    t.EndPos, | ||||
| 		}, | ||||
| 	} | ||||
| } | ||||
| 
 | ||||
|  | ||||
| @ -28,8 +28,11 @@ func assertEqual(t *testing.T, expected interface{}, actual interface{}) { | ||||
| func TestConstructor(t *testing.T) { | ||||
| 	pos := position.NewPosition(1, 2, 3, 4) | ||||
| 	token := &scanner.Token{ | ||||
| 		Value:    `test`, | ||||
| 		Position: pos, | ||||
| 		Value:     `test`, | ||||
| 		StartLine: 1, | ||||
| 		EndLine:   2, | ||||
| 		StartPos:  3, | ||||
| 		EndPos:    4, | ||||
| 	} | ||||
| 
 | ||||
| 	actual := errors.NewError("message", token) | ||||
| @ -43,10 +46,12 @@ func TestConstructor(t *testing.T) { | ||||
| } | ||||
| 
 | ||||
| func TestPrint(t *testing.T) { | ||||
| 	pos := position.NewPosition(1, 2, 3, 4) | ||||
| 	token := &scanner.Token{ | ||||
| 		Value:    `test`, | ||||
| 		Position: pos, | ||||
| 		Value:     `test`, | ||||
| 		StartLine: 1, | ||||
| 		EndLine:   2, | ||||
| 		StartPos:  3, | ||||
| 		EndPos:    4, | ||||
| 	} | ||||
| 
 | ||||
| 	Error := errors.NewError("message", token) | ||||
|  | ||||
							
								
								
									
										10
									
								
								main.go
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								main.go
									
									
									
									
									
								
							| @ -21,13 +21,11 @@ var wg sync.WaitGroup | ||||
| var usePhp5 *bool | ||||
| var dumpType string | ||||
| var profiler string | ||||
| var showPositions *bool | ||||
| var showComments *bool | ||||
| var showResolvedNs *bool | ||||
| 
 | ||||
| func main() { | ||||
| 	usePhp5 = flag.Bool("php5", false, "parse as PHP5") | ||||
| 	showPositions = flag.Bool("p", false, "show positions") | ||||
| 	showComments = flag.Bool("c", false, "show comments") | ||||
| 	showResolvedNs = flag.Bool("r", false, "resolve names") | ||||
| 	flag.StringVar(&dumpType, "d", "", "dump format: [custom, go, json, pretty_json]") | ||||
| @ -145,18 +143,12 @@ func printer(result <-chan parser.Parser) { | ||||
| 			comments = parserWorker.GetComments() | ||||
| 		} | ||||
| 
 | ||||
| 		var positions parser.Positions | ||||
| 		if *showPositions { | ||||
| 			positions = parserWorker.GetPositions() | ||||
| 		} | ||||
| 
 | ||||
| 		switch dumpType { | ||||
| 		case "custom": | ||||
| 			dumper := &visitor.Dumper{ | ||||
| 				Writer:     os.Stdout, | ||||
| 				Indent:     "| ", | ||||
| 				Comments:   comments, | ||||
| 				Positions:  positions, | ||||
| 				NsResolver: nsResolver, | ||||
| 			} | ||||
| 			parserWorker.GetRootNode().Walk(dumper) | ||||
| @ -164,7 +156,6 @@ func printer(result <-chan parser.Parser) { | ||||
| 			dumper := &visitor.JsonDumper{ | ||||
| 				Writer:     os.Stdout, | ||||
| 				Comments:   comments, | ||||
| 				Positions:  positions, | ||||
| 				NsResolver: nsResolver, | ||||
| 			} | ||||
| 			parserWorker.GetRootNode().Walk(dumper) | ||||
| @ -172,7 +163,6 @@ func printer(result <-chan parser.Parser) { | ||||
| 			dumper := &visitor.PrettyJsonDumper{ | ||||
| 				Writer:     os.Stdout, | ||||
| 				Comments:   comments, | ||||
| 				Positions:  positions, | ||||
| 				NsResolver: nsResolver, | ||||
| 			} | ||||
| 			parserWorker.GetRootNode().Walk(dumper) | ||||
|  | ||||
| @ -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
											
										
									
								
							| @ -2,23 +2,35 @@ package binary | ||||
| 
 | ||||
| import ( | ||||
| 	"github.com/z7zmey/php-parser/node" | ||||
| 	"github.com/z7zmey/php-parser/position" | ||||
| 	"github.com/z7zmey/php-parser/walker" | ||||
| ) | ||||
| 
 | ||||
| // BitwiseAnd node | ||||
| type BitwiseAnd struct { | ||||
| 	Left  node.Node | ||||
| 	Right node.Node | ||||
| 	Position *position.Position | ||||
| 	Left     node.Node | ||||
| 	Right    node.Node | ||||
| } | ||||
| 
 | ||||
| // NewBitwiseAnd node constructor | ||||
| func NewBitwiseAnd(Variable node.Node, Expression node.Node) *BitwiseAnd { | ||||
| 	return &BitwiseAnd{ | ||||
| 		Variable, | ||||
| 		Expression, | ||||
| 		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 | ||||
| } | ||||
| 
 | ||||
| // Attributes returns node attributes as map | ||||
| func (n *BitwiseAnd) Attributes() map[string]interface{} { | ||||
| 	return nil | ||||
|  | ||||
| @ -2,23 +2,35 @@ package binary | ||||
| 
 | ||||
| import ( | ||||
| 	"github.com/z7zmey/php-parser/node" | ||||
| 	"github.com/z7zmey/php-parser/position" | ||||
| 	"github.com/z7zmey/php-parser/walker" | ||||
| ) | ||||
| 
 | ||||
| // BitwiseOr node | ||||
| type BitwiseOr struct { | ||||
| 	Left  node.Node | ||||
| 	Right node.Node | ||||
| 	Position *position.Position | ||||
| 	Left     node.Node | ||||
| 	Right    node.Node | ||||
| } | ||||
| 
 | ||||
| // NewBitwiseOr node constructor | ||||
| func NewBitwiseOr(Variable node.Node, Expression node.Node) *BitwiseOr { | ||||
| 	return &BitwiseOr{ | ||||
| 		Variable, | ||||
| 		Expression, | ||||
| 		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 | ||||
| } | ||||
| 
 | ||||
| // Attributes returns node attributes as map | ||||
| func (n *BitwiseOr) Attributes() map[string]interface{} { | ||||
| 	return nil | ||||
|  | ||||
| @ -2,23 +2,35 @@ package binary | ||||
| 
 | ||||
| import ( | ||||
| 	"github.com/z7zmey/php-parser/node" | ||||
| 	"github.com/z7zmey/php-parser/position" | ||||
| 	"github.com/z7zmey/php-parser/walker" | ||||
| ) | ||||
| 
 | ||||
| // BitwiseXor node | ||||
| type BitwiseXor struct { | ||||
| 	Left  node.Node | ||||
| 	Right node.Node | ||||
| 	Position *position.Position | ||||
| 	Left     node.Node | ||||
| 	Right    node.Node | ||||
| } | ||||
| 
 | ||||
| // NewBitwiseXor node constructor | ||||
| func NewBitwiseXor(Variable node.Node, Expression node.Node) *BitwiseXor { | ||||
| 	return &BitwiseXor{ | ||||
| 		Variable, | ||||
| 		Expression, | ||||
| 		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 | ||||
| } | ||||
| 
 | ||||
| // Attributes returns node attributes as map | ||||
| func (n *BitwiseXor) Attributes() map[string]interface{} { | ||||
| 	return nil | ||||
|  | ||||
| @ -2,23 +2,35 @@ package binary | ||||
| 
 | ||||
| import ( | ||||
| 	"github.com/z7zmey/php-parser/node" | ||||
| 	"github.com/z7zmey/php-parser/position" | ||||
| 	"github.com/z7zmey/php-parser/walker" | ||||
| ) | ||||
| 
 | ||||
| // BooleanAnd node | ||||
| type BooleanAnd struct { | ||||
| 	Left  node.Node | ||||
| 	Right node.Node | ||||
| 	Position *position.Position | ||||
| 	Left     node.Node | ||||
| 	Right    node.Node | ||||
| } | ||||
| 
 | ||||
| // NewBooleanAnd node constructor | ||||
| func NewBooleanAnd(Variable node.Node, Expression node.Node) *BooleanAnd { | ||||
| 	return &BooleanAnd{ | ||||
| 		Variable, | ||||
| 		Expression, | ||||
| 		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 | ||||
| } | ||||
| 
 | ||||
| // Attributes returns node attributes as map | ||||
| func (n *BooleanAnd) Attributes() map[string]interface{} { | ||||
| 	return nil | ||||
|  | ||||
| @ -2,23 +2,35 @@ package binary | ||||
| 
 | ||||
| import ( | ||||
| 	"github.com/z7zmey/php-parser/node" | ||||
| 	"github.com/z7zmey/php-parser/position" | ||||
| 	"github.com/z7zmey/php-parser/walker" | ||||
| ) | ||||
| 
 | ||||
| // BooleanOr node | ||||
| type BooleanOr struct { | ||||
| 	Left  node.Node | ||||
| 	Right node.Node | ||||
| 	Position *position.Position | ||||
| 	Left     node.Node | ||||
| 	Right    node.Node | ||||
| } | ||||
| 
 | ||||
| // NewBooleanOr node constructor | ||||
| func NewBooleanOr(Variable node.Node, Expression node.Node) *BooleanOr { | ||||
| 	return &BooleanOr{ | ||||
| 		Variable, | ||||
| 		Expression, | ||||
| 		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 | ||||
| } | ||||
| 
 | ||||
| // Attributes returns node attributes as map | ||||
| func (n *BooleanOr) Attributes() map[string]interface{} { | ||||
| 	return nil | ||||
|  | ||||
| @ -2,23 +2,35 @@ package binary | ||||
| 
 | ||||
| import ( | ||||
| 	"github.com/z7zmey/php-parser/node" | ||||
| 	"github.com/z7zmey/php-parser/position" | ||||
| 	"github.com/z7zmey/php-parser/walker" | ||||
| ) | ||||
| 
 | ||||
| // Coalesce node | ||||
| type Coalesce struct { | ||||
| 	Left  node.Node | ||||
| 	Right node.Node | ||||
| 	Position *position.Position | ||||
| 	Left     node.Node | ||||
| 	Right    node.Node | ||||
| } | ||||
| 
 | ||||
| // NewCoalesce node constructor | ||||
| func NewCoalesce(Variable node.Node, Expression node.Node) *Coalesce { | ||||
| 	return &Coalesce{ | ||||
| 		Variable, | ||||
| 		Expression, | ||||
| 		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 | ||||
| } | ||||
| 
 | ||||
| // Attributes returns node attributes as map | ||||
| func (n *Coalesce) Attributes() map[string]interface{} { | ||||
| 	return nil | ||||
|  | ||||
| @ -2,23 +2,35 @@ package binary | ||||
| 
 | ||||
| import ( | ||||
| 	"github.com/z7zmey/php-parser/node" | ||||
| 	"github.com/z7zmey/php-parser/position" | ||||
| 	"github.com/z7zmey/php-parser/walker" | ||||
| ) | ||||
| 
 | ||||
| // Concat node | ||||
| type Concat struct { | ||||
| 	Left  node.Node | ||||
| 	Right node.Node | ||||
| 	Position *position.Position | ||||
| 	Left     node.Node | ||||
| 	Right    node.Node | ||||
| } | ||||
| 
 | ||||
| // NewConcat node constructor | ||||
| func NewConcat(Variable node.Node, Expression node.Node) *Concat { | ||||
| 	return &Concat{ | ||||
| 		Variable, | ||||
| 		Expression, | ||||
| 		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 | ||||
| } | ||||
| 
 | ||||
| // Attributes returns node attributes as map | ||||
| func (n *Concat) Attributes() map[string]interface{} { | ||||
| 	return nil | ||||
|  | ||||
| @ -2,23 +2,35 @@ package binary | ||||
| 
 | ||||
| import ( | ||||
| 	"github.com/z7zmey/php-parser/node" | ||||
| 	"github.com/z7zmey/php-parser/position" | ||||
| 	"github.com/z7zmey/php-parser/walker" | ||||
| ) | ||||
| 
 | ||||
| // Div node | ||||
| type Div struct { | ||||
| 	Left  node.Node | ||||
| 	Right node.Node | ||||
| 	Position *position.Position | ||||
| 	Left     node.Node | ||||
| 	Right    node.Node | ||||
| } | ||||
| 
 | ||||
| // NewDiv node constructor | ||||
| func NewDiv(Variable node.Node, Expression node.Node) *Div { | ||||
| 	return &Div{ | ||||
| 		Variable, | ||||
| 		Expression, | ||||
| 		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 | ||||
| } | ||||
| 
 | ||||
| // Attributes returns node attributes as map | ||||
| func (n *Div) Attributes() map[string]interface{} { | ||||
| 	return nil | ||||
|  | ||||
| @ -2,23 +2,35 @@ package binary | ||||
| 
 | ||||
| import ( | ||||
| 	"github.com/z7zmey/php-parser/node" | ||||
| 	"github.com/z7zmey/php-parser/position" | ||||
| 	"github.com/z7zmey/php-parser/walker" | ||||
| ) | ||||
| 
 | ||||
| // Equal node | ||||
| type Equal struct { | ||||
| 	Left  node.Node | ||||
| 	Right node.Node | ||||
| 	Position *position.Position | ||||
| 	Left     node.Node | ||||
| 	Right    node.Node | ||||
| } | ||||
| 
 | ||||
| // NewEqual node constructor | ||||
| func NewEqual(Variable node.Node, Expression node.Node) *Equal { | ||||
| 	return &Equal{ | ||||
| 		Variable, | ||||
| 		Expression, | ||||
| 		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 | ||||
| } | ||||
| 
 | ||||
| // Attributes returns node attributes as map | ||||
| func (n *Equal) Attributes() map[string]interface{} { | ||||
| 	return nil | ||||
|  | ||||
| @ -2,23 +2,35 @@ package binary | ||||
| 
 | ||||
| import ( | ||||
| 	"github.com/z7zmey/php-parser/node" | ||||
| 	"github.com/z7zmey/php-parser/position" | ||||
| 	"github.com/z7zmey/php-parser/walker" | ||||
| ) | ||||
| 
 | ||||
| // Greater node | ||||
| type Greater struct { | ||||
| 	Left  node.Node | ||||
| 	Right node.Node | ||||
| 	Position *position.Position | ||||
| 	Left     node.Node | ||||
| 	Right    node.Node | ||||
| } | ||||
| 
 | ||||
| // NewGreater node constructor | ||||
| func NewGreater(Variable node.Node, Expression node.Node) *Greater { | ||||
| 	return &Greater{ | ||||
| 		Variable, | ||||
| 		Expression, | ||||
| 		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 | ||||
| } | ||||
| 
 | ||||
| // Attributes returns node attributes as map | ||||
| func (n *Greater) Attributes() map[string]interface{} { | ||||
| 	return nil | ||||
|  | ||||
| @ -2,23 +2,35 @@ package binary | ||||
| 
 | ||||
| import ( | ||||
| 	"github.com/z7zmey/php-parser/node" | ||||
| 	"github.com/z7zmey/php-parser/position" | ||||
| 	"github.com/z7zmey/php-parser/walker" | ||||
| ) | ||||
| 
 | ||||
| // GreaterOrEqual node | ||||
| type GreaterOrEqual struct { | ||||
| 	Left  node.Node | ||||
| 	Right node.Node | ||||
| 	Position *position.Position | ||||
| 	Left     node.Node | ||||
| 	Right    node.Node | ||||
| } | ||||
| 
 | ||||
| // NewGreaterOrEqual node constructor | ||||
| func NewGreaterOrEqual(Variable node.Node, Expression node.Node) *GreaterOrEqual { | ||||
| 	return &GreaterOrEqual{ | ||||
| 		Variable, | ||||
| 		Expression, | ||||
| 		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 | ||||
| } | ||||
| 
 | ||||
| // Attributes returns node attributes as map | ||||
| func (n *GreaterOrEqual) Attributes() map[string]interface{} { | ||||
| 	return nil | ||||
|  | ||||
| @ -2,23 +2,35 @@ package binary | ||||
| 
 | ||||
| import ( | ||||
| 	"github.com/z7zmey/php-parser/node" | ||||
| 	"github.com/z7zmey/php-parser/position" | ||||
| 	"github.com/z7zmey/php-parser/walker" | ||||
| ) | ||||
| 
 | ||||
| // Identical node | ||||
| type Identical struct { | ||||
| 	Left  node.Node | ||||
| 	Right node.Node | ||||
| 	Position *position.Position | ||||
| 	Left     node.Node | ||||
| 	Right    node.Node | ||||
| } | ||||
| 
 | ||||
| // NewIdentical node constructor | ||||
| func NewIdentical(Variable node.Node, Expression node.Node) *Identical { | ||||
| 	return &Identical{ | ||||
| 		Variable, | ||||
| 		Expression, | ||||
| 		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 | ||||
| } | ||||
| 
 | ||||
| // Attributes returns node attributes as map | ||||
| func (n *Identical) Attributes() map[string]interface{} { | ||||
| 	return nil | ||||
|  | ||||
| @ -2,23 +2,35 @@ package binary | ||||
| 
 | ||||
| import ( | ||||
| 	"github.com/z7zmey/php-parser/node" | ||||
| 	"github.com/z7zmey/php-parser/position" | ||||
| 	"github.com/z7zmey/php-parser/walker" | ||||
| ) | ||||
| 
 | ||||
| // LogicalAnd node | ||||
| type LogicalAnd struct { | ||||
| 	Left  node.Node | ||||
| 	Right node.Node | ||||
| 	Position *position.Position | ||||
| 	Left     node.Node | ||||
| 	Right    node.Node | ||||
| } | ||||
| 
 | ||||
| // NewLogicalAnd node constructor | ||||
| func NewLogicalAnd(Variable node.Node, Expression node.Node) *LogicalAnd { | ||||
| 	return &LogicalAnd{ | ||||
| 		Variable, | ||||
| 		Expression, | ||||
| 		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 | ||||
| } | ||||
| 
 | ||||
| // Attributes returns node attributes as map | ||||
| func (n *LogicalAnd) Attributes() map[string]interface{} { | ||||
| 	return nil | ||||
|  | ||||
| @ -2,23 +2,35 @@ package binary | ||||
| 
 | ||||
| import ( | ||||
| 	"github.com/z7zmey/php-parser/node" | ||||
| 	"github.com/z7zmey/php-parser/position" | ||||
| 	"github.com/z7zmey/php-parser/walker" | ||||
| ) | ||||
| 
 | ||||
| // LogicalOr node | ||||
| type LogicalOr struct { | ||||
| 	Left  node.Node | ||||
| 	Right node.Node | ||||
| 	Position *position.Position | ||||
| 	Left     node.Node | ||||
| 	Right    node.Node | ||||
| } | ||||
| 
 | ||||
| // NewLogicalOr node constructor | ||||
| func NewLogicalOr(Variable node.Node, Expression node.Node) *LogicalOr { | ||||
| 	return &LogicalOr{ | ||||
| 		Variable, | ||||
| 		Expression, | ||||
| 		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 | ||||
| } | ||||
| 
 | ||||
| // Attributes returns node attributes as map | ||||
| func (n *LogicalOr) Attributes() map[string]interface{} { | ||||
| 	return nil | ||||
|  | ||||
| @ -2,23 +2,35 @@ package binary | ||||
| 
 | ||||
| import ( | ||||
| 	"github.com/z7zmey/php-parser/node" | ||||
| 	"github.com/z7zmey/php-parser/position" | ||||
| 	"github.com/z7zmey/php-parser/walker" | ||||
| ) | ||||
| 
 | ||||
| // LogicalXor node | ||||
| type LogicalXor struct { | ||||
| 	Left  node.Node | ||||
| 	Right node.Node | ||||
| 	Position *position.Position | ||||
| 	Left     node.Node | ||||
| 	Right    node.Node | ||||
| } | ||||
| 
 | ||||
| // NewLogicalXor node constructor | ||||
| func NewLogicalXor(Variable node.Node, Expression node.Node) *LogicalXor { | ||||
| 	return &LogicalXor{ | ||||
| 		Variable, | ||||
| 		Expression, | ||||
| 		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 | ||||
| } | ||||
| 
 | ||||
| // Attributes returns node attributes as map | ||||
| func (n *LogicalXor) Attributes() map[string]interface{} { | ||||
| 	return nil | ||||
|  | ||||
| @ -2,23 +2,35 @@ package binary | ||||
| 
 | ||||
| import ( | ||||
| 	"github.com/z7zmey/php-parser/node" | ||||
| 	"github.com/z7zmey/php-parser/position" | ||||
| 	"github.com/z7zmey/php-parser/walker" | ||||
| ) | ||||
| 
 | ||||
| // Minus node | ||||
| type Minus struct { | ||||
| 	Left  node.Node | ||||
| 	Right node.Node | ||||
| 	Position *position.Position | ||||
| 	Left     node.Node | ||||
| 	Right    node.Node | ||||
| } | ||||
| 
 | ||||
| // NewMinus node constructor | ||||
| func NewMinus(Variable node.Node, Expression node.Node) *Minus { | ||||
| 	return &Minus{ | ||||
| 		Variable, | ||||
| 		Expression, | ||||
| 		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 | ||||
| } | ||||
| 
 | ||||
| // Attributes returns node attributes as map | ||||
| func (n *Minus) Attributes() map[string]interface{} { | ||||
| 	return nil | ||||
|  | ||||
| @ -2,23 +2,35 @@ package binary | ||||
| 
 | ||||
| import ( | ||||
| 	"github.com/z7zmey/php-parser/node" | ||||
| 	"github.com/z7zmey/php-parser/position" | ||||
| 	"github.com/z7zmey/php-parser/walker" | ||||
| ) | ||||
| 
 | ||||
| // Mod node | ||||
| type Mod struct { | ||||
| 	Left  node.Node | ||||
| 	Right node.Node | ||||
| 	Position *position.Position | ||||
| 	Left     node.Node | ||||
| 	Right    node.Node | ||||
| } | ||||
| 
 | ||||
| // NewMod node constructor | ||||
| func NewMod(Variable node.Node, Expression node.Node) *Mod { | ||||
| 	return &Mod{ | ||||
| 		Variable, | ||||
| 		Expression, | ||||
| 		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 | ||||
| } | ||||
| 
 | ||||
| // Attributes returns node attributes as map | ||||
| func (n *Mod) Attributes() map[string]interface{} { | ||||
| 	return nil | ||||
|  | ||||
| @ -2,23 +2,35 @@ package binary | ||||
| 
 | ||||
| import ( | ||||
| 	"github.com/z7zmey/php-parser/node" | ||||
| 	"github.com/z7zmey/php-parser/position" | ||||
| 	"github.com/z7zmey/php-parser/walker" | ||||
| ) | ||||
| 
 | ||||
| // Mul node | ||||
| type Mul struct { | ||||
| 	Left  node.Node | ||||
| 	Right node.Node | ||||
| 	Position *position.Position | ||||
| 	Left     node.Node | ||||
| 	Right    node.Node | ||||
| } | ||||
| 
 | ||||
| // NewMul node constructor | ||||
| func NewMul(Variable node.Node, Expression node.Node) *Mul { | ||||
| 	return &Mul{ | ||||
| 		Variable, | ||||
| 		Expression, | ||||
| 		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 | ||||
| } | ||||
| 
 | ||||
| // Attributes returns node attributes as map | ||||
| func (n *Mul) Attributes() map[string]interface{} { | ||||
| 	return nil | ||||
|  | ||||
| @ -2,23 +2,35 @@ package binary | ||||
| 
 | ||||
| import ( | ||||
| 	"github.com/z7zmey/php-parser/node" | ||||
| 	"github.com/z7zmey/php-parser/position" | ||||
| 	"github.com/z7zmey/php-parser/walker" | ||||
| ) | ||||
| 
 | ||||
| // NotEqual node | ||||
| type NotEqual struct { | ||||
| 	Left  node.Node | ||||
| 	Right node.Node | ||||
| 	Position *position.Position | ||||
| 	Left     node.Node | ||||
| 	Right    node.Node | ||||
| } | ||||
| 
 | ||||
| // NewNotEqual node constructor | ||||
| func NewNotEqual(Variable node.Node, Expression node.Node) *NotEqual { | ||||
| 	return &NotEqual{ | ||||
| 		Variable, | ||||
| 		Expression, | ||||
| 		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 | ||||
| } | ||||
| 
 | ||||
| // Attributes returns node attributes as map | ||||
| func (n *NotEqual) Attributes() map[string]interface{} { | ||||
| 	return nil | ||||
|  | ||||
| @ -2,23 +2,35 @@ package binary | ||||
| 
 | ||||
| import ( | ||||
| 	"github.com/z7zmey/php-parser/node" | ||||
| 	"github.com/z7zmey/php-parser/position" | ||||
| 	"github.com/z7zmey/php-parser/walker" | ||||
| ) | ||||
| 
 | ||||
| // NotIdentical node | ||||
| type NotIdentical struct { | ||||
| 	Left  node.Node | ||||
| 	Right node.Node | ||||
| 	Position *position.Position | ||||
| 	Left     node.Node | ||||
| 	Right    node.Node | ||||
| } | ||||
| 
 | ||||
| // NewNotIdentical node constructor | ||||
| func NewNotIdentical(Variable node.Node, Expression node.Node) *NotIdentical { | ||||
| 	return &NotIdentical{ | ||||
| 		Variable, | ||||
| 		Expression, | ||||
| 		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 | ||||
| } | ||||
| 
 | ||||
| // Attributes returns node attributes as map | ||||
| func (n *NotIdentical) Attributes() map[string]interface{} { | ||||
| 	return nil | ||||
|  | ||||
| @ -2,23 +2,35 @@ package binary | ||||
| 
 | ||||
| import ( | ||||
| 	"github.com/z7zmey/php-parser/node" | ||||
| 	"github.com/z7zmey/php-parser/position" | ||||
| 	"github.com/z7zmey/php-parser/walker" | ||||
| ) | ||||
| 
 | ||||
| // Plus node | ||||
| type Plus struct { | ||||
| 	Left  node.Node | ||||
| 	Right node.Node | ||||
| 	Position *position.Position | ||||
| 	Left     node.Node | ||||
| 	Right    node.Node | ||||
| } | ||||
| 
 | ||||
| // NewPlus node constructor | ||||
| func NewPlus(Variable node.Node, Expression node.Node) *Plus { | ||||
| 	return &Plus{ | ||||
| 		Variable, | ||||
| 		Expression, | ||||
| 		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 | ||||
| } | ||||
| 
 | ||||
| // Attributes returns node attributes as map | ||||
| func (n *Plus) Attributes() map[string]interface{} { | ||||
| 	return nil | ||||
|  | ||||
| @ -2,23 +2,35 @@ package binary | ||||
| 
 | ||||
| import ( | ||||
| 	"github.com/z7zmey/php-parser/node" | ||||
| 	"github.com/z7zmey/php-parser/position" | ||||
| 	"github.com/z7zmey/php-parser/walker" | ||||
| ) | ||||
| 
 | ||||
| // Pow node | ||||
| type Pow struct { | ||||
| 	Left  node.Node | ||||
| 	Right node.Node | ||||
| 	Position *position.Position | ||||
| 	Left     node.Node | ||||
| 	Right    node.Node | ||||
| } | ||||
| 
 | ||||
| // NewPow node constructor | ||||
| func NewPow(Variable node.Node, Expression node.Node) *Pow { | ||||
| 	return &Pow{ | ||||
| 		Variable, | ||||
| 		Expression, | ||||
| 		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 | ||||
| } | ||||
| 
 | ||||
| // Attributes returns node attributes as map | ||||
| func (n *Pow) Attributes() map[string]interface{} { | ||||
| 	return nil | ||||
|  | ||||
| @ -2,23 +2,35 @@ package binary | ||||
| 
 | ||||
| import ( | ||||
| 	"github.com/z7zmey/php-parser/node" | ||||
| 	"github.com/z7zmey/php-parser/position" | ||||
| 	"github.com/z7zmey/php-parser/walker" | ||||
| ) | ||||
| 
 | ||||
| // ShiftLeft node | ||||
| type ShiftLeft struct { | ||||
| 	Left  node.Node | ||||
| 	Right node.Node | ||||
| 	Position *position.Position | ||||
| 	Left     node.Node | ||||
| 	Right    node.Node | ||||
| } | ||||
| 
 | ||||
| // NewShiftLeft node constructor | ||||
| func NewShiftLeft(Variable node.Node, Expression node.Node) *ShiftLeft { | ||||
| 	return &ShiftLeft{ | ||||
| 		Variable, | ||||
| 		Expression, | ||||
| 		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 | ||||
| } | ||||
| 
 | ||||
| // Attributes returns node attributes as map | ||||
| func (n *ShiftLeft) Attributes() map[string]interface{} { | ||||
| 	return nil | ||||
|  | ||||
| @ -2,23 +2,35 @@ package binary | ||||
| 
 | ||||
| import ( | ||||
| 	"github.com/z7zmey/php-parser/node" | ||||
| 	"github.com/z7zmey/php-parser/position" | ||||
| 	"github.com/z7zmey/php-parser/walker" | ||||
| ) | ||||
| 
 | ||||
| // ShiftRight node | ||||
| type ShiftRight struct { | ||||
| 	Left  node.Node | ||||
| 	Right node.Node | ||||
| 	Position *position.Position | ||||
| 	Left     node.Node | ||||
| 	Right    node.Node | ||||
| } | ||||
| 
 | ||||
| // NewShiftRight node constructor | ||||
| func NewShiftRight(Variable node.Node, Expression node.Node) *ShiftRight { | ||||
| 	return &ShiftRight{ | ||||
| 		Variable, | ||||
| 		Expression, | ||||
| 		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 | ||||
| } | ||||
| 
 | ||||
| // Attributes returns node attributes as map | ||||
| func (n *ShiftRight) Attributes() map[string]interface{} { | ||||
| 	return nil | ||||
|  | ||||
| @ -2,23 +2,35 @@ package binary | ||||
| 
 | ||||
| import ( | ||||
| 	"github.com/z7zmey/php-parser/node" | ||||
| 	"github.com/z7zmey/php-parser/position" | ||||
| 	"github.com/z7zmey/php-parser/walker" | ||||
| ) | ||||
| 
 | ||||
| // Smaller node | ||||
| type Smaller struct { | ||||
| 	Left  node.Node | ||||
| 	Right node.Node | ||||
| 	Position *position.Position | ||||
| 	Left     node.Node | ||||
| 	Right    node.Node | ||||
| } | ||||
| 
 | ||||
| // NewSmaller node constructor | ||||
| func NewSmaller(Variable node.Node, Expression node.Node) *Smaller { | ||||
| 	return &Smaller{ | ||||
| 		Variable, | ||||
| 		Expression, | ||||
| 		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 | ||||
| } | ||||
| 
 | ||||
| // Attributes returns node attributes as map | ||||
| func (n *Smaller) Attributes() map[string]interface{} { | ||||
| 	return nil | ||||
|  | ||||
| @ -2,23 +2,35 @@ package binary | ||||
| 
 | ||||
| import ( | ||||
| 	"github.com/z7zmey/php-parser/node" | ||||
| 	"github.com/z7zmey/php-parser/position" | ||||
| 	"github.com/z7zmey/php-parser/walker" | ||||
| ) | ||||
| 
 | ||||
| // SmallerOrEqual node | ||||
| type SmallerOrEqual struct { | ||||
| 	Left  node.Node | ||||
| 	Right node.Node | ||||
| 	Position *position.Position | ||||
| 	Left     node.Node | ||||
| 	Right    node.Node | ||||
| } | ||||
| 
 | ||||
| // NewSmallerOrEqual node constructor | ||||
| func NewSmallerOrEqual(Variable node.Node, Expression node.Node) *SmallerOrEqual { | ||||
| 	return &SmallerOrEqual{ | ||||
| 		Variable, | ||||
| 		Expression, | ||||
| 		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 | ||||
| } | ||||
| 
 | ||||
| // Attributes returns node attributes as map | ||||
| func (n *SmallerOrEqual) Attributes() map[string]interface{} { | ||||
| 	return nil | ||||
|  | ||||
| @ -2,23 +2,35 @@ package binary | ||||
| 
 | ||||
| import ( | ||||
| 	"github.com/z7zmey/php-parser/node" | ||||
| 	"github.com/z7zmey/php-parser/position" | ||||
| 	"github.com/z7zmey/php-parser/walker" | ||||
| ) | ||||
| 
 | ||||
| // Spaceship node | ||||
| type Spaceship struct { | ||||
| 	Left  node.Node | ||||
| 	Right node.Node | ||||
| 	Position *position.Position | ||||
| 	Left     node.Node | ||||
| 	Right    node.Node | ||||
| } | ||||
| 
 | ||||
| // NewSpaceship node constructor | ||||
| func NewSpaceship(Variable node.Node, Expression node.Node) *Spaceship { | ||||
| 	return &Spaceship{ | ||||
| 		Variable, | ||||
| 		Expression, | ||||
| 		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 | ||||
| } | ||||
| 
 | ||||
| // Attributes returns node attributes as map | ||||
| func (n *Spaceship) Attributes() map[string]interface{} { | ||||
| 	return nil | ||||
|  | ||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| @ -2,21 +2,33 @@ package cast | ||||
| 
 | ||||
| import ( | ||||
| 	"github.com/z7zmey/php-parser/node" | ||||
| 	"github.com/z7zmey/php-parser/position" | ||||
| 	"github.com/z7zmey/php-parser/walker" | ||||
| ) | ||||
| 
 | ||||
| // Array node | ||||
| type Array struct { | ||||
| 	Expr node.Node | ||||
| 	Position *position.Position | ||||
| 	Expr     node.Node | ||||
| } | ||||
| 
 | ||||
| // NewArray node constructor | ||||
| func NewArray(Expr node.Node) *Array { | ||||
| 	return &Array{ | ||||
| 		Expr, | ||||
| 		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 | ||||
| } | ||||
| 
 | ||||
| // Attributes returns node attributes as map | ||||
| func (n *Array) Attributes() map[string]interface{} { | ||||
| 	return nil | ||||
|  | ||||
| @ -2,21 +2,33 @@ package cast | ||||
| 
 | ||||
| import ( | ||||
| 	"github.com/z7zmey/php-parser/node" | ||||
| 	"github.com/z7zmey/php-parser/position" | ||||
| 	"github.com/z7zmey/php-parser/walker" | ||||
| ) | ||||
| 
 | ||||
| // Bool node | ||||
| type Bool struct { | ||||
| 	Expr node.Node | ||||
| 	Position *position.Position | ||||
| 	Expr     node.Node | ||||
| } | ||||
| 
 | ||||
| // NewBool node constructor | ||||
| func NewBool(Expr node.Node) *Bool { | ||||
| 	return &Bool{ | ||||
| 		Expr, | ||||
| 		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 | ||||
| } | ||||
| 
 | ||||
| // Attributes returns node attributes as map | ||||
| func (n *Bool) Attributes() map[string]interface{} { | ||||
| 	return nil | ||||
|  | ||||
| @ -2,21 +2,33 @@ package cast | ||||
| 
 | ||||
| import ( | ||||
| 	"github.com/z7zmey/php-parser/node" | ||||
| 	"github.com/z7zmey/php-parser/position" | ||||
| 	"github.com/z7zmey/php-parser/walker" | ||||
| ) | ||||
| 
 | ||||
| // Double node | ||||
| type Double struct { | ||||
| 	Expr node.Node | ||||
| 	Position *position.Position | ||||
| 	Expr     node.Node | ||||
| } | ||||
| 
 | ||||
| // NewDouble node constructor | ||||
| func NewDouble(Expr node.Node) *Double { | ||||
| 	return &Double{ | ||||
| 		Expr, | ||||
| 		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 | ||||
| } | ||||
| 
 | ||||
| // Attributes returns node attributes as map | ||||
| func (n *Double) Attributes() map[string]interface{} { | ||||
| 	return nil | ||||
|  | ||||
| @ -2,21 +2,33 @@ package cast | ||||
| 
 | ||||
| import ( | ||||
| 	"github.com/z7zmey/php-parser/node" | ||||
| 	"github.com/z7zmey/php-parser/position" | ||||
| 	"github.com/z7zmey/php-parser/walker" | ||||
| ) | ||||
| 
 | ||||
| // Int node | ||||
| type Int struct { | ||||
| 	Expr node.Node | ||||
| 	Position *position.Position | ||||
| 	Expr     node.Node | ||||
| } | ||||
| 
 | ||||
| // NewInt node constructor | ||||
| func NewInt(Expr node.Node) *Int { | ||||
| 	return &Int{ | ||||
| 		Expr, | ||||
| 		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 | ||||
| } | ||||
| 
 | ||||
| // Attributes returns node attributes as map | ||||
| func (n *Int) Attributes() map[string]interface{} { | ||||
| 	return nil | ||||
|  | ||||
| @ -2,21 +2,33 @@ package cast | ||||
| 
 | ||||
| import ( | ||||
| 	"github.com/z7zmey/php-parser/node" | ||||
| 	"github.com/z7zmey/php-parser/position" | ||||
| 	"github.com/z7zmey/php-parser/walker" | ||||
| ) | ||||
| 
 | ||||
| // Object node | ||||
| type Object struct { | ||||
| 	Expr node.Node | ||||
| 	Position *position.Position | ||||
| 	Expr     node.Node | ||||
| } | ||||
| 
 | ||||
| // NewObject node constructor | ||||
| func NewObject(Expr node.Node) *Object { | ||||
| 	return &Object{ | ||||
| 		Expr, | ||||
| 		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 | ||||
| } | ||||
| 
 | ||||
| // Attributes returns node attributes as map | ||||
| func (n *Object) Attributes() map[string]interface{} { | ||||
| 	return nil | ||||
|  | ||||
| @ -2,21 +2,33 @@ package cast | ||||
| 
 | ||||
| import ( | ||||
| 	"github.com/z7zmey/php-parser/node" | ||||
| 	"github.com/z7zmey/php-parser/position" | ||||
| 	"github.com/z7zmey/php-parser/walker" | ||||
| ) | ||||
| 
 | ||||
| // String node | ||||
| type String struct { | ||||
| 	Expr node.Node | ||||
| 	Position *position.Position | ||||
| 	Expr     node.Node | ||||
| } | ||||
| 
 | ||||
| // NewString node constructor | ||||
| func NewString(Expr node.Node) *String { | ||||
| 	return &String{ | ||||
| 		Expr, | ||||
| 		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 | ||||
| } | ||||
| 
 | ||||
| // Attributes returns node attributes as map | ||||
| func (n *String) Attributes() map[string]interface{} { | ||||
| 	return nil | ||||
|  | ||||
| @ -2,21 +2,33 @@ package cast | ||||
| 
 | ||||
| import ( | ||||
| 	"github.com/z7zmey/php-parser/node" | ||||
| 	"github.com/z7zmey/php-parser/position" | ||||
| 	"github.com/z7zmey/php-parser/walker" | ||||
| ) | ||||
| 
 | ||||
| // Unset node | ||||
| type Unset struct { | ||||
| 	Expr node.Node | ||||
| 	Position *position.Position | ||||
| 	Expr     node.Node | ||||
| } | ||||
| 
 | ||||
| // NewUnset node constructor | ||||
| func NewUnset(Expr node.Node) *Unset { | ||||
| 	return &Unset{ | ||||
| 		Expr, | ||||
| 		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 | ||||
| } | ||||
| 
 | ||||
| // Attributes returns node attributes as map | ||||
| func (n *Unset) Attributes() map[string]interface{} { | ||||
| 	return nil | ||||
|  | ||||
| @ -13,6 +13,7 @@ import ( | ||||
| 	"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 assertEqual(t *testing.T, expected interface{}, actual interface{}) { | ||||
| @ -31,10 +32,44 @@ func TestArray(t *testing.T) { | ||||
| 	src := `<? (array)$a;` | ||||
| 
 | ||||
| 	expected := &node.Root{ | ||||
| 		Position: &position.Position{ | ||||
| 			StartLine: 1, | ||||
| 			EndLine:   1, | ||||
| 			StartPos:  4, | ||||
| 			EndPos:    13, | ||||
| 		}, | ||||
| 		Stmts: []node.Node{ | ||||
| 			&stmt.Expression{ | ||||
| 				Position: &position.Position{ | ||||
| 					StartLine: 1, | ||||
| 					EndLine:   1, | ||||
| 					StartPos:  4, | ||||
| 					EndPos:    13, | ||||
| 				}, | ||||
| 				Expr: &cast.Array{ | ||||
| 					Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}}, | ||||
| 					Position: &position.Position{ | ||||
| 						StartLine: 1, | ||||
| 						EndLine:   1, | ||||
| 						StartPos:  4, | ||||
| 						EndPos:    12, | ||||
| 					}, | ||||
| 					Expr: &expr.Variable{ | ||||
| 						Position: &position.Position{ | ||||
| 							StartLine: 1, | ||||
| 							EndLine:   1, | ||||
| 							StartPos:  11, | ||||
| 							EndPos:    12, | ||||
| 						}, | ||||
| 						VarName: &node.Identifier{ | ||||
| 							Position: &position.Position{ | ||||
| 								StartLine: 1, | ||||
| 								EndLine:   1, | ||||
| 								StartPos:  11, | ||||
| 								EndPos:    12, | ||||
| 							}, | ||||
| 							Value: "a", | ||||
| 						}, | ||||
| 					}, | ||||
| 				}, | ||||
| 			}, | ||||
| 		}, | ||||
| @ -55,10 +90,44 @@ func TestBool(t *testing.T) { | ||||
| 	src := `<? (boolean)$a;` | ||||
| 
 | ||||
| 	expected := &node.Root{ | ||||
| 		Position: &position.Position{ | ||||
| 			StartLine: 1, | ||||
| 			EndLine:   1, | ||||
| 			StartPos:  4, | ||||
| 			EndPos:    15, | ||||
| 		}, | ||||
| 		Stmts: []node.Node{ | ||||
| 			&stmt.Expression{ | ||||
| 				Position: &position.Position{ | ||||
| 					StartLine: 1, | ||||
| 					EndLine:   1, | ||||
| 					StartPos:  4, | ||||
| 					EndPos:    15, | ||||
| 				}, | ||||
| 				Expr: &cast.Bool{ | ||||
| 					Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}}, | ||||
| 					Position: &position.Position{ | ||||
| 						StartLine: 1, | ||||
| 						EndLine:   1, | ||||
| 						StartPos:  4, | ||||
| 						EndPos:    14, | ||||
| 					}, | ||||
| 					Expr: &expr.Variable{ | ||||
| 						Position: &position.Position{ | ||||
| 							StartLine: 1, | ||||
| 							EndLine:   1, | ||||
| 							StartPos:  13, | ||||
| 							EndPos:    14, | ||||
| 						}, | ||||
| 						VarName: &node.Identifier{ | ||||
| 							Position: &position.Position{ | ||||
| 								StartLine: 1, | ||||
| 								EndLine:   1, | ||||
| 								StartPos:  13, | ||||
| 								EndPos:    14, | ||||
| 							}, | ||||
| 							Value: "a", | ||||
| 						}, | ||||
| 					}, | ||||
| 				}, | ||||
| 			}, | ||||
| 		}, | ||||
| @ -79,10 +148,44 @@ func TestBoolShort(t *testing.T) { | ||||
| 	src := `<? (bool)$a;` | ||||
| 
 | ||||
| 	expected := &node.Root{ | ||||
| 		Position: &position.Position{ | ||||
| 			StartLine: 1, | ||||
| 			EndLine:   1, | ||||
| 			StartPos:  4, | ||||
| 			EndPos:    12, | ||||
| 		}, | ||||
| 		Stmts: []node.Node{ | ||||
| 			&stmt.Expression{ | ||||
| 				Position: &position.Position{ | ||||
| 					StartLine: 1, | ||||
| 					EndLine:   1, | ||||
| 					StartPos:  4, | ||||
| 					EndPos:    12, | ||||
| 				}, | ||||
| 				Expr: &cast.Bool{ | ||||
| 					Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}}, | ||||
| 					Position: &position.Position{ | ||||
| 						StartLine: 1, | ||||
| 						EndLine:   1, | ||||
| 						StartPos:  4, | ||||
| 						EndPos:    11, | ||||
| 					}, | ||||
| 					Expr: &expr.Variable{ | ||||
| 						Position: &position.Position{ | ||||
| 							StartLine: 1, | ||||
| 							EndLine:   1, | ||||
| 							StartPos:  10, | ||||
| 							EndPos:    11, | ||||
| 						}, | ||||
| 						VarName: &node.Identifier{ | ||||
| 							Position: &position.Position{ | ||||
| 								StartLine: 1, | ||||
| 								EndLine:   1, | ||||
| 								StartPos:  10, | ||||
| 								EndPos:    11, | ||||
| 							}, | ||||
| 							Value: "a", | ||||
| 						}, | ||||
| 					}, | ||||
| 				}, | ||||
| 			}, | ||||
| 		}, | ||||
| @ -103,10 +206,44 @@ func TestDouble(t *testing.T) { | ||||
| 	src := `<? (double)$a;` | ||||
| 
 | ||||
| 	expected := &node.Root{ | ||||
| 		Position: &position.Position{ | ||||
| 			StartLine: 1, | ||||
| 			EndLine:   1, | ||||
| 			StartPos:  4, | ||||
| 			EndPos:    14, | ||||
| 		}, | ||||
| 		Stmts: []node.Node{ | ||||
| 			&stmt.Expression{ | ||||
| 				Position: &position.Position{ | ||||
| 					StartLine: 1, | ||||
| 					EndLine:   1, | ||||
| 					StartPos:  4, | ||||
| 					EndPos:    14, | ||||
| 				}, | ||||
| 				Expr: &cast.Double{ | ||||
| 					Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}}, | ||||
| 					Position: &position.Position{ | ||||
| 						StartLine: 1, | ||||
| 						EndLine:   1, | ||||
| 						StartPos:  4, | ||||
| 						EndPos:    13, | ||||
| 					}, | ||||
| 					Expr: &expr.Variable{ | ||||
| 						Position: &position.Position{ | ||||
| 							StartLine: 1, | ||||
| 							EndLine:   1, | ||||
| 							StartPos:  12, | ||||
| 							EndPos:    13, | ||||
| 						}, | ||||
| 						VarName: &node.Identifier{ | ||||
| 							Position: &position.Position{ | ||||
| 								StartLine: 1, | ||||
| 								EndLine:   1, | ||||
| 								StartPos:  12, | ||||
| 								EndPos:    13, | ||||
| 							}, | ||||
| 							Value: "a", | ||||
| 						}, | ||||
| 					}, | ||||
| 				}, | ||||
| 			}, | ||||
| 		}, | ||||
| @ -127,10 +264,44 @@ func TestCastFloat(t *testing.T) { | ||||
| 	src := `<? (float)$a;` | ||||
| 
 | ||||
| 	expected := &node.Root{ | ||||
| 		Position: &position.Position{ | ||||
| 			StartLine: 1, | ||||
| 			EndLine:   1, | ||||
| 			StartPos:  4, | ||||
| 			EndPos:    13, | ||||
| 		}, | ||||
| 		Stmts: []node.Node{ | ||||
| 			&stmt.Expression{ | ||||
| 				Position: &position.Position{ | ||||
| 					StartLine: 1, | ||||
| 					EndLine:   1, | ||||
| 					StartPos:  4, | ||||
| 					EndPos:    13, | ||||
| 				}, | ||||
| 				Expr: &cast.Double{ | ||||
| 					Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}}, | ||||
| 					Position: &position.Position{ | ||||
| 						StartLine: 1, | ||||
| 						EndLine:   1, | ||||
| 						StartPos:  4, | ||||
| 						EndPos:    12, | ||||
| 					}, | ||||
| 					Expr: &expr.Variable{ | ||||
| 						Position: &position.Position{ | ||||
| 							StartLine: 1, | ||||
| 							EndLine:   1, | ||||
| 							StartPos:  11, | ||||
| 							EndPos:    12, | ||||
| 						}, | ||||
| 						VarName: &node.Identifier{ | ||||
| 							Position: &position.Position{ | ||||
| 								StartLine: 1, | ||||
| 								EndLine:   1, | ||||
| 								StartPos:  11, | ||||
| 								EndPos:    12, | ||||
| 							}, | ||||
| 							Value: "a", | ||||
| 						}, | ||||
| 					}, | ||||
| 				}, | ||||
| 			}, | ||||
| 		}, | ||||
| @ -151,10 +322,44 @@ func TestInt(t *testing.T) { | ||||
| 	src := `<? (integer)$a;` | ||||
| 
 | ||||
| 	expected := &node.Root{ | ||||
| 		Position: &position.Position{ | ||||
| 			StartLine: 1, | ||||
| 			EndLine:   1, | ||||
| 			StartPos:  4, | ||||
| 			EndPos:    15, | ||||
| 		}, | ||||
| 		Stmts: []node.Node{ | ||||
| 			&stmt.Expression{ | ||||
| 				Position: &position.Position{ | ||||
| 					StartLine: 1, | ||||
| 					EndLine:   1, | ||||
| 					StartPos:  4, | ||||
| 					EndPos:    15, | ||||
| 				}, | ||||
| 				Expr: &cast.Int{ | ||||
| 					Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}}, | ||||
| 					Position: &position.Position{ | ||||
| 						StartLine: 1, | ||||
| 						EndLine:   1, | ||||
| 						StartPos:  4, | ||||
| 						EndPos:    14, | ||||
| 					}, | ||||
| 					Expr: &expr.Variable{ | ||||
| 						Position: &position.Position{ | ||||
| 							StartLine: 1, | ||||
| 							EndLine:   1, | ||||
| 							StartPos:  13, | ||||
| 							EndPos:    14, | ||||
| 						}, | ||||
| 						VarName: &node.Identifier{ | ||||
| 							Position: &position.Position{ | ||||
| 								StartLine: 1, | ||||
| 								EndLine:   1, | ||||
| 								StartPos:  13, | ||||
| 								EndPos:    14, | ||||
| 							}, | ||||
| 							Value: "a", | ||||
| 						}, | ||||
| 					}, | ||||
| 				}, | ||||
| 			}, | ||||
| 		}, | ||||
| @ -175,10 +380,44 @@ func TestIntShort(t *testing.T) { | ||||
| 	src := `<? (int)$a;` | ||||
| 
 | ||||
| 	expected := &node.Root{ | ||||
| 		Position: &position.Position{ | ||||
| 			StartLine: 1, | ||||
| 			EndLine:   1, | ||||
| 			StartPos:  4, | ||||
| 			EndPos:    11, | ||||
| 		}, | ||||
| 		Stmts: []node.Node{ | ||||
| 			&stmt.Expression{ | ||||
| 				Position: &position.Position{ | ||||
| 					StartLine: 1, | ||||
| 					EndLine:   1, | ||||
| 					StartPos:  4, | ||||
| 					EndPos:    11, | ||||
| 				}, | ||||
| 				Expr: &cast.Int{ | ||||
| 					Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}}, | ||||
| 					Position: &position.Position{ | ||||
| 						StartLine: 1, | ||||
| 						EndLine:   1, | ||||
| 						StartPos:  4, | ||||
| 						EndPos:    10, | ||||
| 					}, | ||||
| 					Expr: &expr.Variable{ | ||||
| 						Position: &position.Position{ | ||||
| 							StartLine: 1, | ||||
| 							EndLine:   1, | ||||
| 							StartPos:  9, | ||||
| 							EndPos:    10, | ||||
| 						}, | ||||
| 						VarName: &node.Identifier{ | ||||
| 							Position: &position.Position{ | ||||
| 								StartLine: 1, | ||||
| 								EndLine:   1, | ||||
| 								StartPos:  9, | ||||
| 								EndPos:    10, | ||||
| 							}, | ||||
| 							Value: "a", | ||||
| 						}, | ||||
| 					}, | ||||
| 				}, | ||||
| 			}, | ||||
| 		}, | ||||
| @ -199,10 +438,44 @@ func TestObject(t *testing.T) { | ||||
| 	src := `<? (object)$a;` | ||||
| 
 | ||||
| 	expected := &node.Root{ | ||||
| 		Position: &position.Position{ | ||||
| 			StartLine: 1, | ||||
| 			EndLine:   1, | ||||
| 			StartPos:  4, | ||||
| 			EndPos:    14, | ||||
| 		}, | ||||
| 		Stmts: []node.Node{ | ||||
| 			&stmt.Expression{ | ||||
| 				Position: &position.Position{ | ||||
| 					StartLine: 1, | ||||
| 					EndLine:   1, | ||||
| 					StartPos:  4, | ||||
| 					EndPos:    14, | ||||
| 				}, | ||||
| 				Expr: &cast.Object{ | ||||
| 					Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}}, | ||||
| 					Position: &position.Position{ | ||||
| 						StartLine: 1, | ||||
| 						EndLine:   1, | ||||
| 						StartPos:  4, | ||||
| 						EndPos:    13, | ||||
| 					}, | ||||
| 					Expr: &expr.Variable{ | ||||
| 						Position: &position.Position{ | ||||
| 							StartLine: 1, | ||||
| 							EndLine:   1, | ||||
| 							StartPos:  12, | ||||
| 							EndPos:    13, | ||||
| 						}, | ||||
| 						VarName: &node.Identifier{ | ||||
| 							Position: &position.Position{ | ||||
| 								StartLine: 1, | ||||
| 								EndLine:   1, | ||||
| 								StartPos:  12, | ||||
| 								EndPos:    13, | ||||
| 							}, | ||||
| 							Value: "a", | ||||
| 						}, | ||||
| 					}, | ||||
| 				}, | ||||
| 			}, | ||||
| 		}, | ||||
| @ -223,10 +496,102 @@ func TestString(t *testing.T) { | ||||
| 	src := `<? (string)$a;` | ||||
| 
 | ||||
| 	expected := &node.Root{ | ||||
| 		Position: &position.Position{ | ||||
| 			StartLine: 1, | ||||
| 			EndLine:   1, | ||||
| 			StartPos:  4, | ||||
| 			EndPos:    14, | ||||
| 		}, | ||||
| 		Stmts: []node.Node{ | ||||
| 			&stmt.Expression{ | ||||
| 				Position: &position.Position{ | ||||
| 					StartLine: 1, | ||||
| 					EndLine:   1, | ||||
| 					StartPos:  4, | ||||
| 					EndPos:    14, | ||||
| 				}, | ||||
| 				Expr: &cast.String{ | ||||
| 					Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}}, | ||||
| 					Position: &position.Position{ | ||||
| 						StartLine: 1, | ||||
| 						EndLine:   1, | ||||
| 						StartPos:  4, | ||||
| 						EndPos:    13, | ||||
| 					}, | ||||
| 					Expr: &expr.Variable{ | ||||
| 						Position: &position.Position{ | ||||
| 							StartLine: 1, | ||||
| 							EndLine:   1, | ||||
| 							StartPos:  12, | ||||
| 							EndPos:    13, | ||||
| 						}, | ||||
| 						VarName: &node.Identifier{ | ||||
| 							Position: &position.Position{ | ||||
| 								StartLine: 1, | ||||
| 								EndLine:   1, | ||||
| 								StartPos:  12, | ||||
| 								EndPos:    13, | ||||
| 							}, | ||||
| 							Value: "a", | ||||
| 						}, | ||||
| 					}, | ||||
| 				}, | ||||
| 			}, | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assertEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assertEqual(t, expected, actual) | ||||
| } | ||||
| 
 | ||||
| func TestBinaryString(t *testing.T) { | ||||
| 	src := `<? (binary)$a;` | ||||
| 
 | ||||
| 	expected := &node.Root{ | ||||
| 		Position: &position.Position{ | ||||
| 			StartLine: 1, | ||||
| 			EndLine:   1, | ||||
| 			StartPos:  4, | ||||
| 			EndPos:    14, | ||||
| 		}, | ||||
| 		Stmts: []node.Node{ | ||||
| 			&stmt.Expression{ | ||||
| 				Position: &position.Position{ | ||||
| 					StartLine: 1, | ||||
| 					EndLine:   1, | ||||
| 					StartPos:  4, | ||||
| 					EndPos:    14, | ||||
| 				}, | ||||
| 				Expr: &cast.String{ | ||||
| 					Position: &position.Position{ | ||||
| 						StartLine: 1, | ||||
| 						EndLine:   1, | ||||
| 						StartPos:  4, | ||||
| 						EndPos:    13, | ||||
| 					}, | ||||
| 					Expr: &expr.Variable{ | ||||
| 						Position: &position.Position{ | ||||
| 							StartLine: 1, | ||||
| 							EndLine:   1, | ||||
| 							StartPos:  12, | ||||
| 							EndPos:    13, | ||||
| 						}, | ||||
| 						VarName: &node.Identifier{ | ||||
| 							Position: &position.Position{ | ||||
| 								StartLine: 1, | ||||
| 								EndLine:   1, | ||||
| 								StartPos:  12, | ||||
| 								EndPos:    13, | ||||
| 							}, | ||||
| 							Value: "a", | ||||
| 						}, | ||||
| 					}, | ||||
| 				}, | ||||
| 			}, | ||||
| 		}, | ||||
| @ -247,10 +612,44 @@ func TestUnset(t *testing.T) { | ||||
| 	src := `<? (unset)$a;` | ||||
| 
 | ||||
| 	expected := &node.Root{ | ||||
| 		Position: &position.Position{ | ||||
| 			StartLine: 1, | ||||
| 			EndLine:   1, | ||||
| 			StartPos:  4, | ||||
| 			EndPos:    13, | ||||
| 		}, | ||||
| 		Stmts: []node.Node{ | ||||
| 			&stmt.Expression{ | ||||
| 				Position: &position.Position{ | ||||
| 					StartLine: 1, | ||||
| 					EndLine:   1, | ||||
| 					StartPos:  4, | ||||
| 					EndPos:    13, | ||||
| 				}, | ||||
| 				Expr: &cast.Unset{ | ||||
| 					Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}}, | ||||
| 					Position: &position.Position{ | ||||
| 						StartLine: 1, | ||||
| 						EndLine:   1, | ||||
| 						StartPos:  4, | ||||
| 						EndPos:    12, | ||||
| 					}, | ||||
| 					Expr: &expr.Variable{ | ||||
| 						Position: &position.Position{ | ||||
| 							StartLine: 1, | ||||
| 							EndLine:   1, | ||||
| 							StartPos:  11, | ||||
| 							EndPos:    12, | ||||
| 						}, | ||||
| 						VarName: &node.Identifier{ | ||||
| 							Position: &position.Position{ | ||||
| 								StartLine: 1, | ||||
| 								EndLine:   1, | ||||
| 								StartPos:  11, | ||||
| 								EndPos:    12, | ||||
| 							}, | ||||
| 							Value: "a", | ||||
| 						}, | ||||
| 					}, | ||||
| 				}, | ||||
| 			}, | ||||
| 		}, | ||||
|  | ||||
| @ -2,21 +2,33 @@ package expr | ||||
| 
 | ||||
| import ( | ||||
| 	"github.com/z7zmey/php-parser/node" | ||||
| 	"github.com/z7zmey/php-parser/position" | ||||
| 	"github.com/z7zmey/php-parser/walker" | ||||
| ) | ||||
| 
 | ||||
| // Array node | ||||
| type Array struct { | ||||
| 	Items []node.Node | ||||
| 	Position *position.Position | ||||
| 	Items    []node.Node | ||||
| } | ||||
| 
 | ||||
| // NewArray node constructor | ||||
| func NewArray(Items []node.Node) *Array { | ||||
| 	return &Array{ | ||||
| 		Items, | ||||
| 		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 | ||||
| } | ||||
| 
 | ||||
| // Attributes returns node attributes as map | ||||
| func (n *Array) Attributes() map[string]interface{} { | ||||
| 	return nil | ||||
|  | ||||
| @ -2,11 +2,13 @@ package expr | ||||
| 
 | ||||
| import ( | ||||
| 	"github.com/z7zmey/php-parser/node" | ||||
| 	"github.com/z7zmey/php-parser/position" | ||||
| 	"github.com/z7zmey/php-parser/walker" | ||||
| ) | ||||
| 
 | ||||
| // ArrayDimFetch node | ||||
| type ArrayDimFetch struct { | ||||
| 	Position *position.Position | ||||
| 	Variable node.Node | ||||
| 	Dim      node.Node | ||||
| } | ||||
| @ -14,11 +16,21 @@ type ArrayDimFetch struct { | ||||
| // NewArrayDimFetch node constructor | ||||
| func NewArrayDimFetch(Variable node.Node, Dim node.Node) *ArrayDimFetch { | ||||
| 	return &ArrayDimFetch{ | ||||
| 		Variable, | ||||
| 		Dim, | ||||
| 		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 | ||||
| } | ||||
| 
 | ||||
| // Attributes returns node attributes as map | ||||
| func (n *ArrayDimFetch) Attributes() map[string]interface{} { | ||||
| 	return nil | ||||
|  | ||||
| @ -2,23 +2,35 @@ package expr | ||||
| 
 | ||||
| import ( | ||||
| 	"github.com/z7zmey/php-parser/node" | ||||
| 	"github.com/z7zmey/php-parser/position" | ||||
| 	"github.com/z7zmey/php-parser/walker" | ||||
| ) | ||||
| 
 | ||||
| // ArrayItem node | ||||
| type ArrayItem struct { | ||||
| 	Key node.Node | ||||
| 	Val node.Node | ||||
| 	Position *position.Position | ||||
| 	Key      node.Node | ||||
| 	Val      node.Node | ||||
| } | ||||
| 
 | ||||
| // NewArrayItem node constructor | ||||
| func NewArrayItem(Key node.Node, Val node.Node) *ArrayItem { | ||||
| 	return &ArrayItem{ | ||||
| 		Key, | ||||
| 		Val, | ||||
| 		Key: Key, | ||||
| 		Val: Val, | ||||
| 	} | ||||
| } | ||||
| 
 | ||||
| // 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 | ||||
| } | ||||
| 
 | ||||
| // Attributes returns node attributes as map | ||||
| func (n *ArrayItem) Attributes() map[string]interface{} { | ||||
| 	return nil | ||||
|  | ||||
| @ -2,21 +2,33 @@ package expr | ||||
| 
 | ||||
| import ( | ||||
| 	"github.com/z7zmey/php-parser/node" | ||||
| 	"github.com/z7zmey/php-parser/position" | ||||
| 	"github.com/z7zmey/php-parser/walker" | ||||
| ) | ||||
| 
 | ||||
| // BitwiseNot node | ||||
| type BitwiseNot struct { | ||||
| 	Expr node.Node | ||||
| 	Position *position.Position | ||||
| 	Expr     node.Node | ||||
| } | ||||
| 
 | ||||
| // NewBitwiseNot node constructor | ||||
| func NewBitwiseNot(Expression node.Node) *BitwiseNot { | ||||
| 	return &BitwiseNot{ | ||||
| 		Expression, | ||||
| 		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 | ||||
| } | ||||
| 
 | ||||
| // Attributes returns node attributes as map | ||||
| func (n *BitwiseNot) Attributes() map[string]interface{} { | ||||
| 	return nil | ||||
|  | ||||
| @ -2,21 +2,33 @@ package expr | ||||
| 
 | ||||
| import ( | ||||
| 	"github.com/z7zmey/php-parser/node" | ||||
| 	"github.com/z7zmey/php-parser/position" | ||||
| 	"github.com/z7zmey/php-parser/walker" | ||||
| ) | ||||
| 
 | ||||
| // BooleanNot node | ||||
| type BooleanNot struct { | ||||
| 	Expr node.Node | ||||
| 	Position *position.Position | ||||
| 	Expr     node.Node | ||||
| } | ||||
| 
 | ||||
| // NewBooleanNot node constructor | ||||
| func NewBooleanNot(Expression node.Node) *BooleanNot { | ||||
| 	return &BooleanNot{ | ||||
| 		Expression, | ||||
| 		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 | ||||
| } | ||||
| 
 | ||||
| // Attributes returns node attributes as map | ||||
| func (n *BooleanNot) Attributes() map[string]interface{} { | ||||
| 	return nil | ||||
|  | ||||
| @ -2,11 +2,13 @@ package expr | ||||
| 
 | ||||
| import ( | ||||
| 	"github.com/z7zmey/php-parser/node" | ||||
| 	"github.com/z7zmey/php-parser/position" | ||||
| 	"github.com/z7zmey/php-parser/walker" | ||||
| ) | ||||
| 
 | ||||
| // ClassConstFetch node | ||||
| type ClassConstFetch struct { | ||||
| 	Position     *position.Position | ||||
| 	Class        node.Node | ||||
| 	ConstantName node.Node | ||||
| } | ||||
| @ -14,11 +16,21 @@ type ClassConstFetch struct { | ||||
| // NewClassConstFetch node constructor | ||||
| func NewClassConstFetch(Class node.Node, ConstantName node.Node) *ClassConstFetch { | ||||
| 	return &ClassConstFetch{ | ||||
| 		Class, | ||||
| 		ConstantName, | ||||
| 		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 | ||||
| } | ||||
| 
 | ||||
| // Attributes returns node attributes as map | ||||
| func (n *ClassConstFetch) Attributes() map[string]interface{} { | ||||
| 	return nil | ||||
|  | ||||
| @ -2,21 +2,33 @@ package expr | ||||
| 
 | ||||
| import ( | ||||
| 	"github.com/z7zmey/php-parser/node" | ||||
| 	"github.com/z7zmey/php-parser/position" | ||||
| 	"github.com/z7zmey/php-parser/walker" | ||||
| ) | ||||
| 
 | ||||
| // Clone node | ||||
| type Clone struct { | ||||
| 	Expr node.Node | ||||
| 	Position *position.Position | ||||
| 	Expr     node.Node | ||||
| } | ||||
| 
 | ||||
| // NewClone node constructor | ||||
| func NewClone(Expression node.Node) *Clone { | ||||
| 	return &Clone{ | ||||
| 		Expression, | ||||
| 		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 | ||||
| } | ||||
| 
 | ||||
| // Attributes returns node attributes as map | ||||
| func (n *Clone) Attributes() map[string]interface{} { | ||||
| 	return nil | ||||
|  | ||||
| @ -2,11 +2,13 @@ package expr | ||||
| 
 | ||||
| import ( | ||||
| 	"github.com/z7zmey/php-parser/node" | ||||
| 	"github.com/z7zmey/php-parser/position" | ||||
| 	"github.com/z7zmey/php-parser/walker" | ||||
| ) | ||||
| 
 | ||||
| // Closure node | ||||
| type Closure struct { | ||||
| 	Position      *position.Position | ||||
| 	ReturnsRef    bool | ||||
| 	Static        bool | ||||
| 	PhpDocComment string | ||||
| @ -19,16 +21,26 @@ type Closure struct { | ||||
| // 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{ | ||||
| 		ReturnsRef, | ||||
| 		Static, | ||||
| 		PhpDocComment, | ||||
| 		Params, | ||||
| 		ClosureUse, | ||||
| 		ReturnType, | ||||
| 		Stmts, | ||||
| 		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 | ||||
| } | ||||
| 
 | ||||
| // Attributes returns node attributes as map | ||||
| func (n *Closure) Attributes() map[string]interface{} { | ||||
| 	return map[string]interface{}{ | ||||
|  | ||||
| @ -2,21 +2,33 @@ package expr | ||||
| 
 | ||||
| import ( | ||||
| 	"github.com/z7zmey/php-parser/node" | ||||
| 	"github.com/z7zmey/php-parser/position" | ||||
| 	"github.com/z7zmey/php-parser/walker" | ||||
| ) | ||||
| 
 | ||||
| // ClosureUse node | ||||
| type ClosureUse struct { | ||||
| 	Uses []node.Node | ||||
| 	Position *position.Position | ||||
| 	Uses     []node.Node | ||||
| } | ||||
| 
 | ||||
| // NewClosureUse node constructor | ||||
| func NewClosureUse(Uses []node.Node) *ClosureUse { | ||||
| 	return &ClosureUse{ | ||||
| 		Uses, | ||||
| 		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 | ||||
| } | ||||
| 
 | ||||
| // Attributes returns node attributes as map | ||||
| func (n *ClosureUse) Attributes() map[string]interface{} { | ||||
| 	return nil | ||||
|  | ||||
| @ -2,21 +2,33 @@ package expr | ||||
| 
 | ||||
| import ( | ||||
| 	"github.com/z7zmey/php-parser/node" | ||||
| 	"github.com/z7zmey/php-parser/position" | ||||
| 	"github.com/z7zmey/php-parser/walker" | ||||
| ) | ||||
| 
 | ||||
| // ConstFetch node | ||||
| type ConstFetch struct { | ||||
| 	Position *position.Position | ||||
| 	Constant node.Node | ||||
| } | ||||
| 
 | ||||
| // NewConstFetch node constructor | ||||
| func NewConstFetch(Constant node.Node) *ConstFetch { | ||||
| 	return &ConstFetch{ | ||||
| 		Constant, | ||||
| 		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 | ||||
| } | ||||
| 
 | ||||
| // Attributes returns node attributes as map | ||||
| func (n *ConstFetch) Attributes() map[string]interface{} { | ||||
| 	return nil | ||||
|  | ||||
| @ -2,21 +2,33 @@ package expr | ||||
| 
 | ||||
| import ( | ||||
| 	"github.com/z7zmey/php-parser/node" | ||||
| 	"github.com/z7zmey/php-parser/position" | ||||
| 	"github.com/z7zmey/php-parser/walker" | ||||
| ) | ||||
| 
 | ||||
| // Die node | ||||
| type Die struct { | ||||
| 	Expr node.Node | ||||
| 	Position *position.Position | ||||
| 	Expr     node.Node | ||||
| } | ||||
| 
 | ||||
| // NewDie node constructor | ||||
| func NewDie(Expr node.Node) *Die { | ||||
| 	return &Die{ | ||||
| 		Expr, | ||||
| 		Expr: Expr, | ||||
| 	} | ||||
| } | ||||
| 
 | ||||
| // SetPosition sets node position | ||||
| func (n *Die) SetPosition(p *position.Position) { | ||||
| 	n.Position = p | ||||
| } | ||||
| 
 | ||||
| // GetPosition returns node positions | ||||
| func (n *Die) GetPosition() *position.Position { | ||||
| 	return n.Position | ||||
| } | ||||
| 
 | ||||
| // Attributes returns node attributes as map | ||||
| func (n *Die) Attributes() map[string]interface{} { | ||||
| 	return nil | ||||
|  | ||||
| @ -2,21 +2,33 @@ package expr | ||||
| 
 | ||||
| import ( | ||||
| 	"github.com/z7zmey/php-parser/node" | ||||
| 	"github.com/z7zmey/php-parser/position" | ||||
| 	"github.com/z7zmey/php-parser/walker" | ||||
| ) | ||||
| 
 | ||||
| // Empty node | ||||
| type Empty struct { | ||||
| 	Expr node.Node | ||||
| 	Position *position.Position | ||||
| 	Expr     node.Node | ||||
| } | ||||
| 
 | ||||
| // NewEmpty node constructor | ||||
| func NewEmpty(Expression node.Node) *Empty { | ||||
| 	return &Empty{ | ||||
| 		Expression, | ||||
| 		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 | ||||
| } | ||||
| 
 | ||||
| // Attributes returns node attributes as map | ||||
| func (n *Empty) Attributes() map[string]interface{} { | ||||
| 	return nil | ||||
|  | ||||
| @ -2,21 +2,33 @@ package expr | ||||
| 
 | ||||
| import ( | ||||
| 	"github.com/z7zmey/php-parser/node" | ||||
| 	"github.com/z7zmey/php-parser/position" | ||||
| 	"github.com/z7zmey/php-parser/walker" | ||||
| ) | ||||
| 
 | ||||
| // ErrorSuppress node | ||||
| type ErrorSuppress struct { | ||||
| 	Expr node.Node | ||||
| 	Position *position.Position | ||||
| 	Expr     node.Node | ||||
| } | ||||
| 
 | ||||
| // NewErrorSuppress node constructor | ||||
| func NewErrorSuppress(Expression node.Node) *ErrorSuppress { | ||||
| 	return &ErrorSuppress{ | ||||
| 		Expression, | ||||
| 		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 | ||||
| } | ||||
| 
 | ||||
| // Attributes returns node attributes as map | ||||
| func (n *ErrorSuppress) Attributes() map[string]interface{} { | ||||
| 	return nil | ||||
|  | ||||
| @ -2,21 +2,33 @@ package expr | ||||
| 
 | ||||
| import ( | ||||
| 	"github.com/z7zmey/php-parser/node" | ||||
| 	"github.com/z7zmey/php-parser/position" | ||||
| 	"github.com/z7zmey/php-parser/walker" | ||||
| ) | ||||
| 
 | ||||
| // Eval node | ||||
| type Eval struct { | ||||
| 	Expr node.Node | ||||
| 	Position *position.Position | ||||
| 	Expr     node.Node | ||||
| } | ||||
| 
 | ||||
| // NewEval node constructor | ||||
| func NewEval(Expression node.Node) *Eval { | ||||
| 	return &Eval{ | ||||
| 		Expression, | ||||
| 		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 | ||||
| } | ||||
| 
 | ||||
| // Attributes returns node attributes as map | ||||
| func (n *Eval) Attributes() map[string]interface{} { | ||||
| 	return nil | ||||
|  | ||||
| @ -2,21 +2,33 @@ package expr | ||||
| 
 | ||||
| import ( | ||||
| 	"github.com/z7zmey/php-parser/node" | ||||
| 	"github.com/z7zmey/php-parser/position" | ||||
| 	"github.com/z7zmey/php-parser/walker" | ||||
| ) | ||||
| 
 | ||||
| // Exit node | ||||
| type Exit struct { | ||||
| 	Expr node.Node | ||||
| 	Position *position.Position | ||||
| 	Expr     node.Node | ||||
| } | ||||
| 
 | ||||
| // NewExit node constructor | ||||
| func NewExit(Expr node.Node) *Exit { | ||||
| 	return &Exit{ | ||||
| 		Expr, | ||||
| 		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 | ||||
| } | ||||
| 
 | ||||
| // Attributes returns node attributes as map | ||||
| func (n *Exit) Attributes() map[string]interface{} { | ||||
| 	return nil | ||||
|  | ||||
| @ -2,11 +2,13 @@ package expr | ||||
| 
 | ||||
| import ( | ||||
| 	"github.com/z7zmey/php-parser/node" | ||||
| 	"github.com/z7zmey/php-parser/position" | ||||
| 	"github.com/z7zmey/php-parser/walker" | ||||
| ) | ||||
| 
 | ||||
| // FunctionCall node | ||||
| type FunctionCall struct { | ||||
| 	Position     *position.Position | ||||
| 	Function     node.Node | ||||
| 	ArgumentList *node.ArgumentList | ||||
| } | ||||
| @ -14,11 +16,21 @@ type FunctionCall struct { | ||||
| // NewFunctionCall node constructor | ||||
| func NewFunctionCall(Function node.Node, ArgumentList *node.ArgumentList) *FunctionCall { | ||||
| 	return &FunctionCall{ | ||||
| 		Function, | ||||
| 		ArgumentList, | ||||
| 		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 | ||||
| } | ||||
| 
 | ||||
| // Attributes returns node attributes as map | ||||
| func (n *FunctionCall) Attributes() map[string]interface{} { | ||||
| 	return nil | ||||
|  | ||||
| @ -2,21 +2,33 @@ package expr | ||||
| 
 | ||||
| import ( | ||||
| 	"github.com/z7zmey/php-parser/node" | ||||
| 	"github.com/z7zmey/php-parser/position" | ||||
| 	"github.com/z7zmey/php-parser/walker" | ||||
| ) | ||||
| 
 | ||||
| // Include node | ||||
| type Include struct { | ||||
| 	Expr node.Node | ||||
| 	Position *position.Position | ||||
| 	Expr     node.Node | ||||
| } | ||||
| 
 | ||||
| // NewInclude node constructor | ||||
| func NewInclude(Expression node.Node) *Include { | ||||
| 	return &Include{ | ||||
| 		Expression, | ||||
| 		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 | ||||
| } | ||||
| 
 | ||||
| // Attributes returns node attributes as map | ||||
| func (n *Include) Attributes() map[string]interface{} { | ||||
| 	return nil | ||||
|  | ||||
| @ -2,21 +2,33 @@ package expr | ||||
| 
 | ||||
| import ( | ||||
| 	"github.com/z7zmey/php-parser/node" | ||||
| 	"github.com/z7zmey/php-parser/position" | ||||
| 	"github.com/z7zmey/php-parser/walker" | ||||
| ) | ||||
| 
 | ||||
| // IncludeOnce node | ||||
| type IncludeOnce struct { | ||||
| 	Expr node.Node | ||||
| 	Position *position.Position | ||||
| 	Expr     node.Node | ||||
| } | ||||
| 
 | ||||
| // NewIncludeOnce node constructor | ||||
| func NewIncludeOnce(Expression node.Node) *IncludeOnce { | ||||
| 	return &IncludeOnce{ | ||||
| 		Expression, | ||||
| 		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 | ||||
| } | ||||
| 
 | ||||
| // Attributes returns node attributes as map | ||||
| func (n *IncludeOnce) Attributes() map[string]interface{} { | ||||
| 	return nil | ||||
|  | ||||
| @ -2,23 +2,35 @@ package expr | ||||
| 
 | ||||
| import ( | ||||
| 	"github.com/z7zmey/php-parser/node" | ||||
| 	"github.com/z7zmey/php-parser/position" | ||||
| 	"github.com/z7zmey/php-parser/walker" | ||||
| ) | ||||
| 
 | ||||
| // InstanceOf node | ||||
| type InstanceOf struct { | ||||
| 	Expr  node.Node | ||||
| 	Class node.Node | ||||
| 	Position *position.Position | ||||
| 	Expr     node.Node | ||||
| 	Class    node.Node | ||||
| } | ||||
| 
 | ||||
| // NewInstanceOf node constructor | ||||
| func NewInstanceOf(Expr node.Node, Class node.Node) *InstanceOf { | ||||
| 	return &InstanceOf{ | ||||
| 		Expr, | ||||
| 		Class, | ||||
| 		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 | ||||
| } | ||||
| 
 | ||||
| // Attributes returns node attributes as map | ||||
| func (n *InstanceOf) Attributes() map[string]interface{} { | ||||
| 	return nil | ||||
|  | ||||
| @ -2,21 +2,33 @@ package expr | ||||
| 
 | ||||
| import ( | ||||
| 	"github.com/z7zmey/php-parser/node" | ||||
| 	"github.com/z7zmey/php-parser/position" | ||||
| 	"github.com/z7zmey/php-parser/walker" | ||||
| ) | ||||
| 
 | ||||
| // Isset node | ||||
| type Isset struct { | ||||
| 	Position  *position.Position | ||||
| 	Variables []node.Node | ||||
| } | ||||
| 
 | ||||
| // NewIsset node constructor | ||||
| func NewIsset(Variables []node.Node) *Isset { | ||||
| 	return &Isset{ | ||||
| 		Variables, | ||||
| 		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 | ||||
| } | ||||
| 
 | ||||
| // Attributes returns node attributes as map | ||||
| func (n *Isset) Attributes() map[string]interface{} { | ||||
| 	return nil | ||||
|  | ||||
| @ -2,21 +2,33 @@ package expr | ||||
| 
 | ||||
| import ( | ||||
| 	"github.com/z7zmey/php-parser/node" | ||||
| 	"github.com/z7zmey/php-parser/position" | ||||
| 	"github.com/z7zmey/php-parser/walker" | ||||
| ) | ||||
| 
 | ||||
| // List node | ||||
| type List struct { | ||||
| 	Items []node.Node | ||||
| 	Position *position.Position | ||||
| 	Items    []node.Node | ||||
| } | ||||
| 
 | ||||
| // NewList node constructor | ||||
| func NewList(Items []node.Node) *List { | ||||
| 	return &List{ | ||||
| 		Items, | ||||
| 		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 | ||||
| } | ||||
| 
 | ||||
| // Attributes returns node attributes as map | ||||
| func (n *List) Attributes() map[string]interface{} { | ||||
| 	return nil | ||||
|  | ||||
| @ -2,11 +2,13 @@ package expr | ||||
| 
 | ||||
| import ( | ||||
| 	"github.com/z7zmey/php-parser/node" | ||||
| 	"github.com/z7zmey/php-parser/position" | ||||
| 	"github.com/z7zmey/php-parser/walker" | ||||
| ) | ||||
| 
 | ||||
| // MethodCall node | ||||
| type MethodCall struct { | ||||
| 	Position     *position.Position | ||||
| 	Variable     node.Node | ||||
| 	Method       node.Node | ||||
| 	ArgumentList *node.ArgumentList | ||||
| @ -15,12 +17,22 @@ type MethodCall struct { | ||||
| // NewMethodCall node constructor | ||||
| func NewMethodCall(Variable node.Node, Method node.Node, ArgumentList *node.ArgumentList) *MethodCall { | ||||
| 	return &MethodCall{ | ||||
| 		Variable, | ||||
| 		Method, | ||||
| 		ArgumentList, | ||||
| 		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 | ||||
| } | ||||
| 
 | ||||
| // Attributes returns node attributes as map | ||||
| func (n *MethodCall) Attributes() map[string]interface{} { | ||||
| 	return nil | ||||
|  | ||||
| @ -2,11 +2,13 @@ package expr | ||||
| 
 | ||||
| import ( | ||||
| 	"github.com/z7zmey/php-parser/node" | ||||
| 	"github.com/z7zmey/php-parser/position" | ||||
| 	"github.com/z7zmey/php-parser/walker" | ||||
| ) | ||||
| 
 | ||||
| // New node | ||||
| type New struct { | ||||
| 	Position     *position.Position | ||||
| 	Class        node.Node | ||||
| 	ArgumentList *node.ArgumentList | ||||
| } | ||||
| @ -14,11 +16,21 @@ type New struct { | ||||
| // NewNew node constructor | ||||
| func NewNew(Class node.Node, ArgumentList *node.ArgumentList) *New { | ||||
| 	return &New{ | ||||
| 		Class, | ||||
| 		ArgumentList, | ||||
| 		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 | ||||
| } | ||||
| 
 | ||||
| // Attributes returns node attributes as map | ||||
| func (n *New) Attributes() map[string]interface{} { | ||||
| 	return nil | ||||
|  | ||||
| @ -2,21 +2,33 @@ package expr | ||||
| 
 | ||||
| import ( | ||||
| 	"github.com/z7zmey/php-parser/node" | ||||
| 	"github.com/z7zmey/php-parser/position" | ||||
| 	"github.com/z7zmey/php-parser/walker" | ||||
| ) | ||||
| 
 | ||||
| // PostDec node | ||||
| type PostDec struct { | ||||
| 	Position *position.Position | ||||
| 	Variable node.Node | ||||
| } | ||||
| 
 | ||||
| // NewPostDec node constructor | ||||
| func NewPostDec(Variable node.Node) *PostDec { | ||||
| 	return &PostDec{ | ||||
| 		Variable, | ||||
| 		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 | ||||
| } | ||||
| 
 | ||||
| // Attributes returns node attributes as map | ||||
| func (n *PostDec) Attributes() map[string]interface{} { | ||||
| 	return nil | ||||
|  | ||||
| @ -2,21 +2,33 @@ package expr | ||||
| 
 | ||||
| import ( | ||||
| 	"github.com/z7zmey/php-parser/node" | ||||
| 	"github.com/z7zmey/php-parser/position" | ||||
| 	"github.com/z7zmey/php-parser/walker" | ||||
| ) | ||||
| 
 | ||||
| // PostInc node | ||||
| type PostInc struct { | ||||
| 	Position *position.Position | ||||
| 	Variable node.Node | ||||
| } | ||||
| 
 | ||||
| // NewPostInc node constructor | ||||
| func NewPostInc(Variable node.Node) *PostInc { | ||||
| 	return &PostInc{ | ||||
| 		Variable, | ||||
| 		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 | ||||
| } | ||||
| 
 | ||||
| // Attributes returns node attributes as map | ||||
| func (n *PostInc) Attributes() map[string]interface{} { | ||||
| 	return nil | ||||
|  | ||||
| @ -2,21 +2,33 @@ package expr | ||||
| 
 | ||||
| import ( | ||||
| 	"github.com/z7zmey/php-parser/node" | ||||
| 	"github.com/z7zmey/php-parser/position" | ||||
| 	"github.com/z7zmey/php-parser/walker" | ||||
| ) | ||||
| 
 | ||||
| // PreDec node | ||||
| type PreDec struct { | ||||
| 	Position *position.Position | ||||
| 	Variable node.Node | ||||
| } | ||||
| 
 | ||||
| // NewPreDec node constructor | ||||
| func NewPreDec(Variable node.Node) *PreDec { | ||||
| 	return &PreDec{ | ||||
| 		Variable, | ||||
| 		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 | ||||
| } | ||||
| 
 | ||||
| // Attributes returns node attributes as map | ||||
| func (n *PreDec) Attributes() map[string]interface{} { | ||||
| 	return nil | ||||
|  | ||||
| @ -2,21 +2,33 @@ package expr | ||||
| 
 | ||||
| import ( | ||||
| 	"github.com/z7zmey/php-parser/node" | ||||
| 	"github.com/z7zmey/php-parser/position" | ||||
| 	"github.com/z7zmey/php-parser/walker" | ||||
| ) | ||||
| 
 | ||||
| // PreInc node | ||||
| type PreInc struct { | ||||
| 	Position *position.Position | ||||
| 	Variable node.Node | ||||
| } | ||||
| 
 | ||||
| // NewPreInc node constructor | ||||
| func NewPreInc(Variable node.Node) *PreInc { | ||||
| 	return &PreInc{ | ||||
| 		Variable, | ||||
| 		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 | ||||
| } | ||||
| 
 | ||||
| // Attributes returns node attributes as map | ||||
| func (n *PreInc) Attributes() map[string]interface{} { | ||||
| 	return nil | ||||
|  | ||||
| @ -2,21 +2,33 @@ package expr | ||||
| 
 | ||||
| import ( | ||||
| 	"github.com/z7zmey/php-parser/node" | ||||
| 	"github.com/z7zmey/php-parser/position" | ||||
| 	"github.com/z7zmey/php-parser/walker" | ||||
| ) | ||||
| 
 | ||||
| // Print node | ||||
| type Print struct { | ||||
| 	Expr node.Node | ||||
| 	Position *position.Position | ||||
| 	Expr     node.Node | ||||
| } | ||||
| 
 | ||||
| // NewPrint node constructor | ||||
| func NewPrint(Expression node.Node) *Print { | ||||
| 	return &Print{ | ||||
| 		Expression, | ||||
| 		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 | ||||
| } | ||||
| 
 | ||||
| // Attributes returns node attributes as map | ||||
| func (n *Print) Attributes() map[string]interface{} { | ||||
| 	return nil | ||||
|  | ||||
| @ -2,11 +2,13 @@ package expr | ||||
| 
 | ||||
| import ( | ||||
| 	"github.com/z7zmey/php-parser/node" | ||||
| 	"github.com/z7zmey/php-parser/position" | ||||
| 	"github.com/z7zmey/php-parser/walker" | ||||
| ) | ||||
| 
 | ||||
| // PropertyFetch node | ||||
| type PropertyFetch struct { | ||||
| 	Position *position.Position | ||||
| 	Variable node.Node | ||||
| 	Property node.Node | ||||
| } | ||||
| @ -14,11 +16,21 @@ type PropertyFetch struct { | ||||
| // NewPropertyFetch node constructor | ||||
| func NewPropertyFetch(Variable node.Node, Property node.Node) *PropertyFetch { | ||||
| 	return &PropertyFetch{ | ||||
| 		Variable, | ||||
| 		Property, | ||||
| 		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 | ||||
| } | ||||
| 
 | ||||
| // Attributes returns node attributes as map | ||||
| func (n *PropertyFetch) Attributes() map[string]interface{} { | ||||
| 	return nil | ||||
|  | ||||
| @ -2,21 +2,33 @@ package expr | ||||
| 
 | ||||
| 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 | ||||
| } | ||||
| 
 | ||||
| // NewReference node constructor | ||||
| func NewReference(Variable node.Node) *Reference { | ||||
| 	return &Reference{ | ||||
| 		Variable, | ||||
| 		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 | ||||
| } | ||||
| 
 | ||||
| // Attributes returns node attributes as map | ||||
| func (n *Reference) Attributes() map[string]interface{} { | ||||
| 	return nil | ||||
|  | ||||
| @ -2,21 +2,33 @@ package expr | ||||
| 
 | ||||
| import ( | ||||
| 	"github.com/z7zmey/php-parser/node" | ||||
| 	"github.com/z7zmey/php-parser/position" | ||||
| 	"github.com/z7zmey/php-parser/walker" | ||||
| ) | ||||
| 
 | ||||
| // Require node | ||||
| type Require struct { | ||||
| 	Expr node.Node | ||||
| 	Position *position.Position | ||||
| 	Expr     node.Node | ||||
| } | ||||
| 
 | ||||
| // NewRequire node constructor | ||||
| func NewRequire(Expression node.Node) *Require { | ||||
| 	return &Require{ | ||||
| 		Expression, | ||||
| 		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 | ||||
| } | ||||
| 
 | ||||
| // Attributes returns node attributes as map | ||||
| func (n *Require) Attributes() map[string]interface{} { | ||||
| 	return nil | ||||
|  | ||||
| @ -2,21 +2,33 @@ package expr | ||||
| 
 | ||||
| import ( | ||||
| 	"github.com/z7zmey/php-parser/node" | ||||
| 	"github.com/z7zmey/php-parser/position" | ||||
| 	"github.com/z7zmey/php-parser/walker" | ||||
| ) | ||||
| 
 | ||||
| // RequireOnce node | ||||
| type RequireOnce struct { | ||||
| 	Expr node.Node | ||||
| 	Position *position.Position | ||||
| 	Expr     node.Node | ||||
| } | ||||
| 
 | ||||
| // NewRequireOnce node constructor | ||||
| func NewRequireOnce(Expression node.Node) *RequireOnce { | ||||
| 	return &RequireOnce{ | ||||
| 		Expression, | ||||
| 		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 | ||||
| } | ||||
| 
 | ||||
| // Attributes returns node attributes as map | ||||
| func (n *RequireOnce) Attributes() map[string]interface{} { | ||||
| 	return nil | ||||
|  | ||||
| @ -2,21 +2,33 @@ package expr | ||||
| 
 | ||||
| import ( | ||||
| 	"github.com/z7zmey/php-parser/node" | ||||
| 	"github.com/z7zmey/php-parser/position" | ||||
| 	"github.com/z7zmey/php-parser/walker" | ||||
| ) | ||||
| 
 | ||||
| // ShellExec node | ||||
| type ShellExec struct { | ||||
| 	Parts []node.Node | ||||
| 	Position *position.Position | ||||
| 	Parts    []node.Node | ||||
| } | ||||
| 
 | ||||
| // NewShellExec node constructor | ||||
| func NewShellExec(Parts []node.Node) *ShellExec { | ||||
| 	return &ShellExec{ | ||||
| 		Parts, | ||||
| 		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 | ||||
| } | ||||
| 
 | ||||
| // Attributes returns node attributes as map | ||||
| func (n *ShellExec) Attributes() map[string]interface{} { | ||||
| 	return nil | ||||
|  | ||||
| @ -2,21 +2,33 @@ package expr | ||||
| 
 | ||||
| import ( | ||||
| 	"github.com/z7zmey/php-parser/node" | ||||
| 	"github.com/z7zmey/php-parser/position" | ||||
| 	"github.com/z7zmey/php-parser/walker" | ||||
| ) | ||||
| 
 | ||||
| // ShortArray node | ||||
| type ShortArray struct { | ||||
| 	Items []node.Node | ||||
| 	Position *position.Position | ||||
| 	Items    []node.Node | ||||
| } | ||||
| 
 | ||||
| // NewShortArray node constructor | ||||
| func NewShortArray(Items []node.Node) *ShortArray { | ||||
| 	return &ShortArray{ | ||||
| 		Items, | ||||
| 		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 | ||||
| } | ||||
| 
 | ||||
| // Attributes returns node attributes as map | ||||
| func (n *ShortArray) Attributes() map[string]interface{} { | ||||
| 	return nil | ||||
|  | ||||
| @ -2,21 +2,33 @@ package expr | ||||
| 
 | ||||
| import ( | ||||
| 	"github.com/z7zmey/php-parser/node" | ||||
| 	"github.com/z7zmey/php-parser/position" | ||||
| 	"github.com/z7zmey/php-parser/walker" | ||||
| ) | ||||
| 
 | ||||
| // ShortList node | ||||
| type ShortList struct { | ||||
| 	Items []node.Node | ||||
| 	Position *position.Position | ||||
| 	Items    []node.Node | ||||
| } | ||||
| 
 | ||||
| // NewShortList node constructor | ||||
| func NewShortList(Items []node.Node) *ShortList { | ||||
| 	return &ShortList{ | ||||
| 		Items, | ||||
| 		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 | ||||
| } | ||||
| 
 | ||||
| // Attributes returns node attributes as map | ||||
| func (n *ShortList) Attributes() map[string]interface{} { | ||||
| 	return nil | ||||
|  | ||||
| @ -2,11 +2,13 @@ package expr | ||||
| 
 | ||||
| import ( | ||||
| 	"github.com/z7zmey/php-parser/node" | ||||
| 	"github.com/z7zmey/php-parser/position" | ||||
| 	"github.com/z7zmey/php-parser/walker" | ||||
| ) | ||||
| 
 | ||||
| // StaticCall node | ||||
| type StaticCall struct { | ||||
| 	Position     *position.Position | ||||
| 	Class        node.Node | ||||
| 	Call         node.Node | ||||
| 	ArgumentList *node.ArgumentList | ||||
| @ -15,12 +17,22 @@ type StaticCall struct { | ||||
| // NewStaticCall node constructor | ||||
| func NewStaticCall(Class node.Node, Call node.Node, ArgumentList *node.ArgumentList) *StaticCall { | ||||
| 	return &StaticCall{ | ||||
| 		Class, | ||||
| 		Call, | ||||
| 		ArgumentList, | ||||
| 		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 | ||||
| } | ||||
| 
 | ||||
| // Attributes returns node attributes as map | ||||
| func (n *StaticCall) Attributes() map[string]interface{} { | ||||
| 	return nil | ||||
|  | ||||
| @ -2,11 +2,13 @@ package expr | ||||
| 
 | ||||
| import ( | ||||
| 	"github.com/z7zmey/php-parser/node" | ||||
| 	"github.com/z7zmey/php-parser/position" | ||||
| 	"github.com/z7zmey/php-parser/walker" | ||||
| ) | ||||
| 
 | ||||
| // StaticPropertyFetch node | ||||
| type StaticPropertyFetch struct { | ||||
| 	Position *position.Position | ||||
| 	Class    node.Node | ||||
| 	Property node.Node | ||||
| } | ||||
| @ -14,11 +16,21 @@ type StaticPropertyFetch struct { | ||||
| // NewStaticPropertyFetch node constructor | ||||
| func NewStaticPropertyFetch(Class node.Node, Property node.Node) *StaticPropertyFetch { | ||||
| 	return &StaticPropertyFetch{ | ||||
| 		Class, | ||||
| 		Property, | ||||
| 		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 | ||||
| } | ||||
| 
 | ||||
| // Attributes returns node attributes as map | ||||
| func (n *StaticPropertyFetch) Attributes() map[string]interface{} { | ||||
| 	return nil | ||||
|  | ||||
| @ -2,11 +2,13 @@ package expr | ||||
| 
 | ||||
| import ( | ||||
| 	"github.com/z7zmey/php-parser/node" | ||||
| 	"github.com/z7zmey/php-parser/position" | ||||
| 	"github.com/z7zmey/php-parser/walker" | ||||
| ) | ||||
| 
 | ||||
| // Ternary node | ||||
| type Ternary struct { | ||||
| 	Position  *position.Position | ||||
| 	Condition node.Node | ||||
| 	IfTrue    node.Node | ||||
| 	IfFalse   node.Node | ||||
| @ -15,12 +17,22 @@ type Ternary struct { | ||||
| // NewTernary node constructor | ||||
| func NewTernary(Condition node.Node, IfTrue node.Node, IfFalse node.Node) *Ternary { | ||||
| 	return &Ternary{ | ||||
| 		Condition, | ||||
| 		IfTrue, | ||||
| 		IfFalse, | ||||
| 		Condition: Condition, | ||||
| 		IfTrue:    IfTrue, | ||||
| 		IfFalse:   IfFalse, | ||||
| 	} | ||||
| } | ||||
| 
 | ||||
| // SetPosition sets node position | ||||
| func (n *Ternary) SetPosition(p *position.Position) { | ||||
| 	n.Position = p | ||||
| } | ||||
| 
 | ||||
| // GetPosition returns node positions | ||||
| func (n *Ternary) GetPosition() *position.Position { | ||||
| 	return n.Position | ||||
| } | ||||
| 
 | ||||
| // Attributes returns node attributes as map | ||||
| func (n *Ternary) Attributes() map[string]interface{} { | ||||
| 	return nil | ||||
|  | ||||
| @ -2,21 +2,33 @@ package expr | ||||
| 
 | ||||
| import ( | ||||
| 	"github.com/z7zmey/php-parser/node" | ||||
| 	"github.com/z7zmey/php-parser/position" | ||||
| 	"github.com/z7zmey/php-parser/walker" | ||||
| ) | ||||
| 
 | ||||
| // UnaryMinus node | ||||
| type UnaryMinus struct { | ||||
| 	Expr node.Node | ||||
| 	Position *position.Position | ||||
| 	Expr     node.Node | ||||
| } | ||||
| 
 | ||||
| // NewUnaryMinus node constructor | ||||
| func NewUnaryMinus(Expression node.Node) *UnaryMinus { | ||||
| 	return &UnaryMinus{ | ||||
| 		Expression, | ||||
| 		Expr: Expression, | ||||
| 	} | ||||
| } | ||||
| 
 | ||||
| // SetPosition sets node position | ||||
| func (n *UnaryMinus) SetPosition(p *position.Position) { | ||||
| 	n.Position = p | ||||
| } | ||||
| 
 | ||||
| // GetPosition returns node positions | ||||
| func (n *UnaryMinus) GetPosition() *position.Position { | ||||
| 	return n.Position | ||||
| } | ||||
| 
 | ||||
| // Attributes returns node attributes as map | ||||
| func (n *UnaryMinus) Attributes() map[string]interface{} { | ||||
| 	return nil | ||||
|  | ||||
| @ -2,21 +2,33 @@ package expr | ||||
| 
 | ||||
| import ( | ||||
| 	"github.com/z7zmey/php-parser/node" | ||||
| 	"github.com/z7zmey/php-parser/position" | ||||
| 	"github.com/z7zmey/php-parser/walker" | ||||
| ) | ||||
| 
 | ||||
| // UnaryPlus node | ||||
| type UnaryPlus struct { | ||||
| 	Expr node.Node | ||||
| 	Position *position.Position | ||||
| 	Expr     node.Node | ||||
| } | ||||
| 
 | ||||
| // NewUnaryPlus node constructor | ||||
| func NewUnaryPlus(Expression node.Node) *UnaryPlus { | ||||
| 	return &UnaryPlus{ | ||||
| 		Expression, | ||||
| 		Expr: Expression, | ||||
| 	} | ||||
| } | ||||
| 
 | ||||
| // SetPosition sets node position | ||||
| func (n *UnaryPlus) SetPosition(p *position.Position) { | ||||
| 	n.Position = p | ||||
| } | ||||
| 
 | ||||
| // GetPosition returns node positions | ||||
| func (n *UnaryPlus) GetPosition() *position.Position { | ||||
| 	return n.Position | ||||
| } | ||||
| 
 | ||||
| // Attributes returns node attributes as map | ||||
| func (n *UnaryPlus) Attributes() map[string]interface{} { | ||||
| 	return nil | ||||
|  | ||||
| @ -2,21 +2,33 @@ package expr | ||||
| 
 | ||||
| import ( | ||||
| 	"github.com/z7zmey/php-parser/node" | ||||
| 	"github.com/z7zmey/php-parser/position" | ||||
| 	"github.com/z7zmey/php-parser/walker" | ||||
| ) | ||||
| 
 | ||||
| // Variable node | ||||
| type Variable struct { | ||||
| 	VarName node.Node | ||||
| 	Position *position.Position | ||||
| 	VarName  node.Node | ||||
| } | ||||
| 
 | ||||
| // NewVariable node constructor | ||||
| func NewVariable(VarName node.Node) *Variable { | ||||
| 	return &Variable{ | ||||
| 		VarName, | ||||
| 		VarName: VarName, | ||||
| 	} | ||||
| } | ||||
| 
 | ||||
| // SetPosition sets node position | ||||
| func (n *Variable) SetPosition(p *position.Position) { | ||||
| 	n.Position = p | ||||
| } | ||||
| 
 | ||||
| // GetPosition returns node positions | ||||
| func (n *Variable) GetPosition() *position.Position { | ||||
| 	return n.Position | ||||
| } | ||||
| 
 | ||||
| // Attributes returns node attributes as map | ||||
| func (n *Variable) Attributes() map[string]interface{} { | ||||
| 	return nil | ||||
|  | ||||
| @ -2,23 +2,35 @@ package expr | ||||
| 
 | ||||
| import ( | ||||
| 	"github.com/z7zmey/php-parser/node" | ||||
| 	"github.com/z7zmey/php-parser/position" | ||||
| 	"github.com/z7zmey/php-parser/walker" | ||||
| ) | ||||
| 
 | ||||
| // Yield node | ||||
| type Yield struct { | ||||
| 	Key   node.Node | ||||
| 	Value node.Node | ||||
| 	Position *position.Position | ||||
| 	Key      node.Node | ||||
| 	Value    node.Node | ||||
| } | ||||
| 
 | ||||
| // NewYield node constructor | ||||
| func NewYield(Key node.Node, Value node.Node) *Yield { | ||||
| 	return &Yield{ | ||||
| 		Key, | ||||
| 		Value, | ||||
| 		Key:   Key, | ||||
| 		Value: Value, | ||||
| 	} | ||||
| } | ||||
| 
 | ||||
| // SetPosition sets node position | ||||
| func (n *Yield) SetPosition(p *position.Position) { | ||||
| 	n.Position = p | ||||
| } | ||||
| 
 | ||||
| // GetPosition returns node positions | ||||
| func (n *Yield) GetPosition() *position.Position { | ||||
| 	return n.Position | ||||
| } | ||||
| 
 | ||||
| // Attributes returns node attributes as map | ||||
| func (n *Yield) Attributes() map[string]interface{} { | ||||
| 	return nil | ||||
|  | ||||
| @ -2,21 +2,33 @@ package expr | ||||
| 
 | ||||
| import ( | ||||
| 	"github.com/z7zmey/php-parser/node" | ||||
| 	"github.com/z7zmey/php-parser/position" | ||||
| 	"github.com/z7zmey/php-parser/walker" | ||||
| ) | ||||
| 
 | ||||
| // YieldFrom node | ||||
| type YieldFrom struct { | ||||
| 	Expr node.Node | ||||
| 	Position *position.Position | ||||
| 	Expr     node.Node | ||||
| } | ||||
| 
 | ||||
| // NewYieldFrom node constructor | ||||
| func NewYieldFrom(Expression node.Node) *YieldFrom { | ||||
| 	return &YieldFrom{ | ||||
| 		Expression, | ||||
| 		Expr: Expression, | ||||
| 	} | ||||
| } | ||||
| 
 | ||||
| // SetPosition sets node position | ||||
| func (n *YieldFrom) SetPosition(p *position.Position) { | ||||
| 	n.Position = p | ||||
| } | ||||
| 
 | ||||
| // GetPosition returns node positions | ||||
| func (n *YieldFrom) GetPosition() *position.Position { | ||||
| 	return n.Position | ||||
| } | ||||
| 
 | ||||
| // Attributes returns node attributes as map | ||||
| func (n *YieldFrom) Attributes() map[string]interface{} { | ||||
| 	return nil | ||||
|  | ||||
| @ -6,6 +6,7 @@ import ( | ||||
| 	"testing" | ||||
| 
 | ||||
| 	"github.com/z7zmey/php-parser/node/expr" | ||||
| 	"github.com/z7zmey/php-parser/position" | ||||
| 
 | ||||
| 	"github.com/kylelemons/godebug/pretty" | ||||
| 	"github.com/z7zmey/php-parser/node/scalar" | ||||
| @ -32,11 +33,53 @@ func TestArrayDimFetch(t *testing.T) { | ||||
| 	src := `<? $a[1];` | ||||
| 
 | ||||
| 	expected := &node.Root{ | ||||
| 		Position: &position.Position{ | ||||
| 			StartLine: 1, | ||||
| 			EndLine:   1, | ||||
| 			StartPos:  4, | ||||
| 			EndPos:    9, | ||||
| 		}, | ||||
| 		Stmts: []node.Node{ | ||||
| 			&stmt.Expression{ | ||||
| 				Position: &position.Position{ | ||||
| 					StartLine: 1, | ||||
| 					EndLine:   1, | ||||
| 					StartPos:  4, | ||||
| 					EndPos:    9, | ||||
| 				}, | ||||
| 				Expr: &expr.ArrayDimFetch{ | ||||
| 					Variable: &expr.Variable{VarName: &node.Identifier{Value: "a"}}, | ||||
| 					Dim:      &scalar.Lnumber{Value: "1"}, | ||||
| 					Position: &position.Position{ | ||||
| 						StartLine: 1, | ||||
| 						EndLine:   1, | ||||
| 						StartPos:  4, | ||||
| 						EndPos:    8, | ||||
| 					}, | ||||
| 					Variable: &expr.Variable{ | ||||
| 						Position: &position.Position{ | ||||
| 							StartLine: 1, | ||||
| 							EndLine:   1, | ||||
| 							StartPos:  4, | ||||
| 							EndPos:    5, | ||||
| 						}, | ||||
| 						VarName: &node.Identifier{ | ||||
| 							Position: &position.Position{ | ||||
| 								StartLine: 1, | ||||
| 								EndLine:   1, | ||||
| 								StartPos:  4, | ||||
| 								EndPos:    5, | ||||
| 							}, | ||||
| 							Value: "a", | ||||
| 						}, | ||||
| 					}, | ||||
| 					Dim: &scalar.Lnumber{ | ||||
| 						Position: &position.Position{ | ||||
| 							StartLine: 1, | ||||
| 							EndLine:   1, | ||||
| 							StartPos:  7, | ||||
| 							EndPos:    7, | ||||
| 						}, | ||||
| 						Value: "1", | ||||
| 					}, | ||||
| 				}, | ||||
| 			}, | ||||
| 		}, | ||||
| @ -57,14 +100,70 @@ func TestArrayDimFetchNested(t *testing.T) { | ||||
| 	src := `<? $a[1][2];` | ||||
| 
 | ||||
| 	expected := &node.Root{ | ||||
| 		Position: &position.Position{ | ||||
| 			StartLine: 1, | ||||
| 			EndLine:   1, | ||||
| 			StartPos:  4, | ||||
| 			EndPos:    12, | ||||
| 		}, | ||||
| 		Stmts: []node.Node{ | ||||
| 			&stmt.Expression{ | ||||
| 				Position: &position.Position{ | ||||
| 					StartLine: 1, | ||||
| 					EndLine:   1, | ||||
| 					StartPos:  4, | ||||
| 					EndPos:    12, | ||||
| 				}, | ||||
| 				Expr: &expr.ArrayDimFetch{ | ||||
| 					Variable: &expr.ArrayDimFetch{ | ||||
| 						Variable: &expr.Variable{VarName: &node.Identifier{Value: "a"}}, | ||||
| 						Dim:      &scalar.Lnumber{Value: "1"}, | ||||
| 					Position: &position.Position{ | ||||
| 						StartLine: 1, | ||||
| 						EndLine:   1, | ||||
| 						StartPos:  4, | ||||
| 						EndPos:    11, | ||||
| 					}, | ||||
| 					Variable: &expr.ArrayDimFetch{ | ||||
| 						Position: &position.Position{ | ||||
| 							StartLine: 1, | ||||
| 							EndLine:   1, | ||||
| 							StartPos:  4, | ||||
| 							EndPos:    8, | ||||
| 						}, | ||||
| 						Variable: &expr.Variable{ | ||||
| 							Position: &position.Position{ | ||||
| 								StartLine: 1, | ||||
| 								EndLine:   1, | ||||
| 								StartPos:  4, | ||||
| 								EndPos:    5, | ||||
| 							}, | ||||
| 							VarName: &node.Identifier{ | ||||
| 								Position: &position.Position{ | ||||
| 									StartLine: 1, | ||||
| 									EndLine:   1, | ||||
| 									StartPos:  4, | ||||
| 									EndPos:    5, | ||||
| 								}, | ||||
| 								Value: "a", | ||||
| 							}, | ||||
| 						}, | ||||
| 						Dim: &scalar.Lnumber{ | ||||
| 							Position: &position.Position{ | ||||
| 								StartLine: 1, | ||||
| 								EndLine:   1, | ||||
| 								StartPos:  7, | ||||
| 								EndPos:    7, | ||||
| 							}, | ||||
| 							Value: "1", | ||||
| 						}, | ||||
| 					}, | ||||
| 					Dim: &scalar.Lnumber{ | ||||
| 						Position: &position.Position{ | ||||
| 							StartLine: 1, | ||||
| 							EndLine:   1, | ||||
| 							StartPos:  10, | ||||
| 							EndPos:    10, | ||||
| 						}, | ||||
| 						Value: "2", | ||||
| 					}, | ||||
| 					Dim: &scalar.Lnumber{Value: "2"}, | ||||
| 				}, | ||||
| 			}, | ||||
| 		}, | ||||
|  | ||||
| @ -5,6 +5,7 @@ import ( | ||||
| 	"testing" | ||||
| 
 | ||||
| 	"github.com/z7zmey/php-parser/node/scalar" | ||||
| 	"github.com/z7zmey/php-parser/position" | ||||
| 
 | ||||
| 	"github.com/z7zmey/php-parser/node/expr" | ||||
| 
 | ||||
| @ -18,9 +19,27 @@ func TestArray(t *testing.T) { | ||||
| 	src := `<? array();` | ||||
| 
 | ||||
| 	expected := &node.Root{ | ||||
| 		Position: &position.Position{ | ||||
| 			StartLine: 1, | ||||
| 			EndLine:   1, | ||||
| 			StartPos:  4, | ||||
| 			EndPos:    11, | ||||
| 		}, | ||||
| 		Stmts: []node.Node{ | ||||
| 			&stmt.Expression{ | ||||
| 				Position: &position.Position{ | ||||
| 					StartLine: 1, | ||||
| 					EndLine:   1, | ||||
| 					StartPos:  4, | ||||
| 					EndPos:    11, | ||||
| 				}, | ||||
| 				Expr: &expr.Array{ | ||||
| 					Position: &position.Position{ | ||||
| 						StartLine: 1, | ||||
| 						EndLine:   1, | ||||
| 						StartPos:  4, | ||||
| 						EndPos:    10, | ||||
| 					}, | ||||
| 					Items: []node.Node{}, | ||||
| 				}, | ||||
| 			}, | ||||
| @ -42,12 +61,44 @@ func TestArrayItem(t *testing.T) { | ||||
| 	src := `<? array(1);` | ||||
| 
 | ||||
| 	expected := &node.Root{ | ||||
| 		Position: &position.Position{ | ||||
| 			StartLine: 1, | ||||
| 			EndLine:   1, | ||||
| 			StartPos:  4, | ||||
| 			EndPos:    12, | ||||
| 		}, | ||||
| 		Stmts: []node.Node{ | ||||
| 			&stmt.Expression{ | ||||
| 				Position: &position.Position{ | ||||
| 					StartLine: 1, | ||||
| 					EndLine:   1, | ||||
| 					StartPos:  4, | ||||
| 					EndPos:    12, | ||||
| 				}, | ||||
| 				Expr: &expr.Array{ | ||||
| 					Position: &position.Position{ | ||||
| 						StartLine: 1, | ||||
| 						EndLine:   1, | ||||
| 						StartPos:  4, | ||||
| 						EndPos:    11, | ||||
| 					}, | ||||
| 					Items: []node.Node{ | ||||
| 						&expr.ArrayItem{ | ||||
| 							Val: &scalar.Lnumber{Value: "1"}, | ||||
| 							Position: &position.Position{ | ||||
| 								StartLine: 1, | ||||
| 								EndLine:   1, | ||||
| 								StartPos:  10, | ||||
| 								EndPos:    10, | ||||
| 							}, | ||||
| 							Val: &scalar.Lnumber{ | ||||
| 								Position: &position.Position{ | ||||
| 									StartLine: 1, | ||||
| 									EndLine:   1, | ||||
| 									StartPos:  10, | ||||
| 									EndPos:    10, | ||||
| 								}, | ||||
| 								Value: "1", | ||||
| 							}, | ||||
| 						}, | ||||
| 					}, | ||||
| 				}, | ||||
| @ -70,16 +121,86 @@ func TestArrayItems(t *testing.T) { | ||||
| 	src := `<? array(1=>1, &$b,);` | ||||
| 
 | ||||
| 	expected := &node.Root{ | ||||
| 		Position: &position.Position{ | ||||
| 			StartLine: 1, | ||||
| 			EndLine:   1, | ||||
| 			StartPos:  4, | ||||
| 			EndPos:    21, | ||||
| 		}, | ||||
| 		Stmts: []node.Node{ | ||||
| 			&stmt.Expression{ | ||||
| 				Position: &position.Position{ | ||||
| 					StartLine: 1, | ||||
| 					EndLine:   1, | ||||
| 					StartPos:  4, | ||||
| 					EndPos:    21, | ||||
| 				}, | ||||
| 				Expr: &expr.Array{ | ||||
| 					Position: &position.Position{ | ||||
| 						StartLine: 1, | ||||
| 						EndLine:   1, | ||||
| 						StartPos:  4, | ||||
| 						EndPos:    20, | ||||
| 					}, | ||||
| 					Items: []node.Node{ | ||||
| 						&expr.ArrayItem{ | ||||
| 							Key: &scalar.Lnumber{Value: "1"}, | ||||
| 							Val: &scalar.Lnumber{Value: "1"}, | ||||
| 							Position: &position.Position{ | ||||
| 								StartLine: 1, | ||||
| 								EndLine:   1, | ||||
| 								StartPos:  10, | ||||
| 								EndPos:    13, | ||||
| 							}, | ||||
| 							Key: &scalar.Lnumber{ | ||||
| 								Position: &position.Position{ | ||||
| 									StartLine: 1, | ||||
| 									EndLine:   1, | ||||
| 									StartPos:  10, | ||||
| 									EndPos:    10, | ||||
| 								}, | ||||
| 								Value: "1", | ||||
| 							}, | ||||
| 							Val: &scalar.Lnumber{ | ||||
| 								Position: &position.Position{ | ||||
| 									StartLine: 1, | ||||
| 									EndLine:   1, | ||||
| 									StartPos:  13, | ||||
| 									EndPos:    13, | ||||
| 								}, | ||||
| 								Value: "1", | ||||
| 							}, | ||||
| 						}, | ||||
| 						&expr.ArrayItem{ | ||||
| 							Val: &expr.Reference{Variable: &expr.Variable{VarName: &node.Identifier{Value: "b"}}}, | ||||
| 							Position: &position.Position{ | ||||
| 								StartLine: 1, | ||||
| 								EndLine:   1, | ||||
| 								StartPos:  16, | ||||
| 								EndPos:    18, | ||||
| 							}, | ||||
| 							Val: &expr.Reference{ | ||||
| 								Position: &position.Position{ | ||||
| 									StartLine: 1, | ||||
| 									EndLine:   1, | ||||
| 									StartPos:  16, | ||||
| 									EndPos:    18, | ||||
| 								}, | ||||
| 								Variable: &expr.Variable{ | ||||
| 									Position: &position.Position{ | ||||
| 										StartLine: 1, | ||||
| 										EndLine:   1, | ||||
| 										StartPos:  17, | ||||
| 										EndPos:    18, | ||||
| 									}, | ||||
| 									VarName: &node.Identifier{ | ||||
| 										Position: &position.Position{ | ||||
| 											StartLine: 1, | ||||
| 											EndLine:   1, | ||||
| 											StartPos:  17, | ||||
| 											EndPos:    18, | ||||
| 										}, | ||||
| 										Value: "b", | ||||
| 									}, | ||||
| 								}, | ||||
| 							}, | ||||
| 						}, | ||||
| 					}, | ||||
| 				}, | ||||
|  | ||||
| @ -5,6 +5,7 @@ import ( | ||||
| 	"testing" | ||||
| 
 | ||||
| 	"github.com/z7zmey/php-parser/node/expr" | ||||
| 	"github.com/z7zmey/php-parser/position" | ||||
| 
 | ||||
| 	"github.com/z7zmey/php-parser/node" | ||||
| 	"github.com/z7zmey/php-parser/node/stmt" | ||||
| @ -16,10 +17,44 @@ func TestBitwiseNot(t *testing.T) { | ||||
| 	src := `<? ~$a;` | ||||
| 
 | ||||
| 	expected := &node.Root{ | ||||
| 		Position: &position.Position{ | ||||
| 			StartLine: 1, | ||||
| 			EndLine:   1, | ||||
| 			StartPos:  4, | ||||
| 			EndPos:    7, | ||||
| 		}, | ||||
| 		Stmts: []node.Node{ | ||||
| 			&stmt.Expression{ | ||||
| 				Position: &position.Position{ | ||||
| 					StartLine: 1, | ||||
| 					EndLine:   1, | ||||
| 					StartPos:  4, | ||||
| 					EndPos:    7, | ||||
| 				}, | ||||
| 				Expr: &expr.BitwiseNot{ | ||||
| 					Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}}, | ||||
| 					Position: &position.Position{ | ||||
| 						StartLine: 1, | ||||
| 						EndLine:   1, | ||||
| 						StartPos:  4, | ||||
| 						EndPos:    6, | ||||
| 					}, | ||||
| 					Expr: &expr.Variable{ | ||||
| 						Position: &position.Position{ | ||||
| 							StartLine: 1, | ||||
| 							EndLine:   1, | ||||
| 							StartPos:  5, | ||||
| 							EndPos:    6, | ||||
| 						}, | ||||
| 						VarName: &node.Identifier{ | ||||
| 							Position: &position.Position{ | ||||
| 								StartLine: 1, | ||||
| 								EndLine:   1, | ||||
| 								StartPos:  5, | ||||
| 								EndPos:    6, | ||||
| 							}, | ||||
| 							Value: "a", | ||||
| 						}, | ||||
| 					}, | ||||
| 				}, | ||||
| 			}, | ||||
| 		}, | ||||
|  | ||||
Some files were not shown because too many files have changed in this diff Show More
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user