[gtksourceview] implregex: track the number of subpatterns
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtksourceview] implregex: track the number of subpatterns
- Date: Fri, 2 Jul 2021 22:07:54 +0000 (UTC)
commit 92ff797bff1eb5130e2d3c53e199d3569eebd4e9
Author: Christian Hergert <chergert redhat com>
Date: Fri Jul 2 14:29:45 2021 -0700
implregex: track the number of subpatterns
This comes from GRegex and will be used later on.
gtksourceview/implregex.c | 3 +++
1 file changed, 3 insertions(+)
---
diff --git a/gtksourceview/implregex.c b/gtksourceview/implregex.c
index d018ea07..273e8af7 100644
--- a/gtksourceview/implregex.c
+++ b/gtksourceview/implregex.c
@@ -75,6 +75,7 @@ struct _ImplMatchInfo
pcre2_match_data *match_data;
PCRE2_SIZE *offsets;
int matches;
+ PCRE2_SIZE n_subpatterns;
gssize start_pos;
};
@@ -297,6 +298,8 @@ impl_match_info_new (ImplRegex *regex,
match_info->string_len = string_len;
match_info->match_data = pcre2_match_data_create_from_pattern (regex->code, NULL);
+ pcre2_pattern_info (regex->code, PCRE2_INFO_CAPTURECOUNT, &match_info->n_subpatterns);
+
if (match_info->match_data == NULL)
{
g_error ("Failed to allocate match data");
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]