php-parser/node/nullable.go
2017-12-27 16:26:36 +02:00

28 lines
448 B
Go

package node
import (
"fmt"
"io"
)
type Nullable struct {
SimpleNode
expr Node
}
func NewNullable(expression Node) Node {
return Nullable{
SimpleNode{Name: "Nullable", Attributes: make(map[string]string)},
expression,
}
}
func (n Nullable) 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+" ")
}
}