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<String> parseOn(Context context) {
final start = context.position;
final stop = start + length;
if (stop <= context.buffer.length) {
final result = context.buffer.substring(start, stop);
if (predicate(result)) return context.success(result, stop);
}
return context.failure(message);
}