Add support in IDLE colorizer

This commit is contained in:
Stan Ulbrych 2025-12-06 16:06:52 +00:00
parent e6633ffeb8
commit 2f642c89be
No known key found for this signature in database
GPG key ID: B8E58DBDB2A1A0B8
2 changed files with 23 additions and 1 deletions

View file

@ -42,6 +42,11 @@ def make_pat():
]) +
r"))"
)
lazy_softkw = (
r"^[ \t]*" + # at beginning of line + possible indentation
r"(?P<LAZY_SOFTKW>lazy)" +
r"(?=[ \t]+(?:import|from)\b)" # followed by 'import' or 'from'
)
builtinlist = [str(name) for name in dir(builtins)
if not name.startswith('_') and
name not in keyword.kwlist]
@ -56,7 +61,7 @@ def make_pat():
prog = re.compile("|".join([
builtin, comment, string, kw,
match_softkw, case_default,
case_softkw_and_pattern,
case_softkw_and_pattern, lazy_softkw,
any("SYNC", [r"\n"]),
]),
re.DOTALL | re.MULTILINE)
@ -70,6 +75,7 @@ def make_pat():
"CASE_SOFTKW": "KEYWORD",
"CASE_DEFAULT_UNDERSCORE": "KEYWORD",
"CASE_SOFTKW2": "KEYWORD",
"LAZY_SOFTKW": "KEYWORD",
}