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

Stack overflow achieved with left recursion undetected #1047

Closed
AntoineGuilminCrepon opened this issue Oct 15, 2024 · 2 comments · Fixed by #1048
Closed

Stack overflow achieved with left recursion undetected #1047

AntoineGuilminCrepon opened this issue Oct 15, 2024 · 2 comments · Fixed by #1048

Comments

@AntoineGuilminCrepon
Copy link

Describe the bug
Managed to create a stack overflow by avoiding the "anti-left-recursive" check.

To Reproduce

  • Create a left-recursive grammar rule (e.g. expr = { expr ~ infix ~ expr })
  • Add a predicate checking an obviously true (or obviously false) statement (e.g expr = { !(EOI) ~ expr ~ infix ~ expr })
  • pest_derive does not trigger left-recursion, and let you construct a left-recursive parser.

Expected behavior
pest-derive should ignore predicates for checking left-recursion, since those don't consume any character.

@tomtau
Copy link
Contributor

tomtau commented Oct 15, 2024

@Tartasprint was collecting these edge cases: #851

not sure if this one falls under examples there

@Tartasprint
Copy link
Contributor

I can give a look. Sorry I never finished what I started. To be honest I don't remember much, except I was pretty sure I documented all edge cases at the time. But I'll try again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants