Indent class

Stateful set of parsers to handle indentation-based grammars.

Typical use combines same to match the indentation of items at the current level and during to scope indented blocks:

final indent = Indent();
final line = indent.same & word().plus().flatten();
final block = indent.during(line.plus());

Based on https://stackoverflow.com/a/56926044/82303.

Constructors

Indent({Parser<String>? parser, String? message})
Creates an indentation handler with an optional indentation parser and error message.

Properties

decrease → Parser<void>
Parser that decreases the indentation by one level.
latefinal
hashCode → int
The hash code for this object.
no setterinherited
increase → Parser<String>
Parser that increases the indentation.
latefinal
message → String
The error message to use when an indentation is expected.
final
parser → Parser<String>
The parser used to read a single indentation step.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
same → Parser<String>
Parser that consumes and matches the current indentation level.
latefinal

Methods

during<R>(Parser<R> parser) → Parser<R>
Runs parser in a deeper indentation scope.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited