ast.go 258 B

12345678910111213141516171819
  1. package ast
  2. type Node struct {
  3. Type string
  4. Text string
  5. Children []*Node
  6. }
  7. type Document struct {
  8. Nodes []*Node
  9. }
  10. func NewDocument() *Document {
  11. return &Document{}
  12. }
  13. func (d *Document) AddNode(node *Node) {
  14. d.Nodes = append(d.Nodes, node)
  15. }