implement basic control flow, error handling from functions, many tests
Signed-off-by: Ava Hahn <ava@aidanis.online>
This commit is contained in:
parent
ae365ad63c
commit
09e3546ba6
14 changed files with 315 additions and 488 deletions
|
|
@ -39,7 +39,7 @@ pub struct UserFn {
|
|||
*/
|
||||
#[derive(Clone)]
|
||||
pub enum ValueType {
|
||||
Internal(Rc<dyn Fn(&Seg, &mut SymTable) -> Ctr>),
|
||||
Internal(Rc<dyn Fn(&Seg, &mut SymTable) -> Result<Ctr, String>>),
|
||||
FuncForm(UserFn),
|
||||
VarForm(Box<Ctr>)
|
||||
}
|
||||
|
|
@ -237,7 +237,7 @@ impl Symbol {
|
|||
|
||||
match &self.value {
|
||||
ValueType::VarForm(ref f) => Ok(Box::new(*f.clone())),
|
||||
ValueType::Internal(ref f) => Ok(Box::new(f(evaluated_args, syms))),
|
||||
ValueType::Internal(ref f) => Ok(Box::new(f(evaluated_args, syms)?)),
|
||||
ValueType::FuncForm(ref f) => {
|
||||
// stores any value overwritten by local state
|
||||
// If this ever becomes ASYNC this will need to
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue