Skip to content

Python runtime is inconsistent with Java #3236

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

Closed
Vladimir-Chan opened this issue Jul 28, 2021 · 3 comments
Closed

Python runtime is inconsistent with Java #3236

Vladimir-Chan opened this issue Jul 28, 2021 · 3 comments
Milestone

Comments

@Vladimir-Chan
Copy link

Hello, I am analyzing c# source code with the grammar files in grammar repository by Python target. I converted the grammar actions to Python source. When I tested the grammar by a simple example, I got ParseCancellationException. After debugging, I find that the method nextTokenOnChannel in class BufferedTokenStream is inconsistent with Java. In Python, the comment says

Return -1 if there are no tokens on channel between i and EOF.

While in Java, it says

Return the index of the EOF token if there are no tokens on channel between {@code i} and EOF.

So, which is correct? Please give a consistent version, thx.

@ericvergnaud
Copy link
Contributor

It's an inconsistency between the various runtimes.
Seems the 16/06/2014 change in the Java version was never ported to Python.
Might affect other runtimes, depending on which code base they used as a starting point.

@ericvergnaud
Copy link
Contributor

Feel free to submit a PR

@Vladimir-Chan
Copy link
Author

Ok I have pulled request

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

No branches or pull requests

3 participants