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

Crash with NullPointerException in SymbolChecks.checkForModeConflicts with empty lexer #1188

Closed
octylFractal opened this issue May 6, 2016 · 0 comments

Comments

@octylFractal
Copy link

If I provide an empty lexer, then ANTLR will crash with a confusing NullPointerException. I don't think an empty lexer is really a common case, but the NPE had me worried for a little bit because I didn't understand what was causing it.

The cause is that LexerGrammar doesn't initialize modes until a rule is added.

Relevant stacktrace:

Caused by: java.lang.NullPointerException
    at org.antlr.v4.semantics.SymbolChecks.checkForModeConflicts(SymbolChecks.java:278)
    at org.antlr.v4.semantics.SemanticPipeline.process(SemanticPipeline.java:132)
    at org.antlr.v4.Tool.processNonCombinedGrammar(Tool.java:399)
    at org.antlr.v4.Tool.process(Tool.java:386)
    at org.antlr.v4.Tool.processGrammarsOnCommandLine(Tool.java:345)
@parrt parrt closed this as completed in dc2c9b0 Nov 22, 2016
@parrt parrt added this to the 4.6 milestone Nov 22, 2016
@parrt parrt added the grammars label Nov 22, 2016
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

2 participants