From: Elijah Newren <newren@gmail.com>
To: Philippe Blain via GitGitGadget <gitgitgadget@gmail.com>
Cc: Git Mailing List <git@vger.kernel.org>,
Brandon Casey <drafnel@gmail.com>,
Philippe Blain <levraiphilippeblain@gmail.com>
Subject: Re: [PATCH 2/2] userdiff: improve Fortran xfuncname regex
Date: Wed, 12 Aug 2020 19:10:45 -0700 [thread overview]
Message-ID: <CABPp-BENKdxqXjH07yCNojRWQ3XO+_mm8x+LSVLTBx36m6nSSw@mail.gmail.com> (raw)
In-Reply-To: <69fe977b66f9744c914cfdfa2da4b9be5e720e4f.1597271429.git.gitgitgadget@gmail.com>
On Wed, Aug 12, 2020 at 3:34 PM Philippe Blain via GitGitGadget
<gitgitgadget@gmail.com> wrote:
>
> From: Philippe Blain <levraiphilippeblain@gmail.com>
>
> 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>
> ---
> t/t4018/fortran-comment-keyword | 1 -
> userdiff.c | 2 +-
> 2 files changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/t/t4018/fortran-comment-keyword b/t/t4018/fortran-comment-keyword
> index c5dbdb4c61..e9206a5379 100644
> --- a/t/t4018/fortran-comment-keyword
> +++ b/t/t4018/fortran-comment-keyword
> @@ -8,7 +8,6 @@
> real funcB ! grid function b
>
> real ChangeMe
> - integer broken
>
> end subroutine RIGHT
>
This change seems orthogonal to the explanation in the commit message.
What is its purpose, and does it belong in this commit or a different
one?
> diff --git a/userdiff.c b/userdiff.c
> index 707d82435a..fde02f225b 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])\\."
> --
> gitgitgadget
next prev parent reply other threads:[~2020-08-13 2:11 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-08-12 22:30 [PATCH 0/2] Improve and test Fortran xfuncname regex Philippe Blain via GitGitGadget
2020-08-12 22:30 ` [PATCH 1/2] userdiff: add tests for " Philippe Blain via GitGitGadget
2020-08-12 22:30 ` [PATCH 2/2] userdiff: improve " Philippe Blain via GitGitGadget
2020-08-13 2:10 ` Elijah Newren [this message]
2020-08-13 12:45 ` Philippe Blain
2020-08-13 14:04 ` Elijah Newren
2020-08-13 18:22 ` [PATCH 0/2] Improve and test " Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CABPp-BENKdxqXjH07yCNojRWQ3XO+_mm8x+LSVLTBx36m6nSSw@mail.gmail.com \
--to=newren@gmail.com \
--cc=drafnel@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitgitgadget@gmail.com \
--cc=levraiphilippeblain@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).