Documentation ¶
Overview ¶
Package ebnf contains the AST and parser for parsing the form of EBNF produced by Participle.
The self-referential EBNF is:
EBNF = Production* . Production = <ident> "=" Expression "." . Expression = Sequence ("|" Sequence)* . SubExpression = "(" ("?!" | "?=")? Expression ")" . Sequence = Term+ . Term = "~"? (<ident> | <string> | ("<" <ident> ">") | SubExpression) ("*" | "+" | "?" | "!")? .
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Expression ¶
type Expression struct {
Alternatives []*Sequence `@@ ( "|" @@ )*`
}
Expression is a set of alternatives separated by "|" in the EBNF.
func (*Expression) String ¶
func (e *Expression) String() (out string)
type LookaheadAssertion ¶
type LookaheadAssertion rune
LookaheadAssertion enum.
const ( LookaheadAssertionNone LookaheadAssertion = 0 LookaheadAssertionNegative LookaheadAssertion = '!' LookaheadAssertionPositive LookaheadAssertion = '=' )
Lookahead assertion enums.
func (*LookaheadAssertion) Capture ¶
func (l *LookaheadAssertion) Capture(tokens []string) error
type Node ¶
type Node interface {
// contains filtered or unexported methods
}
A Node in the EBNF grammar.
type Production ¶
type Production struct { Production string `@Ident "="` Expression *Expression `@@ "."` }
Production of the grammar.
type SubExpression ¶
type SubExpression struct { Lookahead LookaheadAssertion `"(" ("?" @("!" | "="))?` Expr *Expression `@@ ")"` }
SubExpression is an expression inside parentheses ( ... )
func (*SubExpression) String ¶
func (s *SubExpression) String() string
Click to show internal directories.
Click to hide internal directories.