Skip to content
Merged
2 changes: 1 addition & 1 deletion Lib/idlelib/colorizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def make_pat():
name not in keyword.kwlist]
builtin = r"([^.'\"\\#]\b|^)" + any("BUILTIN", builtinlist) + r"\b"
comment = any("COMMENT", [r"#[^\n]*"])
stringprefix = r"(?i:r|u|f|fr|rf|b|br|rb)?"
stringprefix = r"(?i:r|u|f|t|fr|rf|b|br|rb|rt|tr)?"
sqstring = stringprefix + r"'[^'\\\n]*(\\.[^'\\\n]*)*'?"
dqstring = stringprefix + r'"[^"\\\n]*(\\.[^"\\\n]*)*"?'
sq3string = stringprefix + r"'''[^'\\]*((\\.|'(?!''))[^'\\]*)*(''')?"
Expand Down
1 change: 1 addition & 0 deletions Lib/idlelib/idle_test/test_colorizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ async def f(): await g()
# All valid prefixes for unicode and byte strings should be colored.
r'x', u'x', R'x', U'x', f'x', F'x'
fr'x', Fr'x', fR'x', FR'x', rf'x', rF'x', Rf'x', RF'x'
tr'x', Tr'x', tR'x', TR'x', rt'x', rT'x', Rt'x', RT'x'
b'x',B'x', br'x',Br'x',bR'x',BR'x', rb'x', rB'x',Rb'x',RB'x'
# Invalid combinations of legal characters should be half colored.
ur'x', ru'x', uf'x', fu'x', UR'x', ufr'x', rfu'x', xf'x', fx'x'
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Colorize t-string prefixes for template strings in IDLE, as done for f-string prefixes.
Loading