mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
PY-31442 Better handling of single backslashes (e.g. before braces) in literal parts
There is actually no need to match them together with braces and then return the second character back to the stream. The longest match rule will ensure that all allowed escape sequences will be recognised as one unit, so it seems safe to match backslash individually for all remaining cases.
This commit is contained in:
@@ -5,7 +5,7 @@ PyFile:UnterminatedFStringWithTrailingBackslashInFormatPart.py
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(Py:EQ)('=')
|
||||
PsiWhiteSpace(' ')
|
||||
PyStringLiteralExpression: {42:
|
||||
PyStringLiteralExpression: {42:\
|
||||
PyFormattedStringNode
|
||||
PsiElement(Py:FSTRING_START)('f'')
|
||||
PyFStringFragment
|
||||
@@ -14,8 +14,8 @@ PyFile:UnterminatedFStringWithTrailingBackslashInFormatPart.py
|
||||
PsiElement(Py:INTEGER_LITERAL)('42')
|
||||
PyFStringFragmentFormatPart
|
||||
PsiElement(Py:FSTRING_FRAGMENT_FORMAT_START)(':')
|
||||
PsiElement(Py:FSTRING_TEXT)('\')
|
||||
PsiErrorElement:} expected
|
||||
<empty list>
|
||||
PsiElement(BAD_CHARACTER)('\')
|
||||
PsiErrorElement:Statement expected, found BAD_CHARACTER
|
||||
<empty list>
|
||||
PsiErrorElement:' expected
|
||||
<empty list>
|
||||
@@ -5,11 +5,9 @@ PyFile:UnterminatedFStringWithTrailingBackslashInLiteralPart.py
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(Py:EQ)('=')
|
||||
PsiWhiteSpace(' ')
|
||||
PyStringLiteralExpression:
|
||||
PyStringLiteralExpression: \
|
||||
PyFormattedStringNode
|
||||
PsiElement(Py:FSTRING_START)('f'')
|
||||
PsiErrorElement:unexpected f-string token
|
||||
<empty list>
|
||||
PsiElement(BAD_CHARACTER)('\')
|
||||
PsiErrorElement:Statement expected, found BAD_CHARACTER
|
||||
<empty list>
|
||||
PsiElement(Py:FSTRING_TEXT)('\')
|
||||
PsiErrorElement:' expected
|
||||
<empty list>
|
||||
Reference in New Issue
Block a user