From a10df92ab8e3df19d79ae62f21a6e5a72ae3c2ee Mon Sep 17 00:00:00 2001 From: greg Date: Tue, 1 May 2018 18:22:52 -0700 Subject: [PATCH] Debug work --- schala-lang/src/lib.rs | 10 +++++----- schala-repl/src/language.rs | 14 ++++++-------- 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/schala-lang/src/lib.rs b/schala-lang/src/lib.rs index 535ac34..4ccb115 100644 --- a/schala-lang/src/lib.rs +++ b/schala-lang/src/lib.rs @@ -114,11 +114,11 @@ impl ProgrammingLanguageInterface for Schala { fn get_stages(&self) -> Vec { vec![ - format!("tokenizing"), - format!("parsing"), //TODO handle both types of this - format!("symbol_table"), - format!("typechecking"), - format!("eval") + format!("tokenizing_stage"), + format!("parsing_stage"), //TODO handle both types of this + format!("symbol_table_stage"), + format!("typechecking_stage"), + format!("eval_stage") ] } } diff --git a/schala-repl/src/language.rs b/schala-repl/src/language.rs index 4187160..2975be8 100644 --- a/schala-repl/src/language.rs +++ b/schala-repl/src/language.rs @@ -203,15 +203,13 @@ macro_rules! pass_chain_helper { { let pass_name = stringify!($pass); let output = { - let debug_pointer: Option<&mut UnfinishedComputation> = { - //TODO this is janky fix it - let debug_condition = ($options.debug.tokens && pass_name == "tokenizing_stage") - || ($options.debug.parse_tree && pass_name == "parsing_stage") - || ($options.debug.symbol_table && pass_name == "symbol_table_stage") - || (pass_name == "typechecking_stage"); - if debug_condition { Some(&mut $comp) } else { None } + let ref debug_set = $options.debug_stages; + let debug_handle: Option<&mut UnfinishedComputation> = if debug_set.contains(pass_name) { + Some(&mut $comp) + } else { + None }; - $pass($state, $input, debug_pointer) + $pass($state, $input, debug_handle) }; match output { Ok(result) => pass_chain_helper! { ($state, $comp, $options); result $(, $rest)* },