parse method
Parses the input and returns a result wrapped in Result if successful,
null
otherwise.
Implementation
@override
Result<List<({int start, int end, String value})>>? parse(
State<StringReader> state) {
final input = state.input;
final length = input.length;
if (state.pos >= length) {
return Result([]);
}
final list = <({int start, int end, String value})>[];
while (state.pos < length) {
final start = state.pos;
final r = p.parse(state);
if (r == null) {
input.readChar(state.pos);
state.pos += input.count;
} else {
final v = input.substring(start, state.pos);
list.add((start: start, end: state.pos, value: v));
}
}
return Result(list);
}