File size: 562 Bytes
3f6412b e6b283b 3f6412b e6b283b 3f6412b e6b283b 26393ae e6b283b 26393ae 3f6412b e6b283b 3f6412b e6b283b 26393ae e6b283b 3f6412b | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
# AUTO: Defines class `LexicalError`.
class LexicalError:
# AUTO: Defines function `__init__`.
def __init__(self, pos, details):
# AUTO: Sets `self.pos`.
self.pos = pos
# AUTO: Sets `self.details`.
self.details = details
# AUTO: Defines function `as_string`.
def as_string(self):
# AUTO: Sets `self.details`.
self.details = self.details.replace('\n', '\\n')
# AUTO: Returns this result to the caller.
return f"LEXICAL error line {self.pos.ln} col {self.pos.col} {self.details}"
|