mirror of
https://github.com/Reuh/anselme.git
synced 2025-10-28 00:59:31 +00:00
Switch back to tag:pop instead of tag:trim
The tag operator should allow for all the user-defined tagging you need, and it already ensures the stack stays consistent so there's no need to be extra careful with tag:trim.
This commit is contained in:
parent
38b2a6ae69
commit
90e5a2d9cf
3 changed files with 8 additions and 11 deletions
|
|
@ -47,9 +47,9 @@ run_line = function(state, line)
|
|||
elseif line.type == "tag" then
|
||||
local v, e = eval(state, line.expression)
|
||||
if not v then return v, ("%s; at %s"):format(e, line.source) end
|
||||
local i = tags:push(state, v)
|
||||
tags:push(state, v)
|
||||
v, e = run_block(state, line.child)
|
||||
tags:trim(state, i-1)
|
||||
tags:pop(state)
|
||||
if e then return v, e end
|
||||
if v then return v end
|
||||
elseif line.type == "return" then
|
||||
|
|
@ -180,7 +180,7 @@ local function run(state, block, resume_from_there, i, j)
|
|||
local v, e = run_block(state, block, resume_from_there, i, j)
|
||||
-- return to previous tag state
|
||||
-- when resuming is done, tag stack pop when exiting the tag block
|
||||
-- stray elements may be left on the stack if there is a return before we exit all the tag block, so we trim them
|
||||
-- stray elements may be left on the stack if there is a return before we go up all the tag blocks, so we trim them
|
||||
if resume_from_there then
|
||||
tags:trim(state, tags_len)
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue