blob: 4861088bfbd7e719e57ad928f222effdff0b2d26 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
from sys import stderr
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)
|