WIP: testing closure types

This commit is contained in:
Aidan Hahn 2021-12-31 11:00:13 -08:00
parent 4cadb1a7eb
commit 69f31db23b
No known key found for this signature in database
GPG key ID: 327711E983899316
7 changed files with 24 additions and 20 deletions

View file

@ -16,7 +16,7 @@
*/
use crate::vars::{VTable, define};
use crate::func::{FTable, Args, Function, Operation, func_declare};
use crate::func::{FTable, Args, Function, Operation, InternalOperation, func_declare};
use crate::segment::{Ast, Ctr};
use crate::lex::lex;
use crate::eval::eval;
@ -25,6 +25,14 @@ use std::rc::Rc;
use std::cell::RefCell;
use std::fs;
/*
fn get_prompt_default() -> InternalOperation {
|_: Ast, _: Rc<RefCell<VTable>>, _: Rc<RefCell<FTable>>| -> Ctr {
print!("λ ");
return Ctr::None;
}
}*/
pub fn configure(filename: String, vars: Rc<RefCell<VTable>>, mut funcs: Rc<RefCell<FTable>>) {
define(vars.clone(), String::from("CFG_RELISH_POSIX"), Rc::new(Ctr::String(String::from("0"))));
define(vars.clone(), String::from("CFG_RELISH_ENV"), Rc::new(Ctr::String(String::from("1"))));
@ -34,18 +42,14 @@ pub fn configure(filename: String, vars: Rc<RefCell<VTable>>, mut funcs: Rc<RefC
Err(s) => println!("{}", s)
}
/*
func_declare(funcs.clone(), Rc::new(RefCell::new(Function{
name: String::from("CFG_RELISH_PROMPT"),
loose_syms: false,
eval_lazy: false,
args: Args::Lazy(0),
function: Operation::Internal(
|_: Ast, _: Rc<RefCell<VTable>>, _: Rc<RefCell<FTable>>| -> Ctr {
print!("λ ");
return Ctr::None;
}
)
})));
function: Operation::Internal(get_prompt_default())
})));*/
match fs::read_to_string(filename) {
Err(s) => {