empty eval include include_once require require_once nodes

This commit is contained in:
z7zmey
2017-12-16 23:25:32 +02:00
parent 52638e6654
commit c6729a06e2
8 changed files with 186 additions and 12 deletions

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

@@ -0,0 +1,29 @@
package expr
import (
"fmt"
"io"
"github.com/z7zmey/php-parser/node"
)
type Empty struct {
node.SimpleNode
expr node.Node
}
func NewEmpty(expression node.Node) node.Node {
return Empty{
node.SimpleNode{Name: "Empty", Attributes: make(map[string]string)},
expression,
}
}
func (n Empty) 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/eval.go Normal file
View File

@@ -0,0 +1,29 @@
package expr
import (
"fmt"
"io"
"github.com/z7zmey/php-parser/node"
)
type Eval struct {
node.SimpleNode
expr node.Node
}
func NewEval(expression node.Node) node.Node {
return Eval{
node.SimpleNode{Name: "Eval", Attributes: make(map[string]string)},
expression,
}
}
func (n Eval) 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/include.go Normal file
View File

@@ -0,0 +1,29 @@
package expr
import (
"fmt"
"io"
"github.com/z7zmey/php-parser/node"
)
type Include struct {
node.SimpleNode
expr node.Node
}
func NewInclude(expression node.Node) node.Node {
return Include{
node.SimpleNode{Name: "Include", Attributes: make(map[string]string)},
expression,
}
}
func (n Include) 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/include_once.go Normal file
View File

@@ -0,0 +1,29 @@
package expr
import (
"fmt"
"io"
"github.com/z7zmey/php-parser/node"
)
type IncludeOnce struct {
node.SimpleNode
expr node.Node
}
func NewIncludeOnce(expression node.Node) node.Node {
return IncludeOnce{
node.SimpleNode{Name: "IncludeOnce", Attributes: make(map[string]string)},
expression,
}
}
func (n IncludeOnce) 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/require.go Normal file
View File

@@ -0,0 +1,29 @@
package expr
import (
"fmt"
"io"
"github.com/z7zmey/php-parser/node"
)
type Require struct {
node.SimpleNode
expr node.Node
}
func NewRequire(expression node.Node) node.Node {
return Require{
node.SimpleNode{Name: "Require", Attributes: make(map[string]string)},
expression,
}
}
func (n Require) 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/require_once.go Normal file
View File

@@ -0,0 +1,29 @@
package expr
import (
"fmt"
"io"
"github.com/z7zmey/php-parser/node"
)
type RequireOnce struct {
node.SimpleNode
expr node.Node
}
func NewRequireOnce(expression node.Node) node.Node {
return RequireOnce{
node.SimpleNode{Name: "RequireOnce", Attributes: make(map[string]string)},
expression,
}
}
func (n RequireOnce) 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+" ")
}
}