[antlr-interest] ast rewrite
Terence Parr
parrt at cs.usfca.edu
Mon Dec 4 09:48:23 PST 2006
On Dec 4, 2006, at 6:43 AM, Alexander Gängel wrote:
> 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)
Hi Alexander. I think it's okay, because the Java API for String
says "The substring begins at the specified beginIndex and extends to
the character at index endIndex - 1."
> I now use this:
>
> String :
> '\'' ~('\'')* '\'' {setText(getText().substring(1, getText
> ().length()-1));}
> ;
Does that work? are you not missing the last character before the
last quote?
Ter
More information about the antlr-interest
mailing list