Chainl1<E, A> class final

Left-associative binary operator chain: p (op p)* folded as ((a op b) op c) op d.

The interpreter handles this iteratively rather than via the recursive Or + FlatMap expansion that a hand-rolled definition would use, so chain depth does not consume Dart call frames.

Inheritance
Available extensions

Constructors

Chainl1(Parser<E, A> p, Parser<E, A Function(A, A)> op)
Creates a left-associative chain.
const

Properties

attempt Parser<Never, Result<E, A>>

Available on Parser<E, A>, provided by the ParserOps extension

Run this parser, restoring position on failure. Returns the Result.
no setter
capture Parser<E, String>

Available on Parser<E, A>, provided by the ParserOps extension

Run this parser and return the matched input as a string.
no setter
hashCode int
The hash code for this object.
no setterinherited
isSimple bool
True if this parser cannot consume input on failure. Used to skip save/restore in Many/Choice/Or loops.
no setterinherited
lookAhead Parser<ParseError, A>

Available on Parser<ParseError, A>, provided by the ParseErrorOps extension

Run this parser but consume no input on success (peek).
no setter
many Parser<E, List<A>>

Available on Parser<E, A>, provided by the ParserOps extension

Zero or more repetitions, collecting results into a list.
no setter
many1 Parser<E, List<A>>

Available on Parser<E, A>, provided by the ParserOps extension

One or more repetitions, collecting results into a list.
no setter
memoize Parser<E, A>

Available on Parser<E, A>, provided by the ParserOps extension

Simple memoization (no left-recursion support).
no setter
notFollowedBy Parser<ParseError, void>

Available on Parser<ParseError, A>, provided by the ParseErrorOps extension

Succeed (consuming nothing) if this parser would fail at the current position.
no setter
op Parser<E, A Function(A, A)>
The operator parser yielding a 2-arg combiner.
final
optional Parser<E, A?>

Available on Parser<E, A>, provided by the ParserOps extension

Try this parser; succeed with null if it fails (without consuming).
no setter
p Parser<E, A>
The element parser.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
skipMany Parser<E, void>

Available on Parser<E, A>, provided by the ParserOps extension

Zero or more repetitions, discarding results.
no setter

Methods

as<B>(B value) Parser<E, B>

Available on Parser<E, A>, provided by the ParserOps extension

Replace the result value.
between(Parser<E, Object?> left, Parser<E, Object?> right) Parser<E, A>

Available on Parser<E, A>, provided by the ParserOps extension

Match between left and right.
chainl1(Parser<E, A Function(A, A)> op) Parser<E, A>

Available on Parser<E, A>, provided by the ParserOps extension

Left-associative binary operator chain.
chainr1(Parser<E, A Function(A, A)> op) Parser<E, A>

Available on Parser<E, A>, provided by the ParserOps extension

Right-associative binary operator chain.
debug(String label) Parser<E, A>

Available on Parser<E, A>, provided by the ParserOps extension

Print a debug message with the parsed value or error details.
endBy(Parser<E, Object?> end) Parser<E, List<A>>

Available on Parser<E, A>, provided by the ParserOps extension

Zero or more, each terminated by end.
expect(String message) Parser<ParseError, A>

Available on Parser<ParseError, A>, provided by the ParseErrorOps extension

Replace the error message with message on failure.
flatMap<B>(Parser<E, B> f(A)) Parser<E, B>

Available on Parser<E, A>, provided by the ParserOps extension

Chain with a parser-producing function.
interpretWith(Result<E, T> run<T>(Parser<E, T> p, Parser<E, T Function(T, T)> op)) Result<E, A>
Dispatch to the interpreter with the element type in scope.
manyAtLeast(int n) Parser<E, List<A>>

Available on Parser<E, A>, provided by the ParserOps extension

At least n occurrences.
map<B>(B f(A)) Parser<E, B>

Available on Parser<E, A>, provided by the ParserOps extension

Transform the result value.
named(String name) Parser<ParseError, A>

Available on Parser<ParseError, A>, provided by the ParseErrorOps extension

Add name to expected-set in error messages on failure.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
or(Parser<E, A> other) Parser<E, A>

Available on Parser<E, A>, provided by the ParserOps extension

Try this parser; on failure, try other.
recover(Parser<E, A> recovery) Parser<E, A>

Available on Parser<E, A>, provided by the ParserOps extension

On failure, try recovery (producing Partial).
run(String input) Result<E, A>

Available on Parser<E, A>, provided by the ParserOps extension

Run this parser on input.
sepBy(Parser<E, Object?> sep) Parser<E, List<A>>

Available on Parser<E, A>, provided by the ParserOps extension

Zero or more, separated by sep.
sepBy1(Parser<E, Object?> sep) Parser<E, List<A>>

Available on Parser<E, A>, provided by the ParserOps extension

One or more, separated by sep.
skipThen<B>(Parser<E, B> other) Parser<E, B>

Available on Parser<E, A>, provided by the ParserOps extension

Run this parser then other, keeping only the right result.
surroundedBy(Parser<E, Object?> delim) Parser<E, A>

Available on Parser<E, A>, provided by the ParserOps extension

Match between the same delim on both sides.
thenSkip(Parser<E, Object?> other) Parser<E, A>

Available on Parser<E, A>, provided by the ParserOps extension

Run this parser then other, keeping only the left result.
times(int n) Parser<E, List<A>>

Available on Parser<E, A>, provided by the ParserOps extension

Exactly n occurrences.
toString() String
A string representation of this object.
inherited
trace(String label) Parser<E, A>

Available on Parser<E, A>, provided by the ParserOps extension

Print a trace message when this parser is tried and when it succeeds/fails.
zip<B>(Parser<E, B> other) Parser<E, (A, B)>

Available on Parser<E, A>, provided by the ParserOps extension

Run this parser then other, returning both results as a record.

Operators

operator ==(Object other) bool
The equality operator.
inherited
operator |(Parser<E, A> other) Parser<E, A>

Available on Parser<E, A>, provided by the ParserOps extension

Alias for or. Try this parser; on failure, try other.