[SVN] C bundle doesn't recognise multi-line function defintions

Chris Thomas chris at cjack.com
Thu Mar 9 04:43:25 UTC 2006


(quoted messages rearranged to avoid offending Sune and/or Allan :)

>>> void
>>> brush_draw_brush (splotd * sp, GdkDrawable * drawable, GGobiData  
>>> * d,
>>>                   ggobid * gg)
>>> {
>>
>> The reason is this line:
>>
>> \s*\( (?=[^)]*\)          # match "(" and use look-ahead for ")"
>>
>> It's looking ahead for the closing bracket I presume to make sure  
>> it's a function, remove the look ahead and it should work. However  
>> I bet the look ahead was added for a reason, I'll let someone who  
>> knows C see if they know why ;)
>
> Might be worth testing it on a decently large source file to see  
> how it behaves without the lookahead; my instinct is that it'll  
> match stuff it shouldn't, although I've certainly been mistaken  
> before (:

It absolutely needs to match the closing paren, otherwise you do get  
false positives. I'm not certain that it has to match the closing  
paren with lookahead, though. (Feel free to disabuse me of that notion.)

If we could get the last clause of the regex to always match the open- 
curly-bracket ({|\n\s*{)
instead of ({|\n), the problem would go away. I don't remember  
whether I've already tried that or not, nor do I remember whether  
multiline regexps work in this context. Have to find some time for TM  
hacking...

Chris




More information about the textmate-dev mailing list