Kill old DebugOptions struct

This commit is contained in:
greg 2018-05-05 21:08:04 -07:00
parent 890e6bd4c5
commit d524389f1d
3 changed files with 4 additions and 19 deletions

View File

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

View File

@ -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<String>,
}
@ -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<String, TraceArtifact>,

View File

@ -63,11 +63,8 @@ pub fn repl_main(generators: Vec<PLIGenerator>) {
}
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<String> = languages.iter().map(|lang| {lang.get_language_name()}).collect();