new compiler

This commit is contained in:
2024-07-11 14:15:31 +02:00
parent 58af9cdd95
commit f4759f01c8
4 changed files with 163 additions and 47 deletions
+26 -8
View File
@@ -22,15 +22,33 @@ fn main() {
.short('o')
.long("output")
.takes_value(true)
.help("Specifies the output executable file name"),
.help("Specifies the output binary file name"),
)
.arg(
Arg::with_name("build")
.short('b')
.long("build")
.help("Puts the rust files in the build directory"),
)
.arg(
Arg::with_name("stdio")
.short('s')
.long("stdio")
.help("LSP Mode"),
)
.get_matches();
let file = matches.value_of("file").unwrap().to_string();
let output = matches.value_of("output").unwrap_or("out").to_string();
if let Ok(_) = fs::create_dir("build") {}
let ecode = transpile(file, "main.rs".to_string(), true);
compile_rust(output);
fs::remove_dir_all("build").expect("Error removing build");
process::exit(ecode as i32);
if matches.is_present("stdio") {
println!("stdio mode!");
} else {
let file = matches.value_of("file").unwrap().to_string();
let output = matches.value_of("output").unwrap_or("out").to_string();
if let Ok(_) = fs::create_dir("build") {}
let ecode = transpile(file, "main.rs".to_string(), true);
compile_rust(output);
if !matches.is_present("build") {
fs::remove_dir_all("build").expect("Error removing build");
}
process::exit(ecode as i32);
}
}