Merge pull request #950 from ericvergnaud/suppress-octals-in-javascript-serialization

Fix antlr4-javascript #36.
This commit is contained in:
Terence Parr 2015-07-05 09:02:19 -07:00
commit 735b40431d
1 changed files with 1 additions and 6 deletions

View File

@ -176,15 +176,10 @@ public class JavaScriptTarget extends Target {
return targetCharValueEscape[v];
}
if (v >= 0x20 && v < 127 && (!Character.isDigit(v) || v == '8' || v == '9')) {
if (v >= 0x20 && v < 127) {
return String.valueOf((char)v);
}
if ( v>=0 && v<=127 ) {
String oct = Integer.toOctalString(v);
return "\\"+ oct;
}
String hex = Integer.toHexString(v|0x10000).substring(1,5);
return "\\u"+hex;
}