mirror of
https://github.com/davidhalter/parso.git
synced 2025-12-09 06:04:54 +08:00
Simplify the regexes
This commit is contained in:
@@ -388,8 +388,10 @@ class DiffParser(object):
|
||||
# endmarker or another dedented code block.
|
||||
typ, string, start_pos, prefix = next(tokens)
|
||||
if '\n' in prefix or '\r' in prefix:
|
||||
prefix = re.sub(r'(?<=\n|\r)[^\n\r]+$', '', prefix)
|
||||
prefix = re.sub(r'[^\n\r]+\Z', '', prefix)
|
||||
else:
|
||||
# This is basically the next line and it still needs to
|
||||
# be parserd.
|
||||
prefix = ''
|
||||
yield PythonToken(
|
||||
PythonTokenTypes.ENDMARKER, '',
|
||||
|
||||
Reference in New Issue
Block a user