Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 0e10243

Browse files
committed
Issue #29071: Use local flags for IDLE colorizer string prefix matcher.
Revised re by Serhiy Storchaka.
1 parent e465a9a commit 0e10243

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

Lib/idlelib/colorizer.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,7 @@ def make_pat():
2121
# 1st 'file' colorized normal, 2nd as builtin, 3rd as string
2222
builtin = r"([^.'\"\\#]\b|^)" + any("BUILTIN", builtinlist) + r"\b"
2323
comment = any("COMMENT", [r"#[^\n]*"])
24-
stringprefix = (r"(\br|R|u|U|f|F|fr|Fr|fR|FR|rf|rF|Rf|RF"
25-
"|b|B|br|Br|bR|BR|rb|rB|Rb|RB)?")
24+
stringprefix = r"(?i:\br|u|f|fr|rf|b|br|rb)?"
2625
sqstring = stringprefix + r"'[^'\\\n]*(\\.[^'\\\n]*)*'?"
2726
dqstring = stringprefix + r'"[^"\\\n]*(\\.[^"\\\n]*)*"?'
2827
sq3string = stringprefix + r"'''[^'\\]*((\\.|'(?!''))[^'\\]*)*(''')?"
@@ -262,10 +261,11 @@ def _color_delegator(parent): # htest #
262261
top = Toplevel(parent)
263262
top.title("Test ColorDelegator")
264263
x, y = map(int, parent.geometry().split('+')[1:])
265-
top.geometry("600x200+%d+%d" % (x + 100, y + 175))
264+
top.geometry("700x250+%d+%d" % (x + 20, y + 175))
266265
source = ("# Following has syntax errors\n"
267266
"if True: then int 1\nelif False: print 0\nelse: float(None)\n"
268-
"#unicode and byte strings, valid prefixes should be colored\n"
267+
"if iF + If + IF: 'keywork matching must respect case'\n"
268+
"# All valid prefixes for unicode and byte strings should be colored\n"
269269
"'x', '''x''', \"x\", \"\"\"x\"\"\"\n"
270270
"r'x', u'x', R'x', U'x', f'x', F'x', ur'is invalid'\n"
271271
"fr'x', Fr'x', fR'x', FR'x', rf'x', rF'x', Rf'x', RF'x'\n"

0 commit comments

Comments
 (0)