Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

diff: Support visibility modifiers in the PHP hunk header regexp

Starting with PHP5, class methods can have a visibility modifier, which
caused the methods not to be matched by the existing regexp, so extend
the regexp to match those modifiers. And while we're at it, allow the
"static" modifier as well.

Since the "static" modifier can appear either before or after the
visibility modifier, let's just allow any number of modifiers to appear
in any order, as that simplifies the regexp and shouldn't cause any
false positives.

Signed-off-by: Björn Steinbrink <B.Steinbrink@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information...
commit 6d2f208c3dd39493f4d45ea67c55a1b7fe06626a 1 parent e498257
Björn Steinbrink authored May 23, 2010 gitster committed May 27, 2010

Showing 1 changed file with 3 additions and 1 deletion. Show diff stats Hide diff stats

  1. 4  userdiff.c
4  userdiff.c
@@ -44,7 +44,9 @@ PATTERNS("pascal",
44 44
 	 "|[-+0-9.e]+|0[xXbB]?[0-9a-fA-F]+"
45 45
 	 "|<>|<=|>=|:=|\\.\\."
46 46
 	 "|[^[:space:]]|[\x80-\xff]+"),
47  
-PATTERNS("php", "^[\t ]*((function|class).*)",
  47
+PATTERNS("php",
  48
+	 "^[\t ]*(((public|protected|private|static)[\t ]+)*function.*)$\n"
  49
+	 "^[\t ]*(class.*)$",
48 50
 	 /* -- */
49 51
 	 "[a-zA-Z_][a-zA-Z0-9_]*"
50 52
 	 "|[-+0-9.e]+|0[xXbB]?[0-9a-fA-F]+"

0 notes on commit 6d2f208

Please sign in to comment.
Something went wrong with that request. Please try again.