lua-minify icon indicating copy to clipboard operation
lua-minify copied to clipboard

require not working

Open martin-braun opened this issue 7 years ago • 2 comments

Coming from LÖVE, having require in your code throws an issue:

require "test"
luajit: minify.lua:205: file<1:3>: Bad symbol `´` in source.
stack traceback:
        [C]: in function 'olderr'
        minify.lua:205: in function 'error'
        minify.lua:406: in function 'CreateLuaTokenStream'
        minify.lua:414: in function 'CreateLuaParser'
        minify.lua:3206: in main chunk
        [C]: at 0x00401f80

luajit 2.1

martin-braun avatar Feb 23 '18 18:02 martin-braun

That's another shortcoming of the current parser - it doesn't handle this special case of function invocation (which only works with a single argument that's either a string literal or a table constructor), see e.g. https://www.lua.org/pil/5.html.

The more verbose / 'standard' syntax will work: require("test")

Regards, NiteHawk

n1tehawk avatar Apr 07 '18 17:04 n1tehawk

Interesting enough: functionargs() already arranged for CallType = 'StringCall'. So it actually takes very little to support "string calls", see 7f607a08.

Regards, NiteHawk

n1tehawk avatar Apr 12 '18 15:04 n1tehawk