diff options
Diffstat (limited to 'neb/exceptions.py')
| -rw-r--r-- | neb/exceptions.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/neb/exceptions.py b/neb/exceptions.py new file mode 100644 index 0000000..8bbe000 --- /dev/null +++ b/neb/exceptions.py @@ -0,0 +1,13 @@ +class NebPanic(BaseException): + pass + +class InterpretPanic(NebPanic): + def __init__(self, sym, msg, arg=None): + big_message = f"[{sym.line}] '{sym.name}': {msg}" + if arg is not None: + big_message += f" (got {arg})" + super().__init__(big_message) + +class LexError(NebPanic): + def __init__(self, message, line): + super().__init__(f"line {line}: {message}") |
