Lines Matching refs:qn
681 compile_range_repeat_node(QtfrNode* qn, int target_len, int empty_info, in compile_range_repeat_node() argument
687 r = add_opcode(reg, qn->greedy ? OP_REPEAT : OP_REPEAT_NG); in compile_range_repeat_node()
695 r = entry_repeat_range(reg, num_repeat, qn->lower, qn->upper); in compile_range_repeat_node()
698 r = compile_tree_empty_check(qn->target, reg, empty_info); in compile_range_repeat_node()
705 IS_QUANTIFIER_IN_REPEAT(qn)) { in compile_range_repeat_node()
706 r = add_opcode(reg, qn->greedy ? OP_REPEAT_INC_SG : OP_REPEAT_INC_NG_SG); in compile_range_repeat_node()
709 r = add_opcode(reg, qn->greedy ? OP_REPEAT_INC : OP_REPEAT_INC_NG); in compile_range_repeat_node()
717 is_anychar_star_quantifier(QtfrNode* qn) in is_anychar_star_quantifier() argument
719 if (qn->greedy && IS_REPEAT_INFINITE(qn->upper) && in is_anychar_star_quantifier()
720 NTYPE(qn->target) == NT_CANY) in is_anychar_star_quantifier()
732 compile_length_quantifier_node(QtfrNode* qn, regex_t* reg) in compile_length_quantifier_node() argument
736 int infinite = IS_REPEAT_INFINITE(qn->upper); in compile_length_quantifier_node()
737 int empty_info = qn->target_empty_info; in compile_length_quantifier_node()
738 int tlen = compile_length_tree(qn->target, reg); in compile_length_quantifier_node()
742 ckn = ((reg->num_comb_exp_check > 0) ? qn->comb_exp_check_num : 0); in compile_length_quantifier_node()
747 if (NTYPE(qn->target) == NT_CANY) { in compile_length_quantifier_node()
748 if (qn->greedy && infinite) { in compile_length_quantifier_node()
749 if (IS_NOT_NULL(qn->next_head_exact) && !CKN_ON) in compile_length_quantifier_node()
750 return SIZE_OP_ANYCHAR_STAR_PEEK_NEXT + tlen * qn->lower + cklen; in compile_length_quantifier_node()
752 return SIZE_OP_ANYCHAR_STAR + tlen * qn->lower + cklen; in compile_length_quantifier_node()
761 if (infinite && qn->lower <= 1) { in compile_length_quantifier_node()
762 if (qn->greedy) { in compile_length_quantifier_node()
763 if (qn->lower == 1) in compile_length_quantifier_node()
771 if (qn->lower == 0) in compile_length_quantifier_node()
779 else if (qn->upper == 0) { in compile_length_quantifier_node()
780 if (qn->is_refered != 0) /* /(?<n>..){0}/ */ in compile_length_quantifier_node()
785 else if (qn->upper == 1 && qn->greedy) { in compile_length_quantifier_node()
786 if (qn->lower == 0) { in compile_length_quantifier_node()
798 else if (!qn->greedy && qn->upper == 1 && qn->lower == 0) { /* '??' */ in compile_length_quantifier_node()
812 compile_quantifier_node(QtfrNode* qn, regex_t* reg) in compile_quantifier_node() argument
816 int infinite = IS_REPEAT_INFINITE(qn->upper); in compile_quantifier_node()
817 int empty_info = qn->target_empty_info; in compile_quantifier_node()
818 int tlen = compile_length_tree(qn->target, reg); in compile_quantifier_node()
822 ckn = ((reg->num_comb_exp_check > 0) ? qn->comb_exp_check_num : 0); in compile_quantifier_node()
824 if (is_anychar_star_quantifier(qn)) { in compile_quantifier_node()
825 r = compile_tree_n_times(qn->target, qn->lower, reg); in compile_quantifier_node()
827 if (IS_NOT_NULL(qn->next_head_exact) && !CKN_ON) { in compile_quantifier_node()
838 return add_bytes(reg, NSTR(qn->next_head_exact)->s, 1); in compile_quantifier_node()
864 if (infinite && qn->lower <= 1) { in compile_quantifier_node()
865 if (qn->greedy) { in compile_quantifier_node()
866 if (qn->lower == 1) { in compile_quantifier_node()
883 r = compile_tree_empty_check(qn->target, reg, empty_info); in compile_quantifier_node()
890 if (qn->lower == 0) { in compile_quantifier_node()
894 r = compile_tree_empty_check(qn->target, reg, empty_info); in compile_quantifier_node()
908 else if (qn->upper == 0) { in compile_quantifier_node()
909 if (qn->is_refered != 0) { /* /(?<n>..){0}/ */ in compile_quantifier_node()
912 r = compile_tree(qn->target, reg); in compile_quantifier_node()
917 else if (qn->upper == 1 && qn->greedy) { in compile_quantifier_node()
918 if (qn->lower == 0) { in compile_quantifier_node()
932 r = compile_tree(qn->target, reg); in compile_quantifier_node()
934 else if (!qn->greedy && qn->upper == 1 && qn->lower == 0) { /* '??' */ in compile_quantifier_node()
949 r = compile_tree(qn->target, reg); in compile_quantifier_node()
952 r = compile_range_repeat_node(qn, mod_tlen, empty_info, reg); in compile_quantifier_node()
966 compile_length_quantifier_node(QtfrNode* qn, regex_t* reg) in compile_length_quantifier_node() argument
969 int infinite = IS_REPEAT_INFINITE(qn->upper); in compile_length_quantifier_node()
970 int empty_info = qn->target_empty_info; in compile_length_quantifier_node()
971 int tlen = compile_length_tree(qn->target, reg); in compile_length_quantifier_node()
976 if (NTYPE(qn->target) == NT_CANY) { in compile_length_quantifier_node()
977 if (qn->greedy && infinite) { in compile_length_quantifier_node()
978 if (IS_NOT_NULL(qn->next_head_exact)) in compile_length_quantifier_node()
979 return SIZE_OP_ANYCHAR_STAR_PEEK_NEXT + tlen * qn->lower; in compile_length_quantifier_node()
981 return SIZE_OP_ANYCHAR_STAR + tlen * qn->lower; in compile_length_quantifier_node()
991 (qn->lower <= 1 || tlen * qn->lower <= QUANTIFIER_EXPAND_LIMIT_SIZE)) { in compile_length_quantifier_node()
992 if (qn->lower == 1 && tlen > QUANTIFIER_EXPAND_LIMIT_SIZE) { in compile_length_quantifier_node()
996 len = tlen * qn->lower; in compile_length_quantifier_node()
999 if (qn->greedy) { in compile_length_quantifier_node()
1000 if (IS_NOT_NULL(qn->head_exact)) in compile_length_quantifier_node()
1002 else if (IS_NOT_NULL(qn->next_head_exact)) in compile_length_quantifier_node()
1010 else if (qn->upper == 0 && qn->is_refered != 0) { /* /(?<n>..){0}/ */ in compile_length_quantifier_node()
1013 else if (!infinite && qn->greedy && in compile_length_quantifier_node()
1014 (qn->upper == 1 || (tlen + SIZE_OP_PUSH) * qn->upper in compile_length_quantifier_node()
1016 len = tlen * qn->lower; in compile_length_quantifier_node()
1017 len += (SIZE_OP_PUSH + tlen) * (qn->upper - qn->lower); in compile_length_quantifier_node()
1019 else if (!qn->greedy && qn->upper == 1 && qn->lower == 0) { /* '??' */ in compile_length_quantifier_node()
1031 compile_quantifier_node(QtfrNode* qn, regex_t* reg) in compile_quantifier_node() argument
1034 int infinite = IS_REPEAT_INFINITE(qn->upper); in compile_quantifier_node()
1035 int empty_info = qn->target_empty_info; in compile_quantifier_node()
1036 int tlen = compile_length_tree(qn->target, reg); in compile_quantifier_node()
1040 if (is_anychar_star_quantifier(qn)) { in compile_quantifier_node()
1041 r = compile_tree_n_times(qn->target, qn->lower, reg); in compile_quantifier_node()
1043 if (IS_NOT_NULL(qn->next_head_exact)) { in compile_quantifier_node()
1049 return add_bytes(reg, NSTR(qn->next_head_exact)->s, 1); in compile_quantifier_node()
1065 (qn->lower <= 1 || tlen * qn->lower <= QUANTIFIER_EXPAND_LIMIT_SIZE)) { in compile_quantifier_node()
1066 if (qn->lower == 1 && tlen > QUANTIFIER_EXPAND_LIMIT_SIZE) { in compile_quantifier_node()
1067 if (qn->greedy) { in compile_quantifier_node()
1068 if (IS_NOT_NULL(qn->head_exact)) in compile_quantifier_node()
1070 else if (IS_NOT_NULL(qn->next_head_exact)) in compile_quantifier_node()
1081 r = compile_tree_n_times(qn->target, qn->lower, reg); in compile_quantifier_node()
1085 if (qn->greedy) { in compile_quantifier_node()
1086 if (IS_NOT_NULL(qn->head_exact)) { in compile_quantifier_node()
1090 add_bytes(reg, NSTR(qn->head_exact)->s, 1); in compile_quantifier_node()
1091 r = compile_tree_empty_check(qn->target, reg, empty_info); in compile_quantifier_node()
1096 else if (IS_NOT_NULL(qn->next_head_exact)) { in compile_quantifier_node()
1100 add_bytes(reg, NSTR(qn->next_head_exact)->s, 1); in compile_quantifier_node()
1101 r = compile_tree_empty_check(qn->target, reg, empty_info); in compile_quantifier_node()
1109 r = compile_tree_empty_check(qn->target, reg, empty_info); in compile_quantifier_node()
1118 r = compile_tree_empty_check(qn->target, reg, empty_info); in compile_quantifier_node()
1123 else if (qn->upper == 0 && qn->is_refered != 0) { /* /(?<n>..){0}/ */ in compile_quantifier_node()
1126 r = compile_tree(qn->target, reg); in compile_quantifier_node()
1128 else if (!infinite && qn->greedy && in compile_quantifier_node()
1129 (qn->upper == 1 || (tlen + SIZE_OP_PUSH) * qn->upper in compile_quantifier_node()
1131 int n = qn->upper - qn->lower; in compile_quantifier_node()
1133 r = compile_tree_n_times(qn->target, qn->lower, reg); in compile_quantifier_node()
1140 r = compile_tree(qn->target, reg); in compile_quantifier_node()
1144 else if (!qn->greedy && qn->upper == 1 && qn->lower == 0) { /* '??' */ in compile_quantifier_node()
1149 r = compile_tree(qn->target, reg); in compile_quantifier_node()
1152 r = compile_range_repeat_node(qn, mod_tlen, empty_info, reg); in compile_quantifier_node()
1248 QtfrNode* qn = NQTFR(node->target); in compile_length_enclose_node() local
1249 tlen = compile_length_tree(qn->target, reg); in compile_length_enclose_node()
1252 len = tlen * qn->lower in compile_length_enclose_node()
1338 QtfrNode* qn = NQTFR(node->target); in compile_enclose_node() local
1339 r = compile_tree_n_times(qn->target, qn->lower, reg); in compile_enclose_node()
1342 len = compile_length_tree(qn->target, reg); in compile_enclose_node()
1347 r = compile_tree(qn->target, reg); in compile_enclose_node()
1984 QtfrNode* qn = NQTFR(node); in quantifiers_memory_node_info() local
1985 if (qn->upper != 0) { in quantifiers_memory_node_info()
1986 r = quantifiers_memory_node_info(qn->target); in quantifiers_memory_node_info()
2103 QtfrNode* qn = NQTFR(node); in get_min_match_length() local
2105 if (qn->lower > 0) { in get_min_match_length()
2106 r = get_min_match_length(qn->target, min, env); in get_min_match_length()
2108 *min = distance_multiply(*min, qn->lower); in get_min_match_length()
2216 QtfrNode* qn = NQTFR(node); in get_max_match_length() local
2218 if (qn->upper != 0) { in get_max_match_length()
2219 r = get_max_match_length(qn->target, max, env); in get_max_match_length()
2221 if (! IS_REPEAT_INFINITE(qn->upper)) in get_max_match_length()
2222 *max = distance_multiply(*max, qn->upper); in get_max_match_length()
2323 QtfrNode* qn = NQTFR(node); in get_char_length_tree1() local
2324 if (qn->lower == qn->upper) { in get_char_length_tree1()
2325 r = get_char_length_tree1(qn->target, reg, &tlen, level); in get_char_length_tree1()
2327 *len = distance_multiply(tlen, qn->lower); in get_char_length_tree1()
2615 QtfrNode* qn = NQTFR(node); in get_head_value_node() local
2616 if (qn->lower > 0) { in get_head_value_node()
2617 if (IS_NOT_NULL(qn->head_exact)) in get_head_value_node()
2618 n = qn->head_exact; in get_head_value_node()
2620 n = get_head_value_node(qn->target, exact, reg); in get_head_value_node()
3149 QtfrNode* qn = NQTFR(node); in next_setup() local
3150 if (qn->greedy && IS_REPEAT_INFINITE(qn->upper)) { in next_setup()
3155 qn->next_head_exact = n; in next_setup()
3159 if (qn->lower <= 1) { in next_setup()
3160 int ttype = NTYPE(qn->target); in next_setup()
3163 x = get_head_value_node(qn->target, 0, reg); in next_setup()
3542 QtfrNode* qn = NQTFR(node); in setup_comb_exp_check() local
3543 Node* target = qn->target; in setup_comb_exp_check()
3546 if (! IS_REPEAT_INFINITE(qn->upper)) { in setup_comb_exp_check()
3547 if (qn->upper > 1) { in setup_comb_exp_check()
3553 if (NTYPE(qn->target) == NT_ENCLOSE) { in setup_comb_exp_check()
3554 EncloseNode* en = NENCLOSE(qn->target); in setup_comb_exp_check()
3559 && q->greedy == qn->greedy) { in setup_comb_exp_check()
3560 qn->upper = (qn->lower == 0 ? 1 : qn->lower); in setup_comb_exp_check()
3561 if (qn->upper == 1) in setup_comb_exp_check()
3572 qn->comb_exp_check_num = -1; in setup_comb_exp_check()
3575 if (IS_REPEAT_INFINITE(qn->upper)) { in setup_comb_exp_check()
3580 var_num = qn->upper - qn->lower; in setup_comb_exp_check()
3589 if (qn->comb_exp_check_num == 0) { in setup_comb_exp_check()
3591 qn->comb_exp_check_num = env->num_comb_exp_check; in setup_comb_exp_check()
3723 QtfrNode* qn = NQTFR(node); in setup_tree() local
3724 Node* target = qn->target; in setup_tree()
3727 qn->state |= NST_IN_REPEAT; in setup_tree()
3730 if (IS_REPEAT_INFINITE(qn->upper) || qn->upper >= 1) { in setup_tree()
3734 qn->target_empty_info = NQ_TARGET_IS_EMPTY; in setup_tree()
3739 qn->target_empty_info = r; in setup_tree()
3746 qn->upper = 1; in setup_tree()
3747 if (qn->lower > 1) qn->lower = 1; in setup_tree()
3749 qn->upper = qn->lower = 0; /* /(?:)+/ ==> // */ in setup_tree()
3757 if (qn->lower != qn->upper) in setup_tree()
3765 if (!IS_REPEAT_INFINITE(qn->lower) && qn->lower == qn->upper && in setup_tree()
3766 qn->lower > 1 && qn->lower <= EXPAND_STRING_MAX_LENGTH) { in setup_tree()
3770 if (len * qn->lower <= EXPAND_STRING_MAX_LENGTH) { in setup_tree()
3771 int i, n = qn->lower; in setup_tree()
3784 if (qn->greedy && (qn->target_empty_info != 0)) { in setup_tree()
3788 qn->head_exact = tqn->head_exact; in setup_tree()
3793 qn->head_exact = get_head_value_node(qn->target, 1, reg); in setup_tree()
4775 QtfrNode* qn = NQTFR(node); in optimize_node_left() local
4777 r = optimize_node_left(qn->target, &nopt, env); in optimize_node_left()
4780 if (qn->lower == 0 && IS_REPEAT_INFINITE(qn->upper)) { in optimize_node_left()
4782 NTYPE(qn->target) == NT_CANY && qn->greedy) { in optimize_node_left()
4790 if (qn->lower > 0) { in optimize_node_left()
4794 for (i = 2; i <= qn->lower && in optimize_node_left()
4798 if (i < qn->lower) { in optimize_node_left()
4804 if (qn->lower != qn->upper) { in optimize_node_left()
4808 if (qn->lower > 1) in optimize_node_left()
4813 min = distance_multiply(nopt.len.min, qn->lower); in optimize_node_left()
4814 if (IS_REPEAT_INFINITE(qn->upper)) in optimize_node_left()
4817 max = distance_multiply(nopt.len.max, qn->upper); in optimize_node_left()