- (put-text-property (match-beginning 3) (match-end 3)
- 'syntax-table
- (if (assoc (char-after (match-beginning 3))
- perl-quote-like-pairs)
- (string-to-syntax "|")
- (string-to-syntax "\"")))
- (perl-syntax-propertize-special-constructs end)))))
+ (unless (nth 8 (save-excursion (syntax-ppss (match-beginning 1))))
+ ;; Don't add this syntax-table property if
+ ;; within a string, which would misbehave in cases such as
+ ;; $a = "foo y \"toto\" bar" where we'd end up changing the
+ ;; syntax of the backslash and hence de-escaping the embedded
+ ;; double quote.
+ (put-text-property (match-beginning 3) (match-end 3)
+ 'syntax-table
+ (if (assoc (char-after (match-beginning 3))
+ perl-quote-like-pairs)
+ (string-to-syntax "|")
+ (string-to-syntax "\"")))
+ (perl-syntax-propertize-special-constructs end))))))