mirror of
https://github.com/davidhalter/parso.git
synced 2026-01-19 09:33:06 +08:00
Error recovery should not match the whole line in case of an invalid token, fixes #40
This commit is contained in:
@@ -448,16 +448,15 @@ def tokenize_lines(lines, version_info, start_pos=(1, 0)):
|
||||
|
||||
pseudomatch = pseudo_token.match(line, pos)
|
||||
if not pseudomatch: # scan for tokens
|
||||
if line.endswith('\n'):
|
||||
new_line = True
|
||||
match = whitespace.match(line, pos)
|
||||
pos = match.end()
|
||||
yield PythonToken(
|
||||
ERRORTOKEN, line[pos:], (lnum, pos),
|
||||
ERRORTOKEN, line[pos], (lnum, pos),
|
||||
additional_prefix + match.group(0)
|
||||
)
|
||||
additional_prefix = ''
|
||||
break
|
||||
pos += 1
|
||||
continue
|
||||
|
||||
prefix = additional_prefix + pseudomatch.group(1)
|
||||
additional_prefix = ''
|
||||
|
||||
Reference in New Issue
Block a user