-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Closed
Description
The title says it all. If G1 includes G2 etc. ... which includes G1 then the antlr tool crashes with stack overflow. It should rather print out some error diagnostics.
Here is an example tested with the version 4.7.1 of the tool :
grammar G1;
import G2;
r : ;
grammar G2;
import G1;
r : ;
$ antlr G1.g4
Exception in thread "main" java.lang.StackOverflowError
at java.util.HashMap.hash(HashMap.java:339)
at java.util.HashMap.get(HashMap.java:557)
at org.antlr.v4.Tool.loadImportedGrammar(Tool.java:617)
at org.antlr.v4.tool.Grammar.loadImportedGrammars(Grammar.java:391)
at org.antlr.v4.tool.Grammar.loadImportedGrammars(Grammar.java:405)
at org.antlr.v4.tool.Grammar.loadImportedGrammars(Grammar.java:405)
at org.antlr.v4.tool.Grammar.loadImportedGrammars(Grammar.java:405)
at org.antlr.v4.tool.Grammar.loadImportedGrammars(Grammar.java:405)
........