minify/optparser.lua

branch
lua5.2
changeset 94
cf209451be5f
parent 93
07c10f9ba77c
child 99
2b6416334a25
equal deleted inserted replaced
93:07c10f9ba77c 94:cf209451be5f
50 -- * the first two lines are for keywords 50 -- * the first two lines are for keywords
51 local SKIP_NAME = {} 51 local SKIP_NAME = {}
52 for v in string.gmatch([[ 52 for v in string.gmatch([[
53 and break do else elseif end false for function if in 53 and break do else elseif end false for function if in
54 local nil not or repeat return then true until while 54 local nil not or repeat return then true until while
55 self]], "%S+") do 55 self _ENV]], "%S+") do
56 SKIP_NAME[v] = true 56 SKIP_NAME[v] = true
57 end 57 end
58 58
59 ------------------------------------------------------------------------ 59 ------------------------------------------------------------------------
60 -- variables and data structures 60 -- variables and data structures
254 -- keep those implicit declarations as-is 254 -- keep those implicit declarations as-is
255 ------------------------------------------------------------------ 255 ------------------------------------------------------------------
256 local temp, j, gotself = {}, 1, false 256 local temp, j, gotself = {}, 1, false
257 for i = 1, #object do 257 for i = 1, #object do
258 local obj = object[i] 258 local obj = object[i]
259 if not obj.isself then 259 if not obj.preserve then
260 temp[j] = obj 260 temp[j] = obj
261 j = j + 1 261 j = j + 1
262 else 262 elseif obj.name == "self" then
263 gotself = true 263 gotself = true
264 end 264 end
265 end 265 end
266 object = temp 266 object = temp
267 ------------------------------------------------------------------ 267 ------------------------------------------------------------------

mercurial