schala/src/main.rs

28 lines
646 B
Rust
Raw Normal View History

extern crate simplerepl;
2015-08-14 17:07:02 -07:00
use std::path::Path;
use std::fs::File;
use std::io::Read;
2015-07-22 02:26:46 -07:00
use simplerepl::REPL;
2015-07-22 03:02:55 -07:00
use tokenizer::tokenize;
2015-07-22 03:02:55 -07:00
mod tokenizer;
2015-07-16 02:55:03 -07:00
2015-07-16 01:40:37 -07:00
fn main() {
2015-08-14 17:07:02 -07:00
let args: Vec<String> = std::env::args().collect();
2015-08-30 02:22:19 -07:00
println!("Schala v 0.02");
2015-08-14 17:07:02 -07:00
if let Some(filename) = args.get(1) {
let mut source_file = File::open(&Path::new(filename)).unwrap();
let mut buffer = String::new();
source_file.read_to_string(&mut buffer).unwrap();
panic!("Not implemented yet");
2015-08-14 17:07:02 -07:00
} else {
REPL::default(repl_handler).run();
2015-08-14 17:07:02 -07:00
}
2015-07-16 02:55:03 -07:00
}
fn repl_handler(input: &str) -> String {
format!("{:?}", tokenize(input))
}