On Sun, 7 Mar 2010 10:11:01 -0800 (PST), Can wrote:
--- On Sun, 3/7/10, Enrico Tröger enrico.troeger@uvena.de wrote:
From: Enrico Tröger enrico.troeger@uvena.de Subject: Re: [Geany-devel] [Patch] - Improve PHP parser (call tips) To: geany-devel@uvena.de Date: Sunday, March 7, 2010, 4:50 PM On Fri, 5 Mar 2010 12:21:25 -0800 (PST), Can wrote:
Hi, The following patch adds call tips for functions in PHP code. The regex pattern for function parameters is not optimal, but should work for most cases. When you have a problem, send the relevant function definition so that I can improve the patch.
Awesome (though I still think it'd be better in thelong term to write a C-based, real parser insteaf of fiddling with regexps).
I tweaked the patch a bit to work also with functions wth a modifier (public, private, ...) as it worked before (which was a patch by Harold, IIRC). I hope I didn't put more bugs into it than before :).
You put a weird pattern: [public|protected|private|static]* If you wanted to group, you should use ()
I didn't want to group, we don't need to know the actual modifier, we just want to allow only this subset. And yes, it was a group before but there is just no need to.
I thought it would be better to handle methods after nested scopes are implemented, that's why I left access modifiers out. Anyway, if you want something, just ask, you don't have to do everything.
Feel free. In your patch, functions with modifiers just were ignored, that's why I added the list of modifiers to be allowed.
Also, there might be cases where the code could crash due to invalid memory accesses, these have to be found.
I see you put a second if block. But, is there a case where match_funcname can be NULL if the first if condition is already true?
It's highly unlikely match_funcname is NULL if the first condition is already true, obviously. But it can easily happen if the first condition is not true, e.g. if the count variable is not between 2 and 6 which might happen.
Regards, Enrico