[antlr-interest] How exclude a symbol from lexer rule?

Dennis Benzinger Dennis.Benzinger at gmx.net
Tue Oct 7 10:08:19 PDT 2008


Am 07.10.2008 16:40, Sergiy Karpenko schrieb:
> Hi, all    
> For axample we have a lexer rule:    
>     
> CHAR : ('a'..'z')|('0'..'9');    
>     
> But, I want exclude from this sequence 'k' symbol.     
> Somethig like    
> EXTCHAR: CHAR ~'k' ;    
> [...]

You can do it the other way around:

EXTCHAR: ('a'..'j')|('l'..'z')|('0'..'9');
CHAR: EXTCHAR|'k';


HTH,
Dennis Benzinger


More information about the antlr-interest mailing list