strath/src/main.rs

27 lines
505 B
Rust
Raw Normal View History

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
pub mod shell;
pub mod parsing;
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
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
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
let code = preprocess(file);
}
}
2021-12-16 10:45:16 +00:00