Tighten names in Language trait
This commit is contained in:
parent
7b7e20859f
commit
7e0acb7d87
@ -251,8 +251,13 @@ fn stage_names() -> Vec<&'static str> {
|
|||||||
|
|
||||||
|
|
||||||
impl ProgrammingLanguageInterface for Schala {
|
impl ProgrammingLanguageInterface for Schala {
|
||||||
fn get_language_name(&self) -> String { format!("Schala") }
|
fn language_name(&self) -> String {
|
||||||
fn get_source_file_suffix(&self) -> String { format!("schala") }
|
"Schala".to_owned()
|
||||||
|
}
|
||||||
|
|
||||||
|
fn source_file_suffix(&self) -> String {
|
||||||
|
"schala".to_owned()
|
||||||
|
}
|
||||||
|
|
||||||
fn run_computation(&mut self, request: ComputationRequest) -> ComputationResponse {
|
fn run_computation(&mut self, request: ComputationRequest) -> ComputationResponse {
|
||||||
struct PassToken<'a> {
|
struct PassToken<'a> {
|
||||||
|
@ -2,8 +2,8 @@ use std::collections::HashSet;
|
|||||||
use std::time;
|
use std::time;
|
||||||
|
|
||||||
pub trait ProgrammingLanguageInterface {
|
pub trait ProgrammingLanguageInterface {
|
||||||
fn get_language_name(&self) -> String;
|
fn language_name(&self) -> String;
|
||||||
fn get_source_file_suffix(&self) -> String;
|
fn source_file_suffix(&self) -> String;
|
||||||
|
|
||||||
fn run_computation(&mut self, _request: ComputationRequest) -> ComputationResponse {
|
fn run_computation(&mut self, _request: ComputationRequest) -> ComputationResponse {
|
||||||
ComputationResponse {
|
ComputationResponse {
|
||||||
|
@ -44,7 +44,7 @@ pub fn run_noninteractive(filenames: Vec<PathBuf>, languages: Vec<Box<dyn Progra
|
|||||||
let mut language = Box::new(
|
let mut language = Box::new(
|
||||||
languages
|
languages
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.find(|lang| lang.get_source_file_suffix() == ext)
|
.find(|lang| lang.source_file_suffix() == ext)
|
||||||
.unwrap_or_else(|| {
|
.unwrap_or_else(|| {
|
||||||
println!("Extension .{} not recognized", ext);
|
println!("Extension .{} not recognized", ext);
|
||||||
exit(1);
|
exit(1);
|
||||||
|
@ -75,7 +75,7 @@ fn global_help(repl: &mut Repl) -> InterpreterDirectiveOutput {
|
|||||||
writeln!(
|
writeln!(
|
||||||
buf,
|
buf,
|
||||||
"Language-specific help for {}",
|
"Language-specific help for {}",
|
||||||
lang.get_language_name()
|
lang.language_name()
|
||||||
)
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
writeln!(buf, "-----------------------").unwrap();
|
writeln!(buf, "-----------------------").unwrap();
|
||||||
|
Loading…
Reference in New Issue
Block a user