27 if shebang then |
27 if shebang then |
28 outfile:write(shebang) |
28 outfile:write(shebang) |
29 end |
29 end |
30 |
30 |
31 |
31 |
32 while base_char + #keywords < 255 and code:find("["..string.char(base_char).."-"..string.char(base_char+#keywords-1).."]") do |
32 while base_char + #keywords <= 255 and code:find("["..string.char(base_char).."-"..string.char(base_char+#keywords-1).."]") do |
33 base_char = base_char + 1; |
33 base_char = base_char + 1; |
34 end |
34 end |
35 if base_char == 255 then |
35 if base_char + #keywords > 255 then |
36 -- Sorry, can't uglify this file :( |
36 -- Sorry, can't uglify this file :( |
37 -- We /could/ use a multi-byte marker, but that would complicate |
37 -- We /could/ use a multi-byte marker, but that would complicate |
38 -- things and lower the compression ratio (there are quite a few |
38 -- things and lower the compression ratio (there are quite a few |
39 -- 2-letter keywords) |
39 -- 2-letter keywords) |
40 outfile:write(code); |
40 outfile:write(code); |
55 -- Go lexer! |
55 -- Go lexer! |
56 llex.init(code, "@"..infile_fn); |
56 llex.init(code, "@"..infile_fn); |
57 llex.llex() |
57 llex.llex() |
58 local seminfo = llex.seminfo; |
58 local seminfo = llex.seminfo; |
59 |
59 |
60 if opts.uglify_level == "full" then |
60 if opts.uglify_level == "full" and base_char+#keywords < 255 then |
61 -- Find longest TK_NAME and TK_STRING tokens |
61 -- Find longest TK_NAME and TK_STRING tokens |
62 local scores = {}; |
62 local scores = {}; |
63 for k,v in ipairs(llex.tok) do |
63 for k,v in ipairs(llex.tok) do |
64 if v == "TK_NAME" or v == "TK_STRING" then |
64 if v == "TK_NAME" or v == "TK_STRING" then |
65 local key = string.format("%q,%q", v, seminfo[k]); |
65 local key = string.format("%q,%q", v, seminfo[k]); |