Import vars and funcs from external file
This commit is contained in:
parent
da5958a125
commit
311e4cc1b8
|
@ -145,6 +145,14 @@ impl Program {
|
||||||
let contents = fs::read_to_string(filename).expect("Something went wrong reading the file");
|
let contents = fs::read_to_string(filename).expect("Something went wrong reading the file");
|
||||||
let mut prog = Program::from_string(contents);
|
let mut prog = Program::from_string(contents);
|
||||||
prog.run();
|
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) {
|
fn parse(&mut self, instruction: &String) {
|
||||||
|
|
Loading…
Reference in New Issue