This class is implemented manually to improve parsing errors.
All functions have running time O(n).
This class internally uses yield return to report early errors first.
Parsing error and token tracking is implemented with local members to improve readability (see ParsingError and _origin).