From 68cf76ab6d72d30dca94e55027f4a56549c29777 Mon Sep 17 00:00:00 2001 From: Celeste Date: Sat, 29 Jan 2022 11:26:16 +0000 Subject: [PATCH] Do the variable stuff. But it's broken --- Cargo.lock | 2 +- Cargo.toml | 2 +- src/main.rs | 16 +++++++++++++++- 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 7ef93b6..dbaef0f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -120,7 +120,7 @@ dependencies = [ [[package]] name = "lintc" -version = "0.2.2" +version = "0.3.0" dependencies = [ "built", ] diff --git a/Cargo.toml b/Cargo.toml index d991ce3..6b329d7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "lintc" -version = "0.2.3" +version = "0.3.0" edition = "2021" build = "build.rs" diff --git a/src/main.rs b/src/main.rs index 2760ebb..8d93b5b 100644 --- a/src/main.rs +++ b/src/main.rs @@ -98,7 +98,21 @@ fn load_macro(set: String, mac: String, inputs: String, vars: Vec) -> St if inputs.contains(")/") { 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(); }