yacc

package
v1.1.3 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2017 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package yacc parses .y files.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ExpressionNode

type ExpressionNode struct {
	Pos
	Items   []Item
	Command string
}

ExpressionNode hold a single expression.

type Item

type Item struct {
	Value string
	Typ   ItemTyp
}

Item hold an item.

type ItemTyp

type ItemTyp int

ItemTyp is the item type.

const (
	// TypToken is the token type.
	TypToken ItemTyp = iota
	// TypLiteral is the literal type.
	TypLiteral
)

type Pos

type Pos int

Pos represents a byte position in the original input text from which this template was parsed.

type ProductionNode

type ProductionNode struct {
	Pos
	Name        string
	Expressions []*ExpressionNode
}

ProductionNode holds is a named production of multiple expressions.

type Tree

type Tree struct {
	Name        string // name of the template represented by the tree.
	Productions []*ProductionNode
	// contains filtered or unexported fields
}

Tree is the representation of a single parsed file.

func New

func New(name string) *Tree

New allocates a new parse tree with the given name.

func Parse

func Parse(name, text string) (t *Tree, err error)

Parse parses the yacc file text with optional name.

func (*Tree) Parse

func (t *Tree) Parse(text string) (err error)

Parse parses the yacc string to construct a representation of the file for analysis.

Jump to

Keyboard shortcuts

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