expr assign binary and cast nodes

This commit is contained in:
z7zmey
2017-12-12 23:26:00 +02:00
parent ddf72d4b4f
commit d7a593ef3b
52 changed files with 1584 additions and 580 deletions

View File

@@ -0,0 +1,36 @@
package binary_op
import (
"fmt"
"io"
"github.com/z7zmey/php-parser/node"
)
type BinaryOp struct {
node.SimpleNode
left node.Node
right node.Node
}
func NewBinaryOp(left node.Node, right node.Node) node.Node {
return BinaryOp{
node.SimpleNode{Name: "BinaryOp", Attributes: make(map[string]string)},
left,
right,
}
}
func (n BinaryOp) Print(out io.Writer, indent string) {
fmt.Fprintf(out, "\n%v%v [- -]", indent, n.Name)
if n.left != nil {
fmt.Fprintf(out, "\n%vleft:", indent+" ")
n.left.Print(out, indent+" ")
}
if n.right != nil {
fmt.Fprintf(out, "\n%vright:", indent+" ")
n.right.Print(out, indent+" ")
}
}

View File

@@ -0,0 +1,19 @@
package binary_op
import (
"github.com/z7zmey/php-parser/node"
)
type BitwiseAnd struct {
BinaryOp
}
func NewBitwiseAnd(variable node.Node, expression node.Node) node.Node {
return BitwiseAnd{
BinaryOp{
node.SimpleNode{Name: "BinaryBitwiseAnd", Attributes: make(map[string]string)},
variable,
expression,
},
}
}

View File

@@ -0,0 +1,19 @@
package binary_op
import (
"github.com/z7zmey/php-parser/node"
)
type BitwiseOr struct {
BinaryOp
}
func NewBitwiseOr(variable node.Node, expression node.Node) node.Node {
return BitwiseOr{
BinaryOp{
node.SimpleNode{Name: "BinaryBitwiseOr", Attributes: make(map[string]string)},
variable,
expression,
},
}
}

View File

@@ -0,0 +1,19 @@
package binary_op
import (
"github.com/z7zmey/php-parser/node"
)
type BitwiseXor struct {
BinaryOp
}
func NewBitwiseXor(variable node.Node, expression node.Node) node.Node {
return BitwiseXor{
BinaryOp{
node.SimpleNode{Name: "BinaryBitwiseXor", Attributes: make(map[string]string)},
variable,
expression,
},
}
}

View File

@@ -0,0 +1,19 @@
package binary_op
import (
"github.com/z7zmey/php-parser/node"
)
type BooleanAnd struct {
BinaryOp
}
func NewBooleanAnd(variable node.Node, expression node.Node) node.Node {
return BooleanAnd{
BinaryOp{
node.SimpleNode{Name: "BinaryBooleanAnd", Attributes: make(map[string]string)},
variable,
expression,
},
}
}

View File

@@ -0,0 +1,19 @@
package binary_op
import (
"github.com/z7zmey/php-parser/node"
)
type BooleanOr struct {
BinaryOp
}
func NewBooleanOr(variable node.Node, expression node.Node) node.Node {
return BooleanOr{
BinaryOp{
node.SimpleNode{Name: "BinaryBooleanOr", Attributes: make(map[string]string)},
variable,
expression,
},
}
}

View File

@@ -0,0 +1,19 @@
package binary_op
import (
"github.com/z7zmey/php-parser/node"
)
type Coalesce struct {
BinaryOp
}
func NewCoalesce(variable node.Node, expression node.Node) node.Node {
return Coalesce{
BinaryOp{
node.SimpleNode{Name: "BinaryCoalesce", Attributes: make(map[string]string)},
variable,
expression,
},
}
}

View File

@@ -0,0 +1,19 @@
package binary_op
import (
"github.com/z7zmey/php-parser/node"
)
type Concat struct {
BinaryOp
}
func NewConcat(variable node.Node, expression node.Node) node.Node {
return Concat{
BinaryOp{
node.SimpleNode{Name: "BinaryConcat", Attributes: make(map[string]string)},
variable,
expression,
},
}
}

View File

