1
0
forked from VimPlug/jedi

Failed statements should not lead to parser fails.

This commit is contained in:
Dave Halter
2015-02-22 20:29:22 +01:00
parent 3ec96b25cc
commit 3a5b2d396e

View File

@@ -350,7 +350,12 @@ class Parser(object):
while True:
if newline.value == '':
# Must be a DEDENT, just continue.
newline = newline.get_previous()
try:
newline = newline.get_previous()
except IndexError:
# If there's a statement that fails to be parsed, there
# will be no previous leaf. So just ignore it.
break
elif newline.value != '\n':
# This may happen if error correction strikes and removes
# a whole statement including '\n'.