parseOn method
Primitive method doing the actual parsing.
The method is overridden in concrete subclasses to implement the
parser specific logic. The methods takes a parse context
and
returns the resulting context, which is either a Success or
Failure context.
Implementation
@override
Result<List<R>> parseOn(Context context) {
var current = context;
final elements = <R>[];
for (var i = 0; i < children.length; i++) {
final result = children[i].parseOn(current);
if (result is Failure) return result;
elements.add(result.value);
current = result;
}
return current.success(elements);
}