[antlr-interest] Inserting tokens?

Gavin Lambert antlr at mirality.co.nz
Fri Oct 17 13:42:15 PDT 2008


At 08:03 18/10/2008, Greg Smolyn wrote:
 >Does it makes sense to modify the IDENT token so it looks like
 >
 >IDENT: F_IDENT | F_IDENTWITHHASH | F_IDENTWITHCLASS ;
 >
 >and in the latter two actually emit an IDENT, Space, and HASH or 

 >CLASS token?

No, because only the top-level lexer rule can emit tokens.

I think a better idea would be to make combinator optional in the 
selector rule.  That way the space is allowed but not required.

I'm a little surprised that you're not hiding whitespace, 
though.  I didn't think CSS was whitespace-sensitive..?  (Not that 
there's anything wrong with not hiding whitespace.)



More information about the antlr-interest mailing list