treerack

package module
v0.0.0-...-a96580b Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2019 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrSyntaxInitialized      = errors.New("syntax initialized")
	ErrInitFailed             = errors.New("init failed")
	ErrNoParsersDefined       = errors.New("no parsers defined")
	ErrInvalidEscapeCharacter = errors.New("invalid escape character")
	ErrMultipleRoots          = errors.New("multiple roots")
	ErrInvalidSymbolName      = errors.New("invalid symbol name")
)
View Source
var ErrInvalidUnicodeCharacter = errors.New("invalid unicode character")

Functions

This section is empty.

Types

type CommitType

type CommitType int
const (
	None  CommitType = 0
	Alias CommitType = 1 << iota
	Whitespace
	NoWhitespace
	Keyword
	NoKeyword
	FailPass
	Root
)

func (CommitType) String

func (ct CommitType) String() string

type GeneratorOptions

type GeneratorOptions struct {
	PackageName string
	Export      bool
}

type Node

type Node struct {
	Name     string
	Nodes    []*Node
	From, To int
	// contains filtered or unexported fields
}

func (*Node) String

func (n *Node) String() string

func (*Node) Text

func (n *Node) Text() string

func (*Node) Tokens

func (n *Node) Tokens() []rune

type ParseError

type ParseError struct {

	// Input is the name of the input file or <input> if not
	// available.
	Input string

	// Offset is the index of the right-most failing
	// token in the input text.
	Offset int

	// Line tells the line index of the right-most failing
	// token in the input text.
	//
	// It is zero-based, and for error reporting, it is
	// recommended to increment it by one.
	Line int

	// Column tells the column index of the right-most failing
	// token in the input text.
	Column int

	// Definition tells the right-most unmatched parser definition.
	Definition string
}

ParseError is returned when the input text doesn't match the used syntax during parsing.

func (*ParseError) Error

func (pe *ParseError) Error() string

type SequenceItem

type SequenceItem struct {
	Name     string
	Min, Max int
}

if min=0&&max=0, it means min=1,max=1 else if max<=0, it means no max else if min<=0, it means no min

type Syntax

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

func (*Syntax) AnyChar

func (s *Syntax) AnyChar(name string, ct CommitType) error

func (*Syntax) CharSequence

func (s *Syntax) CharSequence(name string, ct CommitType, chars []rune) error

func (*Syntax) Choice

func (s *Syntax) Choice(name string, ct CommitType, options ...string) error

func (*Syntax) Class

func (s *Syntax) Class(name string, ct CommitType, not bool, chars []rune, ranges [][]rune) error

func (*Syntax) Generate

func (s *Syntax) Generate(o GeneratorOptions, w io.Writer) error

func (*Syntax) Init

func (s *Syntax) Init() error

func (*Syntax) Parse

func (s *Syntax) Parse(r io.Reader) (*Node, error)

func (*Syntax) ReadSyntax

func (s *Syntax) ReadSyntax(r io.Reader) error

func (*Syntax) Sequence

func (s *Syntax) Sequence(name string, ct CommitType, items ...SequenceItem) error

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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