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

Parse repeated syntax with loops instead of recursion #666

Closed
SimonSapin opened this issue Sep 27, 2023 · 0 comments · Fixed by #721
Closed

Parse repeated syntax with loops instead of recursion #666

SimonSapin opened this issue Sep 27, 2023 · 0 comments · Fixed by #721

Comments

@SimonSapin
Copy link
Contributor

SimonSapin commented Sep 27, 2023

PR #662 made the parser recursion limit apply to every case recursion was used (hopefully i didn’t miss any). In same cases (nested selection set, nested values, arguably nested list types) recursion does make parsing significantly easier. But as of this writing recursion is also used in many case to parse repetition, where it could be easily replaced with a loop.

This issue is fixed if the test added by #662 still passes after uncommenting this assertion:

// assert_eq!(ast.errors.len(), 0)

SimonSapin added a commit that referenced this issue Sep 27, 2023
…662)

The limit was only tracked for nested selection sets, but the parser turns out
to use recursion in other cases too. Issue #666 tracks reducing them.
Stack overflow was observed with little more than 2000
nesting levels or repetitions in the new test.
Defaulting to a quarter of that leaves a comfortable margin.
@goto-bus-stop goto-bus-stop self-assigned this Nov 2, 2023
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.

2 participants