Parser class

The face of the text_expressions library; parses expressions defined in square brackets '[]', arguments defined in curly brackets '{}', and allows for expressions to be defined externally and 'included' in a phrase through the use of acute angles '<>'.

Constructors

Parser({bool quietMode = true})
Creates an instance of an expression parser.

Properties

hashCode int
The hash code for this object.
no setterinherited
lexer ↔ Lexer
Instace of Lexer for breaking phrases into their parsable components.
latefinal
log → Sprint
Instance of Sprint message printer for the parser.
final
phrases Map<String, String>
Map of keys and their corresponding expressions.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

load({required Map<String, String> phrases}) → void
Loads a new set of phrases into the parser, clearing the previous set.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
parse(String phrase, Arguments arguments) String
Takes phrase, tokenises it, parses each Token and returns the accumulation of the parsed tokens as a string.
parseKey(String key, {Map<String, Object> named = const <String, Object>{}, Set<Object> positional = const <Object>{}}) String
Takes key, retrieves the phrase associated with key and parses it.
toString() String
A string representation of this object.
inherited

Operators

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

Constants

fallback → const String
Used as a fallback 'translation' for an inexistent key.