Lichen

pyparser/error.py

932:c07b0dd14f85
6 months ago Paul Boddie Moved integer instantiation support to library functions.
     1      2 class SyntaxError(Exception):     3     """Base class for exceptions raised by the parser."""     4      5     def __init__(self, msg, lineno=0, offset=0, text=None, filename=None,     6                  lastlineno=0):     7         self.msg = msg     8         self.lineno = lineno     9         self.offset = offset    10         self.text = text    11         self.filename = filename    12         self.lastlineno = lastlineno    13     14     def __str__(self):    15         return "%s at pos (%d, %d) in %r" % (self.__class__.__name__,    16                                              self.lineno,    17                                              self.offset,    18                                              self.text)    19     20 class IndentationError(SyntaxError):    21     pass    22     23 class TokenError(SyntaxError):    24     25     def __init__(self, msg, line, lineno, column, tokens, lastlineno=0):    26         SyntaxError.__init__(self, msg, lineno, column, line,    27                              lastlineno=lastlineno)    28         self.tokens = tokens    29     30 class TokenIndentationError(IndentationError):    31     32     def __init__(self, msg, line, lineno, column, tokens):    33         SyntaxError.__init__(self, msg, lineno, column, line)    34         self.tokens = tokens