[antlr-interest] HELP: Escape sequences and string template

Kay Röpke kroepke at classdump.org
Fri Aug 15 13:49:50 PDT 2008


Hi!

On Aug 15, 2008, at 10:33 PM, Ramanand Mandayam wrote:

> However the output of the string template processing phase deletes  
> the first '\' and prints only the second one. When the generated  
> code is processed as a JAVA file the compiler (as it should)  
> generates errors complaining about invalid unicode characters.
>
> Does the string template process need some special treatment when  
> dealing with '\' characters.


Classical double escape issue: If you are always going to print that  
string, double escape it (i.e. escape each \ to \\) in the lexer rule.  
It's ugly, but most likely the only way.

cheers,
-k
-- 
Kay Röpke
http://classdump.org/








More information about the antlr-interest mailing list