[antlr-interest] strange code generated?

Martin Kohl martin.kohl at gmail.com
Fri Aug 31 07:26:10 PDT 2007


Hello,

Looking at the generated Parser.java, I've stumbled across the following
code:

if ( (synpred1()) ) {
   alt1=1;
}
else if ( (true) ) {
   alt1=2;
}
else {
   if (backtracking>0) {failed=true; return ;}
   NoViableAltException nvae =
                        new NoViableAltException(...);
   throw nvae;
}

I think the if(true){statement} can be replaced by statement, the
if(true){}else{} can be shortened to if(true){}.

Kind Regards,
Martin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20070831/d7bdf917/attachment.html 


More information about the antlr-interest mailing list