More work
This commit is contained in:
parent
5b35c2a036
commit
7360e698dd
@ -189,29 +189,29 @@ pub trait ProgrammingLanguageInterface {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
struct ComputationRequest {
|
pub struct ComputationRequest {
|
||||||
pub source: String,
|
pub source: String,
|
||||||
pub debug_requests: Vec<DebugRequest>,
|
pub debug_requests: Vec<DebugRequest>,
|
||||||
}
|
}
|
||||||
|
|
||||||
struct ComputationResponse {
|
pub struct ComputationResponse {
|
||||||
pub main_output: Result<String, String>,
|
pub main_output: Result<String, String>,
|
||||||
pub global_output_stats: GlobalOutputStats,
|
pub global_output_stats: GlobalOutputStats,
|
||||||
pub debug_responses: Vec<DebugResponse>,
|
pub debug_responses: Vec<DebugResponse>,
|
||||||
}
|
}
|
||||||
|
|
||||||
struct DebugRequest {
|
pub struct DebugRequest {
|
||||||
kind: String,
|
kind: String,
|
||||||
value: String
|
value: String
|
||||||
}
|
}
|
||||||
|
|
||||||
struct DebugResponse {
|
pub struct DebugResponse {
|
||||||
kind: String,
|
kind: String,
|
||||||
value: String
|
value: String
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Default, Debug)]
|
#[derive(Default, Debug)]
|
||||||
struct GlobalOutputStats {
|
pub struct GlobalOutputStats {
|
||||||
total_duration: Option<time::Duration>,
|
total_duration: Option<time::Duration>,
|
||||||
stage_durations: Option<Vec<(String, time::Duration)>>
|
stage_durations: Option<Vec<(String, time::Duration)>>
|
||||||
}
|
}
|
||||||
|
@ -39,8 +39,7 @@ pub fn start_repl(langs: Vec<Box<dyn ProgrammingLanguageInterface>>) {
|
|||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut repl = repl::NewRepl::new();
|
let mut repl = repl::NewRepl::new(langs);
|
||||||
|
|
||||||
repl.run_repl();
|
repl.run_repl();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,16 +16,17 @@ const OPTIONS_SAVE_FILE: &'static str = ".schala_repl";
|
|||||||
pub struct NewRepl {
|
pub struct NewRepl {
|
||||||
interpreter_directive_sigil: char,
|
interpreter_directive_sigil: char,
|
||||||
line_reader: ::linefeed::interface::Interface<::linefeed::terminal::DefaultTerminal>,
|
line_reader: ::linefeed::interface::Interface<::linefeed::terminal::DefaultTerminal>,
|
||||||
|
language_states: Vec<Box<ProgrammingLanguageInterface>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl NewRepl {
|
impl NewRepl {
|
||||||
pub fn new() -> NewRepl {
|
pub fn new(languages: Vec<Box<ProgrammingLanguageInterface>>) -> NewRepl {
|
||||||
use linefeed::Interface;
|
use linefeed::Interface;
|
||||||
let line_reader = Interface::new("schala-repl").unwrap();
|
let line_reader = Interface::new("schala-repl").unwrap();
|
||||||
let interpreter_directive_sigil = ':';
|
let interpreter_directive_sigil = ':';
|
||||||
|
|
||||||
NewRepl {
|
NewRepl {
|
||||||
interpreter_directive_sigil, line_reader,
|
interpreter_directive_sigil, line_reader, language_states
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user