Issue #14958: Change IDLE systax highlighting to recognize all string and

byte literals supported in Python 3.3.
This commit is contained in:
Ned Deily 2012-05-29 22:55:43 -07:00
parent e8eb912722
commit 5e92a1ef5a
2 changed files with 8 additions and 4 deletions

View File

@ -21,10 +21,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[rRbB])?'[^'\\\n]*(\\.[^'\\\n]*)*'?"
dqstring = r'(\b[rRbB])?"[^"\\\n]*(\\.[^"\\\n]*)*"?'
sq3string = r"(\b[rRbB])?'''[^'\\]*((\\.|'(?!''))[^'\\]*)*(''')?"
dq3string = r'(\b[rRbB])?"""[^"\\]*((\\.|"(?!""))[^"\\]*)*(""")?'
stringprefix = r"(\br|u|ur|R|U|UR|Ur|uR|b|B|br|Br|bR|BR|rb|rB|Rb|RB)?"
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"])

View File

@ -60,6 +60,9 @@ Core and Builtins
Library
-------
- Issue #14958: Change IDLE systax highlighting to recognize all string and
byte literals supported in Python 3.3.
- Issue #10997: Prevent a duplicate entry in IDLE's "Recent Files" menu.
- Issue #14443: Tell rpmbuild to use the correct version of Python in