Swap over eval code to new paradigm

While keeping the old code commented for reference
This commit is contained in:
greg 2018-05-11 01:50:05 -07:00
parent b4a16cdc55
commit 67917612e6
2 changed files with 9 additions and 9 deletions

View File

@ -12,6 +12,7 @@ pub struct State<'a> {
parent_frame: Option<&'a State<'a>>,
values: HashMap<Rc<String>, ValueEntry>,
}
/*
impl<'a> State<'a> {
@ -26,6 +27,7 @@ impl<'a> State<'a> {
}
}
}
*/
#[derive(Debug)]
enum ValueEntry {
@ -55,6 +57,7 @@ enum FullyEvaluatedExpr {
List(Vec<FullyEvaluatedExpr>)
}
/*
impl FullyEvaluatedExpr {
fn to_string(&self) -> String {
use self::FullyEvaluatedExpr::*;
@ -93,11 +96,15 @@ impl FullyEvaluatedExpr {
}
}
}
*/
impl<'a> State<'a> {
pub fn new() -> State<'a> {
State { parent_frame: None, values: HashMap::new() }
}
}
/*
pub fn new_with_parent(parent: &'a State<'a>) -> State<'a> {
State { parent_frame: Some(parent), values: HashMap::new() }
@ -316,6 +323,7 @@ impl<'a> State<'a> {
})
}
}
*/
/* BELOW HERE NEW STUFF */

View File

@ -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> {
let new_input = input.0;
let new_eval_output = 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 evaluation_outputs = handle.state.evaluate_new(new_input, true);
let text_output: Result<Vec<String>, String> = evaluation_outputs
.into_iter()
.collect();