@@ -1105,41 +1105,44 @@ should be considered a paired angle bracket."
1105
1105
(group " '" )))
1106
1106
" A regular expression matching a character literal." ))
1107
1107
1108
- (defun rust--syntax-propertize-raw-string (end )
1108
+ (defun rust--syntax-propertize-raw-string (str-start end )
1109
1109
" A helper for rust-syntax-propertize.
1110
1110
1111
- If point is already in a raw string, this will apply the
1112
- appropriate string syntax to the character up to the end of the
1113
- raw string, or to END, whichever comes first."
1114
- (let ((str-start (nth 8 (syntax-ppss ))))
1115
- (when str-start
1116
- (when (save-excursion
1117
- (goto-char str-start)
1118
- (looking-at " r\\ (#*\\ )\\ (\" \\ )" ))
1119
- ; ; In a raw string, so try to find the end.
1120
- (let ((hashes (match-string 1 )))
1121
- ; ; Match \ characters at the end of the string to suppress
1122
- ; ; their normal character-quote syntax.
1123
- (when (re-search-forward (concat " \\ (\\\\ *\\ )\\ (\" " hashes " \\ )" ) end t )
1124
- (put-text-property (match-beginning 1 ) (match-end 1 )
1125
- 'syntax-table (string-to-syntax " _" ))
1126
- (put-text-property (1- (match-end 2 )) (match-end 2 )
1127
- 'syntax-table (string-to-syntax " |" ))
1128
- (goto-char (match-end 0 ))))))))
1111
+ This will apply the appropriate string syntax to the character
1112
+ from the STR-START up to the end of the raw string, or to END,
1113
+ whichever comes first."
1114
+ (when (save-excursion
1115
+ (goto-char str-start)
1116
+ (looking-at " r\\ (#*\\ )\\ (\" \\ )" ))
1117
+ ; ; In a raw string, so try to find the end.
1118
+ (let ((hashes (match-string 1 )))
1119
+ ; ; Match \ characters at the end of the string to suppress
1120
+ ; ; their normal character-quote syntax.
1121
+ (when (re-search-forward (concat " \\ (\\\\ *\\ )\\ (\" " hashes " \\ )" ) end t )
1122
+ (put-text-property (match-beginning 1 ) (match-end 1 )
1123
+ 'syntax-table (string-to-syntax " _" ))
1124
+ (put-text-property (1- (match-end 2 )) (match-end 2 )
1125
+ 'syntax-table (string-to-syntax " |" ))
1126
+ (goto-char (match-end 0 ))))))
1129
1127
1130
1128
(defun rust-syntax-propertize (start end )
1131
1129
" A `syntax-propertize-function' to apply properties from START to END."
1132
1130
(goto-char start)
1133
- (rust--syntax-propertize-raw-string end)
1131
+ (let ((str-start (rust-in-str-or-cmnt)))
1132
+ (when str-start
1133
+ (rust--syntax-propertize-raw-string str-start end)))
1134
1134
(funcall
1135
1135
(syntax-propertize-rules
1136
1136
; ; Character literals.
1137
1137
(rust--char-literal-rx (1 " \" " ) (2 " \" " ))
1138
1138
; ; Raw strings.
1139
1139
(" \\ (r\\ )#*\" "
1140
- (1 (prog1 " |"
1141
- (goto-char (match-end 0 ))
1142
- (rust--syntax-propertize-raw-string end))))
1140
+ (0 (ignore
1141
+ (goto-char (match-end 0 ))
1142
+ (unless (save-excursion (nth 8 (syntax-ppss (match-beginning 0 ))))
1143
+ (put-text-property (match-beginning 1 ) (match-end 1 )
1144
+ 'syntax-table (string-to-syntax " |" ))
1145
+ (rust--syntax-propertize-raw-string (match-beginning 0 ) end)))))
1143
1146
(" [<>]"
1144
1147
(0 (ignore
1145
1148
(when (save-match-data
0 commit comments