Commit 04de62ab authored by Stefan Behnel's avatar Stefan Behnel

fix scanner level error reporting in Plex/Errors.py

parent c01af3c9
...@@ -39,7 +39,7 @@ class UnrecognizedInput(PlexError): ...@@ -39,7 +39,7 @@ class UnrecognizedInput(PlexError):
def __init__(self, scanner, state_name): def __init__(self, scanner, state_name):
self.scanner = scanner self.scanner = scanner
self.position = scanner.position() self.position = scanner.get_position()
self.state_name = state_name self.state_name = state_name
def __str__(self): def __str__(self):
......
...@@ -299,6 +299,11 @@ class Scanner(object): ...@@ -299,6 +299,11 @@ class Scanner(object):
""" """
return (self.name, self.start_line, self.start_col) 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): def begin(self, state_name):
"""Set the current state of the scanner to the named state.""" """Set the current state of the scanner to the named state."""
self.initial_state = ( self.initial_state = (
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment