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 {
LangMetaRequest::StageNames => LangMetaResponse::StageNames(
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::Custom { .. } => LangMetaResponse::Custom { kind: format!("not-implemented"), value: format!("") }

View File

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