Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect parse when loops occur after ascends #8

Open
noughtmare opened this issue Jun 16, 2023 · 0 comments
Open

Incorrect parse when loops occur after ascends #8

noughtmare opened this issue Jun 16, 2023 · 0 comments
Labels
bug Something isn't working
Milestone

Comments

@noughtmare
Copy link
Owner

noughtmare commented Jun 16, 2023

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.

@noughtmare noughtmare added the bug Something isn't working label Jun 16, 2023
@noughtmare noughtmare added this to the 0.2 milestone Jun 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant