From 417db4e83ff20fcc71ffe93f0b63756041f44253 Mon Sep 17 00:00:00 2001 From: Dave Halter Date: Sat, 29 Nov 2014 13:30:21 +0100 Subject: [PATCH] suites without indent can also be deleted. --- jedi/parser/__init__.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/jedi/parser/__init__.py b/jedi/parser/__init__.py index 1b226a0b..836dcb8f 100644 --- a/jedi/parser/__init__.py +++ b/jedi/parser/__init__.py @@ -213,7 +213,10 @@ class Parser(object): for index, (dfa, state, (typ, nodes)) in reversed(list(enumerate(stack))): # `suite` can sometimes be only simple_stmt, not stmt. symbol = grammar.number2symbol[typ] - if symbol in ('file_input', 'suite'): + if symbol == 'file_input': + break + elif symbol == 'suite' and len(nodes) > 1: + # suites without an indent in them get discarded. break return index, symbol, nodes