Fix antlr4-javascript #36.

Octal is not supported in strict mode.
This commit is contained in:
Eric Vergnaud 2015-07-05 13:19:50 +08:00
parent 53678867ca
commit d1eb13cddc
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;
}