Home | History | Annotate | Download | only in Oniguruma

Lines Matching defs:qn

686 compile_range_repeat_node(QtfrNode* qn, int target_len, int empty_info,

692 r = add_opcode(reg, qn->greedy ? OP_REPEAT : OP_REPEAT_NG);
700 r = entry_repeat_range(reg, num_repeat, qn->lower, qn->upper);
703 r = compile_tree_empty_check(qn->target, reg, empty_info);
710 IS_QUANTIFIER_IN_REPEAT(qn)) {
711 r = add_opcode(reg, qn->greedy ? OP_REPEAT_INC_SG : OP_REPEAT_INC_NG_SG);
714 r = add_opcode(reg, qn->greedy ? OP_REPEAT_INC : OP_REPEAT_INC_NG);
722 is_anychar_star_quantifier(QtfrNode* qn)
724 if (qn->greedy && IS_REPEAT_INFINITE(qn->upper) &&
725 NTYPE(qn->target) == NT_CANY)
737 compile_length_quantifier_node(QtfrNode* qn, regex_t* reg)
741 int infinite = IS_REPEAT_INFINITE(qn->upper);
742 int empty_info = qn->target_empty_info;
743 int tlen = compile_length_tree(qn->target, reg);
747 ckn = ((reg->num_comb_exp_check > 0) ? qn->comb_exp_check_num : 0);
752 if (NTYPE(qn->target) == NT_CANY) {
753 if (qn->greedy && infinite) {
754 if (IS_NOT_NULL(qn->next_head_exact) && !CKN_ON)
755 return SIZE_OP_ANYCHAR_STAR_PEEK_NEXT + tlen * qn->lower + cklen;
757 return SIZE_OP_ANYCHAR_STAR + tlen * qn->lower + cklen;
766 if (infinite && qn->lower <= 1) {
767 if (qn->greedy) {
768 if (qn->lower == 1)
776 if (qn->lower == 0)
784 else if (qn->upper == 0) {
785 if (qn->is_refered != 0) /* /(?<n>..){0}/ */
790 else if (qn->upper == 1 && qn->greedy) {
791 if (qn->lower == 0) {
803 else if (!qn->greedy && qn->upper == 1 && qn->lower == 0) { /* '??' */
817 compile_quantifier_node(QtfrNode* qn, regex_t* reg)
821 int infinite = IS_REPEAT_INFINITE(qn->upper);
822 int empty_info = qn->target_empty_info;
823 int tlen = compile_length_tree(qn->target, reg);
827 ckn = ((reg->num_comb_exp_check > 0) ? qn->comb_exp_check_num : 0);
829 if (is_anychar_star_quantifier(qn)) {
830 r = compile_tree_n_times(qn->target, qn->lower, reg);
832 if (IS_NOT_NULL(qn->next_head_exact) && !CKN_ON) {
843 return add_bytes(reg, NSTR(qn->next_head_exact)->s, 1);
869 if (infinite && qn->lower <= 1) {
870 if (qn->greedy) {
871 if (qn->lower == 1) {
888 r = compile_tree_empty_check(qn->target, reg, empty_info);
895 if (qn->lower == 0) {
899 r = compile_tree_empty_check(qn->target, reg, empty_info);
913 else if (qn->upper == 0) {
914 if (qn->is_refered != 0) { /* /(?<n>..){0}/ */
917 r = compile_tree(qn->target, reg);
922 else if (qn->upper == 1 && qn->greedy) {
923 if (qn->lower == 0) {
937 r = compile_tree(qn->target, reg);
939 else if (!qn->greedy && qn->upper == 1 && qn->lower == 0) { /* '??' */
954 r = compile_tree(qn->target, reg);
957 r = compile_range_repeat_node(qn, mod_tlen, empty_info, reg);
971 compile_length_quantifier_node(QtfrNode* qn, regex_t* reg)
974 int infinite = IS_REPEAT_INFINITE(qn->upper);
975 int empty_info = qn->target_empty_info;
976 int tlen = compile_length_tree(qn->target, reg);
981 if (NTYPE(qn->target) == NT_CANY) {
982 if (qn->greedy && infinite) {
983 if (IS_NOT_NULL(qn->next_head_exact))
984 return SIZE_OP_ANYCHAR_STAR_PEEK_NEXT + tlen * qn->lower;
986 return SIZE_OP_ANYCHAR_STAR + tlen * qn->lower;
996 (qn->lower <= 1 || tlen * qn->lower <= QUANTIFIER_EXPAND_LIMIT_SIZE)) {
997 if (qn->lower == 1 && tlen > QUANTIFIER_EXPAND_LIMIT_SIZE) {
1001 len = tlen * qn->lower;
1004 if (qn->greedy) {
1005 if (IS_NOT_NULL(qn->head_exact))
1007 else if (IS_NOT_NULL(qn->next_head_exact))
1015 else if (qn->upper == 0 && qn->is_refered != 0) { /* /(?<n>..){0}/ */
1018 else if (!infinite && qn->greedy &&
1019 (qn->upper == 1 || (tlen + SIZE_OP_PUSH) * qn->upper
1021 len = tlen * qn->lower;
1022 len += (SIZE_OP_PUSH + tlen) * (qn->upper - qn->lower);
1024 else if (!qn->greedy && qn->upper == 1 && qn->lower == 0) { /* '??' */
1036 compile_quantifier_node(QtfrNode* qn, regex_t* reg)
1039 int infinite = IS_REPEAT_INFINITE(qn->upper);
1040 int empty_info = qn->target_empty_info;
1041 int tlen = compile_length_tree(qn->target, reg);
1045 if (is_anychar_star_quantifier(qn)) {
1046 r = compile_tree_n_times(qn->target, qn->lower, reg);
1048 if (IS_NOT_NULL(qn->next_head_exact)) {
1054 return add_bytes(reg, NSTR(qn->next_head_exact)->s, 1);
1070 (qn->lower <= 1 || tlen * qn->lower <= QUANTIFIER_EXPAND_LIMIT_SIZE)) {
1071 if (qn->lower == 1 && tlen > QUANTIFIER_EXPAND_LIMIT_SIZE) {
1072 if (qn->greedy) {
1073 if (IS_NOT_NULL(qn->head_exact))
1075 else if (IS_NOT_NULL(qn->next_head_exact))
1086 r = compile_tree_n_times(qn->target, qn->lower, reg);
1090 if (qn->greedy) {
1091 if (IS_NOT_NULL(qn->head_exact)) {
1095 add_bytes(reg, NSTR(qn->head_exact)->s, 1);
1096 r = compile_tree_empty_check(qn->target, reg, empty_info);
1101 else if (IS_NOT_NULL(qn->next_head_exact)) {
1105 add_bytes(reg, NSTR(qn->next_head_exact)->s, 1);
1106 r = compile_tree_empty_check(qn->target, reg, empty_info);
1114 r = compile_tree_empty_check(qn->target, reg, empty_info);
1123 r = compile_tree_empty_check(qn->target, reg, empty_info);
1128 else if (qn->upper == 0 && qn->is_refered != 0) { /* /(?<n>..){0}/ */
1131 r = compile_tree(qn->target, reg);
1133 else if (!infinite && qn->greedy &&
1134 (qn->upper == 1 || (tlen + SIZE_OP_PUSH) * qn->upper
1136 int n = qn->upper - qn->lower;
1138 r = compile_tree_n_times(qn->target, qn->lower, reg);
1145 r = compile_tree(qn->target, reg);
1149 else if (!qn->greedy && qn->upper == 1 && qn->lower == 0) { /* '??' */
1154 r = compile_tree(qn->target, reg);
1157 r = compile_range_repeat_node(qn, mod_tlen, empty_info, reg);
1214 QtfrNode* qn;
1216 qn = NULL;
1259 qn = NQTFR(node->target);
1260 tlen = compile_length_tree(qn->target, reg);
1263 len = tlen * qn->lower
1349 QtfrNode* qn = NQTFR(node->target);
1350 r = compile_tree_n_times(qn->target, qn->lower, reg);
1353 len = compile_length_tree(qn->target, reg);
1358 r = compile_tree(qn->target, reg);
1998 QtfrNode* qn = NQTFR(node);
1999 if (qn->upper != 0) {
2000 r = quantifiers_memory_node_info(qn->target);
2117 QtfrNode* qn = NQTFR(node);
2119 if (qn->lower > 0) {
2120 r = get_min_match_length(qn->target, min, env);
2122 *min = distance_multiply(*min, qn->lower);
2230 QtfrNode* qn = NQTFR(node);
2232 if (qn->upper != 0) {
2233 r = get_max_match_length(qn->target, max, env);
2235 if (! IS_REPEAT_INFINITE(qn->upper))
2236 *max = distance_multiply(*max, qn->upper);
2337 QtfrNode* qn = NQTFR(node);
2338 if (qn->lower == qn->upper) {
2339 r = get_char_length_tree1(qn->target, reg, &tlen, level);
2341 *len = distance_multiply(tlen, qn->lower);
2629 QtfrNode* qn = NQTFR(node);
2630 if (qn->lower > 0) {
2631 if (IS_NOT_NULL(qn->head_exact))
2632 n = qn->head_exact;
2634 n = get_head_value_node(qn->target, exact, reg);
3163 QtfrNode* qn = NQTFR(node);
3164 if (qn->greedy && IS_REPEAT_INFINITE(qn->upper)) {
3169 qn->next_head_exact = n;
3173 if (qn->lower <= 1) {
3174 int ttype = NTYPE(qn->target);
3177 x = get_head_value_node(qn->target, 0, reg);
3563 QtfrNode* qn = NQTFR(node);
3564 Node* target = qn->target;
3567 if (! IS_REPEAT_INFINITE(qn->upper)) {
3568 if (qn->upper > 1) {
3574 if (NTYPE(qn->target) == NT_ENCLOSE) {
3575 EncloseNode* en = NENCLOSE(qn->target);
3580 && q->greedy == qn->greedy) {
3581 qn->upper = (qn->lower == 0 ? 1 : qn->lower);
3582 if (qn->upper == 1)
3593 qn->comb_exp_check_num = -1;
3596 if (IS_REPEAT_INFINITE(qn->upper)) {
3601 var_num = qn->upper - qn->lower;
3610 if (qn->comb_exp_check_num == 0) {
3612 qn->comb_exp_check_num = env->num_comb_exp_check;
3668 1. check empty loop. (set qn->target_empty_info)
3671 4. set qn->head_exact for [push, exact] -> [push_or_jump_exact1, exact].
3744 QtfrNode* qn = NQTFR(node);
3745 Node* target = qn->target;
3748 qn->state |= NST_IN_REPEAT;
3751 if (IS_REPEAT_INFINITE(qn->upper) || qn->upper >= 1) {
3755 qn->target_empty_info = NQ_TARGET_IS_EMPTY;
3760 qn->target_empty_info = r;
3767 qn->upper = 1;
3768 if (qn->lower > 1) qn->lower = 1;
3770 qn->upper = qn->lower = 0; /* /(?:)+/ ==> // */
3778 if (qn->lower != qn->upper)
3786 if (!IS_REPEAT_INFINITE(qn->lower) && qn->lower == qn->upper &&
3787 qn->lower > 1 && qn->lower <= EXPAND_STRING_MAX_LENGTH) {
3791 if (len * qn->lower <= EXPAND_STRING_MAX_LENGTH) {
3792 int i, n = qn->lower;
3805 if (qn->greedy && (qn->target_empty_info != 0)) {
3809 qn->head_exact = tqn->head_exact;
3814 qn->head_exact = get_head_value_node(qn->target, 1, reg);
4796 QtfrNode* qn = NQTFR(node);
4798 r = optimize_node_left(qn->target, &nopt, env);
4801 if (qn->lower == 0 && IS_REPEAT_INFINITE(qn->upper)) {
4803 NTYPE(qn->target) == NT_CANY && qn->greedy) {
4811 if (qn->lower > 0) {
4815 for (i = 2; i <= qn->lower &&
4819 if (i < qn->lower) {
4825 if (qn->lower != qn->upper) {
4829 if (qn->lower > 1)
4834 min = distance_multiply(nopt.len.min, qn->lower);
4835 if (IS_REPEAT_INFINITE(qn->upper))
4838 max = distance_multiply(nopt.len.max, qn->upper);