[antlr-interest] skipping tokens

Sam Barnett-Cormack sdb at geekworld.co.uk
Fri May 26 14:33:23 PDT 2006


Terence Parr wrote:
> So, should lexer rules do like v2 and set "token = Token.SKIP;" in an 
> action so that a token is ignored and another is attempted?  What  about
> a method call "skip();" or something?  The method call is more 
> flexible, but what if some targets can only skip by setting a local  var
> or something in the lexer rule?  The skip() method would not be  able to
> alter them.
> 
> Perhaps we use skip() as the default action and languages that must  set
> locals can force v2 style assignments.  Thoughts?

I don't know much about the implementation, certainly virtually nothing
about v3. However, it strikes me that, with all the funky template-based
generation and magic, you ought to be able to have $skip(); or similar
that expands based on the language being generated...

Sam



More information about the antlr-interest mailing list