-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patherrors.py
36 lines (28 loc) · 842 Bytes
/
errors.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
class ParserGeneratorError(Exception):
pass
class LexingError(Exception):
"""
Raised by a Lexer, if no rule matches.
"""
def __init__(self, message, source_pos):
self.message = message
self.source_pos = source_pos
def getsourcepos(self):
"""
Returns the position in the source, at which this error occurred.
"""
return self.source_pos
class ParsingError(Exception):
"""
Raised by a Parser, if no production rule can be applied.
"""
def __init__(self, message, source_pos):
self.message = message
self.source_pos = source_pos
def getsourcepos(self):
"""
Returns the position in the source, at which this error occurred.
"""
return self.source_pos
class ParserGeneratorWarning(Warning):
pass