mirror of
https://github.com/davidhalter/parso.git
synced 2026-10-08 13:05:13 +08:00
Fix fstring issues when error leaves are involved
This commit is contained in:
1 parent
561e81df00
commit
cd9c213a62
3 files changed
+25
-5
No files matched your search
@@ -12,10 +12,9 @@ import logging
|
||||
|
||||
from parso.utils import split_lines
|
||||
from parso.python.parser import Parser
|
||||
from parso.python.tree import EndMarker, PythonErrorLeaf
|
||||
from parso.python.tree import EndMarker
|
||||
from parso.python.tokenize import PythonToken
|
||||
from parso.python.token import PythonTokenTypes
|
||||
from parso.tree import search_ancestor
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
DEBUG_DIFF_PARSER = False
|
||||
@@ -432,9 +431,9 @@ class DiffParser(object):
|
||||
)
|
||||
stack = self._active_parser.stack
|
||||
self._replace_tos_indent = None
|
||||
#print('start', line_offset + 1, indents)
|
||||
# print('start', line_offset + 1, indents)
|
||||
for token in tokens:
|
||||
#print(token, indents)
|
||||
# print(token, indents)
|
||||
typ = token.type
|
||||
if typ == DEDENT:
|
||||
if len(indents) < initial_indentation_count:
|
||||
|
||||
@@ -532,7 +532,7 @@ def tokenize_lines(lines, version_info, start_pos=(1, 0), indents=None, is_first
|
||||
|
||||
if not pseudomatch: # scan for tokens
|
||||
match = whitespace.match(line, pos)
|
||||
if pos == 0 and paren_level == 0:
|
||||
if pos == 0 and paren_level == 0 and not fstring_stack:
|
||||
for t in dedent_if_necessary(match.end()):
|
||||
yield t
|
||||
pos = match.end()
|
||||
|
||||
Reference in new issue
Block a user