summaryrefslogtreecommitdiff
path: root/userdiff.c
diff options
context:
space:
mode:
authorPhilippe Blain <levraiphilippeblain@gmail.com>2020-08-12 22:30:29 (GMT)
committerJunio C Hamano <gitster@pobox.com>2020-08-13 18:21:18 (GMT)
commit75c3b6b2e8a72239fa23e039c46f9a5cf8c24142 (patch)
tree3a0d8f50ab7083c7ef75584c8f0f7be7499e2372 /userdiff.c
parentb79e6925f0ff8ae0afa6554224a5a2e1c41a4605 (diff)
downloadgit-75c3b6b2e8a72239fa23e039c46f9a5cf8c24142.zip
git-75c3b6b2e8a72239fa23e039c46f9a5cf8c24142.tar.gz
git-75c3b6b2e8a72239fa23e039c46f9a5cf8c24142.tar.bz2
userdiff: improve Fortran xfuncname regex
The third part of the Fortran xfuncname regex wants to match the beginning of a subroutine or function, so it allows for all characters except `'`, `"` or whitespace before the keyword 'function' or 'subroutine'. This is meant to match the 'recursive', 'elemental' or 'pure' keywords, as well as function return types, and to prevent matches inside strings. However, the negated set does not contain the `!` comment character, so a line with an end-of-line comment containing the keyword 'function' or 'subroutine' followed by another word is mistakenly chosen as a hunk header. Improve the regex by adding `!` to the negated set. 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.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/userdiff.c b/userdiff.c
index 707d824..fde02f2 100644
--- a/userdiff.c
+++ b/userdiff.c
@@ -53,7 +53,7 @@ IPATTERN("fortran",
/* Program, module, block data */
"^[ \t]*((END[ \t]+)?(PROGRAM|MODULE|BLOCK[ \t]+DATA"
/* Subroutines and functions */
- "|([^'\" \t]+[ \t]+)*(SUBROUTINE|FUNCTION))[ \t]+[A-Z].*)$",
+ "|([^!'\" \t]+[ \t]+)*(SUBROUTINE|FUNCTION))[ \t]+[A-Z].*)$",
/* -- */
"[a-zA-Z][a-zA-Z0-9_]*"
"|\\.([Ee][Qq]|[Nn][Ee]|[Gg][TtEe]|[Ll][TtEe]|[Tt][Rr][Uu][Ee]|[Ff][Aa][Ll][Ss][Ee]|[Aa][Nn][Dd]|[Oo][Rr]|[Nn]?[Ee][Qq][Vv]|[Nn][Oo][Tt])\\."