pub fn eval(expr: &str) -> Result<CellRef, RuntimeError> {
    // Create the execution frame
    let frame                   = Frame::new(1, None);
    let bindings                = SymbolBindings::new();

    // Apply the standard bindings
    let (frame, bindings)       = setup_standard_bindings(frame, bindings);

    // Parse the expression
    let expr = parse_safas(&mut TokenReadBuffer::new(expr.chars()), FileLocation::new("<expr>"))?;

    // Evaluate the expression
    let (result, _bindings, _frame) = eval_statements(expr, NIL.clone(), bindings, frame);

    if let SafasCell::Error(err) = &*result {
        Err(err.clone())
    } else {
        Ok(result)
    }
}
///
/// Evaluates a single line in an isolated SAFAS instance and returns the result
///
Evaluates a single line in an isolated SAFAS instance and returns the result
Evaluates a single line in an isolated SAFAS instance and returns the result
pub fn eval(expr: &str) -> Result<CellRef, RuntimeError> {
    // Create the execution frame
    let frame                   = Frame::new(1, None);
    let bindings                = SymbolBindings::new();
    // Apply the standard bindings
    let (frame, bindings)       = setup_standard_bindings(frame, bindings);
    // Parse the expression
    let expr = parse_safas(&mut TokenReadBuffer::new(expr.chars()), FileLocation::new("<expr>"))?;
    // Evaluate the expression
    let (result, _bindings, _frame) = eval_statements(expr, NIL.clone(), bindings, frame);
    if let SafasCell::Error(err) = &*result {
        Err(err.clone())
    } else {
        Ok(result)
    }
}
pub fn eval ( expr : & str ) -> Result < CellRef , RuntimeError > { // Create the execution frame let frame = Frame :: new ( 1 , None ) ; let bindings = SymbolBindings :: new ( ) ; // Apply the standard bindings let ( frame , bindings ) = setup_standard_bindings ( frame , bindings ) ; // Parse the expression let expr = parse_safas ( & mut TokenReadBuffer :: new ( expr . chars ( ) ) , FileLocation :: new ( " " ) ) ? ; // Evaluate the expression let ( result , _bindings , _frame ) = eval_statements ( expr , NIL . clone ( ) , bindings , frame ) ; if let SafasCell :: Error ( err ) = & * result { Err ( err . clone ( ) ) } else { Ok ( result ) } }
Evaluates a single line in an isolated SAFAS instance and returns the result
Evaluates a single line in an isolated SAFAS instance and returns the result
expr
&str
expr
&str