@@ -0,0 +1,19 @@
package binary_op
import (
"github.com/z7zmey/php-parser/node"
)
type Div struct {
BinaryOp
}
func NewDiv(variable node.Node, expression node.Node) node.Node {
return Div{
BinaryOp{
node.SimpleNode{Name: "BinaryDiv", Attributes: make(map[string]string)},
variable,
expression,
},
}
}

View File

@@ -0,0 +1,19 @@
package binary_op
import (
"github.com/z7zmey/php-parser/node"
)
type Equal struct {
BinaryOp
}
func NewEqual(variable node.Node, expression node.Node) node.Node {
return Equal{
BinaryOp{
node.SimpleNode{Name: "BinaryEqual", Attributes: make(map[string]string)},
variable,
expression,
},
}
}

View File

@@ -0,0 +1,19 @@
package binary_op
import (
"github.com/z7zmey/php-parser/node"
)
type Greater struct {
BinaryOp
}
func NewGreater(variable node.Node, expression node.Node) node.Node {
return Greater{
BinaryOp{
node.SimpleNode{Name: "BinaryGreater", Attributes: make(map[string]string)},
variable,
expression,
},
}
}

View File

@@ -0,0 +1,19 @@
package binary_op
import (
"github.com/z7zmey/php-parser/node"
)
type GreaterOrEqual struct {
BinaryOp
}
func NewGreaterOrEqual(variable node.Node, expression node.Node) node.Node {
return GreaterOrEqual{
BinaryOp{
node.SimpleNode{Name: "BinaryGreaterOrEqual", Attributes: make(map[string]string)},
variable,
expression,
},
}
}

View File

@@ -0,0 +1,19 @@
package binary_op
import (
"github.com/z7zmey/php-parser/node"
)
type Identical struct {
BinaryOp
}
func NewIdentical(variable node.Node, expression node.Node) node.Node {
return Identical{
BinaryOp{
node.SimpleNode{Name: "BinaryIdentical", Attributes: make(map[string]string)},
variable,
expression,
},
}
}

View File

@@ -0,0 +1,19 @@
package binary_op
import (
"github.com/z7zmey/php-parser/node"
)
type LogicalAnd struct {
BinaryOp
}
func NewLogicalAnd(variable node.Node, expression node.Node) node.Node {
return LogicalAnd{
BinaryOp{
node.SimpleNode{Name: "BinaryLogicalAnd", Attributes: make(map[string]string)},
variable,
expression,
},
}
}

View File

@@ -0,0 +1,19 @@
package binary_op
import (
"github.com/z7zmey/php-parser/node"
)
type LogicalOr struct {
BinaryOp
}
func NewLogicalOr(variable node.Node, expression node.Node) node.Node {
return LogicalOr{
BinaryOp{
node.SimpleNode{Name: "BinaryLogicalOr", Attributes: make(map[string]string)},
variable,
expression,
},
}
}

View File

@@ -0,0 +1,19 @@
package binary_op
import (
"github.com/z7zmey/php-parser/node"
)
type LogicalXor struct {
BinaryOp
}
func NewLogicalXor(variable node.Node, expression node.Node) node.Node {
return LogicalXor{
BinaryOp{
node.SimpleNode{Name: "BinaryLogicalXor", Attributes: make(map[string]string)},
variable,
expression,
},
}
}

View File

@@ -0,0 +1,19 @@
package binary_op
import (
"github.com/z7zmey/php-parser/node"
)
type Minus struct {
BinaryOp
}
func NewMinus(variable node.Node, expression node.Node) node.Node {
return Minus{
BinaryOp{
node.SimpleNode{Name: "BinaryMinus", Attributes: make(map[string]string)},
variable,
expression,
},
}
}

View File

@@ -0,0 +1,19 @@
package binary_op
import (
"github.com/z7zmey/php-parser/node"
)
type Mod struct {
BinaryOp
}
func NewMod(variable node.Node, expression node.Node) node.Node {
return Mod{
BinaryOp{
node.SimpleNode{Name: "BinaryMod", Attributes: make(map[string]string)},
variable,
expression,
},
}
}

View File

