php-parser/node/stmt/stmt_list.go

36 lines
532 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"
)
2017-12-27 17:55:58 +00:00
func(n StmtList) Name() string {
return "StmtList"
}
2017-12-07 09:46:25 +00:00
type StmtList struct {
2017-12-27 17:55:58 +00:00
name string
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{
2017-12-27 17:55:58 +00:00
"StmtList",
2017-12-07 09:46:25 +00:00
stmts,
}
}
func (n StmtList) Print(out io.Writer, indent string) {
2017-12-27 17:55:58 +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+" ")
}
}
}