Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minification error with ... #10

Open
aryajur opened this issue Sep 21, 2018 · 3 comments
Open

Minification error with ... #10

aryajur opened this issue Sep 21, 2018 · 3 comments

Comments

@aryajur
Copy link

aryajur commented Sep 21, 2018

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

@aryajur aryajur changed the title luasocket ltn12 minification error Minification error with ... Sep 21, 2018
@aryajur
Copy link
Author

aryajur commented Sep 21, 2018

It seems the error is because the token parser does not know how to handle "..."?

@stravant
Copy link
Owner

Thanks for the detailed info, I'll see if I can fix and update it after work today.

@aryajur
Copy link
Author

aryajur commented Sep 21, 2018

I created a pull request #11 where it seems to be fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants