diff --git a/schala-lang/language/src/lib.rs b/schala-lang/language/src/lib.rs index 8e2ac04..7786a19 100644 --- a/schala-lang/language/src/lib.rs +++ b/schala-lang/language/src/lib.rs @@ -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!("") } diff --git a/schala-repl/src/repl/mod.rs b/schala-repl/src/repl/mod.rs index 1f04063..38c1c3d 100644 --- a/schala-repl/src/repl/mod.rs +++ b/schala-repl/src/repl/mod.rs @@ -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 = 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 = 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]| {