Grammar class

Implementers

Constructors

Grammar.new({Pattern? main, Pattern? remove, Map<String, Pattern>? rules})
Token Parser - Grammar

Properties

hashCode int
The hash code for this object.
no setterinherited
main Lexeme?
The main lexeme is the lexeme that will be used to tokenize the input when parsing.
getter/setter pair
remover Lexeme?
The remove lexeme is the lexeme that will be used to remove a pattern from the input when parsing.
getter/setter pair
rules Set<Lexeme>
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

add(String name, Pattern lemexe) Lexeme
Add a lexeme to the grammar. This will bind the lexeme to the grammar, so it can be referenced.
addAll(Map<String, Pattern> lexemes) Set<Lexeme>
Add a list of lexemes to the grammar. This will bind the lexemes to the grammar, so they can be referenced.
addLexeme(Lexeme lexeme) → void
Add a lexeme to the grammar. This will bind the lexeme to the grammar, so it can be referenced.
addLexemes(Iterable<Lexeme> tokens) → void
Add a list of lexemes to the grammar. This will bind the lexemes to the grammar, so they can be referenced.
addMain(Lexeme lexeme) → void
Sets the main lexeme of the grammar.
addRemover(Lexeme lexeme) → void
Sets the remover lexeme of the grammar.
lexeme<LexemeT extends Lexeme>(String name) → LexemeT?
Get a previously binded lexeme by its name, from the grammar.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
optionalParse(String input, [Lexeme? main]) Token<Lexeme>?
Parses the provided input and returns the resulting token. If the input is invalid, null is returned.
parse(String string, [Lexeme? main]) Token<Lexeme>
Parses the provided input and returns the resulting token. If the input is invalid, LexicalSyntaxError is thrown.
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited