Apply \r changes in syntax trees

This commit is contained in:
Dave Halter
2019-01-08 20:45:58 +01:00
parent fbaad7883f
commit 574e1c63e8
5 changed files with 16 additions and 8 deletions

View File

@@ -127,8 +127,9 @@ class Parser(BaseParser):
last_leaf = None
if self._start_nonterminal == 'file_input' and \
(token.type == PythonTokenTypes.ENDMARKER or
token.type == DEDENT and '\n' not in last_leaf.value):
(token.type == PythonTokenTypes.ENDMARKER
or token.type == DEDENT and '\n' not in last_leaf.value
and '\r' not in last_leaf.value):
# In Python statements need to end with a newline. But since it's
# possible (and valid in Python ) that there's no newline at the
# end of a file, we have to recover even if the user doesn't want