finally figure out how to hold closures
This commit is contained in:
parent
69f31db23b
commit
f805290a4b
8 changed files with 98 additions and 89 deletions
|
|
@ -16,7 +16,7 @@
|
|||
*/
|
||||
|
||||
use crate::vars::{VTable, define};
|
||||
use crate::func::{FTable, Args, Function, Operation, InternalOperation, func_declare};
|
||||
use crate::func::{FTable, Args, Function, Operation, func_declare};
|
||||
use crate::segment::{Ast, Ctr};
|
||||
use crate::lex::lex;
|
||||
use crate::eval::eval;
|
||||
|
|
@ -25,13 +25,11 @@ 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;
|
||||
}
|
||||
}*/
|
||||
|
||||
fn prompt_default_callback(_: 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"))));
|
||||
|
|
@ -42,14 +40,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(get_prompt_default())
|
||||
})));*/
|
||||
function: Operation::Internal(Box::new(prompt_default_callback))
|
||||
})));
|
||||
|
||||
match fs::read_to_string(filename) {
|
||||
Err(s) => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue