uglify-js
Advanced tools
Comparing version 0.0.3 to 0.0.4
@@ -255,14 +255,15 @@ /*********************************************************************** | ||
function tokenizer($TEXT, skip_comments) { | ||
function tokenizer($TEXT) { | ||
var S = { | ||
text : $TEXT.replace(/\r\n?|[\n\u2028\u2029]/g, "\n").replace(/^\uFEFF/, ''), | ||
pos : 0, | ||
tokpos : 0, | ||
line : 0, | ||
tokline : 0, | ||
col : 0, | ||
tokcol : 0, | ||
newline_before : false, | ||
regex_allowed : false | ||
text : $TEXT.replace(/\r\n?|[\n\u2028\u2029]/g, "\n").replace(/^\uFEFF/, ''), | ||
pos : 0, | ||
tokpos : 0, | ||
line : 0, | ||
tokline : 0, | ||
col : 0, | ||
tokcol : 0, | ||
newline_before : false, | ||
regex_allowed : false, | ||
comments_before : [] | ||
}; | ||
@@ -302,3 +303,3 @@ | ||
function token(type, value) { | ||
function token(type, value, is_comment) { | ||
S.regex_allowed = ((type == "operator" && !HOP(UNARY_POSTFIX, value)) || | ||
@@ -315,2 +316,6 @@ (type == "keyword" && HOP(KEYWORDS_BEFORE_EXPRESSION, value)) || | ||
}; | ||
if (!is_comment) { | ||
ret.comments_before = S.comments_before; | ||
S.comments_before = []; | ||
} | ||
S.newline_before = false; | ||
@@ -422,3 +427,3 @@ return ret; | ||
} | ||
return token("comment1", ret); | ||
return token("comment1", ret, true); | ||
}; | ||
@@ -431,3 +436,3 @@ | ||
text = S.text.substring(S.pos, i), | ||
tok = token("comment2", text); | ||
tok = token("comment2", text, true); | ||
S.pos = i + 2; | ||
@@ -480,17 +485,16 @@ S.line += text.split("\n").length - 1; | ||
var handle_slash = skip_comments ? function() { | ||
function handle_slash() { | ||
next(); | ||
var regex_allowed = S.regex_allowed; | ||
switch (peek()) { | ||
case "/": read_line_comment(); S.regex_allowed = regex_allowed; return next_token(); | ||
case "*": read_multiline_comment(); S.regex_allowed = regex_allowed; return next_token(); | ||
case "/": | ||
S.comments_before.push(read_line_comment()); | ||
S.regex_allowed = regex_allowed; | ||
return next_token(); | ||
case "*": | ||
S.comments_before.push(read_multiline_comment()); | ||
S.regex_allowed = regex_allowed; | ||
return next_token(); | ||
} | ||
return S.regex_allowed ? read_regexp() : read_operator("/"); | ||
} : function() { | ||
next(); | ||
switch (peek()) { | ||
case "/": return read_line_comment(); | ||
case "*": return read_multiline_comment(); | ||
} | ||
return S.regex_allowed ? read_regexp() : read_operator("/"); | ||
}; | ||
@@ -620,9 +624,9 @@ | ||
var S = { | ||
input: tokenizer($TEXT, true), | ||
token: null, | ||
prev: null, | ||
peeked: null, | ||
in_function: 0, | ||
in_loop: 0, | ||
labels: [] | ||
input : typeof $TEXT == "string" ? tokenizer($TEXT, true) : $TEXT, | ||
token : null, | ||
prev : null, | ||
peeked : null, | ||
in_function : 0, | ||
in_loop : 0, | ||
labels : [] | ||
}; | ||
@@ -629,0 +633,0 @@ |
{"name" : "uglify-js", | ||
"author" : "Mihai Bazon - http://github.com/mishoo", | ||
"version" : "0.0.3", | ||
"version" : "0.0.4", | ||
"main" : "index.js", | ||
"bin" : { "uglifyjs" : "./bin/uglifyjs" }, | ||
} |
@@ -1,1 +0,1 @@ | ||
e=d=c=b=a=1;if((longname=2)+1)if(x=3)var z=7;x=y=z=1,h=g+=1,j=++i,j=++i+17 | ||
a=1,b=a,c=1,d=b,e=d,longname=2;if(longname+1){x=3;if(x)var z=7}z=1,y=1,x=1,g+=1,h=g,++i,j=i,i++,j=i+17 |
@@ -1,1 +0,1 @@ | ||
var a=a+"ab1"+c,b=a+"cds123"+c,c=a+"c123"+d+"ds"+c | ||
var a=a+"a"+"b"+1+c,b=a+"c"+"ds"+123+c,c=a+"c"+123+d+"ds"+c |
@@ -1,1 +0,1 @@ | ||
for(a=func(),b=z,a++;i<10;i++)alert(i);var z=1;for(g=2;i<10;i++)alert(i);for(var a=2,i=1;i<10;i++)alert(i) | ||
a=func(),b=z;for(a++;i<10;i++)alert(i);var z=1;g=2;for(;i<10;i++)alert(i);var a=2;for(var i=1;i<10;i++)alert(i) |
@@ -1,1 +0,1 @@ | ||
var a=0;switch(a){case 0:++a} | ||
var a=0;switch(a){case 0:a++} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
79
167323
2758