[antlr-interest] HELP: Escape sequences and string template
ramanand_mandayam at yahoo.com
Fri Aug 15 13:33:54 PDT 2008
I have a string token that contains windows file names which use '\' as folder name separators. In the JAVA target I have rule actions that print out these tokens using the "st" attribute of the node (which in turn is
derived from the "text" attribute of the token).
To escape the '\' itself, the input token string contains the sequence "\\", the intent being to pass the backslash to the final output code that is generated.
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.
More information about the antlr-interest