From d524389f1d6af9e4f63c2d4e8ef31ca2a301d2b0 Mon Sep 17 00:00:00 2001 From: greg Date: Sat, 5 May 2018 21:08:04 -0700 Subject: [PATCH] Kill old DebugOptions struct --- maaru/src/lib.rs | 4 ++-- schala-repl/src/language.rs | 12 ------------ schala-repl/src/lib.rs | 7 ++----- 3 files changed, 4 insertions(+), 19 deletions(-) diff --git a/maaru/src/lib.rs b/maaru/src/lib.rs index c04adcc..72973a6 100644 --- a/maaru/src/lib.rs +++ b/maaru/src/lib.rs @@ -47,7 +47,7 @@ impl<'a> ProgrammingLanguageInterface for Maaru<'a> { let tokens = match tokenizer::tokenize(input) { Ok(tokens) => { - if options.debug.tokens { + if let Some(_) = options.debug_passes.get("tokens") { output.add_artifact(TraceArtifact::new("tokens", format!("{:?}", tokens))); } tokens @@ -59,7 +59,7 @@ impl<'a> ProgrammingLanguageInterface for Maaru<'a> { let ast = match parser::parse(&tokens, &[]) { Ok(ast) => { - if options.debug.ast { + if let Some(_) = options.debug_passes.get("ast") { output.add_artifact(TraceArtifact::new("ast", format!("{:?}", ast))); } ast diff --git a/schala-repl/src/language.rs b/schala-repl/src/language.rs index 34bd1a9..ce3b381 100644 --- a/schala-repl/src/language.rs +++ b/schala-repl/src/language.rs @@ -6,7 +6,6 @@ pub struct LLVMCodeString(pub String); #[derive(Debug, Default, Serialize, Deserialize)] pub struct EvalOptions { - pub debug: DebugOptions, pub execution_method: ExecutionMethod, pub debug_passes: HashSet, } @@ -21,17 +20,6 @@ impl Default for ExecutionMethod { } } -#[derive(Debug, Default, Serialize, Deserialize)] -pub struct DebugOptions { - pub tokens: bool, - pub parse_tree: bool, - pub ast: bool, - pub type_checking: bool, - pub symbol_table: bool, - pub evaluation: bool, - pub llvm_ir: bool, -} - #[derive(Debug, Default)] pub struct UnfinishedComputation { artifacts: HashMap, diff --git a/schala-repl/src/lib.rs b/schala-repl/src/lib.rs index 5f5b8ae..dcdaaf1 100644 --- a/schala-repl/src/lib.rs +++ b/schala-repl/src/lib.rs @@ -63,11 +63,8 @@ pub fn repl_main(generators: Vec) { } let mut options = EvalOptions::default(); - if let Some(ref ltrs) = option_matches.opt_str("debug") { - options.debug.tokens = ltrs.contains("l"); - options.debug.ast = ltrs.contains("a"); - options.debug.parse_tree = ltrs.contains("r"); - options.debug.symbol_table = ltrs.contains("s"); + if let Some(_) = option_matches.opt_str("debug") { + /* TODO - put some debug handling code here */ } let language_names: Vec = languages.iter().map(|lang| {lang.get_language_name()}).collect();