[antlr-interest] specialStateTransition() in Java-generated lexer

Gavin Lambert antlr at mirality.co.nz
Thu Jul 23 14:39:36 PDT 2009


At 09:22 24/07/2009, Kevin J. Cummings wrote:
 >	The only usage of "s" after the "_s = s" assignment, are
 >assignments to "s" itself, which reflect a value depending
 >on the if statements inside the switch.  If you assigned a
 >positive value to s, return it.
 >Otherwise (I assume s is still -1) you break out of the switch
 >statement.  In which case (pun intended), since you are about to 

 >throw an exception, it contains the saved input value _s.  So,
 >the code looks good to me.....

Although it would have made more sense to alter the local variable 
and leave the parameter alone.  So, correct, yes, but "good" might 
be a bit of a stretch... :)



More information about the antlr-interest mailing list