@@ -0,0 +1,19 @@
package binary_op
import (
"github.com/z7zmey/php-parser/node"
)
type Mul struct {
BinaryOp
}
func NewMul(variable node.Node, expression node.Node) node.Node {
return Mul{
BinaryOp{
node.SimpleNode{Name: "BinaryMul", Attributes: make(map[string]string)},
variable,
expression,
},
}
}

View File

@@ -0,0 +1,19 @@
package binary_op
import (
"github.com/z7zmey/php-parser/node"
)
type NotEqual struct {
BinaryOp
}
func NewNotEqual(variable node.Node, expression node.Node) node.Node {
return NotEqual{
BinaryOp{
node.SimpleNode{Name: "BinaryNotEqual", Attributes: make(map[string]string)},
variable,
expression,
},
}
}

View File

@@ -0,0 +1,19 @@
package binary_op
import (
"github.com/z7zmey/php-parser/node"
)
type NotIdentical struct {
BinaryOp
}
func NewNotIdentical(variable node.Node, expression node.Node) node.Node {
return NotIdentical{
BinaryOp{
node.SimpleNode{Name: "BinaryNotIdentical", Attributes: make(map[string]string)},
variable,
expression,
},
}
}

View File

@@ -0,0 +1,19 @@
package binary_op
import (
"github.com/z7zmey/php-parser/node"
)
type Plus struct {
BinaryOp
}
func NewPlus(variable node.Node, expression node.Node) node.Node {
return Plus{
BinaryOp{
node.SimpleNode{Name: "BinaryPlus", Attributes: make(map[string]string)},
variable,
expression,
},
}
}

View File

@@ -0,0 +1,19 @@
package binary_op
import (
"github.com/z7zmey/php-parser/node"
)
type Pow struct {
BinaryOp
}
func NewPow(variable node.Node, expression node.Node) node.Node {
return Pow{
BinaryOp{
node.SimpleNode{Name: "BinaryPow", Attributes: make(map[string]string)},
variable,
expression,
},
}
}

View File

@@ -0,0 +1,19 @@
package binary_op
import (
"github.com/z7zmey/php-parser/node"
)
type ShiftLeft struct {
BinaryOp
}
func NewShiftLeft(variable node.Node, expression node.Node) node.Node {
return ShiftLeft{
BinaryOp{
node.SimpleNode{Name: "BinaryShiftLeft", Attributes: make(map[string]string)},
variable,
expression,
},
}
}

View File

@@ -0,0 +1,19 @@
package binary_op
import (
"github.com/z7zmey/php-parser/node"
)
type ShiftRight struct {
BinaryOp
}
func NewShiftRight(variable node.Node, expression node.Node) node.Node {
return ShiftRight{
BinaryOp{
node.SimpleNode{Name: "BinaryShiftRight", Attributes: make(map[string]string)},
variable,
expression,
},
}
}

View File

@@ -0,0 +1,19 @@
package binary_op
import (
"github.com/z7zmey/php-parser/node"
)
type Smaller struct {
BinaryOp
}
func NewSmaller(variable node.Node, expression node.Node) node.Node {
return Smaller{
BinaryOp{
node.SimpleNode{Name: "BinarySmaller", Attributes: make(map[string]string)},
variable,
expression,
},
}
}

View File

@@ -0,0 +1,19 @@
package binary_op
import (
"github.com/z7zmey/php-parser/node"
)
type SmallerOrEqual struct {
BinaryOp
}
func NewSmallerOrEqual(variable node.Node, expression node.Node) node.Node {
return SmallerOrEqual{
BinaryOp{
node.SimpleNode{Name: "BinarySmallerOrEqual", Attributes: make(map[string]string)},
variable,
expression,
},
}
}

View File

@@ -0,0 +1,19 @@
package binary_op
import (
"github.com/z7zmey/php-parser/node"
)
type Spaceship struct {
BinaryOp
}
func NewSpaceship(variable node.Node, expression node.Node) node.Node {
return Spaceship{
BinaryOp{
node.SimpleNode{Name: "BinarySpaceship", Attributes: make(map[string]string)},
variable,
expression,
},
}
}