var export works now lol
This commit is contained in:
parent
5d345a4c73
commit
c465c974d4
1 changed files with 17 additions and 6 deletions
15
src/vars.rs
15
src/vars.rs
|
|
@ -19,6 +19,7 @@ use std::cell::RefCell;
|
|||
use std::rc::Rc;
|
||||
use std::collections::HashMap;
|
||||
use crate::segment::{Ctr, Ast};
|
||||
use crate::eval::eval;
|
||||
use crate::func::{Function, Operation, Args, FTable};
|
||||
/* Mapping between a string token and a tree of Segments
|
||||
* The string token can be found in any Ctr::Symbol value
|
||||
|
|
@ -45,11 +46,14 @@ pub fn get_export(env_cfg: bool) -> Function {
|
|||
eval_lazy: true,
|
||||
args: Args::Lazy(2),
|
||||
function: Operation::Internal(
|
||||
|a: Ast, b: Rc<RefCell<VTable>>, _c: Rc<RefCell<FTable>>| -> Ctr {
|
||||
|a: Ast, b: Rc<RefCell<VTable>>, c: Rc<RefCell<FTable>>| -> Ctr {
|
||||
let inner = a.borrow_mut();
|
||||
match &inner.car {
|
||||
Ctr::Symbol(identifier) => {
|
||||
match eval(inner.cdr) {
|
||||
match &inner.cdr {
|
||||
Ctr::Seg(tree) => {
|
||||
if let Ok(seg) = eval(tree.clone(), b.clone(), c.clone(), false) {
|
||||
match seg {
|
||||
Ctr::Seg(val) => {
|
||||
let val_tmp = val.borrow().clone();
|
||||
define(b, identifier.to_string(), Rc::new(val_tmp.car));
|
||||
|
|
@ -59,6 +63,13 @@ pub fn get_export(env_cfg: bool) -> Function {
|
|||
eprintln!("impossible args to export");
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
_ => {
|
||||
eprintln!("args not in standard form");
|
||||
}
|
||||
}
|
||||
return Ctr::None;
|
||||
},
|
||||
_ => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue