Skip to content

Commit c782fe4

Browse files
committed
fix(idlelib): fix highlighted error of module idlelib
1 parent 046a4e3 commit c782fe4

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

Lib/idlelib/colorizer.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ def make_pat():
6464

6565

6666
prog = make_pat()
67-
idprog = re.compile(r"\s+(\w+)")
67+
idprog = re.compile(r"\s+([^\\\s([:]+)")
6868
prog_group_name_to_tag = {
6969
"MATCH_SOFTKW": "KEYWORD",
7070
"CASE_SOFTKW": "KEYWORD",
@@ -346,8 +346,9 @@ def _add_tags_in_section(self, chars, head):
346346
self._add_tag(a, b, head, name)
347347
if matched_text in ("def", "class"):
348348
if m1 := self.idprog.match(chars, b):
349-
a, b = m1.span(1)
350-
self._add_tag(a, b, head, "DEFINITION")
349+
if m1.groups()[0].isidentifier():
350+
a, b = m1.span(1)
351+
self._add_tag(a, b, head, "DEFINITION")
351352

352353
def removecolors(self):
353354
"Remove all colorizing tags."

0 commit comments

Comments
 (0)