Move unescaping regexps under a codegen option (unescape_regexps)

This commit is contained in:
Mihai Bazon
2014-01-26 10:05:55 +02:00
parent 6f9d051784
commit ceb200fe81

View File

@@ -51,6 +51,7 @@ function OutputStream(options) {
quote_keys : false,
space_colon : true,
ascii_only : false,
unescape_regexps : false,
inline_script : false,
width : 80,
max_line_len : 32000,
@@ -1150,7 +1151,7 @@ function OutputStream(options) {
var str = self.getValue().toString();
if (output.option("ascii_only")) {
str = output.to_ascii(str);
} else {
} else if (output.option("unescape_regexps")) {
str = str.split("\\\\").map(function(str){
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);