diff -r 61085789b12b -r 2b6416334a25 minify/llex.lua --- a/minify/llex.lua Fri Mar 17 11:01:19 2023 +0000 +++ b/minify/llex.lua Fri Mar 17 11:02:12 2023 +0000 @@ -27,12 +27,23 @@ local base = _G local string = require "string" -module "llex" +--module "llex" local find = string.find local match = string.match local sub = string.sub +local z = '' -- source +local sourceid = '' -- name of source +local I = 1 -- lexer's position in source +local ln = 1 -- line number +local tok = {} -- lexed token list* +local seminfo = {} -- lexed semantic information list* +local tokln = {} -- line numbers for messages* +local buff = '' +-- NOTE: see init() for module variables (externally visible): +-- tok, seminfo, tokln + ---------------------------------------------------------------------- -- initialize keyword list, variables ---------------------------------------------------------------------- @@ -44,14 +55,6 @@ kw[v] = true end --- NOTE: see init() for module variables (externally visible): --- tok, seminfo, tokln - -local z, -- source stream - sourceid, -- name of source - I, -- position of lexer - buff, -- buffer for strings - ln -- line number ---------------------------------------------------------------------- -- add information to token listing @@ -89,13 +92,7 @@ function init(_z, _sourceid) z = _z -- source - sourceid = _sourceid -- name of source - I = 1 -- lexer's position in source - ln = 1 -- line number - tok = {} -- lexed token list* - seminfo = {} -- lexed semantic information list* - tokln = {} -- line numbers for messages* - -- (*) externally visible thru' module + sourceid = _sourceid -- name of source -------------------------------------------------------------------- -- initial processing (shbang handling) -------------------------------------------------------------------- @@ -352,4 +349,11 @@ end--while outer end -return _M +return { +llex = llex, +init = init, +chunkid = chunkid, +tok = tok, +tokln = tokln, +seminfo = seminfo +}