mirror of
https://github.com/davidhalter/parso.git
synced 2026-02-27 12:02:36 +08:00
Initialize start pos properly in diff parser
This commit is contained in:
@@ -405,13 +405,11 @@ class DiffParser(object):
|
|||||||
|
|
||||||
tokens = self._tokenizer(
|
tokens = self._tokenizer(
|
||||||
lines,
|
lines,
|
||||||
start_pos=(1, 0),
|
start_pos=(line_offset + 1, 0),
|
||||||
indents=indents
|
indents=indents
|
||||||
)
|
)
|
||||||
stack = self._active_parser.stack
|
stack = self._active_parser.stack
|
||||||
for typ, string, start_pos, prefix in tokens:
|
for typ, string, start_pos, prefix in tokens:
|
||||||
start_pos = start_pos[0] + line_offset, start_pos[1]
|
|
||||||
|
|
||||||
if typ == PythonTokenTypes.DEDENT:
|
if typ == PythonTokenTypes.DEDENT:
|
||||||
if len(indents) < initial_indentation_count:
|
if len(indents) < initial_indentation_count:
|
||||||
# We are done here, only thing that can come now is an
|
# We are done here, only thing that can come now is an
|
||||||
@@ -429,7 +427,7 @@ class DiffParser(object):
|
|||||||
prefix = ''
|
prefix = ''
|
||||||
yield PythonToken(
|
yield PythonToken(
|
||||||
PythonTokenTypes.ENDMARKER, '',
|
PythonTokenTypes.ENDMARKER, '',
|
||||||
(start_pos[0] + line_offset, 0),
|
start_pos,
|
||||||
prefix
|
prefix
|
||||||
)
|
)
|
||||||
break
|
break
|
||||||
|
|||||||
Reference in New Issue
Block a user