Lichen

pyparser/error.py

583:aed28d04304d
2017-02-13 Paul Boddie Re-added size information to string instances as the __size__ attribute. This fixes problems introduced when using strlen on data likely to contain embedded nulls, which was the reason for having size information explicitly stored in the first place. attr-strvalue-without-size
     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