Implement "marker cleaning"

This commit is contained in:
~karx 2021-02-08 15:45:13 +00:00
parent 0355142103
commit 630e38cfda
1 changed files with 8 additions and 3 deletions

View File

@ -75,7 +75,8 @@ impl Program {
fn add_var(&mut self, arguments: &str) {
let argument_vec: Vec<char> = arguments.chars().collect();
let name = argument_vec[0];
let value: String = argument_vec[1..].into_iter().collect();
let mut value: String = argument_vec[1..].into_iter().collect();
value = self.args_or_funcs(&value);
self.vars.insert(name, value);
}
@ -86,8 +87,6 @@ impl Program {
let body: String = argument_vec[1..].into_iter().collect();
self.funcs.insert(name, body);
println!("{:?}", self.funcs);
}
fn parse_funcs(&mut self, instruction: &String) -> u32 {
@ -114,6 +113,12 @@ impl Program {
let current_char = argument_vec[index];
let str_to_push: String;
if index > 0 {
if argument_vec[index-1] == '*' {
continue;
}
}
if current_char == '*' {
let func_name = argument_vec[index+1];
let body: String;