lua-minify
lua-minify copied to clipboard
Minification error with ...
Hi, When I tried to run minify on the ltn12.lua file I get the following error:
lua: minify.lua:484: 43:23: )
expected.
stack traceback:
[C]: in function 'error'
minify.lua:484: in upvalue 'expect'
minify.lua:674: in upvalue 'funcdecl'
minify.lua:1290: in upvalue 'statement'
minify.lua:1310: in function minify.lua:1303
(...tail calls...)
minify.lua:3206: in main chunk
[C]: in ?
and the output file contains:
Tokens[-3] = .
Tokens[-2] = chain
Tokens[-1] = (
Tokens[0] = ...
Tokens[1] = )
Tokens[2] = local
Tokens[3] = arg
The function it is having this trouble with is:
-- chains a bunch of filters together -- (thanks to Wim Couwenberg) function filter.chain(...) local arg = {...} local n = select('#',...) local top, index = 1, 1 local retry = "" return function(chunk) retry = chunk and retry while true do if index == top then chunk = argindex if chunk == "" or top == n then return chunk elseif chunk then index = index + 1 else top = top+1 index = top end else chunk = arg[index](chunk or "") if chunk == "" then index = index - 1 chunk = retry elseif chunk then if index == n then return chunk else index = index + 1 end else base.error("filter returned inappropriate nil") end end end end end
It seems the error is because the token parser does not know how to handle "..."?
Thanks for the detailed info, I'll see if I can fix and update it after work today.
I created a pull request #11 where it seems to be fixed.