add jumping to a usize
This commit is contained in:
parent
e258f6208d
commit
d6a10ea2cc
2 changed files with 7 additions and 3 deletions
|
@ -1,6 +1,6 @@
|
||||||
[package]
|
[package]
|
||||||
name = "granite"
|
name = "granite"
|
||||||
version = "1.1.0"
|
version = "1.2.0"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
|
|
|
@ -183,8 +183,12 @@ fn execute(program: Program) {
|
||||||
let label_loc = labels.get(&statement.arguments[0]).unwrap();
|
let label_loc = labels.get(&statement.arguments[0]).unwrap();
|
||||||
current_statement = label_loc.clone();
|
current_statement = label_loc.clone();
|
||||||
} else {
|
} else {
|
||||||
println!("Numerical type issues.");
|
let binding = statement.arguments[0].clone().parse::<usize>();
|
||||||
exit(1);
|
if binding.is_ok() { current_statement = binding.unwrap(); }
|
||||||
|
else {
|
||||||
|
println!("Numerical type issues.");
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else if statement.operator == "a" {
|
} else if statement.operator == "a" {
|
||||||
if vars.contains_key(&statement.arguments[0]) && vars.contains_key(&statement.arguments[1]) {
|
if vars.contains_key(&statement.arguments[0]) && vars.contains_key(&statement.arguments[1]) {
|
||||||
|
|
Loading…
Reference in a new issue