Killed some warnings, cleaned up some code
This commit is contained in:
parent
8ff1c632c2
commit
65dc362a1d
@ -1,4 +1,3 @@
|
||||
use std::default::Default;
|
||||
use std::fmt::Debug;
|
||||
|
||||
#[derive(Debug)]
|
||||
|
@ -28,17 +28,17 @@ impl ProgrammingLanguage for Maaru {
|
||||
"Maaru".to_string()
|
||||
}
|
||||
|
||||
fn tokenize(input: &str) -> Result<Vec<Self::Token>, TokenError> {
|
||||
fn tokenize(_input: &str) -> Result<Vec<Self::Token>, TokenError> {
|
||||
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 { })
|
||||
}
|
||||
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()]
|
||||
}
|
||||
fn compile(ast: Self::AST) -> LLVMCodeString {
|
||||
fn compile(_ast: Self::AST) -> LLVMCodeString {
|
||||
unimplemented!()
|
||||
}
|
||||
}
|
||||
|
18
src/main.rs
18
src/main.rs
@ -41,16 +41,20 @@ fn main() {
|
||||
}
|
||||
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[..] {
|
||||
[] | [_] => {
|
||||
let mut repl = Repl::new(languages);
|
||||
repl.show_llvm_ir = show_llvm_ir;
|
||||
repl.run();
|
||||
}
|
||||
[_, ref filename, _..] => {
|
||||
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
|
||||
}
|
||||
|
||||
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 buffer = String::new();
|
||||
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>;
|
||||
struct Repl {
|
||||
show_tokens: bool,
|
||||
show_parse: bool,
|
||||
show_llvm_ir: bool,
|
||||
pub show_tokens: bool,
|
||||
pub show_parse: bool,
|
||||
pub show_llvm_ir: bool,
|
||||
languages: Vec<Box<LanguageInterface>>,
|
||||
current_language_index: usize,
|
||||
interpreter_directive_sigil: char,
|
||||
|
Loading…
Reference in New Issue
Block a user