pkg

package
v0.1.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 9, 2024 License: GPL-3.0 Imports: 10 Imported by: 3

Documentation

Overview

Code generated by go generate; do not edit.

Index

Constants

This section is empty.

Variables

View Source
var (
	Parser *grammar.Parser[*Node, token_type]
)

Functions

This section is empty.

Types

type Node added in v0.1.3

type Node struct {
	Parent, FirstChild, NextSibling, LastChild, PrevSibling *Node

	Type NodeType
	Data string
}

Node is a node in a ast.

func NewNode added in v0.1.3

func NewNode(n_type NodeType, data string) *Node

NewNode creates a new node with the given data.

Parameters:

  • n_type: The type of the node.
  • data: The data of the node.

Returns:

  • *Node: A pointer to the newly created node. It is never nil.

func (*Node) AddChild added in v0.1.3

func (tn *Node) AddChild(target ast.Noder)

AddChild implements the ast.Noder interface.

func (*Node) AddChildren added in v0.1.3

func (tn *Node) AddChildren(children []ast.Noder)

AddChildren implements the ast.Noder interface.

func (*Node) IsLeaf added in v0.1.3

func (tn *Node) IsLeaf() bool

IsLeaf implements the ast.Noder interface.

func (*Node) Iterator added in v0.1.3

func (tn *Node) Iterator() ast.Iterater

Iterator implements the ast.Noder interface.

func (*Node) String added in v0.1.3

func (tn *Node) String() string

String implements the ast.Noder interface.

type NodeIterator added in v0.1.3

type NodeIterator struct {
	// contains filtered or unexported fields
}

NodeIterator is a pull-based iterator that iterates over the children of a Node.

func (*NodeIterator) Consume added in v0.1.3

func (iter *NodeIterator) Consume() (ast.Noder, error)

Consume implements the ast.Iterater interface.

func (*NodeIterator) Restart added in v0.1.3

func (iter *NodeIterator) Restart()

Restart implements the ast.Iterater interface.

type NodeType added in v0.1.2

type NodeType int

NodeType represents the type of a node in the AST tree.

const (
	SourceNode NodeType = iota
	RuleNode
	IdentifierNode
	OrNode
)

func (NodeType) String added in v0.1.2

func (t NodeType) String() string

String implements the NodeTyper interface.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL