Mike,
The entire grammar file is over 2000 lines, so I can't post it, but below are screen-shots of relevant sections. There are over 70 rule-elements for the "statement" rule.
Below the grammar excerpt is the nested if-else condition that hangs with ANTLR 4.6.1 (only a portion is shown, the condition is 24 levels deep).
I'm surprised about the not-merged comment... the option was accepted by the code-generator, so there is at least some level of support i think. Just to be sure, when I used a nonsensical option name, an exception was thrown during code-generation that the option was unknown.
Another observation - the grammar used to have an "end if" rule element following "elseStat" in the first rule below. None of our queries actually need or use it, so I removed it. With this change, ANTLR 4.0, parsing time for the nested if came down from almost 10 minutes to under 4 minutes. Version 4.6.1 still got hung up for almost 2 hours before I killed it. In production usage, no one really uses such deep nesting, but this is one our test cases, and this issue has stopped us from upgrading to the latest ANTLR version.
Any suggestions on things I can try are most welcome.
Thanks,
Gautham