php-parser/node/stmt/echo.go
2017-12-07 11:35:45 +02:00

35 lines
661 B
Go

package stmt
import (
"fmt"
"io"
"github.com/z7zmey/php-parser/node"
"github.com/z7zmey/php-parser/token"
)
type Echo struct {
node.SimpleNode
token token.Token
exprs []node.Node
}
func NewEcho(token token.Token, exprs []node.Node) node.Node {
return Echo{
node.SimpleNode{Name: "Echo", Attributes: make(map[string]string)},
token,
exprs,
}
}
func (n Echo) 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)
if n.exprs != nil {
fmt.Fprintf(out, "\n%vexprs:", indent+" ")
for _, nn := range n.exprs {
nn.Print(out, indent+" ")
}
}
}