More work

This commit is contained in:
greg 2019-03-13 10:10:42 -07:00
parent 5b35c2a036
commit 7360e698dd
3 changed files with 9 additions and 9 deletions

View File

@ -189,29 +189,29 @@ pub trait ProgrammingLanguageInterface {
}
}
struct ComputationRequest {
pub struct ComputationRequest {
pub source: String,
pub debug_requests: Vec<DebugRequest>,
}
struct ComputationResponse {
pub struct ComputationResponse {
pub main_output: Result<String, String>,
pub global_output_stats: GlobalOutputStats,
pub debug_responses: Vec<DebugResponse>,
}
struct DebugRequest {
pub struct DebugRequest {
kind: String,
value: String
}
struct DebugResponse {
pub struct DebugResponse {
kind: String,
value: String
}
#[derive(Default, Debug)]
struct GlobalOutputStats {
pub struct GlobalOutputStats {
total_duration: Option<time::Duration>,
stage_durations: Option<Vec<(String, time::Duration)>>
}

View File

@ -39,8 +39,7 @@ pub fn start_repl(langs: Vec<Box<dyn ProgrammingLanguageInterface>>) {
exit(0);
}
let mut repl = repl::NewRepl::new();
let mut repl = repl::NewRepl::new(langs);
repl.run_repl();
}

View File

@ -16,16 +16,17 @@ const OPTIONS_SAVE_FILE: &'static str = ".schala_repl";
pub struct NewRepl {
interpreter_directive_sigil: char,
line_reader: ::linefeed::interface::Interface<::linefeed::terminal::DefaultTerminal>,
language_states: Vec<Box<ProgrammingLanguageInterface>>,
}
impl NewRepl {
pub fn new() -> NewRepl {
pub fn new(languages: Vec<Box<ProgrammingLanguageInterface>>) -> NewRepl {
use linefeed::Interface;
let line_reader = Interface::new("schala-repl").unwrap();
let interpreter_directive_sigil = ':';
NewRepl {
interpreter_directive_sigil, line_reader,
interpreter_directive_sigil, line_reader, language_states
}
}