Struct rurtle::environ::Environment
[−]
[src]
pub struct Environment { // some fields omitted }
Methods
impl Environment
fn new(turtle: Turtle) -> Environment
Construct a new Environment
with default values
fn get_turtle(&mut self) -> &mut Turtle
fn function_arg_count(&self) -> HashMap<String, i32>
Return a map mapping the function name to the argument count. Useful for
passing it to Parser::parse
fn eval_source(&mut self, source: &str) -> Result<Value, Box<Error>>
Tokenize, parse and evaluate the given source
fn eval(&mut self, node: &Node) -> ResultType
Evaluate the given AST node
fn current_frame(&mut self) -> &mut Frame
Return the current stack frame or the global frame if the code is not executing in a function
fn global_frame(&mut self) -> &mut Frame
Return the global frame
fn get_variable(&mut self, name: &str) -> Option<Value>
Retrieve the value for the variable with the given name
The variable is searched in the current function's local variables. If
it is not defined there, the global namespace will be searched. If the
variable is not found there either, None
is returned.