fastParseOn method
Primitive method doing the actual parsing.
This method is an optimized version of Parser.parseOn that is getting its speed advantage by avoiding any unnecessary memory allocations.
The method is overridden in most concrete subclasses to implement the
optimized logic. As an input the method takes a buffer
and the current
position
in that buffer. It returns a new (positive) position in case
of a successful parse, or -1
in case of a failure.
Subclasses don't necessarily have to override this method, since it is emulated using its slower brother.
Implementation
int fastParseOn(String buffer, int position) {
final result = parseOn(Context(buffer, position));
return result is Failure ? -1 : result.position;
}