MCPcopy Create free account
hub / github.com/git/git / parse

Function parse

compat/regex/regcomp.c:2117–2140  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2115 Parse the regular expression REGEXP and return the structure tree.
2116 If an error has occurred, ERR is set by error code, and return NULL.
2117 This function build the following tree, from regular expression <reg_exp>:
2118 CAT
2119 / \
2120 / \
2121 <reg_exp> EOR
2122
2123 CAT means concatenation.
2124 EOR means end of regular expression. */
2125
2126static bin_tree_t *
2127parse (re_string_t *regexp, regex_t *preg, reg_syntax_t syntax,
2128 reg_errcode_t *err)
2129{
2130 re_dfa_t *dfa = (re_dfa_t *) preg->buffer;
2131 bin_tree_t *tree, *eor, *root;
2132 re_token_t current_token;
2133 dfa->syntax = syntax;
2134 fetch_token (&current_token, regexp, syntax | RE_CARET_ANCHORS_HERE);
2135 tree = parse_reg_exp (regexp, preg, &current_token, syntax, 0, err);
2136 if (BE (*err != REG_NOERROR && tree == NULL, 0))
2137 return NULL;
2138 eor = create_tree (dfa, NULL, NULL, END_OF_RE);
2139 if (tree != NULL)
2140 root = create_tree (dfa, tree, eor, CONCAT);
2141 else
2142 root = eor;
2143 if (BE (eor == NULL || root == NULL, 0))

Callers 1

re_compile_internalFunction · 0.85

Calls 2

parse_reg_expFunction · 0.85
create_treeFunction · 0.85

Tested by

no test coverage detected