[antlr-interest] Empty ifs in Java

Patrick Zimmermann patrick at zakweb.de
Sat Nov 5 05:41:20 PDT 2011


Hello,

I'm new to this mailing list, so hello everyone.

I currently try to create a grammar to parse a textual wiki syntax.
I'm using ANTLR 3.4 and the Java generator.

I've reached a situation where ANTLR creates empty ifs in the generated Java 
code and I boiled it down to the following grammar:

grammar failuretest;
start:		letter+;
letter:		'A' .. 'B';

The resulting Java code contains the following statements:
...
if ( () ) {
...
if (  ) {
...

As far as I know this is no legal Java. And the grammar looks fine to me, apart 
from that the second rule should probably be a lexer rule.

So could this actually be a bug in antlr?


Many thanks in advance,
Patrick Zimmermann


More information about the antlr-interest mailing list