php-parser/node/expr/variable.go

26 lines
496 B
Go
Raw Normal View History

2017-12-06 13:04:44 +00:00
package expr
import (
"fmt"
"io"
"github.com/z7zmey/php-parser/node"
"github.com/z7zmey/php-parser/token"
)
type Variable struct {
node.SimpleNode
token token.Token
}
func NewVariable(token token.Token) node.Node {
return Variable{
node.SimpleNode{Name: "Variable", Attributes: make(map[string]string)},
token,
}
}
func (n Variable) Print(out io.Writer, indent string) {
fmt.Fprintf(out, "\n%v%v [%d %d] %q", indent, n.Name, n.token.StartLine, n.token.EndLine, n.token.Value)
}