php-parser/node/name/name_part.go

31 lines
431 B
Go
Raw Normal View History

2017-12-05 21:36:28 +00:00
package name
import (
2017-12-27 17:55:58 +00:00
"github.com/z7zmey/php-parser/node"
"github.com/z7zmey/php-parser/token"
2017-12-05 21:36:28 +00:00
)
2017-12-27 23:23:32 +00:00
func (n NamePart) Name() string {
2017-12-27 17:55:58 +00:00
return "NamePart"
}
2017-12-05 21:36:28 +00:00
type NamePart struct {
2017-12-27 17:55:58 +00:00
name string
2017-12-05 21:36:28 +00:00
token token.Token
}
func NewNamePart(token token.Token) node.Node {
return NamePart{
2017-12-27 17:55:58 +00:00
"NamePart",
2017-12-05 21:36:28 +00:00
token,
}
}
2017-12-27 23:23:32 +00:00
func (n NamePart) Walk(v node.Visitor) {
2017-12-28 11:36:27 +00:00
if v.EnterNode(n) == false {
2017-12-27 23:23:32 +00:00
return
}
v.Scalar("token", n.token.Value)
2017-12-05 21:36:28 +00:00
}