Versions in this module Expand all Collapse all v0 v0.0.1 Jan 24, 2024 Changes in this version + func ParseWithDebug(debug bool) func(*ParseOptions) + type ErrIncompleteParseFailed struct + func (e *ErrIncompleteParseFailed) Error() string + type ErrLeftRecursion struct + func (e *ErrLeftRecursion) Error() string + type ErrParseFailed struct + Expression Expression + Position int + Text string + func (e *ErrParseFailed) Error() string + func (e *ErrParseFailed) LineAndColumn() (int, int) + type Expression interface + ExprName func() string + Match func(text string, parseOpts *ParseOptions) (*Node, error) + SetExprName func(string) + func ResolveRefsFor(v Expression, rules map[string]Expression) (Expression, error) + type Grammar struct + func NewGrammar(rules map[string]Expression, defaultRule Expression) *Grammar + func (g *Grammar) GetRule(ruleName string) (Expression, bool) + func (g *Grammar) Parse(text string, parseOpts ...ParseOption) (*Node, error) + func (g *Grammar) ParseWithRule(ruleName string, text string, parseOpts ...ParseOption) (*Node, error) + func (g *Grammar) String() string + type LazyReference struct + func NewLazyReference(referenceName string) *LazyReference + func (e *LazyReference) ExprName() string + func (e *LazyReference) Match(text string, parseOpts *ParseOptions) (*Node, error) + func (e *LazyReference) SetExprName(n string) + func (e *LazyReference) String() string + func (r *LazyReference) ResolveRefs(refs map[string]Expression) (Expression, error) + type Literal struct + func NewLiteral(literal string) *Literal + func NewLiteralWithName(name string, literal string) *Literal + func (e *Literal) ExprName() string + func (e *Literal) Match(text string, parseOpts *ParseOptions) (*Node, error) + func (e *Literal) SetExprName(n string) + func (e *Literal) String() string + func (l *Literal) GetLiteral() string + type Lookahead struct + func NewLookahead(name string, member Expression, negative bool) *Lookahead + func NewNot(member Expression) *Lookahead + func (e *Lookahead) ExprName() string + func (e *Lookahead) Match(text string, parseOpts *ParseOptions) (*Node, error) + func (e *Lookahead) SetExprName(n string) + func (e *Lookahead) String() string + func (l *Lookahead) ResolveRefs(refs map[string]Expression) (Expression, error) + type Node struct + Children []*Node + End int + Expression Expression + Match string + Start int + Text string + func ParseWithExpression(expr Expression, text string, opts ...ParseOption) (*Node, error) + func (n *Node) String() string + type OneOf struct + func NewOneOf(name string, members []Expression) *OneOf + func (e *OneOf) ExprName() string + func (e *OneOf) Match(text string, parseOpts *ParseOptions) (*Node, error) + func (e *OneOf) SetExprName(n string) + func (e *OneOf) String() string + func (of *OneOf) ResolveRefs(refs map[string]Expression) (Expression, error) + func (of *OneOf) SetMembers(members []Expression) + type ParseOption func(*ParseOptions) + type ParseOptions struct + type Quantifier struct + func NewOneOrMore(name string, member Expression) *Quantifier + func NewOptional(name string, member Expression) *Quantifier + func NewZeroOrMore(name string, member Expression) *Quantifier + func (e *Quantifier) ExprName() string + func (e *Quantifier) Match(text string, parseOpts *ParseOptions) (*Node, error) + func (e *Quantifier) SetExprName(n string) + func (e *Quantifier) String() string + func (q *Quantifier) ResolveRefs(refs map[string]Expression) (Expression, error) + type Regex struct + func NewRegex(name string, re *regexp2.Regexp) *Regex + func (e *Regex) ExprName() string + func (e *Regex) Match(text string, parseOpts *ParseOptions) (*Node, error) + func (e *Regex) SetExprName(n string) + func (e *Regex) String() string + type Sequence struct + func NewSequence(name string, members []Expression) *Sequence + func (e *Sequence) ExprName() string + func (e *Sequence) Match(text string, parseOpts *ParseOptions) (*Node, error) + func (e *Sequence) SetExprName(n string) + func (e *Sequence) String() string + func (s *Sequence) ResolveRefs(refs map[string]Expression) (Expression, error)