git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Teach git diff about Objective-C syntax
@ 2008-09-16 23:21 Jonathan del Strother
  2008-09-16 23:39 ` Miklos Vajna
  0 siblings, 1 reply; 23+ messages in thread
From: Jonathan del Strother @ 2008-09-16 23:21 UTC (permalink / raw)
  To: git; +Cc: Jonathan del Strother

Add support for recognition of Objective-C class & instance methods, C functions, and class implementation/interfaces.

Signed-off-by: Jonathan del Strother <jon.delStrother@bestbefore.tv>
---
 Documentation/gitattributes.txt |    2 ++
 diff.c                          |    6 ++++++
 2 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/Documentation/gitattributes.txt b/Documentation/gitattributes.txt
index 6f3551d..c1f13e2 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 998dcaa..6ed8322 100644
--- a/diff.c
+++ b/diff.c
@@ -1403,6 +1403,12 @@ static struct builtin_funcname_pattern {
 			"^[ 	]*\\(\\([ 	]*"
 			"[A-Za-z_][A-Za-z_0-9]*\\)\\{2,\\}"
 			"[ 	]*([^;]*\\)$" },
+	{ "objc", "^[\t ]*\\([-+][\t ]*([\t ]*[A-Za-z_][A-Za-z_0-9]*.*).*\\)$"      // Objective-C methods
+			"\\|"
+			"^[\t ]*\\(\\([\t ]*[A-Za-z_][A-Za-z_0-9]*\\)\\{2,\\}[\t ]*([^;]*\\)$" // C functions
+			"\\|"
+			"^@\\(implementation\\|interface\\|protocol\\).*"   // Objective-C class/protocol definitions
+			},
 	{ "pascal", "^\\(\\(procedure\\|function\\|constructor\\|"
 			"destructor\\|interface\\|implementation\\|"
 			"initialization\\|finalization\\)[ \t]*.*\\)$"
-- 
1.6.0.2

^ permalink raw reply related	[flat|nested] 23+ messages in thread

end of thread, other threads:[~2008-10-02 10:41 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
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

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).