2019-06-03 11:07:12 -04:00
|
|
|
package ast
|
|
|
|
|
|
|
|
// FlagEnumAttr
|
|
|
|
type FlagEnumAttr struct {
|
2019-06-11 12:38:22 -04:00
|
|
|
Addr Address
|
|
|
|
Pos Position
|
|
|
|
Content string
|
|
|
|
ChildNodes []Node
|
2019-06-03 11:07:12 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
func parseFlagEnumAttr(line string) Node {
|
2019-06-11 12:38:22 -04:00
|
|
|
groups := groupsFromRegex(
|
|
|
|
"<(?P<position>.*)>(?P<content>.*)",
|
|
|
|
line,
|
|
|
|
)
|
|
|
|
if groups == nil {
|
|
|
|
return &Unknown{}
|
|
|
|
}
|
2019-06-03 11:07:12 -04:00
|
|
|
|
2019-06-11 12:38:22 -04:00
|
|
|
return &FlagEnumAttr{
|
|
|
|
Addr: ParseAddress(groups["address"]),
|
|
|
|
Pos: NewPositionFromString(groups["position"]),
|
|
|
|
Content: groups["content"],
|
|
|
|
ChildNodes: []Node{},
|
|
|
|
}
|
2019-06-03 11:07:12 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
// AddChild adds a new child node. Child nodes can then be accessed with the
|
|
|
|
// Children attribute.
|
|
|
|
func (n *FlagEnumAttr) AddChild(node Node) {
|
2019-06-11 12:38:22 -04:00
|
|
|
n.ChildNodes = append(n.ChildNodes, node)
|
2019-06-03 11:07:12 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
// Address returns the numeric address of the node. See the documentation for
|
|
|
|
// the Address type for more information.
|
|
|
|
func (n *FlagEnumAttr) Address() Address {
|
2019-06-11 12:38:22 -04:00
|
|
|
return n.Addr
|
2019-06-03 11:07:12 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
// Children returns the child nodes. If this node does not have any children or
|
|
|
|
// this node does not support children it will always return an empty slice.
|
|
|
|
func (n *FlagEnumAttr) Children() []Node {
|
2019-06-11 12:38:22 -04:00
|
|
|
return n.ChildNodes
|
2019-06-03 11:07:12 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
// Position returns the position in the original source code.
|
|
|
|
func (n *FlagEnumAttr) Position() Position {
|
2019-06-11 12:38:22 -04:00
|
|
|
return n.Pos
|
2019-06-03 11:07:12 -04:00
|
|
|
}
|