I altered Target.getTargetStringLiteralFromANTLRStringLiteral() so that it converts \uXXXX in an ANTLR string to \uXXXX, thus, avoiding Java's conversion to a single character before compilation. Fixes antlr/antlr#111

This commit is contained in:
Terence Parr 2012-12-31 15:04:36 -08:00
parent 5d390b4a90
commit bd46ac1c3f
2 changed files with 8 additions and 1 deletions

View File

@ -1,5 +1,11 @@
ANTLR v4 Honey Badger
December 31, 2012
* I altered Target.getTargetStringLiteralFromANTLRStringLiteral() so that
it converts \uXXXX in an ANTLR string to \\uXXXX, thus, avoiding Java's
conversion to a single character before compilation.
December 16, 2012
* Encapsulate some fields in ANTLRMessage

View File

@ -284,7 +284,8 @@ public class Target {
case 'f':
case '\\':
case 'u': // Assume unnnn
sb.append('\\'); // Pass the escape through
sb.append('\\'); // Pass the escape through as double \\
sb.append('\\'); // so that Java leaves as \u0000 string not char
break;
default:
// Remove the escape by virtue of not adding it here