]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Issue #14958: Change IDLE systax highlighting to recognize all string and
authorNed Deily <nad@acm.org>
Wed, 30 May 2012 05:55:43 +0000 (22:55 -0700)
committerNed Deily <nad@acm.org>
Wed, 30 May 2012 05:55:43 +0000 (22:55 -0700)
byte literals supported in Python 3.3.

Lib/idlelib/ColorDelegator.py
Misc/NEWS

index 339ac5e3372acdf2dc6c6fb4f4b20c6a2ade0fdf..e4ccb4258c624592514f532e4a2556310576a5f6 100644 (file)
@@ -21,10 +21,11 @@ def make_pat():
     # 1st 'file' colorized normal, 2nd as builtin, 3rd as string
     builtin = r"([^.'\"\\#]\b|^)" + any("BUILTIN", builtinlist) + r"\b"
     comment = any("COMMENT", [r"#[^\n]*"])
-    sqstring = r"(\b[rRbB])?'[^'\\\n]*(\\.[^'\\\n]*)*'?"
-    dqstring = r'(\b[rRbB])?"[^"\\\n]*(\\.[^"\\\n]*)*"?'
-    sq3string = r"(\b[rRbB])?'''[^'\\]*((\\.|'(?!''))[^'\\]*)*(''')?"
-    dq3string = r'(\b[rRbB])?"""[^"\\]*((\\.|"(?!""))[^"\\]*)*(""")?'
+    stringprefix = r"(\br|u|ur|R|U|UR|Ur|uR|b|B|br|Br|bR|BR|rb|rB|Rb|RB)?"
+    sqstring = stringprefix + r"'[^'\\\n]*(\\.[^'\\\n]*)*'?"
+    dqstring = stringprefix + r'"[^"\\\n]*(\\.[^"\\\n]*)*"?'
+    sq3string = stringprefix + r"'''[^'\\]*((\\.|'(?!''))[^'\\]*)*(''')?"
+    dq3string = stringprefix + r'"""[^"\\]*((\\.|"(?!""))[^"\\]*)*(""")?'
     string = any("STRING", [sq3string, dq3string, sqstring, dqstring])
     return kw + "|" + builtin + "|" + comment + "|" + string +\
            "|" + any("SYNC", [r"\n"])
index 73e9dc5ac2ec2977e67c82cea2978a1931294d28..6341af513f50e36b15cf90293f07976e5088a277 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -60,6 +60,9 @@ Core and Builtins
 Library
 -------
 
+- Issue #14958: Change IDLE systax highlighting to recognize all string and
+  byte literals supported in Python 3.3.
+
 - Issue #10997: Prevent a duplicate entry in IDLE's "Recent Files" menu.
 
 - Issue #14443: Tell rpmbuild to use the correct version of Python in