Do the variable stuff. But it's broken

This commit is contained in:
abbie 2022-01-29 11:26:16 +00:00
parent 69986b6801
commit 68cf76ab6d
No known key found for this signature in database
GPG key ID: 04DDE463F9200F87
3 changed files with 17 additions and 3 deletions

2
Cargo.lock generated
View file

@ -120,7 +120,7 @@ dependencies = [
[[package]] [[package]]
name = "lintc" name = "lintc"
version = "0.2.2" version = "0.3.0"
dependencies = [ dependencies = [
"built", "built",
] ]

View file

@ -1,6 +1,6 @@
[package] [package]
name = "lintc" name = "lintc"
version = "0.2.3" version = "0.3.0"
edition = "2021" edition = "2021"
build = "build.rs" build = "build.rs"

View file

@ -98,7 +98,21 @@ fn load_macro(set: String, mac: String, inputs: String, vars: Vec<String>) -> St
if inputs.contains(")/") { if inputs.contains(")/") {
let coolbeans: Vec<&str> = inputs.split(")/").collect(); let coolbeans: Vec<&str> = inputs.split(")/").collect();
println!("{:?}", coolbeans[1]); let mut isin = false;
let mut i: u8 = 0;
for x in vars.to_vec() {
if x == coolbeans[1].to_string() {
isin = true;
}
if isin != true {
i = i + 1;
}
}
if isin != true {
println!("ERROR: Reference to variable {} not assigned.", coolbeans[1]);
process::exit(1);
}
contents = format!("{} .{} STZ", contents, i.to_string());
} }
return contents.to_string(); return contents.to_string();
} }