• Home
  • Raw
  • Download

Lines Matching full:regex

4 Subject: [PATCH] regex: Do not mix PCRE2 Compile, Match, Newline and BSR flags
21 glib/tests/regex.c | 18 ++
193 GRegex *regex; /* the regex */
194 - GRegexMatchFlags match_opts; /* options used at match time on the regex */
195 + uint32_t match_opts; /* pcre match options used at match time on the regex */
197 gint n_subpatterns; /* total number of sub patterns in the regex */
206 - GRegexMatchFlags match_opts; /* options used at match time on the regex */
207 + uint32_t match_opts; /* pcre2 options used at match time on the regex */
210 JITStatus jit_status; /* indicates the status of jit compiler for this compiled regex */
538 -match_info_new (const GRegex *regex,
544 +match_info_new (const GRegex *regex,
553 @@ -761,7 +791,8 @@ match_info_new (const GRegex *regex,
559 + get_pcre2_match_options (match_options, regex->orig_compile_opts);
561 pcre2_pattern_info (regex->pcre_re, PCRE2_INFO_CAPTURECOUNT,
567 -enable_jit_with_match_options (GRegex *regex,
569 +enable_jit_with_match_options (GRegex *regex,
578 - opts = map_to_pcre2_match_flags (match_info->regex->match_opts | match_info->match_opts);
579 + opts = match_info->regex->match_opts | match_info->match_opts;
581 enable_jit_with_match_options (match_info->regex, opts);
582 if (match_info->regex->jit_status == JIT_STATUS_ENABLED)
601 @@ -1563,14 +1594,14 @@ g_regex_unref (GRegex *regex)
625 GRegex *regex;
688 regex = g_new0 (GRegex, 1);
689 regex->ref_count = 1;
690 regex->pattern = g_strdup (pattern);
691 regex->pcre_re = re;
692 - regex->compile_opts = compile_options;
693 - regex->orig_compile_opts = orig_compile_opts;
694 - regex->match_opts = match_options;
695 + regex->compile_opts = pcre_compile_options;
696 + regex->orig_compile_opts = compile_options;
697 + regex->match_opts = pcre_match_options;
698 + regex->orig_match_opts = match_options;
699 enable_jit_with_match_options (regex, regex->match_opts);
701 return regex;
840 @@ -1940,7 +1957,7 @@ g_regex_get_compile_flags (const GRegex *regex)
844 - return map_to_pcre1_compile_flags (regex->compile_opts) | extra_flags;
845 + return g_regex_compile_flags_from_pcre2 (regex->compile_opts) | extra_flags;
849 @@ -1956,9 +1973,15 @@ g_regex_get_compile_flags (const GRegex *regex)
851 g_regex_get_match_flags (const GRegex *regex)
855 g_return_val_if_fail (regex != NULL, 0);
857 - return map_to_pcre1_match_flags (regex->match_opts & G_REGEX_MATCH_MASK);
858 + flags = g_regex_match_flags_from_pcre2 (regex->match_opts);
859 + flags |= (regex->orig_match_opts & G_REGEX_MATCH_NEWLINE_MASK);
860 + flags |= (regex->orig_match_opts & (G_REGEX_MATCH_BSR_ANY | G_REGEX_MATCH_BSR_ANYCRLF));
867 GRegex *regex;
873 regex = g_regex_new (pattern, compile_options, G_REGEX_MATCH_DEFAULT, NULL);
874 if (!regex)
876 @@ -2062,8 +2082,6 @@ g_regex_match (const GRegex *regex,
882 return g_regex_match_full (regex, string, -1, 0, match_options,
885 @@ -2147,8 +2165,6 @@ g_regex_match_full (const GRegex *regex,
891 g_return_val_if_fail (regex != NULL, FALSE);
894 @@ -2199,8 +2215,6 @@ g_regex_match_all (const GRegex *regex,
900 return g_regex_match_all_full (regex, string, -1, 0, match_options,
903 @@ -2272,8 +2286,8 @@ g_regex_match_all_full (const GRegex *regex,
912 g_return_val_if_fail (regex != NULL, FALSE);
914 @@ -2281,6 +2295,14 @@ g_regex_match_all_full (const GRegex *regex,
920 + newline_options = get_pcre2_newline_compile_options (regex->orig_compile_opts);
924 + bsr_options = get_pcre2_bsr_compile_options (regex->orig_compile_opts);
927 * optimization for normal regex matching, but results in omitting some
929 @@ -2289,7 +2311,7 @@ g_regex_match_all_full (const GRegex *regex,
931 pcre_re = regex_compile (regex->pattern,
932 regex->compile_opts | PCRE2_NO_AUTO_POSSESS,
938 @@ -2303,7 +2325,7 @@ g_regex_match_all_full (const GRegex *regex,
942 - (regex->match_opts | match_options | PCRE2_NO_UTF_CHECK) & …
943 + (regex->match_opts | info->match_opts),
948 GRegex *regex;
954 regex = g_regex_new (pattern, compile_options, 0, NULL);
955 if (!regex)
957 @@ -2482,8 +2501,6 @@ g_regex_split (const GRegex *regex,
963 return g_regex_split_full (regex, string, -1, 0,
966 @@ -2548,8 +2565,6 @@ g_regex_split_full (const GRegex *regex,
972 g_return_val_if_fail (regex != NULL, NULL);
975 @@ -3174,8 +3189,6 @@ g_regex_replace (const GRegex *regex,
981 g_return_val_if_fail (regex != NULL, NULL);
984 @@ -3245,8 +3258,6 @@ g_regex_replace_literal (const GRegex *regex,
993 @@ -3335,8 +3346,6 @@ g_regex_replace_eval (const GRegex *regex,
999 g_return_val_if_fail (regex != NULL, NULL);
1002 diff --git a/glib/tests/regex.c b/glib/tests/regex.c
1004 --- a/glib/tests/regex.c
1005 +++ b/glib/tests/regex.c