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.
AnyCharacterParser
A parser that accepts any input element.
CastListParser<R, S>
A parser that casts a Result<List> to a Result<List<S>>.
CastParser<R, S>
A parser that casts a Result to a Result<R>.
CharacterPredicate
Abstract character predicate class.
ChoiceParser<R>
A parser that uses the first parser that succeeds.
ContinuationParser<R, S>
Continuation parser that when activated captures a continuation function and passes it together with the current context into the handler.
DelegateParser<R, S>
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
A parser that consumes nothing and fails.
FlattenParser<R>
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<R, S>
Abstract parser that parses a list of things in some way.
LowercaseCharPredicate
MapParser<R, S>
A parser that performs a transformation with a given function on the successful parse result of the delegate.
NewlineParser
A parser that consumes newlines platform independently.
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.
Parser<R>
Abstract base class of all parsers that produce a parse result of type R.
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
RepeatingCharacterParser
An abstract parser that repeatedly parses between 'min' and 'max' instances of its delegate.
RepeatingParser<T, 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.
SeparatedList<R, S>
A list of elements and its separators.
SeparatedRepeatingParser<R, S>
A parser that consumes the delegate between min and max times separated by the separator parser.
SequenceParser<R>
A parser that parses a sequence of parsers.
SequenceParser2<R1, R2>
A parser that consumes a sequence of 2 parsers and returns a Record with 2 positional parse results.
SequenceParser3<R1, R2, R3>
A parser that consumes a sequence of 3 parsers and returns a Record with 3 positional parse results.
SequenceParser4<R1, R2, R3, R4>
A parser that consumes a sequence of 4 parsers and returns a Record with 4 positional parse results.
SequenceParser5<R1, R2, R3, R4, R5>
A parser that consumes a sequence of 5 parsers and returns a Record with 5 positional parse results.
SequenceParser6<R1, R2, R3, R4, R5, R6>
A parser that consumes a sequence of 6 parsers and returns a Record with 6 positional parse results.
SequenceParser7<R1, R2, R3, R4, R5, R6, R7>
A parser that consumes a sequence of 7 parsers and returns a Record with 7 positional parse results.
SequenceParser8<R1, R2, R3, R4, R5, R6, R7, R8>
A parser that consumes a sequence of 8 parsers and returns a Record with 8 positional parse results.
SequenceParser9<R1, R2, R3, R4, R5, R6, R7, R8, R9>
A parser that consumes a sequence of 9 parsers and returns a Record with 9 positional parse results.
SettableParser<R>
A parser that is not defined, but that can be set at a later point in time.
SingleCharacterParser
Parser class for individual character classes.
SingleCharPredicate
SkipParser<R>
A parser that silently consumes input of another parser before and after its delegate.
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<R>
WhitespaceCharPredicate
WordCharPredicate

Extensions

