diff --git a/README.md b/README.md index 1cadb08..7e4127a 100644 --- a/README.md +++ b/README.md @@ -119,7 +119,7 @@ The purpose of this system is both to allow several scripts to run at the same t Checkpoints are set per function. Paragraphs are expected to be defined inside functions only. -Commiting also happens after a function or paragraph has been manually called. +Commiting also happens after a paragraph has been manually called or resumed from. ### Lines types @@ -533,8 +533,6 @@ $ f this is text: {f} ``` -Functions commit variables after a call. - #### Paragraph calls Most of the time, you should'nt need to call paragraphs yourself - they will be automatically be set as the active checkpoint when the interperter reach their line, and they will be automatically called when resuming its parent function. @@ -576,7 +574,7 @@ And will resume from the checkpoint like before: Method style calling is also possible, like with functions. -Paragraphs commit variables after a call. +Paragraphs commit variables after being called (either manually or automatically from resuming a function). The commit always happen after the paragraph's child block has been ran. Please also be aware that when resuming from a paragraph, Anselme will try to restore the interpreter state as if the function was correctly executed from the start up to this paragraph. This includes: diff --git a/interpreter/expression.lua b/interpreter/expression.lua index 8938429..9e88beb 100644 --- a/interpreter/expression.lua +++ b/interpreter/expression.lua @@ -1,7 +1,7 @@ local expression -local flush_state, to_lua, from_lua, eval_text +local to_lua, from_lua, eval_text -local run, run_block +local run local unpack = table.unpack or unpack @@ -134,7 +134,6 @@ local function eval(state, exp) type = "number", value = state.variables[fn.value.namespace.."👁️"].value + 1 } - flush_state(state) return r else return nil, ("unknown function type %q"):format(fn.value.type) @@ -169,9 +168,8 @@ end package.loaded[...] = eval run = require((...):gsub("expression$", "interpreter")).run -run_block = require((...):gsub("expression$", "interpreter")).run_block expression = require((...):gsub("interpreter%.expression$", "parser.expression")) local common = require((...):gsub("expression$", "common")) -flush_state, to_lua, from_lua, eval_text = common.flush_state, common.to_lua, common.from_lua, common.eval_text +to_lua, from_lua, eval_text = common.to_lua, common.from_lua, common.eval_text return eval