Move unescaping regexps under a codegen option (unescape_regexps)
This commit is contained in:
@@ -46,22 +46,23 @@
|
|||||||
function OutputStream(options) {
|
function OutputStream(options) {
|
||||||
|
|
||||||
options = defaults(options, {
|
options = defaults(options, {
|
||||||
indent_start : 0,
|
indent_start : 0,
|
||||||
indent_level : 4,
|
indent_level : 4,
|
||||||
quote_keys : false,
|
quote_keys : false,
|
||||||
space_colon : true,
|
space_colon : true,
|
||||||
ascii_only : false,
|
ascii_only : false,
|
||||||
inline_script : false,
|
unescape_regexps : false,
|
||||||
width : 80,
|
inline_script : false,
|
||||||
max_line_len : 32000,
|
width : 80,
|
||||||
beautify : false,
|
max_line_len : 32000,
|
||||||
source_map : null,
|
beautify : false,
|
||||||
bracketize : false,
|
source_map : null,
|
||||||
semicolons : true,
|
bracketize : false,
|
||||||
comments : false,
|
semicolons : true,
|
||||||
preserve_line : false,
|
comments : false,
|
||||||
screw_ie8 : false,
|
preserve_line : false,
|
||||||
preamble : null,
|
screw_ie8 : false,
|
||||||
|
preamble : null,
|
||||||
}, true);
|
}, true);
|
||||||
|
|
||||||
var indentation = 0;
|
var indentation = 0;
|
||||||
@@ -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