• Home
  • Raw
  • Download

Lines Matching refs:node

44 static reg_errcode_t optimize_subexps (void *extra, bin_tree_t *node);
45 static reg_errcode_t lower_subexps (void *extra, bin_tree_t *node);
47 bin_tree_t *node);
48 static reg_errcode_t calc_first (void *extra, bin_tree_t *node);
49 static reg_errcode_t calc_next (void *extra, bin_tree_t *node);
50 static reg_errcode_t link_nfa_nodes (void *extra, bin_tree_t *node);
56 Idx node, bool root);
122 static void free_token (re_token_t *node);
123 static reg_errcode_t free_tree (void *extra, bin_tree_t *node);
124 static reg_errcode_t mark_opt_subexp (void *extra, bin_tree_t *node);
318 Idx node = init_state->nodes.elems[node_cnt]; in re_compile_fastmap_iter() local
319 re_token_type_t type = dfa->nodes[node].type; in re_compile_fastmap_iter()
323 re_set_fastmap (fastmap, icase, dfa->nodes[node].opr.c); in re_compile_fastmap_iter()
333 *p++ = dfa->nodes[node].opr.c; in re_compile_fastmap_iter()
334 while (++node < dfa->nodes_len in re_compile_fastmap_iter()
335 && dfa->nodes[node].type == CHARACTER in re_compile_fastmap_iter()
336 && dfa->nodes[node].mb_partial) in re_compile_fastmap_iter()
337 *p++ = dfa->nodes[node].opr.c; in re_compile_fastmap_iter()
353 bitset_word_t w = dfa->nodes[node].opr.sbcset[i]; in re_compile_fastmap_iter()
362 re_charset_t *cset = dfa->nodes[node].opr.mbcset; in re_compile_fastmap_iter()
1062 Idx node; in optimize_utf8() local
1067 for (node = 0; node < dfa->nodes_len; ++node) in optimize_utf8()
1068 switch (dfa->nodes[node].type) in optimize_utf8()
1071 if (dfa->nodes[node].opr.c >= ASCII_CHARS) in optimize_utf8()
1075 switch (dfa->nodes[node].opr.ctx_type) in optimize_utf8()
1109 if (dfa->nodes[node].opr.sbcset[i] >> rshift != 0) in optimize_utf8()
1120 for (node = 0; node < dfa->nodes_len; ++node) in optimize_utf8()
1122 if (dfa->nodes[node].type == CHARACTER in optimize_utf8()
1123 && dfa->nodes[node].opr.c >= ASCII_CHARS) in optimize_utf8()
1124 dfa->nodes[node].mb_partial = 0; in optimize_utf8()
1125 else if (dfa->nodes[node].type == OP_PERIOD) in optimize_utf8()
1126 dfa->nodes[node].type = OP_UTF8_PERIOD; in optimize_utf8()
1206 bin_tree_t *node, *prev; in postorder() local
1208 for (node = root; ; ) in postorder()
1212 while (node->left || node->right) in postorder()
1213 if (node->left) in postorder()
1214 node = node->left; in postorder()
1216 node = node->right; in postorder()
1220 reg_errcode_t err = fn (extra, node); in postorder()
1223 if (node->parent == NULL) in postorder()
1225 prev = node; in postorder()
1226 node = node->parent; in postorder()
1229 while (node->right == prev || node->right == NULL); in postorder()
1230 node = node->right; in postorder()
1238 bin_tree_t *node; in preorder() local
1240 for (node = root; ; ) in preorder()
1242 reg_errcode_t err = fn (extra, node); in preorder()
1247 if (node->left) in preorder()
1248 node = node->left; in preorder()
1252 while (node->right == prev || node->right == NULL) in preorder()
1254 prev = node; in preorder()
1255 node = node->parent; in preorder()
1256 if (!node) in preorder()
1259 node = node->right; in preorder()
1268 optimize_subexps (void *extra, bin_tree_t *node) in optimize_subexps() argument
1272 if (node->token.type == OP_BACK_REF && dfa->subexp_map) in optimize_subexps()
1274 int idx = node->token.opr.idx; in optimize_subexps()
1275 node->token.opr.idx = dfa->subexp_map[idx]; in optimize_subexps()
1276 dfa->used_bkref_map |= 1 << node->token.opr.idx; in optimize_subexps()
1279 else if (node->token.type == SUBEXP in optimize_subexps()
1280 && node->left && node->left->token.type == SUBEXP) in optimize_subexps()
1282 Idx other_idx = node->left->token.opr.idx; in optimize_subexps()
1284 node->left = node->left->left; in optimize_subexps()
1285 if (node->left) in optimize_subexps()
1286 node->left->parent = node; in optimize_subexps()
1288 dfa->subexp_map[other_idx] = dfa->subexp_map[node->token.opr.idx]; in optimize_subexps()
1299 lower_subexps (void *extra, bin_tree_t *node) in lower_subexps() argument
1304 if (node->left && node->left->token.type == SUBEXP) in lower_subexps()
1306 node->left = lower_subexp (&err, preg, node->left); in lower_subexps()
1307 if (node->left) in lower_subexps()
1308 node->left->parent = node; in lower_subexps()
1310 if (node->right && node->right->token.type == SUBEXP) in lower_subexps()
1312 node->right = lower_subexp (&err, preg, node->right); in lower_subexps()
1313 if (node->right) in lower_subexps()
1314 node->right->parent = node; in lower_subexps()
1321 lower_subexp (reg_errcode_t *err, regex_t *preg, bin_tree_t *node) in lower_subexp() argument
1324 bin_tree_t *body = node->left; in lower_subexp()
1332 && node->left != NULL in lower_subexp()
1333 && (node->token.opr.idx >= BITSET_WORD_BITS in lower_subexp()
1335 & ((bitset_word_t) 1 << node->token.opr.idx)))) in lower_subexp()
1336 return node->left; in lower_subexp()
1350 op->token.opr.idx = cls->token.opr.idx = node->token.opr.idx; in lower_subexp()
1351 op->token.opt_subexp = cls->token.opt_subexp = node->token.opt_subexp; in lower_subexp()
1358 calc_first (void *extra, bin_tree_t *node) in calc_first() argument
1361 if (node->token.type == CONCAT) in calc_first()
1363 node->first = node->left->first; in calc_first()
1364 node->node_idx = node->left->node_idx; in calc_first()
1368 node->first = node; in calc_first()
1369 node->node_idx = re_dfa_add_node (dfa, node->token); in calc_first()
1370 if (BE (node->node_idx == REG_MISSING, 0)) in calc_first()
1372 if (node->token.type == ANCHOR) in calc_first()
1373 dfa->nodes[node->node_idx].constraint = node->token.opr.ctx_type; in calc_first()
1380 calc_next (void *extra, bin_tree_t *node) in calc_next() argument
1382 switch (node->token.type) in calc_next()
1385 node->left->next = node; in calc_next()
1388 node->left->next = node->right->first; in calc_next()
1389 node->right->next = node->next; in calc_next()
1392 if (node->left) in calc_next()
1393 node->left->next = node->next; in calc_next()
1394 if (node->right) in calc_next()
1395 node->right->next = node->next; in calc_next()
1403 link_nfa_nodes (void *extra, bin_tree_t *node) in link_nfa_nodes() argument
1406 Idx idx = node->node_idx; in link_nfa_nodes()
1409 switch (node->token.type) in link_nfa_nodes()
1415 assert (node->next == NULL); in link_nfa_nodes()
1423 if (node->left != NULL) in link_nfa_nodes()
1424 left = node->left->first->node_idx; in link_nfa_nodes()
1426 left = node->next->node_idx; in link_nfa_nodes()
1427 if (node->right != NULL) in link_nfa_nodes()
1428 right = node->right->first->node_idx; in link_nfa_nodes()
1430 right = node->next->node_idx; in link_nfa_nodes()
1440 err = re_node_set_init_1 (dfa->edests + idx, node->next->node_idx); in link_nfa_nodes()
1444 dfa->nexts[idx] = node->next->node_idx; in link_nfa_nodes()
1445 if (node->token.type == OP_BACK_REF) in link_nfa_nodes()
1450 assert (!IS_EPSILON_NODE (node->token.type)); in link_nfa_nodes()
1451 dfa->nexts[idx] = node->next->node_idx; in link_nfa_nodes()
1675 calc_eclosure_iter (re_node_set *new_set, re_dfa_t *dfa, Idx node, bool root) in calc_eclosure_iter() argument
1683 err = re_node_set_alloc (&eclosure, dfa->edests[node].nelem + 1); in calc_eclosure_iter()
1689 dfa->eclosures[node].nelem = REG_MISSING; in calc_eclosure_iter()
1693 if (dfa->nodes[node].constraint in calc_eclosure_iter()
1694 && dfa->edests[node].nelem in calc_eclosure_iter()
1695 && !dfa->nodes[dfa->edests[node].elems[0]].duplicated) in calc_eclosure_iter()
1697 err = duplicate_node_closure (dfa, node, node, node, in calc_eclosure_iter()
1698 dfa->nodes[node].constraint); in calc_eclosure_iter()
1704 if (IS_EPSILON_NODE(dfa->nodes[node].type)) in calc_eclosure_iter()
1705 for (i = 0; i < dfa->edests[node].nelem; ++i) in calc_eclosure_iter()
1708 Idx edest = dfa->edests[node].elems[i]; in calc_eclosure_iter()
1738 ok = re_node_set_insert (&eclosure, node); in calc_eclosure_iter()
1742 dfa->eclosures[node].nelem = 0; in calc_eclosure_iter()
1744 dfa->eclosures[node] = eclosure; in calc_eclosure_iter()
3776 mark_opt_subexp (void *extra, bin_tree_t *node) in mark_opt_subexp() argument
3780 if (node->token.type == SUBEXP && node->token.opr.idx == idx) in mark_opt_subexp()
3781 node->token.opt_subexp = 1; in mark_opt_subexp()
3789 free_token (re_token_t *node) in free_token() argument
3792 if (node->type == COMPLEX_BRACKET && node->duplicated == 0) in free_token()
3793 free_charset (node->opr.mbcset); in free_token()
3796 if (node->type == SIMPLE_BRACKET && node->duplicated == 0) in free_token()
3797 re_free (node->opr.sbcset); in free_token()
3804 free_tree (void *extra, bin_tree_t *node) in free_tree() argument
3806 free_token (&node->token); in free_tree()
3819 const bin_tree_t *node; in duplicate_tree() local
3823 for (node = root; ; ) in duplicate_tree()
3826 *p_new = create_token_tree (dfa, NULL, NULL, &node->token); in duplicate_tree()
3834 if (node->left) in duplicate_tree()
3836 node = node->left; in duplicate_tree()
3842 while (node->right == prev || node->right == NULL) in duplicate_tree()
3844 prev = node; in duplicate_tree()
3845 node = node->parent; in duplicate_tree()
3847 if (!node) in duplicate_tree()
3850 node = node->right; in duplicate_tree()