AndParserExtension on Parser<R>
CastListParserExtension on Parser<R>
CastParserExtension on Parser<R>
ChoiceIterableExtension on Iterable<Parser<R>>
ChoiceParserExtension on Parser
ContinuationParserExtension on Parser<R>
EndOfInputParserExtension on Parser<R>
FlattenParserExtension on Parser<R>
GreedyRepeatingParserExtension on Parser<R>
LabelParserExtension on Parser<R>
LazyRepeatingParserExtension on Parser<R>
MapParserExtension on Parser<R>
NotParserExtension on Parser<R>
OptionalParserExtension on Parser<R>
PermuteParserExtension on Parser<List<R>>
PickParserExtension on Parser<List<R>>
PossessiveRepeatingParserExtension on Parser<R>
PredicateStringExtension on String
RecordOfParsersExtension2 on (Parser<R1>, Parser<R2>)
Extensions on a Record with 2 positional Parsers.
RecordOfParsersExtension3 on (Parser<R1>, Parser<R2>, Parser<R3>)
Extensions on a Record with 3 positional Parsers.
RecordOfParsersExtension4 on (Parser<R1>, Parser<R2>, Parser<R3>, Parser<R4>)
Extensions on a Record with 4 positional Parsers.
RecordOfParsersExtension5 on (Parser<R1>, Parser<R2>, Parser<R3>, Parser<R4>, Parser<R5>)
Extensions on a Record with 5 positional Parsers.
RecordOfParsersExtension6 on (Parser<R1>, Parser<R2>, Parser<R3>, Parser<R4>, Parser<R5>, Parser<R6>)
Extensions on a Record with 6 positional Parsers.
RecordOfParsersExtension7 on (Parser<R1>, Parser<R2>, Parser<R3>, Parser<R4>, Parser<R5>, Parser<R6>, Parser<R7>)
Extensions on a Record with 7 positional Parsers.
RecordOfParsersExtension8 on (Parser<R1>, Parser<R2>, Parser<R3>, Parser<R4>, Parser<R5>, Parser<R6>, Parser<R7>, Parser<R8>)
Extensions on a Record with 8 positional Parsers.
RecordOfParsersExtension9 on (Parser<R1>, Parser<R2>, Parser<R3>, Parser<R4>, Parser<R5>, Parser<R6>, Parser<R7>, Parser<R8>, Parser<R9>)
Extensions on a Record with 9 positional Parsers.
RecordOfValuesExtension2 on (T1, T2)
Extension on a Record with 2 positional values.
RecordOfValuesExtension3 on (T1, T2, T3)
Extension on a Record with 3 positional values.
RecordOfValuesExtension4 on (T1, T2, T3, T4)
Extension on a Record with 4 positional values.
RecordOfValuesExtension5 on (T1, T2, T3, T4, T5)
Extension on a Record with 5 positional values.
RecordOfValuesExtension6 on (T1, T2, T3, T4, T5, T6)
Extension on a Record with 6 positional values.
RecordOfValuesExtension7 on (T1, T2, T3, T4, T5, T6, T7)
Extension on a Record with 7 positional values.
RecordOfValuesExtension8 on (T1, T2, T3, T4, T5, T6, T7, T8)
Extension on a Record with 8 positional values.
RecordOfValuesExtension9 on (T1, T2, T3, T4, T5, T6, T7, T8, T9)
Extension on a Record with 9 positional values.
RecordParserExtension2 on Parser<(T1, T2)>
Extension on a Parser producing a Record of 2 positional values.
RecordParserExtension3 on Parser<(T1, T2, T3)>
Extension on a Parser producing a Record of 3 positional values.
RecordParserExtension4 on Parser<(T1, T2, T3, T4)>
Extension on a Parser producing a Record of 4 positional values.
RecordParserExtension5 on Parser<(T1, T2, T3, T4, T5)>
Extension on a Parser producing a Record of 5 positional values.
RecordParserExtension6 on Parser<(T1, T2, T3, T4, T5, T6)>
Extension on a Parser producing a Record of 6 positional values.
RecordParserExtension7 on Parser<(T1, T2, T3, T4, T5, T6, T7)>
Extension on a Parser producing a Record of 7 positional values.
RecordParserExtension8 on Parser<(T1, T2, T3, T4, T5, T6, T7, T8)>
Extension on a Parser producing a Record of 8 positional values.
RecordParserExtension9 on Parser<(T1, T2, T3, T4, T5, T6, T7, T8, T9)>
Extension on a Parser producing a Record of 9 positional values.
RepeatingCharacterParserExtension on Parser<String>
SeparatedByParserExtension on Parser<T>
SeparatedRepeatingParserExtension on Parser<R>
SequenceIterableExtension on Iterable<Parser<R>>
SequenceParserExtension on Parser
SettableParserExtension on Parser<R>
SkipParserExtension on Parser<R>
TokenParserExtension on Parser<R>
TrimmingParserExtension on Parser<R>
WhereParserExtension on Parser<R>

Constants

