From 1e7e407f007052bb5954ccebfdc4461b02df15d2 Mon Sep 17 00:00:00 2001 From: greg Date: Fri, 21 Jun 2019 01:59:04 -0700 Subject: [PATCH] Not working --- schala-lang/language/src/lib.rs | 11 ++++++++++- schala-repl/src/language.rs | 5 +++++ schala-repl/src/lib.rs | 6 +++--- schala-repl/src/repl/mod.rs | 8 ++++---- 4 files changed, 22 insertions(+), 8 deletions(-) diff --git a/schala-lang/language/src/lib.rs b/schala-lang/language/src/lib.rs index ac83280..cedb960 100644 --- a/schala-lang/language/src/lib.rs +++ b/schala-lang/language/src/lib.rs @@ -25,7 +25,7 @@ use std::rc::Rc; use std::collections::HashSet; use itertools::Itertools; -use schala_repl::{ProgrammingLanguageInterface, +use schala_repl::{ProgrammingLanguageInterface, ProgrammingLanguageStages, ComputationRequest, ComputationResponse, LangMetaRequest, LangMetaResponse, GlobalOutputStats, DebugResponse, DebugAsk}; @@ -259,8 +259,17 @@ fn stage_names() -> Vec<&'static str> { ] } +pub enum SchalaStages { + Something +} +impl ProgrammingLanguageStages { + fn to_string() -> String { + format!("DUMMY") + } +} impl ProgrammingLanguageInterface for Schala { + type Stages = SchalaStages; fn get_language_name(&self) -> String { format!("Schala") } fn get_source_file_suffix(&self) -> String { format!("schala") } diff --git a/schala-repl/src/language.rs b/schala-repl/src/language.rs index 34542a1..1a5938e 100644 --- a/schala-repl/src/language.rs +++ b/schala-repl/src/language.rs @@ -1,7 +1,12 @@ use std::time; use std::collections::HashSet; +pub trait ProgrammingLanguageStages { + fn to_string(&self) -> String; +} + pub trait ProgrammingLanguageInterface { + type Stages : ProgrammingLanguageStages; fn get_language_name(&self) -> String; fn get_source_file_suffix(&self) -> String; diff --git a/schala-repl/src/lib.rs b/schala-repl/src/lib.rs index 2e02d41..b7b69ca 100644 --- a/schala-repl/src/lib.rs +++ b/schala-repl/src/lib.rs @@ -21,7 +21,7 @@ use std::process::exit; mod repl; mod language; -pub use language::{ProgrammingLanguageInterface, +pub use language::{ProgrammingLanguageInterface, ProgrammingLanguageStages, ComputationRequest, ComputationResponse, LangMetaRequest, LangMetaResponse, DebugResponse, DebugAsk, GlobalOutputStats}; @@ -29,7 +29,7 @@ DebugResponse, DebugAsk, GlobalOutputStats}; include!(concat!(env!("OUT_DIR"), "/static.rs")); const VERSION_STRING: &'static str = "0.1.0"; -pub fn start_repl(langs: Vec>) { +pub fn start_repl(langs: Vec>>) { let options = command_line_options().parse(std::env::args()).unwrap_or_else(|e| { println!("{:?}", e); exit(1); @@ -51,7 +51,7 @@ pub fn start_repl(langs: Vec>) { }; } -fn run_noninteractive(filename: &str, languages: Vec>) { +fn run_noninteractive(filename: &str, languages: Vec>>) { let path = Path::new(filename); let ext = path.extension().and_then(|e| e.to_str()).unwrap_or_else(|| { println!("Source file lacks extension"); diff --git a/schala-repl/src/repl/mod.rs b/schala-repl/src/repl/mod.rs index 32c339a..af5b0ab 100644 --- a/schala-repl/src/repl/mod.rs +++ b/schala-repl/src/repl/mod.rs @@ -2,7 +2,7 @@ use std::sync::Arc; use std::collections::HashSet; use colored::*; -use crate::language::{ProgrammingLanguageInterface, +use crate::language::{ProgrammingLanguageInterface, ProgrammingLanguageStages, ComputationRequest, ComputationResponse, DebugAsk, LangMetaResponse, LangMetaRequest}; @@ -23,12 +23,12 @@ type InterpreterDirectiveOutput = Option; pub struct Repl { pub interpreter_directive_sigil: char, line_reader: ::linefeed::interface::Interface<::linefeed::terminal::DefaultTerminal>, - language_states: Vec>, + language_states: Vec>>, options: ReplOptions, } impl Repl { - pub fn new(initial_states: Vec>) -> Repl { + pub fn new(initial_states: Vec>>) -> Repl { use linefeed::Interface; let line_reader = Interface::new("schala-repl").unwrap(); let interpreter_directive_sigil = ':'; @@ -113,7 +113,7 @@ impl Repl { directives.perform(self, &arguments) } - fn get_cur_language_state(&mut self) -> &mut Box { + fn get_cur_language_state(&mut self) -> &mut Box> { //TODO this is obviously not complete &mut self.language_states[0] }