Struct fomoscript::Ctx
source · pub struct Ctx {
pub values: Vec<N>,
pub idents: Vec<String>,
pub code: Vec<char>,
pub deep: usize,
}Expand description
Interpreter context, holds all state during execution.
Fields§
§values: Vec<N>§idents: Vec<String>§code: Vec<char>§deep: usizeImplementations§
source§impl Ctx
impl Ctx
pub fn new() -> Ctx
pub fn set_var_scoped(&mut self, name: &str, n: N)
pub fn set_var_absolute(&mut self, i: usize, name: &str, n: N)
sourcepub fn find_var(&mut self, name: &str) -> Option<(usize, &mut N)>
pub fn find_var(&mut self, name: &str) -> Option<(usize, &mut N)>
Find a variable declared in the scope, or any parent scope
returns the path and the variable value
pub fn insert_code(&mut self, code: &str)
pub fn parse_next_expr(&mut self) -> Result<N, &'static str>
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Ctx
impl !Send for Ctx
impl !Sync for Ctx
impl Unpin for Ctx
impl !UnwindSafe for Ctx
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more