Implement "marker cleaning"
This commit is contained in:
parent
0355142103
commit
630e38cfda
11
src/main.rs
11
src/main.rs
|
@ -75,7 +75,8 @@ impl Program {
|
||||||
fn add_var(&mut self, arguments: &str) {
|
fn add_var(&mut self, arguments: &str) {
|
||||||
let argument_vec: Vec<char> = arguments.chars().collect();
|
let argument_vec: Vec<char> = arguments.chars().collect();
|
||||||
let name = argument_vec[0];
|
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);
|
self.vars.insert(name, value);
|
||||||
}
|
}
|
||||||
|
@ -86,8 +87,6 @@ impl Program {
|
||||||
let body: String = argument_vec[1..].into_iter().collect();
|
let body: String = argument_vec[1..].into_iter().collect();
|
||||||
|
|
||||||
self.funcs.insert(name, body);
|
self.funcs.insert(name, body);
|
||||||
|
|
||||||
println!("{:?}", self.funcs);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn parse_funcs(&mut self, instruction: &String) -> u32 {
|
fn parse_funcs(&mut self, instruction: &String) -> u32 {
|
||||||
|
@ -114,6 +113,12 @@ impl Program {
|
||||||
let current_char = argument_vec[index];
|
let current_char = argument_vec[index];
|
||||||
let str_to_push: String;
|
let str_to_push: String;
|
||||||
|
|
||||||
|
if index > 0 {
|
||||||
|
if argument_vec[index-1] == '*' {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if current_char == '*' {
|
if current_char == '*' {
|
||||||
let func_name = argument_vec[index+1];
|
let func_name = argument_vec[index+1];
|
||||||
let body: String;
|
let body: String;
|
||||||
|
|
Loading…
Reference in New Issue