shits gonna break
This commit is contained in:
parent
42bd852117
commit
a529be1e1f
1 changed files with 22 additions and 2 deletions
24
src/main.rs
24
src/main.rs
|
@ -175,8 +175,20 @@ fn load_macro(set: String, mac: String, inputs: String, vars: Vec<String>) -> St
|
||||||
}
|
}
|
||||||
|
|
||||||
if inputs.contains(") begin") {
|
if inputs.contains(") begin") {
|
||||||
|
// I really need to stop calling all my vectors coolbeans.
|
||||||
|
|
||||||
|
// Flowchart of this for me to brain
|
||||||
|
// Place macro <- Apply loop label <- Get loop name
|
||||||
|
// \-> Place cond. jumping -> Set contents to contelt
|
||||||
let coolbeans: Vec<&str> = inputs.split(") begin ").collect();
|
let coolbeans: Vec<&str> = inputs.split(") begin ").collect();
|
||||||
println!("{}", coolbeans.last().unwrap());
|
let loop_name = coolbeans.last().unwrap(); // Get loop name
|
||||||
|
|
||||||
|
let mut loop_contents = format!("@{}&start\n{}", loop_name, contents); // Apply loop label and place macro
|
||||||
|
|
||||||
|
loop_contents = format!("{}\nJCN ,&execy\nJMP ,&end", loop_contents); // Place conditional jumping
|
||||||
|
|
||||||
|
contents = loop_contents.to_string();
|
||||||
|
|
||||||
}
|
}
|
||||||
return contents.to_string();
|
return contents.to_string();
|
||||||
}
|
}
|
||||||
|
@ -251,10 +263,18 @@ fn parse(code: String) -> String {
|
||||||
println!("ERROR: Macro set {} not initalised in code.", tmac[0]);
|
println!("ERROR: Macro set {} not initalised in code.", tmac[0]);
|
||||||
process::exit(1);
|
process::exit(1);
|
||||||
}
|
}
|
||||||
|
} else if line.contains("end!") {
|
||||||
|
blocks[3].push_str(",&end");
|
||||||
|
blocks[3].push_str("BRK");
|
||||||
|
} else if line.contains("rnd!") {
|
||||||
|
blocks[3].push_str(",&end");
|
||||||
|
blocks[3].push_str("BRK");
|
||||||
|
} else if line.contains("break!") {
|
||||||
|
blocks[3].push_str("BRK");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return format!("{}\n{}\n|0000\n{}\n|0100\n{}", blocks[0], blocks[1], blocks[2], blocks[3]).to_string();
|
return format!("( generated by lintc )\n{}\n{}\n|0000\n{}\n|0100\n{}", blocks[0], blocks[1], blocks[2], blocks[3]).to_string();
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
|
|
Reference in a new issue