-
Notifications
You must be signed in to change notification settings - Fork 62
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
Simple expression parser tests fail when executing out-of-order #77
Comments
Yes, looks like the tests are not isolated, as they should be. But I think that's not tricky to solve. I would much appreciate if you could file a PR for that while you are at it. And of course once you are done with your port I'll happily take it as another contribution! |
Hey Mike, sorry for the delay. I'll see what I can do.
We'll try to add the python port soon! |
Good questions. Ignored tokens should not appear in the candidate lists, otherwise you wouldn't need to add them to the ignore list. It's not clear how this could have been accepted in the past. Having a per instance cache for the follow sets seems counterproductive. The ATN is static and lives during the entire application lifetime. Parsing different input doesn't invalidate it or change it. Only the DFA cache changes while parsing is going on, but that has no influence on the ATN walk the c3 engine is performing when looking for candidates. |
When executing the "Typical setup" test case of the simple expression parser without running the "Most simple setup" case first, it fails with the following error:
This can be reproduced by simply deleting the "Most simple setup" case and running
npm run test
.As far as I can see, the problem stems from two issues:
ExprLexer.ID
andExprLexer.EQUAL
tokens are inignoredTokens
of the code completion core, is it expected that they are included in the following lists of the candidate tokens?followSetsByATN
field, which is static and is therefore shared between different instances of the class. Maybe it makes sense to reset the field at the beginning of each test case to ensure a reproducible state? Also, the cache uses only the parser name as the key, which does not take configuration changes, e.g. differentignoredTokens
into account.In any case, thanks for the great work! I'm currently working on a python port of the library for my employer, and hope to contribute it once it is done. Please let me know if I can help with fixing this bug 🙂
The text was updated successfully, but these errors were encountered: