mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-11 08:11:50 +08:00
flow syntax errors should still make it possible to add them to the parser (otherwise parser doesn't include all the code
This commit is contained in:
@@ -593,8 +593,7 @@ class Parser(object):
|
|||||||
# multiple inputs because of with
|
# multiple inputs because of with
|
||||||
inputs = []
|
inputs = []
|
||||||
first = True
|
first = True
|
||||||
while first or command == 'with' \
|
while first or command == 'with' and tok not in [':', '\n']:
|
||||||
and tok not in [':', '\n']:
|
|
||||||
statement, tok = \
|
statement, tok = \
|
||||||
self._parse_statement(added_breaks=added_breaks)
|
self._parse_statement(added_breaks=added_breaks)
|
||||||
if command == 'except' and tok == ',':
|
if command == 'except' and tok == ',':
|
||||||
@@ -608,7 +607,6 @@ class Parser(object):
|
|||||||
inputs.append(statement)
|
inputs.append(statement)
|
||||||
first = False
|
first = False
|
||||||
|
|
||||||
if tok == ':':
|
|
||||||
f = pr.Flow(self.module, command, inputs, first_pos)
|
f = pr.Flow(self.module, command, inputs, first_pos)
|
||||||
if command in extended_flow:
|
if command in extended_flow:
|
||||||
# the last statement has to be another part of
|
# the last statement has to be another part of
|
||||||
@@ -622,11 +620,8 @@ class Parser(object):
|
|||||||
else:
|
else:
|
||||||
s = self._scope.add_statement(f)
|
s = self._scope.add_statement(f)
|
||||||
self._scope = s
|
self._scope = s
|
||||||
else:
|
if tok != ':':
|
||||||
for i in inputs:
|
debug.warning('syntax err, flow started @%s', self.start_pos[0])
|
||||||
i.parent = use_as_parent_scope
|
|
||||||
debug.warning('syntax err, flow started @%s',
|
|
||||||
self.start_pos[0])
|
|
||||||
# returns
|
# returns
|
||||||
elif tok in ['return', 'yield']:
|
elif tok in ['return', 'yield']:
|
||||||
s = self.start_pos
|
s = self.start_pos
|
||||||
|
|||||||
Reference in New Issue
Block a user