frontend

package
v0.0.0-...-0cd0f30 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2014 License: GPL-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Literals []string
View Source
var TokMap map[string]int
View Source
var Tokens []string

Functions

func Lexer

func Lexer(text, filename string) (*lex.Scanner, error)

Types

type Consumer

type Consumer interface {
	Consume(i int) (int, *Node, *ParseError)
}

type FnConsumer

type FnConsumer func(i int) (int, *Node, *ParseError)

func (FnConsumer) Consume

func (self FnConsumer) Consume(i int) (int, *Node, *ParseError)

type LexerContext

type LexerContext struct {
	Filename string
}

func NewContext

func NewContext(filename string) *LexerContext

func (*LexerContext) Literal

func (self *LexerContext) Literal(scan *lex.Scanner, match *machines.Match) (interface{}, error)

func (*LexerContext) Skip

func (self *LexerContext) Skip(scan *lex.Scanner, match *machines.Match) (interface{}, error)

func (*LexerContext) Token

func (self *LexerContext) Token(name string) lex.Action

func (*LexerContext) TokenValue

func (self *LexerContext) TokenValue(name string) lex.Action

type Node

type Node struct {
	Label    string
	Value    interface{}
	Type     types.Type
	Children []*Node
	// contains filtered or unexported fields
}

func NewNode

func NewNode(label string) *Node

func NewTokenNode

func NewTokenNode(tok *Token) *Node

func NewValueNode

func NewValueNode(label string, value interface{}) *Node

func Parse

func Parse(tokens []*Token) (*Node, error)

func (*Node) AddKid

func (self *Node) AddKid(kid *Node) *Node

func (*Node) Annotate

func (self *Node) Annotate(nodes []*Node) *Node

func (*Node) Get

func (self *Node) Get(idx int) *Node

func (*Node) Kid

func (self *Node) Kid(label string) *Node

func (*Node) Leaf

func (self *Node) Leaf() bool

func (*Node) Location

func (self *Node) Location() *SourceLocation

func (*Node) PrependKid

func (self *Node) PrependKid(kid *Node) *Node

func (*Node) Serialize

func (self *Node) Serialize(with_loc bool) string

func (*Node) String

func (self *Node) String() string

func (*Node) WellTyped

func (self *Node) WellTyped() bool

type ParseError

type ParseError struct {
	ErrorFmt string
	Token    *Token
}

func Error

func Error(fmt string, t *Token) *ParseError

func (*ParseError) Error

func (self *ParseError) Error() string

func (*ParseError) Less

func (self *ParseError) Less(o *ParseError) bool

type SourceLocation

type SourceLocation struct {
	Filename                                   string
	StartLine, StartColumn, EndLine, EndColumn int
}

func (*SourceLocation) Join

func (self *SourceLocation) Join(others ...*SourceLocation) (*SourceLocation, error)

func (*SourceLocation) String

func (self *SourceLocation) String() string

type StringConsumer

type StringConsumer struct {
	Productions map[string]Consumer
	// contains filtered or unexported fields
}

func (StringConsumer) Consume

func (self StringConsumer) Consume(i int) (int, *Node, *ParseError)

type Token

type Token struct {
	lex.Token
	Filename string
}

func NewToken

func NewToken(token int, value interface{}, match *machines.Match, filename string) *Token

func (*Token) String

func (self *Token) String() string

Jump to

Keyboard shortcuts

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