pub enum ScriptOperation<'a, SE: ScriptExpression> {
Show 14 variants
None,
Expression {
expression: SE,
},
DefineRegister {
query: TypeQuery<'a>,
},
DropRegister {
index: usize,
},
PushFromRegister {
index: usize,
},
PopToRegister {
index: usize,
},
MoveRegister {
from: usize,
to: usize,
},
CallFunction {
query: FunctionQuery<'a>,
},
BranchScope {
scope_success: ScriptHandle<'a, SE>,
scope_failure: Option<ScriptHandle<'a, SE>>,
},
LoopScope {
scope: ScriptHandle<'a, SE>,
},
PushScope {
scope: ScriptHandle<'a, SE>,
},
PopScope,
ContinueScopeConditionally,
Suspend,
}Expand description
One instruction of a script.
See the module docs for why the set is this small.
Variants§
None
Does nothing.
Expression
Runs a frontend-defined operation. See ScriptExpression.
Fields
expression: SEDefineRegister
Allocates a register of the queried type.
A register has to be defined before it is used, and is dropped when the scope that defined it ends.
DropRegister
Destroys the value in a register, leaving it empty.
PushFromRegister
Moves a register’s value onto the stack, leaving the register empty.
PopToRegister
Moves the top stack value into a register.
MoveRegister
Moves a value from one register to another.
CallFunction
Finds a function in the registry and invokes it.
Fields
query: FunctionQuery<'a>BranchScope
Takes a bool off the stack and runs one of two scopes.
The failure scope is optional, in which case a false does nothing.
LoopScope
Repeats a scope while a bool taken off the stack is true.
The scope must leave a fresh bool on the stack before it ends,
otherwise the next round reads whatever happens to be there.
Fields
scope: ScriptHandle<'a, SE>PushScope
Runs a nested scope and comes back when it ends.
Fields
scope: ScriptHandle<'a, SE>PopScope
Ends the current scope early, the way return does.
ContinueScopeConditionally
Takes a bool off the stack and ends the current scope when it is
false.
Suspend
Stops stepping and reports back to the caller without finishing.
For frontends building coroutines or futures. Anything to yield has to be left on the stack for the host to take.