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

29
node/expr/cast/cast.go Normal file
View File

@@ -0,0 +1,29 @@
package cast
import (
"fmt"
"io"
"github.com/z7zmey/php-parser/node"
)
type Cast struct {
node.SimpleNode
expr node.Node
}
func NewCast(expr node.Node) node.Node {
return Cast{
node.SimpleNode{Name: "Cast", Attributes: make(map[string]string)},
expr,
}
}
func (n Cast) Print(out io.Writer, indent string) {
fmt.Fprintf(out, "\n%v%v [- -]", indent, n.Name)
if n.expr != nil {
fmt.Fprintf(out, "\n%vexpr:", indent+" ")
n.expr.Print(out, indent+" ")
}
}

View File

@@ -0,0 +1,18 @@
package cast
import (
"github.com/z7zmey/php-parser/node"
)
type CastArray struct {
Cast
}
func NewCastArray(expr node.Node) node.Node {
return CastArray{
Cast{
node.SimpleNode{Name: "CastArray", Attributes: make(map[string]string)},
expr,
},
}
}

View File

@@ -0,0 +1,18 @@
package cast
import (
"github.com/z7zmey/php-parser/node"
)
type CastBool struct {
Cast
}
func NewCastBool(expr node.Node) node.Node {
return CastBool{
Cast{
node.SimpleNode{Name: "CastBool", Attributes: make(map[string]string)},
expr,
},
}
}

View File

@@ -0,0 +1,18 @@
package cast
import (
"github.com/z7zmey/php-parser/node"
)
type CastDouble struct {
Cast
}
func NewCastDouble(expr node.Node) node.Node {
return CastDouble{
Cast{
node.SimpleNode{Name: "CastDouble", Attributes: make(map[string]string)},
expr,
},
}
}

View File

@@ -0,0 +1,18 @@
package cast
import (
"github.com/z7zmey/php-parser/node"
)
type CastInt struct {
Cast
}
func NewCastInt(expr node.Node) node.Node {
return CastInt{
Cast{
node.SimpleNode{Name: "CastInt", Attributes: make(map[string]string)},
expr,
},
}
}

View File

@@ -0,0 +1,18 @@
package cast
import (
"github.com/z7zmey/php-parser/node"
)
type CastObject struct {
Cast
}
func NewCastObject(expr node.Node) node.Node {
return CastObject{
Cast{
node.SimpleNode{Name: "CastObject", Attributes: make(map[string]string)},
expr,
},
}
}

View File

@@ -0,0 +1,18 @@
package cast
import (
"github.com/z7zmey/php-parser/node"
)
type CastString struct {
Cast
}
func NewCastString(expr node.Node) node.Node {
return CastString{
Cast{
node.SimpleNode{Name: "CastString", Attributes: make(map[string]string)},
expr,
},
}
}

View File

@@ -0,0 +1,18 @@
package cast
import (
"github.com/z7zmey/php-parser/node"
)
type CastUnset struct {
Cast
}
func NewCastUnset(expr node.Node) node.Node {
return CastUnset{
Cast{
node.SimpleNode{Name: "CastUnset", Attributes: make(map[string]string)},
expr,
},
}
}