node position

This commit is contained in:
z7zmey
2017-12-31 12:59:22 +02:00
parent 8edc05c8d5
commit f2d972582f
158 changed files with 1644 additions and 5 deletions

View File

@@ -13,6 +13,7 @@ func NewFullyQualified(parts []node.Node) node.Node {
NameNode{
"FullyQualifiedName",
map[string]interface{}{},
nil,
parts,
},
}

View File

@@ -7,6 +7,7 @@ import (
type NameNode struct {
name string
attributes map[string]interface{}
position *node.Position
parts []node.Node
}
@@ -14,6 +15,7 @@ func NewName(parts []node.Node) node.Node {
return NameNode{
"Name",
map[string]interface{}{},
nil,
parts,
}
}
@@ -34,6 +36,15 @@ func (n NameNode) SetAttribute(key string, value interface{}) {
n.attributes[key] = value
}
func (n NameNode) Position() *node.Position {
return n.position
}
func (n NameNode) SetPosition(p *node.Position) node.Node {
n.position = p
return n
}
func (n NameNode) Walk(v node.Visitor) {
if v.EnterNode(n) == false {
return

View File

@@ -7,6 +7,7 @@ import (
type NamePart struct {
name string
attributes map[string]interface{}
position *node.Position
}
func NewNamePart(value string) node.Node {
@@ -15,6 +16,7 @@ func NewNamePart(value string) node.Node {
map[string]interface{}{
"value": value,
},
nil,
}
}
@@ -34,6 +36,15 @@ func (n NamePart) SetAttribute(key string, value interface{}) {
n.attributes[key] = value
}
func (n NamePart) Position() *node.Position {
return n.position
}
func (n NamePart) SetPosition(p *node.Position) node.Node {
n.position = p
return n
}
func (n NamePart) Walk(v node.Visitor) {
if v.EnterNode(n) == false {
return

View File

@@ -13,6 +13,7 @@ func NewRelative(parts []node.Node) node.Node {
NameNode{
"RelativeName",
map[string]interface{}{},
nil,
parts,
},
}