diff --git a/core/datatypes.py b/core/datatypes.py index b323990..e2376df 100755 --- a/core/datatypes.py +++ b/core/datatypes.py @@ -196,8 +196,7 @@ def idived_by(self, other: Value) -> ResultTuple: if isinstance(other, Number): if other.value == 0: return None, RTError(other.pos_start, other.pos_end, "Division by zero", self.context) - - return Number(self.value // other.value).set_context(self.context), None + return Number(int(self.value // other.value)).set_context(self.context), None else: return None, Value.illegal_operation(self, other) diff --git a/core/parser.py b/core/parser.py index a9b5b69..7d7cf32 100755 --- a/core/parser.py +++ b/core/parser.py @@ -478,7 +478,7 @@ def arith_expr(self) -> ParseResult[Node]: return self.bin_op(self.term, (TT_PLUS, TT_MINUS)) def term(self) -> ParseResult[Node]: - return self.bin_op(self.factor, (TT_MUL, TT_DIV, TT_MOD)) + return self.bin_op(self.factor, (TT_MUL, TT_DIV, TT_MOD, TT_IDIV)) def factor(self) -> ParseResult[Node]: res = ParseResult[Node]() diff --git a/tests/incdec.rn.json b/tests/incdec.rn.json index a61a1e2..eaa8b91 100644 --- a/tests/incdec.rn.json +++ b/tests/incdec.rn.json @@ -1 +1 @@ -{"code": 0, "stdout": "69\n70\n69\n69\n70\n71\n72\n71\n70\n----------------\n69 69\n69 70\n----------------\n69\n74\n69\n345\n69.0\n1564031349.0\n312806269.0\n4.0\n", "stderr": ""} \ No newline at end of file +{"code": 0, "stdout": "69\n70\n69\n69\n70\n71\n72\n71\n70\n----------------\n69 69\n69 70\n----------------\n69\n74\n69\n345\n69.0\n1564031349.0\n312806269\n4\n", "stderr": ""} \ No newline at end of file