2019-05-22 03:32:00 -07:00
|
|
|
use std::fmt::Write as FmtWrite;
|
|
|
|
|
|
|
|
use crate::repl::Repl;
|
2019-06-02 00:27:12 -07:00
|
|
|
use crate::repl::command_tree::CommandTree;
|
|
|
|
use crate::repl::directive_actions::DirectiveAction;
|
2019-06-01 13:11:07 -07:00
|
|
|
use crate::language::{LangMetaRequest, LangMetaResponse, DebugAsk, DebugResponse};
|
2019-05-22 03:32:00 -07:00
|
|
|
|
2019-06-02 00:18:37 -07:00
|
|
|
|
2019-06-01 13:11:07 -07:00
|
|
|
pub fn directives_from_pass_names(pass_names: &Vec<String>) -> CommandTree {
|
2019-06-02 00:27:12 -07:00
|
|
|
use DirectiveAction::*;
|
|
|
|
|
2019-05-22 03:32:00 -07:00
|
|
|
let passes_directives: Vec<CommandTree> = pass_names.iter()
|
|
|
|
.map(|pass_name| { CommandTree::nonterm_no_further_tab_completions(pass_name, None) })
|
|
|
|
.collect();
|
|
|
|
|
|
|
|
CommandTree::Top(vec![
|
2019-06-02 00:27:12 -07:00
|
|
|
CommandTree::terminal_act("exit", Some("exit the REPL"), vec![], QuitProgram),
|
|
|
|
CommandTree::terminal_act("quit", Some("exit the REPL"), vec![], QuitProgram),
|
|
|
|
CommandTree::terminal_act("help", Some("Print this help message"), vec![], Help),
|
2019-05-22 03:32:00 -07:00
|
|
|
CommandTree::nonterm("debug",
|
|
|
|
Some("Configure debug information"),
|
|
|
|
vec![
|
2019-06-02 00:27:12 -07:00
|
|
|
CommandTree::terminal_act("list-passes", Some("List all registered compiler passes"), vec![], ListPasses),
|
2019-06-02 00:43:55 -07:00
|
|
|
CommandTree::terminal_act("show-immediate", None, passes_directives.clone(), ShowImmediate),
|
|
|
|
CommandTree::terminal_act("show", None, passes_directives.clone(), Show),
|
|
|
|
CommandTree::terminal_act("hide", None, passes_directives.clone(), Hide),
|
2019-05-22 03:32:00 -07:00
|
|
|
CommandTree::nonterm("total-time", None, vec![
|
2019-06-02 00:43:55 -07:00
|
|
|
CommandTree::terminal_act("on", None, vec![], TotalTimeOn),
|
|
|
|
CommandTree::terminal_act("off", None, vec![], TotalTimeOff),
|
2019-05-25 22:21:52 -07:00
|
|
|
]),
|
|
|
|
CommandTree::nonterm("stage-times", Some("Computation time per-stage"), vec![
|
2019-06-02 00:43:55 -07:00
|
|
|
CommandTree::terminal_act("on", None, vec![], StageTimeOn),
|
|
|
|
CommandTree::terminal_act("off", None, vec![], StageTimeOff),
|
2019-05-22 03:32:00 -07:00
|
|
|
])
|
|
|
|
]
|
|
|
|
),
|
|
|
|
CommandTree::nonterm("lang",
|
|
|
|
Some("switch between languages, or go directly to a langauge by name"),
|
|
|
|
vec![
|
|
|
|
CommandTree::nonterm_no_further_tab_completions("next", None),
|
|
|
|
CommandTree::nonterm_no_further_tab_completions("prev", None),
|
|
|
|
CommandTree::nonterm("go", None, vec![]),
|
|
|
|
]
|
|
|
|
),
|
2019-06-02 00:43:55 -07:00
|
|
|
CommandTree::terminal_act("doc", Some("Get language-specific help for an item"), vec![], Doc),
|
2019-05-22 03:32:00 -07:00
|
|
|
])
|
|
|
|
}
|
|
|
|
|