Lines Matching refs:preg
23 static reg_errcode_t re_compile_internal (regex_t *preg, const char * pattern,
32 static void free_workarea_compile (regex_t *preg);
37 static reg_errcode_t analyze (regex_t *preg);
46 static bin_tree_t *lower_subexp (reg_errcode_t *err, regex_t *preg,
62 static bin_tree_t *parse (re_string_t *regexp, regex_t *preg,
64 static bin_tree_t *parse_reg_exp (re_string_t *regexp, regex_t *preg,
67 static bin_tree_t *parse_branch (re_string_t *regexp, regex_t *preg,
70 static bin_tree_t *parse_expression (re_string_t *regexp, regex_t *preg,
73 static bin_tree_t *parse_sub_exp (re_string_t *regexp, regex_t *preg,
445 PREG is a regex_t *. We do not expect any fields to be initialized,
471 If REG_NOSUB is set, then when PREG is passed to regexec, that
479 regcomp (preg, pattern, cflags)
480 regex_t *_Restrict_ preg;
488 preg->buffer = NULL;
489 preg->allocated = 0;
490 preg->used = 0;
493 preg->fastmap = re_malloc (char, SBC_MAX);
494 if (BE (preg->fastmap == NULL, 0))
505 preg->newline_anchor = 1;
508 preg->newline_anchor = 0;
509 preg->no_sub = !!(cflags & REG_NOSUB);
510 preg->translate = NULL;
512 ret = re_compile_internal (preg, pattern, strlen (pattern), syntax);
519 /* We have already checked preg->fastmap != NULL. */
523 (void) re_compile_fastmap (preg);
527 re_free (preg->fastmap);
528 preg->fastmap = NULL;
538 from either regcomp or regexec. We don't use PREG here. */
542 regerror (errcode, preg, errbuf, errbuf_size)
544 const regex_t *_Restrict_ preg;
549 regerror (int errcode, const regex_t *_Restrict_ preg,
660 /* Free dynamically allocated space used by PREG. */
663 regfree (preg)
664 regex_t *preg;
666 re_dfa_t *dfa = (re_dfa_t *) preg->buffer;
669 preg->buffer = NULL;
670 preg->allocated = 0;
672 re_free (preg->fastmap);
673 preg->fastmap = NULL;
675 re_free (preg->translate);
676 preg->translate = NULL;
758 re_compile_internal (regex_t *preg, const char * pattern, size_t length,
766 preg->fastmap_accurate = 0;
767 preg->syntax = syntax;
768 preg->not_bol = preg->not_eol = 0;
769 preg->used = 0;
770 preg->re_nsub = 0;
771 preg->can_be_null = 0;
772 preg->regs_allocated = REGS_UNALLOCATED;
775 dfa = (re_dfa_t *) preg->buffer;
776 if (BE (preg->allocated < sizeof (re_dfa_t), 0))
782 dfa = re_realloc (preg->buffer, re_dfa_t, 1);
785 preg->allocated = sizeof (re_dfa_t);
786 preg->buffer = (unsigned char *) dfa;
788 preg->used = sizeof (re_dfa_t);
794 preg->buffer = NULL;
795 preg->allocated = 0;
806 err = re_string_construct (®exp, pattern, length, preg->translate,
811 free_workarea_compile (preg);
814 preg->buffer = NULL;
815 preg->allocated = 0;
820 preg->re_nsub = 0;
821 dfa->str_tree = parse (®exp, preg, syntax, &err);
826 err = analyze (preg);
832 if (dfa->is_utf8 && !(syntax & RE_ICASE) && preg->translate == NULL)
840 free_workarea_compile (preg);
846 preg->buffer = NULL;
847 preg->allocated = 0;
964 free_workarea_compile (regex_t *preg)
966 re_dfa_t *dfa = (re_dfa_t *) preg->buffer;
1147 analyze (regex_t *preg)
1149 re_dfa_t *dfa = (re_dfa_t *) preg->buffer;
1161 dfa->subexp_map = re_malloc (Idx, preg->re_nsub);
1165 for (i = 0; i < preg->re_nsub; i++)
1168 for (i = 0; i < preg->re_nsub; i++)
1171 if (i == preg->re_nsub)
1178 ret = postorder (dfa->str_tree, lower_subexps, preg);
1194 if ((!preg->no_sub && preg->re_nsub > 0 && dfa->has_plural_match)
1308 regex_t *preg = (regex_t *) extra;
1313 node->left = lower_subexp (&err, preg, node->left);
1319 node->right = lower_subexp (&err, preg, node->right);
1328 lower_subexp (reg_errcode_t *err, regex_t *preg, bin_tree_t *node)
1330 re_dfa_t *dfa = (re_dfa_t *) preg->buffer;
1334 if (preg->no_sub
2110 parse (re_string_t *regexp, regex_t *preg, reg_syntax_t syntax,
2113 re_dfa_t *dfa = (re_dfa_t *) preg->buffer;
2118 tree = parse_reg_exp (regexp, preg, ¤t_token, syntax, 0, err);
2144 parse_reg_exp (re_string_t *regexp, regex_t *preg, re_token_t *token,
2147 re_dfa_t *dfa = (re_dfa_t *) preg->buffer;
2149 tree = parse_branch (regexp, preg, token, syntax, nest, err);
2159 branch = parse_branch (regexp, preg, token, syntax, nest, err);
2185 parse_branch (re_string_t *regexp, regex_t *preg, re_token_t *token,
2189 re_dfa_t *dfa = (re_dfa_t *) preg->buffer;
2190 tree = parse_expression (regexp, preg, token, syntax, nest, err);
2197 expr = parse_expression (regexp, preg, token, syntax, nest, err);
2225 parse_expression (re_string_t *regexp, regex_t *preg, re_token_t *token,
2228 re_dfa_t *dfa = (re_dfa_t *) preg->buffer;
2259 tree = parse_sub_exp (regexp, preg, token, syntax, nest + 1, err);
2302 return parse_expression (regexp, preg, token, syntax, nest, err);
2441 parse_sub_exp (re_string_t *regexp, regex_t *preg, re_token_t *token,
2444 re_dfa_t *dfa = (re_dfa_t *) preg->buffer;
2447 cur_nsub = preg->re_nsub++;
2456 tree = parse_reg_exp (regexp, preg, token, syntax, nest, err);