streamly
streamly copied to clipboard
A parser that follows another parser and computes location information
The problem to be solved is the parse error position reporting in a modular way. To do that we can use a separate parser which computes the current position from the stream. This position could be byte position, line number or any other way of indicating the position. The position parser would accept the input that has already been consumed and discarded by the main parser. Therefore, the parser driver just needs to feed it the input that is being discarded from the backtrack buffer. Anything that is still in the backtrack buffer does not need to be given to this parser as it can be accounted at the time of error.
See #591