php-parser/node/scalar/string.go
2018-01-04 20:42:44 +02:00

50 lines
796 B
Go

package scalar
import (
"github.com/z7zmey/php-parser/node"
)
type String struct {
attributes map[string]interface{}
position *node.Position
}
func NewString(value string) node.Node {
return &String{
map[string]interface{}{
"value": value,
},
nil,
}
}
func (n String) Attributes() map[string]interface{} {
return n.attributes
}
func (n String) Attribute(key string) interface{} {
return n.attributes[key]
}
func (n String) SetAttribute(key string, value interface{}) node.Node {
n.attributes[key] = value
return n
}
func (n String) Position() *node.Position {
return n.position
}
func (n String) SetPosition(p *node.Position) node.Node {
n.position = p
return n
}
func (n String) Walk(v node.Visitor) {
if v.EnterNode(n) == false {
return
}
v.LeaveNode(n)
}