From b14f2b72cecdc8a194bb75e4d4a24b866ddef528 Mon Sep 17 00:00:00 2001 From: Li Jin Date: Wed, 26 Jul 2023 18:21:53 +0800 Subject: make minify and line rewriting work with Lua5.1 --- src/3rdParty/luaminify.lua | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/3rdParty/luaminify.lua') diff --git a/src/3rdParty/luaminify.lua b/src/3rdParty/luaminify.lua index 7f770ca..925af1e 100644 --- a/src/3rdParty/luaminify.lua +++ b/src/3rdParty/luaminify.lua @@ -1737,6 +1737,12 @@ local function Format_Mini(ast) return a.."\n"..b end]] sep = sep or ' ' + if sep == ';' then + local token = a:match("([%w_]+)%s*$") + if token == "then" or token == "do" then + sep = ' ' + end + end local aa, bb = a:sub(-1,-1), b:sub(1,1) if UpperChars[aa] or LowerChars[aa] or aa == '_' then if not (UpperChars[bb] or LowerChars[bb] or bb == '_' or Digits[bb]) then @@ -2094,9 +2100,15 @@ local function FormatYue(ast, lineMap) break end end + aa = aa or '' sep = sep or ' ' if spaceSep then sep = '' + elseif sep == ';' then + local token = aa:match("([%w_]+)%s*$") + if token == "then" or token == "do" then + sep = ' ' + end end local bb = b:match("^%s*([^%s])") if UpperChars[aa] or LowerChars[aa] or aa == '_' then -- cgit v1.2.3-55-g6feb