diff --git a/interp.py b/interp.py index aeab99e..d3ad996 100644 --- a/interp.py +++ b/interp.py @@ -14,12 +14,23 @@ return self._value def verb_Append(self, args): + args_count = len(args) + if args_count != 1: + raise InterpreterError("Invalid argument count %i, expected 1" % (args_count)) appendix = args[0] + if appendix.__class__ != Text: + raise InterpreterError("Invalid argument type %s, expected Text" % (appendix.__class__.__name__)) return Text(self.value() + " " + appendix.value()) class Module_System: def verb_Print(self, args): - print(args[0].value()) + args_count = len(args) + if args_count != 1: + raise InterpreterError("Invalid argument count %i, expected 1" % (args_count)) + line = args[0] + if line.__class__ != Text: + raise InterpreterError("Invalid argument type %s, expected Text" % (line.__class__.__name__)) + print(line.value()) def verb_Read(self, args): return Text(input())