uglify: Fix logic that determines whether we can uglify a file

Thu, 27 May 2010 15:04:58 +0100

author
Matthew Wild <mwild1@gmail.com>
date
Thu, 27 May 2010 15:04:58 +0100
changeset 63
f42b3815ce77
parent 62
15c48274ee1f
child 64
4beddef56d73

uglify: Fix logic that determines whether we can uglify a file

uglify/squish.uglify.lua file | annotate | diff | comparison | revisions
--- a/uglify/squish.uglify.lua	Thu May 27 15:01:52 2010 +0100
+++ b/uglify/squish.uglify.lua	Thu May 27 15:04:58 2010 +0100
@@ -29,10 +29,10 @@
 	end
 
 	
-	while base_char + #keywords < 255 and code:find("["..string.char(base_char).."-"..string.char(base_char+#keywords-1).."]") do
+	while base_char + #keywords <= 255 and code:find("["..string.char(base_char).."-"..string.char(base_char+#keywords-1).."]") do
 		base_char = base_char + 1;
 	end
-	if base_char == 255 then
+	if base_char + #keywords > 255 then
 		-- Sorry, can't uglify this file :(
 		-- We /could/ use a multi-byte marker, but that would complicate
 		-- things and lower the compression ratio (there are quite a few 
@@ -57,7 +57,7 @@
 	llex.llex()
 	local seminfo = llex.seminfo;
 	
-	if opts.uglify_level == "full" then
+	if opts.uglify_level == "full" and base_char+#keywords < 255 then
 		-- Find longest TK_NAME and TK_STRING tokens
 		local scores = {};
 		for k,v in ipairs(llex.tok) do

mercurial