unbounded → const int
An int used to mark an unbounded maximum repetition.

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(String char, [String? message]) Parser<String>
Returns a parser that accepts a specific character only.
charIgnoringCase(String char, [String? message]) Parser<String>
Returns a parser that accepts a case-insensitive specific character only.
createFactory_<R>({String? message, FailureFactory<R>? factory, Callback<R, String>? failureMessage, Callback<R, int>? failurePosition}) FailureFactory<R>
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.
newline([String message = 'newline expected']) Parser<String>
Returns a parser that detects newlines platform independently.
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 given message.
range(String start, String stop, [String? message]) Parser<String>
Returns a parser that accepts any character in the range between start and stop.
selectFarthest(Failure first, Failure second) Failure
Reports the parser failure farthest down in the input string, preferring later failures over earlier ones.
selectFarthestJoined(Failure first, Failure second) Failure
Reports the parser failure farthest down in the input string, joining error messages at the same position.
selectFirst(Failure first, Failure second) Failure
Reports the first parse failure observed.
selectLast(Failure first, Failure second) Failure
Reports the last parse failure observed (default).
seq2<R1, R2>(Parser<R1> parser1, Parser<R2> parser2) Parser<(R1, R2)>
Creates a Parser that consumes the 2 parsers passed as argument in sequence and returns a Record with 2 positional parse results.
seq3<R1, R2, R3>(Parser<R1> parser1, Parser<R2> parser2, Parser<R3> parser3) Parser<(R1, R2, R3)>
Creates a Parser that consumes the 3 parsers passed as argument in sequence and returns a Record with 3 positional parse results.
seq4<R1, R2, R3, R4>(Parser<R1> parser1, Parser<R2> parser2, Parser<R3> parser3, Parser<R4> parser4) Parser<(R1, R2, R3, R4)>
Creates a Parser that consumes the 4 parsers passed as argument in sequence and returns a Record with 4 positional parse results.
seq5<R1, R2, R3, R4, R5>(Parser<R1> parser1, Parser<R2> parser2, Parser<R3> parser3, Parser<R4> parser4, Parser<R5> parser5) Parser<(R1, R2, R3, R4, R5)>
Creates a Parser that consumes the 5 parsers passed as argument in sequence and returns a Record with 5 positional parse results.
seq6<R1, R2, R3, R4, R5, R6>(Parser<R1> parser1, Parser<R2> parser2, Parser<R3> parser3, Parser<R4> parser4, Parser<R5> parser5, Parser<R6> parser6) Parser<(R1, R2, R3, R4, R5, R6)>
Creates a Parser that consumes the 6 parsers passed as argument in sequence and returns a Record with 6 positional parse results.
seq7<R1, R2, R3, R4, R5, R6, R7>(Parser<R1> parser1, Parser<R2> parser2, Parser<R3> parser3, Parser<R4> parser4, Parser<R5> parser5, Parser<R6> parser6, Parser<R7> parser7) Parser<(R1, R2, R3, R4, R5, R6, R7)>
Creates a Parser that consumes the 7 parsers passed as argument in sequence and returns a Record with 7 positional parse results.
seq8<R1, R2, R3, R4, R5, R6, R7, R8>(Parser<R1> parser1, Parser<R2> parser2, Parser<R3> parser3, Parser<R4> parser4, Parser<R5> parser5, Parser<R6> parser6, Parser<R7> parser7, Parser<R8> parser8) Parser<(R1, R2, R3, R4, R5, R6, R7, R8)>
Creates a Parser that consumes the 8 parsers passed as argument in sequence and returns a Record with 8 positional parse results.
seq9<R1, R2, R3, R4, R5, R6, R7, R8, R9>(Parser<R1> parser1, Parser<R2> parser2, Parser<R3> parser3, Parser<R4> parser4, Parser<R5> parser5, Parser<R6> parser6, Parser<R7> parser7, Parser<R8> parser8, Parser<R9> parser9) Parser<(R1, R2, R3, R4, R5, R6, R7, R8, R9)>
Creates a Parser that consumes the 9 parsers passed as argument in sequence and returns a Record with 9 positional parse results.
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

AnyParser = AnyCharacterParser
Alias for deprecated class name.
CharacterParser = SingleCharacterParser
Alias for deprecated class name.
ContinuationFunction<R> = Result<R> Function(Context context)
Continuation function of the ContinuationHandler.
ContinuationHandler<R, S> = Result<S> Function(ContinuationFunction<R> continuation, Context context)
Handler function for the ContinuationParser.
FailureFactory<R> = Result<R> Function(Context context, Success<R> success)
FailureJoiner = Failure Function(Failure first, Failure second)
Function definition that joins parse Failure instances.