Skip to content

Commit

Permalink
diff: use extended regexp to find hunk headers
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Junio C Hamano committed Sep 20, 2008
1 parent cd08431 commit 1883a0d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions diff.c
Original file line number Diff line number Diff line change
Expand Up @@ -1406,7 +1406,7 @@ static const struct funcname_pattern_entry *funcname_pattern(const char *ident)
static const struct funcname_pattern_entry builtin_funcname_pattern[] = {
{ "bibtex", "(@[a-zA-Z]{1,}[ \t]*\{{0,1}[ \t]*[^ \t\"@',\\#}{~%]*).*$",
REG_EXTENDED },
{ "html", "^\\s*\\(<[Hh][1-6]\\s.*>.*\\)$", 0 },
{ "html", "^[ \t]*(<[Hh][1-6][ \t].*>.*)$", REG_EXTENDED },
{ "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]*\\([^;]*)$",
Expand All @@ -1417,8 +1417,8 @@ static const struct funcname_pattern_entry builtin_funcname_pattern[] = {
"|"
"^(.*=[ \t]*(class|record).*)$",
REG_EXTENDED },
{ "php", "^[\t ]*\\(\\(function\\|class\\).*\\)", 0 },
{ "python", "^\\s*\\(\\(class\\|def\\)\\s.*\\)$", 0 },
{ "php", "^[\t ]*((function|class).*)", REG_EXTENDED },
{ "python", "^[ \t]*((class|def)[ \t].*)$", REG_EXTENDED },
{ "ruby", "^[ \t]*((class|module|def)[ \t].*)$",
REG_EXTENDED },
{ "tex",
Expand Down

0 comments on commit 1883a0d

Please sign in to comment.