cpython: 62d3c0336df6 (original) (raw)
Mercurial > cpython
changeset 105922:62d3c0336df6 3.6
Issue #29071: Use local flags for IDLE colorizer string prefix matcher. Revised re by Serhiy Storchaka. [#29071]
Terry Jan Reedy tjreedy@udel.edu | |
---|---|
date | Sun, 01 Jan 2017 21:21:39 -0500 |
parents | f36f9bce997d |
children | 91c15294a0ab ee25895d9d65 |
files | Lib/idlelib/colorizer.py |
diffstat | 1 files changed, 4 insertions(+), 4 deletions(-)[+] [-] Lib/idlelib/colorizer.py 8 |
line wrap: on
line diff
--- 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)?")[](#l1.8)
- 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("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"[](#l1.21)
"if iF + If + IF: 'keywork matching must respect case'\n"[](#l1.22)
"# All valid prefixes for unicode and byte strings should be colored\n"[](#l1.23) "'x', '''x''', \"x\", \"\"\"x\"\"\"\n"[](#l1.24) "r'x', u'x', R'x', U'x', f'x', F'x', ur'is invalid'\n"[](#l1.25) "fr'x', Fr'x', fR'x', FR'x', rf'x', rF'x', Rf'x', RF'x'\n"[](#l1.26)