Ejemplo n.º 1
0
 def mod_by(self, other):
     if isinstance(other, Value):
         if other.value == 0:
             return None, RunTimeError(other.start_pos, other.end_pos,
                                       "Modulo by zero", self.context)
         return Value(self.value % other.value).set_context(
             self.context), None
     return None, RunTimeError(other.start_pos, other.end_pos,
                               "Requires 'Value' type", self.context)
Ejemplo n.º 2
0
 def not_eq_to(self, other):
     if isinstance(other, Value):
         return Value(self.value != other.value).set_context(
             self.context), None
     return None, RunTimeError(other.start_pos, other.end_pos,
                               "Requires 'Value' type", self.context)
Ejemplo n.º 3
0
 def negate(self):
     if isinstance(self, Value):
         return Value(not self.value).set_context(self.context), None
     return None, RunTimeError(other.start_pos, other.end_pos,
                               "Requires 'Value' type", self.context)