php-parser/node/stmt/stmt_list.go

32 lines
540 B
Go
Raw Normal View History

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