diff options
Diffstat (limited to 'lisp/progmodes/python.el')
| -rw-r--r-- | lisp/progmodes/python.el | 19 |
1 files changed, 5 insertions, 14 deletions
diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index ed2a3236be1..dba8fe5572b 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el | |||
| @@ -170,18 +170,9 @@ | |||
| 170 | ;; Make outer chars of matching triple-quote sequences into generic | 170 | ;; Make outer chars of matching triple-quote sequences into generic |
| 171 | ;; string delimiters. Fixme: Is there a better way? | 171 | ;; string delimiters. Fixme: Is there a better way? |
| 172 | ;; First avoid a sequence preceded by an odd number of backslashes. | 172 | ;; First avoid a sequence preceded by an odd number of backslashes. |
| 173 | `((,(rx (not (any ?\\)) | 173 | `((,(concat "\\(?:\\([RUru]\\)[Rr]?\\|^\\|[^\\]\\(?:\\\\.\\)*\\)" ;Prefix. |
| 174 | ?\\ (* (and ?\\ ?\\)) | 174 | "\\(?:\\('\\)'\\('\\)\\|\\(?2:\"\\)\"\\(?3:\"\\)\\)") |
| 175 | (group (syntax string-quote)) | 175 | (1 (python-quote-syntax 1) nil lax) |
| 176 | (backref 1) | ||
| 177 | (group (backref 1))) | ||
| 178 | (2 ,(string-to-syntax "\""))) ; dummy | ||
| 179 | (,(rx (group (optional (any "uUrR"))) ; prefix gets syntax property | ||
| 180 | (optional (any "rR")) ; possible second prefix | ||
| 181 | (group (syntax string-quote)) ; maybe gets property | ||
| 182 | (backref 2) ; per first quote | ||
| 183 | (group (backref 2))) ; maybe gets property | ||
| 184 | (1 (python-quote-syntax 1)) | ||
| 185 | (2 (python-quote-syntax 2)) | 176 | (2 (python-quote-syntax 2)) |
| 186 | (3 (python-quote-syntax 3))) | 177 | (3 (python-quote-syntax 3))) |
| 187 | ;; This doesn't really help. | 178 | ;; This doesn't really help. |
| @@ -219,9 +210,9 @@ Used for syntactic keywords. N is the match number (1, 2 or 3)." | |||
| 219 | (eval-when-compile (string-to-syntax "|")))))) | 210 | (eval-when-compile (string-to-syntax "|")))))) |
| 220 | ;; Consider property for initial char, accounting for prefixes. | 211 | ;; Consider property for initial char, accounting for prefixes. |
| 221 | ((or (and (= n 2) ; leading quote (not prefix) | 212 | ((or (and (= n 2) ; leading quote (not prefix) |
| 222 | (= (match-beginning 1) (match-end 1))) ; prefix is null | 213 | (not (match-end 1))) ; prefix is null |
| 223 | (and (= n 1) ; prefix | 214 | (and (= n 1) ; prefix |
| 224 | (/= (match-beginning 1) (match-end 1)))) ; non-empty | 215 | (match-end 1))) ; non-empty |
| 225 | (let ((font-lock-syntactic-keywords nil)) | 216 | (let ((font-lock-syntactic-keywords nil)) |
| 226 | (unless (eq 'string (syntax-ppss-context (syntax-ppss))) | 217 | (unless (eq 'string (syntax-ppss-context (syntax-ppss))) |
| 227 | (eval-when-compile (string-to-syntax "|"))))) | 218 | (eval-when-compile (string-to-syntax "|"))))) |