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