[antlr-interest] How exclude a symbol from lexer rule? (Sergiy Karpenko)

ajk . anders43 at gmail.com
Wed Oct 8 21:51:52 PDT 2008


CHAR: { LA(1) != 'k' )? ('a'..'z')|('0'..'9') ;

?


--------- Forwarded message ----------
> From: "Sergiy Karpenko" <bergschloss at ukr.net>
> To: Dennis Benzinger <Dennis.Benzinger at gmx.net>
> Date: Tue, 07 Oct 2008 22:05:17 +0300
> Subject: Re: [antlr-interest] How exclude a symbol from lexer rule?
>  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
>
>
>
>
>
>
> _______________________________________________
> antlr-interest mailing list
> antlr-interest at antlr.org
> http://www.antlr.org/mailman/listinfo/antlr-interest
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20081009/a14a1f96/attachment.html 


More information about the antlr-interest mailing list