Implement functions globally
This commit is contained in:
parent
630e38cfda
commit
618a47422e
|
@ -96,10 +96,10 @@ impl Program {
|
||||||
|
|
||||||
// Only a subset of opcodes, because the others don't make sense in a function
|
// Only a subset of opcodes, because the others don't make sense in a function
|
||||||
match opcode {
|
match opcode {
|
||||||
'a' => eval::do_math(self.args_or_vars(arguments), '+'),
|
'a' => eval::do_math(self.args_or_funcs(&self.args_or_vars(arguments)), '+'),
|
||||||
's' => eval::do_math(self.args_or_vars(arguments), '-'),
|
's' => eval::do_math(self.args_or_funcs(&self.args_or_vars(arguments)), '-'),
|
||||||
'm' => eval::do_math(self.args_or_vars(arguments), '*'),
|
'm' => eval::do_math(self.args_or_funcs(&self.args_or_vars(arguments)), '*'),
|
||||||
'd' => eval::do_math(self.args_or_vars(arguments), '/'),
|
'd' => eval::do_math(self.args_or_funcs(&self.args_or_vars(arguments)), '/'),
|
||||||
'l' => {self.add_var(arguments);0}
|
'l' => {self.add_var(arguments);0}
|
||||||
_ => panic!("SyntaxError: No such opcode: {}", self.pc),
|
_ => panic!("SyntaxError: No such opcode: {}", self.pc),
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue