;; string delimiters. Fixme: Is there a better way?
;; First avoid a sequence preceded by an odd number of backslashes.
(syntax-propertize-rules
- (;; (rx (not (any ?\\))
- ;; ?\\ (* (and ?\\ ?\\))
- ;; (group (syntax string-quote))
- ;; (backref 1)
- ;; (group (backref 1)))
- ;; ¡Backrefs don't work in syntax-propertize-rules!
- "[^\\]\\\\\\(\\\\\\\\\\)*\\(?:''\\('\\)\\|\"\"\\(?2:\"\\)\\)"
- (2 "\"")) ; dummy
- (;; (rx (optional (group (any "uUrR"))) ; prefix gets syntax property
- ;; (optional (any "rR")) ; possible second prefix
- ;; (group (syntax string-quote)) ; maybe gets property
- ;; (backref 2) ; per first quote
- ;; (group (backref 2))) ; maybe gets property
- ;; ¡Backrefs don't work in syntax-propertize-rules!
- "\\([RUru]\\)?[Rr]?\\(?:\\('\\)'\\('\\)\\|\\(?2:\"\\)\"\\(?3:\"\\)\\)"
+ (;; ¡Backrefs don't work in syntax-propertize-rules!
+ (concat "\\(?:\\([RUru]\\)[Rr]?\\|^\\|[^\\]\\(?:\\\\.\\)*\\)" ;Prefix.
+ "\\(?:\\('\\)'\\('\\)\\|\\(?2:\"\\)\"\\(?3:\"\\)\\)")
(3 (ignore (python-quote-syntax))))
;; This doesn't really help.
;;((rx (and ?\\ (group ?\n))) (1 " "))