Use ERROR_DEDENT instead of ERRORTOKEN for wrong dedents.

This commit is contained in:
Dave Halter
2017-07-19 20:13:51 +02:00
parent 569cb99ca7
commit 6876e1b7c0
9 changed files with 20 additions and 31 deletions

View File

@@ -13,8 +13,8 @@ import logging
from parso.utils import splitlines
from parso.python.parser import Parser
from parso.python.tree import EndMarker
from parso.python.tokenize import (NEWLINE, TokenInfo,
ENDMARKER, INDENT, DEDENT, ERRORTOKEN)
from parso.python.tokenize import (NEWLINE, TokenInfo, ERROR_DEDENT,
ENDMARKER, INDENT, DEDENT)
def _get_last_line(node_or_leaf):
@@ -305,8 +305,7 @@ class DiffParser(object):
# In case of omitted_first_indent, it might not be dedented fully.
# However this is a sign for us that a dedent happened.
if typ == DEDENT \
or typ == ERRORTOKEN and not string \
and omitted_first_indent and len(indents) == 1:
or typ == ERROR_DEDENT and omitted_first_indent and len(indents) == 1:
indents.pop()
if omitted_first_indent and not indents:
# We are done here, only thing that can come now is an