1
0
infernal-interpreter/infernal_interpreter/Junk.py

34 lines
651 B
Python
Raw Normal View History

import dataclasses
class JunkComparisonException(BaseException):
2018-02-06 19:20:09 +00:00
def __str__ (self):
return "Attempting to perform calculations involving junk values."
@dataclasses.dataclass
class Junk:
represents: str | None = None
2018-02-06 19:56:33 +00:00
def __str__ (self):
return '[{}]'.format(self.represents or 'junk')
2018-02-06 19:56:33 +00:00
def __repr__ (self):
return self.__str__()
def __format__ (self, format):
return self.__str__()
2018-02-06 19:56:33 +00:00
def __add__ (self, other):
return self
2018-02-06 19:56:33 +00:00
def __radd__ (self, other):
return self
2018-02-06 19:56:33 +00:00
def __sub__ (self, other):
return self
2018-02-06 19:56:33 +00:00
def __rsub__ (self, other):
return self
2018-02-06 19:20:09 +00:00