mirror of
https://github.com/davidhalter/parso.git
synced 2025-12-09 06:04:54 +08:00
Use ERROR_DEDENT instead of ERRORTOKEN for wrong dedents.
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user