2017-12-06 13:04:44 +00:00
|
|
|
package expr
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
"io"
|
|
|
|
|
|
|
|
"github.com/z7zmey/php-parser/node"
|
|
|
|
)
|
|
|
|
|
|
|
|
type Variable struct {
|
|
|
|
node.SimpleNode
|
2017-12-18 18:35:29 +00:00
|
|
|
name node.Node
|
2017-12-06 13:04:44 +00:00
|
|
|
}
|
|
|
|
|
2017-12-18 18:35:29 +00:00
|
|
|
func NewVariable(name node.Node) node.Node {
|
2017-12-06 13:04:44 +00:00
|
|
|
return Variable{
|
|
|
|
node.SimpleNode{Name: "Variable", Attributes: make(map[string]string)},
|
2017-12-18 18:35:29 +00:00
|
|
|
name,
|
2017-12-06 13:04:44 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func (n Variable) Print(out io.Writer, indent string) {
|
2017-12-18 18:35:29 +00:00
|
|
|
fmt.Fprintf(out, "\n%v%v [- -]", indent, n.Name)
|
|
|
|
|
|
|
|
if n.name != nil {
|
|
|
|
fmt.Fprintf(out, "\n%vname:", indent+" ")
|
|
|
|
n.name.Print(out, indent+" ")
|
|
|
|
}
|
2017-12-06 13:04:44 +00:00
|
|
|
}
|