From 09b0b033ff6647d59fc46e4ab4e1c113a5146c56 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Enrico=20Tr=C3=B6ger?= Date: Tue, 25 Aug 2009 21:23:14 +0000 Subject: [PATCH] Improve parsing of PHP functions by requiring a valid modifier or whitespace before the 'function' keyword to ignore some false positives like function tags inside comments (patch by Harold Aling, thanks). git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@4124 ea778897-0a13-0410-b9d1-a72fbfd435f5 --- ChangeLog | 9 +++++++++ tagmanager/php.c | 4 ++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index a1e08d47..f44687a2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2009-08-25 Enrico Tröger + + * tagmanager/php.c: + Improve parsing of PHP functions by requiring a valid modifier or + whitespace before the 'function' keyword to ignore some false + positives like function tags inside comments + (patch by Harold Aling, thanks). + + 2009-08-25 Nick Treleaven * data/filetypes.markdown: diff --git a/tagmanager/php.c b/tagmanager/php.c index 083d608e..9a34144d 100644 --- a/tagmanager/php.c +++ b/tagmanager/php.c @@ -76,8 +76,8 @@ static void installPHPRegex (const langType language) "\\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]*[=;]",