Lines Matching refs:idx
24 Idx n) internal_function;
27 static reg_errcode_t match_ctx_add_entry (re_match_context_t *cache, Idx node,
28 Idx str_idx, Idx from, Idx to)
30 static Idx search_cur_bkref_entry (const re_match_context_t *mctx, Idx str_idx)
32 static reg_errcode_t match_ctx_add_subtop (re_match_context_t *mctx, Idx node,
33 Idx str_idx) internal_function;
35 Idx node, Idx str_idx)
38 re_dfastate_t **limited_sts, Idx last_node,
39 Idx last_str_idx)
42 const char *string, Idx length,
43 Idx start, Idx last_start, Idx stop,
47 const char *string1, Idx length1,
48 const char *string2, Idx length2,
49 Idx start, regoff_t range,
51 Idx stop, bool ret_len) internal_function;
53 const char *string, Idx length, Idx start,
54 regoff_t range, Idx stop,
58 Idx nregs, int regs_allocated)
62 static Idx check_matching (re_match_context_t *mctx, bool fl_longest_match,
63 Idx *p_match_first) internal_function;
64 static Idx check_halt_state_context (const re_match_context_t *mctx,
65 const re_dfastate_t *state, Idx idx)
68 regmatch_t *prev_idx_match, Idx cur_node,
69 Idx cur_idx, Idx nmatch) internal_function;
71 Idx str_idx, Idx dest_node, Idx nregs,
85 Idx node_idx, Idx str_idx, Idx max_str_idx)
92 re_sift_context_t *sctx, Idx str_idx,
97 Idx str_idx,
106 Idx dst_node, Idx dst_idx, Idx src_node,
107 Idx src_idx) internal_function;
109 int boundaries, Idx subexp_idx,
110 Idx from_node, Idx bkref_idx)
113 Idx limit, Idx subexp_idx,
114 Idx node, Idx str_idx,
115 Idx bkref_idx) internal_function;
121 Idx str_idx) internal_function;
124 Idx str_idx, const re_node_set *candidates)
128 re_dfastate_t **src, Idx num)
141 Idx str_idx) internal_function;
157 Idx bkref_node, Idx bkref_str_idx)
162 Idx bkref_node, Idx bkref_str)
164 static Idx find_subexp_node (const re_dfa_t *dfa, const re_node_set *nodes,
165 Idx subexp_idx, int type) internal_function;
167 state_array_t *path, Idx top_node,
168 Idx top_str, Idx last_node, Idx last_str,
171 Idx str_idx,
177 Idx ex_subexp, int type)
181 Idx target, Idx ex_subexp,
184 re_node_set *cur_nodes, Idx cur_str,
185 Idx subexp_num, int type)
190 static int check_node_accept_bytes (const re_dfa_t *dfa, Idx node_idx,
191 const re_string_t *input, Idx idx)
199 static Idx group_nodes_into_DFAstates (const re_dfa_t *dfa,
204 const re_token_t *node, Idx idx)
235 Idx start, length;
318 Idx length, start;
331 Idx length, start;
346 Idx length1, length2, start, stop;
360 Idx length1, length2, start, stop;
374 const char *string1, Idx length1,
375 const char *string2, Idx length2,
376 Idx start, regoff_t range, struct re_registers *regs,
377 Idx stop, bool ret_len)
381 Idx len = length1 + length2;
422 const char *string, Idx length,
423 Idx start, regoff_t range, Idx stop, struct re_registers *regs,
428 Idx nregs;
434 Idx last_start = start + range;
514 re_copy_regs (struct re_registers *regs, regmatch_t *pmatch, Idx nregs,
518 Idx i;
519 Idx need_regs = nregs + 1;
647 const char *string, Idx length,
648 Idx start, Idx last_start, Idx stop,
654 Idx left_lim, right_lim;
658 Idx match_first;
659 Idx match_last = REG_MISSING;
660 Idx extra_nmatch;
909 Idx reg_idx;
984 Idx halt_node, match_last;
1078 Idx idx)
1084 context = re_string_context_at (&mctx->input, idx - 1, mctx->eflags);
1117 static Idx
1120 Idx *p_match_first)
1124 Idx match = 0;
1125 Idx match_last = REG_MISSING;
1126 Idx cur_str_idx = re_string_cur_idx (&mctx->input);
1129 Idx next_start_idx = cur_str_idx;
1181 Idx next_char_idx = re_string_cur_idx (&mctx->input) + 1;
1251 check_halt_node_context (const re_dfa_t *dfa, Idx node, unsigned int context)
1268 static Idx
1271 const re_dfastate_t *state, Idx idx)
1273 Idx i;
1278 context = re_string_context_at (&mctx->input, idx, mctx->eflags);
1290 static Idx
1292 proceed_next_node (const re_match_context_t *mctx, Idx nregs, regmatch_t *regs,
1293 Idx *pidx, Idx node, re_node_set *eps_via_nodes,
1297 Idx i;
1303 Idx dest_node;
1311 Idx candidate = edests->elems[i];
1338 Idx naccepted = 0;
1348 Idx subexp_idx = dfa->nodes[node].opr.idx + 1;
1365 Idx dest_node;
1379 Idx dest_node = dfa->nexts[node];
1394 push_fail_stack (struct re_fail_stack_t *fs, Idx str_idx, Idx dest_node,
1395 Idx nregs, regmatch_t *regs, re_node_set *eps_via_nodes)
1398 Idx num = fs->num++;
1409 fs->stack[num].idx = str_idx;
1419 static Idx
1421 pop_fail_stack (struct re_fail_stack_t *fs, Idx *pidx, Idx nregs,
1424 Idx num = --fs->num;
1426 *pidx = fs->stack[num].idx;
1445 Idx idx, cur_node;
1483 for (idx = pmatch[0].rm_so; idx <= pmatch[0].rm_eo ;)
1485 update_regs (dfa, pmatch, prev_idx_match, cur_node, idx, nmatch);
1487 if (idx == pmatch[0].rm_eo && cur_node == mctx->last_node)
1489 Idx reg_idx;
1502 cur_node = pop_fail_stack (fs, &idx, nmatch, pmatch,
1515 cur_node = proceed_next_node (mctx, nmatch, pmatch, &idx, cur_node,
1529 cur_node = pop_fail_stack (fs, &idx, nmatch, pmatch,
1552 Idx fs_idx;
1566 regmatch_t *prev_idx_match, Idx cur_node, Idx cur_idx, Idx nmatch)
1571 Idx reg_num = dfa->nodes[cur_node].opr.idx + 1;
1582 Idx reg_num = dfa->nodes[cur_node].opr.idx + 1;
1641 Idx str_idx = sctx->last_str_idx;
1696 Idx str_idx, re_node_set *cur_dest)
1700 Idx i;
1711 Idx prev_node = cur_src->elems[i];
1739 Idx to_idx = str_idx + naccepted;
1757 clean_state_log_if_needed (re_match_context_t *mctx, Idx next_state_log_idx)
1759 Idx top = mctx->state_log_top;
1783 re_dfastate_t **src, Idx num)
1785 Idx st_idx;
1810 re_sift_context_t *sctx, Idx str_idx,
1861 Idx i;
1882 sub_epsilon_src_nodes (const re_dfa_t *dfa, Idx node, re_node_set *dest_nodes,
1885 Idx ecl_idx;
1892 Idx cur_node = inv_eclosure->elems[ecl_idx];
1897 Idx edst1 = dfa->edests[cur_node].elems[0];
1898 Idx edst2 = ((dfa->edests[cur_node].nelem > 1)
1918 Idx cur_node = inv_eclosure->elems[ecl_idx];
1921 Idx idx = re_node_set_contains (dest_nodes, cur_node) - 1;
1922 re_node_set_remove_at (dest_nodes, idx);
1932 Idx dst_node, Idx dst_idx, Idx src_node, Idx src_idx)
1935 Idx lim_idx, src_pos, dst_pos;
1937 Idx dst_bkref_idx = search_cur_bkref_entry (mctx, dst_idx);
1938 Idx src_bkref_idx = search_cur_bkref_entry (mctx, src_idx);
1941 Idx subexp_idx;
1944 subexp_idx = dfa->nodes[ent->node].opr.idx;
1968 Idx subexp_idx, Idx from_node, Idx bkref_idx)
1972 Idx node_idx;
1978 Idx node = eclosures->elems[node_idx];
1987 Idx dst;
2030 if ((boundaries & 1) && subexp_idx == dfa->nodes[node].opr.idx)
2035 if ((boundaries & 2) && subexp_idx == dfa->nodes[node].opr.idx)
2049 check_dst_limits_calc_pos (const re_match_context_t *mctx, Idx limit,
2050 Idx subexp_idx, Idx from_node, Idx str_idx,
2051 Idx bkref_idx)
2081 struct re_backref_cache_entry *bkref_ents, Idx str_idx)
2084 Idx node_idx, lim_idx;
2088 Idx subexp_idx;
2095 subexp_idx = dfa->nodes[ent->node].opr.idx;
2098 Idx ops_node = REG_MISSING;
2099 Idx cls_node = REG_MISSING;
2102 Idx node = dest_nodes->elems[node_idx];
2105 && subexp_idx == dfa->nodes[node].opr.idx)
2108 && subexp_idx == dfa->nodes[node].opr.idx)
2126 Idx node = dest_nodes->elems[node_idx];
2146 Idx node = dest_nodes->elems[node_idx];
2150 if (subexp_idx != dfa->nodes[node].opr.idx)
2168 Idx str_idx, const re_node_set *candidates)
2172 Idx node_idx, node;
2174 Idx first_idx = search_cur_bkref_entry (mctx, str_idx);
2183 Idx enabled_idx;
2198 Idx subexp_len;
2199 Idx to_idx;
2200 Idx dst_node;
2268 Idx node_idx, Idx str_idx, Idx max_str_idx)
2360 Idx cur_idx = re_string_cur_idx (&mctx->input);
2440 Idx max = mctx->state_log_top;
2441 Idx cur_str_idx = re_string_cur_idx (&mctx->input);
2467 Idx str_idx)
2470 Idx node_idx;
2480 Idx node = cur_nodes->elems[node_idx];
2482 && dfa->nodes[node].opr.idx < BITSET_WORD_BITS
2484 & ((bitset_word_t) 1 << dfa->nodes[node].opr.idx)))
2505 Idx node_cnt, cur_str_idx = re_string_cur_idx (&mctx->input);
2513 Idx cur_node = state->nodes.elems[node_cnt];
2543 Idx i;
2548 Idx cur_node_idx = pstate->nodes.elems[i];
2550 Idx dest_idx;
2614 Idx i;
2615 Idx cur_str_idx = re_string_cur_idx (&mctx->input);
2619 Idx dest_str_idx, prev_nelem, bkc_idx;
2620 Idx node_idx = nodes->elems[i];
2651 Idx subexp_len;
2724 get_subexp (re_match_context_t *mctx, IdxIdx bkref_str_idx)
2727 Idx subexp_num, sub_top_idx;
2730 Idx cache_idx = search_cur_bkref_entry (mctx, bkref_str_idx);
2741 subexp_num = dfa->nodes[bkref_node].opr.idx;
2749 Idx sub_last_idx, sl_str, bkref_str_off;
2751 if (dfa->nodes[sub_top->node].opr.idx != subexp_num)
2806 Idx cls_node;
2875 re_sub_match_last_t *sub_last, Idx bkref_node, Idx bkref_str)
2878 Idx to_idx;
2901 static Idx
2904 Idx subexp_idx, int type)
2906 Idx cls_idx;
2909 Idx cls_node = nodes->elems[cls_idx];
2912 && node->opr.idx == subexp_idx)
2925 check_arrival (re_match_context_t *mctx, state_array_t *path, Idx top_node,
2926 Idx top_str, Idx last_node, Idx last_str, int type)
2930 Idx subexp_num, backup_cur_idx, str_idx, null_cnt;
2936 subexp_num = dfa->nodes[top_node].opr.idx;
2941 Idx old_alloc = path->alloc;
2942 Idx new_alloc = old_alloc + last_str + mctx->max_mb_elem_len + 1;
3087 check_arrival_add_next_nodes (re_match_context_t *mctx, Idx str_idx,
3092 Idx cur_idx;
3101 Idx cur_node = cur_nodes->elems[cur_idx];
3115 Idx next_node = dfa->nexts[cur_node];
3116 Idx next_idx = str_idx + naccepted;
3169 Idx ex_subexp, int type)
3172 Idx idx, outside_node;
3183 for (idx = 0; idx < cur_nodes->nelem; ++idx)
3185 Idx cur_node = cur_nodes->elems[idx];
3222 Idx target, Idx ex_subexp, int type)
3224 Idx cur_node;
3230 && dfa->nodes[cur_node].opr.idx == ex_subexp)
3267 Idx cur_str, Idx subexp_num, int type)
3271 Idx
3281 Idx to_idx, next_node;
3358 Idx i, j;
3364 Idx ndests; /* Number of the destination states from `state'. */
3452 Idx next_node;
3588 static Idx
3595 Idx i, j, k;
3596 Idx ndests; /* Number of the destinations from `state'. */
3783 check_node_accept_bytes (const re_dfa_t *dfa, Idx node_idx,
3784 const re_string_t *input, Idx str_idx)
3788 Idx i;
3867 Idx j;
3900 int32_t idx;
3958 idx = findidx (&cp);
3959 if (idx > 0)
3963 size_t weight_len = weights[idx];
3966 Idx cnt = 0;
3969 == weights[idx + 1 + cnt]))
4035 int32_t idx;
4041 for (idx = 0; idx < extrasize;)
4047 idx = idx + extra[idx] + 1;
4048 elem_mbs_len = extra[idx++];
4052 if (extra[idx + mbs_cnt] != mbs[mbs_cnt])
4059 idx += elem_mbs_len;
4061 idx = (idx + 3) & ~3;
4063 idx += sizeof (uint32_t);
4065 idx = idx + sizeof (uint32_t) * (extra[idx] + 1);
4068 return *(uint32_t *) (extra + idx);
4070 idx += sizeof (uint32_t);
4078 /* Check whether the node accepts the byte which is IDX-th
4084 Idx idx)
4087 ch = re_string_byte_at (&mctx->input, idx);
4120 unsigned int context = re_string_context_at (&mctx->input, idx,
4197 match_ctx_init (re_match_context_t *mctx, int eflags, Idx n)
4234 Idx st_idx;
4237 Idx sl_idx;
4277 match_ctx_add_entry (re_match_context_t *mctx, Idx node, Idx str_idx, Idx from,
4278 Idx to)
4324 static Idx
4326 search_cur_bkref_entry (const re_match_context_t *mctx, Idx str_idx)
4328 Idx left, right, mid, last;
4349 match_ctx_add_subtop (re_match_context_t *mctx, Idx node, Idx str_idx)
4357 Idx new_asub_tops = mctx->asub_tops * 2;
4379 match_ctx_add_sublast (re_sub_match_top_t *subtop, Idx node, Idx str_idx)
4384 Idx new_alasts = 2 * subtop->alasts + 1;
4407 re_dfastate_t **limited_sts, Idx last_node, Idx last_str_idx)