top-level
This commit is contained in:
parent
babda0a037
commit
2fae3929be
1 changed files with 5 additions and 10 deletions
|
|
@ -30,8 +30,12 @@ class _Parser:
|
|||
self._error_highlight_pos = 0
|
||||
self._ast: List[ArgumentType] = []
|
||||
|
||||
with self._error_formatting():
|
||||
try:
|
||||
self._syntax_tree = self._parse()
|
||||
except NonFormattedInvalidSyntaxException as exc:
|
||||
raise ParserExceptionFormatter(
|
||||
self._text, self._error_highlight_pos, self._pos, exc
|
||||
).highlight() from exc
|
||||
|
||||
@property
|
||||
def ast(self) -> SyntaxTree:
|
||||
|
|
@ -42,15 +46,6 @@ class _Parser:
|
|||
"""
|
||||
return self._syntax_tree
|
||||
|
||||
@contextmanager
|
||||
def _error_formatting(self) -> None:
|
||||
try:
|
||||
yield
|
||||
except NonFormattedInvalidSyntaxException as exc:
|
||||
raise ParserExceptionFormatter(
|
||||
self._text, self._error_highlight_pos, self._pos, exc
|
||||
).highlight() from exc
|
||||
|
||||
def _set_highlight_position(self) -> None:
|
||||
self._error_highlight_pos = self._pos
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue