Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Node ¶
type Node interface { // GetNext returns the next node of the current node. GetNext() Node // GetChildren returns the children nodes of the current node. GetChildren() []Node // GetValue returns the value of the current node, the value is // the command or the args of the line by parsing the modelfile. GetValue() string // GetAttributes returns the attributes of the current node, such as key-value pairs. // Attributes can be used to expand the information of the node. GetAttributes() map[string]string // GetStartLine returns the start line of the current node, it will help to // locate the start of the node. GetStartLine() int // GetEndLine returns the end line of the current node, it will help to // locate the end of the node. GetEndLine() int // AddChild adds a child node to the current node. AddChild(child Node) // AddNext adds a next node to the current node. AddNext(next Node) // AddAttribute adds an attribute to the current node. AddAttribute(key, value string) }
Node is the interface for the AST node.
Walk the AST to get the information by the root node. The root node is the entry point of the AST. Use the Node interface to build the AST for the modelfile.
func NewNode ¶
NewNode creates a new node of the AST with the value, start line, and end line. It is used to create the node of the AST, so need to create the node with the value by parsing the modelfile.
func NewRootNode ¶
func NewRootNode() Node
NewRootNode creates a new root node of the AST. It is used as the entry point of the AST, so do not use it to create the node of the AST.
Click to show internal directories.
Click to hide internal directories.