userdiff: recognize 'macro_rules!' as starting a Rust function block
Signed-off-by: Konrad Borowski <konrad@borowski.pw> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Konrad Borowski committed
Oct 7, 2020 at 13:26 UTC
a04c7e0f1b6680385945ea901283d6335c4c108a
2 files changed
+7
-1
t/t4018/rust-macro-rules
new
+6
@@ -0,0 +1,6 @@
1
+macro_rules! RIGHT {
2
+ () => {
3
+ // a comment
4
+ let x = ChangeMe;
5
+ };
6
+}
userdiff.c
+1
-1
@@ -165,7 +165,7 @@ PATTERNS("ruby", "^[ \t]*((class|module|def)[ \t].*)$",
165
"|[-+0-9.e]+|0[xXbB]?[0-9a-fA-F]+|\\?(\\\\C-)?(\\\\M-)?."
166
"|//=?|[-+*/<>%&^|=!]=|<<=?|>>=?|===|\\.{1,3}|::|[!=]~"),
167
PATTERNS("rust",
168
- "^[\t ]*((pub(\\([^\\)]+\\))?[\t ]+)?((async|const|unsafe|extern([\t ]+\"[^\"]+\"))[\t ]+)?(struct|enum|union|mod|trait|fn|impl)[< \t]+[^;]*)$",
168
+ "^[\t ]*((pub(\\([^\\)]+\\))?[\t ]+)?((async|const|unsafe|extern([\t ]+\"[^\"]+\"))[\t ]+)?(struct|enum|union|mod|trait|fn|impl|macro_rules!)[< \t]+[^;]*)$",
169
/* -- */
170
"[a-zA-Z_][a-zA-Z0-9_]*"
171
"|[0-9][0-9_a-fA-Fiosuxz]*(\\.([0-9]*[eE][+-]?)?[0-9_fF]*)?"