node.go 179 B

123456789101112
  1. package ast
  2. func NewNode(tp, text string) *Node {
  3. return &Node{
  4. Type: tp,
  5. Text: text,
  6. }
  7. }
  8. func (n *Node) AddChild(child *Node) {
  9. n.Children = append(n.Children, child)
  10. }