From: Stefan Behnel Date: Thu, 21 Apr 2011 18:58:17 +0000 (+0200) Subject: fix scanner level error reporting in Plex/Errors.py X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=04de62ab74186d2e972fa0ae6814de2eb47f5731;p=cython.git fix scanner level error reporting in Plex/Errors.py --- diff --git a/Cython/Plex/Errors.py b/Cython/Plex/Errors.py index 965e8d35..891873b5 100644 --- a/Cython/Plex/Errors.py +++ b/Cython/Plex/Errors.py @@ -39,7 +39,7 @@ class UnrecognizedInput(PlexError): def __init__(self, scanner, state_name): self.scanner = scanner - self.position = scanner.position() + self.position = scanner.get_position() self.state_name = state_name def __str__(self): diff --git a/Cython/Plex/Scanners.py b/Cython/Plex/Scanners.py index 36ed9d19..315742f3 100644 --- a/Cython/Plex/Scanners.py +++ b/Cython/Plex/Scanners.py @@ -299,6 +299,11 @@ class Scanner(object): """ return (self.name, self.start_line, self.start_col) + def get_position(self): + """Python accessible wrapper around position(), only for error reporting. + """ + return self.position() + def begin(self, state_name): """Set the current state of the scanner to the named state.""" self.initial_state = (