parser

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2018 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package parser is mostly generated from the bnf using gocc. The only user created code is the ParseExpr and ParseGrammar methods as well as the ParseGrammar function.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseExpr

func ParseExpr(s string) (*ast.Expr, error)

ParseExpr returns a parsed expression or error, given a string.

func ParseGrammar

func ParseGrammar(s string) (*ast.Grammar, error)

ParseGrammar parses a relapse grammar and returns an abstract syntax tree.

Types

type Attrib

type Attrib interface {
}

type Parser

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

func NewParser

func NewParser() *Parser

func (*Parser) Error

func (p *Parser) Error(err error, scanner Scanner) (recovered bool, errorAttrib *parseError.Error)

func (*Parser) Parse

func (p *Parser) Parse(scanner Scanner) (res interface{}, err error)

func (*Parser) ParseExpr

func (this *Parser) ParseExpr(s string) (res *ast.Expr, err error)

ParseExpr returns a parsed expression or error, given a string.

func (*Parser) ParseGrammar

func (this *Parser) ParseGrammar(s string) (*ast.Grammar, error)

ParseGrammar parses a relapse grammar and returns an abstract syntax tree.

func (*Parser) Reset

func (p *Parser) Reset()

type ProdTab

type ProdTab [numProductions]ProdTabEntry

TODO: change type and variable names to be consistent with other tables

type ProdTabEntry

type ProdTabEntry struct {
	String     string
	Id         string
	NTType     int
	Index      int
	NumSymbols int
	ReduceFunc func([]Attrib) (Attrib, error)
}

type Scanner

type Scanner interface {
	Scan() (tok *token.Token)
}

Jump to

Keyboard shortcuts

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