Doc requests in type system
This commit is contained in:
parent
c767402865
commit
9476e7039b
@ -52,12 +52,10 @@ pub struct Schala {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl Schala {
|
impl Schala {
|
||||||
fn get_doc(&self, commands: &Vec<&str>) -> Option<String> {
|
fn handle_docs(&self, source: String) -> LangMetaResponse {
|
||||||
Some(format!("Documentation on commands: {:?}", commands))
|
LangMetaResponse::Docs {
|
||||||
}
|
doc_string: format!("<<Schala-lang documentation not yet implemented>>")
|
||||||
|
}
|
||||||
fn handle_custom_interpreter_directives(&mut self, commands: &Vec<&str>) -> Option<String> {
|
|
||||||
Some(format!("Schala-lang command: {:?} not supported", commands.get(0)))
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -246,7 +244,14 @@ impl ProgrammingLanguageInterface for Schala {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn repl_request(&self, repl_request: String) -> String {
|
fn request_meta(&mut self, request: LangMetaRequest) -> LangMetaResponse {
|
||||||
format!("Schala: can't understand {}", repl_request)
|
match request {
|
||||||
|
LangMetaRequest::StageNames => LangMetaResponse::StageNames(
|
||||||
|
vec!["tokenizing".into(), "parsing".into(), "typechecking".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!("") }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -12,10 +12,6 @@ pub trait ProgrammingLanguageInterface {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn repl_request(&self, repl_request: String) -> String {
|
|
||||||
format!("<<No custom interpreter directives or help info specified>>")
|
|
||||||
}
|
|
||||||
|
|
||||||
fn request_meta(&mut self, _request: LangMetaRequest) -> LangMetaResponse {
|
fn request_meta(&mut self, _request: LangMetaRequest) -> LangMetaResponse {
|
||||||
LangMetaResponse::Custom { kind: format!("not-implemented"), value: format!("") }
|
LangMetaResponse::Custom { kind: format!("not-implemented"), value: format!("") }
|
||||||
}
|
}
|
||||||
@ -44,6 +40,9 @@ pub struct DebugResponse {
|
|||||||
|
|
||||||
pub enum LangMetaRequest {
|
pub enum LangMetaRequest {
|
||||||
StageNames,
|
StageNames,
|
||||||
|
Docs {
|
||||||
|
source: String,
|
||||||
|
},
|
||||||
Custom {
|
Custom {
|
||||||
kind: String,
|
kind: String,
|
||||||
value: String
|
value: String
|
||||||
@ -52,6 +51,9 @@ pub enum LangMetaRequest {
|
|||||||
|
|
||||||
pub enum LangMetaResponse {
|
pub enum LangMetaResponse {
|
||||||
StageNames(Vec<String>),
|
StageNames(Vec<String>),
|
||||||
|
Docs {
|
||||||
|
doc_string: String,
|
||||||
|
},
|
||||||
Custom {
|
Custom {
|
||||||
kind: String,
|
kind: String,
|
||||||
value: String
|
value: String
|
||||||
|
Loading…
Reference in New Issue
Block a user