SF.net SVN: geany:[4729] trunk
eht16 at users.sourceforge.net
eht16 at xxxxx
Sun Mar 7 16:50:20 UTC 2010
Revision: 4729
http://geany.svn.sourceforge.net/geany/?rev=4729&view=rev
Author: eht16
Date: 2010-03-07 16:50:20 +0000 (Sun, 07 Mar 2010)
Log Message:
-----------
Improve PHP parser to parse also the argument lists of PHP functions (patch by Can Koy, thanks).
Modified Paths:
--------------
trunk/ChangeLog
trunk/tagmanager/php.c
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2010-03-07 15:41:25 UTC (rev 4728)
+++ trunk/ChangeLog 2010-03-07 16:50:20 UTC (rev 4729)
@@ -14,6 +14,9 @@
move the question from the secondary to the main text to be
more compatible with the Gnome HIG.
Fix broken 'Save' action in 'Resave missing file' dialog.
+ * tagmanager/php.c:
+ Improve PHP parser to parse also the argument lists of PHP
+ functions (patch by Can Koy, thanks).
2010-03-05 Frank Lanitz <frank(at)frank(dot)uvena(dot)de>
Modified: trunk/tagmanager/php.c
===================================================================
--- trunk/tagmanager/php.c 2010-03-07 15:41:25 UTC (rev 4728)
+++ trunk/tagmanager/php.c 2010-03-07 16:50:20 UTC (rev 4729)
@@ -19,7 +19,7 @@
#include "general.h" /* must always come first */
#include <string.h>
-
+#include "main.h"
#include "parse.h"
#include "read.h"
#include "vstring.h"
@@ -67,6 +67,7 @@
#define ALPHA "[:alpha:]"
#define ALNUM "[:alnum:]"
+static void function_cb(const char *line, const regexMatch *matches, unsigned int count);
static void installPHPRegex (const langType language)
{
@@ -78,8 +79,9 @@
"\\1", "m,macro,macros", NULL);
addTagRegex(language, "^[ \t]*const[ \t]*([" ALPHA "_][" ALNUM "_]*)[ \t]*[=;]",
"\\1", "m,macro,macros", NULL);
- addTagRegex(language, "^[ \t]*((public|protected|private|static)[ \t]+)*function[ \t]+&?[ \t]*([" ALPHA "_][" ALNUM "_]*)",
- "\\3", "f,function,functions", NULL);
+ addCallbackRegex(language,
+ "^[ \t]*([public|protected|private|static]*[ \t]*)*function[ \t]+&?[ \t]*([" ALPHA "_][" ALNUM "_]*)[[:space:]]*(\\([^)]*\\))",
+ NULL, function_cb);
addTagRegex(language, "^[ \t]*(\\$|::\\$|\\$this->)([" ALPHA "_][" ALNUM "_]*)[ \t]*=",
"\\2", "v,variable,variables", NULL);
addTagRegex(language, "^[ \t]*((var|public|protected|private|static)[ \t]+)+\\$([" ALPHA "_][" ALNUM "_]*)[ \t]*[=;]",
@@ -94,6 +96,38 @@
"\\3", "j,jsfunction,javascript functions", NULL);
}
+
+static void function_cb(const char *line, const regexMatch *matches, unsigned int count)
+{
+ char *name, *arglist;
+ static char *kindName = "function";
+ tagEntryInfo e;
+ const regexMatch *match_funcname = NULL;
+ const regexMatch *match_arglist = NULL;
+
+ if (count > 2 && count < 6)
+ {
+ match_funcname = &matches[count - 2];
+ match_arglist = &matches[count -1];
+ }
+
+ if (match_funcname != NULL)
+ {
+ name = xMalloc(match_funcname->length + 1, char);
+ strncpy(name, line + match_funcname->start, match_funcname->length);
+ *(name+match_funcname->length) = '\x0';
+ arglist = xMalloc(match_arglist->length + 1, char);
+ strncpy(arglist, line + match_arglist->start, match_arglist->length);
+ *(arglist+match_arglist->length) = '\x0';
+
+ initTagEntry (&e, name);
+ e.kind = 'f';
+ e.kindName = kindName;
+ e.extensionFields.arglist = arglist;
+ makeTagEntry (&e);
+ }
+}
+
/* Create parser definition structure */
extern parserDefinition* PhpParser (void)
{
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Commits
mailing list