From 67917612e6af4cf60e3a74efffd93b79a8cc8442 Mon Sep 17 00:00:00 2001 From: greg Date: Fri, 11 May 2018 01:50:05 -0700 Subject: [PATCH] Swap over eval code to new paradigm While keeping the old code commented for reference --- schala-lang/src/eval.rs | 8 ++++++++ schala-lang/src/lib.rs | 10 +--------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/schala-lang/src/eval.rs b/schala-lang/src/eval.rs index cd61220..5d24af6 100644 --- a/schala-lang/src/eval.rs +++ b/schala-lang/src/eval.rs @@ -12,6 +12,7 @@ pub struct State<'a> { parent_frame: Option<&'a State<'a>>, values: HashMap, 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) } +/* 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 */ diff --git a/schala-lang/src/lib.rs b/schala-lang/src/lib.rs index c0b6180..7545e26 100644 --- a/schala-lang/src/lib.rs +++ b/schala-lang/src/lib.rs @@ -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 { 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, String> = evaluation_outputs .into_iter() .collect();