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.
Index: tagmanager/php.c
===================================================================
--- tagmanager/php.c (revision 4103)
+++ tagmanager/php.c (working copy)
@@ -76,8 +76,8 @@
"\\2", "i,interface,interfaces", NULL);
addTagRegex(language, "(^|[ \t])define[ \t]*\\([ \t]*['\"]?([" ALPHA "_][" ALNUM "_]*)",
"\\2", "d,macro,constant definitions", NULL);
- addTagRegex(language, "(^|[ \t])function[ \t]+&?[ \t]*([" ALPHA "_][" ALNUM "_]*)",
- "\\2", "f,function,functions", NULL);
+ addTagRegex(language, "^[ \t]*((public|protected|private|static)[ \t]+)*function[ \t]+&?[ \t]*([" ALPHA "_][" ALNUM "_]*)",
+ "\\3", "f,function,functions", NULL);
addTagRegex(language, "(^|[ \t])(\\$|::\\$|\\$this->)([" ALPHA "_][" ALNUM "_]*)[ \t]*=",
"\\3", "v,variable,variables", NULL);
addTagRegex(language, "(^|[ \t])(var|public|protected|private|static)[ \t]+\\$([" ALPHA "_][" ALNUM "_]*)[ \t]*[=;]",
_______________________________________________
Geany mailing list
[email protected]
http://lists.uvena.de/cgi-bin/mailman/listinfo/geany