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 aResult<List<S>>
. -
CastParser<
R, S> -
A parser that casts a
Result
to aResult<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<
R> - 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.
-
Sequence2<
T1, T2> - Immutable typed sequence with 2 values.
-
Sequence3<
T1, T2, T3> - Immutable typed sequence with 3 values.
-
Sequence4<
T1, T2, T3, T4> - Immutable typed sequence with 4 values.
-
Sequence5<
T1, T2, T3, T4, T5> - Immutable typed sequence with 5 values.
-
Sequence6<
T1, T2, T3, T4, T5, T6> - Immutable typed sequence with 6 values.
-
Sequence7<
T1, T2, T3, T4, T5, T6, T7> - Immutable typed sequence with 7 values.
-
Sequence8<
T1, T2, T3, T4, T5, T6, T7, T8> - Immutable typed sequence with 8 values.
-
Sequence9<
T1, T2, T3, T4, T5, T6, T7, T8, T9> - Immutable typed sequence with 9 values.
-
SequenceParser<
R> - A parser that parses a sequence of parsers.
-
SequenceParser2<
R1, R2> - A parser that consumes a sequence of 2 typed parsers and returns a typed sequence Sequence2.
-
SequenceParser3<
R1, R2, R3> - A parser that consumes a sequence of 3 typed parsers and returns a typed sequence Sequence3.
-
SequenceParser4<
R1, R2, R3, R4> - A parser that consumes a sequence of 4 typed parsers and returns a typed sequence Sequence4.
-
SequenceParser5<
R1, R2, R3, R4, R5> - A parser that consumes a sequence of 5 typed parsers and returns a typed sequence Sequence5.
-
SequenceParser6<
R1, R2, R3, R4, R5, R6> - A parser that consumes a sequence of 6 typed parsers and returns a typed sequence Sequence6.
-
SequenceParser7<
R1, R2, R3, R4, R5, R6, R7> - A parser that consumes a sequence of 7 typed parsers and returns a typed sequence Sequence7.
-
SequenceParser8<
R1, R2, R3, R4, R5, R6, R7, R8> - A parser that consumes a sequence of 8 typed parsers and returns a typed sequence Sequence8.
-
SequenceParser9<
R1, R2, R3, R4, R5, R6, R7, R8, R9> - A parser that consumes a sequence of 9 typed parsers and returns a typed sequence Sequence9.
-
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 around 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> -
ParserSequenceExtension2
on Parser<
Sequence2< T1, T2> > -
ParserSequenceExtension3
on Parser<
Sequence3< T1, T2, T3> > -
ParserSequenceExtension4
on Parser<
Sequence4< T1, T2, T3, T4> > -
ParserSequenceExtension5
on Parser<
Sequence5< T1, T2, T3, T4, T5> > -
ParserSequenceExtension6
on Parser<
Sequence6< T1, T2, T3, T4, T5, T6> > -
ParserSequenceExtension7
on Parser<
Sequence7< T1, T2, T3, T4, T5, T6, T7> > -
ParserSequenceExtension8
on Parser<
Sequence8< T1, T2, T3, T4, T5, T6, T7, T8> > -
ParserSequenceExtension9
on Parser<
Sequence9< T1, T2, T3, T4, T5, T6, T7, T8, T9> > -
PermuteParserExtension
on Parser<
List< R> > -
PickParserExtension
on Parser<
List< R> > -
PossessiveRepeatingParserExtension
on Parser<
R> - PredicateStringExtension on String
-
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>
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.
-
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 thepredicate
matches, or fails with the givenmessage
. -
range(
String start, String stop, [String? message]) → Parser< String> -
Returns a parser that accepts any character in the range
between
start
andstop
. -
selectFarthest<
R> (Failure< R> first, Failure<R> second) → Failure<R> - Reports the parser failure farthest down in the input string, preferring later failures over earlier ones.
-
selectFarthestJoined<
R> (Failure< R> first, Failure<R> second) → Failure<R> - Reports the parser failure farthest down in the input string, joining error messages at the same position.
-
selectFirst<
R> (Failure< R> first, Failure<R> second) → Failure<R> - Reports the first parse failure observed.
-
selectLast<
R> (Failure< R> first, Failure<R> second) → Failure<R> - Reports the last parse failure observed (default).
-
seq2<
R1, R2> (Parser< R1> parser1, Parser<R2> parser2) → Parser<Sequence2< R1, R2> > - Creates a parser that consumes a sequence of 2 parsers and returns a typed sequence Sequence2.
-
seq3<
R1, R2, R3> (Parser< R1> parser1, Parser<R2> parser2, Parser<R3> parser3) → Parser<Sequence3< R1, R2, R3> > - Creates a parser that consumes a sequence of 3 parsers and returns a typed sequence Sequence3.
-
seq4<
R1, R2, R3, R4> (Parser< R1> parser1, Parser<R2> parser2, Parser<R3> parser3, Parser<R4> parser4) → Parser<Sequence4< R1, R2, R3, R4> > - Creates a parser that consumes a sequence of 4 parsers and returns a typed sequence Sequence4.
-
seq5<
R1, R2, R3, R4, R5> (Parser< R1> parser1, Parser<R2> parser2, Parser<R3> parser3, Parser<R4> parser4, Parser<R5> parser5) → Parser<Sequence5< R1, R2, R3, R4, R5> > - Creates a parser that consumes a sequence of 5 parsers and returns a typed sequence Sequence5.
-
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<Sequence6< R1, R2, R3, R4, R5, R6> > - Creates a parser that consumes a sequence of 6 parsers and returns a typed sequence Sequence6.
-
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<Sequence7< R1, R2, R3, R4, R5, R6, R7> > - Creates a parser that consumes a sequence of 7 parsers and returns a typed sequence Sequence7.
-
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<Sequence8< R1, R2, R3, R4, R5, R6, R7, R8> > - Creates a parser that consumes a sequence of 8 parsers and returns a typed sequence Sequence8.
-
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<Sequence9< R1, R2, R3, R4, R5, R6, R7, R8, R9> > - Creates a parser that consumes a sequence of 9 parsers and returns a typed sequence Sequence9.
-
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> = Failure< R> Function(Context context, Success<R> success) -
FailureJoiner<
R> = Failure< R> Function(Failure<R> first, Failure<R> second) - Function definition that joins parse Failure instances.