Killed some warnings, cleaned up some code

This commit is contained in:
greg 2017-02-02 11:33:07 -08:00
parent 8ff1c632c2
commit 65dc362a1d
3 changed files with 15 additions and 12 deletions

View File

@ -1,4 +1,3 @@
use std::default::Default;
use std::fmt::Debug; use std::fmt::Debug;
#[derive(Debug)] #[derive(Debug)]

View File

@ -28,17 +28,17 @@ impl ProgrammingLanguage for Maaru {
"Maaru".to_string() "Maaru".to_string()
} }
fn tokenize(input: &str) -> Result<Vec<Self::Token>, TokenError> { fn tokenize(_input: &str) -> Result<Vec<Self::Token>, TokenError> {
Ok(vec![Token { }]) Ok(vec![Token { }])
} }
fn parse(input: Vec<Self::Token>) -> Result<Self::AST, ParseError> { fn parse(_input: Vec<Self::Token>) -> Result<Self::AST, ParseError> {
Ok(AST { }) Ok(AST { })
} }
fn evaluate(ast: Self::AST, evaluator: &mut Self::Evaluator) -> Vec<String> { fn evaluate(_ast: Self::AST, _evaluator: &mut Self::Evaluator) -> Vec<String> {
vec!["Unimplemented".to_string()] vec!["Unimplemented".to_string()]
} }
fn compile(ast: Self::AST) -> LLVMCodeString { fn compile(_ast: Self::AST) -> LLVMCodeString {
unimplemented!() unimplemented!()
} }
} }

View File

@ -41,16 +41,20 @@ fn main() {
} }
std::process::exit(1); std::process::exit(1);
} }
let trace = option_matches.opt_present("t");
let show_llvm = option_matches.opt_present("l"); let show_llvm_ir = option_matches.opt_present("l");
let compile = !option_matches.opt_present("i");
let trace_evaluation = option_matches.opt_present("t");
match option_matches.free[..] { match option_matches.free[..] {
[] | [_] => { [] | [_] => {
let mut repl = Repl::new(languages); let mut repl = Repl::new(languages);
repl.show_llvm_ir = show_llvm_ir;
repl.run(); repl.run();
} }
[_, ref filename, _..] => { [_, ref filename, _..] => {
let language = Schala::new(); let language = Schala::new();
run_noninteractive(filename, !option_matches.opt_present("i"), trace, &language); run_noninteractive(filename, &language, trace_evaluation, compile);
} }
}; };
} }
@ -72,7 +76,7 @@ fn program_options() -> getopts::Options {
options options
} }
fn run_noninteractive<'a, T: ProgrammingLanguage>(filename: &str, compile: bool, trace_evaluation: bool, language: &T) { fn run_noninteractive<'a, T: ProgrammingLanguage>(filename: &str, _language: &T, trace_evaluation: bool, compile: bool) {
let mut source_file = File::open(&Path::new(filename)).unwrap(); let mut source_file = File::open(&Path::new(filename)).unwrap();
let mut buffer = String::new(); let mut buffer = String::new();
source_file.read_to_string(&mut buffer).unwrap(); source_file.read_to_string(&mut buffer).unwrap();
@ -110,9 +114,9 @@ fn run_noninteractive<'a, T: ProgrammingLanguage>(filename: &str, compile: bool,
type LineReader = linefeed::Reader<linefeed::terminal::DefaultTerminal>; type LineReader = linefeed::Reader<linefeed::terminal::DefaultTerminal>;
struct Repl { struct Repl {
show_tokens: bool, pub show_tokens: bool,
show_parse: bool, pub show_parse: bool,
show_llvm_ir: bool, pub show_llvm_ir: bool,
languages: Vec<Box<LanguageInterface>>, languages: Vec<Box<LanguageInterface>>,
current_language_index: usize, current_language_index: usize,
interpreter_directive_sigil: char, interpreter_directive_sigil: char,