pub struct VM<'rant> { /* private fields */ }
Expand description
The Rant Virtual Machine.
Implementations
pub fn push_getter_intents(
&mut self,
path: &Rc<AccessPath>,
override_print: bool,
prefer_function: bool,
fallback: Option<Rc<Sequence>>
)
pub fn call_func(
&mut self,
func: RantFunctionHandle,
args: Vec<RantValue>,
override_print: bool
) -> RuntimeResult<()>
pub fn call_func(
&mut self,
func: RantFunctionHandle,
args: Vec<RantValue>,
override_print: bool
) -> RuntimeResult<()>
Prepares a call to a function with the specified arguments.
Checks for an active block and attempts to iterate it. If a valid element is returned, it is pushed onto the call stack.
Performs any necessary preparation (such as pushing weight intents) before pushing a block. If the block can be pushed immediately, it will be.
Consumes attributes and pushes a block onto the resolver stack.
pub fn get_var_value(
&self,
varname: &str,
access: VarAccessMode,
prefer_function: bool
) -> RuntimeResult<RantValue>
pub fn get_var_value(
&self,
varname: &str,
access: VarAccessMode,
prefer_function: bool
) -> RuntimeResult<RantValue>
Gets the value of an existing variable.
pub fn def_var_value(
&mut self,
varname: &str,
access: VarAccessMode,
val: RantValue,
is_const: bool
) -> RuntimeResult<()>
pub fn def_var_value(
&mut self,
varname: &str,
access: VarAccessMode,
val: RantValue,
is_const: bool
) -> RuntimeResult<()>
Defines a new variable in the current scope.
Pushes a value onto the value stack.
Removes and returns the topmost value from the value stack.
Removes and returns the topmost frame from the call stack.
Pushes a frame onto the call stack.
pub fn push_native_call_frame(
&mut self,
callee: Box<dyn FnOnce(&mut VM<'_>) -> RuntimeResult<()>>,
flavor: StackFrameFlavor
) -> RuntimeResult<()>
pub fn push_native_call_frame(
&mut self,
callee: Box<dyn FnOnce(&mut VM<'_>) -> RuntimeResult<()>>,
flavor: StackFrameFlavor
) -> RuntimeResult<()>
Pushes an empty frame onto the call stack with a single RuntimeCall
intent.
pub fn push_frame_flavored(
&mut self,
callee: Rc<Sequence>,
flavor: StackFrameFlavor
) -> RuntimeResult<()>
pub fn push_frame_flavored(
&mut self,
callee: Rc<Sequence>,
flavor: StackFrameFlavor
) -> RuntimeResult<()>
Pushes a flavored frame onto the call stack.
pub fn interrupt_repeater(
&mut self,
break_val: Option<RantValue>,
should_continue: bool
) -> RuntimeResult<()>
pub fn interrupt_repeater(
&mut self,
break_val: Option<RantValue>,
should_continue: bool
) -> RuntimeResult<()>
Interrupts execution of a repeater and either continues the next iteration or exits the block.
Returns from the currently running function.
Gets a mutable reference to the topmost frame on the call stack.
Safely attempts to get a mutable reference to the topmost frame on the call stack.
Safely attempts to get a mutable reference to the frame depth
frames below the top of the call stack.
Safely attempts to get a reference to the frame depth
frames below the top of the call stack.
Gets a reference to the topmost frame on the call stack.
Removes the topmost RNG from the RNG stack and returns it.
Gets a mutable reference to the Rant context that created the VM.
Gets a mutable reference to the resolver associated with the VM.
Gets a reference to the program being executed by the VM.