Skip to content

Commit 23abd3f

Browse files
committed
Merge branch 'js/objc-funchdr'
* js/objc-funchdr: Teach git diff about Objective-C syntax
2 parents 01ed107 + 5d1e958 commit 23abd3f

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

Documentation/gitattributes.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -315,6 +315,8 @@ patterns are available:
315315

316316
- `java` suitable for source code in the Java language.
317317

318+
- `objc` suitable for source code in the Objective-C language.
319+
318320
- `pascal` suitable for source code in the Pascal/Delphi language.
319321

320322
- `php` suitable for source code in the PHP language.

diff.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1429,6 +1429,16 @@ static const struct funcname_pattern_entry builtin_funcname_pattern[] = {
14291429
"!^[ \t]*(catch|do|for|if|instanceof|new|return|switch|throw|while)\n"
14301430
"^[ \t]*(([ \t]*[A-Za-z_][A-Za-z_0-9]*){2,}[ \t]*\\([^;]*)$",
14311431
REG_EXTENDED },
1432+
{ "objc",
1433+
/* Negate C statements that can look like functions */
1434+
"!^[ \t]*(do|for|if|else|return|switch|while)\n"
1435+
/* Objective-C methods */
1436+
"^[ \t]*([-+][ \t]*\\([ \t]*[A-Za-z_][A-Za-z_0-9* \t]*\\)[ \t]*[A-Za-z_].*)$\n"
1437+
/* C functions */
1438+
"^[ \t]*(([ \t]*[A-Za-z_][A-Za-z_0-9]*){2,}[ \t]*\\([^;]*)$\n"
1439+
/* Objective-C class/protocol definitions */
1440+
"^(@(implementation|interface|protocol)[ \t].*)$",
1441+
REG_EXTENDED },
14321442
{ "pascal",
14331443
"^((procedure|function|constructor|destructor|interface|"
14341444
"implementation|initialization|finalization)[ \t]*.*)$"

0 commit comments

Comments
 (0)