mirror of
https://github.com/davidhalter/jedi.git
synced 2026-05-25 09:48:36 +08:00
We don't need to reset the last failed start_pos anymore, because this is something that was necessary with the fucked up old parser.
This commit is contained in:
+1
-13
@@ -101,7 +101,6 @@ class Parser(object):
|
|||||||
|
|
||||||
self._used_names = {}
|
self._used_names = {}
|
||||||
self._scope_names_stack = [{}]
|
self._scope_names_stack = [{}]
|
||||||
self._last_failed_start_pos = (0, 0)
|
|
||||||
self._global_names = []
|
self._global_names = []
|
||||||
|
|
||||||
self.source = source
|
self.source = source
|
||||||
@@ -266,16 +265,7 @@ class Parser(object):
|
|||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
newline.value = ''
|
newline.value = ''
|
||||||
if self._last_failed_start_pos > newline.start_pos:
|
endmarker.start_pos = newline.start_pos
|
||||||
# It may be the case that there was a syntax error in a
|
|
||||||
# function. In that case error correction removes the
|
|
||||||
# right newline. So we use the previously assigned
|
|
||||||
# _last_failed_start_pos variable to account for that.
|
|
||||||
endmarker.start_pos = self._last_failed_start_pos
|
|
||||||
raise NotImplementedError
|
|
||||||
else:
|
|
||||||
endmarker.start_pos = newline.start_pos
|
|
||||||
break
|
|
||||||
|
|
||||||
|
|
||||||
class ParserWithRecovery(Parser):
|
class ParserWithRecovery(Parser):
|
||||||
@@ -382,8 +372,6 @@ class ParserWithRecovery(Parser):
|
|||||||
if failed_stack:
|
if failed_stack:
|
||||||
stack[start_index - 1][2][1].append(pt.ErrorNode(all_nodes))
|
stack[start_index - 1][2][1].append(pt.ErrorNode(all_nodes))
|
||||||
|
|
||||||
self._last_failed_start_pos = start_pos
|
|
||||||
|
|
||||||
stack[start_index:] = []
|
stack[start_index:] = []
|
||||||
return failed_stack
|
return failed_stack
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user