From f6a71e8946fae9c67857f3dd4c38a9d10bcb5965 Mon Sep 17 00:00:00 2001 From: Stefan Behnel Date: Thu, 21 Apr 2011 20:58:17 +0200 Subject: [PATCH] fix scanner level error reporting in Plex/Errors.py --- Cython/Plex/Errors.py | 2 +- Cython/Plex/Scanners.py | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) 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 = ( -- 2.26.2