···
let mut matched: bool = false;
53
+
let mut prefix_len = 1;
54
+
let mut symbol = file.tokens[file.working_index].contents.clone();
55
+
symbol = symbol.trim().to_string();
54
-
for m in &MACRO_LIST {
55
-
let symbol = file.tokens[file.working_index].contents.trim();
57
+
if symbol.len() > 2 {
58
+
let mut ephemeral = false;
59
+
let same_file = file.tokens[file.working_index].origin_file != file.filename_input;
61
+
//if file.tokens[file.working_index].contents.starts_with("!&")
62
+
if symbol.starts_with("!&")
65
+
ephemeral = !same_file;
67
+
//else if file.tokens[file.working_index].contents.starts_with("&")
68
+
else if symbol.starts_with("&")
70
+
ephemeral = same_file;
60
-
if &symbol[1..] == m.symbol {
62
-
println!("Found a macro ({})", m.symbol);
63
-
let mut ephemeral = false;
64
-
if file.tokens[file.working_index].contents.starts_with('&')
65
-
&& file.tokens[file.working_index].origin_file != file.filename_input
67
-
println!("Skipping Ephermal macro from included file.");
73
+
// Check if its a macro
74
+
for m in &MACRO_LIST {
75
+
if &symbol[prefix_len..] == m.symbol {
77
+
println!("Found a macro ({})", m.symbol);
71
-
let (args, tokcount) = collect_arguments(&file.tokens[file.working_index..]);
72
-
let expansion: Vec<Token>;
74
-
expansion = Vec::new();
76
-
expansion = (m.expand)(file, &args);
79
+
let (args, tokcount) =
80
+
collect_arguments(&file.tokens[file.working_index..]);
81
+
let expansion: Vec<Token>;
83
+
expansion = Vec::new();
85
+
expansion = (m.expand)(file, &args);
87
+
file.tokens.remove(file.working_index);
89
+
file.working_index..(file.working_index + tokcount - 1),
78
-
file.tokens.remove(file.working_index);
80
-
file.working_index..(file.working_index + tokcount - 1),
94
+
// Check if its a block
95
+
// for b in &BLOCK_LIST {}}
86
-
// for b in &BLOCK_LIST {}
"Token written as a function but no such function exists \"{}\"",