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

Function parse_branch

compat/regex/regcomp.c:2192–2224  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2190}
2191
2192/* This function build the following tree, from regular expression
2193 <exp1><exp2>:
2194 CAT
2195 / \
2196 / \
2197 <exp1> <exp2>
2198
2199 CAT means concatenation. */
2200
2201static bin_tree_t *
2202parse_branch (re_string_t *regexp, regex_t *preg, re_token_t *token,
2203 reg_syntax_t syntax, int nest, reg_errcode_t *err)
2204{
2205 bin_tree_t *tree, *exp;
2206 re_dfa_t *dfa = (re_dfa_t *) preg->buffer;
2207 tree = parse_expression (regexp, preg, token, syntax, nest, err);
2208 if (BE (*err != REG_NOERROR && tree == NULL, 0))
2209 return NULL;
2210
2211 while (token->type != OP_ALT && token->type != END_OF_RE
2212 && (nest == 0 || token->type != OP_CLOSE_SUBEXP))
2213 {
2214 exp = parse_expression (regexp, preg, token, syntax, nest, err);
2215 if (BE (*err != REG_NOERROR && exp == NULL, 0))
2216 {
2217 return NULL;
2218 }
2219 if (tree != NULL && exp != NULL)
2220 {
2221 tree = create_tree (dfa, tree, exp, CONCAT);
2222 if (tree == NULL)
2223 {
2224 *err = REG_ESPACE;
2225 return NULL;
2226 }
2227 }

Callers 1

parse_reg_expFunction · 0.85

Calls 2

parse_expressionFunction · 0.85
create_treeFunction · 0.85

Tested by

no test coverage detected