summaryrefslogtreecommitdiffstats
path: root/Tools
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1999-04-21 15:49:34 (GMT)
committerGuido van Rossum <guido@python.org>1999-04-21 15:49:34 (GMT)
commitda4b25e0d99a13b25cae675127774bfd2bb55f2d (patch)
treef517db9b17501fb60dd70773808c2ebc3a890e32 /Tools
parent743007d2fe6c7ceb5232c2b9e4dbaeb232635dce (diff)
downloadcpython-da4b25e0d99a13b25cae675127774bfd2bb55f2d.zip
cpython-da4b25e0d99a13b25cae675127774bfd2bb55f2d.tar.gz
cpython-da4b25e0d99a13b25cae675127774bfd2bb55f2d.tar.bz2
Patch by Tim Peters to speed up colorizing of big multiline strings.
Diffstat (limited to 'Tools')
-rw-r--r--Tools/idle/ColorDelegator.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/Tools/idle/ColorDelegator.py b/Tools/idle/ColorDelegator.py
index e04526a..5b4da7c 100644
--- a/Tools/idle/ColorDelegator.py
+++ b/Tools/idle/ColorDelegator.py
@@ -19,10 +19,10 @@ def any(name, list):
def make_pat():
kw = r"\b" + any("KEYWORD", keyword.kwlist) + r"\b"
comment = any("COMMENT", [r"#[^\n]*"])
- sqstring = r"(\b[rR])?'([^'\\\n]|\\.)*'?"
- dqstring = r'(\b[rR])?"([^"\\\n]|\\.)*"?'
- sq3string = r"(\b[rR])?'''([^'\\]|\\.|'(?!''))*(''')?"
- dq3string = r'(\b[rR])?"""([^"\\]|\\.|"(?!""))*(""")?'
+ sqstring = r"(\b[rR])?'[^'\\\n]*(\\.[^'\\\n]*)*'?"
+ dqstring = r'(\b[rR])?"[^"\\\n]*(\\.[^"\\\n]*)*"?'
+ sq3string = r"(\b[rR])?'''[^'\\]*((\\.|'(?!''))[^'\\]*)*(''')?"
+ dq3string = r'(\b[rR])?"""[^"\\]*((\\.|"(?!""))[^"\\]*)*(""")?'
string = any("STRING", [sq3string, dq3string, sqstring, dqstring])
return kw + "|" + comment + "|" + string + "|" + any("SYNC", [r"\n"])