Revision: 5997 http://geany.svn.sourceforge.net/geany/?rev=5997&view=rev Author: ntrel Date: 2011-10-05 12:00:38 +0000 (Wed, 05 Oct 2011) Log Message: ----------- 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
Modified Paths: -------------- trunk/ChangeLog trunk/tagmanager/lregex.c trunk/tagmanager/php.c
Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2011-10-04 17:10:42 UTC (rev 5996) +++ trunk/ChangeLog 2011-10-05 12:00:38 UTC (rev 5997) @@ -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:
Modified: trunk/tagmanager/lregex.c =================================================================== --- trunk/tagmanager/lregex.c 2011-10-04 17:10:42 UTC (rev 5996) +++ trunk/tagmanager/lregex.c 2011-10-05 12:00:38 UTC (rev 5997) @@ -471,11 +471,16 @@ 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); }
Modified: trunk/tagmanager/php.c =================================================================== --- trunk/tagmanager/php.c 2011-10-04 17:10:42 UTC (rev 5996) +++ trunk/tagmanager/php.c 2011-10-05 12:00:38 UTC (rev 5997) @@ -80,13 +80,8 @@ 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:]]*(\(.*\))", + "^[ \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:]]*(\(.*\))", - 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]*[=;]",
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.