From f2d972582f2792c292b6bf67fedb7d3c525473fe Mon Sep 17 00:00:00 2001 From: z7zmey Date: Sun, 31 Dec 2017 12:59:22 +0200 Subject: [PATCH] node position --- node/argument.go | 11 +++++++++++ node/expr/array.go | 11 +++++++++++ node/expr/array_dim_fetch.go | 11 +++++++++++ node/expr/array_item.go | 11 +++++++++++ node/expr/assign_op/assign.go | 10 ++++++++++ node/expr/assign_op/assign_op.go | 1 + node/expr/assign_op/assign_ref.go | 10 ++++++++++ node/expr/assign_op/bitwise_and.go | 10 ++++++++++ node/expr/assign_op/bitwise_or.go | 10 ++++++++++ node/expr/assign_op/bitwise_xor.go | 10 ++++++++++ node/expr/assign_op/concat.go | 10 ++++++++++ node/expr/assign_op/div.go | 10 ++++++++++ node/expr/assign_op/minus.go | 10 ++++++++++ node/expr/assign_op/mod.go | 10 ++++++++++ node/expr/assign_op/mul.go | 10 ++++++++++ node/expr/assign_op/plus.go | 10 ++++++++++ node/expr/assign_op/pow.go | 10 ++++++++++ node/expr/assign_op/shift_left.go | 10 ++++++++++ node/expr/assign_op/shift_right.go | 10 ++++++++++ node/expr/binary_op/binary_op.go | 1 + node/expr/binary_op/bitwise_and.go | 10 ++++++++++ node/expr/binary_op/bitwise_or.go | 10 ++++++++++ node/expr/binary_op/bitwise_xor.go | 10 ++++++++++ node/expr/binary_op/boolean_and.go | 10 ++++++++++ node/expr/binary_op/boolean_or.go | 10 ++++++++++ node/expr/binary_op/coalesce.go | 10 ++++++++++ node/expr/binary_op/concat.go | 10 ++++++++++ node/expr/binary_op/div.go | 10 ++++++++++ node/expr/binary_op/equal.go | 10 ++++++++++ node/expr/binary_op/greater.go | 10 ++++++++++ node/expr/binary_op/greater_or_equal.go | 10 ++++++++++ node/expr/binary_op/identical.go | 10 ++++++++++ node/expr/binary_op/logical_and.go | 10 ++++++++++ node/expr/binary_op/logical_or.go | 10 ++++++++++ node/expr/binary_op/logical_xor.go | 10 ++++++++++ node/expr/binary_op/minus.go | 10 ++++++++++ node/expr/binary_op/mod.go | 10 ++++++++++ node/expr/binary_op/mul.go | 10 ++++++++++ node/expr/binary_op/not_equal.go | 10 ++++++++++ node/expr/binary_op/not_identical.go | 10 ++++++++++ node/expr/binary_op/plus.go | 10 ++++++++++ node/expr/binary_op/pow.go | 10 ++++++++++ node/expr/binary_op/shift_left.go | 10 ++++++++++ node/expr/binary_op/shift_right.go | 10 ++++++++++ node/expr/binary_op/smaller.go | 10 ++++++++++ node/expr/binary_op/smaller_or_equal.go | 10 ++++++++++ node/expr/binary_op/spaceship.go | 10 ++++++++++ node/expr/bitwise_not.go | 11 +++++++++++ node/expr/boolean_not.go | 11 +++++++++++ node/expr/cast/cast.go | 1 + node/expr/cast/cast_array.go | 10 ++++++++++ node/expr/cast/cast_bool.go | 10 ++++++++++ node/expr/cast/cast_double.go | 10 ++++++++++ node/expr/cast/cast_int.go | 10 ++++++++++ node/expr/cast/cast_object.go | 10 ++++++++++ node/expr/cast/cast_string.go | 10 ++++++++++ node/expr/cast/cast_unset.go | 10 ++++++++++ node/expr/class_const_fetch.go | 11 +++++++++++ node/expr/clone.go | 11 +++++++++++ node/expr/closure.go | 11 +++++++++++ node/expr/closure_use.go | 11 +++++++++++ node/expr/const_fetch.go | 11 +++++++++++ node/expr/empty.go | 11 +++++++++++ node/expr/error_suppress.go | 11 +++++++++++ node/expr/eval.go | 11 +++++++++++ node/expr/exit.go | 11 +++++++++++ node/expr/function_call.go | 11 +++++++++++ node/expr/include.go | 11 +++++++++++ node/expr/include_once.go | 11 +++++++++++ node/expr/instance_of.go | 11 +++++++++++ node/expr/isset.go | 11 +++++++++++ node/expr/list.go | 11 +++++++++++ node/expr/method_call.go | 11 +++++++++++ node/expr/new.go | 11 +++++++++++ node/expr/post_dec.go | 11 +++++++++++ node/expr/post_inc.go | 11 +++++++++++ node/expr/pre_dec.go | 11 +++++++++++ node/expr/pre_inc.go | 11 +++++++++++ node/expr/print.go | 11 +++++++++++ node/expr/property_fetch.go | 11 +++++++++++ node/expr/require.go | 11 +++++++++++ node/expr/require_once.go | 11 +++++++++++ node/expr/shell_exec.go | 11 +++++++++++ node/expr/short_array.go | 11 +++++++++++ node/expr/short_list.go | 11 +++++++++++ node/expr/static_call.go | 11 +++++++++++ node/expr/static_property_fetch.go | 11 +++++++++++ node/expr/ternary.go | 11 +++++++++++ node/expr/unary_minus.go | 11 +++++++++++ node/expr/unary_plus.go | 11 +++++++++++ node/expr/variable.go | 11 +++++++++++ node/expr/yield.go | 11 +++++++++++ node/expr/yield_from.go | 11 +++++++++++ node/identifier.go | 11 +++++++++++ node/name/fully_qualified.go | 1 + node/name/name.go | 11 +++++++++++ node/name/name_part.go | 11 +++++++++++ node/name/relative.go | 1 + node/node.go | 19 +++++++++++++++---- node/nullable.go | 11 +++++++++++ node/parameter.go | 11 +++++++++++ node/scalar/dnumber.go | 11 +++++++++++ node/scalar/encapsed.go | 11 +++++++++++ node/scalar/encapsed_string_part.go | 11 +++++++++++ node/scalar/lnumber.go | 11 +++++++++++ node/scalar/magic_constant.go | 11 +++++++++++ node/scalar/string.go | 12 +++++++++++- node/stmt/alt_else.go | 11 +++++++++++ node/stmt/alt_else_if.go | 11 +++++++++++ node/stmt/alt_if.go | 11 +++++++++++ node/stmt/break.go | 11 +++++++++++ node/stmt/case.go | 11 +++++++++++ node/stmt/catch.go | 11 +++++++++++ node/stmt/class.go | 11 +++++++++++ node/stmt/class_const_list.go | 11 +++++++++++ node/stmt/class_method.go | 11 +++++++++++ node/stmt/const_list.go | 11 +++++++++++ node/stmt/constant.go | 11 +++++++++++ node/stmt/continue.go | 11 +++++++++++ node/stmt/declare.go | 11 +++++++++++ node/stmt/default.go | 11 +++++++++++ node/stmt/do.go | 11 +++++++++++ node/stmt/echo.go | 11 +++++++++++ node/stmt/else.go | 11 +++++++++++ node/stmt/else_if.go | 11 +++++++++++ node/stmt/expression.go | 11 +++++++++++ node/stmt/finally.go | 11 +++++++++++ node/stmt/for.go | 11 +++++++++++ node/stmt/foreach.go | 11 +++++++++++ node/stmt/function.go | 11 +++++++++++ node/stmt/global.go | 11 +++++++++++ node/stmt/goto.go | 11 +++++++++++ node/stmt/group_use.go | 11 +++++++++++ node/stmt/halt_compiler.go | 11 +++++++++++ node/stmt/if.go | 11 +++++++++++ node/stmt/inline_html.go | 11 +++++++++++ node/stmt/interface.go | 11 +++++++++++ node/stmt/label.go | 11 +++++++++++ node/stmt/namespace.go | 11 +++++++++++ node/stmt/nop.go | 11 +++++++++++ node/stmt/property.go | 11 +++++++++++ node/stmt/property_list.go | 11 +++++++++++ node/stmt/return.go | 11 +++++++++++ node/stmt/static.go | 11 +++++++++++ node/stmt/static_var.go | 11 +++++++++++ node/stmt/stmt_list.go | 11 +++++++++++ node/stmt/switch.go | 11 +++++++++++ node/stmt/throw.go | 11 +++++++++++ node/stmt/trait.go | 11 +++++++++++ node/stmt/trait_method_ref.go | 11 +++++++++++ node/stmt/trait_use.go | 11 +++++++++++ node/stmt/trait_use_alias.go | 11 +++++++++++ node/stmt/trait_use_precedence.go | 11 +++++++++++ node/stmt/try.go | 11 +++++++++++ node/stmt/unset.go | 11 +++++++++++ node/stmt/use.go | 11 +++++++++++ node/stmt/use_list.go | 11 +++++++++++ node/stmt/while.go | 11 +++++++++++ 158 files changed, 1644 insertions(+), 5 deletions(-) diff --git a/node/argument.go b/node/argument.go index c5b83b7..1913cb3 100644 --- a/node/argument.go +++ b/node/argument.go @@ -3,6 +3,7 @@ package node type Argument struct { name string attributes map[string]interface{} + position *Position expr Node variadic bool } @@ -13,6 +14,7 @@ func NewArgument(expression Node, variadic bool) Node { map[string]interface{}{ "variadic": variadic, }, + nil, expression, variadic, } @@ -34,6 +36,15 @@ func (n Argument) SetAttribute(key string, value interface{}) { n.attributes[key] = value } +func (n Argument) Position() *Position { + return n.position +} + +func (n Argument) SetPosition(p *Position) Node { + n.position = p + return n +} + func (n Argument) Walk(v Visitor) { if v.EnterNode(n) == false { return diff --git a/node/expr/array.go b/node/expr/array.go index b1d9631..7352c1d 100644 --- a/node/expr/array.go +++ b/node/expr/array.go @@ -7,6 +7,7 @@ import ( type Array struct { name string attributes map[string]interface{} + position *node.Position items []node.Node } @@ -14,6 +15,7 @@ func NewArray(items []node.Node) node.Node { return Array{ "Array", map[string]interface{}{}, + nil, items, } } @@ -34,6 +36,15 @@ func (n Array) SetAttribute(key string, value interface{}) { n.attributes[key] = value } +func (n Array) Position() *node.Position { + return n.position +} + +func (n Array) SetPosition(p *node.Position) node.Node { + n.position = p + return n +} + func (n Array) Walk(v node.Visitor) { if v.EnterNode(n) == false { return diff --git a/node/expr/array_dim_fetch.go b/node/expr/array_dim_fetch.go index d7889ed..39cd7e8 100644 --- a/node/expr/array_dim_fetch.go +++ b/node/expr/array_dim_fetch.go @@ -7,6 +7,7 @@ import ( type ArrayDimFetch struct { name string attributes map[string]interface{} + position *node.Position variable node.Node dim node.Node } @@ -15,6 +16,7 @@ func NewArrayDimFetch(variable node.Node, dim node.Node) node.Node { return ArrayDimFetch{ "ArrayDimFetch", map[string]interface{}{}, + nil, variable, dim, } @@ -36,6 +38,15 @@ func (n ArrayDimFetch) SetAttribute(key string, value interface{}) { n.attributes[key] = value } +func (n ArrayDimFetch) Position() *node.Position { + return n.position +} + +func (n ArrayDimFetch) SetPosition(p *node.Position) node.Node { + n.position = p + return n +} + func (n ArrayDimFetch) Walk(v node.Visitor) { if v.EnterNode(n) == false { return diff --git a/node/expr/array_item.go b/node/expr/array_item.go index 1e4a8dc..5340272 100644 --- a/node/expr/array_item.go +++ b/node/expr/array_item.go @@ -7,6 +7,7 @@ import ( type ArrayItem struct { name string attributes map[string]interface{} + position *node.Position key node.Node val node.Node } @@ -17,6 +18,7 @@ func NewArrayItem(key node.Node, val node.Node, byRef bool) node.Node { map[string]interface{}{ "byRef": byRef, }, + nil, key, val, } @@ -38,6 +40,15 @@ func (n ArrayItem) SetAttribute(key string, value interface{}) { n.attributes[key] = value } +func (n ArrayItem) Position() *node.Position { + return n.position +} + +func (n ArrayItem) SetPosition(p *node.Position) node.Node { + n.position = p + return n +} + func (n ArrayItem) Walk(v node.Visitor) { if v.EnterNode(n) == false { return diff --git a/node/expr/assign_op/assign.go b/node/expr/assign_op/assign.go index 57f740b..df70f59 100644 --- a/node/expr/assign_op/assign.go +++ b/node/expr/assign_op/assign.go @@ -13,6 +13,7 @@ func NewAssign(variable node.Node, expression node.Node) node.Node { AssignOp{ "Assign", map[string]interface{}{}, + nil, variable, expression, }, @@ -35,6 +36,15 @@ func (n Assign) SetAttribute(key string, value interface{}) { n.attributes[key] = value } +func (n Assign) Position() *node.Position { + return n.position +} + +func (n Assign) SetPosition(p *node.Position) node.Node { + n.position = p + return n +} + func (n Assign) Walk(v node.Visitor) { if v.EnterNode(n) == false { return diff --git a/node/expr/assign_op/assign_op.go b/node/expr/assign_op/assign_op.go index c71cbb7..ec8bf7b 100644 --- a/node/expr/assign_op/assign_op.go +++ b/node/expr/assign_op/assign_op.go @@ -7,6 +7,7 @@ import ( type AssignOp struct { name string attributes map[string]interface{} + position *node.Position variable node.Node expression node.Node } diff --git a/node/expr/assign_op/assign_ref.go b/node/expr/assign_op/assign_ref.go index e2287a9..a11ddcf 100644 --- a/node/expr/assign_op/assign_ref.go +++ b/node/expr/assign_op/assign_ref.go @@ -13,6 +13,7 @@ func NewAssignRef(variable node.Node, expression node.Node) node.Node { AssignOp{ "AssignRef", map[string]interface{}{}, + nil, variable, expression, }, @@ -35,6 +36,15 @@ func (n AssignRef) SetAttribute(key string, value interface{}) { n.attributes[key] = value } +func (n AssignRef) Position() *node.Position { + return n.position +} + +func (n AssignRef) SetPosition(p *node.Position) node.Node { + n.position = p + return n +} + func (n AssignRef) Walk(v node.Visitor) { if v.EnterNode(n) == false { return diff --git a/node/expr/assign_op/bitwise_and.go b/node/expr/assign_op/bitwise_and.go index 32d9343..cc2c3ec 100644 --- a/node/expr/assign_op/bitwise_and.go +++ b/node/expr/assign_op/bitwise_and.go @@ -13,6 +13,7 @@ func NewBitwiseAnd(variable node.Node, expression node.Node) node.Node { AssignOp{ "AssignBitwiseAnd", map[string]interface{}{}, + nil, variable, expression, }, @@ -35,6 +36,15 @@ func (n BitwiseAnd) SetAttribute(key string, value interface{}) { n.attributes[key] = value } +func (n BitwiseAnd) Position() *node.Position { + return n.position +} + +func (n BitwiseAnd) SetPosition(p *node.Position) node.Node { + n.position = p + return n +} + func (n BitwiseAnd) Walk(v node.Visitor) { if v.EnterNode(n) == false { return diff --git a/node/expr/assign_op/bitwise_or.go b/node/expr/assign_op/bitwise_or.go index eefa2f5..6475bef 100644 --- a/node/expr/assign_op/bitwise_or.go +++ b/node/expr/assign_op/bitwise_or.go @@ -13,6 +13,7 @@ func NewBitwiseOr(variable node.Node, expression node.Node) node.Node { AssignOp{ "AssignBitwiseOr", map[string]interface{}{}, + nil, variable, expression, }, @@ -35,6 +36,15 @@ func (n BitwiseOr) SetAttribute(key string, value interface{}) { n.attributes[key] = value } +func (n BitwiseOr) Position() *node.Position { + return n.position +} + +func (n BitwiseOr) SetPosition(p *node.Position) node.Node { + n.position = p + return n +} + func (n BitwiseOr) Walk(v node.Visitor) { if v.EnterNode(n) == false { return diff --git a/node/expr/assign_op/bitwise_xor.go b/node/expr/assign_op/bitwise_xor.go index 0ba31bb..5f4bd7d 100644 --- a/node/expr/assign_op/bitwise_xor.go +++ b/node/expr/assign_op/bitwise_xor.go @@ -13,6 +13,7 @@ func NewBitwiseXor(variable node.Node, expression node.Node) node.Node { AssignOp{ "AssignBitwiseXor", map[string]interface{}{}, + nil, variable, expression, }, @@ -31,6 +32,15 @@ func (n BitwiseXor) SetAttribute(key string, value interface{}) { n.attributes[key] = value } +func (n BitwiseXor) Position() *node.Position { + return n.position +} + +func (n BitwiseXor) SetPosition(p *node.Position) node.Node { + n.position = p + return n +} + func (n BitwiseXor) Name() string { return "BitwiseXor" } diff --git a/node/expr/assign_op/concat.go b/node/expr/assign_op/concat.go index b7401b2..24de663 100644 --- a/node/expr/assign_op/concat.go +++ b/node/expr/assign_op/concat.go @@ -13,6 +13,7 @@ func NewConcat(variable node.Node, expression node.Node) node.Node { AssignOp{ "AssignConcat", map[string]interface{}{}, + nil, variable, expression, }, @@ -35,6 +36,15 @@ func (n Concat) SetAttribute(key string, value interface{}) { n.attributes[key] = value } +func (n Concat) Position() *node.Position { + return n.position +} + +func (n Concat) SetPosition(p *node.Position) node.Node { + n.position = p + return n +} + func (n Concat) Walk(v node.Visitor) { if v.EnterNode(n) == false { return diff --git a/node/expr/assign_op/div.go b/node/expr/assign_op/div.go index 01c5326..0d97957 100644 --- a/node/expr/assign_op/div.go +++ b/node/expr/assign_op/div.go @@ -13,6 +13,7 @@ func NewDiv(variable node.Node, expression node.Node) node.Node { AssignOp{ "AssignDiv", map[string]interface{}{}, + nil, variable, expression, }, @@ -35,6 +36,15 @@ func (n Div) SetAttribute(key string, value interface{}) { n.attributes[key] = value } +func (n Div) Position() *node.Position { + return n.position +} + +func (n Div) SetPosition(p *node.Position) node.Node { + n.position = p + return n +} + func (n Div) Walk(v node.Visitor) { if v.EnterNode(n) == false { return diff --git a/node/expr/assign_op/minus.go b/node/expr/assign_op/minus.go index db77a7b..4c8800a 100644 --- a/node/expr/assign_op/minus.go +++ b/node/expr/assign_op/minus.go @@ -13,6 +13,7 @@ func NewMinus(variable node.Node, expression node.Node) node.Node { AssignOp{ "AssignMinus", map[string]interface{}{}, + nil, variable, expression, }, @@ -35,6 +36,15 @@ func (n Minus) SetAttribute(key string, value interface{}) { n.attributes[key] = value } +func (n Minus) Position() *node.Position { + return n.position +} + +func (n Minus) SetPosition(p *node.Position) node.Node { + n.position = p + return n +} + func (n Minus) Walk(v node.Visitor) { if v.EnterNode(n) == false { return diff --git a/node/expr/assign_op/mod.go b/node/expr/assign_op/mod.go index afdcad5..e3bacca 100644 --- a/node/expr/assign_op/mod.go +++ b/node/expr/assign_op/mod.go @@ -13,6 +13,7 @@ func NewMod(variable node.Node, expression node.Node) node.Node { AssignOp{ "AssignMod", map[string]interface{}{}, + nil, variable, expression, }, @@ -35,6 +36,15 @@ func (n Mod) SetAttribute(key string, value interface{}) { n.attributes[key] = value } +func (n Mod) Position() *node.Position { + return n.position +} + +func (n Mod) SetPosition(p *node.Position) node.Node { + n.position = p + return n +} + func (n Mod) Walk(v node.Visitor) { if v.EnterNode(n) == false { return diff --git a/node/expr/assign_op/mul.go b/node/expr/assign_op/mul.go index e09cf06..1289ad1 100644 --- a/node/expr/assign_op/mul.go +++ b/node/expr/assign_op/mul.go @@ -13,6 +13,7 @@ func NewMul(variable node.Node, expression node.Node) node.Node { AssignOp{ "AssignMul", map[string]interface{}{}, + nil, variable, expression, }, @@ -35,6 +36,15 @@ func (n Mul) SetAttribute(key string, value interface{}) { n.attributes[key] = value } +func (n Mul) Position() *node.Position { + return n.position +} + +func (n Mul) SetPosition(p *node.Position) node.Node { + n.position = p + return n +} + func (n Mul) Walk(v node.Visitor) { if v.EnterNode(n) == false { return diff --git a/node/expr/assign_op/plus.go b/node/expr/assign_op/plus.go index 705d419..127686c 100644 --- a/node/expr/assign_op/plus.go +++ b/node/expr/assign_op/plus.go @@ -13,6 +13,7 @@ func NewPlus(variable node.Node, expression node.Node) node.Node { AssignOp{ "AssignPlus", map[string]interface{}{}, + nil, variable, expression, }, @@ -35,6 +36,15 @@ func (n Plus) SetAttribute(key string, value interface{}) { n.attributes[key] = value } +func (n Plus) Position() *node.Position { + return n.position +} + +func (n Plus) SetPosition(p *node.Position) node.Node { + n.position = p + return n +} + func (n Plus) Walk(v node.Visitor) { if v.EnterNode(n) == false { return diff --git a/node/expr/assign_op/pow.go b/node/expr/assign_op/pow.go index f15cbf1..e561ed4 100644 --- a/node/expr/assign_op/pow.go +++ b/node/expr/assign_op/pow.go @@ -13,6 +13,7 @@ func NewPow(variable node.Node, expression node.Node) node.Node { AssignOp{ "AssignPow", map[string]interface{}{}, + nil, variable, expression, }, @@ -35,6 +36,15 @@ func (n Pow) SetAttribute(key string, value interface{}) { n.attributes[key] = value } +func (n Pow) Position() *node.Position { + return n.position +} + +func (n Pow) SetPosition(p *node.Position) node.Node { + n.position = p + return n +} + func (n Pow) Walk(v node.Visitor) { if v.EnterNode(n) == false { return diff --git a/node/expr/assign_op/shift_left.go b/node/expr/assign_op/shift_left.go index 91efb9e..1b1960a 100644 --- a/node/expr/assign_op/shift_left.go +++ b/node/expr/assign_op/shift_left.go @@ -13,6 +13,7 @@ func NewShiftLeft(variable node.Node, expression node.Node) node.Node { AssignOp{ "AssignShiftLeft", map[string]interface{}{}, + nil, variable, expression, }, @@ -35,6 +36,15 @@ func (n ShiftLeft) SetAttribute(key string, value interface{}) { n.attributes[key] = value } +func (n ShiftLeft) Position() *node.Position { + return n.position +} + +func (n ShiftLeft) SetPosition(p *node.Position) node.Node { + n.position = p + return n +} + func (n ShiftLeft) Walk(v node.Visitor) { if v.EnterNode(n) == false { return diff --git a/node/expr/assign_op/shift_right.go b/node/expr/assign_op/shift_right.go index e61cf5f..79b0a51 100644 --- a/node/expr/assign_op/shift_right.go +++ b/node/expr/assign_op/shift_right.go @@ -13,6 +13,7 @@ func NewShiftRight(variable node.Node, expression node.Node) node.Node { AssignOp{ "AssignShiftRight", map[string]interface{}{}, + nil, variable, expression, }, @@ -35,6 +36,15 @@ func (n ShiftRight) SetAttribute(key string, value interface{}) { n.attributes[key] = value } +func (n ShiftRight) Position() *node.Position { + return n.position +} + +func (n ShiftRight) SetPosition(p *node.Position) node.Node { + n.position = p + return n +} + func (n ShiftRight) Walk(v node.Visitor) { if v.EnterNode(n) == false { return diff --git a/node/expr/binary_op/binary_op.go b/node/expr/binary_op/binary_op.go index 11075ca..9dc10d6 100644 --- a/node/expr/binary_op/binary_op.go +++ b/node/expr/binary_op/binary_op.go @@ -7,6 +7,7 @@ import ( type BinaryOp struct { name string attributes map[string]interface{} + position *node.Position left node.Node right node.Node } diff --git a/node/expr/binary_op/bitwise_and.go b/node/expr/binary_op/bitwise_and.go index ab81ba1..9aa6cca 100644 --- a/node/expr/binary_op/bitwise_and.go +++ b/node/expr/binary_op/bitwise_and.go @@ -13,6 +13,7 @@ func NewBitwiseAnd(variable node.Node, expression node.Node) node.Node { BinaryOp{ "BinaryBitwiseAnd", map[string]interface{}{}, + nil, variable, expression, }, @@ -35,6 +36,15 @@ func (n BitwiseAnd) SetAttribute(key string, value interface{}) { n.attributes[key] = value } +func (n BitwiseAnd) Position() *node.Position { + return n.position +} + +func (n BitwiseAnd) SetPosition(p *node.Position) node.Node { + n.position = p + return n +} + func (n BitwiseAnd) Walk(v node.Visitor) { if v.EnterNode(n) == false { return diff --git a/node/expr/binary_op/bitwise_or.go b/node/expr/binary_op/bitwise_or.go index 80f82fa..2b3fff9 100644 --- a/node/expr/binary_op/bitwise_or.go +++ b/node/expr/binary_op/bitwise_or.go @@ -13,6 +13,7 @@ func NewBitwiseOr(variable node.Node, expression node.Node) node.Node { BinaryOp{ "BinaryBitwiseOr", map[string]interface{}{}, + nil, variable, expression, }, @@ -31,6 +32,15 @@ func (n BitwiseOr) SetAttribute(key string, value interface{}) { n.attributes[key] = value } +func (n BitwiseOr) Position() *node.Position { + return n.position +} + +func (n BitwiseOr) SetPosition(p *node.Position) node.Node { + n.position = p + return n +} + func (n BitwiseOr) Name() string { return "BitwiseOr" } diff --git a/node/expr/binary_op/bitwise_xor.go b/node/expr/binary_op/bitwise_xor.go index fa3fe7d..93c6513 100644 --- a/node/expr/binary_op/bitwise_xor.go +++ b/node/expr/binary_op/bitwise_xor.go @@ -13,6 +13,7 @@ func NewBitwiseXor(variable node.Node, expression node.Node) node.Node { BinaryOp{ "BinaryBitwiseXor", map[string]interface{}{}, + nil, variable, expression, }, @@ -31,6 +32,15 @@ func (n BitwiseXor) SetAttribute(key string, value interface{}) { n.attributes[key] = value } +func (n BitwiseXor) Position() *node.Position { + return n.position +} + +func (n BitwiseXor) SetPosition(p *node.Position) node.Node { + n.position = p + return n +} + func (n BitwiseXor) Name() string { return "BitwiseXor" } diff --git a/node/expr/binary_op/boolean_and.go b/node/expr/binary_op/boolean_and.go index f5cf5f7..c99eccb 100644 --- a/node/expr/binary_op/boolean_and.go +++ b/node/expr/binary_op/boolean_and.go @@ -13,6 +13,7 @@ func NewBooleanAnd(variable node.Node, expression node.Node) node.Node { BinaryOp{ "BinaryBooleanAnd", map[string]interface{}{}, + nil, variable, expression, }, @@ -35,6 +36,15 @@ func (n BooleanAnd) SetAttribute(key string, value interface{}) { n.attributes[key] = value } +func (n BooleanAnd) Position() *node.Position { + return n.position +} + +func (n BooleanAnd) SetPosition(p *node.Position) node.Node { + n.position = p + return n +} + func (n BooleanAnd) Walk(v node.Visitor) { if v.EnterNode(n) == false { return diff --git a/node/expr/binary_op/boolean_or.go b/node/expr/binary_op/boolean_or.go index 5a1fe15..f08aa75 100644 --- a/node/expr/binary_op/boolean_or.go +++ b/node/expr/binary_op/boolean_or.go @@ -13,6 +13,7 @@ func NewBooleanOr(variable node.Node, expression node.Node) node.Node { BinaryOp{ "BinaryBooleanOr", map[string]interface{}{}, + nil, variable, expression, }, @@ -35,6 +36,15 @@ func (n BooleanOr) SetAttribute(key string, value interface{}) { n.attributes[key] = value } +func (n BooleanOr) Position() *node.Position { + return n.position +} + +func (n BooleanOr) SetPosition(p *node.Position) node.Node { + n.position = p + return n +} + func (n BooleanOr) Walk(v node.Visitor) { if v.EnterNode(n) == false { return diff --git a/node/expr/binary_op/coalesce.go b/node/expr/binary_op/coalesce.go index 8088269..d07cd60 100644 --- a/node/expr/binary_op/coalesce.go +++ b/node/expr/binary_op/coalesce.go @@ -13,6 +13,7 @@ func NewCoalesce(variable node.Node, expression node.Node) node.Node { BinaryOp{ "BinaryCoalesce", map[string]interface{}{}, + nil, variable, expression, }, @@ -35,6 +36,15 @@ func (n Coalesce) SetAttribute(key string, value interface{}) { n.attributes[key] = value } +func (n Coalesce) Position() *node.Position { + return n.position +} + +func (n Coalesce) SetPosition(p *node.Position) node.Node { + n.position = p + return n +} + func (n Coalesce) Walk(v node.Visitor) { if v.EnterNode(n) == false { return diff --git a/node/expr/binary_op/concat.go b/node/expr/binary_op/concat.go index fa09506..e6012d9 100644 --- a/node/expr/binary_op/concat.go +++ b/node/expr/binary_op/concat.go @@ -13,6 +13,7 @@ func NewConcat(variable node.Node, expression node.Node) node.Node { BinaryOp{ "BinaryConcat", map[string]interface{}{}, + nil, variable, expression, }, @@ -35,6 +36,15 @@ func (n Concat) SetAttribute(key string, value interface{}) { n.attributes[key] = value } +func (n Concat) Position() *node.Position { + return n.position +} + +func (n Concat) SetPosition(p *node.Position) node.Node { + n.position = p + return n +} + func (n Concat) Walk(v node.Visitor) { if v.EnterNode(n) == false { return diff --git a/node/expr/binary_op/div.go b/node/expr/binary_op/div.go index bd98153..e940d49 100644 --- a/node/expr/binary_op/div.go +++ b/node/expr/binary_op/div.go @@ -13,6 +13,7 @@ func NewDiv(variable node.Node, expression node.Node) node.Node { BinaryOp{ "BinaryDiv", map[string]interface{}{}, + nil, variable, expression, }, @@ -35,6 +36,15 @@ func (n Div) SetAttribute(key string, value interface{}) { n.attributes[key] = value } +func (n Div) Position() *node.Position { + return n.position +} + +func (n Div) SetPosition(p *node.Position) node.Node { + n.position = p + return n +} + func (n Div) Walk(v node.Visitor) { if v.EnterNode(n) == false { return diff --git a/node/expr/binary_op/equal.go b/node/expr/binary_op/equal.go index 6594e59..654dd2a 100644 --- a/node/expr/binary_op/equal.go +++ b/node/expr/binary_op/equal.go @@ -13,6 +13,7 @@ func NewEqual(variable node.Node, expression node.Node) node.Node { BinaryOp{ "BinaryEqual", map[string]interface{}{}, + nil, variable, expression, }, @@ -35,6 +36,15 @@ func (n Equal) SetAttribute(key string, value interface{}) { n.attributes[key] = value } +func (n Equal) Position() *node.Position { + return n.position +} + +func (n Equal) SetPosition(p *node.Position) node.Node { + n.position = p + return n +} + func (n Equal) Walk(v node.Visitor) { if v.EnterNode(n) == false { return diff --git a/node/expr/binary_op/greater.go b/node/expr/binary_op/greater.go index 217b4fa..b7bb483 100644 --- a/node/expr/binary_op/greater.go +++ b/node/expr/binary_op/greater.go @@ -13,6 +13,7 @@ func NewGreater(variable node.Node, expression node.Node) node.Node { BinaryOp{ "BinaryGreater", map[string]interface{}{}, + nil, variable, expression, }, @@ -35,6 +36,15 @@ func (n Greater) SetAttribute(key string, value interface{}) { n.attributes[key] = value } +func (n Greater) Position() *node.Position { + return n.position +} + +func (n Greater) SetPosition(p *node.Position) node.Node { + n.position = p + return n +} + func (n Greater) Walk(v node.Visitor) { if v.EnterNode(n) == false { return diff --git a/node/expr/binary_op/greater_or_equal.go b/node/expr/binary_op/greater_or_equal.go index 464cd83..a13d59b 100644 --- a/node/expr/binary_op/greater_or_equal.go +++ b/node/expr/binary_op/greater_or_equal.go @@ -13,6 +13,7 @@ func NewGreaterOrEqual(variable node.Node, expression node.Node) node.Node { BinaryOp{ "BinaryGreaterOrEqual", map[string]interface{}{}, + nil, variable, expression, }, @@ -35,6 +36,15 @@ func (n GreaterOrEqual) SetAttribute(key string, value interface{}) { n.attributes[key] = value } +func (n GreaterOrEqual) Position() *node.Position { + return n.position +} + +func (n GreaterOrEqual) SetPosition(p *node.Position) node.Node { + n.position = p + return n +} + func (n GreaterOrEqual) Walk(v node.Visitor) { if v.EnterNode(n) == false { return diff --git a/node/expr/binary_op/identical.go b/node/expr/binary_op/identical.go index 455ce7d..efd5c14 100644 --- a/node/expr/binary_op/identical.go +++ b/node/expr/binary_op/identical.go @@ -13,6 +13,7 @@ func NewIdentical(variable node.Node, expression node.Node) node.Node { BinaryOp{ "BinaryIdentical", map[string]interface{}{}, + nil, variable, expression, }, @@ -35,6 +36,15 @@ func (n Identical) SetAttribute(key string, value interface{}) { n.attributes[key] = value } +func (n Identical) Position() *node.Position { + return n.position +} + +func (n Identical) SetPosition(p *node.Position) node.Node { + n.position = p + return n +} + func (n Identical) Walk(v node.Visitor) { if v.EnterNode(n) == false { return diff --git a/node/expr/binary_op/logical_and.go b/node/expr/binary_op/logical_and.go index ba22f56..3972e92 100644 --- a/node/expr/binary_op/logical_and.go +++ b/node/expr/binary_op/logical_and.go @@ -13,6 +13,7 @@ func NewLogicalAnd(variable node.Node, expression node.Node) node.Node { BinaryOp{ "BinaryLogicalAnd", map[string]interface{}{}, + nil, variable, expression, }, @@ -35,6 +36,15 @@ func (n LogicalAnd) SetAttribute(key string, value interface{}) { n.attributes[key] = value } +func (n LogicalAnd) Position() *node.Position { + return n.position +} + +func (n LogicalAnd) SetPosition(p *node.Position) node.Node { + n.position = p + return n +} + func (n LogicalAnd) Walk(v node.Visitor) { if v.EnterNode(n) == false { return diff --git a/node/expr/binary_op/logical_or.go b/node/expr/binary_op/logical_or.go index a8d99e7..dc22d55 100644 --- a/node/expr/binary_op/logical_or.go +++ b/node/expr/binary_op/logical_or.go @@ -13,6 +13,7 @@ func NewLogicalOr(variable node.Node, expression node.Node) node.Node { BinaryOp{ "BinaryLogicalOr", map[string]interface{}{}, + nil, variable, expression, }, @@ -35,6 +36,15 @@ func (n LogicalOr) SetAttribute(key string, value interface{}) { n.attributes[key] = value } +func (n LogicalOr) Position() *node.Position { + return n.position +} + +func (n LogicalOr) SetPosition(p *node.Position) node.Node { + n.position = p + return n +} + func (n LogicalOr) Walk(v node.Visitor) { if v.EnterNode(n) == false { return diff --git a/node/expr/binary_op/logical_xor.go b/node/expr/binary_op/logical_xor.go index 4e9f022..47bd1de 100644 --- a/node/expr/binary_op/logical_xor.go +++ b/node/expr/binary_op/logical_xor.go @@ -13,6 +13,7 @@ func NewLogicalXor(variable node.Node, expression node.Node) node.Node { BinaryOp{ "BinaryLogicalXor", map[string]interface{}{}, + nil, variable, expression, }, @@ -35,6 +36,15 @@ func (n LogicalXor) SetAttribute(key string, value interface{}) { n.attributes[key] = value } +func (n LogicalXor) Position() *node.Position { + return n.position +} + +func (n LogicalXor) SetPosition(p *node.Position) node.Node { + n.position = p + return n +} + func (n LogicalXor) Walk(v node.Visitor) { if v.EnterNode(n) == false { return diff --git a/node/expr/binary_op/minus.go b/node/expr/binary_op/minus.go index 2e6a7af..fe68838 100644 --- a/node/expr/binary_op/minus.go +++ b/node/expr/binary_op/minus.go @@ -13,6 +13,7 @@ func NewMinus(variable node.Node, expression node.Node) node.Node { BinaryOp{ "BinaryMinus", map[string]interface{}{}, + nil, variable, expression, }, @@ -35,6 +36,15 @@ func (n Minus) SetAttribute(key string, value interface{}) { n.attributes[key] = value } +func (n Minus) Position() *node.Position { + return n.position +} + +func (n Minus) SetPosition(p *node.Position) node.Node { + n.position = p + return n +} + func (n Minus) Walk(v node.Visitor) { if v.EnterNode(n) == false { return diff --git a/node/expr/binary_op/mod.go b/node/expr/binary_op/mod.go index 5dfa0db..e69f016 100644 --- a/node/expr/binary_op/mod.go +++ b/node/expr/binary_op/mod.go @@ -13,6 +13,7 @@ func NewMod(variable node.Node, expression node.Node) node.Node { BinaryOp{ "BinaryMod", map[string]interface{}{}, + nil, variable, expression, }, @@ -35,6 +36,15 @@ func (n Mod) SetAttribute(key string, value interface{}) { n.attributes[key] = value } +func (n Mod) Position() *node.Position { + return n.position +} + +func (n Mod) SetPosition(p *node.Position) node.Node { + n.position = p + return n +} + func (n Mod) Walk(v node.Visitor) { if v.EnterNode(n) == false { return diff --git a/node/expr/binary_op/mul.go b/node/expr/binary_op/mul.go index 849c454..2174112 100644 --- a/node/expr/binary_op/mul.go +++ b/node/expr/binary_op/mul.go @@ -13,6 +13,7 @@ func NewMul(variable node.Node, expression node.Node) node.Node { BinaryOp{ "BinaryMul", map[string]interface{}{}, + nil, variable, expression, }, @@ -35,6 +36,15 @@ func (n Mul) SetAttribute(key string, value interface{}) { n.attributes[key] = value } +func (n Mul) Position() *node.Position { + return n.position +} + +func (n Mul) SetPosition(p *node.Position) node.Node { + n.position = p + return n +} + func (n Mul) Walk(v node.Visitor) { if v.EnterNode(n) == false { return diff --git a/node/expr/binary_op/not_equal.go b/node/expr/binary_op/not_equal.go index 7b4d890..34c422d 100644 --- a/node/expr/binary_op/not_equal.go +++ b/node/expr/binary_op/not_equal.go @@ -13,6 +13,7 @@ func NewNotEqual(variable node.Node, expression node.Node) node.Node { BinaryOp{ "BinaryNotEqual", map[string]interface{}{}, + nil, variable, expression, }, @@ -35,6 +36,15 @@ func (n NotEqual) SetAttribute(key string, value interface{}) { n.attributes[key] = value } +func (n NotEqual) Position() *node.Position { + return n.position +} + +func (n NotEqual) SetPosition(p *node.Position) node.Node { + n.position = p + return n +} + func (n NotEqual) Walk(v node.Visitor) { if v.EnterNode(n) == false { return diff --git a/node/expr/binary_op/not_identical.go b/node/expr/binary_op/not_identical.go index 92452f2..6d8d762 100644 --- a/node/expr/binary_op/not_identical.go +++ b/node/expr/binary_op/not_identical.go @@ -13,6 +13,7 @@ func NewNotIdentical(variable node.Node, expression node.Node) node.Node { BinaryOp{ "BinaryNotIdentical", map[string]interface{}{}, + nil, variable, expression, }, @@ -35,6 +36,15 @@ func (n NotIdentical) SetAttribute(key string, value interface{}) { n.attributes[key] = value } +func (n NotIdentical) Position() *node.Position { + return n.position +} + +func (n NotIdentical) SetPosition(p *node.Position) node.Node { + n.position = p + return n +} + func (n NotIdentical) Walk(v node.Visitor) { if v.EnterNode(n) == false { return diff --git a/node/expr/binary_op/plus.go b/node/expr/binary_op/plus.go index 9b63c6d..e3082c7 100644 --- a/node/expr/binary_op/plus.go +++ b/node/expr/binary_op/plus.go @@ -13,6 +13,7 @@ func NewPlus(variable node.Node, expression node.Node) node.Node { BinaryOp{ "BinaryPlus", map[string]interface{}{}, + nil, variable, expression, }, @@ -35,6 +36,15 @@ func (n Plus) SetAttribute(key string, value interface{}) { n.attributes[key] = value } +func (n Plus) Position() *node.Position { + return n.position +} + +func (n Plus) SetPosition(p *node.Position) node.Node { + n.position = p + return n +} + func (n Plus) Walk(v node.Visitor) { if v.EnterNode(n) == false { return diff --git a/node/expr/binary_op/pow.go b/node/expr/binary_op/pow.go index e45022f..b7c74e8 100644 --- a/node/expr/binary_op/pow.go +++ b/node/expr/binary_op/pow.go @@ -13,6 +13,7 @@ func NewPow(variable node.Node, expression node.Node) node.Node { BinaryOp{ "BinaryPow", map[string]interface{}{}, + nil, variable, expression, }, @@ -35,6 +36,15 @@ func (n Pow) SetAttribute(key string, value interface{}) { n.attributes[key] = value } +func (n Pow) Position() *node.Position { + return n.position +} + +func (n Pow) SetPosition(p *node.Position) node.Node { + n.position = p + return n +} + func (n Pow) Walk(v node.Visitor) { if v.EnterNode(n) == false { return diff --git a/node/expr/binary_op/shift_left.go b/node/expr/binary_op/shift_left.go index 80195ec..4d7bdfa 100644 --- a/node/expr/binary_op/shift_left.go +++ b/node/expr/binary_op/shift_left.go @@ -13,6 +13,7 @@ func NewShiftLeft(variable node.Node, expression node.Node) node.Node { BinaryOp{ "BinaryShiftLeft", map[string]interface{}{}, + nil, variable, expression, }, @@ -35,6 +36,15 @@ func (n ShiftLeft) SetAttribute(key string, value interface{}) { n.attributes[key] = value } +func (n ShiftLeft) Position() *node.Position { + return n.position +} + +func (n ShiftLeft) SetPosition(p *node.Position) node.Node { + n.position = p + return n +} + func (n ShiftLeft) Walk(v node.Visitor) { if v.EnterNode(n) == false { return diff --git a/node/expr/binary_op/shift_right.go b/node/expr/binary_op/shift_right.go index e1e0281..960bdb0 100644 --- a/node/expr/binary_op/shift_right.go +++ b/node/expr/binary_op/shift_right.go @@ -13,6 +13,7 @@ func NewShiftRight(variable node.Node, expression node.Node) node.Node { BinaryOp{ "BinaryShiftRight", map[string]interface{}{}, + nil, variable, expression, }, @@ -35,6 +36,15 @@ func (n ShiftRight) SetAttribute(key string, value interface{}) { n.attributes[key] = value } +func (n ShiftRight) Position() *node.Position { + return n.position +} + +func (n ShiftRight) SetPosition(p *node.Position) node.Node { + n.position = p + return n +} + func (n ShiftRight) Walk(v node.Visitor) { if v.EnterNode(n) == false { return diff --git a/node/expr/binary_op/smaller.go b/node/expr/binary_op/smaller.go index 4be0eaf..79d4160 100644 --- a/node/expr/binary_op/smaller.go +++ b/node/expr/binary_op/smaller.go @@ -13,6 +13,7 @@ func NewSmaller(variable node.Node, expression node.Node) node.Node { BinaryOp{ "BinarySmaller", map[string]interface{}{}, + nil, variable, expression, }, @@ -35,6 +36,15 @@ func (n Smaller) SetAttribute(key string, value interface{}) { n.attributes[key] = value } +func (n Smaller) Position() *node.Position { + return n.position +} + +func (n Smaller) SetPosition(p *node.Position) node.Node { + n.position = p + return n +} + func (n Smaller) Walk(v node.Visitor) { if v.EnterNode(n) == false { return diff --git a/node/expr/binary_op/smaller_or_equal.go b/node/expr/binary_op/smaller_or_equal.go index 71f9607..0001951 100644 --- a/node/expr/binary_op/smaller_or_equal.go +++ b/node/expr/binary_op/smaller_or_equal.go @@ -13,6 +13,7 @@ func NewSmallerOrEqual(variable node.Node, expression node.Node) node.Node { BinaryOp{ "BinarySmallerOrEqual", map[string]interface{}{}, + nil, variable, expression, }, @@ -35,6 +36,15 @@ func (n SmallerOrEqual) SetAttribute(key string, value interface{}) { n.attributes[key] = value } +func (n SmallerOrEqual) Position() *node.Position { + return n.position +} + +func (n SmallerOrEqual) SetPosition(p *node.Position) node.Node { + n.position = p + return n +} + func (n SmallerOrEqual) Walk(v node.Visitor) { if v.EnterNode(n) == false { return diff --git a/node/expr/binary_op/spaceship.go b/node/expr/binary_op/spaceship.go index 41ccd1e..65330fb 100644 --- a/node/expr/binary_op/spaceship.go +++ b/node/expr/binary_op/spaceship.go @@ -13,6 +13,7 @@ func NewSpaceship(variable node.Node, expression node.Node) node.Node { BinaryOp{ "BinarySpaceship", map[string]interface{}{}, + nil, variable, expression, }, @@ -35,6 +36,15 @@ func (n Spaceship) SetAttribute(key string, value interface{}) { n.attributes[key] = value } +func (n Spaceship) Position() *node.Position { + return n.position +} + +func (n Spaceship) SetPosition(p *node.Position) node.Node { + n.position = p + return n +} + func (n Spaceship) Walk(v node.Visitor) { if v.EnterNode(n) == false { return diff --git a/node/expr/bitwise_not.go b/node/expr/bitwise_not.go index 638b14a..84ebd74 100644 --- a/node/expr/bitwise_not.go +++ b/node/expr/bitwise_not.go @@ -7,6 +7,7 @@ import ( type BitwiseNot struct { name string attributes map[string]interface{} + position *node.Position expr node.Node } @@ -14,6 +15,7 @@ func NewBitwiseNot(expression node.Node) node.Node { return BitwiseNot{ "BitwiseNot", map[string]interface{}{}, + nil, expression, } } @@ -34,6 +36,15 @@ func (n BitwiseNot) SetAttribute(key string, value interface{}) { n.attributes[key] = value } +func (n BitwiseNot) Position() *node.Position { + return n.position +} + +func (n BitwiseNot) SetPosition(p *node.Position) node.Node { + n.position = p + return n +} + func (n BitwiseNot) Walk(v node.Visitor) { if v.EnterNode(n) == false { return diff --git a/node/expr/boolean_not.go b/node/expr/boolean_not.go index d97fccc..af5a749 100644 --- a/node/expr/boolean_not.go +++ b/node/expr/boolean_not.go @@ -7,6 +7,7 @@ import ( type BooleanNot struct { name string attributes map[string]interface{} + position *node.Position expr node.Node } @@ -14,6 +15,7 @@ func NewBooleanNot(expression node.Node) node.Node { return BooleanNot{ "BooleanNot", map[string]interface{}{}, + nil, expression, } } @@ -34,6 +36,15 @@ func (n BooleanNot) SetAttribute(key string, value interface{}) { n.attributes[key] = value } +func (n BooleanNot) Position() *node.Position { + return n.position +} + +func (n BooleanNot) SetPosition(p *node.Position) node.Node { + n.position = p + return n +} + func (n BooleanNot) Walk(v node.Visitor) { if v.EnterNode(n) == false { return diff --git a/node/expr/cast/cast.go b/node/expr/cast/cast.go index fc0a8c0..6891866 100644 --- a/node/expr/cast/cast.go +++ b/node/expr/cast/cast.go @@ -7,5 +7,6 @@ import ( type Cast struct { name string attributes map[string]interface{} + position *node.Position expr node.Node } diff --git a/node/expr/cast/cast_array.go b/node/expr/cast/cast_array.go index dd3ca08..10c21f6 100644 --- a/node/expr/cast/cast_array.go +++ b/node/expr/cast/cast_array.go @@ -13,6 +13,7 @@ func NewCastArray(expr node.Node) node.Node { Cast{ "CastArray", map[string]interface{}{}, + nil, expr, }, } @@ -34,6 +35,15 @@ func (n CastArray) SetAttribute(key string, value interface{}) { n.attributes[key] = value } +func (n CastArray) Position() *node.Position { + return n.position +} + +func (n CastArray) SetPosition(p *node.Position) node.Node { + n.position = p + return n +} + func (n CastArray) Walk(v node.Visitor) { if v.EnterNode(n) == false { return diff --git a/node/expr/cast/cast_bool.go b/node/expr/cast/cast_bool.go index 58a7770..c310f2f 100644 --- a/node/expr/cast/cast_bool.go +++ b/node/expr/cast/cast_bool.go @@ -13,6 +13,7 @@ func NewCastBool(expr node.Node) node.Node { Cast{ "CastBool", map[string]interface{}{}, + nil, expr, }, } @@ -34,6 +35,15 @@ func (n CastBool) SetAttribute(key string, value interface{}) { n.attributes[key] = value } +func (n CastBool) Position() *node.Position { + return n.position +} + +func (n CastBool) SetPosition(p *node.Position) node.Node { + n.position = p + return n +} + func (n CastBool) Walk(v node.Visitor) { if v.EnterNode(n) == false { return diff --git a/node/expr/cast/cast_double.go b/node/expr/cast/cast_double.go index 05fe718..c0802d9 100644 --- a/node/expr/cast/cast_double.go +++ b/node/expr/cast/cast_double.go @@ -13,6 +13,7 @@ func NewCastDouble(expr node.Node) node.Node { Cast{ "CastDouble", map[string]interface{}{}, + nil, expr, }, } @@ -34,6 +35,15 @@ func (n CastDouble) SetAttribute(key string, value interface{}) { n.attributes[key] = value } +func (n CastDouble) Position() *node.Position { + return n.position +} + +func (n CastDouble) SetPosition(p *node.Position) node.Node { + n.position = p + return n +} + func (n CastDouble) Walk(v node.Visitor) { if v.EnterNode(n) == false { return diff --git a/node/expr/cast/cast_int.go b/node/expr/cast/cast_int.go index 24e57de..9bce42b 100644 --- a/node/expr/cast/cast_int.go +++ b/node/expr/cast/cast_int.go @@ -13,6 +13,7 @@ func NewCastInt(expr node.Node) node.Node { Cast{ "CastInt", map[string]interface{}{}, + nil, expr, }, } @@ -34,6 +35,15 @@ func (n CastInt) SetAttribute(key string, value interface{}) { n.attributes[key] = value } +func (n CastInt) Position() *node.Position { + return n.position +} + +func (n CastInt) SetPosition(p *node.Position) node.Node { + n.position = p + return n +} + func (n CastInt) Walk(v node.Visitor) { if v.EnterNode(n) == false { return diff --git a/node/expr/cast/cast_object.go b/node/expr/cast/cast_object.go index 06f877f..9d12489 100644 --- a/node/expr/cast/cast_object.go +++ b/node/expr/cast/cast_object.go @@ -13,6 +13,7 @@ func NewCastObject(expr node.Node) node.Node { Cast{ "CastObject", map[string]interface{}{}, + nil, expr, }, } @@ -34,6 +35,15 @@ func (n CastObject) SetAttribute(key string, value interface{}) { n.attributes[key] = value } +func (n CastObject) Position() *node.Position { + return n.position +} + +func (n CastObject) SetPosition(p *node.Position) node.Node { + n.position = p + return n +} + func (n CastObject) Walk(v node.Visitor) { if v.EnterNode(n) == false { return diff --git a/node/expr/cast/cast_string.go b/node/expr/cast/cast_string.go index e7bcd57..a42959a 100644 --- a/node/expr/cast/cast_string.go +++ b/node/expr/cast/cast_string.go @@ -13,6 +13,7 @@ func NewCastString(expr node.Node) node.Node { Cast{ "CastString", map[string]interface{}{}, + nil, expr, }, } @@ -34,6 +35,15 @@ func (n CastString) SetAttribute(key string, value interface{}) { n.attributes[key] = value } +func (n CastString) Position() *node.Position { + return n.position +} + +func (n CastString) SetPosition(p *node.Position) node.Node { + n.position = p + return n +} + func (n CastString) Walk(v node.Visitor) { if v.EnterNode(n) == false { return diff --git a/node/expr/cast/cast_unset.go b/node/expr/cast/cast_unset.go index bd79ecc..9b7d551 100644 --- a/node/expr/cast/cast_unset.go +++ b/node/expr/cast/cast_unset.go @@ -13,6 +13,7 @@ func NewCastUnset(expr node.Node) node.Node { Cast{ "CastUnset", map[string]interface{}{}, + nil, expr, }, } @@ -34,6 +35,15 @@ func (n CastUnset) SetAttribute(key string, value interface{}) { n.attributes[key] = value } +func (n CastUnset) Position() *node.Position { + return n.position +} + +func (n CastUnset) SetPosition(p *node.Position) node.Node { + n.position = p + return n +} + func (n CastUnset) Walk(v node.Visitor) { if v.EnterNode(n) == false { return diff --git a/node/expr/class_const_fetch.go b/node/expr/class_const_fetch.go index 6cae135..64dc9fe 100644 --- a/node/expr/class_const_fetch.go +++ b/node/expr/class_const_fetch.go @@ -16,6 +16,15 @@ func (n ClassConstFetch) SetAttribute(key string, value interface{}) { n.attributes[key] = value } +func (n ClassConstFetch) Position() *node.Position { + return n.position +} + +func (n ClassConstFetch) SetPosition(p *node.Position) node.Node { + n.position = p + return n +} + func (n ClassConstFetch) Name() string { return "ClassConstFetch" } @@ -23,6 +32,7 @@ func (n ClassConstFetch) Name() string { type ClassConstFetch struct { name string attributes map[string]interface{} + position *node.Position class node.Node constantName node.Node } @@ -31,6 +41,7 @@ func NewClassConstFetch(class node.Node, constantName node.Node) node.Node { return ClassConstFetch{ "ClassConstFetch", map[string]interface{}{}, + nil, class, constantName, } diff --git a/node/expr/clone.go b/node/expr/clone.go index 8b683d8..394fb1d 100644 --- a/node/expr/clone.go +++ b/node/expr/clone.go @@ -7,6 +7,7 @@ import ( type Clone struct { name string attributes map[string]interface{} + position *node.Position expr node.Node } @@ -14,6 +15,7 @@ func NewClone(expression node.Node) node.Node { return Clone{ "Clone", map[string]interface{}{}, + nil, expression, } } @@ -34,6 +36,15 @@ func (n Clone) SetAttribute(key string, value interface{}) { n.attributes[key] = value } +func (n Clone) Position() *node.Position { + return n.position +} + +func (n Clone) SetPosition(p *node.Position) node.Node { + n.position = p + return n +} + func (n Clone) Walk(v node.Visitor) { if v.EnterNode(n) == false { return diff --git a/node/expr/closure.go b/node/expr/closure.go index 2f701d6..03e444b 100644 --- a/node/expr/closure.go +++ b/node/expr/closure.go @@ -7,6 +7,7 @@ import ( type Closure struct { name string attributes map[string]interface{} + position *node.Position params []node.Node uses []node.Node returnType node.Node @@ -20,6 +21,7 @@ func NewClosure(params []node.Node, uses []node.Node, returnType node.Node, stmt "isReturnRef": isReturnRef, "isStatic": isStatic, }, + nil, params, uses, returnType, @@ -43,6 +45,15 @@ func (n Closure) SetAttribute(key string, value interface{}) { n.attributes[key] = value } +func (n Closure) Position() *node.Position { + return n.position +} + +func (n Closure) SetPosition(p *node.Position) node.Node { + n.position = p + return n +} + func (n Closure) Walk(v node.Visitor) { if v.EnterNode(n) == false { return diff --git a/node/expr/closure_use.go b/node/expr/closure_use.go index 1ffd894..40b9b13 100644 --- a/node/expr/closure_use.go +++ b/node/expr/closure_use.go @@ -7,6 +7,7 @@ import ( type ClusureUse struct { name string attributes map[string]interface{} + position *node.Position variable node.Node } @@ -16,6 +17,7 @@ func NewClusureUse(variable node.Node, byRef bool) node.Node { map[string]interface{}{ "byRef": byRef, }, + nil, variable, } } @@ -36,6 +38,15 @@ func (n ClusureUse) SetAttribute(key string, value interface{}) { n.attributes[key] = value } +func (n ClusureUse) Position() *node.Position { + return n.position +} + +func (n ClusureUse) SetPosition(p *node.Position) node.Node { + n.position = p + return n +} + func (n ClusureUse) Walk(v node.Visitor) { if v.EnterNode(n) == false { return diff --git a/node/expr/const_fetch.go b/node/expr/const_fetch.go index 1202d98..a34c587 100644 --- a/node/expr/const_fetch.go +++ b/node/expr/const_fetch.go @@ -7,6 +7,7 @@ import ( type ConstFetch struct { name string attributes map[string]interface{} + position *node.Position constant node.Node } @@ -14,6 +15,7 @@ func NewConstFetch(constant node.Node) node.Node { return ConstFetch{ "ConstFetch", map[string]interface{}{}, + nil, constant, } } @@ -34,6 +36,15 @@ func (n ConstFetch) SetAttribute(key string, value interface{}) { n.attributes[key] = value } +func (n ConstFetch) Position() *node.Position { + return n.position +} + +func (n ConstFetch) SetPosition(p *node.Position) node.Node { + n.position = p + return n +} + func (n ConstFetch) Walk(v node.Visitor) { if v.EnterNode(n) == false { return diff --git a/node/expr/empty.go b/node/expr/empty.go index 517831f..a72d4cd 100644 --- a/node/expr/empty.go +++ b/node/expr/empty.go @@ -7,6 +7,7 @@ import ( type Empty struct { name string attributes map[string]interface{} + position *node.Position expr node.Node } @@ -14,6 +15,7 @@ func NewEmpty(expression node.Node) node.Node { return Empty{ "Empty", map[string]interface{}{}, + nil, expression, } } @@ -34,6 +36,15 @@ func (n Empty) SetAttribute(key string, value interface{}) { n.attributes[key] = value } +func (n Empty) Position() *node.Position { + return n.position +} + +func (n Empty) SetPosition(p *node.Position) node.Node { + n.position = p + return n +} + func (n Empty) Walk(v node.Visitor) { if v.EnterNode(n) == false { return diff --git a/node/expr/error_suppress.go b/node/expr/error_suppress.go index cd9a36e..02fae96 100644 --- a/node/expr/error_suppress.go +++ b/node/expr/error_suppress.go @@ -7,6 +7,7 @@ import ( type ErrorSuppress struct { name string attributes map[string]interface{} + position *node.Position expr node.Node } @@ -14,6 +15,7 @@ func NewErrorSuppress(expression node.Node) node.Node { return ErrorSuppress{ "ErrorSuppress", map[string]interface{}{}, + nil, expression, } } @@ -34,6 +36,15 @@ func (n ErrorSuppress) SetAttribute(key string, value interface{}) { n.attributes[key] = value } +func (n ErrorSuppress) Position() *node.Position { + return n.position +} + +func (n ErrorSuppress) SetPosition(p *node.Position) node.Node { + n.position = p + return n +} + func (n ErrorSuppress) Walk(v node.Visitor) { if v.EnterNode(n) == false { return diff --git a/node/expr/eval.go b/node/expr/eval.go index 78c5fd4..9554aa9 100644 --- a/node/expr/eval.go +++ b/node/expr/eval.go @@ -7,6 +7,7 @@ import ( type Eval struct { name string attributes map[string]interface{} + position *node.Position expr node.Node } @@ -14,6 +15,7 @@ func NewEval(expression node.Node) node.Node { return Eval{ "Eval", map[string]interface{}{}, + nil, expression, } } @@ -34,6 +36,15 @@ func (n Eval) SetAttribute(key string, value interface{}) { n.attributes[key] = value } +func (n Eval) Position() *node.Position { + return n.position +} + +func (n Eval) SetPosition(p *node.Position) node.Node { + n.position = p + return n +} + func (n Eval) Walk(v node.Visitor) { if v.EnterNode(n) == false { return diff --git a/node/expr/exit.go b/node/expr/exit.go index 394c46e..d9bb659 100644 --- a/node/expr/exit.go +++ b/node/expr/exit.go @@ -7,6 +7,7 @@ import ( type Exit struct { name string attributes map[string]interface{} + position *node.Position expr node.Node } @@ -16,6 +17,7 @@ func NewExit(expr node.Node, isDie bool) node.Node { map[string]interface{}{ "isDie": isDie, }, + nil, expr, } } @@ -36,6 +38,15 @@ func (n Exit) SetAttribute(key string, value interface{}) { n.attributes[key] = value } +func (n Exit) Position() *node.Position { + return n.position +} + +func (n Exit) SetPosition(p *node.Position) node.Node { + n.position = p + return n +} + func (n Exit) Walk(v node.Visitor) { if v.EnterNode(n) == false { return diff --git a/node/expr/function_call.go b/node/expr/function_call.go index 8c9847c..468132f 100644 --- a/node/expr/function_call.go +++ b/node/expr/function_call.go @@ -7,6 +7,7 @@ import ( type FunctionCall struct { name string attributes map[string]interface{} + position *node.Position function node.Node arguments []node.Node } @@ -15,6 +16,7 @@ func NewFunctionCall(function node.Node, arguments []node.Node) node.Node { return FunctionCall{ "FunctionCall", map[string]interface{}{}, + nil, function, arguments, } @@ -36,6 +38,15 @@ func (n FunctionCall) SetAttribute(key string, value interface{}) { n.attributes[key] = value } +func (n FunctionCall) Position() *node.Position { + return n.position +} + +func (n FunctionCall) SetPosition(p *node.Position) node.Node { + n.position = p + return n +} + func (n FunctionCall) Walk(v node.Visitor) { if v.EnterNode(n) == false { return diff --git a/node/expr/include.go b/node/expr/include.go index 4df0525..b1ea766 100644 --- a/node/expr/include.go +++ b/node/expr/include.go @@ -7,6 +7,7 @@ import ( type Include struct { name string attributes map[string]interface{} + position *node.Position expr node.Node } @@ -14,6 +15,7 @@ func NewInclude(expression node.Node) node.Node { return Include{ "Include", map[string]interface{}{}, + nil, expression, } } @@ -34,6 +36,15 @@ func (n Include) SetAttribute(key string, value interface{}) { n.attributes[key] = value } +func (n Include) Position() *node.Position { + return n.position +} + +func (n Include) SetPosition(p *node.Position) node.Node { + n.position = p + return n +} + func (n Include) Walk(v node.Visitor) { if v.EnterNode(n) == false { return diff --git a/node/expr/include_once.go b/node/expr/include_once.go index 496ad00..dc08dd1 100644 --- a/node/expr/include_once.go +++ b/node/expr/include_once.go @@ -7,6 +7,7 @@ import ( type IncludeOnce struct { name string attributes map[string]interface{} + position *node.Position expr node.Node } @@ -14,6 +15,7 @@ func NewIncludeOnce(expression node.Node) node.Node { return IncludeOnce{ "IncludeOnce", map[string]interface{}{}, + nil, expression, } } @@ -34,6 +36,15 @@ func (n IncludeOnce) SetAttribute(key string, value interface{}) { n.attributes[key] = value } +func (n IncludeOnce) Position() *node.Position { + return n.position +} + +func (n IncludeOnce) SetPosition(p *node.Position) node.Node { + n.position = p + return n +} + func (n IncludeOnce) Walk(v node.Visitor) { if v.EnterNode(n) == false { return diff --git a/node/expr/instance_of.go b/node/expr/instance_of.go index 5456ff4..5d557ca 100644 --- a/node/expr/instance_of.go +++ b/node/expr/instance_of.go @@ -7,6 +7,7 @@ import ( type InstanceOf struct { name string attributes map[string]interface{} + position *node.Position expr node.Node class node.Node } @@ -15,6 +16,7 @@ func NewInstanceOf(expr node.Node, class node.Node) node.Node { return InstanceOf{ "InstanceOf", map[string]interface{}{}, + nil, expr, class, } @@ -36,6 +38,15 @@ func (n InstanceOf) SetAttribute(key string, value interface{}) { n.attributes[key] = value } +func (n InstanceOf) Position() *node.Position { + return n.position +} + +func (n InstanceOf) SetPosition(p *node.Position) node.Node { + n.position = p + return n +} + func (n InstanceOf) Walk(v node.Visitor) { if v.EnterNode(n) == false { return diff --git a/node/expr/isset.go b/node/expr/isset.go index d930272..9c8c607 100644 --- a/node/expr/isset.go +++ b/node/expr/isset.go @@ -7,6 +7,7 @@ import ( type Isset struct { name string attributes map[string]interface{} + position *node.Position variables []node.Node } @@ -14,6 +15,7 @@ func NewIsset(variables []node.Node) node.Node { return Isset{ "Isset", map[string]interface{}{}, + nil, variables, } } @@ -34,6 +36,15 @@ func (n Isset) SetAttribute(key string, value interface{}) { n.attributes[key] = value } +func (n Isset) Position() *node.Position { + return n.position +} + +func (n Isset) SetPosition(p *node.Position) node.Node { + n.position = p + return n +} + func (n Isset) Walk(v node.Visitor) { if v.EnterNode(n) == false { return diff --git a/node/expr/list.go b/node/expr/list.go index aecf4ae..3e956f7 100644 --- a/node/expr/list.go +++ b/node/expr/list.go @@ -7,6 +7,7 @@ import ( type List struct { name string attributes map[string]interface{} + position *node.Position items []node.Node } @@ -14,6 +15,7 @@ func NewList(items []node.Node) node.Node { return List{ "List", map[string]interface{}{}, + nil, items, } } @@ -34,6 +36,15 @@ func (n List) SetAttribute(key string, value interface{}) { n.attributes[key] = value } +func (n List) Position() *node.Position { + return n.position +} + +func (n List) SetPosition(p *node.Position) node.Node { + n.position = p + return n +} + func (n List) Walk(v node.Visitor) { if v.EnterNode(n) == false { return diff --git a/node/expr/method_call.go b/node/expr/method_call.go index 86595a6..e140f3b 100644 --- a/node/expr/method_call.go +++ b/node/expr/method_call.go @@ -7,6 +7,7 @@ import ( type MethodCall struct { name string attributes map[string]interface{} + position *node.Position variable node.Node method node.Node arguments []node.Node @@ -16,6 +17,7 @@ func NewMethodCall(variable node.Node, method node.Node, arguments []node.Node) return MethodCall{ "MethodCall", map[string]interface{}{}, + nil, variable, method, arguments, @@ -38,6 +40,15 @@ func (n MethodCall) SetAttribute(key string, value interface{}) { n.attributes[key] = value } +func (n MethodCall) Position() *node.Position { + return n.position +} + +func (n MethodCall) SetPosition(p *node.Position) node.Node { + n.position = p + return n +} + func (n MethodCall) Walk(v node.Visitor) { if v.EnterNode(n) == false { return diff --git a/node/expr/new.go b/node/expr/new.go index a9462b9..aaafe53 100644 --- a/node/expr/new.go +++ b/node/expr/new.go @@ -7,6 +7,7 @@ import ( type New struct { name string attributes map[string]interface{} + position *node.Position class node.Node arguments []node.Node } @@ -15,6 +16,7 @@ func NewNew(class node.Node, arguments []node.Node) node.Node { return New{ "New", map[string]interface{}{}, + nil, class, arguments, } @@ -36,6 +38,15 @@ func (n New) SetAttribute(key string, value interface{}) { n.attributes[key] = value } +func (n New) Position() *node.Position { + return n.position +} + +func (n New) SetPosition(p *node.Position) node.Node { + n.position = p + return n +} + func (n New) Walk(v node.Visitor) { if v.EnterNode(n) == false { return diff --git a/node/expr/post_dec.go b/node/expr/post_dec.go index 55f4105..23f0257 100644 --- a/node/expr/post_dec.go +++ b/node/expr/post_dec.go @@ -7,6 +7,7 @@ import ( type PostDec struct { name string attributes map[string]interface{} + position *node.Position variable node.Node } @@ -14,6 +15,7 @@ func NewPostDec(variable node.Node) node.Node { return PostDec{ "PostDec", map[string]interface{}{}, + nil, variable, } } @@ -34,6 +36,15 @@ func (n PostDec) SetAttribute(key string, value interface{}) { n.attributes[key] = value } +func (n PostDec) Position() *node.Position { + return n.position +} + +func (n PostDec) SetPosition(p *node.Position) node.Node { + n.position = p + return n +} + func (n PostDec) Walk(v node.Visitor) { if v.EnterNode(n) == false { return diff --git a/node/expr/post_inc.go b/node/expr/post_inc.go index 11944aa..c27d72e 100644 --- a/node/expr/post_inc.go +++ b/node/expr/post_inc.go @@ -7,6 +7,7 @@ import ( type PostInc struct { name string attributes map[string]interface{} + position *node.Position variable node.Node } @@ -14,6 +15,7 @@ func NewPostInc(variable node.Node) node.Node { return PostInc{ "PostInc", map[string]interface{}{}, + nil, variable, } } @@ -34,6 +36,15 @@ func (n PostInc) SetAttribute(key string, value interface{}) { n.attributes[key] = value } +func (n PostInc) Position() *node.Position { + return n.position +} + +func (n PostInc) SetPosition(p *node.Position) node.Node { + n.position = p + return n +} + func (n PostInc) Walk(v node.Visitor) { if v.EnterNode(n) == false { return diff --git a/node/expr/pre_dec.go b/node/expr/pre_dec.go index 23692d3..adcf9ac 100644 --- a/node/expr/pre_dec.go +++ b/node/expr/pre_dec.go @@ -7,6 +7,7 @@ import ( type PreDec struct { name string attributes map[string]interface{} + position *node.Position variable node.Node } @@ -14,6 +15,7 @@ func NewPreDec(variable node.Node) node.Node { return PreDec{ "PreDec", map[string]interface{}{}, + nil, variable, } } @@ -34,6 +36,15 @@ func (n PreDec) SetAttribute(key string, value interface{}) { n.attributes[key] = value } +func (n PreDec) Position() *node.Position { + return n.position +} + +func (n PreDec) SetPosition(p *node.Position) node.Node { + n.position = p + return n +} + func (n PreDec) Walk(v node.Visitor) { if v.EnterNode(n) == false { return diff --git a/node/expr/pre_inc.go b/node/expr/pre_inc.go index 88107f5..c18936b 100644 --- a/node/expr/pre_inc.go +++ b/node/expr/pre_inc.go @@ -7,6 +7,7 @@ import ( type PreInc struct { name string attributes map[string]interface{} + position *node.Position variable node.Node } @@ -14,6 +15,7 @@ func NewPreInc(variable node.Node) node.Node { return PreInc{ "PreInc", map[string]interface{}{}, + nil, variable, } } @@ -34,6 +36,15 @@ func (n PreInc) SetAttribute(key string, value interface{}) { n.attributes[key] = value } +func (n PreInc) Position() *node.Position { + return n.position +} + +func (n PreInc) SetPosition(p *node.Position) node.Node { + n.position = p + return n +} + func (n PreInc) Walk(v node.Visitor) { if v.EnterNode(n) == false { return diff --git a/node/expr/print.go b/node/expr/print.go index 2b0cfc4..9e1276a 100644 --- a/node/expr/print.go +++ b/node/expr/print.go @@ -7,6 +7,7 @@ import ( type Print struct { name string attributes map[string]interface{} + position *node.Position expr node.Node } @@ -14,6 +15,7 @@ func NewPrint(expression node.Node) node.Node { return Print{ "Print", map[string]interface{}{}, + nil, expression, } } @@ -34,6 +36,15 @@ func (n Print) SetAttribute(key string, value interface{}) { n.attributes[key] = value } +func (n Print) Position() *node.Position { + return n.position +} + +func (n Print) SetPosition(p *node.Position) node.Node { + n.position = p + return n +} + func (n Print) Walk(v node.Visitor) { if v.EnterNode(n) == false { return diff --git a/node/expr/property_fetch.go b/node/expr/property_fetch.go index d3be295..07b370c 100644 --- a/node/expr/property_fetch.go +++ b/node/expr/property_fetch.go @@ -7,6 +7,7 @@ import ( type PropertyFetch struct { name string attributes map[string]interface{} + position *node.Position variable node.Node property node.Node } @@ -15,6 +16,7 @@ func NewPropertyFetch(variable node.Node, property node.Node) node.Node { return PropertyFetch{ "PropertyFetch", map[string]interface{}{}, + nil, variable, property, } @@ -36,6 +38,15 @@ func (n PropertyFetch) SetAttribute(key string, value interface{}) { n.attributes[key] = value } +func (n PropertyFetch) Position() *node.Position { + return n.position +} + +func (n PropertyFetch) SetPosition(p *node.Position) node.Node { + n.position = p + return n +} + func (n PropertyFetch) Walk(v node.Visitor) { if v.EnterNode(n) == false { return diff --git a/node/expr/require.go b/node/expr/require.go index bbf7dc7..8033f6c 100644 --- a/node/expr/require.go +++ b/node/expr/require.go @@ -7,6 +7,7 @@ import ( type Require struct { name string attributes map[string]interface{} + position *node.Position expr node.Node } @@ -14,6 +15,7 @@ func NewRequire(expression node.Node) node.Node { return Require{ "Require", map[string]interface{}{}, + nil, expression, } } @@ -34,6 +36,15 @@ func (n Require) SetAttribute(key string, value interface{}) { n.attributes[key] = value } +func (n Require) Position() *node.Position { + return n.position +} + +func (n Require) SetPosition(p *node.Position) node.Node { + n.position = p + return n +} + func (n Require) Walk(v node.Visitor) { if v.EnterNode(n) == false { return diff --git a/node/expr/require_once.go b/node/expr/require_once.go index 33c9099..18ba761 100644 --- a/node/expr/require_once.go +++ b/node/expr/require_once.go @@ -7,6 +7,7 @@ import ( type RequireOnce struct { name string attributes map[string]interface{} + position *node.Position expr node.Node } @@ -14,6 +15,7 @@ func NewRequireOnce(expression node.Node) node.Node { return RequireOnce{ "RequireOnce", map[string]interface{}{}, + nil, expression, } } @@ -34,6 +36,15 @@ func (n RequireOnce) SetAttribute(key string, value interface{}) { n.attributes[key] = value } +func (n RequireOnce) Position() *node.Position { + return n.position +} + +func (n RequireOnce) SetPosition(p *node.Position) node.Node { + n.position = p + return n +} + func (n RequireOnce) Walk(v node.Visitor) { if v.EnterNode(n) == false { return diff --git a/node/expr/shell_exec.go b/node/expr/shell_exec.go index 1795d1f..f17679b 100644 --- a/node/expr/shell_exec.go +++ b/node/expr/shell_exec.go @@ -7,6 +7,7 @@ import ( type ShellExec struct { name string attributes map[string]interface{} + position *node.Position parts []node.Node } @@ -14,6 +15,7 @@ func NewShellExec(parts []node.Node) node.Node { return ShellExec{ "ShellExec", map[string]interface{}{}, + nil, parts, } } @@ -34,6 +36,15 @@ func (n ShellExec) SetAttribute(key string, value interface{}) { n.attributes[key] = value } +func (n ShellExec) Position() *node.Position { + return n.position +} + +func (n ShellExec) SetPosition(p *node.Position) node.Node { + n.position = p + return n +} + func (n ShellExec) Walk(v node.Visitor) { if v.EnterNode(n) == false { return diff --git a/node/expr/short_array.go b/node/expr/short_array.go index 467d9f1..f764493 100644 --- a/node/expr/short_array.go +++ b/node/expr/short_array.go @@ -7,6 +7,7 @@ import ( type ShortArray struct { name string attributes map[string]interface{} + position *node.Position items []node.Node } @@ -14,6 +15,7 @@ func NewShortArray(items []node.Node) node.Node { return ShortArray{ "ShortArray", map[string]interface{}{}, + nil, items, } } @@ -34,6 +36,15 @@ func (n ShortArray) SetAttribute(key string, value interface{}) { n.attributes[key] = value } +func (n ShortArray) Position() *node.Position { + return n.position +} + +func (n ShortArray) SetPosition(p *node.Position) node.Node { + n.position = p + return n +} + func (n ShortArray) Walk(v node.Visitor) { if v.EnterNode(n) == false { return diff --git a/node/expr/short_list.go b/node/expr/short_list.go index 85a42b9..983cf9c 100644 --- a/node/expr/short_list.go +++ b/node/expr/short_list.go @@ -7,6 +7,7 @@ import ( type ShortList struct { name string attributes map[string]interface{} + position *node.Position items []node.Node } @@ -14,6 +15,7 @@ func NewShortList(items []node.Node) node.Node { return ShortList{ "ShortList", map[string]interface{}{}, + nil, items, } } @@ -34,6 +36,15 @@ func (n ShortList) SetAttribute(key string, value interface{}) { n.attributes[key] = value } +func (n ShortList) Position() *node.Position { + return n.position +} + +func (n ShortList) SetPosition(p *node.Position) node.Node { + n.position = p + return n +} + func (n ShortList) Walk(v node.Visitor) { if v.EnterNode(n) == false { return diff --git a/node/expr/static_call.go b/node/expr/static_call.go index a0a689b..ea0a598 100644 --- a/node/expr/static_call.go +++ b/node/expr/static_call.go @@ -7,6 +7,7 @@ import ( type StaticCall struct { name string attributes map[string]interface{} + position *node.Position class node.Node call node.Node arguments []node.Node @@ -16,6 +17,7 @@ func NewStaticCall(class node.Node, call node.Node, arguments []node.Node) node. return StaticCall{ "StaticCall", map[string]interface{}{}, + nil, class, call, arguments, @@ -38,6 +40,15 @@ func (n StaticCall) SetAttribute(key string, value interface{}) { n.attributes[key] = value } +func (n StaticCall) Position() *node.Position { + return n.position +} + +func (n StaticCall) SetPosition(p *node.Position) node.Node { + n.position = p + return n +} + func (n StaticCall) Walk(v node.Visitor) { if v.EnterNode(n) == false { return diff --git a/node/expr/static_property_fetch.go b/node/expr/static_property_fetch.go index 322da9a..369faa9 100644 --- a/node/expr/static_property_fetch.go +++ b/node/expr/static_property_fetch.go @@ -7,6 +7,7 @@ import ( type StaticPropertyFetch struct { name string attributes map[string]interface{} + position *node.Position class node.Node property node.Node } @@ -15,6 +16,7 @@ func NewStaticPropertyFetch(class node.Node, property node.Node) node.Node { return StaticPropertyFetch{ "StaticPropertyFetch", map[string]interface{}{}, + nil, class, property, } @@ -36,6 +38,15 @@ func (n StaticPropertyFetch) SetAttribute(key string, value interface{}) { n.attributes[key] = value } +func (n StaticPropertyFetch) Position() *node.Position { + return n.position +} + +func (n StaticPropertyFetch) SetPosition(p *node.Position) node.Node { + n.position = p + return n +} + func (n StaticPropertyFetch) Walk(v node.Visitor) { if v.EnterNode(n) == false { return diff --git a/node/expr/ternary.go b/node/expr/ternary.go index b1dc0d7..690212f 100644 --- a/node/expr/ternary.go +++ b/node/expr/ternary.go @@ -7,6 +7,7 @@ import ( type Ternary struct { name string attributes map[string]interface{} + position *node.Position condition node.Node ifTrue node.Node ifFalse node.Node @@ -16,6 +17,7 @@ func NewTernary(condition node.Node, ifTrue node.Node, ifFalse node.Node) node.N return Ternary{ "Ternary", map[string]interface{}{}, + nil, condition, ifTrue, ifFalse, @@ -38,6 +40,15 @@ func (n Ternary) SetAttribute(key string, value interface{}) { n.attributes[key] = value } +func (n Ternary) Position() *node.Position { + return n.position +} + +func (n Ternary) SetPosition(p *node.Position) node.Node { + n.position = p + return n +} + func (n Ternary) Walk(v node.Visitor) { if v.EnterNode(n) == false { return diff --git a/node/expr/unary_minus.go b/node/expr/unary_minus.go index d02807b..da4b312 100644 --- a/node/expr/unary_minus.go +++ b/node/expr/unary_minus.go @@ -7,6 +7,7 @@ import ( type UnaryMinus struct { name string attributes map[string]interface{} + position *node.Position expr node.Node } @@ -14,6 +15,7 @@ func NewUnaryMinus(expression node.Node) node.Node { return UnaryMinus{ "UnaryMinus", map[string]interface{}{}, + nil, expression, } } @@ -34,6 +36,15 @@ func (n UnaryMinus) SetAttribute(key string, value interface{}) { n.attributes[key] = value } +func (n UnaryMinus) Position() *node.Position { + return n.position +} + +func (n UnaryMinus) SetPosition(p *node.Position) node.Node { + n.position = p + return n +} + func (n UnaryMinus) Walk(v node.Visitor) { if v.EnterNode(n) == false { return diff --git a/node/expr/unary_plus.go b/node/expr/unary_plus.go index 9556876..65d2060 100644 --- a/node/expr/unary_plus.go +++ b/node/expr/unary_plus.go @@ -7,6 +7,7 @@ import ( type UnaryPlus struct { name string attributes map[string]interface{} + position *node.Position expr node.Node } @@ -14,6 +15,7 @@ func NewUnaryPlus(expression node.Node) node.Node { return UnaryPlus{ "UnaryPlus", map[string]interface{}{}, + nil, expression, } } @@ -34,6 +36,15 @@ func (n UnaryPlus) SetAttribute(key string, value interface{}) { n.attributes[key] = value } +func (n UnaryPlus) Position() *node.Position { + return n.position +} + +func (n UnaryPlus) SetPosition(p *node.Position) node.Node { + n.position = p + return n +} + func (n UnaryPlus) Walk(v node.Visitor) { if v.EnterNode(n) == false { return diff --git a/node/expr/variable.go b/node/expr/variable.go index 001af0a..4bc192c 100644 --- a/node/expr/variable.go +++ b/node/expr/variable.go @@ -7,6 +7,7 @@ import ( type Variable struct { name string attributes map[string]interface{} + position *node.Position varName node.Node } @@ -14,6 +15,7 @@ func NewVariable(varName node.Node) node.Node { return Variable{ "Variable", map[string]interface{}{}, + nil, varName, } } @@ -34,6 +36,15 @@ func (n Variable) SetAttribute(key string, value interface{}) { n.attributes[key] = value } +func (n Variable) Position() *node.Position { + return n.position +} + +func (n Variable) SetPosition(p *node.Position) node.Node { + n.position = p + return n +} + func (n Variable) Walk(v node.Visitor) { if v.EnterNode(n) == false { return diff --git a/node/expr/yield.go b/node/expr/yield.go index 2df2911..6a25d0c 100644 --- a/node/expr/yield.go +++ b/node/expr/yield.go @@ -7,6 +7,7 @@ import ( type Yield struct { name string attributes map[string]interface{} + position *node.Position key node.Node value node.Node } @@ -15,6 +16,7 @@ func NewYield(key node.Node, value node.Node) node.Node { return Yield{ "Yield", map[string]interface{}{}, + nil, key, value, } @@ -36,6 +38,15 @@ func (n Yield) SetAttribute(key string, value interface{}) { n.attributes[key] = value } +func (n Yield) Position() *node.Position { + return n.position +} + +func (n Yield) SetPosition(p *node.Position) node.Node { + n.position = p + return n +} + func (n Yield) Walk(v node.Visitor) { if v.EnterNode(n) == false { return diff --git a/node/expr/yield_from.go b/node/expr/yield_from.go index f0ee6ec..c548414 100644 --- a/node/expr/yield_from.go +++ b/node/expr/yield_from.go @@ -7,6 +7,7 @@ import ( type YieldFrom struct { name string attributes map[string]interface{} + position *node.Position expr node.Node } @@ -14,6 +15,7 @@ func NewYieldFrom(expression node.Node) node.Node { return YieldFrom{ "YieldFrom", map[string]interface{}{}, + nil, expression, } } @@ -34,6 +36,15 @@ func (n YieldFrom) SetAttribute(key string, value interface{}) { n.attributes[key] = value } +func (n YieldFrom) Position() *node.Position { + return n.position +} + +func (n YieldFrom) SetPosition(p *node.Position) node.Node { + n.position = p + return n +} + func (n YieldFrom) Walk(v node.Visitor) { if v.EnterNode(n) == false { return diff --git a/node/identifier.go b/node/identifier.go index 03193d1..b1cedd0 100644 --- a/node/identifier.go +++ b/node/identifier.go @@ -7,6 +7,7 @@ import ( type Identifier struct { name string attributes map[string]interface{} + position *Position } func NewIdentifier(token token.Token) Node { @@ -15,6 +16,7 @@ func NewIdentifier(token token.Token) Node { map[string]interface{}{ "value": token.Value, }, + nil, } } @@ -34,6 +36,15 @@ func (n Identifier) SetAttribute(key string, value interface{}) { n.attributes[key] = value } +func (n Identifier) Position() *Position { + return n.position +} + +func (n Identifier) SetPosition(p *Position) Node { + n.position = p + return n +} + func (n Identifier) Walk(v Visitor) { if v.EnterNode(n) == false { return diff --git a/node/name/fully_qualified.go b/node/name/fully_qualified.go index 76ab231..6e3a242 100644 --- a/node/name/fully_qualified.go +++ b/node/name/fully_qualified.go @@ -13,6 +13,7 @@ func NewFullyQualified(parts []node.Node) node.Node { NameNode{ "FullyQualifiedName", map[string]interface{}{}, + nil, parts, }, } diff --git a/node/name/name.go b/node/name/name.go index dd54699..4d81a0b 100644 --- a/node/name/name.go +++ b/node/name/name.go @@ -7,6 +7,7 @@ import ( type NameNode struct { name string attributes map[string]interface{} + position *node.Position parts []node.Node } @@ -14,6 +15,7 @@ func NewName(parts []node.Node) node.Node { return NameNode{ "Name", map[string]interface{}{}, + nil, parts, } } @@ -34,6 +36,15 @@ func (n NameNode) SetAttribute(key string, value interface{}) { n.attributes[key] = value } +func (n NameNode) Position() *node.Position { + return n.position +} + +func (n NameNode) SetPosition(p *node.Position) node.Node { + n.position = p + return n +} + func (n NameNode) Walk(v node.Visitor) { if v.EnterNode(n) == false { return diff --git a/node/name/name_part.go b/node/name/name_part.go index ebf56ac..5494a16 100644 --- a/node/name/name_part.go +++ b/node/name/name_part.go @@ -7,6 +7,7 @@ import ( type NamePart struct { name string attributes map[string]interface{} + position *node.Position } func NewNamePart(value string) node.Node { @@ -15,6 +16,7 @@ func NewNamePart(value string) node.Node { map[string]interface{}{ "value": value, }, + nil, } } @@ -34,6 +36,15 @@ func (n NamePart) SetAttribute(key string, value interface{}) { n.attributes[key] = value } +func (n NamePart) Position() *node.Position { + return n.position +} + +func (n NamePart) SetPosition(p *node.Position) node.Node { + n.position = p + return n +} + func (n NamePart) Walk(v node.Visitor) { if v.EnterNode(n) == false { return diff --git a/node/name/relative.go b/node/name/relative.go index bb17d2d..dc4bfc2 100644 --- a/node/name/relative.go +++ b/node/name/relative.go @@ -13,6 +13,7 @@ func NewRelative(parts []node.Node) node.Node { NameNode{ "RelativeName", map[string]interface{}{}, + nil, parts, }, } diff --git a/node/node.go b/node/node.go index 2e49ab3..1d75309 100644 --- a/node/node.go +++ b/node/node.go @@ -1,13 +1,24 @@ package node +type Node interface { + Attributer + Positioner + Name() string + Walk(v Visitor) +} + type Attributer interface { Attributes() map[string]interface{} Attribute(key string) interface{} SetAttribute(key string, value interface{}) } -type Node interface { - Attributer - Name() string - Walk(v Visitor) +type Positioner interface { + Position() *Position + SetPosition(p *Position) Node +} + +type Position struct { + StartLine int + EndLine int } diff --git a/node/nullable.go b/node/nullable.go index 2f0c35d..f0fe2e6 100644 --- a/node/nullable.go +++ b/node/nullable.go @@ -3,6 +3,7 @@ package node type Nullable struct { name string attributes map[string]interface{} + position *Position expr Node } @@ -10,6 +11,7 @@ func NewNullable(expression Node) Node { return Nullable{ "Nullable", map[string]interface{}{}, + nil, expression, } } @@ -30,6 +32,15 @@ func (n Nullable) SetAttribute(key string, value interface{}) { n.attributes[key] = value } +func (n Nullable) Position() *Position { + return n.position +} + +func (n Nullable) SetPosition(p *Position) Node { + n.position = p + return n +} + func (n Nullable) Walk(v Visitor) { if v.EnterNode(n) == false { return diff --git a/node/parameter.go b/node/parameter.go index 4723e5e..8d313e8 100644 --- a/node/parameter.go +++ b/node/parameter.go @@ -3,6 +3,7 @@ package node type Parameter struct { name string attributes map[string]interface{} + position *Position variableType Node variable Node defaultValue Node @@ -15,6 +16,7 @@ func NewParameter(variableType Node, variable Node, defaultValue Node, byRef boo "byRef": byRef, "variadic": variadic, }, + nil, variableType, variable, defaultValue, @@ -37,6 +39,15 @@ func (n Parameter) SetAttribute(key string, value interface{}) { n.attributes[key] = value } +func (n Parameter) Position() *Position { + return n.position +} + +func (n Parameter) SetPosition(p *Position) Node { + n.position = p + return n +} + func (n Parameter) Walk(v Visitor) { if v.EnterNode(n) == false { return diff --git a/node/scalar/dnumber.go b/node/scalar/dnumber.go index 437ab1f..e5b4a68 100644 --- a/node/scalar/dnumber.go +++ b/node/scalar/dnumber.go @@ -7,6 +7,7 @@ import ( type Dnumber struct { name string attributes map[string]interface{} + position *node.Position } func NewDnumber(value string) node.Node { @@ -15,6 +16,7 @@ func NewDnumber(value string) node.Node { map[string]interface{}{ "value": value, }, + nil, } } @@ -34,6 +36,15 @@ func (n Dnumber) SetAttribute(key string, value interface{}) { n.attributes[key] = value } +func (n Dnumber) Position() *node.Position { + return n.position +} + +func (n Dnumber) SetPosition(p *node.Position) node.Node { + n.position = p + return n +} + func (n Dnumber) Walk(v node.Visitor) { if v.EnterNode(n) == false { return diff --git a/node/scalar/encapsed.go b/node/scalar/encapsed.go index f603dc2..99954ec 100644 --- a/node/scalar/encapsed.go +++ b/node/scalar/encapsed.go @@ -7,6 +7,7 @@ import ( type Encapsed struct { name string attributes map[string]interface{} + position *node.Position parts []node.Node } @@ -14,6 +15,7 @@ func NewEncapsed(parts []node.Node) node.Node { return Encapsed{ "Encapsed", map[string]interface{}{}, + nil, parts, } } @@ -34,6 +36,15 @@ func (n Encapsed) SetAttribute(key string, value interface{}) { n.attributes[key] = value } +func (n Encapsed) Position() *node.Position { + return n.position +} + +func (n Encapsed) SetPosition(p *node.Position) node.Node { + n.position = p + return n +} + func (n Encapsed) Walk(v node.Visitor) { if v.EnterNode(n) == false { return diff --git a/node/scalar/encapsed_string_part.go b/node/scalar/encapsed_string_part.go index b765ee1..370f3dd 100644 --- a/node/scalar/encapsed_string_part.go +++ b/node/scalar/encapsed_string_part.go @@ -7,6 +7,7 @@ import ( type EncapsedStringPart struct { name string attributes map[string]interface{} + position *node.Position } func NewEncapsedStringPart(value string) node.Node { @@ -15,6 +16,7 @@ func NewEncapsedStringPart(value string) node.Node { map[string]interface{}{ "value": value, }, + nil, } } @@ -34,6 +36,15 @@ func (n EncapsedStringPart) SetAttribute(key string, value interface{}) { n.attributes[key] = value } +func (n EncapsedStringPart) Position() *node.Position { + return n.position +} + +func (n EncapsedStringPart) SetPosition(p *node.Position) node.Node { + n.position = p + return n +} + func (n EncapsedStringPart) Walk(v node.Visitor) { if v.EnterNode(n) == false { return diff --git a/node/scalar/lnumber.go b/node/scalar/lnumber.go index b9be7c7..7a60ef4 100644 --- a/node/scalar/lnumber.go +++ b/node/scalar/lnumber.go @@ -7,6 +7,7 @@ import ( type Lnumber struct { name string attributes map[string]interface{} + position *node.Position } func NewLnumber(value string) node.Node { @@ -15,6 +16,7 @@ func NewLnumber(value string) node.Node { map[string]interface{}{ "value": value, }, + nil, } } @@ -34,6 +36,15 @@ func (n Lnumber) SetAttribute(key string, value interface{}) { n.attributes[key] = value } +func (n Lnumber) Position() *node.Position { + return n.position +} + +func (n Lnumber) SetPosition(p *node.Position) node.Node { + n.position = p + return n +} + func (n Lnumber) Walk(v node.Visitor) { if v.EnterNode(n) == false { return diff --git a/node/scalar/magic_constant.go b/node/scalar/magic_constant.go index f1330ca..5263c8d 100644 --- a/node/scalar/magic_constant.go +++ b/node/scalar/magic_constant.go @@ -7,6 +7,7 @@ import ( type MagicConstant struct { name string attributes map[string]interface{} + position *node.Position } func NewMagicConstant(value string) node.Node { @@ -15,6 +16,7 @@ func NewMagicConstant(value string) node.Node { map[string]interface{}{ "value": value, }, + nil, } } @@ -34,6 +36,15 @@ func (n MagicConstant) SetAttribute(key string, value interface{}) { n.attributes[key] = value } +func (n MagicConstant) Position() *node.Position { + return n.position +} + +func (n MagicConstant) SetPosition(p *node.Position) node.Node { + n.position = p + return n +} + func (n MagicConstant) Walk(v node.Visitor) { if v.EnterNode(n) == false { return diff --git a/node/scalar/string.go b/node/scalar/string.go index 2bade24..670ade3 100644 --- a/node/scalar/string.go +++ b/node/scalar/string.go @@ -7,15 +7,16 @@ import ( type String struct { name string attributes map[string]interface{} + position *node.Position } func NewString(value string) node.Node { return String{ "String", - map[string]interface{}{ "value": value, }, + nil, } } @@ -35,6 +36,15 @@ func (n String) SetAttribute(key string, value interface{}) { n.attributes[key] = value } +func (n String) Position() *node.Position { + return n.position +} + +func (n String) SetPosition(p *node.Position) node.Node { + n.position = p + return n +} + func (n String) Walk(v node.Visitor) { if v.EnterNode(n) == false { return diff --git a/node/stmt/alt_else.go b/node/stmt/alt_else.go index a64b0ee..e768366 100644 --- a/node/stmt/alt_else.go +++ b/node/stmt/alt_else.go @@ -7,6 +7,7 @@ import ( type AltElse struct { name string attributes map[string]interface{} + position *node.Position stmt node.Node } @@ -14,6 +15,7 @@ func NewAltElse(stmt node.Node) node.Node { return AltElse{ "AltElse", map[string]interface{}{}, + nil, stmt, } } @@ -34,6 +36,15 @@ func (n AltElse) SetAttribute(key string, value interface{}) { n.attributes[key] = value } +func (n AltElse) Position() *node.Position { + return n.position +} + +func (n AltElse) SetPosition(p *node.Position) node.Node { + n.position = p + return n +} + func (n AltElse) Walk(v node.Visitor) { if v.EnterNode(n) == false { return diff --git a/node/stmt/alt_else_if.go b/node/stmt/alt_else_if.go index d2f38e3..017699e 100644 --- a/node/stmt/alt_else_if.go +++ b/node/stmt/alt_else_if.go @@ -7,6 +7,7 @@ import ( type AltElseIf struct { name string attributes map[string]interface{} + position *node.Position cond node.Node stmt node.Node } @@ -15,6 +16,7 @@ func NewAltElseIf(cond node.Node, stmt node.Node) node.Node { return AltElseIf{ "AltElseIf", map[string]interface{}{}, + nil, cond, stmt, } @@ -36,6 +38,15 @@ func (n AltElseIf) SetAttribute(key string, value interface{}) { n.attributes[key] = value } +func (n AltElseIf) Position() *node.Position { + return n.position +} + +func (n AltElseIf) SetPosition(p *node.Position) node.Node { + n.position = p + return n +} + func (n AltElseIf) Walk(v node.Visitor) { if v.EnterNode(n) == false { return diff --git a/node/stmt/alt_if.go b/node/stmt/alt_if.go index 17e4f5c..365107c 100644 --- a/node/stmt/alt_if.go +++ b/node/stmt/alt_if.go @@ -7,6 +7,7 @@ import ( type AltIf struct { name string attributes map[string]interface{} + position *node.Position cond node.Node stmt node.Node elseIf []node.Node @@ -17,6 +18,7 @@ func NewAltIf(cond node.Node, stmt node.Node) node.Node { return AltIf{ "AltIf", map[string]interface{}{}, + nil, cond, stmt, nil, @@ -40,6 +42,15 @@ func (n AltIf) SetAttribute(key string, value interface{}) { n.attributes[key] = value } +func (n AltIf) Position() *node.Position { + return n.position +} + +func (n AltIf) SetPosition(p *node.Position) node.Node { + n.position = p + return n +} + func (n AltIf) AddElseIf(elseIf node.Node) node.Node { if n.elseIf == nil { n.elseIf = make([]node.Node, 0) diff --git a/node/stmt/break.go b/node/stmt/break.go index 814535b..c97c4c4 100644 --- a/node/stmt/break.go +++ b/node/stmt/break.go @@ -7,6 +7,7 @@ import ( type Break struct { name string attributes map[string]interface{} + position *node.Position expr node.Node } @@ -14,6 +15,7 @@ func NewBreak(expr node.Node) node.Node { return Break{ "Break", map[string]interface{}{}, + nil, expr, } } @@ -34,6 +36,15 @@ func (n Break) SetAttribute(key string, value interface{}) { n.attributes[key] = value } +func (n Break) Position() *node.Position { + return n.position +} + +func (n Break) SetPosition(p *node.Position) node.Node { + n.position = p + return n +} + func (n Break) Walk(v node.Visitor) { if v.EnterNode(n) == false { return diff --git a/node/stmt/case.go b/node/stmt/case.go index 657e927..0a0257c 100644 --- a/node/stmt/case.go +++ b/node/stmt/case.go @@ -7,6 +7,7 @@ import ( type Case struct { name string attributes map[string]interface{} + position *node.Position cond node.Node stmts []node.Node } @@ -15,6 +16,7 @@ func NewCase(cond node.Node, stmts []node.Node) node.Node { return Case{ "Case", map[string]interface{}{}, + nil, cond, stmts, } @@ -36,6 +38,15 @@ func (n Case) SetAttribute(key string, value interface{}) { n.attributes[key] = value } +func (n Case) Position() *node.Position { + return n.position +} + +func (n Case) SetPosition(p *node.Position) node.Node { + n.position = p + return n +} + func (n Case) Walk(v node.Visitor) { if v.EnterNode(n) == false { return diff --git a/node/stmt/catch.go b/node/stmt/catch.go index a4ec410..125db52 100644 --- a/node/stmt/catch.go +++ b/node/stmt/catch.go @@ -7,6 +7,7 @@ import ( type Catch struct { name string attributes map[string]interface{} + position *node.Position types []node.Node variable node.Node stmts []node.Node @@ -16,6 +17,7 @@ func NewCatch(types []node.Node, variable node.Node, stmts []node.Node) node.Nod return Catch{ "Catch", map[string]interface{}{}, + nil, types, variable, stmts, @@ -38,6 +40,15 @@ func (n Catch) SetAttribute(key string, value interface{}) { n.attributes[key] = value } +func (n Catch) Position() *node.Position { + return n.position +} + +func (n Catch) SetPosition(p *node.Position) node.Node { + n.position = p + return n +} + func (n Catch) Walk(v node.Visitor) { if v.EnterNode(n) == false { return diff --git a/node/stmt/class.go b/node/stmt/class.go index d034422..b1069d0 100644 --- a/node/stmt/class.go +++ b/node/stmt/class.go @@ -7,6 +7,7 @@ import ( type Class struct { name string attributes map[string]interface{} + position *node.Position className node.Node modifiers []node.Node args []node.Node @@ -19,6 +20,7 @@ func NewClass(className node.Node, modifiers []node.Node, args []node.Node, exte return Class{ "Class", map[string]interface{}{}, + nil, className, modifiers, args, @@ -44,6 +46,15 @@ func (n Class) SetAttribute(key string, value interface{}) { n.attributes[key] = value } +func (n Class) Position() *node.Position { + return n.position +} + +func (n Class) SetPosition(p *node.Position) node.Node { + n.position = p + return n +} + func (n Class) Walk(v node.Visitor) { if v.EnterNode(n) == false { return diff --git a/node/stmt/class_const_list.go b/node/stmt/class_const_list.go index a5f5ff9..eb18dad 100644 --- a/node/stmt/class_const_list.go +++ b/node/stmt/class_const_list.go @@ -7,6 +7,7 @@ import ( type ClassConstList struct { name string attributes map[string]interface{} + position *node.Position modifiers []node.Node consts []node.Node } @@ -15,6 +16,7 @@ func NewClassConstList(modifiers []node.Node, consts []node.Node) node.Node { return ClassConstList{ "ClassConstList", map[string]interface{}{}, + nil, modifiers, consts, } @@ -36,6 +38,15 @@ func (n ClassConstList) SetAttribute(key string, value interface{}) { n.attributes[key] = value } +func (n ClassConstList) Position() *node.Position { + return n.position +} + +func (n ClassConstList) SetPosition(p *node.Position) node.Node { + n.position = p + return n +} + func (n ClassConstList) Walk(v node.Visitor) { if v.EnterNode(n) == false { return diff --git a/node/stmt/class_method.go b/node/stmt/class_method.go index fd64cf5..7959765 100644 --- a/node/stmt/class_method.go +++ b/node/stmt/class_method.go @@ -7,6 +7,7 @@ import ( type ClassMethod struct { name string attributes map[string]interface{} + position *node.Position methodName node.Node modifiers []node.Node params []node.Node @@ -20,6 +21,7 @@ func NewClassMethod(methodName node.Node, modifiers []node.Node, returnsRef bool map[string]interface{}{ "returnsRef": returnsRef, }, + nil, methodName, modifiers, params, @@ -44,6 +46,15 @@ func (n ClassMethod) SetAttribute(key string, value interface{}) { n.attributes[key] = value } +func (n ClassMethod) Position() *node.Position { + return n.position +} + +func (n ClassMethod) SetPosition(p *node.Position) node.Node { + n.position = p + return n +} + func (n ClassMethod) Walk(v node.Visitor) { if v.EnterNode(n) == false { return diff --git a/node/stmt/const_list.go b/node/stmt/const_list.go index 0efca5f..e21dc0c 100644 --- a/node/stmt/const_list.go +++ b/node/stmt/const_list.go @@ -7,6 +7,7 @@ import ( type ConstList struct { name string attributes map[string]interface{} + position *node.Position consts []node.Node } @@ -14,6 +15,7 @@ func NewConstList(consts []node.Node) node.Node { return ConstList{ "ConstList", map[string]interface{}{}, + nil, consts, } } @@ -34,6 +36,15 @@ func (n ConstList) SetAttribute(key string, value interface{}) { n.attributes[key] = value } +func (n ConstList) Position() *node.Position { + return n.position +} + +func (n ConstList) SetPosition(p *node.Position) node.Node { + n.position = p + return n +} + func (n ConstList) Walk(v node.Visitor) { if v.EnterNode(n) == false { return diff --git a/node/stmt/constant.go b/node/stmt/constant.go index ee537f5..d50c2ca 100644 --- a/node/stmt/constant.go +++ b/node/stmt/constant.go @@ -7,6 +7,7 @@ import ( type Constant struct { name string attributes map[string]interface{} + position *node.Position constantName node.Node expr node.Node } @@ -15,6 +16,7 @@ func NewConstant(constantName node.Node, expr node.Node) node.Node { return Constant{ "Constant", map[string]interface{}{}, + nil, constantName, expr, } @@ -36,6 +38,15 @@ func (n Constant) SetAttribute(key string, value interface{}) { n.attributes[key] = value } +func (n Constant) Position() *node.Position { + return n.position +} + +func (n Constant) SetPosition(p *node.Position) node.Node { + n.position = p + return n +} + func (n Constant) Walk(v node.Visitor) { if v.EnterNode(n) == false { return diff --git a/node/stmt/continue.go b/node/stmt/continue.go index cc6d1fb..65d8a03 100644 --- a/node/stmt/continue.go +++ b/node/stmt/continue.go @@ -7,6 +7,7 @@ import ( type Continue struct { name string attributes map[string]interface{} + position *node.Position expr node.Node } @@ -14,6 +15,7 @@ func NewContinue(expr node.Node) node.Node { return Continue{ "Continue", map[string]interface{}{}, + nil, expr, } } @@ -34,6 +36,15 @@ func (n Continue) SetAttribute(key string, value interface{}) { n.attributes[key] = value } +func (n Continue) Position() *node.Position { + return n.position +} + +func (n Continue) SetPosition(p *node.Position) node.Node { + n.position = p + return n +} + func (n Continue) Walk(v node.Visitor) { if v.EnterNode(n) == false { return diff --git a/node/stmt/declare.go b/node/stmt/declare.go index c42f458..6c59307 100644 --- a/node/stmt/declare.go +++ b/node/stmt/declare.go @@ -7,6 +7,7 @@ import ( type Declare struct { name string attributes map[string]interface{} + position *node.Position consts []node.Node stmt node.Node } @@ -15,6 +16,7 @@ func NewDeclare(consts []node.Node, stmt node.Node) node.Node { return Declare{ "Declare", map[string]interface{}{}, + nil, consts, stmt, } @@ -36,6 +38,15 @@ func (n Declare) SetAttribute(key string, value interface{}) { n.attributes[key] = value } +func (n Declare) Position() *node.Position { + return n.position +} + +func (n Declare) SetPosition(p *node.Position) node.Node { + n.position = p + return n +} + func (n Declare) Walk(v node.Visitor) { if v.EnterNode(n) == false { return diff --git a/node/stmt/default.go b/node/stmt/default.go index 2d35ad8..89316e2 100644 --- a/node/stmt/default.go +++ b/node/stmt/default.go @@ -7,6 +7,7 @@ import ( type Default struct { name string attributes map[string]interface{} + position *node.Position stmts []node.Node } @@ -14,6 +15,7 @@ func NewDefault(stmts []node.Node) node.Node { return Default{ "Default", map[string]interface{}{}, + nil, stmts, } } @@ -34,6 +36,15 @@ func (n Default) SetAttribute(key string, value interface{}) { n.attributes[key] = value } +func (n Default) Position() *node.Position { + return n.position +} + +func (n Default) SetPosition(p *node.Position) node.Node { + n.position = p + return n +} + func (n Default) Walk(v node.Visitor) { if v.EnterNode(n) == false { return diff --git a/node/stmt/do.go b/node/stmt/do.go index aabbfdc..24c050b 100644 --- a/node/stmt/do.go +++ b/node/stmt/do.go @@ -7,6 +7,7 @@ import ( type Do struct { name string attributes map[string]interface{} + position *node.Position stmt node.Node cond node.Node } @@ -15,6 +16,7 @@ func NewDo(stmt node.Node, cond node.Node) node.Node { return Do{ "Do", map[string]interface{}{}, + nil, stmt, cond, } @@ -36,6 +38,15 @@ func (n Do) SetAttribute(key string, value interface{}) { n.attributes[key] = value } +func (n Do) Position() *node.Position { + return n.position +} + +func (n Do) SetPosition(p *node.Position) node.Node { + n.position = p + return n +} + func (n Do) Walk(v node.Visitor) { if v.EnterNode(n) == false { return diff --git a/node/stmt/echo.go b/node/stmt/echo.go index 78f7611..af1ae84 100644 --- a/node/stmt/echo.go +++ b/node/stmt/echo.go @@ -7,6 +7,7 @@ import ( type Echo struct { name string attributes map[string]interface{} + position *node.Position exprs []node.Node } @@ -14,6 +15,7 @@ func NewEcho(exprs []node.Node) node.Node { return Echo{ "Echo", map[string]interface{}{}, + nil, exprs, } } @@ -34,6 +36,15 @@ func (n Echo) SetAttribute(key string, value interface{}) { n.attributes[key] = value } +func (n Echo) Position() *node.Position { + return n.position +} + +func (n Echo) SetPosition(p *node.Position) node.Node { + n.position = p + return n +} + func (n Echo) Walk(v node.Visitor) { if v.EnterNode(n) == false { return diff --git a/node/stmt/else.go b/node/stmt/else.go index fe1cf1b..91d661d 100644 --- a/node/stmt/else.go +++ b/node/stmt/else.go @@ -7,6 +7,7 @@ import ( type Else struct { name string attributes map[string]interface{} + position *node.Position stmt node.Node } @@ -14,6 +15,7 @@ func NewElse(stmt node.Node) node.Node { return Else{ "Else", map[string]interface{}{}, + nil, stmt, } } @@ -34,6 +36,15 @@ func (n Else) SetAttribute(key string, value interface{}) { n.attributes[key] = value } +func (n Else) Position() *node.Position { + return n.position +} + +func (n Else) SetPosition(p *node.Position) node.Node { + n.position = p + return n +} + func (n Else) Walk(v node.Visitor) { if v.EnterNode(n) == false { return diff --git a/node/stmt/else_if.go b/node/stmt/else_if.go index 72c73d8..3b1c306 100644 --- a/node/stmt/else_if.go +++ b/node/stmt/else_if.go @@ -7,6 +7,7 @@ import ( type ElseIf struct { name string attributes map[string]interface{} + position *node.Position cond node.Node stmt node.Node } @@ -15,6 +16,7 @@ func NewElseIf(cond node.Node, stmt node.Node) node.Node { return ElseIf{ "ElseIf", map[string]interface{}{}, + nil, cond, stmt, } @@ -36,6 +38,15 @@ func (n ElseIf) SetAttribute(key string, value interface{}) { n.attributes[key] = value } +func (n ElseIf) Position() *node.Position { + return n.position +} + +func (n ElseIf) SetPosition(p *node.Position) node.Node { + n.position = p + return n +} + func (n ElseIf) Walk(v node.Visitor) { if v.EnterNode(n) == false { return diff --git a/node/stmt/expression.go b/node/stmt/expression.go index 7d186ea..a70d362 100644 --- a/node/stmt/expression.go +++ b/node/stmt/expression.go @@ -7,6 +7,7 @@ import ( type Expression struct { name string attributes map[string]interface{} + position *node.Position expr node.Node } @@ -14,6 +15,7 @@ func NewExpression(expr node.Node) node.Node { return Expression{ "Expression", map[string]interface{}{}, + nil, expr, } } @@ -34,6 +36,15 @@ func (n Expression) SetAttribute(key string, value interface{}) { n.attributes[key] = value } +func (n Expression) Position() *node.Position { + return n.position +} + +func (n Expression) SetPosition(p *node.Position) node.Node { + n.position = p + return n +} + func (n Expression) Walk(v node.Visitor) { if v.EnterNode(n) == false { return diff --git a/node/stmt/finally.go b/node/stmt/finally.go index 4de81a4..8cee1cd 100644 --- a/node/stmt/finally.go +++ b/node/stmt/finally.go @@ -7,6 +7,7 @@ import ( type Finally struct { name string attributes map[string]interface{} + position *node.Position stmts []node.Node } @@ -14,6 +15,7 @@ func NewFinally(stmts []node.Node) node.Node { return Finally{ "Finally", map[string]interface{}{}, + nil, stmts, } } @@ -34,6 +36,15 @@ func (n Finally) SetAttribute(key string, value interface{}) { n.attributes[key] = value } +func (n Finally) Position() *node.Position { + return n.position +} + +func (n Finally) SetPosition(p *node.Position) node.Node { + n.position = p + return n +} + func (n Finally) Walk(v node.Visitor) { if v.EnterNode(n) == false { return diff --git a/node/stmt/for.go b/node/stmt/for.go index 35a3508..aead82c 100644 --- a/node/stmt/for.go +++ b/node/stmt/for.go @@ -7,6 +7,7 @@ import ( type For struct { name string attributes map[string]interface{} + position *node.Position init []node.Node cond []node.Node loop []node.Node @@ -17,6 +18,7 @@ func NewFor(init []node.Node, cond []node.Node, loop []node.Node, stmt node.Node return For{ "For", map[string]interface{}{}, + nil, init, cond, loop, @@ -40,6 +42,15 @@ func (n For) SetAttribute(key string, value interface{}) { n.attributes[key] = value } +func (n For) Position() *node.Position { + return n.position +} + +func (n For) SetPosition(p *node.Position) node.Node { + n.position = p + return n +} + func (n For) Walk(v node.Visitor) { if v.EnterNode(n) == false { return diff --git a/node/stmt/foreach.go b/node/stmt/foreach.go index 1e8b527..ff2fbf7 100644 --- a/node/stmt/foreach.go +++ b/node/stmt/foreach.go @@ -7,6 +7,7 @@ import ( type Foreach struct { name string attributes map[string]interface{} + position *node.Position expr node.Node key node.Node variable node.Node @@ -19,6 +20,7 @@ func NewForeach(expr node.Node, key node.Node, variable node.Node, stmt node.Nod map[string]interface{}{ "byRef": byRef, }, + nil, expr, key, variable, @@ -42,6 +44,15 @@ func (n Foreach) SetAttribute(key string, value interface{}) { n.attributes[key] = value } +func (n Foreach) Position() *node.Position { + return n.position +} + +func (n Foreach) SetPosition(p *node.Position) node.Node { + n.position = p + return n +} + func (n Foreach) Walk(v node.Visitor) { if v.EnterNode(n) == false { return diff --git a/node/stmt/function.go b/node/stmt/function.go index 9bc7cbe..0f48770 100644 --- a/node/stmt/function.go +++ b/node/stmt/function.go @@ -7,6 +7,7 @@ import ( type Function struct { name string attributes map[string]interface{} + position *node.Position functionName node.Node params []node.Node returnType node.Node @@ -19,6 +20,7 @@ func NewFunction(functionName node.Node, returnsRef bool, params []node.Node, re map[string]interface{}{ "returnsRef": returnsRef, }, + nil, functionName, params, returnType, @@ -42,6 +44,15 @@ func (n Function) SetAttribute(key string, value interface{}) { n.attributes[key] = value } +func (n Function) Position() *node.Position { + return n.position +} + +func (n Function) SetPosition(p *node.Position) node.Node { + n.position = p + return n +} + func (n Function) Walk(v node.Visitor) { if v.EnterNode(n) == false { return diff --git a/node/stmt/global.go b/node/stmt/global.go index 6d18e7c..faaef25 100644 --- a/node/stmt/global.go +++ b/node/stmt/global.go @@ -7,6 +7,7 @@ import ( type Global struct { name string attributes map[string]interface{} + position *node.Position vars []node.Node } @@ -14,6 +15,7 @@ func NewGlobal(vars []node.Node) node.Node { return Global{ "Global", map[string]interface{}{}, + nil, vars, } } @@ -34,6 +36,15 @@ func (n Global) SetAttribute(key string, value interface{}) { n.attributes[key] = value } +func (n Global) Position() *node.Position { + return n.position +} + +func (n Global) SetPosition(p *node.Position) node.Node { + n.position = p + return n +} + func (n Global) Walk(v node.Visitor) { if v.EnterNode(n) == false { return diff --git a/node/stmt/goto.go b/node/stmt/goto.go index a52ced3..1f1e2cf 100644 --- a/node/stmt/goto.go +++ b/node/stmt/goto.go @@ -7,6 +7,7 @@ import ( type Goto struct { name string attributes map[string]interface{} + position *node.Position label node.Node } @@ -14,6 +15,7 @@ func NewGoto(label node.Node) node.Node { return Goto{ "Goto", map[string]interface{}{}, + nil, label, } } @@ -34,6 +36,15 @@ func (n Goto) SetAttribute(key string, value interface{}) { n.attributes[key] = value } +func (n Goto) Position() *node.Position { + return n.position +} + +func (n Goto) SetPosition(p *node.Position) node.Node { + n.position = p + return n +} + func (n Goto) Walk(v node.Visitor) { if v.EnterNode(n) == false { return diff --git a/node/stmt/group_use.go b/node/stmt/group_use.go index 2259730..7e109e2 100644 --- a/node/stmt/group_use.go +++ b/node/stmt/group_use.go @@ -7,6 +7,7 @@ import ( type GroupUse struct { name string attributes map[string]interface{} + position *node.Position useType node.Node prefix node.Node useList []node.Node @@ -16,6 +17,7 @@ func NewGroupUse(useType node.Node, prefix node.Node, useList []node.Node) node. return GroupUse{ "GroupUse", map[string]interface{}{}, + nil, useType, prefix, useList, @@ -38,6 +40,15 @@ func (n GroupUse) SetAttribute(key string, value interface{}) { n.attributes[key] = value } +func (n GroupUse) Position() *node.Position { + return n.position +} + +func (n GroupUse) SetPosition(p *node.Position) node.Node { + n.position = p + return n +} + func (n GroupUse) SetUseType(useType node.Node) node.Node { n.useType = useType return n diff --git a/node/stmt/halt_compiler.go b/node/stmt/halt_compiler.go index d5ccb7a..6e2bca9 100644 --- a/node/stmt/halt_compiler.go +++ b/node/stmt/halt_compiler.go @@ -7,12 +7,14 @@ import ( type HaltCompiler struct { name string attributes map[string]interface{} + position *node.Position } func NewHaltCompiler() node.Node { return HaltCompiler{ "HaltCompiler", map[string]interface{}{}, + nil, } } @@ -32,6 +34,15 @@ func (n HaltCompiler) SetAttribute(key string, value interface{}) { n.attributes[key] = value } +func (n HaltCompiler) Position() *node.Position { + return n.position +} + +func (n HaltCompiler) SetPosition(p *node.Position) node.Node { + n.position = p + return n +} + func (n HaltCompiler) Walk(v node.Visitor) { if v.EnterNode(n) == false { return diff --git a/node/stmt/if.go b/node/stmt/if.go index 85f0add..97f8a24 100644 --- a/node/stmt/if.go +++ b/node/stmt/if.go @@ -7,6 +7,7 @@ import ( type If struct { name string attributes map[string]interface{} + position *node.Position cond node.Node stmt node.Node elseIf []node.Node @@ -17,6 +18,7 @@ func NewIf(cond node.Node, stmt node.Node) node.Node { return If{ "If", map[string]interface{}{}, + nil, cond, stmt, nil, @@ -40,6 +42,15 @@ func (n If) SetAttribute(key string, value interface{}) { n.attributes[key] = value } +func (n If) Position() *node.Position { + return n.position +} + +func (n If) SetPosition(p *node.Position) node.Node { + n.position = p + return n +} + func (n If) AddElseIf(elseIf node.Node) node.Node { if n.elseIf == nil { n.elseIf = make([]node.Node, 0) diff --git a/node/stmt/inline_html.go b/node/stmt/inline_html.go index d0b0a1c..212fdf8 100644 --- a/node/stmt/inline_html.go +++ b/node/stmt/inline_html.go @@ -7,6 +7,7 @@ import ( type InlineHtml struct { name string attributes map[string]interface{} + position *node.Position } func NewInlineHtml(value string) node.Node { @@ -15,6 +16,7 @@ func NewInlineHtml(value string) node.Node { map[string]interface{}{ "value": value, }, + nil, } } @@ -34,6 +36,15 @@ func (n InlineHtml) SetAttribute(key string, value interface{}) { n.attributes[key] = value } +func (n InlineHtml) Position() *node.Position { + return n.position +} + +func (n InlineHtml) SetPosition(p *node.Position) node.Node { + n.position = p + return n +} + func (n InlineHtml) Walk(v node.Visitor) { if v.EnterNode(n) == false { return diff --git a/node/stmt/interface.go b/node/stmt/interface.go index 7daa1dc..c3bb847 100644 --- a/node/stmt/interface.go +++ b/node/stmt/interface.go @@ -7,6 +7,7 @@ import ( type Interface struct { name string attributes map[string]interface{} + position *node.Position interfaceName node.Node extends []node.Node stmts []node.Node @@ -16,6 +17,7 @@ func NewInterface(interfaceName node.Node, extends []node.Node, stmts []node.Nod return Interface{ "Interface", map[string]interface{}{}, + nil, interfaceName, extends, stmts, @@ -38,6 +40,15 @@ func (n Interface) SetAttribute(key string, value interface{}) { n.attributes[key] = value } +func (n Interface) Position() *node.Position { + return n.position +} + +func (n Interface) SetPosition(p *node.Position) node.Node { + n.position = p + return n +} + func (n Interface) Walk(v node.Visitor) { if v.EnterNode(n) == false { return diff --git a/node/stmt/label.go b/node/stmt/label.go index 029a2b8..cc35bed 100644 --- a/node/stmt/label.go +++ b/node/stmt/label.go @@ -7,6 +7,7 @@ import ( type Label struct { name string attributes map[string]interface{} + position *node.Position labelName node.Node } @@ -14,6 +15,7 @@ func NewLabel(labelName node.Node) node.Node { return Label{ "Label", map[string]interface{}{}, + nil, labelName, } } @@ -34,6 +36,15 @@ func (n Label) SetAttribute(key string, value interface{}) { n.attributes[key] = value } +func (n Label) Position() *node.Position { + return n.position +} + +func (n Label) SetPosition(p *node.Position) node.Node { + n.position = p + return n +} + func (n Label) Walk(v node.Visitor) { if v.EnterNode(n) == false { return diff --git a/node/stmt/namespace.go b/node/stmt/namespace.go index ca6e984..02a0a46 100644 --- a/node/stmt/namespace.go +++ b/node/stmt/namespace.go @@ -7,6 +7,7 @@ import ( type Namespace struct { name string attributes map[string]interface{} + position *node.Position namespaceName node.Node stmts []node.Node } @@ -15,6 +16,7 @@ func NewNamespace(namespaceName node.Node, stmts []node.Node) node.Node { return Namespace{ "Namespace", map[string]interface{}{}, + nil, namespaceName, stmts, } @@ -36,6 +38,15 @@ func (n Namespace) SetAttribute(key string, value interface{}) { n.attributes[key] = value } +func (n Namespace) Position() *node.Position { + return n.position +} + +func (n Namespace) SetPosition(p *node.Position) node.Node { + n.position = p + return n +} + func (n Namespace) Walk(v node.Visitor) { if v.EnterNode(n) == false { return diff --git a/node/stmt/nop.go b/node/stmt/nop.go index 32c69e0..886ff4a 100644 --- a/node/stmt/nop.go +++ b/node/stmt/nop.go @@ -7,12 +7,14 @@ import ( type Nop struct { name string attributes map[string]interface{} + position *node.Position } func NewNop() node.Node { return Nop{ "Nop", map[string]interface{}{}, + nil, } } @@ -32,6 +34,15 @@ func (n Nop) SetAttribute(key string, value interface{}) { n.attributes[key] = value } +func (n Nop) Position() *node.Position { + return n.position +} + +func (n Nop) SetPosition(p *node.Position) node.Node { + n.position = p + return n +} + func (n Nop) Walk(v node.Visitor) { if v.EnterNode(n) == false { return diff --git a/node/stmt/property.go b/node/stmt/property.go index 6e09da8..7241b62 100644 --- a/node/stmt/property.go +++ b/node/stmt/property.go @@ -7,6 +7,7 @@ import ( type Property struct { name string attributes map[string]interface{} + position *node.Position variable node.Node expr node.Node } @@ -15,6 +16,7 @@ func NewProperty(variable node.Node, expr node.Node) node.Node { return Property{ "Property", map[string]interface{}{}, + nil, variable, expr, } @@ -35,6 +37,15 @@ func (n Property) SetAttribute(key string, value interface{}) { n.attributes[key] = value } +func (n Property) Position() *node.Position { + return n.position +} + +func (n Property) SetPosition(p *node.Position) node.Node { + n.position = p + return n +} + func (n Property) Walk(v node.Visitor) { if v.EnterNode(n) == false { return diff --git a/node/stmt/property_list.go b/node/stmt/property_list.go index a43f96f..2a2dc6a 100644 --- a/node/stmt/property_list.go +++ b/node/stmt/property_list.go @@ -7,6 +7,7 @@ import ( type PropertyList struct { name string attributes map[string]interface{} + position *node.Position modifiers []node.Node properties []node.Node } @@ -15,6 +16,7 @@ func NewPropertyList(modifiers []node.Node, properties []node.Node) node.Node { return PropertyList{ "PropertyList", map[string]interface{}{}, + nil, modifiers, properties, } @@ -36,6 +38,15 @@ func (n PropertyList) SetAttribute(key string, value interface{}) { n.attributes[key] = value } +func (n PropertyList) Position() *node.Position { + return n.position +} + +func (n PropertyList) SetPosition(p *node.Position) node.Node { + n.position = p + return n +} + func (n PropertyList) Walk(v node.Visitor) { if v.EnterNode(n) == false { return diff --git a/node/stmt/return.go b/node/stmt/return.go index 4097291..475582c 100644 --- a/node/stmt/return.go +++ b/node/stmt/return.go @@ -7,6 +7,7 @@ import ( type Return struct { name string attributes map[string]interface{} + position *node.Position expr node.Node } @@ -14,6 +15,7 @@ func NewReturn(expr node.Node) node.Node { return Return{ "Return", map[string]interface{}{}, + nil, expr, } } @@ -34,6 +36,15 @@ func (n Return) SetAttribute(key string, value interface{}) { n.attributes[key] = value } +func (n Return) Position() *node.Position { + return n.position +} + +func (n Return) SetPosition(p *node.Position) node.Node { + n.position = p + return n +} + func (n Return) Walk(v node.Visitor) { if v.EnterNode(n) == false { return diff --git a/node/stmt/static.go b/node/stmt/static.go index 9a05552..6236f3e 100644 --- a/node/stmt/static.go +++ b/node/stmt/static.go @@ -7,6 +7,7 @@ import ( type Static struct { name string attributes map[string]interface{} + position *node.Position vars []node.Node } @@ -14,6 +15,7 @@ func NewStatic(vars []node.Node) node.Node { return Static{ "Static", map[string]interface{}{}, + nil, vars, } } @@ -34,6 +36,15 @@ func (n Static) SetAttribute(key string, value interface{}) { n.attributes[key] = value } +func (n Static) Position() *node.Position { + return n.position +} + +func (n Static) SetPosition(p *node.Position) node.Node { + n.position = p + return n +} + func (n Static) Walk(v node.Visitor) { if v.EnterNode(n) == false { return diff --git a/node/stmt/static_var.go b/node/stmt/static_var.go index a9287b5..f18f648 100644 --- a/node/stmt/static_var.go +++ b/node/stmt/static_var.go @@ -7,6 +7,7 @@ import ( type StaticVar struct { name string attributes map[string]interface{} + position *node.Position variable node.Node expr node.Node } @@ -15,6 +16,7 @@ func NewStaticVar(variable node.Node, expr node.Node) node.Node { return StaticVar{ "StaticVar", map[string]interface{}{}, + nil, variable, expr, } @@ -36,6 +38,15 @@ func (n StaticVar) SetAttribute(key string, value interface{}) { n.attributes[key] = value } +func (n StaticVar) Position() *node.Position { + return n.position +} + +func (n StaticVar) SetPosition(p *node.Position) node.Node { + n.position = p + return n +} + func (n StaticVar) Walk(v node.Visitor) { if v.EnterNode(n) == false { return diff --git a/node/stmt/stmt_list.go b/node/stmt/stmt_list.go index e566b94..d358095 100644 --- a/node/stmt/stmt_list.go +++ b/node/stmt/stmt_list.go @@ -7,6 +7,7 @@ import ( type StmtList struct { name string attributes map[string]interface{} + position *node.Position stmts []node.Node } @@ -14,6 +15,7 @@ func NewStmtList(stmts []node.Node) node.Node { return StmtList{ "StmtList", map[string]interface{}{}, + nil, stmts, } } @@ -34,6 +36,15 @@ func (n StmtList) SetAttribute(key string, value interface{}) { n.attributes[key] = value } +func (n StmtList) Position() *node.Position { + return n.position +} + +func (n StmtList) SetPosition(p *node.Position) node.Node { + n.position = p + return n +} + func (n StmtList) Walk(v node.Visitor) { if v.EnterNode(n) == false { return diff --git a/node/stmt/switch.go b/node/stmt/switch.go index 91d03f5..4100a8b 100644 --- a/node/stmt/switch.go +++ b/node/stmt/switch.go @@ -17,6 +17,15 @@ func (n Switch) SetAttribute(key string, value interface{}) { n.attributes[key] = value } +func (n Switch) Position() *node.Position { + return n.position +} + +func (n Switch) SetPosition(p *node.Position) node.Node { + n.position = p + return n +} + func (n Switch) Name() string { return "Switch" } @@ -24,6 +33,7 @@ func (n Switch) Name() string { type Switch struct { name string attributes map[string]interface{} + position *node.Position token token.Token cond node.Node cases []node.Node @@ -33,6 +43,7 @@ func NewSwitch(token token.Token, cond node.Node, cases []node.Node) node.Node { return Switch{ "Switch", map[string]interface{}{}, + nil, token, cond, cases, diff --git a/node/stmt/throw.go b/node/stmt/throw.go index a29f662..e4b0e99 100644 --- a/node/stmt/throw.go +++ b/node/stmt/throw.go @@ -7,6 +7,7 @@ import ( type Throw struct { name string attributes map[string]interface{} + position *node.Position expr node.Node } @@ -14,6 +15,7 @@ func NewThrow(expr node.Node) node.Node { return Throw{ "Throw", map[string]interface{}{}, + nil, expr, } } @@ -34,6 +36,15 @@ func (n Throw) SetAttribute(key string, value interface{}) { n.attributes[key] = value } +func (n Throw) Position() *node.Position { + return n.position +} + +func (n Throw) SetPosition(p *node.Position) node.Node { + n.position = p + return n +} + func (n Throw) Walk(v node.Visitor) { if v.EnterNode(n) == false { return diff --git a/node/stmt/trait.go b/node/stmt/trait.go index 903e662..ab01694 100644 --- a/node/stmt/trait.go +++ b/node/stmt/trait.go @@ -7,6 +7,7 @@ import ( type Trait struct { name string attributes map[string]interface{} + position *node.Position traitName node.Node stmts []node.Node } @@ -15,6 +16,7 @@ func NewTrait(traitName node.Node, stmts []node.Node) node.Node { return Trait{ "Trait", map[string]interface{}{}, + nil, traitName, stmts, } @@ -36,6 +38,15 @@ func (n Trait) SetAttribute(key string, value interface{}) { n.attributes[key] = value } +func (n Trait) Position() *node.Position { + return n.position +} + +func (n Trait) SetPosition(p *node.Position) node.Node { + n.position = p + return n +} + func (n Trait) Walk(v node.Visitor) { if v.EnterNode(n) == false { return diff --git a/node/stmt/trait_method_ref.go b/node/stmt/trait_method_ref.go index f44a500..7d3b2d3 100644 --- a/node/stmt/trait_method_ref.go +++ b/node/stmt/trait_method_ref.go @@ -7,6 +7,7 @@ import ( type TraitMethodRef struct { name string attributes map[string]interface{} + position *node.Position trait node.Node method node.Node } @@ -15,6 +16,7 @@ func NewTraitMethodRef(trait node.Node, method node.Node) node.Node { return TraitMethodRef{ "TraitMethodRef", map[string]interface{}{}, + nil, trait, method, } @@ -36,6 +38,15 @@ func (n TraitMethodRef) SetAttribute(key string, value interface{}) { n.attributes[key] = value } +func (n TraitMethodRef) Position() *node.Position { + return n.position +} + +func (n TraitMethodRef) SetPosition(p *node.Position) node.Node { + n.position = p + return n +} + func (n TraitMethodRef) Walk(v node.Visitor) { if v.EnterNode(n) == false { return diff --git a/node/stmt/trait_use.go b/node/stmt/trait_use.go index c526838..ac44ac3 100644 --- a/node/stmt/trait_use.go +++ b/node/stmt/trait_use.go @@ -7,6 +7,7 @@ import ( type TraitUse struct { name string attributes map[string]interface{} + position *node.Position traits []node.Node adaptations []node.Node } @@ -15,6 +16,7 @@ func NewTraitUse(traits []node.Node, adaptations []node.Node) node.Node { return TraitUse{ "TraitUse", map[string]interface{}{}, + nil, traits, adaptations, } @@ -36,6 +38,15 @@ func (n TraitUse) SetAttribute(key string, value interface{}) { n.attributes[key] = value } +func (n TraitUse) Position() *node.Position { + return n.position +} + +func (n TraitUse) SetPosition(p *node.Position) node.Node { + n.position = p + return n +} + func (n TraitUse) Walk(v node.Visitor) { if v.EnterNode(n) == false { return diff --git a/node/stmt/trait_use_alias.go b/node/stmt/trait_use_alias.go index 035aae9..768223b 100644 --- a/node/stmt/trait_use_alias.go +++ b/node/stmt/trait_use_alias.go @@ -7,6 +7,7 @@ import ( type TraitUseAlias struct { name string attributes map[string]interface{} + position *node.Position ref node.Node modifier node.Node alias node.Node @@ -16,6 +17,7 @@ func NewTraitUseAlias(ref node.Node, modifier node.Node, alias node.Node) node.N return TraitUseAlias{ "TraitUseAlias", map[string]interface{}{}, + nil, ref, modifier, alias, @@ -38,6 +40,15 @@ func (n TraitUseAlias) SetAttribute(key string, value interface{}) { n.attributes[key] = value } +func (n TraitUseAlias) Position() *node.Position { + return n.position +} + +func (n TraitUseAlias) SetPosition(p *node.Position) node.Node { + n.position = p + return n +} + func (n TraitUseAlias) Walk(v node.Visitor) { if v.EnterNode(n) == false { return diff --git a/node/stmt/trait_use_precedence.go b/node/stmt/trait_use_precedence.go index 155c532..9145452 100644 --- a/node/stmt/trait_use_precedence.go +++ b/node/stmt/trait_use_precedence.go @@ -7,6 +7,7 @@ import ( type TraitUsePrecedence struct { name string attributes map[string]interface{} + position *node.Position ref node.Node insteadof node.Node } @@ -15,6 +16,7 @@ func NewTraitUsePrecedence(ref node.Node, insteadof node.Node) node.Node { return TraitUsePrecedence{ "TraitUsePrecedence", map[string]interface{}{}, + nil, ref, insteadof, } @@ -36,6 +38,15 @@ func (n TraitUsePrecedence) SetAttribute(key string, value interface{}) { n.attributes[key] = value } +func (n TraitUsePrecedence) Position() *node.Position { + return n.position +} + +func (n TraitUsePrecedence) SetPosition(p *node.Position) node.Node { + n.position = p + return n +} + func (n TraitUsePrecedence) Walk(v node.Visitor) { if v.EnterNode(n) == false { return diff --git a/node/stmt/try.go b/node/stmt/try.go index 68b7986..6f24d1a 100644 --- a/node/stmt/try.go +++ b/node/stmt/try.go @@ -7,6 +7,7 @@ import ( type Try struct { name string attributes map[string]interface{} + position *node.Position stmts []node.Node catches []node.Node finally node.Node @@ -16,6 +17,7 @@ func NewTry(stmts []node.Node, catches []node.Node, finally node.Node) node.Node return Try{ "Try", map[string]interface{}{}, + nil, stmts, catches, finally, @@ -38,6 +40,15 @@ func (n Try) SetAttribute(key string, value interface{}) { n.attributes[key] = value } +func (n Try) Position() *node.Position { + return n.position +} + +func (n Try) SetPosition(p *node.Position) node.Node { + n.position = p + return n +} + func (n Try) Walk(v node.Visitor) { if v.EnterNode(n) == false { return diff --git a/node/stmt/unset.go b/node/stmt/unset.go index 1dbcba6..3afce11 100644 --- a/node/stmt/unset.go +++ b/node/stmt/unset.go @@ -7,6 +7,7 @@ import ( type Unset struct { name string attributes map[string]interface{} + position *node.Position vars []node.Node } @@ -14,6 +15,7 @@ func NewUnset(vars []node.Node) node.Node { return Unset{ "Unset", map[string]interface{}{}, + nil, vars, } } @@ -34,6 +36,15 @@ func (n Unset) SetAttribute(key string, value interface{}) { n.attributes[key] = value } +func (n Unset) Position() *node.Position { + return n.position +} + +func (n Unset) SetPosition(p *node.Position) node.Node { + n.position = p + return n +} + func (n Unset) Walk(v node.Visitor) { if v.EnterNode(n) == false { return diff --git a/node/stmt/use.go b/node/stmt/use.go index 55eeef6..0ef33df 100644 --- a/node/stmt/use.go +++ b/node/stmt/use.go @@ -7,6 +7,7 @@ import ( type Use struct { name string attributes map[string]interface{} + position *node.Position useType node.Node use node.Node alias node.Node @@ -16,6 +17,7 @@ func NewUse(useType node.Node, use node.Node, alias node.Node) node.Node { return Use{ "Use", map[string]interface{}{}, + nil, useType, use, alias, @@ -38,6 +40,15 @@ func (n Use) SetAttribute(key string, value interface{}) { n.attributes[key] = value } +func (n Use) Position() *node.Position { + return n.position +} + +func (n Use) SetPosition(p *node.Position) node.Node { + n.position = p + return n +} + func (n Use) SetUseType(useType node.Node) node.Node { n.useType = useType return n diff --git a/node/stmt/use_list.go b/node/stmt/use_list.go index 124c6cd..120cf18 100644 --- a/node/stmt/use_list.go +++ b/node/stmt/use_list.go @@ -7,6 +7,7 @@ import ( type UseList struct { name string attributes map[string]interface{} + position *node.Position useType node.Node uses []node.Node } @@ -15,6 +16,7 @@ func NewUseList(useType node.Node, uses []node.Node) node.Node { return UseList{ "UseList", map[string]interface{}{}, + nil, useType, uses, } @@ -36,6 +38,15 @@ func (n UseList) SetAttribute(key string, value interface{}) { n.attributes[key] = value } +func (n UseList) Position() *node.Position { + return n.position +} + +func (n UseList) SetPosition(p *node.Position) node.Node { + n.position = p + return n +} + func (n UseList) Walk(v node.Visitor) { if v.EnterNode(n) == false { return diff --git a/node/stmt/while.go b/node/stmt/while.go index 456af5c..d464dd1 100644 --- a/node/stmt/while.go +++ b/node/stmt/while.go @@ -8,6 +8,7 @@ import ( type While struct { name string attributes map[string]interface{} + position *node.Position token token.Token cond node.Node stmt node.Node @@ -17,6 +18,7 @@ func NewWhile(token token.Token, cond node.Node, stmt node.Node) node.Node { return While{ "While", map[string]interface{}{}, + nil, token, cond, stmt, @@ -39,6 +41,15 @@ func (n While) SetAttribute(key string, value interface{}) { n.attributes[key] = value } +func (n While) Position() *node.Position { + return n.position +} + +func (n While) SetPosition(p *node.Position) node.Node { + n.position = p + return n +} + func (n While) Walk(v node.Visitor) { if v.EnterNode(n) == false { return