[antlr-interest] UnSkipping Tokens

Daniel Hernandez Bahr dbahr at estudiantes.uci.cu
Tue Mar 23 06:24:34 PDT 2010


Hello, everyone!

I was wondering if it would be possible to "unskip" a token for a 
certain parser rule, something like:

class MyLexer extends Lexer;
...
NEWLINE : '\u' | '\r' { $newline; $setType(Token.SKIP)};
...

class MyParser extends Parser;
...
somerule {/somehow tell the lexer not to skip the /NEWLINE/ token/}:
  /somerule production/ NEWLINE;

The thing is I need to recognize a NEWLINE in some specific sections of 
the code but it would be an enormous work not to skip it on every other 
parser rule.

Best regards,

D.H. Bahr


More information about the antlr-interest mailing list