Hi, As discussed in the "Compiler tab suggestions" thread, Geany regex error message parsing is buggy - it fetches the matching strings by index, but GRegex indexes all subgroups, returning empty string for the non-matching ones. So using | for alternatives does not work, and parsing a set of strings like:
filename:line:column: warning: passing argument # of 'function' from incompatible pointer type In file included from filename:line, from filename:line, ... from filename:line: filename:line:column: note: expected 'foo' but argument is of type 'bar' is either impossible, or requires a very complex expression. This is a regression caused by our switch to GRegex. Fix attached. Of course, it's a simple loop skipping the non-matching groups by their start position. Tested with both filename:line and line:filename. -- E-gards: Jimmy
>From d9ff8a53c7ce71aa0d7ab79f57897ec205d17dad Mon Sep 17 00:00:00 2001 From: Dimitar Zhekov <dimitar.zhe...@gmail.com> Date: Tue, 21 Jan 2014 20:22:28 +0200 Subject: [PATCH] fix regex error message parsing (GRegex indexes subgroups, not matches) --- src/filetypes.c | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/src/filetypes.c b/src/filetypes.c index 0048b34..4cd2eea 100644 --- a/src/filetypes.c +++ b/src/filetypes.c @@ -1627,11 +1627,27 @@ gboolean filetypes_parse_error_message(GeanyFiletype *ft, const gchar *message, } if (g_match_info_get_match_count(minfo) >= 3) { - gchar *first, *second, *end; + gchar *first = NULL, *second, *end; glong l; + gint i; + + for (i = 1; ; i++) + { + gint start_pos; + + g_match_info_fetch_pos(minfo, i, &start_pos, NULL); + if (start_pos != -1) + { + if (first == NULL) + first = g_match_info_fetch(minfo, i); + else + { + second = g_match_info_fetch(minfo, i); + break; + } + } + } - first = g_match_info_fetch(minfo, 1); - second = g_match_info_fetch(minfo, 2); l = strtol(first, &end, 10); if (*end == '\0') /* first is purely decimals */ { -- 1.8.5.2
_______________________________________________ Devel mailing list Devel@lists.geany.org https://lists.geany.org/cgi-bin/mailman/listinfo/devel