unary_plus unary_minus boolean_not bitwise_not nodes
This commit is contained in:
29
node/expr/bitwise_not.go
Normal file
29
node/expr/bitwise_not.go
Normal file
@@ -0,0 +1,29 @@
|
||||
package expr
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io"
|
||||
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
)
|
||||
|
||||
type BitwiseNot struct {
|
||||
node.SimpleNode
|
||||
expr node.Node
|
||||
}
|
||||
|
||||
func NewBitwiseNot(expression node.Node) node.Node {
|
||||
return BitwiseNot{
|
||||
node.SimpleNode{Name: "BitwiseNot", Attributes: make(map[string]string)},
|
||||
expression,
|
||||
}
|
||||
}
|
||||
|
||||
func (n BitwiseNot) 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+" ")
|
||||
}
|
||||
}
|
||||
29
node/expr/boolean_not.go
Normal file
29
node/expr/boolean_not.go
Normal file
@@ -0,0 +1,29 @@
|
||||
package expr
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io"
|
||||
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
)
|
||||
|
||||
type BooleanNot struct {
|
||||
node.SimpleNode
|
||||
expr node.Node
|
||||
}
|
||||
|
||||
func NewBooleanNot(expression node.Node) node.Node {
|
||||
return BooleanNot{
|
||||
node.SimpleNode{Name: "BooleanNot", Attributes: make(map[string]string)},
|
||||
expression,
|
||||
}
|
||||
}
|
||||
|
||||
func (n BooleanNot) 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+" ")
|
||||
}
|
||||
}
|
||||
29
node/expr/unary_minus.go
Normal file
29
node/expr/unary_minus.go
Normal file
@@ -0,0 +1,29 @@
|
||||
package expr
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io"
|
||||
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
)
|
||||
|
||||
type UnaryMinus struct {
|
||||
node.SimpleNode
|
||||
expr node.Node
|
||||
}
|
||||
|
||||
func NewUnaryMinus(expression node.Node) node.Node {
|
||||
return UnaryMinus{
|
||||
node.SimpleNode{Name: "UnaryMinus", Attributes: make(map[string]string)},
|
||||
expression,
|
||||
}
|
||||
}
|
||||
|
||||
func (n UnaryMinus) 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+" ")
|
||||
}
|
||||
}
|
||||
29
node/expr/unary_plus.go
Normal file
29
node/expr/unary_plus.go
Normal file
@@ -0,0 +1,29 @@
|
||||
package expr
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io"
|
||||
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
)
|
||||
|
||||
type UnaryPlus struct {
|
||||
node.SimpleNode
|
||||
expr node.Node
|
||||
}
|
||||
|
||||
func NewUnaryPlus(expression node.Node) node.Node {
|
||||
return UnaryPlus{
|
||||
node.SimpleNode{Name: "UnaryPlus", Attributes: make(map[string]string)},
|
||||
expression,
|
||||
}
|
||||
}
|
||||
|
||||
func (n UnaryPlus) 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+" ")
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user