in progress work with scaffolding for environment integration

This commit is contained in:
Aidan Hahn 2021-11-21 12:48:11 -08:00
parent c465c974d4
commit 5aa2b27343
No known key found for this signature in database
GPG key ID: 327711E983899316

View file

@ -18,6 +18,7 @@
use std::cell::RefCell; use std::cell::RefCell;
use std::rc::Rc; use std::rc::Rc;
use std::collections::HashMap; use std::collections::HashMap;
use std::env;
use crate::segment::{Ctr, Ast}; use crate::segment::{Ctr, Ast};
use crate::eval::eval; use crate::eval::eval;
use crate::func::{Function, Operation, Args, FTable}; use crate::func::{Function, Operation, Args, FTable};
@ -38,7 +39,6 @@ pub fn define(
} }
} }
// TODO: Accept bool config value for env vars
pub fn get_export(env_cfg: bool) -> Function { pub fn get_export(env_cfg: bool) -> Function {
return Function{ return Function{
name: String::from("export"), name: String::from("export"),
@ -57,12 +57,21 @@ pub fn get_export(env_cfg: bool) -> Function {
Ctr::Seg(val) => { Ctr::Seg(val) => {
let val_tmp = val.borrow().clone(); let val_tmp = val.borrow().clone();
define(b, identifier.to_string(), Rc::new(val_tmp.car)); define(b, identifier.to_string(), Rc::new(val_tmp.car));
if env_cfg {
// set var in env
// gotta distill value
// env::set_var(identifier, VALUE)
}
}, },
_ => { _ => {
eprintln!("impossible args to export"); eprintln!("impossible args to export");
} }
} }
},
Ctr::None => {
// UNSET VAR LOGIC
} }
}, },
@ -73,7 +82,6 @@ pub fn get_export(env_cfg: bool) -> Function {
return Ctr::None; return Ctr::None;
}, },
_ => { _ => {
println!("{:#?}", a);
eprintln!("first argument to export must be a symbol"); eprintln!("first argument to export must be a symbol");
return Ctr::None; return Ctr::None;
} }