parse method
Parses input data actively and produces the result.
Returns Tuple1 of the result if parsing was successful; otherwise
returns null
.
final r1 = p.parse(state);
Implementation
@override
Tuple1<List<E>>? parse(ParseState state) {
final pos = state.pos;
final r1 = p.parse(state);
if (r1 == null) {
return min == 0 ? Tuple1(<E>[]) : null;
}
final list = [r1.$0];
while (list.length < max) {
final r1 = p.parse(state);
if (r1 == null) {
break;
}
list.add(r1.$0);
}
if (list.length >= min) {
return Tuple1(list);
}
state.pos = pos;
}