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