diff options
author | Mihai Bazon <mihai@bazon.net> | 2014-01-26 10:05:55 +0200 |
---|---|---|
committer | Mihai Bazon <mihai@bazon.net> | 2014-01-26 10:05:55 +0200 |
commit | ceb200fe81b42e0abd2242018530d6d952eb058d (patch) | |
tree | 2f5809974da92192760389d1c562aea2f01d878f | |
parent | 6f9d0517841a543807019daf51a88c5e24c24690 (diff) | |
download | tracifyjs-ceb200fe81b42e0abd2242018530d6d952eb058d.tar.gz tracifyjs-ceb200fe81b42e0abd2242018530d6d952eb058d.zip |
Move unescaping regexps under a codegen option (`unescape_regexps`)
-rw-r--r-- | lib/output.js | 35 |
1 files changed, 18 insertions, 17 deletions
diff --git a/lib/output.js b/lib/output.js index c2f49e9e..55039030 100644 --- a/lib/output.js +++ b/lib/output.js @@ -46,22 +46,23 @@ function OutputStream(options) { options = defaults(options, { - indent_start : 0, - indent_level : 4, - quote_keys : false, - space_colon : true, - ascii_only : false, - inline_script : false, - width : 80, - max_line_len : 32000, - beautify : false, - source_map : null, - bracketize : false, - semicolons : true, - comments : false, - preserve_line : false, - screw_ie8 : false, - preamble : null, + indent_start : 0, + indent_level : 4, + quote_keys : false, + space_colon : true, + ascii_only : false, + unescape_regexps : false, + inline_script : false, + width : 80, + max_line_len : 32000, + beautify : false, + source_map : null, + bracketize : false, + semicolons : true, + comments : false, + preserve_line : false, + screw_ie8 : false, + preamble : null, }, true); var indentation = 0; @@ -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); |