[antlr-interest] How exclude a symbol from lexer rule?
Sergiy Karpenko
bergschloss at ukr.net
Tue Oct 7 12:05:17 PDT 2008
Yeah I know this way. But it is complicated when lexer rule has a lot of subrules. And I need both of them. Original rule and modified.
So, in this case there is a lot of work for update each subrule.
Decision, I chose, is:
CHAR: CHARSET_WITHOUT_EXCHARS I EXCLUDED_CHARS;
CHARSET_WITHOUT_EXCHARS: ('a'..'j')|('l'..'z')|('0'..'9');
EXCLUDED_CHARS: 'k';
Thanks
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20081007/d221b6dd/attachment.html
More information about the antlr-interest
mailing list