diff --git a/minify.lua b/minify.lua index 41d7a60..f26124b 100644 --- a/minify.lua +++ b/minify.lua @@ -752,6 +752,20 @@ function CreateLuaParser(text) end end + local function callexpr(base) + return MkNode{ + Type = 'CallExpr'; + Base = base; + FunctionArguments = functionargs(); + GetFirstToken = function(self) + return self.Base:GetFirstToken() + end; + GetLastToken = function(self) + return self.FunctionArguments:GetLastToken() + end; + } + end + local function primaryexpr() local base = prefixexpr() assert(base, "nil prefixexpr") @@ -807,29 +821,11 @@ function CreateLuaParser(text) end; } elseif tk.Source == '{' then - base = MkNode{ - Type = 'CallExpr'; - Base = base; - FunctionArguments = functionargs(); - GetFirstToken = function(self) - return self.Base:GetFirstToken() - end; - GetLastToken = function(self) - return self.FunctionArguments:GetLastToken() - end; - } + base = callexpr(base) -- TableCall elseif tk.Source == '(' then - base = MkNode{ - Type = 'CallExpr'; - Base = base; - FunctionArguments = functionargs(); - GetFirstToken = function(self) - return self.Base:GetFirstToken() - end; - GetLastToken = function(self) - return self.FunctionArguments:GetLastToken() - end; - } + base = callexpr(base) -- ArgCall + elseif tk.Type == 'String' then + base = callexpr(base) -- StringCall else return base end