From e4a42e76919a9e55a3c3c32a926662d4ef51a574 Mon Sep 17 00:00:00 2001 From: greg Date: Sun, 5 Feb 2017 21:23:11 -0800 Subject: [PATCH] Add back eval printing --- src/language.rs | 4 ++++ src/main.rs | 5 ++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/language.rs b/src/language.rs index e5d7ec9..d876d86 100644 --- a/src/language.rs +++ b/src/language.rs @@ -45,9 +45,13 @@ pub struct LanguageInterfaceOptions { pub trait LanguageInterface { fn evaluate_in_repl(&mut self, input: &str, options: LanguageInterfaceOptions) -> String; fn get_language_name(&self) -> String; + fn set_option(&mut self, option: &str, value: bool) -> bool; } impl LanguageInterface for (PL, PL::Evaluator) where PL: ProgrammingLanguage, T: Debug, A: Debug, E: EvaluationMachine { + fn set_option(&mut self, option: &str, value: bool) -> bool { + self.1.set_option(option, value) + } fn get_language_name(&self) -> String { PL::name() } diff --git a/src/main.rs b/src/main.rs index 0f3273a..f8cbb77 100644 --- a/src/main.rs +++ b/src/main.rs @@ -258,7 +258,10 @@ impl Repl { match commands.get(2) { Some(&"tokens") => self.show_tokens = show, Some(&"parse") => self.show_parse = show, - Some(&"eval") => { /*self.evaluator.set_option("trace_evaluation", show);*/ }, + Some(&"eval") => { + let ref mut language = self.languages[self.current_language_index]; + language.set_option("trace_evaluation", show); + }, Some(&"llvm") => self.show_llvm_ir = show, Some(e) => { println!("Bad `show`/`hide` argument: {}", e);