All of lore.kernel.org
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Brandon Casey <casey@nrlssc.navy.mil>
Cc: Arjen Laarhoven <arjen@yaph.org>,
	Mike Ralphson <mike.ralphson@gmail.com>,
	Johannes Sixt <j.sixt@viscovery.net>, Jeff King <peff@peff.net>,
	Boyd Lynn Gerber <gerberb@zenez.com>,
	Git Mailing List <git@vger.kernel.org>,
	Avery Pennarun <apenwarr@gmail.com>,
	Johan Herland <johan@herland.net>, Andreas Ericsson <ae@op5.se>,
	Kirill Smelkov <kirr@mns.spb.ru>,
	Giuseppe Bilotta <giuseppe.bilotta@gmail.com>,
	Gustaf Hendeby <hendeby@isy.liu.se>,
	Jonathan del Strother <maillist@steelskies.com>
Subject: Re: [PATCH v2 4/4] diff.c: convert builtin funcname patterns to non-GNU extended regex syntax
Date: Fri, 19 Sep 2008 23:58:30 -0700	[thread overview]
Message-ID: <7vy71n482x.fsf@gitster.siamese.dyndns.org> (raw)
In-Reply-To: <7v7i97swv3.fsf@gitster.siamese.dyndns.org> (Junio C. Hamano's message of "Fri, 19 Sep 2008 13:29:20 -0700")

Junio C Hamano <gitster@pobox.com> writes:

> Neither has [4/4] on it.  I'd like two patches so that:
>
>  * [PATCH 1/2] applies to bc/maint-diff-hunk-header-fix, so that the
>    languages in 1.6.0.2 are fixed for non GNU platforms;
>
>  * After applying [1/2] to bc/maint-diff-hunk-header-fix, I'll merge the
>    branch to bc/master-diff-hunk-header-fix and then...
>
>  * [PATCH 2/2] applies on top of it to convert new languages that are
>    supported only on 'master' to use xfuncname.

Here is [1/2] to be applied on top of 45d9414 (diff.*.xfuncname which uses
"extended" regex's for hunk header selection, 2008-09-18).

Testing appreciated.

-- >8 --
Subject: [PATCH] diff: use extended regexp to find hunk headers

Using ERE elements such as "|" (alternation) by backquoting in BRE
is a GNU extension and should not be done in portable programs.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
 diff.c |   31 +++++++++++++++++--------------
 1 files changed, 17 insertions(+), 14 deletions(-)

diff --git a/diff.c b/diff.c
index dabb4b4..175a044 100644
--- a/diff.c
+++ b/diff.c
@@ -1399,20 +1399,23 @@ static const struct funcname_pattern_entry *funcname_pattern(const char *ident)
 }
 
 static const struct funcname_pattern_entry builtin_funcname_pattern[] = {
-	{ "java", "!^[ 	]*\\(catch\\|do\\|for\\|if\\|instanceof\\|"
-			"new\\|return\\|switch\\|throw\\|while\\)\n"
-			"^[ 	]*\\(\\([ 	]*"
-			"[A-Za-z_][A-Za-z_0-9]*\\)\\{2,\\}"
-			"[ 	]*([^;]*\\)$", 0 },
-	{ "pascal", "^\\(\\(procedure\\|function\\|constructor\\|"
-			"destructor\\|interface\\|implementation\\|"
-			"initialization\\|finalization\\)[ \t]*.*\\)$"
-			"\\|"
-			"^\\(.*=[ \t]*\\(class\\|record\\).*\\)$",
-			0 },
-	{ "bibtex", "\\(@[a-zA-Z]\\{1,\\}[ \t]*{\\{0,1\\}[ \t]*[^ \t\"@',\\#}{~%]*\\).*$", 0 },
-	{ "tex", "^\\(\\\\\\(\\(sub\\)*section\\|chapter\\|part\\)\\*\\{0,1\\}{.*\\)$", 0 },
-	{ "ruby", "^\\s*\\(\\(class\\|module\\|def\\)\\s.*\\)$", 0 },
+	{ "java",
+	  "!^[ \t]*(catch|do|for|if|instanceof|new|return|switch|throw|while)\n"
+	  "^[ \t]*(([ \t]*[A-Za-z_][A-Za-z_0-9]*){2,}[ \t]*\\([^;]*)$",
+	  REG_EXTENDED },
+	{ "pascal",
+	  "^((procedure|function|constructor|destructor|interface|"
+		"implementation|initialization|finalization)[ \t]*.*)$"
+	  "|"
+	  "^(.*=[ \t]*(class|record).*)$",
+	  REG_EXTENDED },
+	{ "bibtex", "(@[a-zA-Z]{1,}[ \t]*\{{0,1}[ \t]*[^ \t\"@',\\#}{~%]*).*$",
+	  REG_EXTENDED },
+	{ "tex",
+	  "^(\\\\((sub)*section|chapter|part)\\*{0,1}\{.*)$",
+	  REG_EXTENDED },
+	{ "ruby", "^[ \t]*((class|module|def)[ \t].*)$",
+	  REG_EXTENDED },
 };
 
 static const struct funcname_pattern_entry *diff_funcname_pattern(struct diff_filespec *one)

  reply	other threads:[~2008-09-20  7:00 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <7vskry1485.fsf@gitster.siamese.dyndns.org>
2008-09-18 22:40 ` [PATCH v2 1/4] diff.c: return pattern entry pointer rather than just the hunk header pattern Brandon Casey
2008-09-19 18:14   ` Boyd Lynn Gerber
2008-09-19 19:11     ` Brandon Casey
2008-09-18 22:42 ` [PATCH v2 2/4] diff.c: associate a flag with each pattern and use it for compiling regex Brandon Casey
2008-09-18 22:44 ` [PATCH v2 3/4] diff.*.xfuncname which uses "extended" regex's for hunk header selection Brandon Casey
2008-09-18 22:47 ` [PATCH v2 4/4] diff.c: convert builtin funcname patterns to non-GNU extended regex syntax Brandon Casey
2008-09-18 22:59   ` Brandon Casey
2008-09-19 15:59     ` Brandon Casey
2008-09-18 23:40   ` Johan Herland
2008-09-19 15:55     ` Brandon Casey
2008-09-19 20:29   ` Junio C Hamano
2008-09-20  6:58     ` Junio C Hamano [this message]
2008-09-20 21:03       ` Brandon Casey
2008-09-20 22:29         ` Junio C Hamano
2008-09-22 16:59           ` Brandon Casey
2008-09-24  0:04             ` Brandon Casey
2008-09-26 17:49               ` Brandon Casey
2008-09-29 21:52                 ` [PATCH] diff.c: remove duplicate bibtex pattern introduced by merge 92bb9785 Brandon Casey
2008-09-22 23:19       ` [PATCH bc/maint-diff-hunk-header] t4018-diff-funcname: test syntax of builtin xfuncname patterns Brandon Casey
2008-09-22 23:26         ` [PATCH bc/master-diff-hunk-header] " Brandon Casey
2008-09-23  0:49           ` [PATCH] diff funcname_pattern: Allow HTML header tags without attributes Johan Herland
2008-09-23  1:46             ` Junio C Hamano
2008-09-23  2:05               ` Johan Herland
2008-09-20  7:02     ` [PATCH v2 4/4] diff.c: convert builtin funcname patterns to non-GNU extended regex syntax Junio C Hamano
2008-09-20  7:51       ` Junio C Hamano
2008-09-22  8:29   ` Gustaf Hendeby

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=7vy71n482x.fsf@gitster.siamese.dyndns.org \
    --to=gitster@pobox.com \
    --cc=ae@op5.se \
    --cc=apenwarr@gmail.com \
    --cc=arjen@yaph.org \
    --cc=casey@nrlssc.navy.mil \
    --cc=gerberb@zenez.com \
    --cc=git@vger.kernel.org \
    --cc=giuseppe.bilotta@gmail.com \
    --cc=hendeby@isy.liu.se \
    --cc=j.sixt@viscovery.net \
    --cc=johan@herland.net \
    --cc=kirr@mns.spb.ru \
    --cc=maillist@steelskies.com \
    --cc=mike.ralphson@gmail.com \
    --cc=peff@peff.net \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.