Add back debug passes command completion support

This commit is contained in:
greg 2019-03-19 19:37:29 -07:00
parent 9476e7039b
commit 3a98096b61
2 changed files with 11 additions and 22 deletions

View File

@ -248,7 +248,7 @@ impl ProgrammingLanguageInterface for Schala {
match request { match request {
LangMetaRequest::StageNames => LangMetaResponse::StageNames( LangMetaRequest::StageNames => LangMetaResponse::StageNames(
vec!["tokenizing".into(), "parsing".into(), "typechecking".into(), vec!["tokenizing".into(), "parsing".into(), "typechecking".into(),
"ast reduction".into(), "ast-walking evaluation".into()] "ast reduction".into(), "ast-walking-evaluation".into()]
), ),
LangMetaRequest::Docs { source } => self.handle_docs(source), LangMetaRequest::Docs { source } => self.handle_docs(source),
LangMetaRequest::Custom { .. } => LangMetaResponse::Custom { kind: format!("not-implemented"), value: format!("") } LangMetaRequest::Custom { .. } => LangMetaResponse::Custom { kind: format!("not-implemented"), value: format!("") }

View File

@ -5,7 +5,7 @@ use std::sync::Arc;
use colored::*; use colored::*;
use itertools::Itertools; use itertools::Itertools;
use crate::language::{ProgrammingLanguageInterface, ComputationRequest, ComputationResponse}; use crate::language::{ProgrammingLanguageInterface, ComputationRequest, ComputationResponse, LangMetaRequest, LangMetaResponse};
mod command_tree; mod command_tree;
use self::command_tree::{CommandTree, BoxedCommandFunction}; use self::command_tree::{CommandTree, BoxedCommandFunction};
@ -188,27 +188,16 @@ impl Repl {
} }
} }
fn get_directives(&self) -> CommandTree { fn get_directives(&mut self) -> CommandTree {
let passes_directives = vec![]; let language_state = self.get_cur_language_state();
/* let passes = match language_state.request_meta(LangMetaRequest::StageNames) {
let ref passes = self.get_cur_language().get_passes(); LangMetaResponse::StageNames(names) => names,
_ => vec![],
};
let passes_directives: Vec<CommandTree> = passes.iter() let passes_directives: Vec<CommandTree> = passes.iter()
.map(|pass_descriptor| { .map(|pass_name| { CommandTree::term(pass_name, None) })
let name = &pass_descriptor.name; .collect();
if pass_descriptor.debug_options.len() == 0 {
CommandTree::term(name, None)
} else {
let children: Vec<CommandTree> = pass_descriptor.debug_options.iter()
.map(|o| CommandTree::term(o, None)).collect();
CommandTree::NonTerminal {
name: name.clone(),
children,
help_msg: None,
function: None,
}
}
}).collect();
*/
CommandTree::Top(vec![ CommandTree::Top(vec![
CommandTree::term_with_function("exit", Some("exit the REPL"), Box::new(|repl: &mut Repl, _cmds: &[&str]| { CommandTree::term_with_function("exit", Some("exit the REPL"), Box::new(|repl: &mut Repl, _cmds: &[&str]| {