]> granicus.if.org Git - python/commitdiff
Issue #14958: backport to 2.7.x from 3.3 (patch by Roger Serwy)
authorNed Deily <nad@acm.org>
Mon, 31 Dec 2012 23:06:38 +0000 (15:06 -0800)
committerNed Deily <nad@acm.org>
Mon, 31 Dec 2012 23:06:38 +0000 (15:06 -0800)
Lib/idlelib/ColorDelegator.py
Misc/NEWS

index 7f4d740ffac5d7d1e6352c0ae22d944b320d148f..0610c4b6aac3321aebfd13bd35b062d7740aba84 100644 (file)
@@ -20,10 +20,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[rRuU])?'[^'\\\n]*(\\.[^'\\\n]*)*'?"
-    dqstring = r'(\b[rRuU])?"[^"\\\n]*(\\.[^"\\\n]*)*"?'
-    sq3string = r"(\b[rRuU])?'''[^'\\]*((\\.|'(?!''))[^'\\]*)*(''')?"
-    dq3string = r'(\b[rRuU])?"""[^"\\]*((\\.|"(?!""))[^"\\]*)*(""")?'
+    stringprefix = r"(\br|u|ur|R|U|UR|Ur|uR|b|B|br|Br|bR|BR)?"
+    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 e99efca3ffdae4c2167017e1569b34f3450aa104..8bfa5690176c59e36931e09c0f4403902ac691f0 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -430,6 +430,9 @@ Library
 - Issue #12157: Make pool.map() empty iterables correctly.  Initial
   patch by mouad.
 
+- Issue #14958: Change IDLE systax highlighting to recognize all string and byte
+  literals currently supported in Python 2.7.
+
 - Issue #14962: Update text coloring in IDLE shell window after changing
   options.  Patch by Roger Serwy.