Fix CTags bug 2970274 - when using addCallbackRegex the callback
receives less than the number of matches. The number is still not correct (due to POSIX regex compatibility) but at least includes all non-empty matches now. http://sourceforge.net/tracker/index.php?func=detail&aid=2970274 &group_id=6556&atid=106556 git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@5997 ea778897-0a13-0410-b9d1-a72fbfd435f5
This commit is contained in:
parent
3462cc900a
commit
03d22bec52
11
ChangeLog
11
ChangeLog
@ -1,3 +1,14 @@
|
||||
2011-10-05 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
|
||||
|
||||
* tagmanager/lregex.c, tagmanager/php.c:
|
||||
Fix CTags bug 2970274 - when using addCallbackRegex the callback
|
||||
receives less than the number of matches. The number is still not
|
||||
correct (due to POSIX regex compatibility) but at least includes
|
||||
all non-empty matches now.
|
||||
http://sourceforge.net/tracker/index.php?func=detail&aid=2970274
|
||||
&group_id=6556&atid=106556
|
||||
|
||||
|
||||
2011-10-04 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
|
||||
|
||||
* tagmanager/js.c:
|
||||
|
||||
@ -471,11 +471,16 @@ static void matchCallbackPattern (
|
||||
for (i = 0 ; i < BACK_REFERENCE_COUNT ; ++i)
|
||||
{
|
||||
int so, eo;
|
||||
if (!g_match_info_fetch_pos(minfo, i, &so, &eo) || so == -1)
|
||||
if (!g_match_info_fetch_pos(minfo, i, &so, &eo))
|
||||
break;
|
||||
matches [i].start = so;
|
||||
matches [i].length = eo - so;
|
||||
++count;
|
||||
/* a valid match may have both offsets == -1,
|
||||
* e.g. (foo)*(bar) matching "bar" - see CTags bug 2970274.
|
||||
* As POSIX regex doesn't seem to have a way to count matches,
|
||||
* we return the count up to the last non-empty match. */
|
||||
if (so != -1)
|
||||
count = i + 1;
|
||||
}
|
||||
patbuf->u.callback.function (vStringValue (line), matches, count);
|
||||
}
|
||||
|
||||
@ -80,12 +80,7 @@ static void installPHPRegex (const langType language)
|
||||
addTagRegex(language, "^[ \t]*const[ \t]*([" ALPHA "_][" ALNUM "_]*)[ \t]*[=;]",
|
||||
"\\1", "m,macro,macros", NULL);
|
||||
addCallbackRegex(language,
|
||||
"^[ \t]*((public|protected|private|static|final)[ \t]+)+function[ \t]+&?[ \t]*([" ALPHA "_][" ALNUM "_]*)[[:space:]]*(\\(.*\\))",
|
||||
NULL, function_cb);
|
||||
/* note: using (qualifiers)* instead of (qualifiers)+ in the above regex doesn't seem to
|
||||
* match 'function' on its own, so we handle that separately: */
|
||||
addCallbackRegex(language,
|
||||
"^[ \t]*function[ \t]+&?[ \t]*([" ALPHA "_][" ALNUM "_]*)[[:space:]]*(\\(.*\\))",
|
||||
"^[ \t]*((public|protected|private|static|final)[ \t]+)*function[ \t]+&?[ \t]*([" ALPHA "_][" ALNUM "_]*)[[:space:]]*(\\(.*\\))",
|
||||
NULL, function_cb);
|
||||
addTagRegex(language, "^[ \t]*(\\$|::\\$|\\$this->)([" ALPHA "_][" ALNUM "_]*)[ \t]*=",
|
||||
"\\2", "v,variable,variables", NULL);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user