php-parser/node/node_scalar_string.go

29 lines
544 B
Go
Raw Normal View History

2017-12-03 21:29:17 +00:00
package node
import (
"fmt"
"github.com/z7zmey/php-parser/token"
"io"
)
type NodeScalarString struct {
2017-12-04 21:24:12 +00:00
*SimpleNode
2017-12-03 21:29:17 +00:00
token token.Token
}
func NewNodeScalarString(t token.Token) Node {
return NodeScalarString{
2017-12-04 21:24:12 +00:00
&SimpleNode{Name: "NodeScalarString", Attributes: make(map[string]string)},
2017-12-03 21:29:17 +00:00
t,
}
}
func (n NodeScalarString) Print(out io.Writer, indent string) {
2017-12-04 21:24:12 +00:00
fmt.Fprintf(out, "\n%v%v [%d %d] %q", indent, n.Name, n.token.StartLine, n.token.EndLine, n.token.Value)
for _, nn := range n.Children {
2017-12-03 21:29:17 +00:00
nn.Print(out, indent+" ")
}
}