1
0
infernal-interpreter/infernal_interpreter/Junk.py

34 lines
651 B
Python

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