2021-12-15 19:28:10 +00:00
|
|
|
use std::env;
|
2021-12-16 08:03:40 +00:00
|
|
|
use std::fs;
|
2021-12-15 19:28:10 +00:00
|
|
|
|
2021-12-20 13:34:21 +00:00
|
|
|
pub mod shell;
|
|
|
|
pub mod parsing;
|
2021-12-19 20:38:21 +00:00
|
|
|
|
|
|
|
use parsing::preprocessor::preprocess;
|
2021-12-16 10:45:16 +00:00
|
|
|
|
2021-12-15 19:28:10 +00:00
|
|
|
fn main() {
|
2021-12-16 08:03:40 +00:00
|
|
|
let args: Vec<String> = env::args().collect();
|
2021-12-16 10:45:16 +00:00
|
|
|
|
2021-12-19 20:38:21 +00:00
|
|
|
let run_shell = String::from("RUN_SH");
|
|
|
|
let path: &String = match args.get(1) {
|
|
|
|
Some(path) => path,
|
|
|
|
None => &run_shell,
|
|
|
|
};
|
2021-12-16 08:03:40 +00:00
|
|
|
|
2021-12-19 20:38:21 +00:00
|
|
|
if path == "RUN_SH" {
|
|
|
|
shell::run_shell();
|
|
|
|
} else {
|
|
|
|
let file = fs::read_to_string(path).expect("Couldnt read file:");
|
2021-12-16 08:03:40 +00:00
|
|
|
|
2021-12-19 20:38:21 +00:00
|
|
|
let code = preprocess(file);
|
|
|
|
}
|
|
|
|
}
|
2021-12-16 10:45:16 +00:00
|
|
|
|