If one alternative succeeds and performs an ascend and later another alternative from the same recursion depth finds a loop then the combination of that ascend and loop is missed.
For example the expr2 test case:
expr2 = 'expr2
::= number 10
<|> (+) <$> expr2 <* char '+' <*> expr2
There are probably several ways to solve this. One way could be to remember the final results of ascends such that they can be used if a loop is found in the future.
Or perhaps we could process all alternatives until either a loop is found or input is consumed. And collect all the loops that way before continuing to parse the non-loopy alternatives. That would require some special treatment of empty parsers.
If one alternative succeeds and performs an ascend and later another alternative from the same recursion depth finds a loop then the combination of that ascend and loop is missed.
For example the
expr2test case:There are probably several ways to solve this. One way could be to remember the final results of ascends such that they can be used if a loop is found in the future.
Or perhaps we could process all alternatives until either a loop is found or input is consumed. And collect all the loops that way before continuing to parse the non-loopy alternatives. That would require some special treatment of empty parsers.