1
0
Fork 0
mirror of https://github.com/Reuh/anselme.git synced 2025-10-27 16:49:31 +00:00

Rename checkpoint variable, add reached variable for checkpoints

This commit is contained in:
Étienne Fildadut 2021-04-23 17:39:51 +02:00
parent 0171d92352
commit 17751c5c59
8 changed files with 102 additions and 22 deletions

View file

@ -112,11 +112,11 @@ local function eval(state, exp)
end
-- eval function
local r, e
if exp.explicit_call or state.variables[fn.value.namespace.."🏁"].value == "" then
if exp.explicit_call or state.variables[fn.value.namespace.."🔖"].value == "" then
r, e = run(state, fn.value.child)
-- resume at last checkpoint
else
local expr, err = expression(state.variables[fn.value.namespace.."🏁"].value, state, "")
local expr, err = expression(state.variables[fn.value.namespace.."🔖"].value, state, "")
if not expr then return expr, err end
r, e = eval(state, expr)
end

View file

@ -135,11 +135,11 @@ local function run_line(state, line)
end
end
elseif line.type == "checkpoint" then
state.variables[line.namespace.."👁️"] = {
state.variables[line.namespace.."🏁"] = {
type = "number",
value = state.variables[line.namespace.."👁️"].value + 1
value = state.variables[line.namespace.."🏁"].value + 1
}
state.variables[line.parent_function.namespace.."🏁"] = {
state.variables[line.parent_function.namespace.."🔖"] = {
type = "string",
value = line.name
}
@ -183,11 +183,15 @@ run_block = function(state, block, resume_from_there, i, j)
type = "number",
value = state.variables[parent_line.namespace.."👁️"].value + 1
}
state.variables[parent_line.namespace.."🏁"] = {
type = "number",
value = state.variables[parent_line.namespace.."🏁"].value + 1
}
-- don't update checkpoint if an already more precise checkpoint is set
-- (since we will go up the whole checkpoint hierarchy when resuming from a nested checkpoint)
local current_checkpoint = state.variables[parent_line.parent_function.namespace.."🏁"].value
local current_checkpoint = state.variables[parent_line.parent_function.namespace.."🔖"].value
if not current_checkpoint:match("^"..escape(parent_line.name)) then
state.variables[parent_line.parent_function.namespace.."🏁"] = {
state.variables[parent_line.parent_function.namespace.."🔖"] = {
type = "string",
value = parent_line.name
}