label node

This commit is contained in:
vadim
2017-12-08 12:01:52 +02:00
parent c25748d7db
commit 92688ac8d2
3 changed files with 27 additions and 2 deletions

25
node/stmt/label.go Normal file
View File

@@ -0,0 +1,25 @@
package stmt
import (
"fmt"
"io"
"github.com/z7zmey/php-parser/node"
"github.com/z7zmey/php-parser/token"
)
type Label struct {
node.SimpleNode
token token.Token
}
func NewLabel(token token.Token) node.Node {
return Label{
node.SimpleNode{Name: "Label", Attributes: make(map[string]string)},
token,
}
}
func (n Label) 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)
}