php-parser/node/scalar/encapsed_string_part.go

29 lines
605 B
Go
Raw Normal View History

2017-12-04 22:02:24 +00:00
package scalar
import (
"fmt"
"github.com/z7zmey/php-parser/token"
"github.com/z7zmey/php-parser/node"
"io"
)
type EncapsedStringPart struct {
node.SimpleNode
token token.Token
}
func NewEncapsedStringPart(t token.Token) node.Node {
return EncapsedStringPart{
node.SimpleNode{Name: "EncapsedStringPart", Attributes: make(map[string]string)},
t,
}
}
func (n EncapsedStringPart) 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)
for _, nn := range n.Children {
nn.Print(out, indent+" ")
}
}