diff options
Diffstat (limited to 'projects/hackc/utils.py')
-rw-r--r-- | projects/hackc/utils.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/projects/hackc/utils.py b/projects/hackc/utils.py index d1ea3ca..4861088 100644 --- a/projects/hackc/utils.py +++ b/projects/hackc/utils.py @@ -4,6 +4,16 @@ EXIT_CODE_FILE_ERROR = 1 EXIT_CODE_INVALID_TOKEN = 2 EXIT_CODE_SYNTAX_ERROR = 4 +# vim autoindent misbehaves if I type these verbatim in strings +LEFT_BRACE = "{" +RIGHT_BRACE = "}" + +class JackSyntaxError(Exception): + def __init__(self, msg, token): + self.message = msg + self.token = token + super().__init__(msg) + def print_err(msg): print(msg, file=stderr) |