From: Johannes Sixt <j6t@kdbg.org>
To: Thomas Rast <trast@student.ethz.ch>
Cc: Junio C Hamano <gitster@pobox.com>, Jeff King <peff@peff.net>,
git@vger.kernel.org
Subject: Re: [PATCH] userdiff: allow * between cpp funcname words
Date: Wed, 07 Dec 2011 22:13:10 +0100 [thread overview]
Message-ID: <4EDFD6E6.5050301@kdbg.org> (raw)
In-Reply-To: <201112070904.28212.trast@student.ethz.ch>
Am 07.12.2011 09:04, schrieb Thomas Rast:
> Junio C Hamano wrote:
>> Thomas Rast <trast@student.ethz.ch> writes:
>>
>>> Actually (sadly) I'll have to revise it. It doesn't match much of C++
>>> either, and I haven't yet come up with a reasonable regex that
>>> matches, say,
>>>
>>> foo::Bar<int>::t& Baz::operator<<(
>>>
>>> which I would call ludicrous, but it's valid C++.
>>
>> Heh, I'd rather not see us go that route, which would either end up
>> implementing a C++ parser or reverting the heuristics back to "non-blank
>> at the beginning of the line" that was already reasonably useful.
>
> Well, there are many things that we deliberately do not match right
> now and for which that's a good thing:
>
> label:
> public:
> void declaration_only(...);
> int global_variable;
>
> At some point I was wondering whether it would be better to just
> declare a non-match for '.*;' and '^[A-Za-z_][A-Za-z_0-9]+:', and
> otherwise match all '^[A-Za-z].*\(' but I may be missing something.
The current cpp pattern doesn't work that well with C++. Since it
requires a blank before a name before the opening parentheses, it
doesn't catch constructors:
Foo::Foo()
and it should fail for GNU style C function definitions as well (I
didn't test):
void
do_the_foo()
I'll run this pattern for a while:
diff.cpp.xfuncname=!^[a-zA-Z_][a-zA-Z_0-9]*[[:space:]]*:[[:space:]]*$
^[a-zA-Z_].*
BTW, your match pattern requires an opening parenthesis; it would not
catch class definitions.
-- Hannes
prev parent reply other threads:[~2011-12-07 21:13 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-12-06 16:35 [PATCH] userdiff: allow * between cpp funcname words Thomas Rast
2011-12-06 19:02 ` Jeff King
2011-12-06 20:17 ` Thomas Rast
2011-12-06 20:19 ` Jeff King
2011-12-06 20:52 ` Johannes Sixt
2011-12-06 21:07 ` René Scharfe
2011-12-06 21:15 ` Junio C Hamano
2011-12-07 8:04 ` Thomas Rast
2011-12-07 21:13 ` Johannes Sixt [this message]
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=4EDFD6E6.5050301@kdbg.org \
--to=j6t@kdbg.org \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=peff@peff.net \
--cc=trast@student.ethz.ch \
/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).