syntaxfile

package
v0.0.0-...-c51fe07 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2015 License: MPL-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	M_OR byte = iota
	M_SEQ
	M_DROP
	M_OMIT_VERBOSITY
)
View Source
const (
	F_VERBOSE byte = 1 << iota
	F_MUTE
)

Variables

This section is empty.

Functions

This section is empty.

Types

type CallRule

type CallRule struct {
	Name string
}

func (CallRule) Parse

func (c CallRule) Parse(sf SyntaxFile, t *parsing.Token, d *ast.AST, e *ErrorRecorder) *parsing.Token

func (CallRule) ScanForKeyWords

func (c CallRule) ScanForKeyWords(km map[string]string)

func (CallRule) String

func (c CallRule) String() string

type ErrorRecorder

type ErrorRecorder struct {
	Errors []SyntaxError
}

func (*ErrorRecorder) Add

func (e *ErrorRecorder) Add(err SyntaxError)

func (*ErrorRecorder) AddErr

func (e *ErrorRecorder) AddErr(p interface{}, w string)

func (*ErrorRecorder) Backup

func (e *ErrorRecorder) Backup() (b ErrorRecorder)

func (*ErrorRecorder) Restore

func (e *ErrorRecorder) Restore(b ErrorRecorder)

type Group

type Group struct {
	Data Rule
	Name string
}

func (Group) Parse

func (g Group) Parse(sf SyntaxFile, t *parsing.Token, d *ast.AST, e *ErrorRecorder) *parsing.Token

func (Group) ScanForKeyWords

func (g Group) ScanForKeyWords(km map[string]string)

func (Group) String

func (g Group) String() string

type MatchText

type MatchText struct {
	Text string
}

func (MatchText) Parse

func (m MatchText) Parse(sf SyntaxFile, t *parsing.Token, d *ast.AST, e *ErrorRecorder) *parsing.Token

func (MatchText) ScanForKeyWords

func (m MatchText) ScanForKeyWords(km map[string]string)

func (MatchText) String

func (m MatchText) String() string

type MatchToken

type MatchToken struct {
	Token string
}

func (MatchToken) Parse

func (m MatchToken) Parse(sf SyntaxFile, t *parsing.Token, d *ast.AST, e *ErrorRecorder) *parsing.Token

func (MatchToken) ScanForKeyWords

func (m MatchToken) ScanForKeyWords(km map[string]string)

func (MatchToken) String

func (m MatchToken) String() string

type Modifier

type Modifier struct {
	Data  []Rule
	Mode  byte
	Flags byte
}

func (Modifier) Parse

func (m Modifier) Parse(sf SyntaxFile, t *parsing.Token, d *ast.AST, e *ErrorRecorder) *parsing.Token

func (Modifier) ScanForKeyWords

func (m Modifier) ScanForKeyWords(km map[string]string)

func (Modifier) String

func (m Modifier) String() string

type Rule

type Rule interface {
	// Scans for keywords, used by SyntaxFile.ScanForKeyWords
	ScanForKeyWords(km map[string]string)
	// Parses an
	// sf SyntaxFile:     its parent syntax file object
	// t *parsing.Token:  the first token (the source is a linked list of tokens
	//                    that uses a lazy evaluation technique)
	// d *ast.AST:        The destination for the AST
	// e *ErrorRecorder:  The destination for the Error messages
	Parse(sf SyntaxFile, t *parsing.Token, d *ast.AST, e *ErrorRecorder) *parsing.Token
}

A Syntax rule (general interface).

type SyntaxError

type SyntaxError struct {
	Position interface{}
	What     string
}

type SyntaxFile

type SyntaxFile map[string]Rule

A SyntaxFile object. It containes all (top-level) rules.

func Parse

func Parse(src io.Reader) SyntaxFile

Parses an SyntaxFile. On Syntax error it panics.

func (SyntaxFile) ScanForKeyWords

func (sf SyntaxFile) ScanForKeyWords(km map[string]string)

Scans for keywords and stores it inside a map. It is needed for the Lexer.

func (SyntaxFile) String

func (sf SyntaxFile) String() string

Jump to

Keyboard shortcuts

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