1
0
Fork 0
mirror of https://github.com/Reuh/anselme.git synced 2025-10-27 16:49:31 +00:00
anselme/stdlib/checkpoint.lua
Étienne Reuh Fildadut 56ed6c912b Replace checkpoint system
The previous system needed to store of the scope and full AST to build a Resumable object, which means that if persisted, updating the resumable script will have no effect.
The new system instead uses an anchor token and does not require any information besides the anchor name.
2023-12-27 17:06:35 +01:00

22 lines
477 B
Lua

local ast = require("ast")
local ArgumentTuple = ast.ArgumentTuple
local resume_manager = require("state.resume_manager")
return {
{
"_~>_", "(anchor::anchor, quote)",
function(state, anchor, quote)
resume_manager:push(state, anchor)
local r = quote:call(state, ArgumentTuple:new())
resume_manager:pop(state)
return r
end
},
{
"_~>_", "(anchor::nil, quote)",
function(state, anchor, quote)
return quote:call(state, ArgumentTuple:new())
end
}
}