[antlr-interest] Antlr 3 and the newline token problem

John B. Brodie jbb at acm.org
Fri Nov 25 15:17:53 PST 2005


Pardon me for being stupid...

but would it make sense that instead of


WS : '\r' '\n' {newline();}
       | '\r'    {newline();}
       | '\n'   {newline();}
     ;



use



WS : ( '\r' ( '\n' )? | '\n' ) { newline(); /*$setType(Token.SKIP)*/ };



for me, no non-determinism.

i haven't had to deal with line/col tracking (yet;-). but seems like
my version calls newline() in the same way as the non-deterministic
version...

hope this helps...
   -jbb


More information about the antlr-interest mailing list