mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-08 14:54:47 +08:00
Working with dedents in error recovery.
This commit is contained in:
@@ -320,9 +320,16 @@ def generate_tokens(readline, line_offset=0):
|
||||
else: # ordinary string
|
||||
yield Token(STRING, token, spos, prefix)
|
||||
elif initial in namechars: # ordinary name
|
||||
yield Token(NAME, token, spos, prefix)
|
||||
if token in ALWAYS_BREAK_TOKEN:
|
||||
paren_level = 0
|
||||
while True:
|
||||
indent = indents.pop()
|
||||
if indent > start:
|
||||
yield Token(DEDENT, '', (lnum, 0), '')
|
||||
else:
|
||||
indents.append(indent)
|
||||
break
|
||||
yield Token(NAME, token, spos, prefix)
|
||||
elif initial == '\\' and line[start:] == '\\\n': # continued stmt
|
||||
continue
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user