wdte: github.com/DeedleFake/wdte/ast Index | Files | Directories

package ast

import "github.com/DeedleFake/wdte/ast"

Package ast provides the parser for WDTE.

Index

Package Files

ast.go doc.go node.go tokenstack.go

type Epsilon Uses

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

An Epsilon is a special terminal which represnts a non-action.

func (Epsilon) Children Uses

func (e Epsilon) Children() []Node

func (Epsilon) Parent Uses

func (e Epsilon) Parent() Node

type NTerm Uses

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

An NTerm is a Node that represents a non-terminal. NTerms are always parent nodes.

func (*NTerm) AddChild Uses

func (nt *NTerm) AddChild(n Node)

AddChild adds a child to the right-hand side of the NTerm's list of children.

func (NTerm) Children Uses

func (nt NTerm) Children() []Node

func (NTerm) Name Uses

func (nt NTerm) Name() string

Name returns the name of the non-terminal, minus the surrounding `<` and `>`.

func (NTerm) Parent Uses

func (nt NTerm) Parent() Node

type Node Uses

type Node interface {
    // Parent returns the Node's parent, or nil if it is the root node.
    Parent() Node

    // Children returns the node's children in left-to-right order.
    Children() []Node
}

A Node represents a node of the AST.

func Parse Uses

func Parse(r io.Reader, macros scanner.MacroMap) (Node, error)

Parse parses a full script, returning the root node of the AST.

type ParseError Uses

type ParseError struct {
    Line, Col int
    Err       error
}

A ParseError is returned if an error happens during parsing.

func (ParseError) Error Uses

func (err ParseError) Error() string

type Term Uses

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

A Term is a Node that represents a terminal, such as a string or a keyword. Terms are always leaf nodes.

func (Term) Children Uses

func (t Term) Children() []Node

func (Term) Parent Uses

func (t Term) Parent() Node

func (Term) Tok Uses

func (t Term) Tok() scanner.Token

Tok returns the scanner token that the node was generated from.

Directories

PathSynopsis
internal/pgen

Package ast imports 4 packages (graph) and is imported by 1 packages. Updated 2019-03-27. Refresh now. Tools for package owners.