php-parser/node/stmt/stmt_list.go
2017-12-19 00:55:57 +02:00

32 lines
540 B
Go

package stmt
import (
"fmt"
"io"
"github.com/z7zmey/php-parser/node"
)
type StmtList struct {
node.SimpleNode
stmts []node.Node
}
func NewStmtList(stmts []node.Node) node.Node {
return StmtList{
node.SimpleNode{Name: "StmtList", Attributes: make(map[string]string)},
stmts,
}
}
func (n StmtList) Print(out io.Writer, indent string) {
fmt.Fprintf(out, "\n%v%v [- -]", indent, n.Name)
if n.stmts != nil {
fmt.Fprintf(out, "\n%vstmts:", indent+" ")
for _, nn := range n.stmts {
nn.Print(out, indent+" ")
}
}
}