aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShawn O. Pearce <spearce@spearce.org>2008-10-09 11:01:51 -0700
committerShawn O. Pearce <spearce@spearce.org>2008-10-09 11:01:51 -0700
commit23abd3f48cb217d1558fa1984bfa8c502717c08f (patch)
tree10d4300c9700ee80d5538c4f302cac16aa7cd914
parent01ed1079f3fae37eda7e0e0dcab9b74b34e9327e (diff)
parent5d1e958e2467ef295637844fd85be7a8ab187ef1 (diff)
downloadgit-23abd3f48cb217d1558fa1984bfa8c502717c08f.tar.gz
git-23abd3f48cb217d1558fa1984bfa8c502717c08f.tar.xz
Merge branch 'js/objc-funchdr'
* js/objc-funchdr: Teach git diff about Objective-C syntax
-rw-r--r--Documentation/gitattributes.txt2
-rw-r--r--diff.c10
2 files changed, 12 insertions, 0 deletions
diff --git a/Documentation/gitattributes.txt b/Documentation/gitattributes.txt
index 2ae771f2f..26945593c 100644
--- a/Documentation/gitattributes.txt
+++ b/Documentation/gitattributes.txt
@@ -315,6 +315,8 @@ patterns are available:
- `java` suitable for source code in the Java language.
+- `objc` suitable for source code in the Objective-C language.
+
- `pascal` suitable for source code in the Pascal/Delphi language.
- `php` suitable for source code in the PHP language.
diff --git a/diff.c b/diff.c
index 02e948c9d..2af3a9748 100644
--- a/diff.c
+++ b/diff.c
@@ -1429,6 +1429,16 @@ static const struct funcname_pattern_entry builtin_funcname_pattern[] = {
"!^[ \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 },
+ { "objc",
+ /* Negate C statements that can look like functions */
+ "!^[ \t]*(do|for|if|else|return|switch|while)\n"
+ /* Objective-C methods */
+ "^[ \t]*([-+][ \t]*\\([ \t]*[A-Za-z_][A-Za-z_0-9* \t]*\\)[ \t]*[A-Za-z_].*)$\n"
+ /* C functions */
+ "^[ \t]*(([ \t]*[A-Za-z_][A-Za-z_0-9]*){2,}[ \t]*\\([^;]*)$\n"
+ /* Objective-C class/protocol definitions */
+ "^(@(implementation|interface|protocol)[ \t].*)$",
+ REG_EXTENDED },
{ "pascal",
"^((procedure|function|constructor|destructor|interface|"
"implementation|initialization|finalization)[ \t]*.*)$"