CharacterParser constructor
CharacterParser(
- CharacterPredicate predicate,
- String message, {
- bool unicode = false,
Constructs a new character parser.
The predicate
defines the character class to be detected.
The message
is the error text generated in case the predicate does not
satisfy the input.
By default, the parsers works on UTF-16 code units. If unicode
is set
to true
unicode surrogate pairs are extracted from the input and matched
against the predicate.
Implementation
factory CharacterParser(
CharacterPredicate predicate,
String message, {
bool unicode = false,
}) => switch (unicode) {
false => SingleCharacterParser(predicate, message),
true => UnicodeCharacterParser(predicate, message),
};