Starting to move debug options around
+ add method to ProgrammingLanguageInterface that is a list of stages
This commit is contained in:
parent
fff587cd6a
commit
aaf98db2b7
@ -169,6 +169,9 @@ pub trait ProgrammingLanguageInterface {
|
|||||||
|
|
||||||
fn get_language_name(&self) -> String;
|
fn get_language_name(&self) -> String;
|
||||||
fn get_source_file_suffix(&self) -> String;
|
fn get_source_file_suffix(&self) -> String;
|
||||||
|
fn get_stages(&self) -> Vec<String> {
|
||||||
|
vec![]
|
||||||
|
}
|
||||||
fn handle_custom_interpreter_directives(&mut self, _commands: &Vec<&str>) -> Option<String> {
|
fn handle_custom_interpreter_directives(&mut self, _commands: &Vec<&str>) -> Option<String> {
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
|
@ -277,7 +277,26 @@ impl Repl {
|
|||||||
writeln!(buf, "{}", lang.custom_interpreter_directives_help()).unwrap();
|
writeln!(buf, "{}", lang.custom_interpreter_directives_help()).unwrap();
|
||||||
Some(buf)
|
Some(buf)
|
||||||
},
|
},
|
||||||
"debug" => {
|
"debug" => self.handle_debug(commands),
|
||||||
|
e => self.languages[self.current_language_index]
|
||||||
|
.handle_custom_interpreter_directives(&commands)
|
||||||
|
.or(Some(format!("Unknown command: {}", e)))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
fn handle_debug(&mut self, commands: Vec<&str>) -> Option<String> {
|
||||||
|
match commands.get(1) {
|
||||||
|
b @ Some(&"show") | b @ Some(&"hide") => {
|
||||||
|
let show = b == Some(&"show");
|
||||||
|
let debug_stage = match commands.get(2) {
|
||||||
|
Some(s) => s,
|
||||||
|
None => return Some(format!("Must specify a stage to debug")),
|
||||||
|
};
|
||||||
|
None
|
||||||
|
},
|
||||||
|
_ => Some(format!("Unknown debug command"))
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
* {
|
||||||
let show = match commands.get(1) {
|
let show = match commands.get(1) {
|
||||||
Some(&"show") => true,
|
Some(&"show") => true,
|
||||||
Some(&"hide") => false,
|
Some(&"hide") => false,
|
||||||
@ -299,6 +318,9 @@ impl Repl {
|
|||||||
};
|
};
|
||||||
None
|
None
|
||||||
},
|
},
|
||||||
|
|
||||||
|
AND DEBUG OPTIONS
|
||||||
|
|
||||||
"options" => {
|
"options" => {
|
||||||
let ref d = self.options.debug;
|
let ref d = self.options.debug;
|
||||||
let tokens = if d.tokens { "true".green() } else { "false".red() };
|
let tokens = if d.tokens { "true".green() } else { "false".red() };
|
||||||
@ -308,10 +330,8 @@ impl Repl {
|
|||||||
Some(format!(r#"Debug:
|
Some(format!(r#"Debug:
|
||||||
tokens: {}, parse: {}, ast: {}, symbols: {}"#, tokens, parse_tree, ast, symbol_table))
|
tokens: {}, parse: {}, ast: {}, symbols: {}"#, tokens, parse_tree, ast, symbol_table))
|
||||||
},
|
},
|
||||||
e => self.languages[self.current_language_index]
|
|
||||||
.handle_custom_interpreter_directives(&commands)
|
*/
|
||||||
.or(Some(format!("Unknown command: {}", e)))
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user