Skip to content

Commit ff64d8d

Browse files
authored
gh-145239: Colorize case + in the REPL (#150979)
1 parent ce916dc commit ff64d8d

2 files changed

Lines changed: 9 additions & 1 deletion

File tree

Lib/_pyrepl/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ def is_soft_keyword_used(*tokens: TI | None) -> bool:
274274
None | TI(T.NEWLINE) | TI(T.INDENT) | TI(T.DEDENT) | TI(string=":"),
275275
TI(string="case"),
276276
TI(T.NUMBER | T.STRING | T.FSTRING_START | T.TSTRING_START)
277-
| TI(T.OP, string="(" | "*" | "-" | "[" | "{")
277+
| TI(T.OP, string="(" | "*" | "-" | "+" | "[" | "{")
278278
):
279279
return True
280280
case (

Lib/test/test_pyrepl/test_utils.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,14 @@ def test_gen_colors_keyword_highlighting(self):
125125
("import", "keyword"),
126126
],
127127
),
128+
(
129+
"case +1",
130+
[
131+
("case", "soft_keyword"),
132+
("+", "op"),
133+
("1", "number"),
134+
],
135+
),
128136
]
129137
for code, expected_highlights in cases:
130138
with self.subTest(code=code):

0 commit comments

Comments
 (0)