Added the error line
This commit is contained in:
parent
8d0329ecbb
commit
aa9fdadc1f
|
|
@ -325,6 +325,7 @@ class ContextManager:
|
|||
# self.pile = self.parsed_list.copy()
|
||||
line_number = 1
|
||||
for index, token in enumerate(self.parsed_list):
|
||||
token.line_number = line_number
|
||||
self.pile.append(token)
|
||||
try:
|
||||
if isinstance(token, syntax.Linebreak):
|
||||
|
|
@ -335,7 +336,7 @@ class ContextManager:
|
|||
elif token.counterpart() in self.matched_elements:
|
||||
self.encapsulate(self._get_matched(token.counterpart()), index)
|
||||
elif isinstance(token, syntax.ClosedSemanticType):
|
||||
raise MismatchedContainerError(token, line_number)
|
||||
raise MismatchedContainerError(token)
|
||||
else:
|
||||
self._add_matched(token.label, index)
|
||||
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ from bootstraparse.modules.tools import __GLk # __GFi, __GFu, __GL
|
|||
|
||||
|
||||
# Define the error codes
|
||||
_ERRORS = ["ParsingError"]
|
||||
_ERRORS = ["ParsingError", "MismatchedContainerError"]
|
||||
__all__ = _ERRORS+[]
|
||||
|
||||
|
||||
|
|
@ -143,4 +143,4 @@ class MismatchedContainerError(Exception):
|
|||
def __init__(self, token, line=-1): # TODO: context_manager needs to pass over line for error handling
|
||||
self.token = token
|
||||
self.line = line
|
||||
super().__init__(f"Could not process {token.label} in line {line}.")
|
||||
super().__init__(f"Could not process {token.label} in line {token.line_number}.")
|
||||
|
|
|
|||
Loading…
Reference in New Issue