Debug work

This commit is contained in:
greg 2018-05-01 18:22:52 -07:00
parent fe64cbcd3a
commit a10df92ab8
2 changed files with 11 additions and 13 deletions

View File

@ -114,11 +114,11 @@ impl ProgrammingLanguageInterface for Schala {
fn get_stages(&self) -> Vec<String> { fn get_stages(&self) -> Vec<String> {
vec![ vec![
format!("tokenizing"), format!("tokenizing_stage"),
format!("parsing"), //TODO handle both types of this format!("parsing_stage"), //TODO handle both types of this
format!("symbol_table"), format!("symbol_table_stage"),
format!("typechecking"), format!("typechecking_stage"),
format!("eval") format!("eval_stage")
] ]
} }
} }

View File

@ -203,15 +203,13 @@ macro_rules! pass_chain_helper {
{ {
let pass_name = stringify!($pass); let pass_name = stringify!($pass);
let output = { let output = {
let debug_pointer: Option<&mut UnfinishedComputation> = { let ref debug_set = $options.debug_stages;
//TODO this is janky fix it let debug_handle: Option<&mut UnfinishedComputation> = if debug_set.contains(pass_name) {
let debug_condition = ($options.debug.tokens && pass_name == "tokenizing_stage") Some(&mut $comp)
|| ($options.debug.parse_tree && pass_name == "parsing_stage") } else {
|| ($options.debug.symbol_table && pass_name == "symbol_table_stage") None
|| (pass_name == "typechecking_stage");
if debug_condition { Some(&mut $comp) } else { None }
}; };
$pass($state, $input, debug_pointer) $pass($state, $input, debug_handle)
}; };
match output { match output {
Ok(result) => pass_chain_helper! { ($state, $comp, $options); result $(, $rest)* }, Ok(result) => pass_chain_helper! { ($state, $comp, $options); result $(, $rest)* },