mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-10 18:09:38 +07:00
PY-79967 Support t-prefixed strings, Related PR: https://github.com/JetBrains/intellij-community/pull/302
* Add PYTHON314_PREFIXES to CompatibilityVisitor * Patch typeshed, add t-string related stubs * Infer `string.templatelib.Template` type for t-strings instead of plain `str` GitOrigin-RevId: 0e913910ab9e0dca4052856b0585ce66265291c0
This commit is contained in:
committed by
intellij-monorepo-bot
parent
a1846f3078
commit
7239d2ef2c
File diff suppressed because it is too large
Load Diff
@@ -85,7 +85,7 @@ ONE_TWO_APOS = ('[^\\']) | ('\\[^]) | (''[^\\']) | (''\\[^])
|
||||
APOS_STRING_CHAR = [^\\'] | {ANY_ESCAPE_SEQUENCE} | {ONE_TWO_APOS}
|
||||
TRIPLE_APOS_LITERAL = {THREE_APOS} {APOS_STRING_CHAR}* {THREE_APOS}?
|
||||
|
||||
FSTRING_PREFIX = [UuBbCcRr]{0,3}[fF][UuBbCcRr]{0,3}
|
||||
FSTRING_PREFIX = [UuBbCcRr]{0,3}[fFtT][UuBbCcRr]{0,3}
|
||||
FSTRING_START = {FSTRING_PREFIX} (\"\"\"|'''|\"|')
|
||||
FSTRING_QUOTES = (\"{1,3}|'{1,3})
|
||||
FSTRING_ESCAPED_LBRACE = "{{"
|
||||
|
||||
@@ -109,7 +109,7 @@ public class ExpressionParsing extends Parsing {
|
||||
if (atToken(PyTokenTypes.FSTRING_START)) {
|
||||
final String prefixThenQuotes = builder.getTokenText();
|
||||
assert prefixThenQuotes != null;
|
||||
final String openingQuotes = prefixThenQuotes.replaceFirst("^[UuBbCcRrFf]*", "");
|
||||
final String openingQuotes = prefixThenQuotes.replaceFirst("^[UuBbCcRrFfTt]*", "");
|
||||
final SyntaxTreeBuilder.Marker marker = builder.mark();
|
||||
nextToken();
|
||||
while (true) {
|
||||
|
||||
@@ -11,7 +11,7 @@ public class PyStringLiteralCoreUtil {
|
||||
/**
|
||||
* Valid string prefix characters (lowercased) as defined in Python lexer.
|
||||
*/
|
||||
public static final String PREFIX_CHARACTERS = "ubcrf";
|
||||
public static final String PREFIX_CHARACTERS = "ubcrft";
|
||||
|
||||
/**
|
||||
* Maximum length of a string prefix as defined in Python lexer.
|
||||
|
||||
@@ -99,7 +99,7 @@ public final class PyStringLiteralUtil extends PyStringLiteralCoreUtil {
|
||||
* @return whether the given prefix contains either 'f' or 'F' character
|
||||
*/
|
||||
public static boolean isFormattedPrefix(@NotNull String prefix) {
|
||||
return StringUtil.indexOfIgnoreCase(prefix, 'f', 0) >= 0;
|
||||
return StringUtil.indexOfIgnoreCase(prefix, 'f', 0) >= 0 | StringUtil.indexOfIgnoreCase(prefix, 't', 0) >= 0;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user