Import vars and funcs from external file

This commit is contained in:
~karx 2021-02-16 19:14:20 +00:00
parent da5958a125
commit 311e4cc1b8
1 changed files with 8 additions and 0 deletions

View File

@ -145,6 +145,14 @@ impl Program {
let contents = fs::read_to_string(filename).expect("Something went wrong reading the file");
let mut prog = Program::from_string(contents);
prog.run();
for (key, value) in prog.vars.iter() {
self.vars.insert(*key, value.to_string());
}
for (key, value) in prog.funcs.iter() {
self.funcs.insert(*key, value.to_string());
}
}
fn parse(&mut self, instruction: &String) {