[antlr-interest] ast rewrite

Alexander Gängel alexander at gaengel.de
Mon Dec 4 06:43:22 PST 2006


Ok I found it in the wiki:

STRING: '\"' CHARS '\"' {setText(getText().substring(1, getText().length()));} ;

but with this I still have the tailing '

I thins the wiki is wrong in this point. (I'mnot sure if I just misssomething)

I now use this:

String    :
     '\''  ~('\'')* '\''   {setText(getText().substring(1, 
getText().length()-1));}
     ;

Alexander


Alexander Gängel schrieb:
> Hi,
> I have a lexer rule like this:
>
> String    :
>     '\''  ~('\'')* '\''
>     ;
>
> but I would like to have in the AST only the sting without the single 
> quotes
>
> is this possible?
>
> I use AntlrWorks 1.0b6


More information about the antlr-interest mailing list