From: Konrad Borowski <konrad@borowski.pw>
Changes since v1:
- Changed macro_rules! to be considered to use the same
rule as rest of keywords to reduce the size of a change
as suggested by Phillip Wood. This means that
'pub macro_rules!` (a syntax error) is considered to be
a hunk header.
- Written commit message in imperative mood as suggested by
Johannes Sixt.
Signed-off-by: Konrad Borowski <konrad@borowski.pw>
---
userdiff: support Rust macrosPublished-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-865%2Fxfix%2Fuserdiff-macro-rules-rust-v2
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-865/xfix/userdiff-macro-rules-rust-v2
Pull-Request: https://github.com/git/git/pull/865
Range-diff vs v1:
1: 9e071ddf63 ! 1: a3fd67d84f userdiff: support Rust macros
@@ Metadata
Author: Konrad Borowski <konrad@borowski.pw>
## Commit message ##
- userdiff: support Rust macros
+ userdiff: permit Rust's macro_rules! keyword in hunk headers
- This adds a support for macro_rules! keyword which declares
- a macro. It also includes a test case.
+ Changes since v1:
+ - Changed macro_rules! to be considered to use the same
+ rule as rest of keywords to reduce the size of a change
+ as suggested by Phillip Wood. This means that
+ 'pub macro_rules!` (a syntax error) is considered to be
+ a hunk header.
+
+ - Written commit message in imperative mood as suggested by
+ Johannes Sixt.
Signed-off-by: Konrad Borowski <konrad@borowski.pw>
@@ userdiff.c: PATTERNS("ruby", "^[ \t]*((class|module|def)[ \t].*)$",
"|//=?|[-+*/<>%&^|=!]=|<<=?|>>=?|===|\\.{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)[< \t]+|macro_rules[\t ]*!)[^;]*)$",
++ "^[\t ]*((pub(\\([^\\)]+\\))?[\t ]+)?((async|const|unsafe|extern([\t ]+\"[^\"]+\"))[\t ]+)?(struct|enum|union|mod|trait|fn|impl|macro_rules[\t ]*!)[< \t]+[^;]*)$",
/* -- */
"[a-zA-Z_][a-zA-Z0-9_]*"
"|[0-9][0-9_a-fA-Fiosuxz]*(\\.([0-9]*[eE][+-]?)?[0-9_fF]*)?" t/t4018/rust-macro-rules | 6 ++++++
userdiff.c | 2 +-
2 files changed, 7 insertions(+), 1 deletion(-)
create mode 100644 t/t4018/rust-macro-rules