-
Notifications
You must be signed in to change notification settings - Fork 36
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
Infinite loop bug #4
Comments
This shouldn't cause an infinite loop, as Could you please provide a test grammar file that triggers this bug? Regarding code style, well... Parsers are not for the faint of heart. They are bound to contain some nasty stuff here and there, due to the nature of the problem they solve (trying to translate human text input into program language). The code in question is part of the error-recovery. If an alternative didn't parse correctly, it is logged, one token is discarded and the same alternative is tried again. Using here |
Hi, I have a similar issue with this loop. Although the loop is not infinite, is some cases the number of recursive calls produce a You can recreate the bug with the grammar and text to parse at the end of this message. I tried to reproduce the bug with a simpler grammar but did not succeed. The bug is probably due by the fact that at Parser.cs:587 a Grammar:
Text to parse:
|
Hi again!
After some testing I've discovered that
for
loop at https://github.com/cederberg/grammatica/blob/master/src/csharp/PerCederberg.Grammatica.Runtime/RecursiveDescentParser.cs#L213 executes infinitely in some cases. And here's some criticism for you: the thing you've done by increasing/decreasing loop counter within loop is pretty much anti-pattern. It's very, very hard to understand what was your intention there, and what has gone wrong.The text was updated successfully, but these errors were encountered: