Pass 3: link all DFA nodes to their NEXT node (any order will do). */
| 1420 | node->left->next = node->next; |
| 1421 | if (node->right) |
| 1422 | node->right->next = node->next; |
| 1423 | break; |
| 1424 | } |
| 1425 | return REG_NOERROR; |
| 1426 | } |
| 1427 | |
| 1428 | /* Pass 3: link all DFA nodes to their NEXT node (any order will do). */ |
| 1429 | static reg_errcode_t |
| 1430 | link_nfa_nodes (void *extra, bin_tree_t *node) |
| 1431 | { |
| 1432 | re_dfa_t *dfa = (re_dfa_t *) extra; |
| 1433 | int idx = node->node_idx; |
| 1434 | reg_errcode_t err = REG_NOERROR; |
| 1435 | |
| 1436 | switch (node->token.type) |
| 1437 | { |
| 1438 | case CONCAT: |
| 1439 | break; |
| 1440 | |
| 1441 | case END_OF_RE: |
| 1442 | assert (node->next == NULL); |
| 1443 | break; |
| 1444 | |
| 1445 | case OP_DUP_ASTERISK: |
| 1446 | case OP_ALT: |
| 1447 | { |
| 1448 | int left, right; |
| 1449 | dfa->has_plural_match = 1; |
| 1450 | if (node->left != NULL) |
| 1451 | left = node->left->first->node_idx; |
| 1452 | else |
| 1453 | left = node->next->node_idx; |
| 1454 | if (node->right != NULL) |
| 1455 | right = node->right->first->node_idx; |
| 1456 | else |
| 1457 | right = node->next->node_idx; |
| 1458 | assert (left > -1); |
| 1459 | assert (right > -1); |
| 1460 | err = re_node_set_init_2 (dfa->edests + idx, left, right); |
| 1461 | } |
| 1462 | break; |
| 1463 | |
| 1464 | case ANCHOR: |
| 1465 | case OP_OPEN_SUBEXP: |
| 1466 | case OP_CLOSE_SUBEXP: |
| 1467 | err = re_node_set_init_1 (dfa->edests + idx, node->next->node_idx); |
| 1468 | break; |
| 1469 | |
| 1470 | case OP_BACK_REF: |
| 1471 | dfa->nexts[idx] = node->next->node_idx; |
| 1472 | if (node->token.type == OP_BACK_REF) |
| 1473 | err = re_node_set_init_1 (dfa->edests + idx, dfa->nexts[idx]); |
| 1474 | break; |
| 1475 | |
| 1476 | default: |
| 1477 | assert (!IS_EPSILON_NODE (node->token.type)); |
| 1478 | dfa->nexts[idx] = node->next->node_idx; |
| 1479 | break; |
nothing calls this directly
no test coverage detected