Re: [PATCH] Teach git diff about Objective-C syntax
- From
Jonathan del Strother <maillist@steelskies.com>
- Date
- Sep 17, 2008, 12:26 UTC
- Message-ID
- <57518fd10809170526i5c1e7dadgc38bb00e8073ba55@mail.gmail.com>
- In-Reply-To
- <alpine.DEB.1.00.0809171205430.14329@racer>
On Wed, Sep 17, 2008 at 12:06 PM, Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:
Show 17 quoted lines
> Hi,
>
> On Wed, 17 Sep 2008, Jonathan del Strother wrote:
>
>> - "^[ ]*\\(\\([ ]*"
>> + "^[ \t]*\\(\\([ \t]*"
>
> Why?
>
>> "[A-Za-z_][A-Za-z_0-9]*\\)\\{2,\\}"
>> - "[ ]*([^;]*\\)$" },
>> + "[ \t]*([^;]*\\)$" },
>> +
>> + { "objc", "![ \t]*\\(do\\|for\\|if\\|else\\|return\\|switch\\|while\\)\n" /* Negate C statements that can look like functions */
>> + "^[ \t]*\\([-+][ \t]*([ \t]*[A-Za-z_][A-Za-z_0-9]*.*).*\\)$" /* Objective-C methods */
>
> I see you still have these awfully long lines.I was hoping I'd get away with it since the overlong parts are just comments...
You'd prefer something like
{ "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]*.*).*\\)$"
"\\|"
/* C functions */
"^[ \t]*\\(\\([ \t]*[A-Za-z_][A-Za-z_0-9]*\\)\\{2,\\}[ \t]*([^;]*\\)$"
"\\|"
/* Objective-C class/protocol definitions */
"^@\\(implementation\\|interface\\|protocol\\).*"},?