Swap over eval code to new paradigm
While keeping the old code commented for reference
This commit is contained in:
parent
b4a16cdc55
commit
67917612e6
@ -12,6 +12,7 @@ pub struct State<'a> {
|
|||||||
parent_frame: Option<&'a State<'a>>,
|
parent_frame: Option<&'a State<'a>>,
|
||||||
values: HashMap<Rc<String>, ValueEntry>,
|
values: HashMap<Rc<String>, ValueEntry>,
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
|
|
||||||
impl<'a> State<'a> {
|
impl<'a> State<'a> {
|
||||||
|
|
||||||
@ -26,6 +27,7 @@ impl<'a> State<'a> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
enum ValueEntry {
|
enum ValueEntry {
|
||||||
@ -55,6 +57,7 @@ enum FullyEvaluatedExpr {
|
|||||||
List(Vec<FullyEvaluatedExpr>)
|
List(Vec<FullyEvaluatedExpr>)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
impl FullyEvaluatedExpr {
|
impl FullyEvaluatedExpr {
|
||||||
fn to_string(&self) -> String {
|
fn to_string(&self) -> String {
|
||||||
use self::FullyEvaluatedExpr::*;
|
use self::FullyEvaluatedExpr::*;
|
||||||
@ -93,11 +96,15 @@ impl FullyEvaluatedExpr {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
impl<'a> State<'a> {
|
impl<'a> State<'a> {
|
||||||
pub fn new() -> State<'a> {
|
pub fn new() -> State<'a> {
|
||||||
State { parent_frame: None, values: HashMap::new() }
|
State { parent_frame: None, values: HashMap::new() }
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
|
||||||
pub fn new_with_parent(parent: &'a State<'a>) -> State<'a> {
|
pub fn new_with_parent(parent: &'a State<'a>) -> State<'a> {
|
||||||
State { parent_frame: Some(parent), values: HashMap::new() }
|
State { parent_frame: Some(parent), values: HashMap::new() }
|
||||||
@ -316,6 +323,7 @@ impl<'a> State<'a> {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
/* BELOW HERE NEW STUFF */
|
/* BELOW HERE NEW STUFF */
|
||||||
|
|
||||||
|
@ -102,15 +102,7 @@ fn ast_reducing(handle: &mut Schala, input: parsing::AST, comp: Option<&mut Unfi
|
|||||||
fn eval(handle: &mut Schala, input: TempASTReduction, _comp: Option<&mut UnfinishedComputation>) -> Result<String, String> {
|
fn eval(handle: &mut Schala, input: TempASTReduction, _comp: Option<&mut UnfinishedComputation>) -> Result<String, String> {
|
||||||
|
|
||||||
let new_input = input.0;
|
let new_input = input.0;
|
||||||
let new_eval_output = handle.state.evaluate_new(new_input, true);
|
let evaluation_outputs = handle.state.evaluate_new(new_input, true);
|
||||||
match new_eval_output[0] {
|
|
||||||
Ok(ref s) => println!("NEW OUTPUT> {}", s),
|
|
||||||
Err(ref s) => println!("NEW Err> {}", s),
|
|
||||||
};
|
|
||||||
|
|
||||||
/* old-style eval */
|
|
||||||
let input = input.1;
|
|
||||||
let evaluation_outputs = handle.state.evaluate(input);
|
|
||||||
let text_output: Result<Vec<String>, String> = evaluation_outputs
|
let text_output: Result<Vec<String>, String> = evaluation_outputs
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.collect();
|
.collect();
|
||||||
|
Loading…
Reference in New Issue
Block a user