userdiff: recognize 'macro_rules!' as starting a Rust function block
authorKonrad Borowski <redacted>
Wed, 7 Oct 2020 13:26:11 +0000 (13:26 +0000)
committerJunio C Hamano <redacted>
Wed, 7 Oct 2020 15:48:20 +0000 (08:48 -0700)
Signed-off-by: Konrad Borowski <redacted>
Signed-off-by: Junio C Hamano <redacted>
t/t4018/rust-macro-rules [new file with mode: 0644]
userdiff.c

diff --git a/t/t4018/rust-macro-rules b/t/t4018/rust-macro-rules
new file mode 100644 (file)
index 0000000..ec610c5
--- /dev/null
@@ -0,0 +1,6 @@
+macro_rules! RIGHT {
+    () => {
+        // a comment
+        let x = ChangeMe;
+    };
+}
index fde02f225b2b9ed17a8246913c3bddfa6483c98b..29030377242bc4dca0d53e3a0af215d39ce106e2 100644 (file)
@@ -165,7 +165,7 @@ PATTERNS("ruby", "^[ \t]*((class|module|def)[ \t].*)$",
         "|[-+0-9.e]+|0[xXbB]?[0-9a-fA-F]+|\\?(\\\\C-)?(\\\\M-)?."
         "|//=?|[-+*/<>%&^|=!]=|<<=?|>>=?|===|\\.{1,3}|::|[!=]~"),
 PATTERNS("rust",
-        "^[\t ]*((pub(\\([^\\)]+\\))?[\t ]+)?((async|const|unsafe|extern([\t ]+\"[^\"]+\"))[\t ]+)?(struct|enum|union|mod|trait|fn|impl)[< \t]+[^;]*)$",
+        "^[\t ]*((pub(\\([^\\)]+\\))?[\t ]+)?((async|const|unsafe|extern([\t ]+\"[^\"]+\"))[\t ]+)?(struct|enum|union|mod|trait|fn|impl|macro_rules!)[< \t]+[^;]*)$",
         /* -- */
         "[a-zA-Z_][a-zA-Z0-9_]*"
         "|[0-9][0-9_a-fA-Fiosuxz]*(\\.([0-9]*[eE][+-]?)?[0-9_fF]*)?"
git clone https://git.99rst.org/PROJECT