Add back eval printing
This commit is contained in:
parent
cc537f292d
commit
e4a42e7691
@ -45,9 +45,13 @@ pub struct LanguageInterfaceOptions {
|
|||||||
pub trait LanguageInterface {
|
pub trait LanguageInterface {
|
||||||
fn evaluate_in_repl(&mut self, input: &str, options: LanguageInterfaceOptions) -> String;
|
fn evaluate_in_repl(&mut self, input: &str, options: LanguageInterfaceOptions) -> String;
|
||||||
fn get_language_name(&self) -> 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 {
|
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 {
|
fn get_language_name(&self) -> String {
|
||||||
PL::name()
|
PL::name()
|
||||||
}
|
}
|
||||||
|
@ -258,7 +258,10 @@ impl Repl {
|
|||||||
match commands.get(2) {
|
match commands.get(2) {
|
||||||
Some(&"tokens") => self.show_tokens = show,
|
Some(&"tokens") => self.show_tokens = show,
|
||||||
Some(&"parse") => self.show_parse = 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(&"llvm") => self.show_llvm_ir = show,
|
||||||
Some(e) => {
|
Some(e) => {
|
||||||
println!("Bad `show`/`hide` argument: {}", e);
|
println!("Bad `show`/`hide` argument: {}", e);
|
||||||
|
Loading…
Reference in New Issue
Block a user