[antlr-interest] v3 equivalent of char skip suffix.

Kay Roepke kroepke at classdump.org
Wed Jul 18 09:48:05 PDT 2007


On Jul 18, 2007, at 9:42 AM, Johannes Luber wrote:

> Alex Shneyderman wrote:
>> what would be the v3 equivalent of for the following v2 rule:
>>
>> BR  :  '<'! "br" '>'! ;
>>
>
> BR  :  '<'! 'br' '>'! ;
>
> should be correct.

This feature is not yet implemented in v3, sorry. You have to strip  
the characters in an action, via
{ setText(getText().subString(1,getText().length()-1)); }

For tree building it works, but ! in a lexer rule doesn't. It's  
because the text normally doesn't get copied, but refers back to
the character stream.

cheers,
-k

--  
Kay Röpke
http://classdump.org/






More information about the antlr-interest mailing list