2015-12-18 23:40:30 -08:00
|
|
|
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
|
|
|
|
2015-12-18 23:40:30 -08:00
|
|
|
use simplerepl::REPL;
|
2015-07-22 03:02:55 -07:00
|
|
|
|
2015-12-18 23:40:30 -08: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();
|
2015-12-18 23:40:30 -08:00
|
|
|
panic!("Not implemented yet");
|
2015-08-14 17:07:02 -07:00
|
|
|
} else {
|
2015-12-18 23:40:30 -08:00
|
|
|
REPL::default(repl_handler).run();
|
2015-08-14 17:07:02 -07:00
|
|
|
}
|
2015-07-16 02:55:03 -07:00
|
|
|
}
|
|
|
|
|
2015-12-18 23:40:30 -08:00
|
|
|
fn repl_handler(input: &str) -> String {
|
|
|
|
format!("{:?}", tokenize(input))
|
2015-07-24 03:08:54 -07:00
|
|
|
}
|