summaryrefslogtreecommitdiffstats
path: root/Lib/idlelib
diff options
context:
space:
mode:
authorTerry Jan Reedy <tjreedy@udel.edu>2017-01-02 02:21:39 (GMT)
committerTerry Jan Reedy <tjreedy@udel.edu>2017-01-02 02:21:39 (GMT)
commit0e10243d64d7753f448fbce5bd20bab818ef2d26 (patch)
tree7411478d31aaa93fdd118c5e36dea026904b7824 /Lib/idlelib
parente465a9af8e87aa2c4c20dfaa23b310827c2ec345 (diff)
downloadcpython-0e10243d64d7753f448fbce5bd20bab818ef2d26.zip
cpython-0e10243d64d7753f448fbce5bd20bab818ef2d26.tar.gz
cpython-0e10243d64d7753f448fbce5bd20bab818ef2d26.tar.bz2
Issue #29071: Use local flags for IDLE colorizer string prefix matcher.
Revised re by Serhiy Storchaka.
Diffstat (limited to 'Lib/idlelib')
-rw-r--r--Lib/idlelib/colorizer.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/Lib/idlelib/colorizer.py b/Lib/idlelib/colorizer.py
index 7a919f1..ff40845 100644
--- a/Lib/idlelib/colorizer.py
+++ b/Lib/idlelib/colorizer.py
@@ -21,8 +21,7 @@ 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]*"])
- stringprefix = (r"(\br|R|u|U|f|F|fr|Fr|fR|FR|rf|rF|Rf|RF"
- "|b|B|br|Br|bR|BR|rb|rB|Rb|RB)?")
+ stringprefix = r"(?i:\br|u|f|fr|rf|b|br|rb)?"
sqstring = stringprefix + r"'[^'\\\n]*(\\.[^'\\\n]*)*'?"
dqstring = stringprefix + r'"[^"\\\n]*(\\.[^"\\\n]*)*"?'
sq3string = stringprefix + r"'''[^'\\]*((\\.|'(?!''))[^'\\]*)*(''')?"
@@ -262,10 +261,11 @@ def _color_delegator(parent): # htest #
top = Toplevel(parent)
top.title("Test ColorDelegator")
x, y = map(int, parent.geometry().split('+')[1:])
- top.geometry("600x200+%d+%d" % (x + 100, y + 175))
+ top.geometry("700x250+%d+%d" % (x + 20, y + 175))
source = ("# Following has syntax errors\n"
"if True: then int 1\nelif False: print 0\nelse: float(None)\n"
- "#unicode and byte strings, valid prefixes should be colored\n"
+ "if iF + If + IF: 'keywork matching must respect case'\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', ur'is invalid'\n"
"fr'x', Fr'x', fR'x', FR'x', rf'x', rF'x', Rf'x', RF'x'\n"