| 2446 | |
| 2447 | return tree; |
| 2448 | } |
| 2449 | |
| 2450 | /* This function build the following tree, from regular expression |
| 2451 | (<reg_exp>): |
| 2452 | SUBEXP |
| 2453 | | |
| 2454 | <reg_exp> |
| 2455 | */ |
| 2456 | |
| 2457 | static bin_tree_t * |
| 2458 | parse_sub_exp (re_string_t *regexp, regex_t *preg, re_token_t *token, |
| 2459 | reg_syntax_t syntax, int nest, reg_errcode_t *err) |
| 2460 | { |
| 2461 | re_dfa_t *dfa = (re_dfa_t *) preg->buffer; |
| 2462 | bin_tree_t *tree; |
| 2463 | size_t cur_nsub; |
| 2464 | cur_nsub = preg->re_nsub++; |
| 2465 | |
| 2466 | fetch_token (token, regexp, syntax | RE_CARET_ANCHORS_HERE); |
| 2467 | |
| 2468 | /* The subexpression may be a null string. */ |
| 2469 | if (token->type == OP_CLOSE_SUBEXP) |
| 2470 | tree = NULL; |
| 2471 | else |
| 2472 | { |
| 2473 | tree = parse_reg_exp (regexp, preg, token, syntax, nest, err); |
| 2474 | if (BE (*err == REG_NOERROR && token->type != OP_CLOSE_SUBEXP, 0)) |
| 2475 | *err = REG_EPAREN; |
| 2476 | if (BE (*err != REG_NOERROR, 0)) |
| 2477 | return NULL; |
| 2478 | } |
| 2479 | |
| 2480 | if (cur_nsub <= '9' - '1') |
| 2481 | dfa->completed_bkref_map |= 1 << cur_nsub; |
| 2482 | |
| 2483 | tree = create_tree (dfa, tree, NULL, SUBEXP); |
| 2484 | if (BE (tree == NULL, 0)) |
| 2485 | { |
no test coverage detected