Roll src/third_party/skia c6f3e2c:efb7e42
[chromium-blink-merge.git] / third_party / cython / src / Cython / Plex / Errors.py
blob891873b56feba2f951cd3ac0c97488eb7af1725a
1 #=======================================================================
3 # Python Lexical Analyser
5 # Exception classes
7 #=======================================================================
9 class PlexError(Exception):
10 message = ""
12 class PlexTypeError(PlexError, TypeError):
13 pass
15 class PlexValueError(PlexError, ValueError):
16 pass
18 class InvalidRegex(PlexError):
19 pass
21 class InvalidToken(PlexError):
23 def __init__(self, token_number, message):
24 PlexError.__init__(self, "Token number %d: %s" % (token_number, message))
26 class InvalidScanner(PlexError):
27 pass
29 class AmbiguousAction(PlexError):
30 message = "Two tokens with different actions can match the same string"
32 def __init__(self):
33 pass
35 class UnrecognizedInput(PlexError):
36 scanner = None
37 position = None
38 state_name = None
40 def __init__(self, scanner, state_name):
41 self.scanner = scanner
42 self.position = scanner.get_position()
43 self.state_name = state_name
45 def __str__(self):
46 return ("'%s', line %d, char %d: Token not recognised in state %s"
47 % (self.position + (repr(self.state_name),)))