File tree Expand file tree Collapse file tree 2 files changed +15
-2
lines changed Expand file tree Collapse file tree 2 files changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -2193,6 +2193,19 @@ fn main() {
2193
2193
" \"\" " font-lock-string-face
2194
2194
" /* " font-lock-comment-delimiter-face
2195
2195
" print!(\"\" ); */" font-lock-comment-face ))
2196
+ ; ; with newline directly following delimiter
2197
+ (rust-test-font-lock
2198
+ " print!(\n\"\"\n ); { /* print!(\"\" ); */ }"
2199
+ '(" print!" rust-builtin-formatting-macro-face
2200
+ " \"\" " font-lock-string-face
2201
+ " /* " font-lock-comment-delimiter-face
2202
+ " print!(\"\" ); */" font-lock-comment-face ))
2203
+ ; ; with empty println!()
2204
+ (rust-test-font-lock
2205
+ " println!(); { /* println!(); */ }"
2206
+ '(" println!" rust-builtin-formatting-macro-face
2207
+ " /* " font-lock-comment-delimiter-face
2208
+ " println!(); */" font-lock-comment-face ))
2196
2209
; ; other delimiters
2197
2210
(rust-test-font-lock
2198
2211
" print!{\"\" }; { /* no-op */ }"
Original file line number Diff line number Diff line change @@ -633,7 +633,7 @@ match data if found. Returns nil if not within a Rust string."
633
633
" List of builtin Rust macros for string formatting used by `rust-mode-font-lock-keywords' . (`write!' is handled separately.)" )
634
634
635
635
(defvar rust-formatting-macro-opening-re
636
- " [[:space:]]*[({[][[:space:]]*"
636
+ " [[:space:]\n ]*[({[][[:space:]\n ]*"
637
637
" Regular expression to match the opening delimiter of a Rust formatting macro." )
638
638
639
639
(defvar rust-start-of-string-re
@@ -661,7 +661,7 @@ match data if found. Returns nil if not within a Rust string."
661
661
1 font-lock-preprocessor-face keep)
662
662
663
663
; ; Builtin formatting macros
664
- (,(concat (rust-re-grab (concat (regexp-opt rust-builtin-formatting-macros) " !" )) (concat rust-formatting-macro-opening-re rust-start-of-string-re))
664
+ (,(concat (rust-re-grab (concat (regexp-opt rust-builtin-formatting-macros) " !" )) (concat rust-formatting-macro-opening-re " \\ (?: " rust-start-of-string-re) " \\ )? " )
665
665
(1 'rust-builtin-formatting-macro-face )
666
666
(rust-string-interpolation-matcher
667
667
(rust-end-of-string)
You can’t perform that action at this time.
0 commit comments