php-parser/node/stmt/alt_else.go

37 lines
626 B
Go
Raw Normal View History

2017-12-18 22:55:57 +00:00
package stmt
import (
2017-12-27 17:55:58 +00:00
"fmt"
"io"
2017-12-18 22:55:57 +00:00
"github.com/z7zmey/php-parser/node"
"github.com/z7zmey/php-parser/token"
)
2017-12-27 17:55:58 +00:00
func(n AltElse) Name() string {
return "AltElse"
}
2017-12-18 22:55:57 +00:00
type AltElse struct {
2017-12-27 17:55:58 +00:00
name string
token token.Token
stmt node.Node
2017-12-18 22:55:57 +00:00
}
func NewAltElse(token token.Token, stmt node.Node) node.Node {
return AltElse{
2017-12-27 17:55:58 +00:00
"AltElse",
token,
stmt,
}
}
func (n AltElse) 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.stmt != nil {
fmt.Fprintf(out, "\n%vstmt:", indent+" ")
n.stmt.Print(out, indent+" ")
2017-12-18 22:55:57 +00:00
}
}