summaryrefslogtreecommitdiff
path: root/userdiff.c
diff options
context:
space:
mode:
authorPhilippe Blain <levraiphilippeblain@gmail.com>2020-08-12 22:30:28 (GMT)
committerJunio C Hamano <gitster@pobox.com>2020-08-13 18:21:17 (GMT)
commitb79e6925f0ff8ae0afa6554224a5a2e1c41a4605 (patch)
treec7404820f9a1e0b385ed1df3648cd5b4e7fcc65b /userdiff.c
parent47ae905ffb98cc4d4fd90083da6bc8dab55d9ecc (diff)
downloadgit-b79e6925f0ff8ae0afa6554224a5a2e1c41a4605.zip
git-b79e6925f0ff8ae0afa6554224a5a2e1c41a4605.tar.gz
git-b79e6925f0ff8ae0afa6554224a5a2e1c41a4605.tar.bz2
userdiff: add tests for Fortran xfuncname regex
The Fortran userdiff patterns, introduced in 909a5494f8 (userdiff.c: add builtin fortran regex patterns, 2010-09-10), predate the test infrastructure for xfuncname patterns, introduced in bfa7d01413 (t4018: an infrastructure to test hunk headers, 2014-03-21). Add tests for the Fortran xfuncname patterns. The test 't/t4018/fortran-comment-keyword' documents a shortcoming of the regex that is fixed in a subsequent commit. While at it, add descriptive comments for the different parts of the regex. Signed-off-by: Philippe Blain <levraiphilippeblain@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'userdiff.c')
-rw-r--r--userdiff.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/userdiff.c b/userdiff.c
index 1df884e..707d824 100644
--- a/userdiff.c
+++ b/userdiff.c
@@ -46,9 +46,13 @@ PATTERNS("elixir",
/* Not real operators, but should be grouped */
"|:?%[A-Za-z0-9_.]\\{\\}?"),
IPATTERN("fortran",
+ /* Don't match comment lines */
"!^([C*]|[ \t]*!)\n"
+ /* Don't match 'module procedure' lines */
"!^[ \t]*MODULE[ \t]+PROCEDURE[ \t]\n"
+ /* Program, module, block data */
"^[ \t]*((END[ \t]+)?(PROGRAM|MODULE|BLOCK[ \t]+DATA"
+ /* Subroutines and functions */
"|([^'\" \t]+[ \t]+)*(SUBROUTINE|FUNCTION))[ \t]+[A-Z].*)$",
/* -- */
"[a-zA-Z][a-zA-Z0-9_]*"