Dear Geany devs,
I've been tinkering with the regex in tagmanager/php.c to better detect functions. My regex is still far from perfect, but I'll only detect functions prefixed with either whitespace or on or more of these: public, protected, private or static.
I'd guess a better approach would be to detect the opening parenthesis '(' after the function name...
The first 2 commented 'functions' are indexed by the current regex as the functions 'should' and 'would'.
/** * This function should not be indexed */
// this function would also be indexed
Correct examples:
public static function this_one_will() {
function this_one_too() {
Cheers!
Harold.
On Tue, 18 Aug 2009 10:52:02 +0200, Harold wrote:
Dear Geany devs,
I've been tinkering with the regex in tagmanager/php.c to better detect functions. My regex is still far from perfect, but I'll only detect functions prefixed with either whitespace or on or more of these: public, protected, private or static.
I'd guess a better approach would be to detect the opening parenthesis '(' after the function name...
The first 2 commented 'functions' are indexed by the current regex as the functions 'should' and 'would'.
Giving that I'm not very good in reading and understanding regular expressions, the patch looks good to me. The approach is pretty much ok, I think. At least it should make the current situation much better even if not perfect.
Any objections in committing it? Any other PHP users around?
Regards, Enrico
On Wed, 19 Aug 2009 23:21:30 +0200, Enrico wrote:
On Tue, 18 Aug 2009 10:52:02 +0200, Harold wrote:
Dear Geany devs,
I've been tinkering with the regex in tagmanager/php.c to better detect functions. My regex is still far from perfect, but I'll only detect functions prefixed with either whitespace or on or more of these: public, protected, private or static.
I'd guess a better approach would be to detect the opening parenthesis '(' after the function name...
The first 2 commented 'functions' are indexed by the current regex as the functions 'should' and 'would'.
Giving that I'm not very good in reading and understanding regular
s/Giving/Given/ :)
expressions, the patch looks good to me. The approach is pretty much ok, I think. At least it should make the current situation much better even if not perfect.
Any objections in committing it? Any other PHP users around?
Too late. I just committed it. Let's hope it'll work fine, I'm sure it makes things better for PHP.
Thanks a bunch Harold.
Regards, Enrico