Move unescaping regexps under a codegen option (unescape_regexps)
This commit is contained in:
@@ -51,6 +51,7 @@ function OutputStream(options) {
|
|||||||
quote_keys : false,
|
quote_keys : false,
|
||||||
space_colon : true,
|
space_colon : true,
|
||||||
ascii_only : false,
|
ascii_only : false,
|
||||||
|
unescape_regexps : false,
|
||||||
inline_script : false,
|
inline_script : false,
|
||||||
width : 80,
|
width : 80,
|
||||||
max_line_len : 32000,
|
max_line_len : 32000,
|
||||||
@@ -1150,7 +1151,7 @@ function OutputStream(options) {
|
|||||||
var str = self.getValue().toString();
|
var str = self.getValue().toString();
|
||||||
if (output.option("ascii_only")) {
|
if (output.option("ascii_only")) {
|
||||||
str = output.to_ascii(str);
|
str = output.to_ascii(str);
|
||||||
} else {
|
} else if (output.option("unescape_regexps")) {
|
||||||
str = str.split("\\\\").map(function(str){
|
str = str.split("\\\\").map(function(str){
|
||||||
return str.replace(/\\u[0-9a-fA-F]{4}|\\x[0-9a-fA-F]{2}/g, function(s){
|
return str.replace(/\\u[0-9a-fA-F]{4}|\\x[0-9a-fA-F]{2}/g, function(s){
|
||||||
var code = parseInt(s.substr(2), 16);
|
var code = parseInt(s.substr(2), 16);
|
||||||
|
|||||||
Reference in New Issue
Block a user