Produce machine code in the path of the assembly file

This commit is contained in:
Hazem Krimi
2024-03-13 23:18:49 +01:00
parent 29b0babd19
commit fd8e48e904
3 changed files with 2 additions and 40 deletions
+2 -2
View File
@@ -49,8 +49,8 @@ fn main() {
.unwrap_or("")
{
"asm" => {
let filename = path.file_stem().unwrap().to_str().unwrap();
let mut file = fs::File::create(format!("{}.hack", filename)).unwrap();
let filepath = path.canonicalize().unwrap().to_str().unwrap().replace("asm", "hack");
let mut file = fs::File::create(filepath).unwrap();
let content = fs::read_to_string(&path).expect("You must provide a correct filepath!");
let re = Regex::new(r"\s*\/\/.*").unwrap();
let processed: String = content