git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Jonathan del Strother" <maillist@steelskies.com>
To: "Junio C Hamano" <gitster@pobox.com>
Cc: "Miklos Vajna" <vmiklos@frugalware.org>,
	"Andreas Ericsson" <ae@op5.se>,
	git@vger.kernel.org, Johannes.Schindelin@gmx.de
Subject: Re: [PATCH] Teach git diff about Objective-C syntax
Date: Thu, 18 Sep 2008 00:30:08 +0100	[thread overview]
Message-ID: <57518fd10809171630v97485aalcc5089f96082c0fc@mail.gmail.com> (raw)
In-Reply-To: <7vljxq4i5p.fsf@gitster.siamese.dyndns.org>

On Wed, Sep 17, 2008 at 9:44 PM, Junio C Hamano <gitster@pobox.com> wrote:
> Are you sure the regexp you have for Objective-C methods quotes a dot "."
> correctly, by the way?  It appears to match almost anything enclosed in a
> pair of parentheses, as long as you have two alpha after open paren.

It could be a little more restrictive, but I'm not sure how much
further it could be taken without it getting ridiculous.  Just as some
examples, it needs to match :
+(id)someClassMethod
-(id)someInstanceMethod
-(NSNumber*)numberWithNumerator:(int)n denominator:(int)d
-(NSString*)stringWithVariableArguments:(NSString*)format ...

(I seem to remember that if your method returns 'id' you can skip the
return type, eg "- someInstanceMethod", but I don't think there's any
hope for people that use that notation...)

^[ \t]*\\([-+][ \t]*([ \t]*[A-Za-z_][A-Za-z_0-9* \t]*)[ \t]*_?[A-Za-z]*\\)$
would be a small improvement - that is, a plus or minus, brackets
around the return type, then at least one letter for the method name,
potentially preceded by an underscore.  Can anyone suggest anything
better?

Also, why can't I use \s for whitespace, \w for word characters etc?
I thought we were using the gnu regex library?


> Also I am not sure if you can do the pattern alternates the way you did.
> If you have this:
>
>        "...\\(A\\|B\\)$"
>        "\\|"
>        "...\\(C\\|D\\)$"
>
> A and B will be captured as $1 but wouldn't C or D captured as $2?

Hmm, hadn't considered that.  It appears to work fine, but I haven't
yet had chance to track down exactly where the funcname regexp match
occurs to see what the code is doing with the different matches.  I'll
try and take a look tomorrow, unless someone can enlighten me before
then...

  reply	other threads:[~2008-09-17 23:31 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-09-16 23:21 [PATCH] Teach git diff about Objective-C syntax Jonathan del Strother
2008-09-16 23:39 ` Miklos Vajna
2008-09-17  0:07   ` Jonathan del Strother
2008-09-17 10:49     ` Jonathan del Strother
2008-09-17 11:06       ` Johannes Schindelin
2008-09-17 12:26         ` Jonathan del Strother
2008-09-17 13:29           ` Jonathan del Strother
2008-09-17 15:03             ` Andreas Ericsson
2008-09-17 15:31               ` Jonathan del Strother
2008-09-17 15:55                 ` Miklos Vajna
2008-09-17 19:14                   ` Jonathan del Strother
2008-09-17 20:44                     ` Junio C Hamano
2008-09-17 23:30                       ` Jonathan del Strother [this message]
2008-09-30 23:46                         ` [PATCH v2] " Jonathan del Strother
2008-10-01  0:52                           ` Brandon Casey
2008-10-01 19:28                             ` [PATCH] xdiff-interface.c: strip newline (and cr) from line before pattern matching Brandon Casey
2008-10-01 20:05                               ` Johannes Schindelin
2008-10-02 10:29                               ` Jonathan del Strother
2008-10-02 10:40                           ` [PATCH v2] Teach git diff about Objective-C syntax Jonathan del Strother
2008-09-18  6:50                     ` [PATCH] " Andreas Ericsson
2008-09-17 13:37         ` Jonathan del Strother
2008-09-17 14:28           ` Johannes Schindelin
2008-09-17 14:32             ` Jonathan del Strother

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=57518fd10809171630v97485aalcc5089f96082c0fc@mail.gmail.com \
    --to=maillist@steelskies.com \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=ae@op5.se \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=vmiklos@frugalware.org \
    /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).