Simplify the regexes

This commit is contained in:
Dave Halter
2019-01-10 01:21:56 +01:00
parent 610a820799
commit 94c2681c8e
2 changed files with 8 additions and 1 deletions

View File

@@ -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, '',