Merge with 3.6

This commit is contained in:
Terry Jan Reedy 2017-01-01 21:21:54 -05:00
commit bade830a21

View file

@ -21,8 +21,7 @@ def make_pat():
# 1st 'file' colorized normal, 2nd as builtin, 3rd as string # 1st 'file' colorized normal, 2nd as builtin, 3rd as string
builtin = r"([^.'\"\\#]\b|^)" + any("BUILTIN", builtinlist) + r"\b" builtin = r"([^.'\"\\#]\b|^)" + any("BUILTIN", builtinlist) + r"\b"
comment = any("COMMENT", [r"#[^\n]*"]) comment = any("COMMENT", [r"#[^\n]*"])
stringprefix = (r"(\br|R|u|U|f|F|fr|Fr|fR|FR|rf|rF|Rf|RF" stringprefix = r"(?i:\br|u|f|fr|rf|b|br|rb)?"
"|b|B|br|Br|bR|BR|rb|rB|Rb|RB)?")
sqstring = stringprefix + r"'[^'\\\n]*(\\.[^'\\\n]*)*'?" sqstring = stringprefix + r"'[^'\\\n]*(\\.[^'\\\n]*)*'?"
dqstring = stringprefix + r'"[^"\\\n]*(\\.[^"\\\n]*)*"?' dqstring = stringprefix + r'"[^"\\\n]*(\\.[^"\\\n]*)*"?'
sq3string = stringprefix + r"'''[^'\\]*((\\.|'(?!''))[^'\\]*)*(''')?" sq3string = stringprefix + r"'''[^'\\]*((\\.|'(?!''))[^'\\]*)*(''')?"
@ -262,10 +261,11 @@ def _color_delegator(parent): # htest #
top = Toplevel(parent) top = Toplevel(parent)
top.title("Test ColorDelegator") top.title("Test ColorDelegator")
x, y = map(int, parent.geometry().split('+')[1:]) 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" source = ("# Following has syntax errors\n"
"if True: then int 1\nelif False: print 0\nelse: float(None)\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" "'x', '''x''', \"x\", \"\"\"x\"\"\"\n"
"r'x', u'x', R'x', U'x', f'x', F'x', ur'is invalid'\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" "fr'x', Fr'x', fR'x', FR'x', rf'x', rF'x', Rf'x', RF'x'\n"