diff options
author | Barry Warsaw <barry@python.org> | 1998-05-19 16:06:21 (GMT) |
---|---|---|
committer | Barry Warsaw <barry@python.org> | 1998-05-19 16:06:21 (GMT) |
commit | 751f4931d8e53c510b3c3a793fcd64eda1c13908 (patch) | |
tree | ad303ba36373f3c8a17508406494147539dbdbd9 /Misc/python-mode.el | |
parent | 820273d6d15f3c827cad700b9aa41bab1320c7b3 (diff) | |
download | cpython-751f4931d8e53c510b3c3a793fcd64eda1c13908.zip cpython-751f4931d8e53c510b3c3a793fcd64eda1c13908.tar.gz cpython-751f4931d8e53c510b3c3a793fcd64eda1c13908.tar.bz2 |
(py-stringlit-re): Another ME patch to recognize SQTQs and DQTQs
(single and double quoted triple quoted strings :-) with embedded
single like-quotes. Also recognizes raw prefix.
Diffstat (limited to 'Misc/python-mode.el')
-rw-r--r-- | Misc/python-mode.el | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/Misc/python-mode.el b/Misc/python-mode.el index b725e03..39d1f1b 100644 --- a/Misc/python-mode.el +++ b/Misc/python-mode.el @@ -403,9 +403,23 @@ Currently-active file is at the head of the list.") ;; Regexp matching a Python string literal (defconst py-stringlit-re (concat - "'\\([^'\n\\]\\|\\\\.\\)*'" ; single-quoted + ;; These fail if backslash-quote ends the string (not worth + ;; fixing?). They precede the short versions so that the first two + ;; quotes don't look like an empty short string. + ;; + ;; (maybe raw), long single quoted triple quoted strings (SQTQ), + ;; with potential embedded single quotes + "[rR]?'''[^']*\\(\\('[^']\\|''[^']\\)[^']*\\)*'''" + "\\|" + ;; (maybe raw), long double quoted triple quoted strings (DQTQ), + ;; with potential embedded double quotes + "[rR]?\"\"\"[^\"]*\\(\\(\"[^\"]\\|\"\"[^\"]\\)[^\"]*\\)*\"\"\"" + "\\|" + "[rR]?'\\([^'\n\\]\\|\\\\.\\)*'" ; single-quoted "\\|" ; or - "\"\\([^\"\n\\]\\|\\\\.\\)*\"")) ; double-quoted + "[rR]?\"\\([^\"\n\\]\\|\\\\.\\)*\"" ; double-quoted + )) + ;; Regexp matching Python lines that are continued via backslash. ;; This is tricky because a trailing backslash does not mean @@ -2801,6 +2815,10 @@ local bindings to py-newline-and-indent.")) ;; statement we need to skip over the continuation lines. Tricky: ;; Again we need to be clever to avoid quadratic time behavior. (defun py-goto-beyond-final-line () + ;; TEST ADDED BY MDE; not quite the right solution + (if (looking-at (concat "[ \t]*\\(" py-stringlit-re "\\)")) + (goto-char (match-end 0))) + ;; (forward-line 1) (let (state) (while (and (py-continuation-line-p) |