repl now complete

Signed-off-by: Ava Hahn <ava@aidanis.online>
This commit is contained in:
Ava Hahn 2023-03-01 11:14:42 -08:00
parent fbb85f2e3d
commit 2439a37aaa
Signed by untrusted user who does not match committer: affine
GPG key ID: 3A4645B8CF806069
9 changed files with 188 additions and 123 deletions

View file

@ -56,13 +56,20 @@ pub fn static_stdlib(syms: &mut SymTable) -> Result<(), String> {
/// dynamic_stdlib
/// takes configuration data and uses it to insert dynamic
/// callbacks with configuration into a symtable
pub fn dynamic_stdlib(env: bool, syms: &mut SymTable) -> Result<(), String> {
pub fn dynamic_stdlib(syms: &mut SymTable) -> Result<(), String> {
//get CFG_RELISH_ENV from syms
let env_cfg_user_form = syms.call_symbol(
&"CFG_RELISH_ENV".to_string(), &Seg::new(), true)
.unwrap_or_else(|_: String| Box::new(Ctr::None))
.to_string()
.ne("");
syms.insert("def".to_string(), Symbol {
name: String::from("define"),
args: Args::Infinite,
conditional_branches: true,
value: ValueType::Internal(Rc::new( move |ast: &Seg, syms: &mut SymTable| -> Result<Ctr, String> {
_store_callback(ast, syms, env)
_store_callback(ast, syms, env_cfg_user_form)
},
)),
});