parser library
This package contains the standard parser implementations.
Classes
-
AndParser<
R> -
The and-predicate, a parser that succeeds whenever its delegate does, but
does not consume the input stream
Parr 1994, 1995
. - AnyParser
- A parser that accepts any input element.
-
CastListParser<
T, R> -
A parser that casts a
Result<List>
to aResult<List<R>>
. -
CastParser<
T, R> -
A parser that casts a
Result
to aResult<R>
. - CharacterParser
- Parser class for individual character classes.
- CharacterPredicate
- Abstract character predicate class.
-
ChoiceParser<
T> - A parser that uses the first parser that succeeds.
-
ContinuationParser<
T, R> - Continuation parser that when activated captures a continuation function and passes it together with the current context into the handler.
-
DelegateParser<
T, R> -
An abstract parser that delegates to a parser of type
T
. - DigitCharPredicate
- EndOfInputParser
- A parser that succeeds at the end of input.
-
EpsilonParser<
R> - A parser that consumes nothing and succeeds.
-
FailureParser<
R> - A parser that consumes nothing and fails.
-
FlattenParser<
T> - A parser that discards the result of the delegate and answers the sub-string its delegate consumes.
-
GreedyRepeatingParser<
R> - A greedy repeating parser, commonly seen in regular expression implementations. It aggressively consumes as much input as possible and then backtracks to meet the 'limit' condition.
-
LabeledParser<
R> - Interface of a parser that has a debug label.
-
LabelParser<
R> - A parser that always defers to its delegate, but that also holds a label for debugging purposes.
-
LazyRepeatingParser<
R> - A lazy repeating parser, commonly seen in regular expression implementations. It limits its consumption to meet the 'limit' condition as early as possible.
- LetterCharPredicate
-
LimitedRepeatingParser<
R> - An abstract parser that repeatedly parses between 'min' and 'max' instances of its delegate and that requires the input to be completed with a specified parser 'limit'. Subclasses provide repeating behavior as typically seen in regular expression implementations (non-blind).
-
ListParser<
T, R> - Abstract parser that parses a list of things in some way.
- LowercaseCharPredicate
-
MapParser<
T, R> - A parser that performs a transformation with a given function on the successful parse result of the delegate.
-
NotParser<
R> -
The not-predicate, a parser that succeeds whenever its delegate does not,
but consumes no input
Parr 1994, 1995
. -
OptionalParser<
R> -
A parser that optionally parsers its delegate, or answers
null
. - PatternParser
- A parser that uses a Pattern matcher for parsing.
-
PermuteParser<
R> - A parser that performs a transformation with a given function on the successful parse result of the delegate.
-
PickParser<
R> - A parser that performs a transformation with a given function on the successful parse result of the delegate.
- PositionParser
- A parser that reports the current input position.
-
PossessiveRepeatingParser<
R> - A greedy parser that repeatedly parses between 'min' and 'max' instances of its delegate.
- PredicateParser
- A parser for a literal satisfying a predicate.
- RangeCharPredicate
-
RepeatingParser<
R> - An abstract parser that repeatedly parses between 'min' and 'max' instances of its delegate.
-
ResolvableParser<
R> - Interface of a parser that can be resolved to another one.
-
SequenceParser<
T> - A parser that parses a sequence of parsers.
-
SettableParser<
R> - A parser that is not defined, but that can be set at a later point in time.
- SingleCharPredicate
-
TokenParser<
R> - A parser that creates a token of the result its delegate parses.
-
TrimmingParser<
R> - A parser that silently consumes input of another parser around its delegate.
- UppercaseCharPredicate
-
WhereParser<
T> - WhitespaceCharPredicate
- WordCharPredicate
Extensions
-
AndParserExtension
on Parser<
T> -
CastListParserExtension
on Parser<
T> -
CastParserExtension
on Parser<
T> -
ChoiceIterableExtension
on Iterable<
Parser< T> > - ChoiceParserExtension on Parser
-
ContinuationParserExtension
on Parser<
T> -
EndOfInputParserExtension
on Parser<
T> -
FlattenParserExtension
on Parser<
T> -
GreedyRepeatingParserExtension
on Parser<
T> -
LabelParserExtension
on Parser<
R> -
LazyRepeatingParserExtension
on Parser<
T> -
MapParserExtension
on Parser<
T> -
NotParserExtension
on Parser<
T> -
OptionalParserExtension
on Parser<
T> -
PermuteParserExtension
on Parser<
List< T> > -
PickParserExtension
on Parser<
List< T> > -
PossessiveRepeatingParserExtension
on Parser<
T> - PredicateStringExtension on String
-
SeparatedBy
on Parser<
T> -
SequenceIterableExtension
on Iterable<
Parser< T> > - SequenceParserExtension on Parser
-
SettableParserExtension
on Parser<
T> -
TokenParserExtension
on Parser<
T> -
TrimmingParserExtension
on Parser<
T> -
WhereParserExtension
on Parser<
T>
Functions
-
any(
[String message = 'input expected']) → Parser< String> - Returns a parser that accepts any input element.
-
anyOf(
String chars, [String? message]) → Parser< String> - Returns a parser that accepts any of the specified characters.
-
char(
Object char, [String? message]) → Parser< String> - Returns a parser that accepts a specific character only.
-
digit(
[String message = 'digit expected']) → Parser< String> -
Returns a parser that accepts any digit character. The accepted input is
equivalent to the character-set
0-9
. -
endOfInput(
[String message = 'end of input expected']) → Parser< void> - Returns a parser that succeeds at the end of input.
-
epsilon(
) → Parser< void> - Returns a parser that consumes nothing and succeeds.
-
epsilonWith<
R> (R result) → Parser< R> -
Returns a parser that consumes nothing and succeeds with
result
. -
failure<
R> ([String message = 'unable to parse']) → Parser< R> - Returns a parser that consumes nothing and fails.
-
letter(
[String message = 'letter expected']) → Parser< String> -
Returns a parser that accepts any letter character (lowercase or uppercase).
The accepted input is equivalent to the character-set
a-zA-Z
. -
lowercase(
[String message = 'lowercase letter expected']) → Parser< String> -
Returns a parser that accepts any lowercase character. The accepted input is
equivalent to the character-set
a-z
. -
noneOf(
String chars, [String? message]) → Parser< String> - Returns a parser that accepts none of the specified characters.
-
pattern(
String element, [String? message]) → Parser< String> - Returns a parser that accepts a single character of a given character set provided as a string.
-
patternIgnoreCase(
String element, [String? message]) → Parser< String> - Returns a parser that accepts a single character of a given case-insensitive character set provided as a string.
-
position(
) → Parser - Returns a parser that reports the current input position.
-
predicate(
int length, Predicate< String> predicate, String message) → Parser<String> -
Returns a parser that reads input of the specified
length
, accepts it if the predicate matches, or fails with the givenmessage
. -
range(
Object start, Object stop, [String? message]) → Parser< String> -
Returns a parser that accepts any character in the range
between
start
andstop
. -
selectFarthest<
T> (Failure< T> first, Failure<T> second) → Failure<T> - Reports the parser failure farthest down in the input string, preferring later failures over earlier ones.
-
selectFarthestJoined<
T> (Failure< T> first, Failure<T> second) → Failure<T> - Reports the parser failure farthest down in the input string, joining error messages at the same position.
-
selectFirst<
T> (Failure< T> first, Failure<T> second) → Failure<T> - Reports the first parse failure observed.
-
selectLast<
T> (Failure< T> first, Failure<T> second) → Failure<T> - Reports the last parse failure observed (default).
-
string(
String element, [String? message]) → Parser< String> -
Returns a parser that accepts the string
element
. -
stringIgnoreCase(
String element, [String? message]) → Parser< String> -
Returns a parser that accepts the string
element
ignoring the case. -
undefined<
R> ([String message = 'undefined parser']) → SettableParser< R> - Returns a parser that is not defined, but that can be set at a later point in time.
-
uppercase(
[String message = 'uppercase letter expected']) → Parser< String> -
Returns a parser that accepts any uppercase character. The accepted input is
equivalent to the character-set
A-Z
. -
whitespace(
[String message = 'whitespace expected']) → Parser< String> - Returns a parser that accepts any whitespace character.
-
word(
[String message = 'letter or digit expected']) → Parser< String> -
Returns a parser that accepts any word character (lowercase, uppercase,
underscore, or digit). The accepted input is equivalent to the character-set
a-zA-Z_0-9
.
Typedefs
-
ContinuationFunction<
T> = Result< T> Function(Context context) - Continuation function of the ContinuationHandler.
-
ContinuationHandler<
T, R> = Result< R> Function(ContinuationFunction<T> continuation, Context context) - Handler function for the ContinuationParser.
-
FailureJoiner<
T> = Failure< T> Function(Failure<T> first, Failure<T> second) - Function definition that joins parse Failure instances.