betto_abnf library

Support for Augmented Backus-Naur Form (ABNF)

Refer to:

Classes

AlternativeLiterals
Represents a list of alternative literal strings (e.g., "en" / "de").
Alternatives
Represents alternative rules that can be matched (e.g., foo / bar in RFC 5234).
CharacterElement
Represents a single character (code point) element.
Concatenation
Represents a concatenation of elements that must be matched in order (e.g., foo bar).
Element
The base representation of an ABNF grammar element.
ElementVisitor<R>
Visitor interface for traversing ABNF grammar Element nodes.
EmptyElement
Grammar
Represents a complete ABNF grammar starting from an entry rule.
GrammarPrinter
Group
Represents a group of elements that must be matched together (e.g., (foo bar)).
LiteralElement
Represents a literal string (e.g., "en").
NegativeLookahead
Represents a negative lookahead assertion. Matches if the inner element fails. Consumes no input.
OptionalSequence
Represents an optional sequence of elements (e.g., [foo bar]).
ParseResult
The result of parsing an input string.
ParseTreeNode
Represents a node in the parse tree with its full context
ParseTreeWalker
A walker that traverses a parse tree created by a successful parse
Repetition
Represents variable repetition of an element (e.g., *foo or 1*3foo).
Rule
A named grammar rule combining a name and an underlying Element.
Sequence
A sequence of grammar elements that must be matched in order.
ValueRange
Represents a range of values (e.g., %x41-5A).

Properties

alpha Rule
final
alphaLower Rule
final
alphanum Rule
final
alphaUpper Rule
final
bit Rule
final
char Rule
final
cr Rule
final
crlf Rule
final
ctl Rule
Controls characters (range %x00-1F / %x7F).
final
digit Rule
final
dquote Rule
final
hexdig Rule
final
hexletters Rule
final
htab Rule
final
lf Rule
final
optionalWsp Rule
final
sp Rule
final
vchar Rule
Visible (printing) characters (range %x21-7E).
final
wsp Rule
final

Functions

alternativeLiterals(Iterable<String> value, {String? description}) AlternativeLiterals
Creates a case-insensitive set of alternative literals (the RFC 5234 default).
alternatives(Iterable<Element> elements) Alternatives
caseSensitiveAlternativeLiterals(Iterable<String> value, {String? description}) AlternativeLiterals
Creates a case-sensitive set of alternative literals (equivalent to RFC 7405 %s).
caseSensitiveLiteral(String value, {String? description}) Element
Creates a case-sensitive literal element (equivalent to RFC 7405 %s).
character(int value, {String? description}) CharacterElement
concatenation(ElementSequence elements) Concatenation
grammar(String name, Rule entryRule, {String? description}) Grammar
group(ElementSequence elements) Group
literal(String value, {String? description}) Element
Creates a case-insensitive literal element (the RFC 5234 default).
negativeLookahead(Element element, {String? description}) NegativeLookahead
optional(ElementSequence elements) OptionalSequence
optionalSequence(ElementSequence elements) OptionalSequence
repetition(Element value, int n) Repetition
rule(String name, Element element, {String? description}) Rule
Creates a named Rule from a given grammar element.
valueRange(int start, int end) ValueRange
variableRepetition(Element value, {int min = 0, int? max}) Repetition

Typedefs

ElementSequence = Iterable<Element>
ParseTreeVisitor = bool Function(ParseTreeNode node)
A visitor function that is called for each node in the parse tree. Return false to stop traversal, true to continue.