diff --git a/node/argument.go b/node/argument.go index 10b56d6..551a6f4 100644 --- a/node/argument.go +++ b/node/argument.go @@ -1,34 +1,23 @@ package node type Argument struct { - attributes map[string]interface{} - position *Position - expr Node - variadic bool + position *Position + Variadic bool + Expr Node } -func NewArgument(Expression Node, variadic bool) Node { +func NewArgument(Expression Node, Variadic bool) Node { return &Argument{ - map[string]interface{}{ - "variadic": variadic, - }, nil, + Variadic, Expression, - variadic, } } func (n Argument) Attributes() map[string]interface{} { - return n.attributes -} - -func (n Argument) Attribute(Key string) interface{} { - return n.attributes[Key] -} - -func (n Argument) SetAttribute(Key string, Value interface{}) Node { - n.attributes[Key] = Value - return n + return map[string]interface{}{ + "Variadic": n.Variadic, + } } func (n Argument) Position() *Position { @@ -45,9 +34,9 @@ func (n Argument) Walk(v Visitor) { return } - if n.expr != nil { - vv := v.GetChildrenVisitor("expr") - n.expr.Walk(vv) + if n.Expr != nil { + vv := v.GetChildrenVisitor("Expr") + n.Expr.Walk(vv) } v.LeaveNode(n) diff --git a/node/expr/array.go b/node/expr/array.go index 042d2cc..d54a169 100644 --- a/node/expr/array.go +++ b/node/expr/array.go @@ -5,21 +5,19 @@ import ( ) type Array struct { - attributes map[string]interface{} - position *node.Position - Items []node.Node + position *node.Position + Items []node.Node } func NewArray(Items []node.Node) node.Node { return &Array{ - map[string]interface{}{}, nil, Items, } } func (n Array) Attributes() map[string]interface{} { - return n.attributes + return nil } func (n Array) Position() *node.Position { diff --git a/node/expr/array_dim_fetch.go b/node/expr/array_dim_fetch.go index b4f6bb8..ec93ffa 100644 --- a/node/expr/array_dim_fetch.go +++ b/node/expr/array_dim_fetch.go @@ -5,15 +5,13 @@ import ( ) type ArrayDimFetch struct { - attributes map[string]interface{} - position *node.Position - Variable node.Node - Dim node.Node + position *node.Position + Variable node.Node + Dim node.Node } func NewArrayDimFetch(Variable node.Node, Dim node.Node) node.Node { return &ArrayDimFetch{ - map[string]interface{}{}, nil, Variable, Dim, @@ -21,7 +19,7 @@ func NewArrayDimFetch(Variable node.Node, Dim node.Node) node.Node { } func (n ArrayDimFetch) Attributes() map[string]interface{} { - return n.attributes + return nil } func (n ArrayDimFetch) Position() *node.Position { diff --git a/node/expr/array_item.go b/node/expr/array_item.go index 1c58875..72c1974 100644 --- a/node/expr/array_item.go +++ b/node/expr/array_item.go @@ -5,25 +5,25 @@ import ( ) type ArrayItem struct { - attributes map[string]interface{} - position *node.Position - Key node.Node - Val node.Node + position *node.Position + ByRef bool + Key node.Node + Val node.Node } -func NewArrayItem(Key node.Node, Val node.Node, byRef bool) node.Node { +func NewArrayItem(Key node.Node, Val node.Node, ByRef bool) node.Node { return &ArrayItem{ - map[string]interface{}{ - "byRef": byRef, - }, nil, + ByRef, Key, Val, } } func (n ArrayItem) Attributes() map[string]interface{} { - return n.attributes + return map[string]interface{}{ + "ByRef": n.ByRef, + } } func (n ArrayItem) Position() *node.Position { diff --git a/node/expr/assign_op/assign.go b/node/expr/assign_op/assign.go index 779983d..58668ff 100644 --- a/node/expr/assign_op/assign.go +++ b/node/expr/assign_op/assign.go @@ -11,7 +11,6 @@ type Assign struct { func NewAssign(Variable node.Node, Expression node.Node) node.Node { return &Assign{ AssignOp{ - map[string]interface{}{}, nil, Variable, Expression, @@ -20,7 +19,7 @@ func NewAssign(Variable node.Node, Expression node.Node) node.Node { } func (n Assign) Attributes() map[string]interface{} { - return n.attributes + return nil } func (n Assign) Position() *node.Position { diff --git a/node/expr/assign_op/assign_op.go b/node/expr/assign_op/assign_op.go index ccec608..41d1e0e 100644 --- a/node/expr/assign_op/assign_op.go +++ b/node/expr/assign_op/assign_op.go @@ -5,7 +5,6 @@ import ( ) type AssignOp struct { - 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 de84a41..caecb12 100644 --- a/node/expr/assign_op/assign_ref.go +++ b/node/expr/assign_op/assign_ref.go @@ -11,7 +11,6 @@ type AssignRef struct { func NewAssignRef(Variable node.Node, Expression node.Node) node.Node { return &AssignRef{ AssignOp{ - map[string]interface{}{}, nil, Variable, Expression, @@ -20,7 +19,7 @@ func NewAssignRef(Variable node.Node, Expression node.Node) node.Node { } func (n AssignRef) Attributes() map[string]interface{} { - return n.attributes + return nil } func (n AssignRef) Position() *node.Position { diff --git a/node/expr/assign_op/bitwise_and.go b/node/expr/assign_op/bitwise_and.go index f8269d9..5aebcdf 100644 --- a/node/expr/assign_op/bitwise_and.go +++ b/node/expr/assign_op/bitwise_and.go @@ -11,7 +11,6 @@ type BitwiseAnd struct { func NewBitwiseAnd(Variable node.Node, Expression node.Node) node.Node { return &BitwiseAnd{ AssignOp{ - map[string]interface{}{}, nil, Variable, Expression, @@ -20,7 +19,7 @@ func NewBitwiseAnd(Variable node.Node, Expression node.Node) node.Node { } func (n BitwiseAnd) Attributes() map[string]interface{} { - return n.attributes + return nil } func (n BitwiseAnd) Position() *node.Position { diff --git a/node/expr/assign_op/bitwise_or.go b/node/expr/assign_op/bitwise_or.go index 8fad15a..2ea40bb 100644 --- a/node/expr/assign_op/bitwise_or.go +++ b/node/expr/assign_op/bitwise_or.go @@ -11,7 +11,6 @@ type BitwiseOr struct { func NewBitwiseOr(Variable node.Node, Expression node.Node) node.Node { return &BitwiseOr{ AssignOp{ - map[string]interface{}{}, nil, Variable, Expression, @@ -20,7 +19,7 @@ func NewBitwiseOr(Variable node.Node, Expression node.Node) node.Node { } func (n BitwiseOr) Attributes() map[string]interface{} { - return n.attributes + return nil } func (n BitwiseOr) Position() *node.Position { diff --git a/node/expr/assign_op/bitwise_xor.go b/node/expr/assign_op/bitwise_xor.go index d385a8b..66d68ce 100644 --- a/node/expr/assign_op/bitwise_xor.go +++ b/node/expr/assign_op/bitwise_xor.go @@ -11,7 +11,6 @@ type BitwiseXor struct { func NewBitwiseXor(Variable node.Node, Expression node.Node) node.Node { return &BitwiseXor{ AssignOp{ - map[string]interface{}{}, nil, Variable, Expression, @@ -20,7 +19,7 @@ func NewBitwiseXor(Variable node.Node, Expression node.Node) node.Node { } func (n BitwiseXor) Attributes() map[string]interface{} { - return n.attributes + return nil } func (n BitwiseXor) Position() *node.Position { diff --git a/node/expr/assign_op/concat.go b/node/expr/assign_op/concat.go index ce355df..80dfbf9 100644 --- a/node/expr/assign_op/concat.go +++ b/node/expr/assign_op/concat.go @@ -11,7 +11,6 @@ type Concat struct { func NewConcat(Variable node.Node, Expression node.Node) node.Node { return &Concat{ AssignOp{ - map[string]interface{}{}, nil, Variable, Expression, @@ -20,7 +19,7 @@ func NewConcat(Variable node.Node, Expression node.Node) node.Node { } func (n Concat) Attributes() map[string]interface{} { - return n.attributes + return nil } func (n Concat) Position() *node.Position { diff --git a/node/expr/assign_op/div.go b/node/expr/assign_op/div.go index 4a79969..0fe1904 100644 --- a/node/expr/assign_op/div.go +++ b/node/expr/assign_op/div.go @@ -11,7 +11,6 @@ type Div struct { func NewDiv(Variable node.Node, Expression node.Node) node.Node { return &Div{ AssignOp{ - map[string]interface{}{}, nil, Variable, Expression, @@ -20,7 +19,7 @@ func NewDiv(Variable node.Node, Expression node.Node) node.Node { } func (n Div) Attributes() map[string]interface{} { - return n.attributes + return nil } func (n Div) Position() *node.Position { diff --git a/node/expr/assign_op/minus.go b/node/expr/assign_op/minus.go index b9edbb5..6fea61d 100644 --- a/node/expr/assign_op/minus.go +++ b/node/expr/assign_op/minus.go @@ -11,7 +11,6 @@ type Minus struct { func NewMinus(Variable node.Node, Expression node.Node) node.Node { return &Minus{ AssignOp{ - map[string]interface{}{}, nil, Variable, Expression, @@ -20,7 +19,7 @@ func NewMinus(Variable node.Node, Expression node.Node) node.Node { } func (n Minus) Attributes() map[string]interface{} { - return n.attributes + return nil } func (n Minus) Position() *node.Position { diff --git a/node/expr/assign_op/mod.go b/node/expr/assign_op/mod.go index 4ab2e90..3a0a1f3 100644 --- a/node/expr/assign_op/mod.go +++ b/node/expr/assign_op/mod.go @@ -11,7 +11,6 @@ type Mod struct { func NewMod(Variable node.Node, Expression node.Node) node.Node { return &Mod{ AssignOp{ - map[string]interface{}{}, nil, Variable, Expression, @@ -20,7 +19,7 @@ func NewMod(Variable node.Node, Expression node.Node) node.Node { } func (n Mod) Attributes() map[string]interface{} { - return n.attributes + return nil } func (n Mod) Position() *node.Position { diff --git a/node/expr/assign_op/mul.go b/node/expr/assign_op/mul.go index 8db763e..610c018 100644 --- a/node/expr/assign_op/mul.go +++ b/node/expr/assign_op/mul.go @@ -11,7 +11,6 @@ type Mul struct { func NewMul(Variable node.Node, Expression node.Node) node.Node { return &Mul{ AssignOp{ - map[string]interface{}{}, nil, Variable, Expression, @@ -20,7 +19,7 @@ func NewMul(Variable node.Node, Expression node.Node) node.Node { } func (n Mul) Attributes() map[string]interface{} { - return n.attributes + return nil } func (n Mul) Position() *node.Position { diff --git a/node/expr/assign_op/plus.go b/node/expr/assign_op/plus.go index 6938f59..25749a4 100644 --- a/node/expr/assign_op/plus.go +++ b/node/expr/assign_op/plus.go @@ -11,7 +11,6 @@ type Plus struct { func NewPlus(Variable node.Node, Expression node.Node) node.Node { return &Plus{ AssignOp{ - map[string]interface{}{}, nil, Variable, Expression, @@ -20,7 +19,7 @@ func NewPlus(Variable node.Node, Expression node.Node) node.Node { } func (n Plus) Attributes() map[string]interface{} { - return n.attributes + return nil } func (n Plus) Position() *node.Position { diff --git a/node/expr/assign_op/pow.go b/node/expr/assign_op/pow.go index 2e0f28e..7192955 100644 --- a/node/expr/assign_op/pow.go +++ b/node/expr/assign_op/pow.go @@ -11,7 +11,6 @@ type Pow struct { func NewPow(Variable node.Node, Expression node.Node) node.Node { return &Pow{ AssignOp{ - map[string]interface{}{}, nil, Variable, Expression, @@ -20,7 +19,7 @@ func NewPow(Variable node.Node, Expression node.Node) node.Node { } func (n Pow) Attributes() map[string]interface{} { - return n.attributes + return nil } func (n Pow) Position() *node.Position { diff --git a/node/expr/assign_op/shift_left.go b/node/expr/assign_op/shift_left.go index 7477e79..385888c 100644 --- a/node/expr/assign_op/shift_left.go +++ b/node/expr/assign_op/shift_left.go @@ -11,7 +11,6 @@ type ShiftLeft struct { func NewShiftLeft(Variable node.Node, Expression node.Node) node.Node { return &ShiftLeft{ AssignOp{ - map[string]interface{}{}, nil, Variable, Expression, @@ -20,7 +19,7 @@ func NewShiftLeft(Variable node.Node, Expression node.Node) node.Node { } func (n ShiftLeft) Attributes() map[string]interface{} { - return n.attributes + return nil } func (n ShiftLeft) Position() *node.Position { diff --git a/node/expr/assign_op/shift_right.go b/node/expr/assign_op/shift_right.go index a95d10d..f68bbfa 100644 --- a/node/expr/assign_op/shift_right.go +++ b/node/expr/assign_op/shift_right.go @@ -11,7 +11,6 @@ type ShiftRight struct { func NewShiftRight(Variable node.Node, Expression node.Node) node.Node { return &ShiftRight{ AssignOp{ - map[string]interface{}{}, nil, Variable, Expression, @@ -20,7 +19,7 @@ func NewShiftRight(Variable node.Node, Expression node.Node) node.Node { } func (n ShiftRight) Attributes() map[string]interface{} { - return n.attributes + return nil } func (n ShiftRight) Position() *node.Position { diff --git a/node/expr/binary_op/binary_op.go b/node/expr/binary_op/binary_op.go index d1f113b..2c43a28 100644 --- a/node/expr/binary_op/binary_op.go +++ b/node/expr/binary_op/binary_op.go @@ -5,8 +5,7 @@ import ( ) type BinaryOp struct { - attributes map[string]interface{} - position *node.Position - Left node.Node - Right node.Node + 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 b5732a4..fad24f9 100644 --- a/node/expr/binary_op/bitwise_and.go +++ b/node/expr/binary_op/bitwise_and.go @@ -11,7 +11,6 @@ type BitwiseAnd struct { func NewBitwiseAnd(Variable node.Node, Expression node.Node) node.Node { return &BitwiseAnd{ BinaryOp{ - map[string]interface{}{}, nil, Variable, Expression, @@ -20,7 +19,7 @@ func NewBitwiseAnd(Variable node.Node, Expression node.Node) node.Node { } func (n BitwiseAnd) Attributes() map[string]interface{} { - return n.attributes + return nil } func (n BitwiseAnd) Position() *node.Position { diff --git a/node/expr/binary_op/bitwise_or.go b/node/expr/binary_op/bitwise_or.go index e6e8c90..97a8a3e 100644 --- a/node/expr/binary_op/bitwise_or.go +++ b/node/expr/binary_op/bitwise_or.go @@ -11,7 +11,6 @@ type BitwiseOr struct { func NewBitwiseOr(Variable node.Node, Expression node.Node) node.Node { return &BitwiseOr{ BinaryOp{ - map[string]interface{}{}, nil, Variable, Expression, @@ -20,7 +19,7 @@ func NewBitwiseOr(Variable node.Node, Expression node.Node) node.Node { } func (n BitwiseOr) Attributes() map[string]interface{} { - return n.attributes + return nil } func (n BitwiseOr) Position() *node.Position { diff --git a/node/expr/binary_op/bitwise_xor.go b/node/expr/binary_op/bitwise_xor.go index d8fa064..941aaac 100644 --- a/node/expr/binary_op/bitwise_xor.go +++ b/node/expr/binary_op/bitwise_xor.go @@ -11,7 +11,6 @@ type BitwiseXor struct { func NewBitwiseXor(Variable node.Node, Expression node.Node) node.Node { return &BitwiseXor{ BinaryOp{ - map[string]interface{}{}, nil, Variable, Expression, @@ -20,7 +19,7 @@ func NewBitwiseXor(Variable node.Node, Expression node.Node) node.Node { } func (n BitwiseXor) Attributes() map[string]interface{} { - return n.attributes + return nil } func (n BitwiseXor) Position() *node.Position { diff --git a/node/expr/binary_op/boolean_and.go b/node/expr/binary_op/boolean_and.go index ff556d9..1d90d35 100644 --- a/node/expr/binary_op/boolean_and.go +++ b/node/expr/binary_op/boolean_and.go @@ -11,7 +11,6 @@ type BooleanAnd struct { func NewBooleanAnd(Variable node.Node, Expression node.Node) node.Node { return &BooleanAnd{ BinaryOp{ - map[string]interface{}{}, nil, Variable, Expression, @@ -20,7 +19,7 @@ func NewBooleanAnd(Variable node.Node, Expression node.Node) node.Node { } func (n BooleanAnd) Attributes() map[string]interface{} { - return n.attributes + return nil } func (n BooleanAnd) Position() *node.Position { diff --git a/node/expr/binary_op/boolean_or.go b/node/expr/binary_op/boolean_or.go index f946263..da4938e 100644 --- a/node/expr/binary_op/boolean_or.go +++ b/node/expr/binary_op/boolean_or.go @@ -11,7 +11,6 @@ type BooleanOr struct { func NewBooleanOr(Variable node.Node, Expression node.Node) node.Node { return &BooleanOr{ BinaryOp{ - map[string]interface{}{}, nil, Variable, Expression, @@ -20,7 +19,7 @@ func NewBooleanOr(Variable node.Node, Expression node.Node) node.Node { } func (n BooleanOr) Attributes() map[string]interface{} { - return n.attributes + return nil } func (n BooleanOr) Position() *node.Position { diff --git a/node/expr/binary_op/coalesce.go b/node/expr/binary_op/coalesce.go index c70cca8..5425c03 100644 --- a/node/expr/binary_op/coalesce.go +++ b/node/expr/binary_op/coalesce.go @@ -11,7 +11,6 @@ type Coalesce struct { func NewCoalesce(Variable node.Node, Expression node.Node) node.Node { return &Coalesce{ BinaryOp{ - map[string]interface{}{}, nil, Variable, Expression, @@ -20,7 +19,7 @@ func NewCoalesce(Variable node.Node, Expression node.Node) node.Node { } func (n Coalesce) Attributes() map[string]interface{} { - return n.attributes + return nil } func (n Coalesce) Position() *node.Position { diff --git a/node/expr/binary_op/concat.go b/node/expr/binary_op/concat.go index 2027ccd..5786a9a 100644 --- a/node/expr/binary_op/concat.go +++ b/node/expr/binary_op/concat.go @@ -11,7 +11,6 @@ type Concat struct { func NewConcat(Variable node.Node, Expression node.Node) node.Node { return &Concat{ BinaryOp{ - map[string]interface{}{}, nil, Variable, Expression, @@ -20,7 +19,7 @@ func NewConcat(Variable node.Node, Expression node.Node) node.Node { } func (n Concat) Attributes() map[string]interface{} { - return n.attributes + return nil } func (n Concat) Position() *node.Position { diff --git a/node/expr/binary_op/div.go b/node/expr/binary_op/div.go index b814af3..c5fb5c1 100644 --- a/node/expr/binary_op/div.go +++ b/node/expr/binary_op/div.go @@ -11,7 +11,6 @@ type Div struct { func NewDiv(Variable node.Node, Expression node.Node) node.Node { return &Div{ BinaryOp{ - map[string]interface{}{}, nil, Variable, Expression, @@ -20,7 +19,7 @@ func NewDiv(Variable node.Node, Expression node.Node) node.Node { } func (n Div) Attributes() map[string]interface{} { - return n.attributes + return nil } func (n Div) Position() *node.Position { diff --git a/node/expr/binary_op/equal.go b/node/expr/binary_op/equal.go index b72811a..9fb5aa3 100644 --- a/node/expr/binary_op/equal.go +++ b/node/expr/binary_op/equal.go @@ -11,7 +11,6 @@ type Equal struct { func NewEqual(Variable node.Node, Expression node.Node) node.Node { return &Equal{ BinaryOp{ - map[string]interface{}{}, nil, Variable, Expression, @@ -20,7 +19,7 @@ func NewEqual(Variable node.Node, Expression node.Node) node.Node { } func (n Equal) Attributes() map[string]interface{} { - return n.attributes + return nil } func (n Equal) Position() *node.Position { diff --git a/node/expr/binary_op/greater.go b/node/expr/binary_op/greater.go index 27e67c0..29901d2 100644 --- a/node/expr/binary_op/greater.go +++ b/node/expr/binary_op/greater.go @@ -11,7 +11,6 @@ type Greater struct { func NewGreater(Variable node.Node, Expression node.Node) node.Node { return &Greater{ BinaryOp{ - map[string]interface{}{}, nil, Variable, Expression, @@ -20,7 +19,7 @@ func NewGreater(Variable node.Node, Expression node.Node) node.Node { } func (n Greater) Attributes() map[string]interface{} { - return n.attributes + return nil } func (n Greater) Position() *node.Position { diff --git a/node/expr/binary_op/greater_or_equal.go b/node/expr/binary_op/greater_or_equal.go index 9705f55..6cd4c45 100644 --- a/node/expr/binary_op/greater_or_equal.go +++ b/node/expr/binary_op/greater_or_equal.go @@ -11,7 +11,6 @@ type GreaterOrEqual struct { func NewGreaterOrEqual(Variable node.Node, Expression node.Node) node.Node { return &GreaterOrEqual{ BinaryOp{ - map[string]interface{}{}, nil, Variable, Expression, @@ -20,7 +19,7 @@ func NewGreaterOrEqual(Variable node.Node, Expression node.Node) node.Node { } func (n GreaterOrEqual) Attributes() map[string]interface{} { - return n.attributes + return nil } func (n GreaterOrEqual) Position() *node.Position { diff --git a/node/expr/binary_op/identical.go b/node/expr/binary_op/identical.go index 8b969ae..b7f544b 100644 --- a/node/expr/binary_op/identical.go +++ b/node/expr/binary_op/identical.go @@ -11,7 +11,6 @@ type Identical struct { func NewIdentical(Variable node.Node, Expression node.Node) node.Node { return &Identical{ BinaryOp{ - map[string]interface{}{}, nil, Variable, Expression, @@ -20,7 +19,7 @@ func NewIdentical(Variable node.Node, Expression node.Node) node.Node { } func (n Identical) Attributes() map[string]interface{} { - return n.attributes + return nil } func (n Identical) Position() *node.Position { diff --git a/node/expr/binary_op/logical_and.go b/node/expr/binary_op/logical_and.go index 9bc9d92..a9400d3 100644 --- a/node/expr/binary_op/logical_and.go +++ b/node/expr/binary_op/logical_and.go @@ -11,7 +11,6 @@ type LogicalAnd struct { func NewLogicalAnd(Variable node.Node, Expression node.Node) node.Node { return &LogicalAnd{ BinaryOp{ - map[string]interface{}{}, nil, Variable, Expression, @@ -20,7 +19,7 @@ func NewLogicalAnd(Variable node.Node, Expression node.Node) node.Node { } func (n LogicalAnd) Attributes() map[string]interface{} { - return n.attributes + return nil } func (n LogicalAnd) Position() *node.Position { diff --git a/node/expr/binary_op/logical_or.go b/node/expr/binary_op/logical_or.go index e9d2225..84fa84d 100644 --- a/node/expr/binary_op/logical_or.go +++ b/node/expr/binary_op/logical_or.go @@ -11,7 +11,6 @@ type LogicalOr struct { func NewLogicalOr(Variable node.Node, Expression node.Node) node.Node { return &LogicalOr{ BinaryOp{ - map[string]interface{}{}, nil, Variable, Expression, @@ -20,7 +19,7 @@ func NewLogicalOr(Variable node.Node, Expression node.Node) node.Node { } func (n LogicalOr) Attributes() map[string]interface{} { - return n.attributes + return nil } func (n LogicalOr) Position() *node.Position { diff --git a/node/expr/binary_op/logical_xor.go b/node/expr/binary_op/logical_xor.go index 063ed21..cdc5830 100644 --- a/node/expr/binary_op/logical_xor.go +++ b/node/expr/binary_op/logical_xor.go @@ -11,7 +11,6 @@ type LogicalXor struct { func NewLogicalXor(Variable node.Node, Expression node.Node) node.Node { return &LogicalXor{ BinaryOp{ - map[string]interface{}{}, nil, Variable, Expression, @@ -20,7 +19,7 @@ func NewLogicalXor(Variable node.Node, Expression node.Node) node.Node { } func (n LogicalXor) Attributes() map[string]interface{} { - return n.attributes + return nil } func (n LogicalXor) Position() *node.Position { diff --git a/node/expr/binary_op/minus.go b/node/expr/binary_op/minus.go index f7f5f21..4b0804e 100644 --- a/node/expr/binary_op/minus.go +++ b/node/expr/binary_op/minus.go @@ -11,7 +11,6 @@ type Minus struct { func NewMinus(Variable node.Node, Expression node.Node) node.Node { return &Minus{ BinaryOp{ - map[string]interface{}{}, nil, Variable, Expression, @@ -20,7 +19,7 @@ func NewMinus(Variable node.Node, Expression node.Node) node.Node { } func (n Minus) Attributes() map[string]interface{} { - return n.attributes + return nil } func (n Minus) Position() *node.Position { diff --git a/node/expr/binary_op/mod.go b/node/expr/binary_op/mod.go index 287c224..509b9c9 100644 --- a/node/expr/binary_op/mod.go +++ b/node/expr/binary_op/mod.go @@ -11,7 +11,6 @@ type Mod struct { func NewMod(Variable node.Node, Expression node.Node) node.Node { return &Mod{ BinaryOp{ - map[string]interface{}{}, nil, Variable, Expression, @@ -20,7 +19,7 @@ func NewMod(Variable node.Node, Expression node.Node) node.Node { } func (n Mod) Attributes() map[string]interface{} { - return n.attributes + return nil } func (n Mod) Position() *node.Position { diff --git a/node/expr/binary_op/mul.go b/node/expr/binary_op/mul.go index 74d1c80..05c471c 100644 --- a/node/expr/binary_op/mul.go +++ b/node/expr/binary_op/mul.go @@ -11,7 +11,6 @@ type Mul struct { func NewMul(Variable node.Node, Expression node.Node) node.Node { return &Mul{ BinaryOp{ - map[string]interface{}{}, nil, Variable, Expression, @@ -20,7 +19,7 @@ func NewMul(Variable node.Node, Expression node.Node) node.Node { } func (n Mul) Attributes() map[string]interface{} { - return n.attributes + return nil } func (n Mul) Position() *node.Position { diff --git a/node/expr/binary_op/not_equal.go b/node/expr/binary_op/not_equal.go index 2016870..9bbadf2 100644 --- a/node/expr/binary_op/not_equal.go +++ b/node/expr/binary_op/not_equal.go @@ -11,7 +11,6 @@ type NotEqual struct { func NewNotEqual(Variable node.Node, Expression node.Node) node.Node { return &NotEqual{ BinaryOp{ - map[string]interface{}{}, nil, Variable, Expression, @@ -20,7 +19,7 @@ func NewNotEqual(Variable node.Node, Expression node.Node) node.Node { } func (n NotEqual) Attributes() map[string]interface{} { - return n.attributes + return nil } func (n NotEqual) Position() *node.Position { diff --git a/node/expr/binary_op/not_identical.go b/node/expr/binary_op/not_identical.go index e81a125..b2d736e 100644 --- a/node/expr/binary_op/not_identical.go +++ b/node/expr/binary_op/not_identical.go @@ -11,7 +11,6 @@ type NotIdentical struct { func NewNotIdentical(Variable node.Node, Expression node.Node) node.Node { return &NotIdentical{ BinaryOp{ - map[string]interface{}{}, nil, Variable, Expression, @@ -20,7 +19,7 @@ func NewNotIdentical(Variable node.Node, Expression node.Node) node.Node { } func (n NotIdentical) Attributes() map[string]interface{} { - return n.attributes + return nil } func (n NotIdentical) Position() *node.Position { diff --git a/node/expr/binary_op/plus.go b/node/expr/binary_op/plus.go index 9c7ce0d..88ff8b9 100644 --- a/node/expr/binary_op/plus.go +++ b/node/expr/binary_op/plus.go @@ -11,7 +11,6 @@ type Plus struct { func NewPlus(Variable node.Node, Expression node.Node) node.Node { return &Plus{ BinaryOp{ - map[string]interface{}{}, nil, Variable, Expression, @@ -20,7 +19,7 @@ func NewPlus(Variable node.Node, Expression node.Node) node.Node { } func (n Plus) Attributes() map[string]interface{} { - return n.attributes + return nil } func (n Plus) Position() *node.Position { diff --git a/node/expr/binary_op/pow.go b/node/expr/binary_op/pow.go index 87a5a41..01110a0 100644 --- a/node/expr/binary_op/pow.go +++ b/node/expr/binary_op/pow.go @@ -11,7 +11,6 @@ type Pow struct { func NewPow(Variable node.Node, Expression node.Node) node.Node { return &Pow{ BinaryOp{ - map[string]interface{}{}, nil, Variable, Expression, @@ -20,7 +19,7 @@ func NewPow(Variable node.Node, Expression node.Node) node.Node { } func (n Pow) Attributes() map[string]interface{} { - return n.attributes + return nil } func (n Pow) Position() *node.Position { diff --git a/node/expr/binary_op/shift_left.go b/node/expr/binary_op/shift_left.go index 7c6087e..1e034e1 100644 --- a/node/expr/binary_op/shift_left.go +++ b/node/expr/binary_op/shift_left.go @@ -11,7 +11,6 @@ type ShiftLeft struct { func NewShiftLeft(Variable node.Node, Expression node.Node) node.Node { return &ShiftLeft{ BinaryOp{ - map[string]interface{}{}, nil, Variable, Expression, @@ -20,7 +19,7 @@ func NewShiftLeft(Variable node.Node, Expression node.Node) node.Node { } func (n ShiftLeft) Attributes() map[string]interface{} { - return n.attributes + return nil } func (n ShiftLeft) Position() *node.Position { diff --git a/node/expr/binary_op/shift_right.go b/node/expr/binary_op/shift_right.go index 4d37973..6cb57f4 100644 --- a/node/expr/binary_op/shift_right.go +++ b/node/expr/binary_op/shift_right.go @@ -11,7 +11,6 @@ type ShiftRight struct { func NewShiftRight(Variable node.Node, Expression node.Node) node.Node { return &ShiftRight{ BinaryOp{ - map[string]interface{}{}, nil, Variable, Expression, @@ -20,7 +19,7 @@ func NewShiftRight(Variable node.Node, Expression node.Node) node.Node { } func (n ShiftRight) Attributes() map[string]interface{} { - return n.attributes + return nil } func (n ShiftRight) Position() *node.Position { diff --git a/node/expr/binary_op/smaller.go b/node/expr/binary_op/smaller.go index 02be9b0..7a403c7 100644 --- a/node/expr/binary_op/smaller.go +++ b/node/expr/binary_op/smaller.go @@ -11,7 +11,6 @@ type Smaller struct { func NewSmaller(Variable node.Node, Expression node.Node) node.Node { return &Smaller{ BinaryOp{ - map[string]interface{}{}, nil, Variable, Expression, @@ -20,7 +19,7 @@ func NewSmaller(Variable node.Node, Expression node.Node) node.Node { } func (n Smaller) Attributes() map[string]interface{} { - return n.attributes + return nil } func (n Smaller) Position() *node.Position { diff --git a/node/expr/binary_op/smaller_or_equal.go b/node/expr/binary_op/smaller_or_equal.go index fdc1474..3dde672 100644 --- a/node/expr/binary_op/smaller_or_equal.go +++ b/node/expr/binary_op/smaller_or_equal.go @@ -11,7 +11,6 @@ type SmallerOrEqual struct { func NewSmallerOrEqual(Variable node.Node, Expression node.Node) node.Node { return &SmallerOrEqual{ BinaryOp{ - map[string]interface{}{}, nil, Variable, Expression, @@ -20,7 +19,7 @@ func NewSmallerOrEqual(Variable node.Node, Expression node.Node) node.Node { } func (n SmallerOrEqual) Attributes() map[string]interface{} { - return n.attributes + return nil } func (n SmallerOrEqual) Position() *node.Position { diff --git a/node/expr/binary_op/spaceship.go b/node/expr/binary_op/spaceship.go index dd3ef89..52a5146 100644 --- a/node/expr/binary_op/spaceship.go +++ b/node/expr/binary_op/spaceship.go @@ -11,7 +11,6 @@ type Spaceship struct { func NewSpaceship(Variable node.Node, Expression node.Node) node.Node { return &Spaceship{ BinaryOp{ - map[string]interface{}{}, nil, Variable, Expression, @@ -20,7 +19,7 @@ func NewSpaceship(Variable node.Node, Expression node.Node) node.Node { } func (n Spaceship) Attributes() map[string]interface{} { - return n.attributes + return nil } func (n Spaceship) Position() *node.Position { diff --git a/node/expr/bitwise_not.go b/node/expr/bitwise_not.go index 6d9d405..8b62ced 100644 --- a/node/expr/bitwise_not.go +++ b/node/expr/bitwise_not.go @@ -5,21 +5,19 @@ import ( ) type BitwiseNot struct { - attributes map[string]interface{} - position *node.Position - expr node.Node + position *node.Position + Expr node.Node } func NewBitwiseNot(Expression node.Node) node.Node { return &BitwiseNot{ - map[string]interface{}{}, nil, Expression, } } func (n BitwiseNot) Attributes() map[string]interface{} { - return n.attributes + return nil } func (n BitwiseNot) Position() *node.Position { @@ -36,9 +34,9 @@ func (n BitwiseNot) Walk(v node.Visitor) { return } - if n.expr != nil { - vv := v.GetChildrenVisitor("expr") - n.expr.Walk(vv) + if n.Expr != nil { + vv := v.GetChildrenVisitor("Expr") + n.Expr.Walk(vv) } v.LeaveNode(n) diff --git a/node/expr/boolean_not.go b/node/expr/boolean_not.go index d43f324..96f3288 100644 --- a/node/expr/boolean_not.go +++ b/node/expr/boolean_not.go @@ -5,21 +5,19 @@ import ( ) type BooleanNot struct { - attributes map[string]interface{} - position *node.Position - expr node.Node + position *node.Position + Expr node.Node } func NewBooleanNot(Expression node.Node) node.Node { return &BooleanNot{ - map[string]interface{}{}, nil, Expression, } } func (n BooleanNot) Attributes() map[string]interface{} { - return n.attributes + return nil } func (n BooleanNot) Position() *node.Position { @@ -36,9 +34,9 @@ func (n BooleanNot) Walk(v node.Visitor) { return } - if n.expr != nil { - vv := v.GetChildrenVisitor("expr") - n.expr.Walk(vv) + if n.Expr != nil { + vv := v.GetChildrenVisitor("Expr") + n.Expr.Walk(vv) } v.LeaveNode(n) diff --git a/node/expr/cast/cast.go b/node/expr/cast/cast.go index 4dc14cc..f632f15 100644 --- a/node/expr/cast/cast.go +++ b/node/expr/cast/cast.go @@ -5,7 +5,6 @@ import ( ) type Cast struct { - attributes map[string]interface{} - position *node.Position - expr node.Node + position *node.Position + Expr node.Node } diff --git a/node/expr/cast/cast_array.go b/node/expr/cast/cast_array.go index 4734017..a82c4da 100644 --- a/node/expr/cast/cast_array.go +++ b/node/expr/cast/cast_array.go @@ -8,18 +8,17 @@ type CastArray struct { Cast } -func NewCastArray(expr node.Node) node.Node { +func NewCastArray(Expr node.Node) node.Node { return &CastArray{ Cast{ - map[string]interface{}{}, nil, - expr, + Expr, }, } } func (n CastArray) Attributes() map[string]interface{} { - return n.attributes + return nil } func (n CastArray) Position() *node.Position { @@ -36,9 +35,9 @@ func (n CastArray) Walk(v node.Visitor) { return } - if n.expr != nil { - vv := v.GetChildrenVisitor("expr") - n.expr.Walk(vv) + if n.Expr != nil { + vv := v.GetChildrenVisitor("Expr") + n.Expr.Walk(vv) } v.LeaveNode(n) diff --git a/node/expr/cast/cast_bool.go b/node/expr/cast/cast_bool.go index def78bd..0ba23d1 100644 --- a/node/expr/cast/cast_bool.go +++ b/node/expr/cast/cast_bool.go @@ -8,18 +8,17 @@ type CastBool struct { Cast } -func NewCastBool(expr node.Node) node.Node { +func NewCastBool(Expr node.Node) node.Node { return &CastBool{ Cast{ - map[string]interface{}{}, nil, - expr, + Expr, }, } } func (n CastBool) Attributes() map[string]interface{} { - return n.attributes + return nil } func (n CastBool) Position() *node.Position { @@ -36,9 +35,9 @@ func (n CastBool) Walk(v node.Visitor) { return } - if n.expr != nil { - vv := v.GetChildrenVisitor("expr") - n.expr.Walk(vv) + if n.Expr != nil { + vv := v.GetChildrenVisitor("Expr") + n.Expr.Walk(vv) } v.LeaveNode(n) diff --git a/node/expr/cast/cast_double.go b/node/expr/cast/cast_double.go index 6e0097e..0f7a600 100644 --- a/node/expr/cast/cast_double.go +++ b/node/expr/cast/cast_double.go @@ -8,18 +8,17 @@ type CastDouble struct { Cast } -func NewCastDouble(expr node.Node) node.Node { +func NewCastDouble(Expr node.Node) node.Node { return &CastDouble{ Cast{ - map[string]interface{}{}, nil, - expr, + Expr, }, } } func (n CastDouble) Attributes() map[string]interface{} { - return n.attributes + return nil } func (n CastDouble) Position() *node.Position { @@ -36,9 +35,9 @@ func (n CastDouble) Walk(v node.Visitor) { return } - if n.expr != nil { - vv := v.GetChildrenVisitor("expr") - n.expr.Walk(vv) + if n.Expr != nil { + vv := v.GetChildrenVisitor("Expr") + n.Expr.Walk(vv) } v.LeaveNode(n) diff --git a/node/expr/cast/cast_int.go b/node/expr/cast/cast_int.go index 84dddb6..c1b6572 100644 --- a/node/expr/cast/cast_int.go +++ b/node/expr/cast/cast_int.go @@ -8,18 +8,17 @@ type CastInt struct { Cast } -func NewCastInt(expr node.Node) node.Node { +func NewCastInt(Expr node.Node) node.Node { return &CastInt{ Cast{ - map[string]interface{}{}, nil, - expr, + Expr, }, } } func (n CastInt) Attributes() map[string]interface{} { - return n.attributes + return nil } func (n CastInt) Position() *node.Position { @@ -36,9 +35,9 @@ func (n CastInt) Walk(v node.Visitor) { return } - if n.expr != nil { - vv := v.GetChildrenVisitor("expr") - n.expr.Walk(vv) + if n.Expr != nil { + vv := v.GetChildrenVisitor("Expr") + n.Expr.Walk(vv) } v.LeaveNode(n) diff --git a/node/expr/cast/cast_object.go b/node/expr/cast/cast_object.go index 14c9bf9..4f5259f 100644 --- a/node/expr/cast/cast_object.go +++ b/node/expr/cast/cast_object.go @@ -8,18 +8,17 @@ type CastObject struct { Cast } -func NewCastObject(expr node.Node) node.Node { +func NewCastObject(Expr node.Node) node.Node { return &CastObject{ Cast{ - map[string]interface{}{}, nil, - expr, + Expr, }, } } func (n CastObject) Attributes() map[string]interface{} { - return n.attributes + return nil } func (n CastObject) Position() *node.Position { @@ -36,9 +35,9 @@ func (n CastObject) Walk(v node.Visitor) { return } - if n.expr != nil { - vv := v.GetChildrenVisitor("expr") - n.expr.Walk(vv) + if n.Expr != nil { + vv := v.GetChildrenVisitor("Expr") + n.Expr.Walk(vv) } v.LeaveNode(n) diff --git a/node/expr/cast/cast_string.go b/node/expr/cast/cast_string.go index e08b466..589ec60 100644 --- a/node/expr/cast/cast_string.go +++ b/node/expr/cast/cast_string.go @@ -8,18 +8,17 @@ type CastString struct { Cast } -func NewCastString(expr node.Node) node.Node { +func NewCastString(Expr node.Node) node.Node { return &CastString{ Cast{ - map[string]interface{}{}, nil, - expr, + Expr, }, } } func (n CastString) Attributes() map[string]interface{} { - return n.attributes + return nil } func (n CastString) Position() *node.Position { @@ -36,9 +35,9 @@ func (n CastString) Walk(v node.Visitor) { return } - if n.expr != nil { - vv := v.GetChildrenVisitor("expr") - n.expr.Walk(vv) + if n.Expr != nil { + vv := v.GetChildrenVisitor("Expr") + n.Expr.Walk(vv) } v.LeaveNode(n) diff --git a/node/expr/cast/cast_unset.go b/node/expr/cast/cast_unset.go index 5930bb1..9d510ab 100644 --- a/node/expr/cast/cast_unset.go +++ b/node/expr/cast/cast_unset.go @@ -8,18 +8,17 @@ type CastUnset struct { Cast } -func NewCastUnset(expr node.Node) node.Node { +func NewCastUnset(Expr node.Node) node.Node { return &CastUnset{ Cast{ - map[string]interface{}{}, nil, - expr, + Expr, }, } } func (n CastUnset) Attributes() map[string]interface{} { - return n.attributes + return nil } func (n CastUnset) Position() *node.Position { @@ -36,9 +35,9 @@ func (n CastUnset) Walk(v node.Visitor) { return } - if n.expr != nil { - vv := v.GetChildrenVisitor("expr") - n.expr.Walk(vv) + if n.Expr != nil { + vv := v.GetChildrenVisitor("Expr") + n.Expr.Walk(vv) } v.LeaveNode(n) diff --git a/node/expr/class_const_fetch.go b/node/expr/class_const_fetch.go index 292e83a..3bb9e53 100644 --- a/node/expr/class_const_fetch.go +++ b/node/expr/class_const_fetch.go @@ -5,7 +5,6 @@ import ( ) type ClassConstFetch struct { - attributes map[string]interface{} position *node.Position Class node.Node ConstantName node.Node @@ -13,7 +12,6 @@ type ClassConstFetch struct { func NewClassConstFetch(Class node.Node, ConstantName node.Node) node.Node { return &ClassConstFetch{ - map[string]interface{}{}, nil, Class, ConstantName, @@ -21,7 +19,7 @@ func NewClassConstFetch(Class node.Node, ConstantName node.Node) node.Node { } func (n ClassConstFetch) Attributes() map[string]interface{} { - return n.attributes + return nil } func (n ClassConstFetch) Position() *node.Position { diff --git a/node/expr/clone.go b/node/expr/clone.go index 3963966..1cfa618 100644 --- a/node/expr/clone.go +++ b/node/expr/clone.go @@ -5,21 +5,19 @@ import ( ) type Clone struct { - attributes map[string]interface{} - position *node.Position - expr node.Node + position *node.Position + Expr node.Node } func NewClone(Expression node.Node) node.Node { return &Clone{ - map[string]interface{}{}, nil, Expression, } } func (n Clone) Attributes() map[string]interface{} { - return n.attributes + return nil } func (n Clone) Position() *node.Position { @@ -36,9 +34,9 @@ func (n Clone) Walk(v node.Visitor) { return } - if n.expr != nil { - vv := v.GetChildrenVisitor("expr") - n.expr.Walk(vv) + if n.Expr != nil { + vv := v.GetChildrenVisitor("Expr") + n.Expr.Walk(vv) } v.LeaveNode(n) diff --git a/node/expr/closure.go b/node/expr/closure.go index bb2b49b..5481b13 100644 --- a/node/expr/closure.go +++ b/node/expr/closure.go @@ -5,22 +5,22 @@ import ( ) type Closure struct { - attributes map[string]interface{} - position *node.Position - Params []node.Node - Uses []node.Node - ReturnType node.Node - Stmts []node.Node + position *node.Position + ReturnsRef bool + Static bool + PhpDocComment string + Params []node.Node + Uses []node.Node + ReturnType node.Node + Stmts []node.Node } -func NewClosure(Params []node.Node, Uses []node.Node, ReturnType node.Node, Stmts []node.Node, isStatic bool, isReturnRef bool, phpDocComment string) node.Node { +func NewClosure(Params []node.Node, Uses []node.Node, ReturnType node.Node, Stmts []node.Node, Static bool, ReturnsRef bool, PhpDocComment string) node.Node { return &Closure{ - map[string]interface{}{ - "isReturnRef": isReturnRef, - "isStatic": isStatic, - "phpDocComment": phpDocComment, - }, nil, + ReturnsRef, + Static, + PhpDocComment, Params, Uses, ReturnType, @@ -29,7 +29,11 @@ func NewClosure(Params []node.Node, Uses []node.Node, ReturnType node.Node, Stmt } func (n Closure) Attributes() map[string]interface{} { - return n.attributes + return map[string]interface{}{ + "ReturnsRef": n.ReturnsRef, + "Static": n.Static, + "PhpDocComment": n.PhpDocComment, + } } func (n Closure) Position() *node.Position { diff --git a/node/expr/closure_use.go b/node/expr/closure_use.go index 3be98c9..235fc3d 100644 --- a/node/expr/closure_use.go +++ b/node/expr/closure_use.go @@ -5,23 +5,23 @@ import ( ) type ClusureUse struct { - attributes map[string]interface{} - position *node.Position - Variable node.Node + position *node.Position + ByRef bool + Variable node.Node } -func NewClusureUse(Variable node.Node, byRef bool) node.Node { +func NewClusureUse(Variable node.Node, ByRef bool) node.Node { return &ClusureUse{ - map[string]interface{}{ - "byRef": byRef, - }, nil, + ByRef, Variable, } } func (n ClusureUse) Attributes() map[string]interface{} { - return n.attributes + return map[string]interface{}{ + "ByRef": n.ByRef, + } } func (n ClusureUse) Position() *node.Position { diff --git a/node/expr/const_fetch.go b/node/expr/const_fetch.go index 05274e0..af1b540 100644 --- a/node/expr/const_fetch.go +++ b/node/expr/const_fetch.go @@ -5,21 +5,19 @@ import ( ) type ConstFetch struct { - attributes map[string]interface{} - position *node.Position - Constant node.Node + position *node.Position + Constant node.Node } func NewConstFetch(Constant node.Node) node.Node { return &ConstFetch{ - map[string]interface{}{}, nil, Constant, } } func (n ConstFetch) Attributes() map[string]interface{} { - return n.attributes + return nil } func (n ConstFetch) Position() *node.Position { diff --git a/node/expr/empty.go b/node/expr/empty.go index aff7243..73d6b8d 100644 --- a/node/expr/empty.go +++ b/node/expr/empty.go @@ -5,21 +5,19 @@ import ( ) type Empty struct { - attributes map[string]interface{} - position *node.Position - expr node.Node + position *node.Position + Expr node.Node } func NewEmpty(Expression node.Node) node.Node { return &Empty{ - map[string]interface{}{}, nil, Expression, } } func (n Empty) Attributes() map[string]interface{} { - return n.attributes + return nil } func (n Empty) Position() *node.Position { @@ -36,9 +34,9 @@ func (n Empty) Walk(v node.Visitor) { return } - if n.expr != nil { - vv := v.GetChildrenVisitor("expr") - n.expr.Walk(vv) + if n.Expr != nil { + vv := v.GetChildrenVisitor("Expr") + n.Expr.Walk(vv) } v.LeaveNode(n) diff --git a/node/expr/error_suppress.go b/node/expr/error_suppress.go index 1852fed..7c2f966 100644 --- a/node/expr/error_suppress.go +++ b/node/expr/error_suppress.go @@ -5,21 +5,19 @@ import ( ) type ErrorSuppress struct { - attributes map[string]interface{} - position *node.Position - expr node.Node + position *node.Position + Expr node.Node } func NewErrorSuppress(Expression node.Node) node.Node { return &ErrorSuppress{ - map[string]interface{}{}, nil, Expression, } } func (n ErrorSuppress) Attributes() map[string]interface{} { - return n.attributes + return nil } func (n ErrorSuppress) Position() *node.Position { @@ -36,9 +34,9 @@ func (n ErrorSuppress) Walk(v node.Visitor) { return } - if n.expr != nil { - vv := v.GetChildrenVisitor("expr") - n.expr.Walk(vv) + if n.Expr != nil { + vv := v.GetChildrenVisitor("Expr") + n.Expr.Walk(vv) } v.LeaveNode(n) diff --git a/node/expr/eval.go b/node/expr/eval.go index 58c0f68..10e201b 100644 --- a/node/expr/eval.go +++ b/node/expr/eval.go @@ -5,21 +5,19 @@ import ( ) type Eval struct { - attributes map[string]interface{} - position *node.Position - expr node.Node + position *node.Position + Expr node.Node } func NewEval(Expression node.Node) node.Node { return &Eval{ - map[string]interface{}{}, nil, Expression, } } func (n Eval) Attributes() map[string]interface{} { - return n.attributes + return nil } func (n Eval) Position() *node.Position { @@ -36,9 +34,9 @@ func (n Eval) Walk(v node.Visitor) { return } - if n.expr != nil { - vv := v.GetChildrenVisitor("expr") - n.expr.Walk(vv) + if n.Expr != nil { + vv := v.GetChildrenVisitor("Expr") + n.Expr.Walk(vv) } v.LeaveNode(n) diff --git a/node/expr/exit.go b/node/expr/exit.go index c680e2c..43060fe 100644 --- a/node/expr/exit.go +++ b/node/expr/exit.go @@ -5,23 +5,23 @@ import ( ) type Exit struct { - attributes map[string]interface{} - position *node.Position - expr node.Node + position *node.Position + Expr node.Node + IsDie bool } -func NewExit(expr node.Node, isDie bool) node.Node { +func NewExit(Expr node.Node, IsDie bool) node.Node { return &Exit{ - map[string]interface{}{ - "isDie": isDie, - }, nil, - expr, + Expr, + IsDie, } } func (n Exit) Attributes() map[string]interface{} { - return n.attributes + return map[string]interface{}{ + "IsDie": n.IsDie, + } } func (n Exit) Position() *node.Position { @@ -38,9 +38,9 @@ func (n Exit) Walk(v node.Visitor) { return } - if n.expr != nil { - vv := v.GetChildrenVisitor("expr") - n.expr.Walk(vv) + if n.Expr != nil { + vv := v.GetChildrenVisitor("Expr") + n.Expr.Walk(vv) } v.LeaveNode(n) diff --git a/node/expr/function_call.go b/node/expr/function_call.go index bfc9a8c..f76b8ff 100644 --- a/node/expr/function_call.go +++ b/node/expr/function_call.go @@ -5,15 +5,13 @@ import ( ) type FunctionCall struct { - attributes map[string]interface{} - position *node.Position - Function node.Node - Arguments []node.Node + position *node.Position + Function node.Node + Arguments []node.Node } func NewFunctionCall(Function node.Node, Arguments []node.Node) node.Node { return &FunctionCall{ - map[string]interface{}{}, nil, Function, Arguments, @@ -21,7 +19,7 @@ func NewFunctionCall(Function node.Node, Arguments []node.Node) node.Node { } func (n FunctionCall) Attributes() map[string]interface{} { - return n.attributes + return nil } func (n FunctionCall) Position() *node.Position { diff --git a/node/expr/include.go b/node/expr/include.go index eaa19cb..3d1f969 100644 --- a/node/expr/include.go +++ b/node/expr/include.go @@ -5,21 +5,19 @@ import ( ) type Include struct { - attributes map[string]interface{} - position *node.Position - expr node.Node + position *node.Position + Expr node.Node } func NewInclude(Expression node.Node) node.Node { return &Include{ - map[string]interface{}{}, nil, Expression, } } func (n Include) Attributes() map[string]interface{} { - return n.attributes + return nil } func (n Include) Position() *node.Position { @@ -36,9 +34,9 @@ func (n Include) Walk(v node.Visitor) { return } - if n.expr != nil { - vv := v.GetChildrenVisitor("expr") - n.expr.Walk(vv) + if n.Expr != nil { + vv := v.GetChildrenVisitor("Expr") + n.Expr.Walk(vv) } v.LeaveNode(n) diff --git a/node/expr/include_once.go b/node/expr/include_once.go index 70dfdaa..f38fcfc 100644 --- a/node/expr/include_once.go +++ b/node/expr/include_once.go @@ -5,21 +5,19 @@ import ( ) type IncludeOnce struct { - attributes map[string]interface{} - position *node.Position - expr node.Node + position *node.Position + Expr node.Node } func NewIncludeOnce(Expression node.Node) node.Node { return &IncludeOnce{ - map[string]interface{}{}, nil, Expression, } } func (n IncludeOnce) Attributes() map[string]interface{} { - return n.attributes + return nil } func (n IncludeOnce) Position() *node.Position { @@ -36,9 +34,9 @@ func (n IncludeOnce) Walk(v node.Visitor) { return } - if n.expr != nil { - vv := v.GetChildrenVisitor("expr") - n.expr.Walk(vv) + if n.Expr != nil { + vv := v.GetChildrenVisitor("Expr") + n.Expr.Walk(vv) } v.LeaveNode(n) diff --git a/node/expr/instance_of.go b/node/expr/instance_of.go index d245181..dbf273c 100644 --- a/node/expr/instance_of.go +++ b/node/expr/instance_of.go @@ -5,23 +5,21 @@ import ( ) type InstanceOf struct { - attributes map[string]interface{} - position *node.Position - expr node.Node - Class node.Node + position *node.Position + Expr node.Node + Class node.Node } -func NewInstanceOf(expr node.Node, Class node.Node) node.Node { +func NewInstanceOf(Expr node.Node, Class node.Node) node.Node { return &InstanceOf{ - map[string]interface{}{}, nil, - expr, + Expr, Class, } } func (n InstanceOf) Attributes() map[string]interface{} { - return n.attributes + return nil } func (n InstanceOf) Position() *node.Position { @@ -38,9 +36,9 @@ func (n InstanceOf) Walk(v node.Visitor) { return } - if n.expr != nil { - vv := v.GetChildrenVisitor("expr") - n.expr.Walk(vv) + if n.Expr != nil { + vv := v.GetChildrenVisitor("Expr") + n.Expr.Walk(vv) } if n.Class != nil { diff --git a/node/expr/isset.go b/node/expr/isset.go index 6cd08db..ea1a95d 100644 --- a/node/expr/isset.go +++ b/node/expr/isset.go @@ -5,21 +5,19 @@ import ( ) type Isset struct { - attributes map[string]interface{} - position *node.Position - Variables []node.Node + position *node.Position + Variables []node.Node } func NewIsset(Variables []node.Node) node.Node { return &Isset{ - map[string]interface{}{}, nil, Variables, } } func (n Isset) Attributes() map[string]interface{} { - return n.attributes + return nil } func (n Isset) Position() *node.Position { diff --git a/node/expr/list.go b/node/expr/list.go index baacc57..32c329c 100644 --- a/node/expr/list.go +++ b/node/expr/list.go @@ -5,21 +5,19 @@ import ( ) type List struct { - attributes map[string]interface{} - position *node.Position - Items []node.Node + position *node.Position + Items []node.Node } func NewList(Items []node.Node) node.Node { return &List{ - map[string]interface{}{}, nil, Items, } } func (n List) Attributes() map[string]interface{} { - return n.attributes + return nil } func (n List) Position() *node.Position { diff --git a/node/expr/method_call.go b/node/expr/method_call.go index b76504c..d8ce3a6 100644 --- a/node/expr/method_call.go +++ b/node/expr/method_call.go @@ -5,16 +5,14 @@ import ( ) type MethodCall struct { - attributes map[string]interface{} - position *node.Position - Variable node.Node - Method node.Node - Arguments []node.Node + position *node.Position + Variable node.Node + Method node.Node + Arguments []node.Node } func NewMethodCall(Variable node.Node, Method node.Node, Arguments []node.Node) node.Node { return &MethodCall{ - map[string]interface{}{}, nil, Variable, Method, @@ -23,7 +21,7 @@ func NewMethodCall(Variable node.Node, Method node.Node, Arguments []node.Node) } func (n MethodCall) Attributes() map[string]interface{} { - return n.attributes + return nil } func (n MethodCall) Position() *node.Position { diff --git a/node/expr/new.go b/node/expr/new.go index 685f7e3..12a786e 100644 --- a/node/expr/new.go +++ b/node/expr/new.go @@ -5,15 +5,13 @@ import ( ) type New struct { - attributes map[string]interface{} - position *node.Position - Class node.Node - Arguments []node.Node + position *node.Position + Class node.Node + Arguments []node.Node } func NewNew(Class node.Node, Arguments []node.Node) node.Node { return &New{ - map[string]interface{}{}, nil, Class, Arguments, @@ -21,7 +19,7 @@ func NewNew(Class node.Node, Arguments []node.Node) node.Node { } func (n New) Attributes() map[string]interface{} { - return n.attributes + return nil } func (n New) Position() *node.Position { diff --git a/node/expr/post_dec.go b/node/expr/post_dec.go index 9d0078d..e0282bd 100644 --- a/node/expr/post_dec.go +++ b/node/expr/post_dec.go @@ -5,21 +5,19 @@ import ( ) type PostDec struct { - attributes map[string]interface{} - position *node.Position - Variable node.Node + position *node.Position + Variable node.Node } func NewPostDec(Variable node.Node) node.Node { return &PostDec{ - map[string]interface{}{}, nil, Variable, } } func (n PostDec) Attributes() map[string]interface{} { - return n.attributes + return nil } func (n PostDec) Position() *node.Position { diff --git a/node/expr/post_inc.go b/node/expr/post_inc.go index 2a1e0dd..d87285d 100644 --- a/node/expr/post_inc.go +++ b/node/expr/post_inc.go @@ -5,21 +5,19 @@ import ( ) type PostInc struct { - attributes map[string]interface{} - position *node.Position - Variable node.Node + position *node.Position + Variable node.Node } func NewPostInc(Variable node.Node) node.Node { return &PostInc{ - map[string]interface{}{}, nil, Variable, } } func (n PostInc) Attributes() map[string]interface{} { - return n.attributes + return nil } func (n PostInc) Position() *node.Position { diff --git a/node/expr/pre_dec.go b/node/expr/pre_dec.go index 6514ee9..4713eb2 100644 --- a/node/expr/pre_dec.go +++ b/node/expr/pre_dec.go @@ -5,21 +5,19 @@ import ( ) type PreDec struct { - attributes map[string]interface{} - position *node.Position - Variable node.Node + position *node.Position + Variable node.Node } func NewPreDec(Variable node.Node) node.Node { return &PreDec{ - map[string]interface{}{}, nil, Variable, } } func (n PreDec) Attributes() map[string]interface{} { - return n.attributes + return nil } func (n PreDec) Position() *node.Position { diff --git a/node/expr/pre_inc.go b/node/expr/pre_inc.go index e0c3d12..f75bad9 100644 --- a/node/expr/pre_inc.go +++ b/node/expr/pre_inc.go @@ -5,21 +5,19 @@ import ( ) type PreInc struct { - attributes map[string]interface{} - position *node.Position - Variable node.Node + position *node.Position + Variable node.Node } func NewPreInc(Variable node.Node) node.Node { return &PreInc{ - map[string]interface{}{}, nil, Variable, } } func (n PreInc) Attributes() map[string]interface{} { - return n.attributes + return nil } func (n PreInc) Position() *node.Position { diff --git a/node/expr/print.go b/node/expr/print.go index 140d270..46881fc 100644 --- a/node/expr/print.go +++ b/node/expr/print.go @@ -5,21 +5,19 @@ import ( ) type Print struct { - attributes map[string]interface{} - position *node.Position - expr node.Node + position *node.Position + Expr node.Node } func NewPrint(Expression node.Node) node.Node { return &Print{ - map[string]interface{}{}, nil, Expression, } } func (n Print) Attributes() map[string]interface{} { - return n.attributes + return nil } func (n Print) Position() *node.Position { @@ -36,9 +34,9 @@ func (n Print) Walk(v node.Visitor) { return } - if n.expr != nil { - vv := v.GetChildrenVisitor("expr") - n.expr.Walk(vv) + if n.Expr != nil { + vv := v.GetChildrenVisitor("Expr") + n.Expr.Walk(vv) } v.LeaveNode(n) diff --git a/node/expr/property_fetch.go b/node/expr/property_fetch.go index 78f537c..60af79f 100644 --- a/node/expr/property_fetch.go +++ b/node/expr/property_fetch.go @@ -5,15 +5,13 @@ import ( ) type PropertyFetch struct { - attributes map[string]interface{} - position *node.Position - Variable node.Node - Property node.Node + position *node.Position + Variable node.Node + Property node.Node } func NewPropertyFetch(Variable node.Node, Property node.Node) node.Node { return &PropertyFetch{ - map[string]interface{}{}, nil, Variable, Property, @@ -21,7 +19,7 @@ func NewPropertyFetch(Variable node.Node, Property node.Node) node.Node { } func (n PropertyFetch) Attributes() map[string]interface{} { - return n.attributes + return nil } func (n PropertyFetch) Position() *node.Position { diff --git a/node/expr/require.go b/node/expr/require.go index f3928ca..1dd1309 100644 --- a/node/expr/require.go +++ b/node/expr/require.go @@ -5,21 +5,19 @@ import ( ) type Require struct { - attributes map[string]interface{} - position *node.Position - expr node.Node + position *node.Position + Expr node.Node } func NewRequire(Expression node.Node) node.Node { return &Require{ - map[string]interface{}{}, nil, Expression, } } func (n Require) Attributes() map[string]interface{} { - return n.attributes + return nil } func (n Require) Position() *node.Position { @@ -36,9 +34,9 @@ func (n Require) Walk(v node.Visitor) { return } - if n.expr != nil { - vv := v.GetChildrenVisitor("expr") - n.expr.Walk(vv) + if n.Expr != nil { + vv := v.GetChildrenVisitor("Expr") + n.Expr.Walk(vv) } v.LeaveNode(n) diff --git a/node/expr/require_once.go b/node/expr/require_once.go index d678859..d96e4db 100644 --- a/node/expr/require_once.go +++ b/node/expr/require_once.go @@ -5,21 +5,19 @@ import ( ) type RequireOnce struct { - attributes map[string]interface{} - position *node.Position - expr node.Node + position *node.Position + Expr node.Node } func NewRequireOnce(Expression node.Node) node.Node { return &RequireOnce{ - map[string]interface{}{}, nil, Expression, } } func (n RequireOnce) Attributes() map[string]interface{} { - return n.attributes + return nil } func (n RequireOnce) Position() *node.Position { @@ -36,9 +34,9 @@ func (n RequireOnce) Walk(v node.Visitor) { return } - if n.expr != nil { - vv := v.GetChildrenVisitor("expr") - n.expr.Walk(vv) + if n.Expr != nil { + vv := v.GetChildrenVisitor("Expr") + n.Expr.Walk(vv) } v.LeaveNode(n) diff --git a/node/expr/shell_exec.go b/node/expr/shell_exec.go index df4cc07..e36485b 100644 --- a/node/expr/shell_exec.go +++ b/node/expr/shell_exec.go @@ -5,21 +5,19 @@ import ( ) type ShellExec struct { - attributes map[string]interface{} - position *node.Position - Parts []node.Node + position *node.Position + Parts []node.Node } func NewShellExec(Parts []node.Node) node.Node { return &ShellExec{ - map[string]interface{}{}, nil, Parts, } } func (n ShellExec) Attributes() map[string]interface{} { - return n.attributes + return nil } func (n ShellExec) Position() *node.Position { diff --git a/node/expr/short_array.go b/node/expr/short_array.go index 64379bb..3bb1ee9 100644 --- a/node/expr/short_array.go +++ b/node/expr/short_array.go @@ -5,21 +5,19 @@ import ( ) type ShortArray struct { - attributes map[string]interface{} - position *node.Position - Items []node.Node + position *node.Position + Items []node.Node } func NewShortArray(Items []node.Node) node.Node { return &ShortArray{ - map[string]interface{}{}, nil, Items, } } func (n ShortArray) Attributes() map[string]interface{} { - return n.attributes + return nil } func (n ShortArray) Position() *node.Position { diff --git a/node/expr/short_list.go b/node/expr/short_list.go index 14f121f..31e762e 100644 --- a/node/expr/short_list.go +++ b/node/expr/short_list.go @@ -5,21 +5,19 @@ import ( ) type ShortList struct { - attributes map[string]interface{} - position *node.Position - Items []node.Node + position *node.Position + Items []node.Node } func NewShortList(Items []node.Node) node.Node { return &ShortList{ - map[string]interface{}{}, nil, Items, } } func (n ShortList) Attributes() map[string]interface{} { - return n.attributes + return nil } func (n ShortList) Position() *node.Position { diff --git a/node/expr/static_call.go b/node/expr/static_call.go index aa2fdb8..2d6fb18 100644 --- a/node/expr/static_call.go +++ b/node/expr/static_call.go @@ -5,16 +5,14 @@ import ( ) type StaticCall struct { - attributes map[string]interface{} - position *node.Position - Class node.Node - Call node.Node - Arguments []node.Node + position *node.Position + Class node.Node + Call node.Node + Arguments []node.Node } func NewStaticCall(Class node.Node, Call node.Node, Arguments []node.Node) node.Node { return &StaticCall{ - map[string]interface{}{}, nil, Class, Call, @@ -23,7 +21,7 @@ func NewStaticCall(Class node.Node, Call node.Node, Arguments []node.Node) node. } func (n StaticCall) Attributes() map[string]interface{} { - return n.attributes + return nil } func (n StaticCall) Position() *node.Position { diff --git a/node/expr/static_property_fetch.go b/node/expr/static_property_fetch.go index 030e917..062704d 100644 --- a/node/expr/static_property_fetch.go +++ b/node/expr/static_property_fetch.go @@ -5,15 +5,13 @@ import ( ) type StaticPropertyFetch struct { - attributes map[string]interface{} - position *node.Position - Class node.Node - Property node.Node + position *node.Position + Class node.Node + Property node.Node } func NewStaticPropertyFetch(Class node.Node, Property node.Node) node.Node { return &StaticPropertyFetch{ - map[string]interface{}{}, nil, Class, Property, @@ -21,7 +19,7 @@ func NewStaticPropertyFetch(Class node.Node, Property node.Node) node.Node { } func (n StaticPropertyFetch) Attributes() map[string]interface{} { - return n.attributes + return nil } func (n StaticPropertyFetch) Position() *node.Position { diff --git a/node/expr/ternary.go b/node/expr/ternary.go index 77d44eb..ea4a7b6 100644 --- a/node/expr/ternary.go +++ b/node/expr/ternary.go @@ -5,16 +5,14 @@ import ( ) type Ternary struct { - attributes map[string]interface{} - position *node.Position - Condition node.Node - IfTrue node.Node - IfFalse node.Node + position *node.Position + Condition node.Node + IfTrue node.Node + IfFalse node.Node } func NewTernary(Condition node.Node, IfTrue node.Node, IfFalse node.Node) node.Node { return &Ternary{ - map[string]interface{}{}, nil, Condition, IfTrue, @@ -23,7 +21,7 @@ func NewTernary(Condition node.Node, IfTrue node.Node, IfFalse node.Node) node.N } func (n Ternary) Attributes() map[string]interface{} { - return n.attributes + return nil } func (n Ternary) Position() *node.Position { diff --git a/node/expr/unary_minus.go b/node/expr/unary_minus.go index 5562508..7a99c04 100644 --- a/node/expr/unary_minus.go +++ b/node/expr/unary_minus.go @@ -5,21 +5,19 @@ import ( ) type UnaryMinus struct { - attributes map[string]interface{} - position *node.Position - expr node.Node + position *node.Position + Expr node.Node } func NewUnaryMinus(Expression node.Node) node.Node { return &UnaryMinus{ - map[string]interface{}{}, nil, Expression, } } func (n UnaryMinus) Attributes() map[string]interface{} { - return n.attributes + return nil } func (n UnaryMinus) Position() *node.Position { @@ -36,9 +34,9 @@ func (n UnaryMinus) Walk(v node.Visitor) { return } - if n.expr != nil { - vv := v.GetChildrenVisitor("expr") - n.expr.Walk(vv) + if n.Expr != nil { + vv := v.GetChildrenVisitor("Expr") + n.Expr.Walk(vv) } v.LeaveNode(n) diff --git a/node/expr/unary_plus.go b/node/expr/unary_plus.go index 4341926..67082a6 100644 --- a/node/expr/unary_plus.go +++ b/node/expr/unary_plus.go @@ -5,21 +5,19 @@ import ( ) type UnaryPlus struct { - attributes map[string]interface{} - position *node.Position - expr node.Node + position *node.Position + Expr node.Node } func NewUnaryPlus(Expression node.Node) node.Node { return &UnaryPlus{ - map[string]interface{}{}, nil, Expression, } } func (n UnaryPlus) Attributes() map[string]interface{} { - return n.attributes + return nil } func (n UnaryPlus) Position() *node.Position { @@ -36,9 +34,9 @@ func (n UnaryPlus) Walk(v node.Visitor) { return } - if n.expr != nil { - vv := v.GetChildrenVisitor("expr") - n.expr.Walk(vv) + if n.Expr != nil { + vv := v.GetChildrenVisitor("Expr") + n.Expr.Walk(vv) } v.LeaveNode(n) diff --git a/node/expr/variable.go b/node/expr/variable.go index 4747b58..02769b1 100644 --- a/node/expr/variable.go +++ b/node/expr/variable.go @@ -5,21 +5,19 @@ import ( ) type Variable struct { - attributes map[string]interface{} - position *node.Position - VarName node.Node + position *node.Position + VarName node.Node } func NewVariable(VarName node.Node) node.Node { return &Variable{ - map[string]interface{}{}, nil, VarName, } } func (n Variable) Attributes() map[string]interface{} { - return n.attributes + return nil } func (n Variable) Position() *node.Position { diff --git a/node/expr/yield.go b/node/expr/yield.go index 5e298a4..074a48a 100644 --- a/node/expr/yield.go +++ b/node/expr/yield.go @@ -5,15 +5,13 @@ import ( ) type Yield struct { - attributes map[string]interface{} - position *node.Position - Key node.Node - Value node.Node + position *node.Position + Key node.Node + Value node.Node } func NewYield(Key node.Node, Value node.Node) node.Node { return &Yield{ - map[string]interface{}{}, nil, Key, Value, @@ -21,7 +19,7 @@ func NewYield(Key node.Node, Value node.Node) node.Node { } func (n Yield) Attributes() map[string]interface{} { - return n.attributes + return nil } func (n Yield) Position() *node.Position { diff --git a/node/expr/yield_from.go b/node/expr/yield_from.go index 839ad88..df0bd0e 100644 --- a/node/expr/yield_from.go +++ b/node/expr/yield_from.go @@ -5,21 +5,19 @@ import ( ) type YieldFrom struct { - attributes map[string]interface{} - position *node.Position - expr node.Node + position *node.Position + Expr node.Node } func NewYieldFrom(Expression node.Node) node.Node { return &YieldFrom{ - map[string]interface{}{}, nil, Expression, } } func (n YieldFrom) Attributes() map[string]interface{} { - return n.attributes + return nil } func (n YieldFrom) Position() *node.Position { @@ -36,9 +34,9 @@ func (n YieldFrom) Walk(v node.Visitor) { return } - if n.expr != nil { - vv := v.GetChildrenVisitor("expr") - n.expr.Walk(vv) + if n.Expr != nil { + vv := v.GetChildrenVisitor("Expr") + n.Expr.Walk(vv) } v.LeaveNode(n) diff --git a/node/identifier.go b/node/identifier.go index 969f765..6c29a21 100644 --- a/node/identifier.go +++ b/node/identifier.go @@ -1,34 +1,21 @@ package node -import ( - "github.com/z7zmey/php-parser/token" -) - type Identifier struct { - attributes map[string]interface{} - position *Position + position *Position + Value string } -func NewIdentifier(token token.Token) Node { +func NewIdentifier(Value string) Node { return &Identifier{ - map[string]interface{}{ - "Value": token.Value, - }, nil, + Value, } } func (n Identifier) Attributes() map[string]interface{} { - return n.attributes -} - -func (n Identifier) Attribute(Key string) interface{} { - return n.attributes[Key] -} - -func (n Identifier) SetAttribute(Key string, Value interface{}) Node { - n.attributes[Key] = Value - return n + return map[string]interface{}{ + "Value": n.Value, + } } func (n Identifier) Position() *Position { diff --git a/node/name/fully_qualified.go b/node/name/fully_qualified.go index 64d4de5..7d35734 100644 --- a/node/name/fully_qualified.go +++ b/node/name/fully_qualified.go @@ -11,13 +11,8 @@ type FullyQualified struct { func NewFullyQualified(Parts []node.Node) node.Node { return &FullyQualified{ Name{ - map[string]interface{}{}, nil, Parts, }, } } - -func (n FullyQualified) Attributes() map[string]interface{} { - return n.attributes -} diff --git a/node/name/name.go b/node/name/name.go index f214810..fd799e1 100644 --- a/node/name/name.go +++ b/node/name/name.go @@ -5,21 +5,19 @@ import ( ) type Name struct { - attributes map[string]interface{} - position *node.Position - Parts []node.Node + position *node.Position + Parts []node.Node } func NewName(Parts []node.Node) node.Node { return &Name{ - map[string]interface{}{}, nil, Parts, } } func (n Name) Attributes() map[string]interface{} { - return n.attributes + return nil } func (n Name) Position() *node.Position { diff --git a/node/name/name_part.go b/node/name/name_part.go index 9e5fc2e..a05b7e1 100644 --- a/node/name/name_part.go +++ b/node/name/name_part.go @@ -5,21 +5,21 @@ import ( ) type NamePart struct { - attributes map[string]interface{} - position *node.Position + position *node.Position + Value string } func NewNamePart(Value string) node.Node { return &NamePart{ - map[string]interface{}{ - "Value": Value, - }, nil, + Value, } } func (n NamePart) Attributes() map[string]interface{} { - return n.attributes + return map[string]interface{}{ + "Value": n.Value, + } } func (n NamePart) Position() *node.Position { diff --git a/node/name/relative.go b/node/name/relative.go index 3139aa5..38ce435 100644 --- a/node/name/relative.go +++ b/node/name/relative.go @@ -11,13 +11,8 @@ type Relative struct { func NewRelative(Parts []node.Node) node.Node { return &Relative{ Name{ - map[string]interface{}{}, nil, Parts, }, } } - -func (n Relative) Attributes() map[string]interface{} { - return n.attributes -} diff --git a/node/nullable.go b/node/nullable.go index 73b649e..d4e22ef 100644 --- a/node/nullable.go +++ b/node/nullable.go @@ -1,30 +1,19 @@ package node type Nullable struct { - attributes map[string]interface{} - position *Position - expr Node + position *Position + Expr Node } func NewNullable(Expression Node) Node { return &Nullable{ - map[string]interface{}{}, nil, Expression, } } func (n Nullable) Attributes() map[string]interface{} { - return n.attributes -} - -func (n Nullable) Attribute(Key string) interface{} { - return n.attributes[Key] -} - -func (n Nullable) SetAttribute(Key string, Value interface{}) Node { - n.attributes[Key] = Value - return n + return nil } func (n Nullable) Position() *Position { @@ -41,9 +30,9 @@ func (n Nullable) Walk(v Visitor) { return } - if n.expr != nil { - vv := v.GetChildrenVisitor("expr") - n.expr.Walk(vv) + if n.Expr != nil { + vv := v.GetChildrenVisitor("Expr") + n.Expr.Walk(vv) } v.LeaveNode(n) diff --git a/node/parameter.go b/node/parameter.go index 0908e68..66afe4c 100644 --- a/node/parameter.go +++ b/node/parameter.go @@ -1,20 +1,19 @@ package node type Parameter struct { - attributes map[string]interface{} position *Position + ByRef bool + Variadic bool VariableType Node Variable Node DefaultValue Node } -func NewParameter(VariableType Node, Variable Node, DefaultValue Node, byRef bool, variadic bool) Node { +func NewParameter(VariableType Node, Variable Node, DefaultValue Node, ByRef bool, Variadic bool) Node { return &Parameter{ - map[string]interface{}{ - "byRef": byRef, - "variadic": variadic, - }, nil, + ByRef, + Variadic, VariableType, Variable, DefaultValue, @@ -22,16 +21,10 @@ func NewParameter(VariableType Node, Variable Node, DefaultValue Node, byRef boo } func (n Parameter) Attributes() map[string]interface{} { - return n.attributes -} - -func (n Parameter) Attribute(Key string) interface{} { - return n.attributes[Key] -} - -func (n Parameter) SetAttribute(Key string, Value interface{}) Node { - n.attributes[Key] = Value - return n + return map[string]interface{}{ + "ByRef": n.ByRef, + "Variadic": n.Variadic, + } } func (n Parameter) Position() *Position { diff --git a/node/scalar/dnumber.go b/node/scalar/dnumber.go index f1c0182..d546e5e 100644 --- a/node/scalar/dnumber.go +++ b/node/scalar/dnumber.go @@ -5,21 +5,21 @@ import ( ) type Dnumber struct { - attributes map[string]interface{} - position *node.Position + position *node.Position + Value string } func NewDnumber(Value string) node.Node { return &Dnumber{ - map[string]interface{}{ - "Value": Value, - }, nil, + Value, } } func (n Dnumber) Attributes() map[string]interface{} { - return n.attributes + return map[string]interface{}{ + "Value": n.Value, + } } func (n Dnumber) Position() *node.Position { diff --git a/node/scalar/encapsed.go b/node/scalar/encapsed.go index 8408e7b..f6d0cef 100644 --- a/node/scalar/encapsed.go +++ b/node/scalar/encapsed.go @@ -5,21 +5,19 @@ import ( ) type Encapsed struct { - attributes map[string]interface{} - position *node.Position - Parts []node.Node + position *node.Position + Parts []node.Node } func NewEncapsed(Parts []node.Node) node.Node { return &Encapsed{ - map[string]interface{}{}, nil, Parts, } } func (n Encapsed) Attributes() map[string]interface{} { - return n.attributes + return nil } func (n Encapsed) Position() *node.Position { diff --git a/node/scalar/encapsed_string_part.go b/node/scalar/encapsed_string_part.go index 5079f6d..aad59b2 100644 --- a/node/scalar/encapsed_string_part.go +++ b/node/scalar/encapsed_string_part.go @@ -5,21 +5,21 @@ import ( ) type EncapsedStringPart struct { - attributes map[string]interface{} - position *node.Position + position *node.Position + Value string } func NewEncapsedStringPart(Value string) node.Node { return &EncapsedStringPart{ - map[string]interface{}{ - "Value": Value, - }, nil, + Value, } } func (n EncapsedStringPart) Attributes() map[string]interface{} { - return n.attributes + return map[string]interface{}{ + "Value": n.Value, + } } func (n EncapsedStringPart) Position() *node.Position { diff --git a/node/scalar/lnumber.go b/node/scalar/lnumber.go index 822420d..0d834f1 100644 --- a/node/scalar/lnumber.go +++ b/node/scalar/lnumber.go @@ -5,21 +5,21 @@ import ( ) type Lnumber struct { - attributes map[string]interface{} - position *node.Position + position *node.Position + Value string } func NewLnumber(Value string) node.Node { return &Lnumber{ - map[string]interface{}{ - "Value": Value, - }, nil, + Value, } } func (n Lnumber) Attributes() map[string]interface{} { - return n.attributes + return map[string]interface{}{ + "Value": n.Value, + } } func (n Lnumber) Position() *node.Position { diff --git a/node/scalar/magic_constant.go b/node/scalar/magic_constant.go index 37d7e3b..9e9d886 100644 --- a/node/scalar/magic_constant.go +++ b/node/scalar/magic_constant.go @@ -5,21 +5,21 @@ import ( ) type MagicConstant struct { - attributes map[string]interface{} - position *node.Position + position *node.Position + Value string } func NewMagicConstant(Value string) node.Node { return &MagicConstant{ - map[string]interface{}{ - "Value": Value, - }, nil, + Value, } } func (n MagicConstant) Attributes() map[string]interface{} { - return n.attributes + return map[string]interface{}{ + "Value": n.Value, + } } func (n MagicConstant) Position() *node.Position { diff --git a/node/scalar/string.go b/node/scalar/string.go index 647ea68..801727b 100644 --- a/node/scalar/string.go +++ b/node/scalar/string.go @@ -5,21 +5,21 @@ import ( ) type String struct { - attributes map[string]interface{} - position *node.Position + position *node.Position + Value string } func NewString(Value string) node.Node { return &String{ - map[string]interface{}{ - "Value": Value, - }, nil, + Value, } } func (n String) Attributes() map[string]interface{} { - return n.attributes + return map[string]interface{}{ + "Value": n.Value, + } } func (n String) Position() *node.Position { diff --git a/node/stmt/alt_else.go b/node/stmt/alt_else.go index 7a666ae..4c66ec8 100644 --- a/node/stmt/alt_else.go +++ b/node/stmt/alt_else.go @@ -5,21 +5,19 @@ import ( ) type AltElse struct { - attributes map[string]interface{} - position *node.Position - Stmt node.Node + position *node.Position + Stmt node.Node } func NewAltElse(Stmt node.Node) node.Node { return &AltElse{ - map[string]interface{}{}, nil, Stmt, } } func (n AltElse) Attributes() map[string]interface{} { - return n.attributes + return nil } func (n AltElse) Position() *node.Position { diff --git a/node/stmt/alt_else_if.go b/node/stmt/alt_else_if.go index 4a1c720..258abee 100644 --- a/node/stmt/alt_else_if.go +++ b/node/stmt/alt_else_if.go @@ -5,15 +5,13 @@ import ( ) type AltElseIf struct { - attributes map[string]interface{} - position *node.Position - Cond node.Node - Stmt node.Node + position *node.Position + Cond node.Node + Stmt node.Node } func NewAltElseIf(Cond node.Node, Stmt node.Node) node.Node { return &AltElseIf{ - map[string]interface{}{}, nil, Cond, Stmt, @@ -21,7 +19,7 @@ func NewAltElseIf(Cond node.Node, Stmt node.Node) node.Node { } func (n AltElseIf) Attributes() map[string]interface{} { - return n.attributes + return nil } func (n AltElseIf) Position() *node.Position { diff --git a/node/stmt/alt_if.go b/node/stmt/alt_if.go index 2c21282..4de0890 100644 --- a/node/stmt/alt_if.go +++ b/node/stmt/alt_if.go @@ -5,17 +5,15 @@ import ( ) type AltIf struct { - attributes map[string]interface{} - position *node.Position - Cond node.Node - Stmt node.Node - ElseIf []node.Node - _else node.Node + position *node.Position + Cond node.Node + Stmt node.Node + ElseIf []node.Node + _else node.Node } func NewAltIf(Cond node.Node, Stmt node.Node) node.Node { return &AltIf{ - map[string]interface{}{}, nil, Cond, Stmt, @@ -25,7 +23,7 @@ func NewAltIf(Cond node.Node, Stmt node.Node) node.Node { } func (n AltIf) Attributes() map[string]interface{} { - return n.attributes + return nil } func (n AltIf) Position() *node.Position { diff --git a/node/stmt/break.go b/node/stmt/break.go index bffa774..4189796 100644 --- a/node/stmt/break.go +++ b/node/stmt/break.go @@ -5,21 +5,19 @@ import ( ) type Break struct { - attributes map[string]interface{} - position *node.Position - expr node.Node + position *node.Position + Expr node.Node } -func NewBreak(expr node.Node) node.Node { +func NewBreak(Expr node.Node) node.Node { return &Break{ - map[string]interface{}{}, nil, - expr, + Expr, } } func (n Break) Attributes() map[string]interface{} { - return n.attributes + return nil } func (n Break) Position() *node.Position { @@ -36,9 +34,9 @@ func (n Break) Walk(v node.Visitor) { return } - if n.expr != nil { - vv := v.GetChildrenVisitor("expr") - n.expr.Walk(vv) + if n.Expr != nil { + vv := v.GetChildrenVisitor("Expr") + n.Expr.Walk(vv) } v.LeaveNode(n) diff --git a/node/stmt/case.go b/node/stmt/case.go index 39ae950..e55af64 100644 --- a/node/stmt/case.go +++ b/node/stmt/case.go @@ -5,15 +5,13 @@ import ( ) type Case struct { - attributes map[string]interface{} - position *node.Position - Cond node.Node - Stmts []node.Node + position *node.Position + Cond node.Node + Stmts []node.Node } func NewCase(Cond node.Node, Stmts []node.Node) node.Node { return &Case{ - map[string]interface{}{}, nil, Cond, Stmts, @@ -21,7 +19,7 @@ func NewCase(Cond node.Node, Stmts []node.Node) node.Node { } func (n Case) Attributes() map[string]interface{} { - return n.attributes + return nil } func (n Case) Position() *node.Position { diff --git a/node/stmt/catch.go b/node/stmt/catch.go index 28ade5c..103ecc5 100644 --- a/node/stmt/catch.go +++ b/node/stmt/catch.go @@ -5,16 +5,14 @@ import ( ) type Catch struct { - attributes map[string]interface{} - position *node.Position - Types []node.Node - Variable node.Node - Stmts []node.Node + position *node.Position + Types []node.Node + Variable node.Node + Stmts []node.Node } func NewCatch(Types []node.Node, Variable node.Node, Stmts []node.Node) node.Node { return &Catch{ - map[string]interface{}{}, nil, Types, Variable, @@ -23,7 +21,7 @@ func NewCatch(Types []node.Node, Variable node.Node, Stmts []node.Node) node.Nod } func (n Catch) Attributes() map[string]interface{} { - return n.attributes + return nil } func (n Catch) Position() *node.Position { diff --git a/node/stmt/class.go b/node/stmt/class.go index 851936c..91bc13c 100644 --- a/node/stmt/class.go +++ b/node/stmt/class.go @@ -5,22 +5,20 @@ import ( ) type Class struct { - attributes map[string]interface{} - position *node.Position - ClassName node.Node - Modifiers []node.Node - args []node.Node - Extends node.Node - Implements []node.Node - Stmts []node.Node + position *node.Position + PhpDocComment string + ClassName node.Node + Modifiers []node.Node + args []node.Node + Extends node.Node + Implements []node.Node + Stmts []node.Node } -func NewClass(ClassName node.Node, Modifiers []node.Node, args []node.Node, Extends node.Node, Implements []node.Node, Stmts []node.Node, phpDocComment string) node.Node { +func NewClass(ClassName node.Node, Modifiers []node.Node, args []node.Node, Extends node.Node, Implements []node.Node, Stmts []node.Node, PhpDocComment string) node.Node { return &Class{ - map[string]interface{}{ - "phpDocComment": phpDocComment, - }, nil, + PhpDocComment, ClassName, Modifiers, args, @@ -31,7 +29,9 @@ func NewClass(ClassName node.Node, Modifiers []node.Node, args []node.Node, Exte } func (n Class) Attributes() map[string]interface{} { - return n.attributes + return map[string]interface{}{ + "PhpDocComment": n.PhpDocComment, + } } func (n Class) Position() *node.Position { diff --git a/node/stmt/class_const_list.go b/node/stmt/class_const_list.go index f4a0afd..cf60270 100644 --- a/node/stmt/class_const_list.go +++ b/node/stmt/class_const_list.go @@ -5,15 +5,13 @@ import ( ) type ClassConstList struct { - attributes map[string]interface{} - position *node.Position - Modifiers []node.Node - Consts []node.Node + position *node.Position + Modifiers []node.Node + Consts []node.Node } func NewClassConstList(Modifiers []node.Node, Consts []node.Node) node.Node { return &ClassConstList{ - map[string]interface{}{}, nil, Modifiers, Consts, @@ -21,7 +19,7 @@ func NewClassConstList(Modifiers []node.Node, Consts []node.Node) node.Node { } func (n ClassConstList) Attributes() map[string]interface{} { - return n.attributes + return nil } func (n ClassConstList) Position() *node.Position { diff --git a/node/stmt/class_method.go b/node/stmt/class_method.go index 6ca3b07..dc2a779 100644 --- a/node/stmt/class_method.go +++ b/node/stmt/class_method.go @@ -5,22 +5,21 @@ import ( ) type ClassMethod struct { - attributes map[string]interface{} - position *node.Position - MethodName node.Node - Modifiers []node.Node - Params []node.Node - ReturnType node.Node - Stmts []node.Node + position *node.Position + ReturnsRef bool + PhpDocComment string + MethodName node.Node + Modifiers []node.Node + Params []node.Node + ReturnType node.Node + Stmts []node.Node } -func NewClassMethod(MethodName node.Node, Modifiers []node.Node, returnsRef bool, Params []node.Node, ReturnType node.Node, Stmts []node.Node, phpDocComment string) node.Node { +func NewClassMethod(MethodName node.Node, Modifiers []node.Node, ReturnsRef bool, Params []node.Node, ReturnType node.Node, Stmts []node.Node, PhpDocComment string) node.Node { return &ClassMethod{ - map[string]interface{}{ - "returnsRef": returnsRef, - "phpDocComment": phpDocComment, - }, nil, + ReturnsRef, + PhpDocComment, MethodName, Modifiers, Params, @@ -30,7 +29,10 @@ func NewClassMethod(MethodName node.Node, Modifiers []node.Node, returnsRef bool } func (n ClassMethod) Attributes() map[string]interface{} { - return n.attributes + return map[string]interface{}{ + "ReturnsRef": n.ReturnsRef, + "PhpDocComment": n.PhpDocComment, + } } func (n ClassMethod) Position() *node.Position { diff --git a/node/stmt/const_list.go b/node/stmt/const_list.go index 7fbba26..8bf75bb 100644 --- a/node/stmt/const_list.go +++ b/node/stmt/const_list.go @@ -5,21 +5,19 @@ import ( ) type ConstList struct { - attributes map[string]interface{} - position *node.Position - Consts []node.Node + position *node.Position + Consts []node.Node } func NewConstList(Consts []node.Node) node.Node { return &ConstList{ - map[string]interface{}{}, nil, Consts, } } func (n ConstList) Attributes() map[string]interface{} { - return n.attributes + return nil } func (n ConstList) Position() *node.Position { diff --git a/node/stmt/constant.go b/node/stmt/constant.go index 31a765e..d7c7a22 100644 --- a/node/stmt/constant.go +++ b/node/stmt/constant.go @@ -5,25 +5,25 @@ import ( ) type Constant struct { - attributes map[string]interface{} - position *node.Position - ConstantName node.Node - expr node.Node + position *node.Position + PhpDocComment string + ConstantName node.Node + Expr node.Node } -func NewConstant(ConstantName node.Node, expr node.Node, phpDocComment string) node.Node { +func NewConstant(ConstantName node.Node, Expr node.Node, PhpDocComment string) node.Node { return &Constant{ - map[string]interface{}{ - "phpDocComment": phpDocComment, - }, nil, + PhpDocComment, ConstantName, - expr, + Expr, } } func (n Constant) Attributes() map[string]interface{} { - return n.attributes + return map[string]interface{}{ + "PhpDocComment": n.PhpDocComment, + } } func (n Constant) Position() *node.Position { @@ -45,9 +45,9 @@ func (n Constant) Walk(v node.Visitor) { n.ConstantName.Walk(vv) } - if n.expr != nil { - vv := v.GetChildrenVisitor("expr") - n.expr.Walk(vv) + if n.Expr != nil { + vv := v.GetChildrenVisitor("Expr") + n.Expr.Walk(vv) } v.LeaveNode(n) diff --git a/node/stmt/continue.go b/node/stmt/continue.go index d3df806..8e4482a 100644 --- a/node/stmt/continue.go +++ b/node/stmt/continue.go @@ -5,21 +5,19 @@ import ( ) type Continue struct { - attributes map[string]interface{} - position *node.Position - expr node.Node + position *node.Position + Expr node.Node } -func NewContinue(expr node.Node) node.Node { +func NewContinue(Expr node.Node) node.Node { return &Continue{ - map[string]interface{}{}, nil, - expr, + Expr, } } func (n Continue) Attributes() map[string]interface{} { - return n.attributes + return nil } func (n Continue) Position() *node.Position { @@ -36,9 +34,9 @@ func (n Continue) Walk(v node.Visitor) { return } - if n.expr != nil { - vv := v.GetChildrenVisitor("expr") - n.expr.Walk(vv) + if n.Expr != nil { + vv := v.GetChildrenVisitor("Expr") + n.Expr.Walk(vv) } v.LeaveNode(n) diff --git a/node/stmt/declare.go b/node/stmt/declare.go index 28da683..2316e5f 100644 --- a/node/stmt/declare.go +++ b/node/stmt/declare.go @@ -5,15 +5,13 @@ import ( ) type Declare struct { - attributes map[string]interface{} - position *node.Position - Consts []node.Node - Stmt node.Node + position *node.Position + Consts []node.Node + Stmt node.Node } func NewDeclare(Consts []node.Node, Stmt node.Node) node.Node { return &Declare{ - map[string]interface{}{}, nil, Consts, Stmt, @@ -21,7 +19,7 @@ func NewDeclare(Consts []node.Node, Stmt node.Node) node.Node { } func (n Declare) Attributes() map[string]interface{} { - return n.attributes + return nil } func (n Declare) Position() *node.Position { diff --git a/node/stmt/default.go b/node/stmt/default.go index 896807d..322b397 100644 --- a/node/stmt/default.go +++ b/node/stmt/default.go @@ -5,21 +5,19 @@ import ( ) type Default struct { - attributes map[string]interface{} - position *node.Position - Stmts []node.Node + position *node.Position + Stmts []node.Node } func NewDefault(Stmts []node.Node) node.Node { return &Default{ - map[string]interface{}{}, nil, Stmts, } } func (n Default) Attributes() map[string]interface{} { - return n.attributes + return nil } func (n Default) Position() *node.Position { diff --git a/node/stmt/do.go b/node/stmt/do.go index 3af66a5..8453d8d 100644 --- a/node/stmt/do.go +++ b/node/stmt/do.go @@ -5,15 +5,13 @@ import ( ) type Do struct { - attributes map[string]interface{} - position *node.Position - Stmt node.Node - Cond node.Node + position *node.Position + Stmt node.Node + Cond node.Node } func NewDo(Stmt node.Node, Cond node.Node) node.Node { return &Do{ - map[string]interface{}{}, nil, Stmt, Cond, @@ -21,7 +19,7 @@ func NewDo(Stmt node.Node, Cond node.Node) node.Node { } func (n Do) Attributes() map[string]interface{} { - return n.attributes + return nil } func (n Do) Position() *node.Position { diff --git a/node/stmt/echo.go b/node/stmt/echo.go index 79fb0ac..698cbe2 100644 --- a/node/stmt/echo.go +++ b/node/stmt/echo.go @@ -5,21 +5,19 @@ import ( ) type Echo struct { - attributes map[string]interface{} - position *node.Position - Exprs []node.Node + position *node.Position + Exprs []node.Node } func NewEcho(Exprs []node.Node) node.Node { return &Echo{ - map[string]interface{}{}, nil, Exprs, } } func (n Echo) Attributes() map[string]interface{} { - return n.attributes + return nil } func (n Echo) Position() *node.Position { diff --git a/node/stmt/else.go b/node/stmt/else.go index 9c43b25..3524c7e 100644 --- a/node/stmt/else.go +++ b/node/stmt/else.go @@ -5,21 +5,19 @@ import ( ) type Else struct { - attributes map[string]interface{} - position *node.Position - Stmt node.Node + position *node.Position + Stmt node.Node } func NewElse(Stmt node.Node) node.Node { return &Else{ - map[string]interface{}{}, nil, Stmt, } } func (n Else) Attributes() map[string]interface{} { - return n.attributes + return nil } func (n Else) Position() *node.Position { diff --git a/node/stmt/else_if.go b/node/stmt/else_if.go index 9b214ca..709e6cb 100644 --- a/node/stmt/else_if.go +++ b/node/stmt/else_if.go @@ -5,15 +5,13 @@ import ( ) type ElseIf struct { - attributes map[string]interface{} - position *node.Position - Cond node.Node - Stmt node.Node + position *node.Position + Cond node.Node + Stmt node.Node } func NewElseIf(Cond node.Node, Stmt node.Node) node.Node { return &ElseIf{ - map[string]interface{}{}, nil, Cond, Stmt, @@ -21,7 +19,7 @@ func NewElseIf(Cond node.Node, Stmt node.Node) node.Node { } func (n ElseIf) Attributes() map[string]interface{} { - return n.attributes + return nil } func (n ElseIf) Position() *node.Position { diff --git a/node/stmt/expression.go b/node/stmt/expression.go index 506ee22..afcd587 100644 --- a/node/stmt/expression.go +++ b/node/stmt/expression.go @@ -7,14 +7,14 @@ import ( type Expression struct { attributes map[string]interface{} position *node.Position - expr node.Node + Expr node.Node } -func NewExpression(expr node.Node) node.Node { +func NewExpression(Expr node.Node) node.Node { return &Expression{ map[string]interface{}{}, nil, - expr, + Expr, } } @@ -36,9 +36,9 @@ func (n Expression) Walk(v node.Visitor) { return } - if n.expr != nil { - vv := v.GetChildrenVisitor("expr") - n.expr.Walk(vv) + if n.Expr != nil { + vv := v.GetChildrenVisitor("Expr") + n.Expr.Walk(vv) } v.LeaveNode(n) diff --git a/node/stmt/finally.go b/node/stmt/finally.go index 2f54324..2dfae03 100644 --- a/node/stmt/finally.go +++ b/node/stmt/finally.go @@ -5,21 +5,19 @@ import ( ) type Finally struct { - attributes map[string]interface{} - position *node.Position - Stmts []node.Node + position *node.Position + Stmts []node.Node } func NewFinally(Stmts []node.Node) node.Node { return &Finally{ - map[string]interface{}{}, nil, Stmts, } } func (n Finally) Attributes() map[string]interface{} { - return n.attributes + return nil } func (n Finally) Position() *node.Position { diff --git a/node/stmt/for.go b/node/stmt/for.go index 388691e..2d4562a 100644 --- a/node/stmt/for.go +++ b/node/stmt/for.go @@ -5,17 +5,15 @@ import ( ) type For struct { - attributes map[string]interface{} - position *node.Position - Init []node.Node - Cond []node.Node - Loop []node.Node - Stmt node.Node + position *node.Position + Init []node.Node + Cond []node.Node + Loop []node.Node + Stmt node.Node } func NewFor(Init []node.Node, Cond []node.Node, Loop []node.Node, Stmt node.Node) node.Node { return &For{ - map[string]interface{}{}, nil, Init, Cond, @@ -25,7 +23,7 @@ func NewFor(Init []node.Node, Cond []node.Node, Loop []node.Node, Stmt node.Node } func (n For) Attributes() map[string]interface{} { - return n.attributes + return nil } func (n For) Position() *node.Position { diff --git a/node/stmt/foreach.go b/node/stmt/foreach.go index 1859cd9..c88c04a 100644 --- a/node/stmt/foreach.go +++ b/node/stmt/foreach.go @@ -5,21 +5,19 @@ import ( ) type Foreach struct { - attributes map[string]interface{} - position *node.Position - expr node.Node - Key node.Node - Variable node.Node - Stmt node.Node + position *node.Position + ByRef bool + Expr node.Node + Key node.Node + Variable node.Node + Stmt node.Node } -func NewForeach(expr node.Node, Key node.Node, Variable node.Node, Stmt node.Node, byRef bool) node.Node { +func NewForeach(Expr node.Node, Key node.Node, Variable node.Node, Stmt node.Node, ByRef bool) node.Node { return &Foreach{ - map[string]interface{}{ - "byRef": byRef, - }, nil, - expr, + ByRef, + Expr, Key, Variable, Stmt, @@ -27,7 +25,9 @@ func NewForeach(expr node.Node, Key node.Node, Variable node.Node, Stmt node.Nod } func (n Foreach) Attributes() map[string]interface{} { - return n.attributes + return map[string]interface{}{ + "ByRef": n.ByRef, + } } func (n Foreach) Position() *node.Position { @@ -44,9 +44,9 @@ func (n Foreach) Walk(v node.Visitor) { return } - if n.expr != nil { - vv := v.GetChildrenVisitor("expr") - n.expr.Walk(vv) + if n.Expr != nil { + vv := v.GetChildrenVisitor("Expr") + n.Expr.Walk(vv) } if n.Key != nil { diff --git a/node/stmt/function.go b/node/stmt/function.go index 15dfd3f..eac5da0 100644 --- a/node/stmt/function.go +++ b/node/stmt/function.go @@ -5,7 +5,6 @@ import ( ) type Function struct { - attributes map[string]interface{} position *node.Position ReturnsRef bool PhpDocComment string @@ -17,10 +16,6 @@ type Function struct { func NewFunction(FunctionName node.Node, ReturnsRef bool, Params []node.Node, ReturnType node.Node, Stmts []node.Node, PhpDocComment string) node.Node { return &Function{ - map[string]interface{}{ - "ReturnsRef": ReturnsRef, - "PhpDocComment": PhpDocComment, - }, nil, ReturnsRef, PhpDocComment, diff --git a/node/stmt/global.go b/node/stmt/global.go index 067f3d9..57a2500 100644 --- a/node/stmt/global.go +++ b/node/stmt/global.go @@ -5,21 +5,19 @@ import ( ) type Global struct { - attributes map[string]interface{} - position *node.Position - Vars []node.Node + position *node.Position + Vars []node.Node } func NewGlobal(Vars []node.Node) node.Node { return &Global{ - map[string]interface{}{}, nil, Vars, } } func (n Global) Attributes() map[string]interface{} { - return n.attributes + return nil } func (n Global) Position() *node.Position { diff --git a/node/stmt/goto.go b/node/stmt/goto.go index cf68bb5..1fcd9dc 100644 --- a/node/stmt/goto.go +++ b/node/stmt/goto.go @@ -5,21 +5,19 @@ import ( ) type Goto struct { - attributes map[string]interface{} - position *node.Position - Label node.Node + position *node.Position + Label node.Node } func NewGoto(Label node.Node) node.Node { return &Goto{ - map[string]interface{}{}, nil, Label, } } func (n Goto) Attributes() map[string]interface{} { - return n.attributes + return nil } func (n Goto) Position() *node.Position { diff --git a/node/stmt/group_use.go b/node/stmt/group_use.go index ab2dc07..2f52317 100644 --- a/node/stmt/group_use.go +++ b/node/stmt/group_use.go @@ -5,16 +5,14 @@ import ( ) type GroupUse struct { - attributes map[string]interface{} - position *node.Position - UseType node.Node - pRefix node.Node - UseList []node.Node + position *node.Position + UseType node.Node + pRefix node.Node + UseList []node.Node } func NewGroupUse(UseType node.Node, pRefix node.Node, UseList []node.Node) node.Node { return &GroupUse{ - map[string]interface{}{}, nil, UseType, pRefix, @@ -23,7 +21,7 @@ func NewGroupUse(UseType node.Node, pRefix node.Node, UseList []node.Node) node. } func (n GroupUse) Attributes() map[string]interface{} { - return n.attributes + return nil } func (n GroupUse) Position() *node.Position { diff --git a/node/stmt/halt_compiler.go b/node/stmt/halt_compiler.go index 92e2189..dd4ab31 100644 --- a/node/stmt/halt_compiler.go +++ b/node/stmt/halt_compiler.go @@ -5,19 +5,17 @@ import ( ) type HaltCompiler struct { - attributes map[string]interface{} - position *node.Position + position *node.Position } func NewHaltCompiler() node.Node { return &HaltCompiler{ - map[string]interface{}{}, nil, } } func (n HaltCompiler) Attributes() map[string]interface{} { - return n.attributes + return nil } func (n HaltCompiler) Position() *node.Position { diff --git a/node/stmt/if.go b/node/stmt/if.go index 854cc3a..b98d019 100644 --- a/node/stmt/if.go +++ b/node/stmt/if.go @@ -5,17 +5,15 @@ import ( ) type If struct { - attributes map[string]interface{} - position *node.Position - Cond node.Node - Stmt node.Node - ElseIf []node.Node - _else node.Node + position *node.Position + Cond node.Node + Stmt node.Node + ElseIf []node.Node + _else node.Node } func NewIf(Cond node.Node, Stmt node.Node) node.Node { return &If{ - map[string]interface{}{}, nil, Cond, Stmt, @@ -25,7 +23,7 @@ func NewIf(Cond node.Node, Stmt node.Node) node.Node { } func (n If) Attributes() map[string]interface{} { - return n.attributes + return nil } func (n If) Position() *node.Position { diff --git a/node/stmt/inline_html.go b/node/stmt/inline_html.go index 468166d..3da6ae3 100644 --- a/node/stmt/inline_html.go +++ b/node/stmt/inline_html.go @@ -5,21 +5,21 @@ import ( ) type InlineHtml struct { - attributes map[string]interface{} - position *node.Position + position *node.Position + Value string } func NewInlineHtml(Value string) node.Node { return &InlineHtml{ - map[string]interface{}{ - "Value": Value, - }, nil, + Value, } } func (n InlineHtml) Attributes() map[string]interface{} { - return n.attributes + return map[string]interface{}{ + "Value": n.Value, + } } func (n InlineHtml) Position() *node.Position { diff --git a/node/stmt/interface.go b/node/stmt/interface.go index 453940b..f6b325d 100644 --- a/node/stmt/interface.go +++ b/node/stmt/interface.go @@ -5,19 +5,17 @@ import ( ) type Interface struct { - attributes map[string]interface{} position *node.Position + PhpDocComment string InterfaceName node.Node Extends []node.Node Stmts []node.Node } -func NewInterface(InterfaceName node.Node, Extends []node.Node, Stmts []node.Node, phpDocComment string) node.Node { +func NewInterface(InterfaceName node.Node, Extends []node.Node, Stmts []node.Node, PhpDocComment string) node.Node { return &Interface{ - map[string]interface{}{ - "phpDocComment": phpDocComment, - }, nil, + PhpDocComment, InterfaceName, Extends, Stmts, @@ -25,7 +23,9 @@ func NewInterface(InterfaceName node.Node, Extends []node.Node, Stmts []node.Nod } func (n Interface) Attributes() map[string]interface{} { - return n.attributes + return map[string]interface{}{ + "PhpDocComment": n.PhpDocComment, + } } func (n Interface) Position() *node.Position { diff --git a/node/stmt/label.go b/node/stmt/label.go index 85ac0b3..3f7ceaa 100644 --- a/node/stmt/label.go +++ b/node/stmt/label.go @@ -5,21 +5,19 @@ import ( ) type Label struct { - attributes map[string]interface{} - position *node.Position - LabelName node.Node + position *node.Position + LabelName node.Node } func NewLabel(LabelName node.Node) node.Node { return &Label{ - map[string]interface{}{}, nil, LabelName, } } func (n Label) Attributes() map[string]interface{} { - return n.attributes + return nil } func (n Label) Position() *node.Position { diff --git a/node/stmt/namespace.go b/node/stmt/namespace.go index c5183f0..78433c2 100644 --- a/node/stmt/namespace.go +++ b/node/stmt/namespace.go @@ -5,7 +5,6 @@ import ( ) type Namespace struct { - attributes map[string]interface{} position *node.Position NamespaceName node.Node Stmts []node.Node @@ -13,7 +12,6 @@ type Namespace struct { func NewNamespace(NamespaceName node.Node, Stmts []node.Node) node.Node { return &Namespace{ - map[string]interface{}{}, nil, NamespaceName, Stmts, @@ -21,7 +19,7 @@ func NewNamespace(NamespaceName node.Node, Stmts []node.Node) node.Node { } func (n Namespace) Attributes() map[string]interface{} { - return n.attributes + return nil } func (n Namespace) Position() *node.Position { diff --git a/node/stmt/nop.go b/node/stmt/nop.go index 62a0ac8..8ba7f3f 100644 --- a/node/stmt/nop.go +++ b/node/stmt/nop.go @@ -5,19 +5,17 @@ import ( ) type Nop struct { - attributes map[string]interface{} - position *node.Position + position *node.Position } func NewNop() node.Node { return &Nop{ - map[string]interface{}{}, nil, } } func (n Nop) Attributes() map[string]interface{} { - return n.attributes + return nil } func (n Nop) Position() *node.Position { diff --git a/node/stmt/property.go b/node/stmt/property.go index 83772ab..428791d 100644 --- a/node/stmt/property.go +++ b/node/stmt/property.go @@ -5,24 +5,24 @@ import ( ) type Property struct { - attributes map[string]interface{} - position *node.Position - Variable node.Node - expr node.Node + position *node.Position + PhpDocComment string + Variable node.Node + Expr node.Node } -func NewProperty(Variable node.Node, expr node.Node, phpDocComment string) node.Node { +func NewProperty(Variable node.Node, Expr node.Node, PhpDocComment string) node.Node { return &Property{ - map[string]interface{}{ - "phpDocComment": phpDocComment, - }, nil, + PhpDocComment, Variable, - expr, + Expr, } } func (n Property) Attributes() map[string]interface{} { - return n.attributes + return map[string]interface{}{ + "PhpDocComment": n.PhpDocComment, + } } func (n Property) Position() *node.Position { @@ -44,9 +44,9 @@ func (n Property) Walk(v node.Visitor) { n.Variable.Walk(vv) } - if n.expr != nil { - vv := v.GetChildrenVisitor("expr") - n.expr.Walk(vv) + if n.Expr != nil { + vv := v.GetChildrenVisitor("Expr") + n.Expr.Walk(vv) } v.LeaveNode(n) diff --git a/node/stmt/property_list.go b/node/stmt/property_list.go index e290ba1..257cd36 100644 --- a/node/stmt/property_list.go +++ b/node/stmt/property_list.go @@ -5,7 +5,6 @@ import ( ) type PropertyList struct { - attributes map[string]interface{} position *node.Position Modifiers []node.Node Properties []node.Node @@ -13,7 +12,6 @@ type PropertyList struct { func NewPropertyList(Modifiers []node.Node, Properties []node.Node) node.Node { return &PropertyList{ - map[string]interface{}{}, nil, Modifiers, Properties, @@ -21,7 +19,7 @@ func NewPropertyList(Modifiers []node.Node, Properties []node.Node) node.Node { } func (n PropertyList) Attributes() map[string]interface{} { - return n.attributes + return nil } func (n PropertyList) Position() *node.Position { diff --git a/node/stmt/return.go b/node/stmt/return.go index 01c8240..e76548f 100644 --- a/node/stmt/return.go +++ b/node/stmt/return.go @@ -5,21 +5,19 @@ import ( ) type Return struct { - attributes map[string]interface{} - position *node.Position - expr node.Node + position *node.Position + Expr node.Node } -func NewReturn(expr node.Node) node.Node { +func NewReturn(Expr node.Node) node.Node { return &Return{ - map[string]interface{}{}, nil, - expr, + Expr, } } func (n Return) Attributes() map[string]interface{} { - return n.attributes + return nil } func (n Return) Position() *node.Position { @@ -36,9 +34,9 @@ func (n Return) Walk(v node.Visitor) { return } - if n.expr != nil { - vv := v.GetChildrenVisitor("expr") - n.expr.Walk(vv) + if n.Expr != nil { + vv := v.GetChildrenVisitor("Expr") + n.Expr.Walk(vv) } v.LeaveNode(n) diff --git a/node/stmt/static.go b/node/stmt/static.go index cd18982..6529faf 100644 --- a/node/stmt/static.go +++ b/node/stmt/static.go @@ -5,21 +5,19 @@ import ( ) type Static struct { - attributes map[string]interface{} - position *node.Position - Vars []node.Node + position *node.Position + Vars []node.Node } func NewStatic(Vars []node.Node) node.Node { return &Static{ - map[string]interface{}{}, nil, Vars, } } func (n Static) Attributes() map[string]interface{} { - return n.attributes + return nil } func (n Static) Position() *node.Position { diff --git a/node/stmt/static_var.go b/node/stmt/static_var.go index 06ddf45..2ccb38f 100644 --- a/node/stmt/static_var.go +++ b/node/stmt/static_var.go @@ -5,23 +5,21 @@ import ( ) type StaticVar struct { - attributes map[string]interface{} - position *node.Position - Variable node.Node - expr node.Node + position *node.Position + Variable node.Node + Expr node.Node } -func NewStaticVar(Variable node.Node, expr node.Node) node.Node { +func NewStaticVar(Variable node.Node, Expr node.Node) node.Node { return &StaticVar{ - map[string]interface{}{}, nil, Variable, - expr, + Expr, } } func (n StaticVar) Attributes() map[string]interface{} { - return n.attributes + return nil } func (n StaticVar) Position() *node.Position { @@ -43,9 +41,9 @@ func (n StaticVar) Walk(v node.Visitor) { n.Variable.Walk(vv) } - if n.expr != nil { - vv := v.GetChildrenVisitor("expr") - n.expr.Walk(vv) + if n.Expr != nil { + vv := v.GetChildrenVisitor("Expr") + n.Expr.Walk(vv) } v.LeaveNode(n) diff --git a/node/stmt/stmt_list.go b/node/stmt/stmt_list.go index 65e852f..2285f3f 100644 --- a/node/stmt/stmt_list.go +++ b/node/stmt/stmt_list.go @@ -5,21 +5,19 @@ import ( ) type StmtList struct { - attributes map[string]interface{} - position *node.Position - Stmts []node.Node + position *node.Position + Stmts []node.Node } func NewStmtList(Stmts []node.Node) node.Node { return StmtList{ - map[string]interface{}{}, nil, Stmts, } } func (n StmtList) Attributes() map[string]interface{} { - return n.attributes + return nil } func (n StmtList) Position() *node.Position { diff --git a/node/stmt/switch.go b/node/stmt/switch.go index f65e133..c30c8e0 100644 --- a/node/stmt/switch.go +++ b/node/stmt/switch.go @@ -6,16 +6,14 @@ import ( ) type Switch struct { - attributes map[string]interface{} - position *node.Position - token token.Token - Cond node.Node - cases []node.Node + position *node.Position + token token.Token + Cond node.Node + cases []node.Node } func NewSwitch(token token.Token, Cond node.Node, cases []node.Node) node.Node { return &Switch{ - map[string]interface{}{}, nil, token, Cond, @@ -24,7 +22,7 @@ func NewSwitch(token token.Token, Cond node.Node, cases []node.Node) node.Node { } func (n Switch) Attributes() map[string]interface{} { - return n.attributes + return nil } func (n Switch) Position() *node.Position { diff --git a/node/stmt/throw.go b/node/stmt/throw.go index 92162a7..7e5162f 100644 --- a/node/stmt/throw.go +++ b/node/stmt/throw.go @@ -5,21 +5,19 @@ import ( ) type Throw struct { - attributes map[string]interface{} - position *node.Position - expr node.Node + position *node.Position + Expr node.Node } -func NewThrow(expr node.Node) node.Node { +func NewThrow(Expr node.Node) node.Node { return &Throw{ - map[string]interface{}{}, nil, - expr, + Expr, } } func (n Throw) Attributes() map[string]interface{} { - return n.attributes + return nil } func (n Throw) Position() *node.Position { @@ -36,9 +34,9 @@ func (n Throw) Walk(v node.Visitor) { return } - if n.expr != nil { - vv := v.GetChildrenVisitor("expr") - n.expr.Walk(vv) + if n.Expr != nil { + vv := v.GetChildrenVisitor("Expr") + n.Expr.Walk(vv) } v.LeaveNode(n) diff --git a/node/stmt/trait.go b/node/stmt/trait.go index 5711c34..0b51e09 100644 --- a/node/stmt/trait.go +++ b/node/stmt/trait.go @@ -5,25 +5,25 @@ import ( ) type Trait struct { - attributes map[string]interface{} - position *node.Position - TraitName node.Node - Stmts []node.Node + position *node.Position + PhpDocComment string + TraitName node.Node + Stmts []node.Node } -func NewTrait(TraitName node.Node, Stmts []node.Node, phpDocComment string) node.Node { +func NewTrait(TraitName node.Node, Stmts []node.Node, PhpDocComment string) node.Node { return &Trait{ - map[string]interface{}{ - "phpDocComment": phpDocComment, - }, nil, + PhpDocComment, TraitName, Stmts, } } func (n Trait) Attributes() map[string]interface{} { - return n.attributes + return map[string]interface{}{ + "PhpDocComment": n.PhpDocComment, + } } func (n Trait) Position() *node.Position { diff --git a/node/stmt/trait_method_ref.go b/node/stmt/trait_method_ref.go index 48760e0..41510e6 100644 --- a/node/stmt/trait_method_ref.go +++ b/node/stmt/trait_method_ref.go @@ -5,15 +5,13 @@ import ( ) type TraitMethodRef struct { - attributes map[string]interface{} - position *node.Position - Trait node.Node - Method node.Node + position *node.Position + Trait node.Node + Method node.Node } func NewTraitMethodRef(Trait node.Node, Method node.Node) node.Node { return &TraitMethodRef{ - map[string]interface{}{}, nil, Trait, Method, @@ -21,7 +19,7 @@ func NewTraitMethodRef(Trait node.Node, Method node.Node) node.Node { } func (n TraitMethodRef) Attributes() map[string]interface{} { - return n.attributes + return nil } func (n TraitMethodRef) Position() *node.Position { diff --git a/node/stmt/trait_use.go b/node/stmt/trait_use.go index 91154eb..492a300 100644 --- a/node/stmt/trait_use.go +++ b/node/stmt/trait_use.go @@ -5,7 +5,6 @@ import ( ) type TraitUse struct { - attributes map[string]interface{} position *node.Position Traits []node.Node Adaptations []node.Node @@ -13,7 +12,6 @@ type TraitUse struct { func NewTraitUse(Traits []node.Node, Adaptations []node.Node) node.Node { return &TraitUse{ - map[string]interface{}{}, nil, Traits, Adaptations, @@ -21,7 +19,7 @@ func NewTraitUse(Traits []node.Node, Adaptations []node.Node) node.Node { } func (n TraitUse) Attributes() map[string]interface{} { - return n.attributes + return nil } func (n TraitUse) Position() *node.Position { diff --git a/node/stmt/trait_use_alias.go b/node/stmt/trait_use_alias.go index a583d4c..75d1b05 100644 --- a/node/stmt/trait_use_alias.go +++ b/node/stmt/trait_use_alias.go @@ -5,16 +5,14 @@ import ( ) type TraitUseAlias struct { - attributes map[string]interface{} - position *node.Position - Ref node.Node - Modifier node.Node - Alias node.Node + position *node.Position + Ref node.Node + Modifier node.Node + Alias node.Node } func NewTraitUseAlias(Ref node.Node, Modifier node.Node, Alias node.Node) node.Node { return &TraitUseAlias{ - map[string]interface{}{}, nil, Ref, Modifier, @@ -23,7 +21,7 @@ func NewTraitUseAlias(Ref node.Node, Modifier node.Node, Alias node.Node) node.N } func (n TraitUseAlias) Attributes() map[string]interface{} { - return n.attributes + return nil } func (n TraitUseAlias) Position() *node.Position { diff --git a/node/stmt/trait_use_precedence.go b/node/stmt/trait_use_precedence.go index 4186880..755900a 100644 --- a/node/stmt/trait_use_precedence.go +++ b/node/stmt/trait_use_precedence.go @@ -5,15 +5,13 @@ import ( ) type TraitUsePrecedence struct { - attributes map[string]interface{} - position *node.Position - Ref node.Node - Insteadof node.Node + position *node.Position + Ref node.Node + Insteadof node.Node } func NewTraitUsePrecedence(Ref node.Node, Insteadof node.Node) node.Node { return &TraitUsePrecedence{ - map[string]interface{}{}, nil, Ref, Insteadof, @@ -21,7 +19,7 @@ func NewTraitUsePrecedence(Ref node.Node, Insteadof node.Node) node.Node { } func (n TraitUsePrecedence) Attributes() map[string]interface{} { - return n.attributes + return nil } func (n TraitUsePrecedence) Position() *node.Position { diff --git a/node/stmt/try.go b/node/stmt/try.go index 90d0169..a0c4517 100644 --- a/node/stmt/try.go +++ b/node/stmt/try.go @@ -5,16 +5,14 @@ import ( ) type Try struct { - attributes map[string]interface{} - position *node.Position - Stmts []node.Node - Catches []node.Node - Finally node.Node + position *node.Position + Stmts []node.Node + Catches []node.Node + Finally node.Node } func NewTry(Stmts []node.Node, Catches []node.Node, Finally node.Node) node.Node { return &Try{ - map[string]interface{}{}, nil, Stmts, Catches, @@ -23,7 +21,7 @@ func NewTry(Stmts []node.Node, Catches []node.Node, Finally node.Node) node.Node } func (n Try) Attributes() map[string]interface{} { - return n.attributes + return nil } func (n Try) Position() *node.Position { diff --git a/node/stmt/unset.go b/node/stmt/unset.go index 77edbed..6e09314 100644 --- a/node/stmt/unset.go +++ b/node/stmt/unset.go @@ -5,21 +5,19 @@ import ( ) type Unset struct { - attributes map[string]interface{} - position *node.Position - Vars []node.Node + position *node.Position + Vars []node.Node } func NewUnset(Vars []node.Node) node.Node { return &Unset{ - map[string]interface{}{}, nil, Vars, } } func (n Unset) Attributes() map[string]interface{} { - return n.attributes + return nil } func (n Unset) Position() *node.Position { diff --git a/parser/parser.go b/parser/parser.go index 9728581..6b0e5a0 100644 --- a/parser/parser.go +++ b/parser/parser.go @@ -5,10 +5,6 @@ import __yyfmt__ "fmt" //line parser/parser.y:2 import ( - "io" - "strconv" - "strings" - "github.com/z7zmey/php-parser/node" "github.com/z7zmey/php-parser/node/expr" "github.com/z7zmey/php-parser/node/expr/assign_op" @@ -18,9 +14,12 @@ import ( "github.com/z7zmey/php-parser/node/scalar" "github.com/z7zmey/php-parser/node/stmt" "github.com/z7zmey/php-parser/token" + "io" + "strconv" + "strings" ) -var rootnode node.Node +var rootnode = stmt.NewStmtList([]node.Node{}) func Parse(src io.Reader, fName string) node.Node { yyDebug = 0 @@ -2668,13 +2667,13 @@ yydefault: yyDollar = yyS[yypt-1 : yypt+1] //line parser/parser.y:333 { - yyVAL.node = node.NewIdentifier(yyDollar[1].token).SetPosition(NewTokenPosition(yyDollar[1].token)) + yyVAL.node = node.NewIdentifier(yyDollar[1].token.Value).SetPosition(NewTokenPosition(yyDollar[1].token)) } case 100: yyDollar = yyS[yypt-1 : yypt+1] //line parser/parser.y:334 { - yyVAL.node = node.NewIdentifier(yyDollar[1].token).SetPosition(NewTokenPosition(yyDollar[1].token)) + yyVAL.node = node.NewIdentifier(yyDollar[1].token.Value).SetPosition(NewTokenPosition(yyDollar[1].token)) } case 101: yyDollar = yyS[yypt-6 : yypt+1] @@ -2766,7 +2765,7 @@ yydefault: yyDollar = yyS[yypt-3 : yypt+1] //line parser/parser.y:396 { - yyVAL.node = stmt.NewUse(nil, name.NewName(yyDollar[1].list).SetPosition(NewNodeListPosition(yyDollar[1].list)), node.NewIdentifier(yyDollar[3].token).SetPosition(NewTokenPosition(yyDollar[3].token))).SetPosition(NewNodeListTokenPosition(yyDollar[1].list, yyDollar[3].token)) + yyVAL.node = stmt.NewUse(nil, name.NewName(yyDollar[1].list).SetPosition(NewNodeListPosition(yyDollar[1].list)), node.NewIdentifier(yyDollar[3].token.Value).SetPosition(NewTokenPosition(yyDollar[3].token))).SetPosition(NewNodeListTokenPosition(yyDollar[1].list, yyDollar[3].token)) } case 117: yyDollar = yyS[yypt-1 : yypt+1] @@ -2980,13 +2979,13 @@ yydefault: yyDollar = yyS[yypt-3 : yypt+1] //line parser/parser.y:457 { - yyVAL.node = stmt.NewGoto(node.NewIdentifier(yyDollar[2].token).SetPosition(NewTokenPosition(yyDollar[2].token))).SetPosition(NewTokensPosition(yyDollar[1].token, yyDollar[3].token)) + yyVAL.node = stmt.NewGoto(node.NewIdentifier(yyDollar[2].token.Value).SetPosition(NewTokenPosition(yyDollar[2].token))).SetPosition(NewTokensPosition(yyDollar[1].token, yyDollar[3].token)) } case 152: yyDollar = yyS[yypt-2 : yypt+1] //line parser/parser.y:458 { - yyVAL.node = stmt.NewLabel(node.NewIdentifier(yyDollar[1].token).SetPosition(NewTokenPosition(yyDollar[1].token))).SetPosition(NewTokensPosition(yyDollar[1].token, yyDollar[2].token)) + yyVAL.node = stmt.NewLabel(node.NewIdentifier(yyDollar[1].token.Value).SetPosition(NewTokenPosition(yyDollar[1].token))).SetPosition(NewTokensPosition(yyDollar[1].token, yyDollar[2].token)) } case 153: yyDollar = yyS[yypt-0 : yypt+1] @@ -2998,7 +2997,7 @@ yydefault: yyDollar = yyS[yypt-9 : yypt+1] //line parser/parser.y:463 { - identifier := node.NewIdentifier(yyDollar[5].token).SetPosition(NewTokenPosition(yyDollar[5].token)) + identifier := node.NewIdentifier(yyDollar[5].token.Value).SetPosition(NewTokenPosition(yyDollar[5].token)) variable := expr.NewVariable(identifier).SetPosition(NewTokenPosition(yyDollar[5].token)) yyVAL.list = append(yyDollar[1].list, stmt.NewCatch(yyDollar[4].list, variable, yyDollar[8].list).SetPosition(NewTokensPosition(yyDollar[2].token, yyDollar[9].token))) } @@ -3048,7 +3047,7 @@ yydefault: yyDollar = yyS[yypt-11 : yypt+1] //line parser/parser.y:490 { - name := node.NewIdentifier(yyDollar[3].token).SetPosition(NewTokenPosition(yyDollar[3].token)) + name := node.NewIdentifier(yyDollar[3].token.Value).SetPosition(NewTokenPosition(yyDollar[3].token)) yyVAL.node = stmt.NewFunction(name, yyDollar[2].boolWithToken.value, yyDollar[6].list, yyDollar[8].node, yyDollar[10].list, yyDollar[4].str). SetPosition(NewTokensPosition(yyDollar[1].token, yyDollar[11].token)) } @@ -3080,7 +3079,7 @@ yydefault: yyDollar = yyS[yypt-9 : yypt+1] //line parser/parser.y:509 { - name := node.NewIdentifier(yyDollar[3].token).SetPosition(NewTokenPosition(yyDollar[3].token)) + name := node.NewIdentifier(yyDollar[3].token.Value).SetPosition(NewTokenPosition(yyDollar[3].token)) yyVAL.node = stmt.NewClass(name, yyDollar[1].list, nil, yyDollar[4].node, yyDollar[5].list, yyDollar[8].list, yyDollar[6].str). SetPosition(NewOptionalListTokensPosition(yyDollar[1].list, yyDollar[2].token, yyDollar[9].token)) } @@ -3088,7 +3087,7 @@ yydefault: yyDollar = yyS[yypt-8 : yypt+1] //line parser/parser.y:515 { - name := node.NewIdentifier(yyDollar[2].token).SetPosition(NewTokenPosition(yyDollar[2].token)) + name := node.NewIdentifier(yyDollar[2].token.Value).SetPosition(NewTokenPosition(yyDollar[2].token)) yyVAL.node = stmt.NewClass(name, nil, nil, yyDollar[3].node, yyDollar[4].list, yyDollar[7].list, yyDollar[5].str). SetPosition(NewTokensPosition(yyDollar[1].token, yyDollar[8].token)) } @@ -3108,19 +3107,19 @@ yydefault: yyDollar = yyS[yypt-1 : yypt+1] //line parser/parser.y:528 { - yyVAL.node = node.NewIdentifier(yyDollar[1].token).SetPosition(NewTokenPosition(yyDollar[1].token)) + yyVAL.node = node.NewIdentifier(yyDollar[1].token.Value).SetPosition(NewTokenPosition(yyDollar[1].token)) } case 172: yyDollar = yyS[yypt-1 : yypt+1] //line parser/parser.y:529 { - yyVAL.node = node.NewIdentifier(yyDollar[1].token).SetPosition(NewTokenPosition(yyDollar[1].token)) + yyVAL.node = node.NewIdentifier(yyDollar[1].token.Value).SetPosition(NewTokenPosition(yyDollar[1].token)) } case 173: yyDollar = yyS[yypt-6 : yypt+1] //line parser/parser.y:534 { - name := node.NewIdentifier(yyDollar[2].token).SetPosition(NewTokenPosition(yyDollar[2].token)) + name := node.NewIdentifier(yyDollar[2].token.Value).SetPosition(NewTokenPosition(yyDollar[2].token)) yyVAL.node = stmt.NewTrait(name, yyDollar[5].list, yyDollar[3].str). SetPosition(NewTokensPosition(yyDollar[1].token, yyDollar[6].token)) } @@ -3128,7 +3127,7 @@ yydefault: yyDollar = yyS[yypt-7 : yypt+1] //line parser/parser.y:543 { - name := node.NewIdentifier(yyDollar[2].token).SetPosition(NewTokenPosition(yyDollar[2].token)) + name := node.NewIdentifier(yyDollar[2].token.Value).SetPosition(NewTokenPosition(yyDollar[2].token)) yyVAL.node = stmt.NewInterface(name, yyDollar[3].list, yyDollar[6].list, yyDollar[4].str). SetPosition(NewTokensPosition(yyDollar[1].token, yyDollar[7].token)) } @@ -3362,7 +3361,7 @@ yydefault: yyDollar = yyS[yypt-4 : yypt+1] //line parser/parser.y:667 { - identifier := node.NewIdentifier(yyDollar[4].token).SetPosition(NewTokenPosition(yyDollar[4].token)) + identifier := node.NewIdentifier(yyDollar[4].token.Value).SetPosition(NewTokenPosition(yyDollar[4].token)) variable := expr.NewVariable(identifier).SetPosition(NewTokenPosition(yyDollar[4].token)) if yyDollar[1].node != nil { yyVAL.node = node.NewParameter(yyDollar[1].node, variable, nil, yyDollar[2].boolWithToken.value, yyDollar[3].boolWithToken.value).SetPosition(NewNodeTokenPosition(yyDollar[1].node, yyDollar[4].token)) @@ -3378,7 +3377,7 @@ yydefault: yyDollar = yyS[yypt-6 : yypt+1] //line parser/parser.y:681 { - identifier := node.NewIdentifier(yyDollar[4].token).SetPosition(NewTokenPosition(yyDollar[4].token)) + identifier := node.NewIdentifier(yyDollar[4].token.Value).SetPosition(NewTokenPosition(yyDollar[4].token)) variable := expr.NewVariable(identifier).SetPosition(NewTokenPosition(yyDollar[4].token)) if yyDollar[1].node != nil { yyVAL.node = node.NewParameter(yyDollar[1].node, variable, yyDollar[6].node, yyDollar[2].boolWithToken.value, yyDollar[3].boolWithToken.value).SetPosition(NewNodesPosition(yyDollar[1].node, yyDollar[6].node)) @@ -3418,13 +3417,13 @@ yydefault: yyDollar = yyS[yypt-1 : yypt+1] //line parser/parser.y:707 { - yyVAL.node = node.NewIdentifier(yyDollar[1].token).SetPosition(NewTokenPosition(yyDollar[1].token)) + yyVAL.node = node.NewIdentifier(yyDollar[1].token.Value).SetPosition(NewTokenPosition(yyDollar[1].token)) } case 221: yyDollar = yyS[yypt-1 : yypt+1] //line parser/parser.y:708 { - yyVAL.node = node.NewIdentifier(yyDollar[1].token).SetPosition(NewTokenPosition(yyDollar[1].token)) + yyVAL.node = node.NewIdentifier(yyDollar[1].token.Value).SetPosition(NewTokenPosition(yyDollar[1].token)) } case 222: yyDollar = yyS[yypt-1 : yypt+1] @@ -3514,7 +3513,7 @@ yydefault: yyDollar = yyS[yypt-1 : yypt+1] //line parser/parser.y:748 { - identifier := node.NewIdentifier(yyDollar[1].token).SetPosition(NewTokenPosition(yyDollar[1].token)) + identifier := node.NewIdentifier(yyDollar[1].token.Value).SetPosition(NewTokenPosition(yyDollar[1].token)) variable := expr.NewVariable(identifier).SetPosition(NewTokenPosition(yyDollar[1].token)) yyVAL.node = stmt.NewStaticVar(variable, nil).SetPosition(NewTokenPosition(yyDollar[1].token)) } @@ -3522,7 +3521,7 @@ yydefault: yyDollar = yyS[yypt-3 : yypt+1] //line parser/parser.y:754 { - identifier := node.NewIdentifier(yyDollar[1].token).SetPosition(NewTokenPosition(yyDollar[1].token)) + identifier := node.NewIdentifier(yyDollar[1].token.Value).SetPosition(NewTokenPosition(yyDollar[1].token)) variable := expr.NewVariable(identifier).SetPosition(NewTokenPosition(yyDollar[1].token)) yyVAL.node = stmt.NewStaticVar(variable, yyDollar[3].node).SetPosition(NewTokenNodePosition(yyDollar[1].token, yyDollar[3].node)) } @@ -3560,7 +3559,7 @@ yydefault: yyDollar = yyS[yypt-10 : yypt+1] //line parser/parser.y:771 { - name := node.NewIdentifier(yyDollar[4].token).SetPosition(NewTokenPosition(yyDollar[4].token)) + name := node.NewIdentifier(yyDollar[4].token.Value).SetPosition(NewTokenPosition(yyDollar[4].token)) yyVAL.node = stmt.NewClassMethod(name, yyDollar[1].list, yyDollar[3].boolWithToken.value, yyDollar[7].list, yyDollar[9].node, yyDollar[10].nodesWithEndToken.nodes, yyDollar[5].str). SetPosition(NewOptionalListTokensPosition(yyDollar[1].list, yyDollar[2].token, yyDollar[10].nodesWithEndToken.endToken)) } @@ -3629,19 +3628,19 @@ yydefault: yyDollar = yyS[yypt-3 : yypt+1] //line parser/parser.y:808 { - yyVAL.node = stmt.NewTraitUseAlias(yyDollar[1].node, nil, node.NewIdentifier(yyDollar[3].token).SetPosition(NewTokenPosition(yyDollar[3].token))).SetPosition(NewNodeTokenPosition(yyDollar[1].node, yyDollar[3].token)) + yyVAL.node = stmt.NewTraitUseAlias(yyDollar[1].node, nil, node.NewIdentifier(yyDollar[3].token.Value).SetPosition(NewTokenPosition(yyDollar[3].token))).SetPosition(NewNodeTokenPosition(yyDollar[1].node, yyDollar[3].token)) } case 255: yyDollar = yyS[yypt-3 : yypt+1] //line parser/parser.y:810 { - yyVAL.node = stmt.NewTraitUseAlias(yyDollar[1].node, nil, node.NewIdentifier(yyDollar[3].token).SetPosition(NewTokenPosition(yyDollar[3].token))).SetPosition(NewNodeTokenPosition(yyDollar[1].node, yyDollar[3].token)) + yyVAL.node = stmt.NewTraitUseAlias(yyDollar[1].node, nil, node.NewIdentifier(yyDollar[3].token.Value).SetPosition(NewTokenPosition(yyDollar[3].token))).SetPosition(NewNodeTokenPosition(yyDollar[1].node, yyDollar[3].token)) } case 256: yyDollar = yyS[yypt-4 : yypt+1] //line parser/parser.y:812 { - yyVAL.node = stmt.NewTraitUseAlias(yyDollar[1].node, yyDollar[3].node, node.NewIdentifier(yyDollar[4].token).SetPosition(NewTokenPosition(yyDollar[4].token))).SetPosition(NewNodeTokenPosition(yyDollar[1].node, yyDollar[4].token)) + yyVAL.node = stmt.NewTraitUseAlias(yyDollar[1].node, yyDollar[3].node, node.NewIdentifier(yyDollar[4].token.Value).SetPosition(NewTokenPosition(yyDollar[4].token))).SetPosition(NewNodeTokenPosition(yyDollar[1].node, yyDollar[4].token)) } case 257: yyDollar = yyS[yypt-3 : yypt+1] @@ -3653,7 +3652,7 @@ yydefault: yyDollar = yyS[yypt-1 : yypt+1] //line parser/parser.y:817 { - yyVAL.node = stmt.NewTraitMethodRef(nil, node.NewIdentifier(yyDollar[1].token).SetPosition(NewTokenPosition(yyDollar[1].token))).SetPosition(NewTokenPosition(yyDollar[1].token)) + yyVAL.node = stmt.NewTraitMethodRef(nil, node.NewIdentifier(yyDollar[1].token.Value).SetPosition(NewTokenPosition(yyDollar[1].token))).SetPosition(NewTokenPosition(yyDollar[1].token)) } case 259: yyDollar = yyS[yypt-1 : yypt+1] @@ -3665,7 +3664,7 @@ yydefault: yyDollar = yyS[yypt-3 : yypt+1] //line parser/parser.y:822 { - yyVAL.node = stmt.NewTraitMethodRef(yyDollar[1].node, node.NewIdentifier(yyDollar[3].token).SetPosition(NewTokenPosition(yyDollar[3].token))).SetPosition(NewNodeTokenPosition(yyDollar[1].node, yyDollar[3].token)) + yyVAL.node = stmt.NewTraitMethodRef(yyDollar[1].node, node.NewIdentifier(yyDollar[3].token.Value).SetPosition(NewTokenPosition(yyDollar[3].token))).SetPosition(NewNodeTokenPosition(yyDollar[1].node, yyDollar[3].token)) } case 261: yyDollar = yyS[yypt-1 : yypt+1] @@ -3689,7 +3688,7 @@ yydefault: yyDollar = yyS[yypt-1 : yypt+1] //line parser/parser.y:832 { - yyVAL.list = []node.Node{node.NewIdentifier(yyDollar[1].token).SetPosition(NewTokenPosition(yyDollar[1].token))} + yyVAL.list = []node.Node{node.NewIdentifier(yyDollar[1].token.Value).SetPosition(NewTokenPosition(yyDollar[1].token))} } case 265: yyDollar = yyS[yypt-0 : yypt+1] @@ -3719,37 +3718,37 @@ yydefault: yyDollar = yyS[yypt-1 : yypt+1] //line parser/parser.y:846 { - yyVAL.node = node.NewIdentifier(yyDollar[1].token).SetPosition(NewTokenPosition(yyDollar[1].token)) + yyVAL.node = node.NewIdentifier(yyDollar[1].token.Value).SetPosition(NewTokenPosition(yyDollar[1].token)) } case 270: yyDollar = yyS[yypt-1 : yypt+1] //line parser/parser.y:847 { - yyVAL.node = node.NewIdentifier(yyDollar[1].token).SetPosition(NewTokenPosition(yyDollar[1].token)) + yyVAL.node = node.NewIdentifier(yyDollar[1].token.Value).SetPosition(NewTokenPosition(yyDollar[1].token)) } case 271: yyDollar = yyS[yypt-1 : yypt+1] //line parser/parser.y:848 { - yyVAL.node = node.NewIdentifier(yyDollar[1].token).SetPosition(NewTokenPosition(yyDollar[1].token)) + yyVAL.node = node.NewIdentifier(yyDollar[1].token.Value).SetPosition(NewTokenPosition(yyDollar[1].token)) } case 272: yyDollar = yyS[yypt-1 : yypt+1] //line parser/parser.y:849 { - yyVAL.node = node.NewIdentifier(yyDollar[1].token).SetPosition(NewTokenPosition(yyDollar[1].token)) + yyVAL.node = node.NewIdentifier(yyDollar[1].token.Value).SetPosition(NewTokenPosition(yyDollar[1].token)) } case 273: yyDollar = yyS[yypt-1 : yypt+1] //line parser/parser.y:850 { - yyVAL.node = node.NewIdentifier(yyDollar[1].token).SetPosition(NewTokenPosition(yyDollar[1].token)) + yyVAL.node = node.NewIdentifier(yyDollar[1].token.Value).SetPosition(NewTokenPosition(yyDollar[1].token)) } case 274: yyDollar = yyS[yypt-1 : yypt+1] //line parser/parser.y:851 { - yyVAL.node = node.NewIdentifier(yyDollar[1].token).SetPosition(NewTokenPosition(yyDollar[1].token)) + yyVAL.node = node.NewIdentifier(yyDollar[1].token.Value).SetPosition(NewTokenPosition(yyDollar[1].token)) } case 275: yyDollar = yyS[yypt-3 : yypt+1] @@ -3767,7 +3766,7 @@ yydefault: yyDollar = yyS[yypt-2 : yypt+1] //line parser/parser.y:861 { - identifier := node.NewIdentifier(yyDollar[1].token).SetPosition(NewTokenPosition(yyDollar[1].token)) + identifier := node.NewIdentifier(yyDollar[1].token.Value).SetPosition(NewTokenPosition(yyDollar[1].token)) variable := expr.NewVariable(identifier).SetPosition(NewTokenPosition(yyDollar[1].token)) yyVAL.node = stmt.NewProperty(variable, nil, yyDollar[2].str).SetPosition(NewTokenPosition(yyDollar[1].token)) } @@ -3775,7 +3774,7 @@ yydefault: yyDollar = yyS[yypt-4 : yypt+1] //line parser/parser.y:867 { - identifier := node.NewIdentifier(yyDollar[1].token).SetPosition(NewTokenPosition(yyDollar[1].token)) + identifier := node.NewIdentifier(yyDollar[1].token.Value).SetPosition(NewTokenPosition(yyDollar[1].token)) variable := expr.NewVariable(identifier).SetPosition(NewTokenPosition(yyDollar[1].token)) yyVAL.node = stmt.NewProperty(variable, yyDollar[3].node, yyDollar[4].str).SetPosition(NewTokenNodePosition(yyDollar[1].token, yyDollar[3].node)) } @@ -3795,14 +3794,14 @@ yydefault: yyDollar = yyS[yypt-4 : yypt+1] //line parser/parser.y:881 { - name := node.NewIdentifier(yyDollar[1].token).SetPosition(NewTokenPosition(yyDollar[1].token)) + name := node.NewIdentifier(yyDollar[1].token.Value).SetPosition(NewTokenPosition(yyDollar[1].token)) yyVAL.node = stmt.NewConstant(name, yyDollar[3].node, yyDollar[4].str).SetPosition(NewTokenNodePosition(yyDollar[1].token, yyDollar[3].node)) } case 282: yyDollar = yyS[yypt-4 : yypt+1] //line parser/parser.y:889 { - name := node.NewIdentifier(yyDollar[1].token).SetPosition(NewTokenPosition(yyDollar[1].token)) + name := node.NewIdentifier(yyDollar[1].token.Value).SetPosition(NewTokenPosition(yyDollar[1].token)) yyVAL.node = stmt.NewConstant(name, yyDollar[3].node, yyDollar[4].str).SetPosition(NewTokenNodePosition(yyDollar[1].token, yyDollar[3].node)) } case 283: @@ -4380,7 +4379,7 @@ yydefault: yyDollar = yyS[yypt-1 : yypt+1] //line parser/parser.y:1052 { - identifier := node.NewIdentifier(yyDollar[1].token).SetPosition(NewTokenPosition(yyDollar[1].token)) + identifier := node.NewIdentifier(yyDollar[1].token.Value).SetPosition(NewTokenPosition(yyDollar[1].token)) variable := expr.NewVariable(identifier).SetPosition(NewTokenPosition(yyDollar[1].token)) yyVAL.node = expr.NewClusureUse(variable, false).SetPosition(NewTokenPosition(yyDollar[1].token)) } @@ -4388,7 +4387,7 @@ yydefault: yyDollar = yyS[yypt-2 : yypt+1] //line parser/parser.y:1058 { - identifier := node.NewIdentifier(yyDollar[2].token).SetPosition(NewTokenPosition(yyDollar[2].token)) + identifier := node.NewIdentifier(yyDollar[2].token.Value).SetPosition(NewTokenPosition(yyDollar[2].token)) variable := expr.NewVariable(identifier).SetPosition(NewTokenPosition(yyDollar[2].token)) yyVAL.node = expr.NewClusureUse(variable, true).SetPosition(NewTokensPosition(yyDollar[1].token, yyDollar[2].token)) } @@ -4420,7 +4419,7 @@ yydefault: yyDollar = yyS[yypt-1 : yypt+1] //line parser/parser.y:1079 { - yyVAL.node = node.NewIdentifier(yyDollar[1].token).SetPosition(NewTokenPosition(yyDollar[1].token)) + yyVAL.node = node.NewIdentifier(yyDollar[1].token.Value).SetPosition(NewTokenPosition(yyDollar[1].token)) } case 383: yyDollar = yyS[yypt-1 : yypt+1] @@ -4606,13 +4605,13 @@ yydefault: yyDollar = yyS[yypt-3 : yypt+1] //line parser/parser.y:1133 { - yyVAL.node = expr.NewClassConstFetch(yyDollar[1].node, node.NewIdentifier(yyDollar[3].token).SetPosition(NewTokenPosition(yyDollar[3].token))).SetPosition(NewNodeTokenPosition(yyDollar[1].node, yyDollar[3].token)) + yyVAL.node = expr.NewClassConstFetch(yyDollar[1].node, node.NewIdentifier(yyDollar[3].token.Value).SetPosition(NewTokenPosition(yyDollar[3].token))).SetPosition(NewNodeTokenPosition(yyDollar[1].node, yyDollar[3].token)) } case 414: yyDollar = yyS[yypt-3 : yypt+1] //line parser/parser.y:1135 { - yyVAL.node = expr.NewClassConstFetch(yyDollar[1].node, node.NewIdentifier(yyDollar[3].token).SetPosition(NewTokenPosition(yyDollar[3].token))).SetPosition(NewNodeTokenPosition(yyDollar[1].node, yyDollar[3].token)) + yyVAL.node = expr.NewClassConstFetch(yyDollar[1].node, node.NewIdentifier(yyDollar[3].token.Value).SetPosition(NewTokenPosition(yyDollar[3].token))).SetPosition(NewNodeTokenPosition(yyDollar[1].node, yyDollar[3].token)) } case 415: yyDollar = yyS[yypt-1 : yypt+1] @@ -4738,7 +4737,7 @@ yydefault: yyDollar = yyS[yypt-1 : yypt+1] //line parser/parser.y:1181 { - yyVAL.node = expr.NewVariable(node.NewIdentifier(yyDollar[1].token).SetPosition(NewTokenPosition(yyDollar[1].token))).SetPosition(NewTokenPosition(yyDollar[1].token)) + yyVAL.node = expr.NewVariable(node.NewIdentifier(yyDollar[1].token.Value).SetPosition(NewTokenPosition(yyDollar[1].token))).SetPosition(NewTokenPosition(yyDollar[1].token)) } case 436: yyDollar = yyS[yypt-4 : yypt+1] @@ -4804,7 +4803,7 @@ yydefault: yyDollar = yyS[yypt-1 : yypt+1] //line parser/parser.y:1213 { - yyVAL.node = node.NewIdentifier(yyDollar[1].token).SetPosition(NewTokenPosition(yyDollar[1].token)) + yyVAL.node = node.NewIdentifier(yyDollar[1].token.Value).SetPosition(NewTokenPosition(yyDollar[1].token)) } case 447: yyDollar = yyS[yypt-3 : yypt+1] @@ -4822,7 +4821,7 @@ yydefault: yyDollar = yyS[yypt-1 : yypt+1] //line parser/parser.y:1219 { - yyVAL.node = node.NewIdentifier(yyDollar[1].token).SetPosition(NewTokenPosition(yyDollar[1].token)) + yyVAL.node = node.NewIdentifier(yyDollar[1].token.Value).SetPosition(NewTokenPosition(yyDollar[1].token)) } case 450: yyDollar = yyS[yypt-3 : yypt+1] @@ -4940,13 +4939,13 @@ yydefault: yyDollar = yyS[yypt-1 : yypt+1] //line parser/parser.y:1275 { - yyVAL.node = expr.NewVariable(node.NewIdentifier(yyDollar[1].token).SetPosition(NewTokenPosition(yyDollar[1].token))).SetPosition(NewTokenPosition(yyDollar[1].token)) + yyVAL.node = expr.NewVariable(node.NewIdentifier(yyDollar[1].token.Value).SetPosition(NewTokenPosition(yyDollar[1].token))).SetPosition(NewTokenPosition(yyDollar[1].token)) } case 468: yyDollar = yyS[yypt-4 : yypt+1] //line parser/parser.y:1277 { - identifier := node.NewIdentifier(yyDollar[1].token).SetPosition(NewTokenPosition(yyDollar[1].token)) + identifier := node.NewIdentifier(yyDollar[1].token.Value).SetPosition(NewTokenPosition(yyDollar[1].token)) variable := expr.NewVariable(identifier).SetPosition(NewTokenPosition(yyDollar[1].token)) yyVAL.node = expr.NewArrayDimFetch(variable, yyDollar[3].node).SetPosition(NewTokensPosition(yyDollar[1].token, yyDollar[4].token)) } @@ -4954,9 +4953,9 @@ yydefault: yyDollar = yyS[yypt-3 : yypt+1] //line parser/parser.y:1283 { - identifier := node.NewIdentifier(yyDollar[1].token).SetPosition(NewTokenPosition(yyDollar[1].token)) + identifier := node.NewIdentifier(yyDollar[1].token.Value).SetPosition(NewTokenPosition(yyDollar[1].token)) variable := expr.NewVariable(identifier).SetPosition(NewTokenPosition(yyDollar[1].token)) - yyVAL.node = expr.NewPropertyFetch(variable, node.NewIdentifier(yyDollar[3].token).SetPosition(NewTokenPosition(yyDollar[3].token))). + yyVAL.node = expr.NewPropertyFetch(variable, node.NewIdentifier(yyDollar[3].token.Value).SetPosition(NewTokenPosition(yyDollar[3].token))). SetPosition(NewTokensPosition(yyDollar[1].token, yyDollar[3].token)) } case 470: @@ -4969,13 +4968,13 @@ yydefault: yyDollar = yyS[yypt-3 : yypt+1] //line parser/parser.y:1290 { - yyVAL.node = expr.NewVariable(node.NewIdentifier(yyDollar[2].token).SetPosition(NewTokenPosition(yyDollar[2].token))).SetPosition(NewTokensPosition(yyDollar[1].token, yyDollar[3].token)) + yyVAL.node = expr.NewVariable(node.NewIdentifier(yyDollar[2].token.Value).SetPosition(NewTokenPosition(yyDollar[2].token))).SetPosition(NewTokensPosition(yyDollar[1].token, yyDollar[3].token)) } case 472: yyDollar = yyS[yypt-6 : yypt+1] //line parser/parser.y:1292 { - identifier := node.NewIdentifier(yyDollar[2].token).SetPosition(NewTokenPosition(yyDollar[2].token)) + identifier := node.NewIdentifier(yyDollar[2].token.Value).SetPosition(NewTokenPosition(yyDollar[2].token)) variable := expr.NewVariable(identifier).SetPosition(NewTokenPosition(yyDollar[2].token)) yyVAL.node = expr.NewArrayDimFetch(variable, yyDollar[4].node).SetPosition(NewTokensPosition(yyDollar[1].token, yyDollar[6].token)) } @@ -5019,7 +5018,7 @@ yydefault: yyDollar = yyS[yypt-1 : yypt+1] //line parser/parser.y:1322 { - identifier := node.NewIdentifier(yyDollar[1].token).SetPosition(NewTokenPosition(yyDollar[1].token)) + identifier := node.NewIdentifier(yyDollar[1].token.Value).SetPosition(NewTokenPosition(yyDollar[1].token)) yyVAL.node = expr.NewVariable(identifier).SetPosition(NewTokenPosition(yyDollar[1].token)) } case 478: diff --git a/parser/parser.y b/parser/parser.y index 62436be..274e31c 100644 --- a/parser/parser.y +++ b/parser/parser.y @@ -330,8 +330,8 @@ top_statement: ; use_type: - T_FUNCTION { $$ = node.NewIdentifier($1).SetPosition(NewTokenPosition($1)) } - | T_CONST { $$ = node.NewIdentifier($1).SetPosition(NewTokenPosition($1)) } + T_FUNCTION { $$ = node.NewIdentifier($1.Value).SetPosition(NewTokenPosition($1)) } + | T_CONST { $$ = node.NewIdentifier($1.Value).SetPosition(NewTokenPosition($1)) } ; group_use_declaration: @@ -393,7 +393,7 @@ inline_use_declaration: unprefixed_use_declaration: namespace_name { $$ = stmt.NewUse(nil, name.NewName($1).SetPosition(NewNodeListPosition($1)), nil).SetPosition(NewNodeListPosition($1)) } - | namespace_name T_AS T_STRING { $$ = stmt.NewUse(nil, name.NewName($1).SetPosition(NewNodeListPosition($1)), node.NewIdentifier($3).SetPosition(NewTokenPosition($3))).SetPosition(NewNodeListTokenPosition($1, $3)) } + | namespace_name T_AS T_STRING { $$ = stmt.NewUse(nil, name.NewName($1).SetPosition(NewNodeListPosition($1)), node.NewIdentifier($3.Value).SetPosition(NewTokenPosition($3))).SetPosition(NewNodeListTokenPosition($1, $3)) } ; use_declaration: @@ -454,14 +454,14 @@ statement: } } | T_THROW expr ';' { $$ = stmt.NewThrow($2).SetPosition(NewTokensPosition($1, $3)) } - | T_GOTO T_STRING ';' { $$ = stmt.NewGoto(node.NewIdentifier($2).SetPosition(NewTokenPosition($2))).SetPosition(NewTokensPosition($1, $3)) } - | T_STRING ':' { $$ = stmt.NewLabel(node.NewIdentifier($1).SetPosition(NewTokenPosition($1))).SetPosition(NewTokensPosition($1, $2)) } + | T_GOTO T_STRING ';' { $$ = stmt.NewGoto(node.NewIdentifier($2.Value).SetPosition(NewTokenPosition($2))).SetPosition(NewTokensPosition($1, $3)) } + | T_STRING ':' { $$ = stmt.NewLabel(node.NewIdentifier($1.Value).SetPosition(NewTokenPosition($1))).SetPosition(NewTokensPosition($1, $2)) } catch_list: /* empty */ { $$ = []node.Node{} } | catch_list T_CATCH '(' catch_name_list T_VARIABLE ')' '{' inner_statement_list '}' { - identifier := node.NewIdentifier($5).SetPosition(NewTokenPosition($5)) + identifier := node.NewIdentifier($5.Value).SetPosition(NewTokenPosition($5)) variable := expr.NewVariable(identifier).SetPosition(NewTokenPosition($5)) $$ = append($1, stmt.NewCatch($4, variable, $8).SetPosition(NewTokensPosition($2, $9))) } @@ -488,7 +488,7 @@ unset_variable: function_declaration_statement: T_FUNCTION returns_ref T_STRING backup_doc_comment '(' parameter_list ')' return_type '{' inner_statement_list '}' { - name := node.NewIdentifier($3).SetPosition(NewTokenPosition($3)) + name := node.NewIdentifier($3.Value).SetPosition(NewTokenPosition($3)) $$ = stmt.NewFunction(name, $2.value, $6, $8, $10, $4). SetPosition(NewTokensPosition($1, $11)) } @@ -507,13 +507,13 @@ is_variadic: class_declaration_statement: class_modifiers T_CLASS T_STRING extends_from implements_list backup_doc_comment '{' class_statement_list '}' { - name := node.NewIdentifier($3).SetPosition(NewTokenPosition($3)) + name := node.NewIdentifier($3.Value).SetPosition(NewTokenPosition($3)) $$ = stmt.NewClass(name, $1, nil, $4, $5, $8, $6). SetPosition(NewOptionalListTokensPosition($1, $2, $9)) } | T_CLASS T_STRING extends_from implements_list backup_doc_comment '{' class_statement_list '}' { - name := node.NewIdentifier($2).SetPosition(NewTokenPosition($2)) + name := node.NewIdentifier($2.Value).SetPosition(NewTokenPosition($2)) $$ = stmt.NewClass(name, nil, nil, $3, $4, $7, $5). SetPosition(NewTokensPosition($1, $8)) } @@ -525,14 +525,14 @@ class_modifiers: ; class_modifier: - T_ABSTRACT { $$ = node.NewIdentifier($1).SetPosition(NewTokenPosition($1)) } - | T_FINAL { $$ = node.NewIdentifier($1).SetPosition(NewTokenPosition($1)) } + T_ABSTRACT { $$ = node.NewIdentifier($1.Value).SetPosition(NewTokenPosition($1)) } + | T_FINAL { $$ = node.NewIdentifier($1.Value).SetPosition(NewTokenPosition($1)) } ; trait_declaration_statement: T_TRAIT T_STRING backup_doc_comment '{' class_statement_list '}' { - name := node.NewIdentifier($2).SetPosition(NewTokenPosition($2)) + name := node.NewIdentifier($2.Value).SetPosition(NewTokenPosition($2)) $$ = stmt.NewTrait(name, $5, $3). SetPosition(NewTokensPosition($1, $6)) } @@ -541,7 +541,7 @@ trait_declaration_statement: interface_declaration_statement: T_INTERFACE T_STRING interface_extends_list backup_doc_comment '{' class_statement_list '}' { - name := node.NewIdentifier($2).SetPosition(NewTokenPosition($2)) + name := node.NewIdentifier($2.Value).SetPosition(NewTokenPosition($2)) $$ = stmt.NewInterface(name, $3, $6, $4). SetPosition(NewTokensPosition($1, $7)) } @@ -665,7 +665,7 @@ non_empty_parameter_list: parameter: optional_type is_reference is_variadic T_VARIABLE { - identifier := node.NewIdentifier($4).SetPosition(NewTokenPosition($4)) + identifier := node.NewIdentifier($4.Value).SetPosition(NewTokenPosition($4)) variable := expr.NewVariable(identifier).SetPosition(NewTokenPosition($4)) if $1 != nil { $$ = node.NewParameter($1, variable, nil, $2.value, $3.value).SetPosition(NewNodeTokenPosition($1, $4)) @@ -679,7 +679,7 @@ parameter: } | optional_type is_reference is_variadic T_VARIABLE '=' expr { - identifier := node.NewIdentifier($4).SetPosition(NewTokenPosition($4)) + identifier := node.NewIdentifier($4.Value).SetPosition(NewTokenPosition($4)) variable := expr.NewVariable(identifier).SetPosition(NewTokenPosition($4)) if $1 != nil { $$ = node.NewParameter($1, variable, $6, $2.value, $3.value).SetPosition(NewNodesPosition($1, $6)) @@ -704,8 +704,8 @@ type_expr: ; type: - T_ARRAY { $$ = node.NewIdentifier($1).SetPosition(NewTokenPosition($1)) } - | T_CALLABLE { $$ = node.NewIdentifier($1).SetPosition(NewTokenPosition($1)) } + T_ARRAY { $$ = node.NewIdentifier($1.Value).SetPosition(NewTokenPosition($1)) } + | T_CALLABLE { $$ = node.NewIdentifier($1.Value).SetPosition(NewTokenPosition($1)) } | name { $$ = $1; } ; @@ -746,13 +746,13 @@ static_var_list: static_var: T_VARIABLE { - identifier := node.NewIdentifier($1).SetPosition(NewTokenPosition($1)) + identifier := node.NewIdentifier($1.Value).SetPosition(NewTokenPosition($1)) variable := expr.NewVariable(identifier).SetPosition(NewTokenPosition($1)) $$ = stmt.NewStaticVar(variable, nil).SetPosition(NewTokenPosition($1)) } | T_VARIABLE '=' expr { - identifier := node.NewIdentifier($1).SetPosition(NewTokenPosition($1)) + identifier := node.NewIdentifier($1.Value).SetPosition(NewTokenPosition($1)) variable := expr.NewVariable(identifier).SetPosition(NewTokenPosition($1)) $$ = stmt.NewStaticVar(variable, $3).SetPosition(NewTokenNodePosition($1, $3)) } @@ -769,7 +769,7 @@ class_statement: | T_USE name_list trait_adaptations { $$ = stmt.NewTraitUse($2, $3.nodes).SetPosition(NewTokensPosition($1, $3.endToken)) } | method_modifiers T_FUNCTION returns_ref identifier backup_doc_comment '(' parameter_list ')' return_type method_body { - name := node.NewIdentifier($4).SetPosition(NewTokenPosition($4)) + name := node.NewIdentifier($4.Value).SetPosition(NewTokenPosition($4)) $$ = stmt.NewClassMethod(name, $1, $3.value, $7, $9, $10.nodes, $5). SetPosition(NewOptionalListTokensPosition($1, $2, $10.endToken)) } @@ -805,21 +805,21 @@ trait_precedence: ; trait_alias: - trait_method_reference T_AS T_STRING { $$ = stmt.NewTraitUseAlias($1, nil, node.NewIdentifier($3).SetPosition(NewTokenPosition($3))).SetPosition(NewNodeTokenPosition($1, $3)) } + trait_method_reference T_AS T_STRING { $$ = stmt.NewTraitUseAlias($1, nil, node.NewIdentifier($3.Value).SetPosition(NewTokenPosition($3))).SetPosition(NewNodeTokenPosition($1, $3)) } | trait_method_reference T_AS reserved_non_modifiers - { $$ = stmt.NewTraitUseAlias($1, nil, node.NewIdentifier($3).SetPosition(NewTokenPosition($3))).SetPosition(NewNodeTokenPosition($1, $3)) } + { $$ = stmt.NewTraitUseAlias($1, nil, node.NewIdentifier($3.Value).SetPosition(NewTokenPosition($3))).SetPosition(NewNodeTokenPosition($1, $3)) } | trait_method_reference T_AS member_modifier identifier - { $$ = stmt.NewTraitUseAlias($1, $3, node.NewIdentifier($4).SetPosition(NewTokenPosition($4))).SetPosition(NewNodeTokenPosition($1, $4)) } + { $$ = stmt.NewTraitUseAlias($1, $3, node.NewIdentifier($4.Value).SetPosition(NewTokenPosition($4))).SetPosition(NewNodeTokenPosition($1, $4)) } | trait_method_reference T_AS member_modifier { $$ = stmt.NewTraitUseAlias($1, $3, nil).SetPosition(NewNodesPosition($1, $3)) } ; trait_method_reference: - identifier { $$ = stmt.NewTraitMethodRef(nil, node.NewIdentifier($1).SetPosition(NewTokenPosition($1))).SetPosition(NewTokenPosition($1)) } + identifier { $$ = stmt.NewTraitMethodRef(nil, node.NewIdentifier($1.Value).SetPosition(NewTokenPosition($1))).SetPosition(NewTokenPosition($1)) } | absolute_trait_method_reference { $$ = $1; } ; absolute_trait_method_reference: - name T_PAAMAYIM_NEKUDOTAYIM identifier { $$ = stmt.NewTraitMethodRef($1, node.NewIdentifier($3).SetPosition(NewTokenPosition($3))).SetPosition(NewNodeTokenPosition($1, $3)) } + name T_PAAMAYIM_NEKUDOTAYIM identifier { $$ = stmt.NewTraitMethodRef($1, node.NewIdentifier($3.Value).SetPosition(NewTokenPosition($3))).SetPosition(NewNodeTokenPosition($1, $3)) } ; method_body: @@ -829,7 +829,7 @@ method_body: variable_modifiers: non_empty_member_modifiers { $$ = $1; } - | T_VAR { $$ = []node.Node{node.NewIdentifier($1).SetPosition(NewTokenPosition($1))} } + | T_VAR { $$ = []node.Node{node.NewIdentifier($1.Value).SetPosition(NewTokenPosition($1))} } ; method_modifiers: @@ -843,12 +843,12 @@ non_empty_member_modifiers: ; member_modifier: - T_PUBLIC { $$ = node.NewIdentifier($1).SetPosition(NewTokenPosition($1)) } - | T_PROTECTED { $$ = node.NewIdentifier($1).SetPosition(NewTokenPosition($1)) } - | T_PRIVATE { $$ = node.NewIdentifier($1).SetPosition(NewTokenPosition($1)) } - | T_STATIC { $$ = node.NewIdentifier($1).SetPosition(NewTokenPosition($1)) } - | T_ABSTRACT { $$ = node.NewIdentifier($1).SetPosition(NewTokenPosition($1)) } - | T_FINAL { $$ = node.NewIdentifier($1).SetPosition(NewTokenPosition($1)) } + T_PUBLIC { $$ = node.NewIdentifier($1.Value).SetPosition(NewTokenPosition($1)) } + | T_PROTECTED { $$ = node.NewIdentifier($1.Value).SetPosition(NewTokenPosition($1)) } + | T_PRIVATE { $$ = node.NewIdentifier($1.Value).SetPosition(NewTokenPosition($1)) } + | T_STATIC { $$ = node.NewIdentifier($1.Value).SetPosition(NewTokenPosition($1)) } + | T_ABSTRACT { $$ = node.NewIdentifier($1.Value).SetPosition(NewTokenPosition($1)) } + | T_FINAL { $$ = node.NewIdentifier($1.Value).SetPosition(NewTokenPosition($1)) } ; property_list: @@ -859,13 +859,13 @@ property_list: property: T_VARIABLE backup_doc_comment { - identifier := node.NewIdentifier($1).SetPosition(NewTokenPosition($1)) + identifier := node.NewIdentifier($1.Value).SetPosition(NewTokenPosition($1)) variable := expr.NewVariable(identifier).SetPosition(NewTokenPosition($1)) $$ = stmt.NewProperty(variable, nil, $2).SetPosition(NewTokenPosition($1)) } | T_VARIABLE '=' expr backup_doc_comment { - identifier := node.NewIdentifier($1).SetPosition(NewTokenPosition($1)) + identifier := node.NewIdentifier($1.Value).SetPosition(NewTokenPosition($1)) variable := expr.NewVariable(identifier).SetPosition(NewTokenPosition($1)) $$ = stmt.NewProperty(variable, $3, $4).SetPosition(NewTokenNodePosition($1, $3)) } @@ -879,7 +879,7 @@ class_const_list: class_const_decl: identifier '=' expr backup_doc_comment { - name := node.NewIdentifier($1).SetPosition(NewTokenPosition($1)) + name := node.NewIdentifier($1.Value).SetPosition(NewTokenPosition($1)) $$ = stmt.NewConstant(name, $3, $4).SetPosition(NewTokenNodePosition($1, $3)) } ; @@ -887,7 +887,7 @@ class_const_decl: const_decl: T_STRING '=' expr backup_doc_comment { - name := node.NewIdentifier($1).SetPosition(NewTokenPosition($1)) + name := node.NewIdentifier($1.Value).SetPosition(NewTokenPosition($1)) $$ = stmt.NewConstant(name, $3, $4).SetPosition(NewTokenNodePosition($1, $3)) } ; @@ -1050,13 +1050,13 @@ lexical_var_list: lexical_var: T_VARIABLE { - identifier := node.NewIdentifier($1).SetPosition(NewTokenPosition($1)) + identifier := node.NewIdentifier($1.Value).SetPosition(NewTokenPosition($1)) variable := expr.NewVariable(identifier).SetPosition(NewTokenPosition($1)) $$ = expr.NewClusureUse(variable, false).SetPosition(NewTokenPosition($1)) } | '&' T_VARIABLE { - identifier := node.NewIdentifier($2).SetPosition(NewTokenPosition($2)) + identifier := node.NewIdentifier($2.Value).SetPosition(NewTokenPosition($2)) variable := expr.NewVariable(identifier).SetPosition(NewTokenPosition($2)) $$ = expr.NewClusureUse(variable, true).SetPosition(NewTokensPosition($1, $2)) } @@ -1076,7 +1076,7 @@ function_call: ; class_name: - T_STATIC { $$ = node.NewIdentifier($1).SetPosition(NewTokenPosition($1)) } + T_STATIC { $$ = node.NewIdentifier($1.Value).SetPosition(NewTokenPosition($1)) } | name { $$ = $1; } ; @@ -1130,9 +1130,9 @@ scalar: constant: name { $$ = expr.NewConstFetch($1).SetPosition(NewNodePosition($1)) } - | class_name T_PAAMAYIM_NEKUDOTAYIM identifier { $$ = expr.NewClassConstFetch($1, node.NewIdentifier($3).SetPosition(NewTokenPosition($3))).SetPosition(NewNodeTokenPosition($1, $3)) } + | class_name T_PAAMAYIM_NEKUDOTAYIM identifier { $$ = expr.NewClassConstFetch($1, node.NewIdentifier($3.Value).SetPosition(NewTokenPosition($3))).SetPosition(NewNodeTokenPosition($1, $3)) } | variable_class_name T_PAAMAYIM_NEKUDOTAYIM identifier - { $$ = expr.NewClassConstFetch($1, node.NewIdentifier($3).SetPosition(NewTokenPosition($3))).SetPosition(NewNodeTokenPosition($1, $3)) } + { $$ = expr.NewClassConstFetch($1, node.NewIdentifier($3.Value).SetPosition(NewTokenPosition($3))).SetPosition(NewNodeTokenPosition($1, $3)) } ; expr: @@ -1178,7 +1178,7 @@ variable: ; simple_variable: - T_VARIABLE { $$ = expr.NewVariable(node.NewIdentifier($1).SetPosition(NewTokenPosition($1))).SetPosition(NewTokenPosition($1)) } + T_VARIABLE { $$ = expr.NewVariable(node.NewIdentifier($1.Value).SetPosition(NewTokenPosition($1))).SetPosition(NewTokenPosition($1)) } | '$' '{' expr '}' { $$ = expr.NewVariable($3).SetPosition(NewTokensPosition($1, $4)) } | '$' simple_variable { $$ = expr.NewVariable($2).SetPosition(NewTokenNodePosition($1, $2)) } ; @@ -1210,13 +1210,13 @@ new_variable: ; member_name: - identifier { $$ = node.NewIdentifier($1).SetPosition(NewTokenPosition($1)) } + identifier { $$ = node.NewIdentifier($1.Value).SetPosition(NewTokenPosition($1)) } | '{' expr '}' { $$ = $2; } | simple_variable { $$ = $1 } ; property_name: - T_STRING { $$ = node.NewIdentifier($1).SetPosition(NewTokenPosition($1)) } + T_STRING { $$ = node.NewIdentifier($1.Value).SetPosition(NewTokenPosition($1)) } | '{' expr '}' { $$ = $2; } | simple_variable { $$ = $1 } ; @@ -1272,25 +1272,25 @@ encaps_list: ; encaps_var: - T_VARIABLE { $$ = expr.NewVariable(node.NewIdentifier($1).SetPosition(NewTokenPosition($1))).SetPosition(NewTokenPosition($1)) } + T_VARIABLE { $$ = expr.NewVariable(node.NewIdentifier($1.Value).SetPosition(NewTokenPosition($1))).SetPosition(NewTokenPosition($1)) } | T_VARIABLE '[' encaps_var_offset ']' { - identifier := node.NewIdentifier($1).SetPosition(NewTokenPosition($1)) + identifier := node.NewIdentifier($1.Value).SetPosition(NewTokenPosition($1)) variable := expr.NewVariable(identifier).SetPosition(NewTokenPosition($1)) $$ = expr.NewArrayDimFetch(variable, $3).SetPosition(NewTokensPosition($1, $4)) } | T_VARIABLE T_OBJECT_OPERATOR T_STRING { - identifier := node.NewIdentifier($1).SetPosition(NewTokenPosition($1)) + identifier := node.NewIdentifier($1.Value).SetPosition(NewTokenPosition($1)) variable := expr.NewVariable(identifier).SetPosition(NewTokenPosition($1)) - $$ = expr.NewPropertyFetch(variable, node.NewIdentifier($3).SetPosition(NewTokenPosition($3))). + $$ = expr.NewPropertyFetch(variable, node.NewIdentifier($3.Value).SetPosition(NewTokenPosition($3))). SetPosition(NewTokensPosition($1, $3)) } | T_DOLLAR_OPEN_CURLY_BRACES expr '}' { $$ = expr.NewVariable($2).SetPosition(NewTokensPosition($1, $3)) } - | T_DOLLAR_OPEN_CURLY_BRACES T_STRING_VARNAME '}' { $$ = expr.NewVariable(node.NewIdentifier($2).SetPosition(NewTokenPosition($2))).SetPosition(NewTokensPosition($1, $3)) } + | T_DOLLAR_OPEN_CURLY_BRACES T_STRING_VARNAME '}' { $$ = expr.NewVariable(node.NewIdentifier($2.Value).SetPosition(NewTokenPosition($2))).SetPosition(NewTokensPosition($1, $3)) } | T_DOLLAR_OPEN_CURLY_BRACES T_STRING_VARNAME '[' expr ']' '}' { - identifier := node.NewIdentifier($2).SetPosition(NewTokenPosition($2)) + identifier := node.NewIdentifier($2.Value).SetPosition(NewTokenPosition($2)) variable := expr.NewVariable(identifier).SetPosition(NewTokenPosition($2)) $$ = expr.NewArrayDimFetch(variable, $4).SetPosition(NewTokensPosition($1, $6)) } @@ -1320,7 +1320,7 @@ encaps_var_offset: } | T_VARIABLE { - identifier := node.NewIdentifier($1).SetPosition(NewTokenPosition($1)) + identifier := node.NewIdentifier($1.Value).SetPosition(NewTokenPosition($1)) $$ = expr.NewVariable(identifier).SetPosition(NewTokenPosition($1)) } ;