ListParser<T> class abstract

A Parser that produces Lists of a type T.

Inheritance

Constructors

ListParser()

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

and(Parser other) Parser<List<T>>
Consumes this and another parser, but only considers the result of this parser.
inherited
back(int amount) Parser<List<T>>
Moves backward a certain amount of steps after parsing, if it was successful.
inherited
cache() Parser<List<T>>
Caches the results of parse attempts at various locations within the source text.
inherited
cast<U extends T>() Parser<U>
Casts this parser to produce U objects.
inherited
castDynamic() Parser
Casts this parser to produce dynamic objects.
inherited
change<U>(ParseResult<U> f(ParseResult<List<T>>)) Parser<U>
Runs the given function, which changes the returned ParseResult into one relating to a U object.
inherited
check(Matcher matcher, {String? errorMessage, SyntaxErrorSeverity? severity}) Parser<List<T>>
Validates the parse result against a Matcher.
inherited
error({String? errorMessage, SyntaxErrorSeverity? severity}) Parser<List<T>>
Binds an errorMessage to a copy of this parser.
inherited
first() Parser<T>
Shortcut for calling index with 0.
flatten() Parser<String>
Condenses a ListParser into having a value of the combined span's text.
foldErrors({bool equal(SyntaxError a, SyntaxError b)?}) Parser<List<T>>
Removes multiple errors that occur in the same spot; this can reduce noise in parser output.
inherited
forward(int amount) Parser<List<T>>
Skips forward a certain amount of steps after parsing, if it was successful.
inherited
index(int i) Parser<T>
Modifies this parser to only return the value at the given index i.
last() Parser<T>
Shortcut for calling index with the greatest-possible index.
map<U>(U f(ParseResult<List<T>>)) Parser<U>
Transforms the parse result using a unary function.
inherited
maxDepth(int depth) Parser<List<T>>
Prevents recursion past a certain depth, preventing stack overflow errors.
inherited
maybeParenthesized() Parser<List<T>>
Parses this, either as-is or wrapped in parentheses.
inherited
negate({String errorMessage = 'Negate error', SyntaxErrorSeverity severity = SyntaxErrorSeverity.error}) Parser<List<T>>
Ensures this pattern is not matched.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
opt({bool backtrack = true}) ListParser<T>
Produces an optional copy of this parser.
override
or<U>(Parser<List<T>> other) Parser<List<T>>
Shortcut for or-ing two parsers.
inherited
parenthesized() Parser<List<T>>
Parses this, wrapped in parentheses.
inherited
parse(SpanScanner scanner, [int depth = 1]) ParseResult<List<T>>
Parses text from a SpanScanner.
inherited
plus() ListParser<List<T>>
Parses this sequence one or more times.
inherited
reduce(T combine(T, T)) Parser<T>
Modifies this parser to call List.reduce on the parsed values.
safe({bool backtrack = true, String errorMessage = 'error', SyntaxErrorSeverity? severity}) Parser<List<T>>
Safely escapes this parser when an error occurs.
inherited
separatedBy(Parser other) Parser<List<List<T>>>
Expects to see an infinite amounts of the pattern, separated by the other pattern.
inherited
separatedByComma() Parser<List<List<T>>>
inherited
sort(Comparator<T> compare) ListParser<T>
Sorts the parsed values, using the given Comparator.
space() Parser<List<T>>
Consumes any trailing whitespace.
inherited
star({bool backtrack = true}) ListParser<List<T>>
Consumes 0 or more instance(s) of this parser.
inherited
stringify(CodeBuffer buffer) → void
Prints a representation of this parser, ideally without causing a stack overflow.
inherited
surroundedBy(Parser left, [Parser? right]) Parser<List<T>>
Expects to see the pattern, surrounded by the others.
inherited
surroundedByCurlyBraces({required List<T> defaultValue}) Parser<List<T>>
inherited
surroundedBySquareBrackets({required List<T> defaultValue}) Parser<List<T>>
inherited
then(Parser other) ListParser
Shortcut for chain-ing two parsers together.
inherited
times(int count, {bool exact = true, String tooFew = 'Too few', String tooMany = 'Too many', bool backtrack = true, SyntaxErrorSeverity? severity}) ListParser<List<T>>
Expect this pattern a certain number of times.
inherited
toList() ListParser<List<T>>
Casts this instance into a ListParser.
inherited
toString() String
A string representation of this object.
inherited
trail(Pattern pattern) Parser<List<T>>
Consumes and ignores any trailing occurrences of pattern.
inherited
value(List<T> f(ParseResult<List<T>?>)) Parser<List<T>>
Sets the value of the ParseResult.
inherited
where(bool f(T)) Parser<List<T>>
Modifies this parser, returning only the values that match a predicate.

Operators

operator &(Parser<List<T>> other) Parser<List<T>>
inherited
operator ==(Object other) bool
The equality operator.
inherited
operator |(Parser<List<T>> other) Parser<List<T>>
inherited
operator ~() Parser<List<T>>
inherited