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

ParseRuleContext in empty input has undefined stop token #71

Open
lonely-lockley opened this issue May 12, 2024 · 1 comment
Open

ParseRuleContext in empty input has undefined stop token #71

lonely-lockley opened this issue May 12, 2024 · 1 comment
Labels
possible-bug Could be a bug

Comments

@lonely-lockley
Copy link

In java ANTLR4 implementation the code like:

var parseTree = parser.parse();

returns a ParseRuleContext object with start and stop token pointing to EOF for zero-length input. This library returns start as expected, but stop property value is undefined. This breaks the logic of searching for the rule bounds (from parseTree.start!.start to parseTree.stop!.stop). I've added additional checks, but it would be nice not to have them at all.

antlr4ng version 3.0.4
antlr4ng-cli version 2.0.0

@mike-lischke
Copy link
Owner

Odd, the stop token is only omitted in case of errors. At least that's what I though until now.

@mike-lischke mike-lischke added the possible-bug Could be a bug label May 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
possible-bug Could be a bug
Projects
None yet
Development

No branches or pull requests

2 participants