add jumping to a usize

This commit is contained in:
abbie 2024-08-14 12:46:48 +01:00
parent e258f6208d
commit d6a10ea2cc
Signed by: threeoh6000
GPG key ID: 801FE4AD456E922C
2 changed files with 7 additions and 3 deletions

View file

@ -1,6 +1,6 @@
[package]
name = "granite"
version = "1.1.0"
version = "1.2.0"
edition = "2021"
[dependencies]

View file

@ -183,9 +183,13 @@ fn execute(program: Program) {
let label_loc = labels.get(&statement.arguments[0]).unwrap();
current_statement = label_loc.clone();
} else {
let binding = statement.arguments[0].clone().parse::<usize>();
if binding.is_ok() { current_statement = binding.unwrap(); }
else {
println!("Numerical type issues.");
exit(1);
}
}
} else if statement.operator == "a" {
if vars.contains_key(&statement.arguments[0]) && vars.contains_key(&statement.arguments[1]) {
let value = vars.get(&statement.arguments[0]).unwrap();