github.com/Konstantin8105/c4go@v0.0.0-20240505174241-768bb1c65a51/ast/builtin_type.go (about) 1 package ast 2 3 // BuiltinType is builtin type 4 type BuiltinType struct { 5 Addr Address 6 Type string 7 ChildNodes []Node 8 } 9 10 func parseBuiltinType(line string) *BuiltinType { 11 groups := groupsFromRegex( 12 "'(?P<type>.*?)'", 13 line, 14 ) 15 16 return &BuiltinType{ 17 Addr: ParseAddress(groups["address"]), 18 Type: groups["type"], 19 ChildNodes: []Node{}, 20 } 21 } 22 23 // AddChild adds a new child node. Child nodes can then be accessed with the 24 // Children attribute. 25 func (n *BuiltinType) AddChild(node Node) { 26 n.ChildNodes = append(n.ChildNodes, node) 27 } 28 29 // Address returns the numeric address of the node. See the documentation for 30 // the Address type for more information. 31 func (n *BuiltinType) Address() Address { 32 return n.Addr 33 } 34 35 // Children returns the child nodes. If this node does not have any children or 36 // this node does not support children it will always return an empty slice. 37 func (n *BuiltinType) Children() []Node { 38 return n.ChildNodes 39 } 40 41 // Position returns the position in the original source code. 42 func (n *BuiltinType) Position() Position { 43 return Position{} 44 }