From 3979fa1596b659b50fa2786b796c8261485e2ab7 Mon Sep 17 00:00:00 2001 From: Terry Jan Reedy Date: Mon, 14 May 2018 22:39:18 -0400 Subject: [PATCH 1/2] bpo-29706: Test that IDLE colors async/await as keywords. This is verified by eye in the htest. --- Lib/idlelib/colorizer.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Lib/idlelib/colorizer.py b/Lib/idlelib/colorizer.py index 5cb85f24dfd7234..0236468d0e05fa7 100644 --- a/Lib/idlelib/colorizer.py +++ b/Lib/idlelib/colorizer.py @@ -268,13 +268,14 @@ def _color_delegator(parent): # htest # "else: float(None)\n" "if iF + If + IF: 'keyword matching must respect case'\n" "if'': x or'' # valid string-keyword no-space combinations\n" + "async def f(): await g()\n" "# All valid prefixes for unicode and byte strings should be colored.\n" "'x', '''x''', \"x\", \"\"\"x\"\"\"\n" "r'x', u'x', R'x', U'x', f'x', F'x'\n" "fr'x', Fr'x', fR'x', FR'x', rf'x', rF'x', Rf'x', RF'x'\n" "b'x',B'x', br'x',Br'x',bR'x',BR'x', rb'x'.rB'x',Rb'x',RB'x'\n" "# Invalid combinations of legal characters should be half colored.\n" - "ur'x', ru'x', uf'x', fu'x', UR'x', ufr'x', rfu'x', xf'x', fx'x'" + "ur'x', ru'x', uf'x', fu'x', UR'x', ufr'x', rfu'x', xf'x', fx'x'\n" ) text = Text(top, background="white") text.pack(expand=1, fill="both") From 7e19060ffa0ecc68db5034924236fd5e264c3070 Mon Sep 17 00:00:00 2001 From: Terry Jan Reedy Date: Tue, 15 May 2018 03:36:48 -0400 Subject: [PATCH 2/2] Remove some stray leftover comments. --- Lib/idlelib/colorizer.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/Lib/idlelib/colorizer.py b/Lib/idlelib/colorizer.py index 0236468d0e05fa7..1f31ce22d7e510b 100644 --- a/Lib/idlelib/colorizer.py +++ b/Lib/idlelib/colorizer.py @@ -17,8 +17,6 @@ def make_pat(): builtinlist = [str(name) for name in dir(builtins) if not name.startswith('_') and \ name not in keyword.kwlist] - # self.file = open("file") : - # 1st 'file' colorized normal, 2nd as builtin, 3rd as string builtin = r"([^.'\"\\#]\b|^)" + any("BUILTIN", builtinlist) + r"\b" comment = any("COMMENT", [r"#[^\n]*"]) stringprefix = r"(?i:r|u|f|fr|rf|b|br|rb)?"