From da4b25e0d99a13b25cae675127774bfd2bb55f2d Mon Sep 17 00:00:00 2001 From: Guido van Rossum Date: Wed, 21 Apr 1999 15:49:34 +0000 Subject: Patch by Tim Peters to speed up colorizing of big multiline strings. --- Tools/idle/ColorDelegator.py | 8 ++++---- 1 file 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"]) -- cgit v0.12