expr assign binary and cast nodes
This commit is contained in:
29
node/expr/cast/cast.go
Normal file
29
node/expr/cast/cast.go
Normal 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+" ")
|
||||
}
|
||||
}
|
||||
18
node/expr/cast/cast_array.go
Normal file
18
node/expr/cast/cast_array.go
Normal 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,
|
||||
},
|
||||
}
|
||||
}
|
||||
18
node/expr/cast/cast_bool.go
Normal file
18
node/expr/cast/cast_bool.go
Normal 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,
|
||||
},
|
||||
}
|
||||
}
|
||||
18
node/expr/cast/cast_double.go
Normal file
18
node/expr/cast/cast_double.go
Normal 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,
|
||||
},
|
||||
}
|
||||
}
|
||||
18
node/expr/cast/cast_int.go
Normal file
18
node/expr/cast/cast_int.go
Normal 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,
|
||||
},
|
||||
}
|
||||
}
|
||||
18
node/expr/cast/cast_object.go
Normal file
18
node/expr/cast/cast_object.go
Normal 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,
|
||||
},
|
||||
}
|
||||
}
|
||||
18
node/expr/cast/cast_string.go
Normal file
18
node/expr/cast/cast_string.go
Normal 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,
|
||||
},
|
||||
}
|
||||
}
|
||||
18
node/expr/cast/cast_unset.go
Normal file
18
node/expr/cast/cast_unset.go
Normal 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,
|
||||
},
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user