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() {
21932193 " \"\" " font-lock-string-face
21942194 " /* " font-lock-comment-delimiter-face
21952195 " 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 ))
21962209 ; ; other delimiters
21972210 (rust-test-font-lock
21982211 " 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."
633633 " List of builtin Rust macros for string formatting used by `rust-mode-font-lock-keywords' . (`write!' is handled separately.)" )
634634
635635(defvar rust-formatting-macro-opening-re
636- " [[:space:]]*[({[][[:space:]]*"
636+ " [[:space:]\n ]*[({[][[:space:]\n ]*"
637637 " Regular expression to match the opening delimiter of a Rust formatting macro." )
638638
639639(defvar rust-start-of-string-re
@@ -661,7 +661,7 @@ match data if found. Returns nil if not within a Rust string."
661661 1 font-lock-preprocessor-face keep)
662662
663663 ; ; 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) " \\ )? " )
665665 (1 'rust-builtin-formatting-macro-face )
666666 (rust-string-interpolation-matcher
667667 (rust-end-of-string)
You can’t perform that action at this time.
0 commit comments