Lines Matching refs:qn

661 compile_range_repeat_node(QuantifierNode* qn, int target_len, int empty_info,  in compile_range_repeat_node()  argument
667 r = add_opcode(reg, qn->greedy ? OP_REPEAT : OP_REPEAT_NG); in compile_range_repeat_node()
675 r = entry_repeat_range(reg, num_repeat, qn->lower, qn->upper); in compile_range_repeat_node()
678 r = compile_tree_empty_check(qn->target, reg, empty_info); in compile_range_repeat_node()
685 IS_QUANTIFIER_IN_REPEAT(qn)) { in compile_range_repeat_node()
686 r = add_opcode(reg, qn->greedy ? OP_REPEAT_INC_SG : OP_REPEAT_INC_NG_SG); in compile_range_repeat_node()
689 r = add_opcode(reg, qn->greedy ? OP_REPEAT_INC : OP_REPEAT_INC_NG); in compile_range_repeat_node()
697 is_anychar_star_quantifier(QuantifierNode* qn) in is_anychar_star_quantifier() argument
699 if (qn->greedy && IS_REPEAT_INFINITE(qn->upper) && in is_anychar_star_quantifier()
700 NTYPE(qn->target) == N_ANYCHAR) in is_anychar_star_quantifier()
712 compile_length_quantifier_node(QuantifierNode* qn, regex_t* reg) in compile_length_quantifier_node() argument
716 int infinite = IS_REPEAT_INFINITE(qn->upper); in compile_length_quantifier_node()
717 int empty_info = qn->target_empty_info; in compile_length_quantifier_node()
718 int tlen = compile_length_tree(qn->target, reg); in compile_length_quantifier_node()
722 ckn = ((reg->num_comb_exp_check > 0) ? qn->comb_exp_check_num : 0); in compile_length_quantifier_node()
727 if (NTYPE(qn->target) == N_ANYCHAR) { in compile_length_quantifier_node()
728 if (qn->greedy && infinite) { in compile_length_quantifier_node()
729 if (IS_NOT_NULL(qn->next_head_exact) && !CKN_ON) in compile_length_quantifier_node()
730 return SIZE_OP_ANYCHAR_STAR_PEEK_NEXT + tlen * qn->lower + cklen; in compile_length_quantifier_node()
732 return SIZE_OP_ANYCHAR_STAR + tlen * qn->lower + cklen; in compile_length_quantifier_node()
741 if (infinite && qn->lower <= 1) { in compile_length_quantifier_node()
742 if (qn->greedy) { in compile_length_quantifier_node()
743 if (qn->lower == 1) in compile_length_quantifier_node()
751 if (qn->lower == 0) in compile_length_quantifier_node()
759 else if (qn->upper == 0) { in compile_length_quantifier_node()
760 if (qn->is_refered != 0) /* /(?<n>..){0}/ */ in compile_length_quantifier_node()
765 else if (qn->upper == 1 && qn->greedy) { in compile_length_quantifier_node()
766 if (qn->lower == 0) { in compile_length_quantifier_node()
778 else if (!qn->greedy && qn->upper == 1 && qn->lower == 0) { /* '??' */ in compile_length_quantifier_node()
792 compile_quantifier_node(QuantifierNode* qn, regex_t* reg) in compile_quantifier_node() argument
796 int infinite = IS_REPEAT_INFINITE(qn->upper); in compile_quantifier_node()
797 int empty_info = qn->target_empty_info; in compile_quantifier_node()
798 int tlen = compile_length_tree(qn->target, reg); in compile_quantifier_node()
802 ckn = ((reg->num_comb_exp_check > 0) ? qn->comb_exp_check_num : 0); in compile_quantifier_node()
804 if (is_anychar_star_quantifier(qn)) { in compile_quantifier_node()
805 r = compile_tree_n_times(qn->target, qn->lower, reg); in compile_quantifier_node()
807 if (IS_NOT_NULL(qn->next_head_exact) && !CKN_ON) { in compile_quantifier_node()
818 return add_bytes(reg, NSTRING(qn->next_head_exact).s, 1); in compile_quantifier_node()
844 if (infinite && qn->lower <= 1) { in compile_quantifier_node()
845 if (qn->greedy) { in compile_quantifier_node()
846 if (qn->lower == 1) { in compile_quantifier_node()
863 r = compile_tree_empty_check(qn->target, reg, empty_info); in compile_quantifier_node()
870 if (qn->lower == 0) { in compile_quantifier_node()
874 r = compile_tree_empty_check(qn->target, reg, empty_info); in compile_quantifier_node()
888 else if (qn->upper == 0) { in compile_quantifier_node()
889 if (qn->is_refered != 0) { /* /(?<n>..){0}/ */ in compile_quantifier_node()
892 r = compile_tree(qn->target, reg); in compile_quantifier_node()
897 else if (qn->upper == 1 && qn->greedy) { in compile_quantifier_node()
898 if (qn->lower == 0) { in compile_quantifier_node()
912 r = compile_tree(qn->target, reg); in compile_quantifier_node()
914 else if (!qn->greedy && qn->upper == 1 && qn->lower == 0) { /* '??' */ in compile_quantifier_node()
929 r = compile_tree(qn->target, reg); in compile_quantifier_node()
932 r = compile_range_repeat_node(qn, mod_tlen, empty_info, reg); in compile_quantifier_node()
946 compile_length_quantifier_node(QuantifierNode* qn, regex_t* reg) in compile_length_quantifier_node() argument
949 int infinite = IS_REPEAT_INFINITE(qn->upper); in compile_length_quantifier_node()
950 int empty_info = qn->target_empty_info; in compile_length_quantifier_node()
951 int tlen = compile_length_tree(qn->target, reg); in compile_length_quantifier_node()
956 if (NTYPE(qn->target) == N_ANYCHAR) { in compile_length_quantifier_node()
957 if (qn->greedy && infinite) { in compile_length_quantifier_node()
958 if (IS_NOT_NULL(qn->next_head_exact)) in compile_length_quantifier_node()
959 return SIZE_OP_ANYCHAR_STAR_PEEK_NEXT + tlen * qn->lower; in compile_length_quantifier_node()
961 return SIZE_OP_ANYCHAR_STAR + tlen * qn->lower; in compile_length_quantifier_node()
971 (qn->lower <= 1 || tlen * qn->lower <= QUANTIFIER_EXPAND_LIMIT_SIZE)) { in compile_length_quantifier_node()
972 if (qn->lower == 1 && tlen > QUANTIFIER_EXPAND_LIMIT_SIZE) { in compile_length_quantifier_node()
976 len = tlen * qn->lower; in compile_length_quantifier_node()
979 if (qn->greedy) { in compile_length_quantifier_node()
980 if (IS_NOT_NULL(qn->head_exact)) in compile_length_quantifier_node()
982 else if (IS_NOT_NULL(qn->next_head_exact)) in compile_length_quantifier_node()
990 else if (qn->upper == 0 && qn->is_refered != 0) { /* /(?<n>..){0}/ */ in compile_length_quantifier_node()
993 else if (!infinite && qn->greedy && in compile_length_quantifier_node()
994 (qn->upper == 1 || (tlen + SIZE_OP_PUSH) * qn->upper in compile_length_quantifier_node()
996 len = tlen * qn->lower; in compile_length_quantifier_node()
997 len += (SIZE_OP_PUSH + tlen) * (qn->upper - qn->lower); in compile_length_quantifier_node()
999 else if (!qn->greedy && qn->upper == 1 && qn->lower == 0) { /* '??' */ in compile_length_quantifier_node()
1011 compile_quantifier_node(QuantifierNode* qn, regex_t* reg) in compile_quantifier_node() argument
1014 int infinite = IS_REPEAT_INFINITE(qn->upper); in compile_quantifier_node()
1015 int empty_info = qn->target_empty_info; in compile_quantifier_node()
1016 int tlen = compile_length_tree(qn->target, reg); in compile_quantifier_node()
1020 if (is_anychar_star_quantifier(qn)) { in compile_quantifier_node()
1021 r = compile_tree_n_times(qn->target, qn->lower, reg); in compile_quantifier_node()
1023 if (IS_NOT_NULL(qn->next_head_exact)) { in compile_quantifier_node()
1029 return add_bytes(reg, NSTRING(qn->next_head_exact).s, 1); in compile_quantifier_node()
1045 (qn->lower <= 1 || tlen * qn->lower <= QUANTIFIER_EXPAND_LIMIT_SIZE)) { in compile_quantifier_node()
1046 if (qn->lower == 1 && tlen > QUANTIFIER_EXPAND_LIMIT_SIZE) { in compile_quantifier_node()
1047 if (qn->greedy) { in compile_quantifier_node()
1048 if (IS_NOT_NULL(qn->head_exact)) in compile_quantifier_node()
1050 else if (IS_NOT_NULL(qn->next_head_exact)) in compile_quantifier_node()
1061 r = compile_tree_n_times(qn->target, qn->lower, reg); in compile_quantifier_node()
1065 if (qn->greedy) { in compile_quantifier_node()
1066 if (IS_NOT_NULL(qn->head_exact)) { in compile_quantifier_node()
1070 add_bytes(reg, NSTRING(qn->head_exact).s, 1); in compile_quantifier_node()
1071 r = compile_tree_empty_check(qn->target, reg, empty_info); in compile_quantifier_node()
1076 else if (IS_NOT_NULL(qn->next_head_exact)) { in compile_quantifier_node()
1080 add_bytes(reg, NSTRING(qn->next_head_exact).s, 1); in compile_quantifier_node()
1081 r = compile_tree_empty_check(qn->target, reg, empty_info); in compile_quantifier_node()
1089 r = compile_tree_empty_check(qn->target, reg, empty_info); in compile_quantifier_node()
1098 r = compile_tree_empty_check(qn->target, reg, empty_info); in compile_quantifier_node()
1103 else if (qn->upper == 0 && qn->is_refered != 0) { /* /(?<n>..){0}/ */ in compile_quantifier_node()
1106 r = compile_tree(qn->target, reg); in compile_quantifier_node()
1108 else if (!infinite && qn->greedy && in compile_quantifier_node()
1109 (qn->upper == 1 || (tlen + SIZE_OP_PUSH) * qn->upper in compile_quantifier_node()
1111 int n = qn->upper - qn->lower; in compile_quantifier_node()
1113 r = compile_tree_n_times(qn->target, qn->lower, reg); in compile_quantifier_node()
1120 r = compile_tree(qn->target, reg); in compile_quantifier_node()
1124 else if (!qn->greedy && qn->upper == 1 && qn->lower == 0) { /* '??' */ in compile_quantifier_node()
1129 r = compile_tree(qn->target, reg); in compile_quantifier_node()
1132 r = compile_range_repeat_node(qn, mod_tlen, empty_info, reg); in compile_quantifier_node()
1228 QuantifierNode* qn = &NQUANTIFIER(node->target); in compile_length_effect_node() local
1229 tlen = compile_length_tree(qn->target, reg); in compile_length_effect_node()
1232 len = tlen * qn->lower in compile_length_effect_node()
1318 QuantifierNode* qn = &NQUANTIFIER(node->target); in compile_effect_node() local
1319 r = compile_tree_n_times(qn->target, qn->lower, reg); in compile_effect_node()
1322 len = compile_length_tree(qn->target, reg); in compile_effect_node()
1327 r = compile_tree(qn->target, reg); in compile_effect_node()
1962 QuantifierNode* qn = &(NQUANTIFIER(node)); in quantifiers_memory_node_info() local
1963 if (qn->upper != 0) { in quantifiers_memory_node_info()
1964 r = quantifiers_memory_node_info(qn->target); in quantifiers_memory_node_info()
2086 QuantifierNode* qn = &(NQUANTIFIER(node)); in get_min_match_length() local
2088 if (qn->lower > 0) { in get_min_match_length()
2089 r = get_min_match_length(qn->target, min, env); in get_min_match_length()
2091 *min = distance_multiply(*min, qn->lower); in get_min_match_length()
2207 QuantifierNode* qn = &(NQUANTIFIER(node)); in get_max_match_length() local
2209 if (qn->upper != 0) { in get_max_match_length()
2210 r = get_max_match_length(qn->target, max, env); in get_max_match_length()
2212 if (! IS_REPEAT_INFINITE(qn->upper)) in get_max_match_length()
2213 *max = distance_multiply(*max, qn->upper); in get_max_match_length()
2314 QuantifierNode* qn = &(NQUANTIFIER(node)); in get_char_length_tree1() local
2315 if (qn->lower == qn->upper) { in get_char_length_tree1()
2316 r = get_char_length_tree1(qn->target, reg, &tlen, level); in get_char_length_tree1()
2318 *len = distance_multiply(tlen, qn->lower); in get_char_length_tree1()
2626 QuantifierNode* qn = &(NQUANTIFIER(node)); in get_head_value_node() local
2627 if (qn->lower > 0) { in get_head_value_node()
2628 if (IS_NOT_NULL(qn->head_exact)) in get_head_value_node()
2629 n = qn->head_exact; in get_head_value_node()
2631 n = get_head_value_node(qn->target, exact, reg); in get_head_value_node()
3160 QuantifierNode* qn = &(NQUANTIFIER(node)); in next_setup() local
3161 if (qn->greedy && IS_REPEAT_INFINITE(qn->upper)) { in next_setup()
3163 qn->next_head_exact = get_head_value_node(next_node, 1, reg); in next_setup()
3166 if (qn->lower <= 1) { in next_setup()
3167 int ttype = NTYPE(qn->target); in next_setup()
3170 x = get_head_value_node(qn->target, 0, reg); in next_setup()
3332 QuantifierNode* qn = &(NQUANTIFIER(node)); in setup_comb_exp_check() local
3333 Node* target = qn->target; in setup_comb_exp_check()
3336 if (! IS_REPEAT_INFINITE(qn->upper)) { in setup_comb_exp_check()
3337 if (qn->upper > 1) { in setup_comb_exp_check()
3343 if (NTYPE(qn->target) == N_EFFECT) { in setup_comb_exp_check()
3344 EffectNode* en = &(NEFFECT(qn->target)); in setup_comb_exp_check()
3349 && q->greedy == qn->greedy) { in setup_comb_exp_check()
3350 qn->upper = (qn->lower == 0 ? 1 : qn->lower); in setup_comb_exp_check()
3351 if (qn->upper == 1) in setup_comb_exp_check()
3362 qn->comb_exp_check_num = -1; in setup_comb_exp_check()
3365 if (IS_REPEAT_INFINITE(qn->upper)) { in setup_comb_exp_check()
3370 var_num = qn->upper - qn->lower; in setup_comb_exp_check()
3379 if (qn->comb_exp_check_num == 0) { in setup_comb_exp_check()
3381 qn->comb_exp_check_num = env->num_comb_exp_check; in setup_comb_exp_check()
3513 QuantifierNode* qn = &(NQUANTIFIER(node)); in setup_tree() local
3514 Node* target = qn->target; in setup_tree()
3517 qn->state |= NST_IN_REPEAT; in setup_tree()
3520 if (IS_REPEAT_INFINITE(qn->upper) || qn->upper >= 1) { in setup_tree()
3524 qn->target_empty_info = NQ_TARGET_IS_EMPTY; in setup_tree()
3529 qn->target_empty_info = r; in setup_tree()
3536 qn->upper = 1; in setup_tree()
3537 if (qn->lower > 1) qn->lower = 1; in setup_tree()
3539 qn->upper = qn->lower = 0; /* /(?:)+/ ==> // */ in setup_tree()
3547 if (qn->lower != qn->upper) in setup_tree()
3555 if (!IS_REPEAT_INFINITE(qn->lower) && qn->lower == qn->upper && in setup_tree()
3556 qn->lower > 1 && qn->lower <= EXPAND_STRING_MAX_LENGTH) { in setup_tree()
3560 if (len * qn->lower <= EXPAND_STRING_MAX_LENGTH) { in setup_tree()
3561 int i, n = qn->lower; in setup_tree()
3574 if (qn->greedy && (qn->target_empty_info != 0)) { in setup_tree()
3578 qn->head_exact = tqn->head_exact; in setup_tree()
3583 qn->head_exact = get_head_value_node(qn->target, 1, reg); in setup_tree()
4569 QuantifierNode* qn = &(NQUANTIFIER(node)); in optimize_node_left() local
4571 r = optimize_node_left(qn->target, &nopt, env); in optimize_node_left()
4574 if (qn->lower == 0 && IS_REPEAT_INFINITE(qn->upper)) { in optimize_node_left()
4576 NTYPE(qn->target) == N_ANYCHAR && qn->greedy) { in optimize_node_left()
4584 if (qn->lower > 0) { in optimize_node_left()
4588 for (i = 2; i < qn->lower && in optimize_node_left()
4592 if (i < qn->lower) { in optimize_node_left()
4598 if (qn->lower != qn->upper) { in optimize_node_left()
4602 if (qn->lower > 1) in optimize_node_left()
4607 min = distance_multiply(nopt.len.min, qn->lower); in optimize_node_left()
4608 if (IS_REPEAT_INFINITE(qn->upper)) in optimize_node_left()
4611 max = distance_multiply(nopt.len.max, qn->upper); in optimize_node_left()