diff options
author | Context Git Mirror Bot <phg42.2a@gmail.com> | 2015-05-16 00:15:04 +0200 |
---|---|---|
committer | Context Git Mirror Bot <phg42.2a@gmail.com> | 2015-05-16 00:15:04 +0200 |
commit | b55577d0998160c0174e250b542016ecd6ca9056 (patch) | |
tree | 27093212d5ca3e6ffe4ae434c3ec094233ed37ba /tex/context/base/util-sta.lua | |
parent | 624cbb5da392e9403984dd1cf368c0d408b1c2a8 (diff) | |
download | context-b55577d0998160c0174e250b542016ecd6ca9056.tar.gz |
2015-05-15 23:06:00
Diffstat (limited to 'tex/context/base/util-sta.lua')
-rw-r--r-- | tex/context/base/util-sta.lua | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/tex/context/base/util-sta.lua b/tex/context/base/util-sta.lua index 1a61ec4e6..27ab5a624 100644 --- a/tex/context/base/util-sta.lua +++ b/tex/context/base/util-sta.lua @@ -81,6 +81,8 @@ end function stacker.new(name) + local report = logs.reporter("stacker",name or nil) + local s local stack = { } @@ -126,8 +128,18 @@ function stacker.new(name) end end - local tops = { } - local top, switch + local tops = { } + local top = nil + local switch = nil + + local function resolve_reset(mode) + if #tops > 0 then + report("resetting %s left-over states of %a",#tops,name) + end + tops = { } + top = nil + switch = nil + end local function resolve_begin(mode) if mode then @@ -206,8 +218,7 @@ function stacker.new(name) local function resolve_end() -- resolve_step(s.unset) - local noftop = #top - if noftop > 0 then + if #tops > 0 then -- was #top brrr local result = s.stop(s,top,1,#top) remove(tops) top = tops[#tops] @@ -224,8 +235,6 @@ function stacker.new(name) resolve_end() end - local report = logs.reporter("stacker",name or nil) - s = { name = name or "unknown", unset = -1, @@ -240,6 +249,7 @@ function stacker.new(name) resolve_begin = resolve_begin, resolve_step = resolve_step, resolve_end = resolve_end, + resolve_reset = resolve_reset, } return s -- we can overload functions |