diff --git a/CHANGES.txt b/CHANGES.txt index bcab03c35..a9a270e8d 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -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 diff --git a/tool/src/org/antlr/v4/codegen/Target.java b/tool/src/org/antlr/v4/codegen/Target.java index ba782db3f..45558b79b 100644 --- a/tool/src/org/antlr/v4/codegen/Target.java +++ b/tool/src/org/antlr/v4/codegen/Target.java @@ -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