Add back eval printing

This commit is contained in:
greg 2017-02-05 21:23:11 -08:00
parent cc537f292d
commit e4a42e7691
2 changed files with 8 additions and 1 deletions

View File

@ -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<PL, T, A, E> LanguageInterface for (PL, PL::Evaluator) where PL: ProgrammingLanguage<Token=T, AST=A, Evaluator=E>, 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()
}

View File

@ -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);