Lines Matching refs:reg
896 #define STACK_NULL_CHECK_MEMST(isnull,id,s,reg) do {\ argument
915 if (BIT_STATUS_AT(reg->bt_mem_end, k->u.mem.num))\
935 #define STACK_NULL_CHECK_MEMST_REC(isnull,id,s,reg) do {\ argument
956 if (BIT_STATUS_AT(reg->bt_mem_end, k->u.mem.num))\
1088 StackType* stk_top, UChar* str, regex_t* reg) in make_capture_history_tree() argument
1098 BIT_STATUS_AT(reg->capture_history, n) != 0) { in make_capture_history_tree()
1106 r = make_capture_history_tree(child, kp, stk_top, str, reg); in make_capture_history_tree()
1140 static int backref_match_at_nested_level(regex_t* reg in backref_match_at_nested_level() argument
1169 if (string_cmp_ic(reg->enc, ambig_flag, in backref_match_at_nested_level()
1202 regex_t* reg; member
1213 ONIG_STATE_DEC_THREAD(ta->reg); in trap_ensure()
1236 onig_exec_trap(regex_t* reg, MatchArg* msa, StackType* stk_base) in onig_exec_trap() argument
1242 ta.reg = reg; in onig_exec_trap()
1252 onig_exec_trap(reg, msa, stk_base);\
1423 match_at(regex_t* reg, const UChar* str, const UChar* end, const UChar* sstart, in match_at() argument
1432 OnigOptionType option = reg->options; in match_at()
1433 OnigEncoding encode = reg->enc; in match_at()
1434 OnigAmbigType ambig_flag = reg->ambig_flag; in match_at()
1436 UChar *p = reg->p; in match_at()
1446 int num_comb_exp_check = reg->num_comb_exp_check; in match_at()
1448 n = reg->num_repeat + reg->num_mem * 2; in match_at()
1451 pop_level = reg->stack_pop_level; in match_at()
1452 num_mem = reg->num_mem; in match_at()
1455 mem_start_stk = (StackIndex* )(repeat_stk + reg->num_repeat); in match_at()
1523 if (BIT_STATUS_AT(reg->bt_mem_start, i)) in match_at()
1528 rmt[i].rm_eo = (BIT_STATUS_AT(reg->bt_mem_end, i) in match_at()
1543 if (BIT_STATUS_AT(reg->bt_mem_start, i)) in match_at()
1548 region->end[i] = (BIT_STATUS_AT(reg->bt_mem_end, i) in match_at()
1558 if (reg->capture_history != 0) { in match_at()
1577 stk, (UChar* )str, reg); in match_at()
2299 if (BIT_STATUS_AT(reg->bt_mem_start, mem)) in match_at()
2333 if (BIT_STATUS_AT(reg->bt_mem_start, mem)) in match_at()
2338 pend = (BIT_STATUS_AT(reg->bt_mem_end, mem) in match_at()
2365 if (BIT_STATUS_AT(reg->bt_mem_start, mem)) in match_at()
2370 pend = (BIT_STATUS_AT(reg->bt_mem_end, mem) in match_at()
2397 if (BIT_STATUS_AT(reg->bt_mem_start, mem)) in match_at()
2402 pend = (BIT_STATUS_AT(reg->bt_mem_end, mem) in match_at()
2436 if (BIT_STATUS_AT(reg->bt_mem_start, mem)) in match_at()
2441 pend = (BIT_STATUS_AT(reg->bt_mem_end, mem) in match_at()
2475 if (backref_match_at_nested_level(reg, stk, stk_base, ic, ambig_flag in match_at()
2553 STACK_NULL_CHECK_MEMST(isnull, mem, s, reg); in match_at()
2576 STACK_NULL_CHECK_MEMST_REC(isnull, mem, s, reg); in match_at()
2690 if (reg->repeat_range[mem].lower == 0) { in match_at()
2707 if (reg->repeat_range[mem].lower == 0) { in match_at()
2723 if (stkp->u.repeat.count >= reg->repeat_range[mem].upper) { in match_at()
2726 else if (stkp->u.repeat.count >= reg->repeat_range[mem].lower) { in match_at()
2753 if (stkp->u.repeat.count < reg->repeat_range[mem].upper) { in match_at()
2754 if (stkp->u.repeat.count >= reg->repeat_range[mem].lower) { in match_at()
2765 else if (stkp->u.repeat.count == reg->repeat_range[mem].upper) { in match_at()
2857 p = reg->p + addr; in match_at()
3062 bm_search_notrev(regex_t* reg, const UChar* target, const UChar* target_end, in bm_search_notrev() argument
3083 if (IS_NULL(reg->int_map)) { in bm_search_notrev()
3092 skip = reg->map[*se]; in bm_search_notrev()
3095 s += enc_len(reg->enc, s); in bm_search_notrev()
3108 skip = reg->int_map[*se]; in bm_search_notrev()
3111 s += enc_len(reg->enc, s); in bm_search_notrev()
3120 bm_search(regex_t* reg, const UChar* target, const UChar* target_end, in bm_search() argument
3132 if (IS_NULL(reg->int_map)) { in bm_search()
3140 s += reg->map[*s]; in bm_search()
3151 s += reg->int_map[*s]; in bm_search()
3179 bm_search_backward(regex_t* reg, const UChar* target, const UChar* target_end, in bm_search_backward() argument
3189 s = ONIGENC_LEFT_ADJUST_CHAR_HEAD(reg->enc, adjust_text, s); in bm_search_backward()
3200 s -= reg->int_map_backward[*s]; in bm_search_backward()
3201 s = ONIGENC_LEFT_ADJUST_CHAR_HEAD(reg->enc, adjust_text, s); in bm_search_backward()
3237 onig_match(regex_t* reg, const UChar* str, const UChar* end, const UChar* at, OnigRegion* region, in onig_match() argument
3247 if (ONIG_STATE(reg) >= ONIG_STATE_NORMAL) { in onig_match()
3248 ONIG_STATE_INC(reg); in onig_match()
3249 if (IS_NOT_NULL(reg->chain) && ONIG_STATE(reg) == ONIG_STATE_NORMAL) { in onig_match()
3250 onig_chain_reduce(reg); in onig_match()
3251 ONIG_STATE_INC(reg); in onig_match()
3259 while (ONIG_STATE(reg) < ONIG_STATE_NORMAL) { in onig_match()
3273 STATE_CHECK_BUFF_INIT(msa, end - str, offset, reg->num_comb_exp_check); in onig_match()
3282 r = onig_region_resize_clear(region, reg->num_mem + 1); in onig_match()
3288 prev = (UChar* )onigenc_get_prev_char_head(reg->enc, str, at); in onig_match()
3289 r = match_at(reg, str, end, at, prev, &msa); in onig_match()
3293 ONIG_STATE_DEC_THREAD(reg); in onig_match()
3298 forward_search_range(regex_t* reg, const UChar* str, const UChar* end, UChar* s, in forward_search_range() argument
3309 if (reg->dmin > 0) { in forward_search_range()
3310 if (ONIGENC_IS_SINGLEBYTE(reg->enc)) { in forward_search_range()
3311 p += reg->dmin; in forward_search_range()
3314 UChar *q = p + reg->dmin; in forward_search_range()
3315 while (p < q) p += enc_len(reg->enc, p); in forward_search_range()
3320 switch (reg->optimize) { in forward_search_range()
3322 p = slow_search(reg->enc, reg->exact, reg->exact_end, p, end, range); in forward_search_range()
3325 p = slow_search_ic(reg->enc, reg->ambig_flag, in forward_search_range()
3326 reg->exact, reg->exact_end, p, end, range); in forward_search_range()
3330 p = bm_search(reg, reg->exact, reg->exact_end, p, end, range); in forward_search_range()
3334 p = bm_search_notrev(reg, reg->exact, reg->exact_end, p, end, range); in forward_search_range()
3338 p = map_search(reg->enc, reg->map, p, range); in forward_search_range()
3343 if (p - reg->dmin < s) { in forward_search_range()
3346 p += enc_len(reg->enc, p); in forward_search_range()
3350 if (reg->sub_anchor) { in forward_search_range()
3353 switch (reg->sub_anchor) { in forward_search_range()
3356 prev = onigenc_get_prev_char_head(reg->enc, in forward_search_range()
3358 if (!ONIGENC_IS_MBC_NEWLINE(reg->enc, prev, end)) in forward_search_range()
3365 prev = (UChar* )onigenc_get_prev_char_head(reg->enc, in forward_search_range()
3367 if (prev && ONIGENC_IS_MBC_NEWLINE(reg->enc, prev, end)) in forward_search_range()
3370 else if (! ONIGENC_IS_MBC_NEWLINE(reg->enc, p, end) in forward_search_range()
3372 && ! ONIGENC_IS_MBC_CRNL(reg->enc, p, end) in forward_search_range()
3380 if (reg->dmax == 0) { in forward_search_range()
3384 *low_prev = onigenc_get_prev_char_head(reg->enc, s, p); in forward_search_range()
3386 *low_prev = onigenc_get_prev_char_head(reg->enc, in forward_search_range()
3391 if (reg->dmax != ONIG_INFINITE_DISTANCE) { in forward_search_range()
3392 *low = p - reg->dmax; in forward_search_range()
3394 *low = onigenc_get_right_adjust_char_head_with_prev(reg->enc, s, in forward_search_range()
3397 *low_prev = onigenc_get_prev_char_head(reg->enc, in forward_search_range()
3402 *low_prev = onigenc_get_prev_char_head(reg->enc, in forward_search_range()
3408 *high = p - reg->dmin; in forward_search_range()
3413 (int )(*low - str), (int )(*high - str), reg->dmin, reg->dmax); in forward_search_range()
3427 backward_search_range(regex_t* reg, const UChar* str, const UChar* end, in backward_search_range() argument
3434 range += reg->dmin; in backward_search_range()
3438 switch (reg->optimize) { in backward_search_range()
3441 p = slow_search_backward(reg->enc, reg->exact, reg->exact_end, in backward_search_range()
3446 p = slow_search_backward_ic(reg->enc, reg->ambig_flag, in backward_search_range()
3447 reg->exact, reg->exact_end, in backward_search_range()
3453 if (IS_NULL(reg->int_map_backward)) { in backward_search_range()
3457 r = set_bm_backward_skip(reg->exact, reg->exact_end, reg->enc, in backward_search_range()
3458 &(reg->int_map_backward)); in backward_search_range()
3461 p = bm_search_backward(reg, reg->exact, reg->exact_end, range, adjrange, in backward_search_range()
3466 p = map_search_backward(reg->enc, reg->map, range, adjrange, p); in backward_search_range()
3471 if (reg->sub_anchor) { in backward_search_range()
3474 switch (reg->sub_anchor) { in backward_search_range()
3477 prev = onigenc_get_prev_char_head(reg->enc, str, p); in backward_search_range()
3478 if (!ONIGENC_IS_MBC_NEWLINE(reg->enc, prev, end)) { in backward_search_range()
3487 prev = onigenc_get_prev_char_head(reg->enc, adjrange, p); in backward_search_range()
3489 if (ONIGENC_IS_MBC_NEWLINE(reg->enc, prev, end)) { in backward_search_range()
3494 else if (! ONIGENC_IS_MBC_NEWLINE(reg->enc, p, end) in backward_search_range()
3496 && ! ONIGENC_IS_MBC_CRNL(reg->enc, p, end) in backward_search_range()
3499 p = onigenc_get_prev_char_head(reg->enc, adjrange, p); in backward_search_range()
3508 if (reg->dmax != ONIG_INFINITE_DISTANCE) { in backward_search_range()
3509 *low = p - reg->dmax; in backward_search_range()
3510 *high = p - reg->dmin; in backward_search_range()
3511 *high = onigenc_get_right_adjust_char_head(reg->enc, adjrange, *high); in backward_search_range()
3530 onig_search(regex_t* reg, const UChar* str, const UChar* end, in onig_search() argument
3541 if (ONIG_STATE(reg) >= ONIG_STATE_NORMAL) { in onig_search()
3542 ONIG_STATE_INC(reg); in onig_search()
3543 if (IS_NOT_NULL(reg->chain) && ONIG_STATE(reg) == ONIG_STATE_NORMAL) { in onig_search()
3544 onig_chain_reduce(reg); in onig_search()
3545 ONIG_STATE_INC(reg); in onig_search()
3553 while (ONIG_STATE(reg) < ONIG_STATE_NORMAL) { in onig_search()
3574 r = onig_region_resize_clear(region, reg->num_mem + 1); in onig_search()
3582 r = match_at(reg, str, end, s, prev, &msa);\ in onig_search()
3585 if (! IS_FIND_LONGEST(reg->options)) {\ in onig_search()
3593 r = match_at(reg, str, end, s, prev, &msa);\ in onig_search()
3603 if (reg->anchor != 0 && str < end) { in onig_search()
3606 if (reg->anchor & ANCHOR_BEGIN_POSITION) { in onig_search()
3614 else if (reg->anchor & ANCHOR_BEGIN_BUF) { in onig_search()
3629 else if (reg->anchor & ANCHOR_END_BUF) { in onig_search()
3633 if ((OnigDistance )(max_semi_end - str) < reg->anchor_dmin) in onig_search()
3637 if ((OnigDistance )(min_semi_end - start) > reg->anchor_dmax) { in onig_search()
3638 start = min_semi_end - reg->anchor_dmax; in onig_search()
3640 start = onigenc_get_right_adjust_char_head(reg->enc, str, start); in onig_search()
3642 start = onigenc_get_prev_char_head(reg->enc, str, end); in onig_search()
3645 if ((OnigDistance )(max_semi_end - (range - 1)) < reg->anchor_dmin) { in onig_search()
3646 range = max_semi_end - reg->anchor_dmin + 1; in onig_search()
3652 if ((OnigDistance )(min_semi_end - range) > reg->anchor_dmax) { in onig_search()
3653 range = min_semi_end - reg->anchor_dmax; in onig_search()
3655 if ((OnigDistance )(max_semi_end - start) < reg->anchor_dmin) { in onig_search()
3656 start = max_semi_end - reg->anchor_dmin; in onig_search()
3657 start = ONIGENC_LEFT_ADJUST_CHAR_HEAD(reg->enc, str, start); in onig_search()
3662 else if (reg->anchor & ANCHOR_SEMI_END_BUF) { in onig_search()
3663 UChar* pre_end = ONIGENC_STEP_BACK(reg->enc, str, end, 1); in onig_search()
3666 if (ONIGENC_IS_MBC_NEWLINE(reg->enc, pre_end, end)) { in onig_search()
3670 pre_end = ONIGENC_STEP_BACK(reg->enc, str, pre_end, 1); in onig_search()
3672 ONIGENC_IS_MBC_CRNL(reg->enc, pre_end, end)) { in onig_search()
3685 else if ((reg->anchor & ANCHOR_ANYCHAR_STAR_ML)) { in onig_search()
3696 if (reg->threshold_len == 0) { in onig_search()
3721 STATE_CHECK_BUFF_INIT(msa, end - str, offset, reg->num_comb_exp_check); in onig_search()
3728 prev = onigenc_get_prev_char_head(reg->enc, str, s); in onig_search()
3732 if (reg->optimize != ONIG_OPTIMIZE_NONE) { in onig_search()
3736 if (reg->dmax != 0) { in onig_search()
3737 if (reg->dmax == ONIG_INFINITE_DISTANCE) in onig_search()
3740 sch_range += reg->dmax; in onig_search()
3745 if ((end - start) < reg->threshold_len) in onig_search()
3748 if (reg->dmax != ONIG_INFINITE_DISTANCE) { in onig_search()
3750 if (! forward_search_range(reg, str, end, s, sch_range, in onig_search()
3759 s += enc_len(reg->enc, s); in onig_search()
3765 if (! forward_search_range(reg, str, end, s, sch_range, in onig_search()
3768 if ((reg->anchor & ANCHOR_ANYCHAR_STAR) != 0) { in onig_search()
3772 s += enc_len(reg->enc, s); in onig_search()
3774 while (!ONIGENC_IS_MBC_NEWLINE(reg->enc, prev, end) && s < range) { in onig_search()
3776 s += enc_len(reg->enc, s); in onig_search()
3787 s += enc_len(reg->enc, s); in onig_search()
3795 if (reg->optimize != ONIG_OPTIMIZE_NONE) { in onig_search()
3799 adjrange = ONIGENC_LEFT_ADJUST_CHAR_HEAD(reg->enc, str, range); in onig_search()
3803 if (reg->dmax != ONIG_INFINITE_DISTANCE && in onig_search()
3804 (end - range) >= reg->threshold_len) { in onig_search()
3806 sch_start = s + reg->dmax; in onig_search()
3808 if (backward_search_range(reg, str, end, sch_start, range, adjrange, in onig_search()
3816 prev = onigenc_get_prev_char_head(reg->enc, str, s); in onig_search()
3824 if ((end - range) < reg->threshold_len) goto mismatch; in onig_search()
3827 if (reg->dmax != 0) { in onig_search()
3828 if (reg->dmax == ONIG_INFINITE_DISTANCE) in onig_search()
3831 sch_start += reg->dmax; in onig_search()
3834 sch_start = ONIGENC_LEFT_ADJUST_CHAR_HEAD(reg->enc, in onig_search()
3838 if (backward_search_range(reg, str, end, sch_start, range, adjrange, in onig_search()
3844 prev = onigenc_get_prev_char_head(reg->enc, str, s); in onig_search()
3852 if (IS_FIND_LONGEST(reg->options)) { in onig_search()
3863 ONIG_STATE_DEC_THREAD(reg); in onig_search()
3867 if (IS_FIND_NOT_EMPTY(reg->options) && region in onig_search()
3884 ONIG_STATE_DEC_THREAD(reg); in onig_search()
3892 ONIG_STATE_DEC_THREAD(reg); in onig_search()
3898 onig_get_encoding(regex_t* reg) in onig_get_encoding() argument
3900 return reg->enc; in onig_get_encoding()
3904 onig_get_options(regex_t* reg) in onig_get_options() argument
3906 return reg->options; in onig_get_options()
3910 onig_get_ambig_flag(regex_t* reg) in onig_get_ambig_flag() argument
3912 return reg->ambig_flag; in onig_get_ambig_flag()
3916 onig_get_syntax(regex_t* reg) in onig_get_syntax() argument
3918 return reg->syntax; in onig_get_syntax()
3922 onig_number_of_captures(regex_t* reg) in onig_number_of_captures() argument
3924 return reg->num_mem; in onig_number_of_captures()
3928 onig_number_of_capture_histories(regex_t* reg) in onig_number_of_capture_histories() argument
3935 if (BIT_STATUS_AT(reg->capture_history, i) != 0) in onig_number_of_capture_histories()