minify/lparser.lua

branch
lua5.2
changeset 99
2b6416334a25
parent 94
cf209451be5f
--- a/minify/lparser.lua	Fri Mar 17 11:01:19 2023 +0000
+++ b/minify/lparser.lua	Fri Mar 17 11:02:12 2023 +0000
@@ -27,7 +27,10 @@
 
 local base = _G
 local string = require "string"
-module "lparser"
+--2018-06-10: RH - The lparser return table is declared here to satisfy the stat function. Stat
+-- must exist before chunk and parse so creating a placeholderis the easiest solution.
+local lparser = {}
+
 
 --[[--------------------------------------------------------------------
 -- variable and data structure initialization
@@ -1205,7 +1208,7 @@
   local fn = stat_call[c]
   -- handles: if while do for repeat function local return break
   if fn then
-    _M[fn]()
+    lparser[fn]()
     -- return or break must be last statement
     if c == "return" or c == "break" then return true end
   else
@@ -1291,4 +1294,25 @@
   ilocalinfo, ilocalrefs = {}, {}
 end
 
-return _M
+lparser = {
+expr = expr,
+exp1 = exp1,
+explist1 = explist1,
+body = body,
+block = block,
+for_stat = for_stat,
+while_stat = while_stat,
+repeat_stat = repeat_stat,
+if_stat = if_stat,
+return_stat = return_stat,
+break_stat = break_stat,
+expr_stat = expr_stat,
+function_stat = function_stat,
+do_stat = do_stat,
+local_stat = local_stat,
+chunk = chunk,
+parser = parser,
+init = init
+}
+
+return lparser

mercurial