Lines Matching refs:r
58 UChar* r = (UChar* )xmalloc(len + 1); in str_dup() local
59 CHECK_NULL_RETURN(r); in str_dup()
60 xmemcpy(r, s, len); in str_dup()
61 r[len] = (UChar )0; in str_dup()
62 return r; in str_dup()
273 int r; in add_opcode_rel_addr() local
275 r = add_opcode(reg, opcode); in add_opcode_rel_addr()
276 if (r) return r; in add_opcode_rel_addr()
277 r = add_rel_addr(reg, addr); in add_opcode_rel_addr()
278 return r; in add_opcode_rel_addr()
298 int r; in add_opcode_option() local
300 r = add_opcode(reg, opcode); in add_opcode_option()
301 if (r) return r; in add_opcode_option()
302 r = add_option(reg, option); in add_opcode_option()
303 return r; in add_opcode_option()
362 int r; in compile_tree_empty_check() local
366 r = add_opcode(reg, OP_NULL_CHECK_START); in compile_tree_empty_check()
367 if (r) return r; in compile_tree_empty_check()
368 r = add_mem_num(reg, reg->num_null_check); /* NULL CHECK ID */ in compile_tree_empty_check()
369 if (r) return r; in compile_tree_empty_check()
373 r = compile_tree(node, reg); in compile_tree_empty_check()
374 if (r) return r; in compile_tree_empty_check()
378 r = add_opcode(reg, OP_NULL_CHECK_END); in compile_tree_empty_check()
380 r = add_opcode(reg, OP_NULL_CHECK_END_MEMST); in compile_tree_empty_check()
382 r = add_opcode(reg, OP_NULL_CHECK_END_MEMST_PUSH); in compile_tree_empty_check()
384 if (r) return r; in compile_tree_empty_check()
385 r = add_mem_num(reg, saved_num_null_check); /* NULL CHECK ID */ in compile_tree_empty_check()
387 return r; in compile_tree_empty_check()
394 int r; in compile_call() local
396 r = add_opcode(reg, OP_CALL); in compile_call()
397 if (r) return r; in compile_call()
398 r = unset_addr_list_add(node->unset_addr_list, BBUF_GET_OFFSET_POS(reg), in compile_call()
400 if (r) return r; in compile_call()
401 r = add_abs_addr(reg, 0 /*dummy addr.*/); in compile_call()
402 return r; in compile_call()
409 int i, r; in compile_tree_n_times() local
412 r = compile_tree(node, reg); in compile_tree_n_times()
413 if (r) return r; in compile_tree_n_times()
460 int rlen, r, len, prev_len, slen, ambig; in compile_length_string_node() local
483 r = add_compile_string_length(prev, prev_len, slen, reg, ambig); in compile_length_string_node()
484 rlen += r; in compile_length_string_node()
491 r = add_compile_string_length(prev, prev_len, slen, reg, ambig); in compile_length_string_node()
492 rlen += r; in compile_length_string_node()
508 int r, len, prev_len, slen, ambig; in compile_string_node() local
531 r = add_compile_string(prev, prev_len, slen, reg, ambig); in compile_string_node()
532 if (r) return r; in compile_string_node()
560 int r, pad_size; in add_multi_byte_cclass()
567 r = add_bytes(reg, mbuf->p, mbuf->used); in add_multi_byte_cclass()
572 return r; in add_multi_byte_cclass()
609 int r; in compile_cclass_node() local
613 r = add_pointer(reg, cc); in compile_cclass_node()
614 return r; in compile_cclass_node()
623 r = add_bitset(reg, cc->bs); in compile_cclass_node()
632 r = add_multi_byte_cclass(cc->mbuf, reg); in compile_cclass_node()
640 r = add_bitset(reg, cc->bs); in compile_cclass_node()
641 if (r) return r; in compile_cclass_node()
642 r = add_multi_byte_cclass(cc->mbuf, reg); in compile_cclass_node()
646 return r; in compile_cclass_node()
684 int r; in compile_range_repeat_node() local
687 r = add_opcode(reg, qn->greedy ? OP_REPEAT : OP_REPEAT_NG); in compile_range_repeat_node()
688 if (r) return r; in compile_range_repeat_node()
689 r = add_mem_num(reg, num_repeat); /* OP_REPEAT ID */ in compile_range_repeat_node()
691 if (r) return r; in compile_range_repeat_node()
692 r = add_rel_addr(reg, target_len + SIZE_OP_REPEAT_INC); in compile_range_repeat_node()
693 if (r) return r; in compile_range_repeat_node()
695 r = entry_repeat_range(reg, num_repeat, qn->lower, qn->upper); in compile_range_repeat_node()
696 if (r) return r; in compile_range_repeat_node()
698 r = compile_tree_empty_check(qn->target, reg, empty_info); in compile_range_repeat_node()
699 if (r) return r; 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()
711 if (r) return r; in compile_range_repeat_node()
712 r = add_mem_num(reg, num_repeat); /* OP_REPEAT ID */ in compile_range_repeat_node()
713 return r; in compile_range_repeat_node()
814 int r, mod_tlen; in compile_quantifier_node() local
825 r = compile_tree_n_times(qn->target, qn->lower, reg); in compile_quantifier_node()
826 if (r) return r; in compile_quantifier_node()
829 r = add_opcode(reg, OP_ANYCHAR_ML_STAR_PEEK_NEXT); in compile_quantifier_node()
831 r = add_opcode(reg, OP_ANYCHAR_STAR_PEEK_NEXT); in compile_quantifier_node()
832 if (r) return r; in compile_quantifier_node()
834 r = add_state_check_num(reg, ckn); in compile_quantifier_node()
835 if (r) return r; in compile_quantifier_node()
842 r = add_opcode(reg, (CKN_ON ? in compile_quantifier_node()
847 r = add_opcode(reg, (CKN_ON ? in compile_quantifier_node()
851 if (r) return r; in compile_quantifier_node()
853 r = add_state_check_num(reg, ckn); in compile_quantifier_node()
855 return r; in compile_quantifier_node()
867 r = add_opcode_rel_addr(reg, OP_JUMP, in compile_quantifier_node()
869 if (r) return r; in compile_quantifier_node()
873 r = add_opcode(reg, OP_STATE_CHECK_PUSH); in compile_quantifier_node()
874 if (r) return r; in compile_quantifier_node()
875 r = add_state_check_num(reg, ckn); in compile_quantifier_node()
876 if (r) return r; in compile_quantifier_node()
877 r = add_rel_addr(reg, mod_tlen + SIZE_OP_JUMP); in compile_quantifier_node()
880 r = add_opcode_rel_addr(reg, OP_PUSH, mod_tlen + SIZE_OP_JUMP); in compile_quantifier_node()
882 if (r) return r; in compile_quantifier_node()
883 r = compile_tree_empty_check(qn->target, reg, empty_info); in compile_quantifier_node()
884 if (r) return r; in compile_quantifier_node()
885 r = add_opcode_rel_addr(reg, OP_JUMP, in compile_quantifier_node()
891 r = add_opcode_rel_addr(reg, OP_JUMP, mod_tlen); in compile_quantifier_node()
892 if (r) return r; in compile_quantifier_node()
894 r = compile_tree_empty_check(qn->target, reg, empty_info); in compile_quantifier_node()
895 if (r) return r; in compile_quantifier_node()
897 r = add_opcode(reg, OP_STATE_CHECK_PUSH_OR_JUMP); in compile_quantifier_node()
898 if (r) return r; in compile_quantifier_node()
899 r = add_state_check_num(reg, ckn); in compile_quantifier_node()
900 if (r) return r; in compile_quantifier_node()
901 r = add_rel_addr(reg, in compile_quantifier_node()
905 r = add_opcode_rel_addr(reg, OP_PUSH, -(mod_tlen + (int )SIZE_OP_PUSH)); in compile_quantifier_node()
910 r = add_opcode_rel_addr(reg, OP_JUMP, tlen); in compile_quantifier_node()
911 if (r) return r; in compile_quantifier_node()
912 r = compile_tree(qn->target, reg); in compile_quantifier_node()
915 r = 0; in compile_quantifier_node()
920 r = add_opcode(reg, OP_STATE_CHECK_PUSH); in compile_quantifier_node()
921 if (r) return r; in compile_quantifier_node()
922 r = add_state_check_num(reg, ckn); in compile_quantifier_node()
923 if (r) return r; in compile_quantifier_node()
924 r = add_rel_addr(reg, tlen); in compile_quantifier_node()
927 r = add_opcode_rel_addr(reg, OP_PUSH, tlen); in compile_quantifier_node()
929 if (r) return r; in compile_quantifier_node()
932 r = compile_tree(qn->target, reg); in compile_quantifier_node()
936 r = add_opcode(reg, OP_STATE_CHECK_PUSH); in compile_quantifier_node()
937 if (r) return r; in compile_quantifier_node()
938 r = add_state_check_num(reg, ckn); in compile_quantifier_node()
939 if (r) return r; in compile_quantifier_node()
940 r = add_rel_addr(reg, SIZE_OP_JUMP); in compile_quantifier_node()
943 r = add_opcode_rel_addr(reg, OP_PUSH, SIZE_OP_JUMP); in compile_quantifier_node()
946 if (r) return r; in compile_quantifier_node()
947 r = add_opcode_rel_addr(reg, OP_JUMP, tlen); in compile_quantifier_node()
948 if (r) return r; 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()
954 if (r) return r; in compile_quantifier_node()
955 r = add_opcode(reg, OP_STATE_CHECK); in compile_quantifier_node()
956 if (r) return r; in compile_quantifier_node()
957 r = add_state_check_num(reg, ckn); in compile_quantifier_node()
960 return r; in compile_quantifier_node()
1033 int i, r, mod_tlen; in compile_quantifier_node() local
1041 r = compile_tree_n_times(qn->target, qn->lower, reg); in compile_quantifier_node()
1042 if (r) return r; in compile_quantifier_node()
1045 r = add_opcode(reg, OP_ANYCHAR_ML_STAR_PEEK_NEXT); in compile_quantifier_node()
1047 r = add_opcode(reg, OP_ANYCHAR_STAR_PEEK_NEXT); in compile_quantifier_node()
1048 if (r) return r; in compile_quantifier_node()
1069 r = add_opcode_rel_addr(reg, OP_JUMP, SIZE_OP_PUSH_OR_JUMP_EXACT1); in compile_quantifier_node()
1071 r = add_opcode_rel_addr(reg, OP_JUMP, SIZE_OP_PUSH_IF_PEEK_NEXT); in compile_quantifier_node()
1073 r = add_opcode_rel_addr(reg, OP_JUMP, SIZE_OP_PUSH); in compile_quantifier_node()
1076 r = add_opcode_rel_addr(reg, OP_JUMP, SIZE_OP_JUMP); in compile_quantifier_node()
1078 if (r) return r; in compile_quantifier_node()
1081 r = compile_tree_n_times(qn->target, qn->lower, reg); in compile_quantifier_node()
1082 if (r) return r; in compile_quantifier_node()
1087 r = add_opcode_rel_addr(reg, OP_PUSH_OR_JUMP_EXACT1, in compile_quantifier_node()
1089 if (r) return r; in compile_quantifier_node()
1091 r = compile_tree_empty_check(qn->target, reg, empty_info); in compile_quantifier_node()
1092 if (r) return r; in compile_quantifier_node()
1093 r = add_opcode_rel_addr(reg, OP_JUMP, in compile_quantifier_node()
1097 r = add_opcode_rel_addr(reg, OP_PUSH_IF_PEEK_NEXT, in compile_quantifier_node()
1099 if (r) return r; in compile_quantifier_node()
1101 r = compile_tree_empty_check(qn->target, reg, empty_info); in compile_quantifier_node()
1102 if (r) return r; in compile_quantifier_node()
1103 r = add_opcode_rel_addr(reg, OP_JUMP, in compile_quantifier_node()
1107 r = add_opcode_rel_addr(reg, OP_PUSH, mod_tlen + SIZE_OP_JUMP); in compile_quantifier_node()
1108 if (r) return r; in compile_quantifier_node()
1109 r = compile_tree_empty_check(qn->target, reg, empty_info); in compile_quantifier_node()
1110 if (r) return r; in compile_quantifier_node()
1111 r = add_opcode_rel_addr(reg, OP_JUMP, in compile_quantifier_node()
1116 r = add_opcode_rel_addr(reg, OP_JUMP, mod_tlen); in compile_quantifier_node()
1117 if (r) return r; in compile_quantifier_node()
1118 r = compile_tree_empty_check(qn->target, reg, empty_info); in compile_quantifier_node()
1119 if (r) return r; in compile_quantifier_node()
1120 r = add_opcode_rel_addr(reg, OP_PUSH, -(mod_tlen + (int )SIZE_OP_PUSH)); in compile_quantifier_node()
1124 r = add_opcode_rel_addr(reg, OP_JUMP, tlen); in compile_quantifier_node()
1125 if (r) return r; in compile_quantifier_node()
1126 r = compile_tree(qn->target, reg); in compile_quantifier_node()
1133 r = compile_tree_n_times(qn->target, qn->lower, reg); in compile_quantifier_node()
1134 if (r) return r; in compile_quantifier_node()
1137 r = add_opcode_rel_addr(reg, OP_PUSH, in compile_quantifier_node()
1139 if (r) return r; in compile_quantifier_node()
1140 r = compile_tree(qn->target, reg); in compile_quantifier_node()
1141 if (r) return r; in compile_quantifier_node()
1145 r = add_opcode_rel_addr(reg, OP_PUSH, SIZE_OP_JUMP); in compile_quantifier_node()
1146 if (r) return r; in compile_quantifier_node()
1147 r = add_opcode_rel_addr(reg, OP_JUMP, tlen); in compile_quantifier_node()
1148 if (r) return r; 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()
1154 return r; in compile_quantifier_node()
1181 int r; in compile_option_node() local
1185 r = add_opcode_option(reg, OP_SET_OPTION_PUSH, node->option); in compile_option_node()
1186 if (r) return r; in compile_option_node()
1187 r = add_opcode_option(reg, OP_SET_OPTION, prev); in compile_option_node()
1188 if (r) return r; in compile_option_node()
1189 r = add_opcode(reg, OP_FAIL); in compile_option_node()
1190 if (r) return r; in compile_option_node()
1194 r = compile_tree(node->target, reg); in compile_option_node()
1198 if (r) return r; in compile_option_node()
1199 r = add_opcode_option(reg, OP_SET_OPTION, prev); in compile_option_node()
1201 return r; in compile_option_node()
1273 int r, len; in compile_enclose_node() local
1282 r = add_opcode(reg, OP_CALL); in compile_enclose_node()
1283 if (r) return r; in compile_enclose_node()
1286 r = add_abs_addr(reg, (int )node->call_addr); in compile_enclose_node()
1287 if (r) return r; in compile_enclose_node()
1297 r = add_opcode_rel_addr(reg, OP_JUMP, len); in compile_enclose_node()
1298 if (r) return r; in compile_enclose_node()
1302 r = add_opcode(reg, OP_MEMORY_START_PUSH); in compile_enclose_node()
1304 r = add_opcode(reg, OP_MEMORY_START); in compile_enclose_node()
1305 if (r) return r; in compile_enclose_node()
1306 r = add_mem_num(reg, node->regnum); in compile_enclose_node()
1307 if (r) return r; in compile_enclose_node()
1308 r = compile_tree(node->target, reg); in compile_enclose_node()
1309 if (r) return r; in compile_enclose_node()
1313 r = add_opcode(reg, (IS_ENCLOSE_RECURSION(node) in compile_enclose_node()
1316 r = add_opcode(reg, (IS_ENCLOSE_RECURSION(node) in compile_enclose_node()
1319 if (r) return r; in compile_enclose_node()
1320 r = add_mem_num(reg, node->regnum); in compile_enclose_node()
1321 if (r) return r; in compile_enclose_node()
1322 r = add_opcode(reg, OP_RETURN); in compile_enclose_node()
1328 r = add_opcode(reg, OP_MEMORY_END_PUSH); in compile_enclose_node()
1330 r = add_opcode(reg, OP_MEMORY_END); in compile_enclose_node()
1331 if (r) return r; in compile_enclose_node()
1332 r = add_mem_num(reg, node->regnum); in compile_enclose_node()
1339 r = compile_tree_n_times(qn->target, qn->lower, reg); in compile_enclose_node()
1340 if (r) return r; in compile_enclose_node()
1345 r = add_opcode_rel_addr(reg, OP_PUSH, len + SIZE_OP_POP + SIZE_OP_JUMP); in compile_enclose_node()
1346 if (r) return r; in compile_enclose_node()
1347 r = compile_tree(qn->target, reg); in compile_enclose_node()
1348 if (r) return r; in compile_enclose_node()
1349 r = add_opcode(reg, OP_POP); in compile_enclose_node()
1350 if (r) return r; in compile_enclose_node()
1351 r = add_opcode_rel_addr(reg, OP_JUMP, in compile_enclose_node()
1355 r = add_opcode(reg, OP_PUSH_STOP_BT); in compile_enclose_node()
1356 if (r) return r; in compile_enclose_node()
1357 r = compile_tree(node->target, reg); in compile_enclose_node()
1358 if (r) return r; in compile_enclose_node()
1359 r = add_opcode(reg, OP_POP_STOP_BT); in compile_enclose_node()
1368 return r; in compile_enclose_node()
1407 int r, len; in compile_anchor_node() local
1410 case ANCHOR_BEGIN_BUF: r = add_opcode(reg, OP_BEGIN_BUF); break; in compile_anchor_node()
1411 case ANCHOR_END_BUF: r = add_opcode(reg, OP_END_BUF); break; in compile_anchor_node()
1412 case ANCHOR_BEGIN_LINE: r = add_opcode(reg, OP_BEGIN_LINE); break; in compile_anchor_node()
1413 case ANCHOR_END_LINE: r = add_opcode(reg, OP_END_LINE); break; in compile_anchor_node()
1414 case ANCHOR_SEMI_END_BUF: r = add_opcode(reg, OP_SEMI_END_BUF); break; in compile_anchor_node()
1415 case ANCHOR_BEGIN_POSITION: r = add_opcode(reg, OP_BEGIN_POSITION); break; in compile_anchor_node()
1417 case ANCHOR_WORD_BOUND: r = add_opcode(reg, OP_WORD_BOUND); break; in compile_anchor_node()
1418 case ANCHOR_NOT_WORD_BOUND: r = add_opcode(reg, OP_NOT_WORD_BOUND); break; in compile_anchor_node()
1420 case ANCHOR_WORD_BEGIN: r = add_opcode(reg, OP_WORD_BEGIN); break; in compile_anchor_node()
1421 case ANCHOR_WORD_END: r = add_opcode(reg, OP_WORD_END); break; in compile_anchor_node()
1425 r = add_opcode(reg, OP_PUSH_POS); in compile_anchor_node()
1426 if (r) return r; in compile_anchor_node()
1427 r = compile_tree(node->target, reg); in compile_anchor_node()
1428 if (r) return r; in compile_anchor_node()
1429 r = add_opcode(reg, OP_POP_POS); in compile_anchor_node()
1435 r = add_opcode_rel_addr(reg, OP_PUSH_POS_NOT, len + SIZE_OP_FAIL_POS); in compile_anchor_node()
1436 if (r) return r; in compile_anchor_node()
1437 r = compile_tree(node->target, reg); in compile_anchor_node()
1438 if (r) return r; in compile_anchor_node()
1439 r = add_opcode(reg, OP_FAIL_POS); in compile_anchor_node()
1445 r = add_opcode(reg, OP_LOOK_BEHIND); in compile_anchor_node()
1446 if (r) return r; in compile_anchor_node()
1448 r = get_char_length_tree(node->target, reg, &n); in compile_anchor_node()
1449 if (r) return ONIGERR_INVALID_LOOK_BEHIND_PATTERN; in compile_anchor_node()
1453 r = add_length(reg, n); in compile_anchor_node()
1454 if (r) return r; in compile_anchor_node()
1455 r = compile_tree(node->target, reg); in compile_anchor_node()
1463 r = add_opcode_rel_addr(reg, OP_PUSH_LOOK_BEHIND_NOT, in compile_anchor_node()
1465 if (r) return r; in compile_anchor_node()
1467 r = get_char_length_tree(node->target, reg, &n); in compile_anchor_node()
1468 if (r) return ONIGERR_INVALID_LOOK_BEHIND_PATTERN; in compile_anchor_node()
1472 r = add_length(reg, n); in compile_anchor_node()
1473 if (r) return r; in compile_anchor_node()
1474 r = compile_tree(node->target, reg); in compile_anchor_node()
1475 if (r) return r; in compile_anchor_node()
1476 r = add_opcode(reg, OP_FAIL_LOOK_BEHIND_NOT); in compile_anchor_node()
1485 return r; in compile_anchor_node()
1491 int len, type, r; in compile_length_tree() local
1498 r = compile_length_tree(NCAR(node), reg); in compile_length_tree()
1499 if (r < 0) return r; in compile_length_tree()
1500 len += r; in compile_length_tree()
1502 r = len; in compile_length_tree()
1509 n = r = 0; in compile_length_tree()
1511 r += compile_length_tree(NCAR(node), reg); in compile_length_tree()
1514 r += (SIZE_OP_PUSH + SIZE_OP_JUMP) * (n - 1); in compile_length_tree()
1520 r = compile_length_string_raw_node(NSTR(node), reg); in compile_length_tree()
1522 r = compile_length_string_node(node, reg); in compile_length_tree()
1526 r = compile_length_cclass_node(NCCLASS(node), reg); in compile_length_tree()
1531 r = SIZE_OPCODE; in compile_length_tree()
1540 r = SIZE_OPCODE + SIZE_OPTION + SIZE_LENGTH + in compile_length_tree()
1546 r = ((!IS_IGNORECASE(reg->options) && br->back_static[0] <= 2) in compile_length_tree()
1550 r = SIZE_OPCODE + SIZE_LENGTH + (SIZE_MEMNUM * br->back_num); in compile_length_tree()
1557 r = SIZE_OP_CALL; in compile_length_tree()
1562 r = compile_length_quantifier_node(NQTFR(node), reg); in compile_length_tree()
1566 r = compile_length_enclose_node(NENCLOSE(node), reg); in compile_length_tree()
1570 r = compile_length_anchor_node(NANCHOR(node), reg); in compile_length_tree()
1578 return r; in compile_length_tree()
1584 int n, type, len, pos, r = 0; in compile_tree() local
1590 r = compile_tree(NCAR(node), reg); in compile_tree()
1591 } while (r == 0 && IS_NOT_NULL(node = NCDR(node))); in compile_tree()
1609 r = add_opcode_rel_addr(reg, OP_PUSH, len + SIZE_OP_JUMP); in compile_tree()
1610 if (r) break; in compile_tree()
1612 r = compile_tree(NCAR(node), reg); in compile_tree()
1613 if (r) break; in compile_tree()
1616 r = add_opcode_rel_addr(reg, OP_JUMP, len); in compile_tree()
1617 if (r) break; in compile_tree()
1625 r = compile_string_raw_node(NSTR(node), reg); in compile_tree()
1627 r = compile_string_node(node, reg); in compile_tree()
1631 r = compile_cclass_node(NCCLASS(node), reg); in compile_tree()
1647 r = add_opcode(reg, op); in compile_tree()
1653 r = add_opcode(reg, OP_ANYCHAR_ML); in compile_tree()
1655 r = add_opcode(reg, OP_ANYCHAR); in compile_tree()
1664 r = add_opcode(reg, OP_BACKREF_WITH_LEVEL); in compile_tree()
1665 if (r) return r; in compile_tree()
1666 r = add_option(reg, (reg->options & ONIG_OPTION_IGNORECASE)); in compile_tree()
1667 if (r) return r; in compile_tree()
1668 r = add_length(reg, br->nest_level); in compile_tree()
1669 if (r) return r; in compile_tree()
1678 r = add_opcode(reg, OP_BACKREFN_IC); in compile_tree()
1679 if (r) return r; in compile_tree()
1680 r = add_mem_num(reg, n); in compile_tree()
1684 case 1: r = add_opcode(reg, OP_BACKREF1); break; in compile_tree()
1685 case 2: r = add_opcode(reg, OP_BACKREF2); break; in compile_tree()
1687 r = add_opcode(reg, OP_BACKREFN); in compile_tree()
1688 if (r) return r; in compile_tree()
1689 r = add_mem_num(reg, n); in compile_tree()
1699 r = add_opcode(reg, OP_BACKREF_MULTI_IC); in compile_tree()
1702 r = add_opcode(reg, OP_BACKREF_MULTI); in compile_tree()
1704 if (r) return r; in compile_tree()
1709 r = add_length(reg, br->back_num); in compile_tree()
1710 if (r) return r; in compile_tree()
1713 r = add_mem_num(reg, p[i]); in compile_tree()
1714 if (r) return r; in compile_tree()
1722 r = compile_call(NCALL(node), reg); in compile_tree()
1727 r = compile_quantifier_node(NQTFR(node), reg); in compile_tree()
1731 r = compile_enclose_node(NENCLOSE(node), reg); in compile_tree()
1735 r = compile_anchor_node(NANCHOR(node), reg); in compile_tree()
1745 return r; in compile_tree()
1753 int r = 0; in noname_disable_map() local
1760 r = noname_disable_map(&(NCAR(node)), map, counter); in noname_disable_map()
1761 } while (r == 0 && IS_NOT_NULL(node = NCDR(node))); in noname_disable_map()
1768 r = noname_disable_map(ptarget, map, counter); in noname_disable_map()
1783 r = noname_disable_map(&(en->target), map, counter); in noname_disable_map()
1789 r = noname_disable_map(plink, map, counter); in noname_disable_map()
1793 r = noname_disable_map(&(en->target), map, counter); in noname_disable_map()
1801 return r; in noname_disable_map()
1835 int r = 0; in renumber_by_map() local
1841 r = renumber_by_map(NCAR(node), map); in renumber_by_map()
1842 } while (r == 0 && IS_NOT_NULL(node = NCDR(node))); in renumber_by_map()
1845 r = renumber_by_map(NQTFR(node)->target, map); in renumber_by_map()
1848 r = renumber_by_map(NENCLOSE(node)->target, map); in renumber_by_map()
1852 r = renumber_node_backref(node, map); in renumber_by_map()
1859 return r; in renumber_by_map()
1865 int r = 0; in numbered_ref_check() local
1871 r = numbered_ref_check(NCAR(node)); in numbered_ref_check()
1872 } while (r == 0 && IS_NOT_NULL(node = NCDR(node))); in numbered_ref_check()
1875 r = numbered_ref_check(NQTFR(node)->target); in numbered_ref_check()
1878 r = numbered_ref_check(NENCLOSE(node)->target); in numbered_ref_check()
1890 return r; in numbered_ref_check()
1896 int r, i, pos, counter; in disable_noname_group_capture() local
1906 r = noname_disable_map(root, map, &counter); in disable_noname_group_capture()
1907 if (r != 0) return r; in disable_noname_group_capture()
1909 r = renumber_by_map(*root, map); in disable_noname_group_capture()
1910 if (r != 0) return r; in disable_noname_group_capture()
1958 int r = 0; in quantifiers_memory_node_info() local
1967 if (v > r) r = v; in quantifiers_memory_node_info()
1978 r = quantifiers_memory_node_info(NCALL(node)->target); in quantifiers_memory_node_info()
1986 r = quantifiers_memory_node_info(qn->target); in quantifiers_memory_node_info()
2001 r = quantifiers_memory_node_info(en->target); in quantifiers_memory_node_info()
2019 return r; in quantifiers_memory_node_info()
2027 int r = 0; in get_min_match_length() local
2041 r = get_min_match_length(nodes[backs[0]], min, env); in get_min_match_length()
2042 if (r != 0) break; in get_min_match_length()
2045 r = get_min_match_length(nodes[backs[i]], &tmin, env); in get_min_match_length()
2046 if (r != 0) break; in get_min_match_length()
2060 r = get_min_match_length(NCALL(node)->target, min, env); in get_min_match_length()
2066 r = get_min_match_length(NCAR(node), &tmin, env); in get_min_match_length()
2067 if (r == 0) *min += tmin; in get_min_match_length()
2068 } while (r == 0 && IS_NOT_NULL(node = NCDR(node))); in get_min_match_length()
2077 r = get_min_match_length(x, &tmin, env); in get_min_match_length()
2078 if (r != 0) break; in get_min_match_length()
2081 } while (r == 0 && IS_NOT_NULL(y = NCDR(y))); in get_min_match_length()
2106 r = get_min_match_length(qn->target, min, env); in get_min_match_length()
2107 if (r == 0) in get_min_match_length()
2122 r = get_min_match_length(en->target, min, env); in get_min_match_length()
2123 if (r == 0) { in get_min_match_length()
2132 r = get_min_match_length(en->target, min, env); in get_min_match_length()
2143 return r; in get_min_match_length()
2150 int r = 0; in get_max_match_length() local
2156 r = get_max_match_length(NCAR(node), &tmax, env); in get_max_match_length()
2157 if (r == 0) in get_max_match_length()
2159 } while (r == 0 && IS_NOT_NULL(node = NCDR(node))); in get_max_match_length()
2164 r = get_max_match_length(NCAR(node), &tmax, env); in get_max_match_length()
2165 if (r == 0 && *max < tmax) *max = tmax; in get_max_match_length()
2166 } while (r == 0 && IS_NOT_NULL(node = NCDR(node))); in get_max_match_length()
2198 r = get_max_match_length(nodes[backs[i]], &tmax, env); in get_max_match_length()
2199 if (r != 0) break; in get_max_match_length()
2208 r = get_max_match_length(NCALL(node)->target, max, env); in get_max_match_length()
2219 r = get_max_match_length(qn->target, max, env); in get_max_match_length()
2220 if (r == 0 && *max != 0) { in get_max_match_length()
2239 r = get_max_match_length(en->target, max, env); in get_max_match_length()
2240 if (r == 0) { in get_max_match_length()
2249 r = get_max_match_length(en->target, max, env); in get_max_match_length()
2260 return r; in get_max_match_length()
2271 int r = 0; in get_char_length_tree1() local
2278 r = get_char_length_tree1(NCAR(node), reg, &tlen, level); in get_char_length_tree1()
2279 if (r == 0) in get_char_length_tree1()
2281 } while (r == 0 && IS_NOT_NULL(node = NCDR(node))); in get_char_length_tree1()
2289 r = get_char_length_tree1(NCAR(node), reg, &tlen, level); in get_char_length_tree1()
2290 while (r == 0 && IS_NOT_NULL(node = NCDR(node))) { in get_char_length_tree1()
2291 r = get_char_length_tree1(NCAR(node), reg, &tlen2, level); in get_char_length_tree1()
2292 if (r == 0) { in get_char_length_tree1()
2297 if (r == 0) { in get_char_length_tree1()
2300 r = GET_CHAR_LEN_TOP_ALT_VARLEN; in get_char_length_tree1()
2302 r = GET_CHAR_LEN_VARLEN; in get_char_length_tree1()
2325 r = get_char_length_tree1(qn->target, reg, &tlen, level); in get_char_length_tree1()
2326 if (r == 0) in get_char_length_tree1()
2330 r = GET_CHAR_LEN_VARLEN; in get_char_length_tree1()
2337 r = get_char_length_tree1(NCALL(node)->target, reg, len, level); in get_char_length_tree1()
2339 r = GET_CHAR_LEN_VARLEN; in get_char_length_tree1()
2361 r = get_char_length_tree1(en->target, reg, len, level); in get_char_length_tree1()
2362 if (r == 0) { in get_char_length_tree1()
2371 r = get_char_length_tree1(en->target, reg, len, level); in get_char_length_tree1()
2383 r = GET_CHAR_LEN_VARLEN; in get_char_length_tree1()
2387 return r; in get_char_length_tree1()
2662 int type, r = 0; in check_type_tree() local
2672 r = check_type_tree(NCAR(node), type_mask, enclose_mask, in check_type_tree()
2674 } while (r == 0 && IS_NOT_NULL(node = NCDR(node))); in check_type_tree()
2678 r = check_type_tree(NQTFR(node)->target, type_mask, enclose_mask, in check_type_tree()
2688 r = check_type_tree(en->target, type_mask, enclose_mask, anchor_mask); in check_type_tree()
2698 r = check_type_tree(NANCHOR(node)->target, in check_type_tree()
2705 return r; in check_type_tree()
2717 int r = 0; in subexp_inf_recursive_check() local
2731 r |= ret; in subexp_inf_recursive_check()
2744 r = RECURSION_EXIST; in subexp_inf_recursive_check()
2748 r &= ret; in subexp_inf_recursive_check()
2754 r = subexp_inf_recursive_check(NQTFR(node)->target, env, head); in subexp_inf_recursive_check()
2755 if (r == RECURSION_EXIST) { in subexp_inf_recursive_check()
2756 if (NQTFR(node)->lower == 0) r = 0; in subexp_inf_recursive_check()
2768 r = subexp_inf_recursive_check(an->target, env, head); in subexp_inf_recursive_check()
2775 r = subexp_inf_recursive_check(NCALL(node)->target, env, head); in subexp_inf_recursive_check()
2785 r = subexp_inf_recursive_check(NENCLOSE(node)->target, env, head); in subexp_inf_recursive_check()
2794 return r; in subexp_inf_recursive_check()
2801 int r = 0; in subexp_inf_recursive_check_trav() local
2808 r = subexp_inf_recursive_check_trav(NCAR(node), env); in subexp_inf_recursive_check_trav()
2809 } while (r == 0 && IS_NOT_NULL(node = NCDR(node))); in subexp_inf_recursive_check_trav()
2813 r = subexp_inf_recursive_check_trav(NQTFR(node)->target, env); in subexp_inf_recursive_check_trav()
2824 r = subexp_inf_recursive_check_trav(an->target, env); in subexp_inf_recursive_check_trav()
2836 r = subexp_inf_recursive_check(en->target, env, 1); in subexp_inf_recursive_check_trav()
2837 if (r > 0) return ONIGERR_NEVER_ENDING_RECURSION; in subexp_inf_recursive_check_trav()
2840 r = subexp_inf_recursive_check_trav(en->target, env); in subexp_inf_recursive_check_trav()
2849 return r; in subexp_inf_recursive_check_trav()
2855 int r = 0; in subexp_recursive_check() local
2861 r |= subexp_recursive_check(NCAR(node)); in subexp_recursive_check()
2866 r = subexp_recursive_check(NQTFR(node)->target); in subexp_recursive_check()
2877 r = subexp_recursive_check(an->target); in subexp_recursive_check()
2884 r = subexp_recursive_check(NCALL(node)->target); in subexp_recursive_check()
2885 if (r != 0) SET_CALL_RECURSION(node); in subexp_recursive_check()
2895 r = subexp_recursive_check(NENCLOSE(node)->target); in subexp_recursive_check()
2904 return r; in subexp_recursive_check()
2914 int r = 0; in subexp_recursive_check_trav() local
2924 if (ret == FOUND_CALLED_NODE) r = FOUND_CALLED_NODE; in subexp_recursive_check_trav()
2931 r = subexp_recursive_check_trav(NQTFR(node)->target, env); in subexp_recursive_check_trav()
2933 if (r == FOUND_CALLED_NODE) in subexp_recursive_check_trav()
2946 r = subexp_recursive_check_trav(an->target, env); in subexp_recursive_check_trav()
2959 r = subexp_recursive_check(en->target); in subexp_recursive_check_trav()
2960 if (r != 0) SET_ENCLOSE_STATUS(node, NST_RECURSION); in subexp_recursive_check_trav()
2964 r = subexp_recursive_check_trav(en->target, env); in subexp_recursive_check_trav()
2966 r |= FOUND_CALLED_NODE; in subexp_recursive_check_trav()
2974 return r; in subexp_recursive_check_trav()
2981 int r = 0; in setup_subexp_call() local
2987 r = setup_subexp_call(NCAR(node), env); in setup_subexp_call()
2988 } while (r == 0 && IS_NOT_NULL(node = NCDR(node))); in setup_subexp_call()
2993 r = setup_subexp_call(NCAR(node), env); in setup_subexp_call()
2994 } while (r == 0 && IS_NOT_NULL(node = NCDR(node))); in setup_subexp_call()
2998 r = setup_subexp_call(NQTFR(node)->target, env); in setup_subexp_call()
3001 r = setup_subexp_call(NENCLOSE(node)->target, env); in setup_subexp_call()
3072 r = setup_subexp_call(an->target, env); in setup_subexp_call()
3082 return r; in setup_subexp_call()
3123 int r, len; in setup_look_behind() local
3126 r = get_char_length_tree(an->target, reg, &len); in setup_look_behind()
3127 if (r == 0) in setup_look_behind()
3129 else if (r == GET_CHAR_LEN_VARLEN) in setup_look_behind()
3130 r = ONIGERR_INVALID_LOOK_BEHIND_PATTERN; in setup_look_behind()
3131 else if (r == GET_CHAR_LEN_TOP_ALT_VARLEN) { in setup_look_behind()
3133 r = divide_look_behind_alternatives(node); in setup_look_behind()
3135 r = ONIGERR_INVALID_LOOK_BEHIND_PATTERN; in setup_look_behind()
3138 return r; in setup_look_behind()
3194 int r, i, len, sbuf_size; in update_string_node_case_fold() local
3220 r = onig_node_str_set(node, sbuf, sp); in update_string_node_case_fold()
3221 if (r != 0) { in update_string_node_case_fold()
3223 return r; in update_string_node_case_fold()
3234 int r; in expand_case_fold_make_rem_string() local
3240 r = update_string_node_case_fold(reg, node); in expand_case_fold_make_rem_string()
3241 if (r != 0) { in expand_case_fold_make_rem_string()
3243 return r; in expand_case_fold_make_rem_string()
3257 int r, i, j, len, varlen; in expand_case_fold_string_alt() local
3300 r = len; in expand_case_fold_string_alt()
3304 r = onig_node_str_cat(snode, buf, buf + len); in expand_case_fold_string_alt()
3305 if (r != 0) goto mem_err2; in expand_case_fold_string_alt()
3318 r = expand_case_fold_make_rem_string(&rem, q, end, reg); in expand_case_fold_string_alt()
3319 if (r != 0) { in expand_case_fold_string_alt()
3369 int r, n, len, alt_num; in expand_case_fold_string() local
3381 r = 0; in expand_case_fold_string()
3389 r = n; in expand_case_fold_string()
3415 r = onig_node_str_cat(snode, p, p + len); in expand_case_fold_string()
3416 if (r != 0) goto err; in expand_case_fold_string()
3430 r = expand_case_fold_string_alt(n, items, p, len, end, reg, &prev_node); in expand_case_fold_string()
3431 if (r < 0) goto mem_err; in expand_case_fold_string()
3432 if (r == 1) { in expand_case_fold_string()
3463 r = expand_case_fold_make_rem_string(&srem, p, end, reg); in expand_case_fold_string()
3464 if (r != 0) goto mem_err; in expand_case_fold_string()
3493 r = ONIGERR_MEMORY; in expand_case_fold_string()
3497 return r; in expand_case_fold_string()
3514 int r = state; in setup_comb_exp_check() local
3522 r = setup_comb_exp_check(NCAR(node), r, env); in setup_comb_exp_check()
3524 } while (r >= 0 && IS_NOT_NULL(node = NCDR(node))); in setup_comb_exp_check()
3533 r |= ret; in setup_comb_exp_check()
3598 r = setup_comb_exp_check(target, child_state, env); in setup_comb_exp_check()
3599 r |= add_state; in setup_comb_exp_check()
3613 r = setup_comb_exp_check(en->target, state, env); in setup_comb_exp_check()
3618 r = setup_comb_exp_check(en->target, state, env); in setup_comb_exp_check()
3629 r = setup_comb_exp_check(NCALL(node)->target, state, env); in setup_comb_exp_check()
3637 return r; in setup_comb_exp_check()
3658 int r = 0; in setup_tree() local
3666 r = setup_tree(NCAR(node), reg, state, env); in setup_tree()
3667 if (IS_NOT_NULL(prev) && r == 0) { in setup_tree()
3668 r = next_setup(prev, NCAR(node), reg); in setup_tree()
3671 } while (r == 0 && IS_NOT_NULL(node = NCDR(node))); in setup_tree()
3677 r = setup_tree(NCAR(node), reg, (state | IN_ALT), env); in setup_tree()
3678 } while (r == 0 && IS_NOT_NULL(node = NCDR(node))); in setup_tree()
3686 r = expand_case_fold_string(node, reg); in setup_tree()
3731 r = get_min_match_length(target, &d, env); in setup_tree()
3732 if (r) break; in setup_tree()
3736 r = quantifiers_memory_node_info(target); in setup_tree()
3737 if (r < 0) break; in setup_tree()
3738 if (r > 0) { in setup_tree()
3739 qn->target_empty_info = r; in setup_tree()
3743 r = get_max_match_length(target, &d, env); in setup_tree()
3744 if (r == 0 && d == 0) { in setup_tree()
3759 r = setup_tree(target, reg, state, env); in setup_tree()
3760 if (r) break; in setup_tree()
3774 r = onig_node_str_cat(node, sn->s, sn->end); in setup_tree()
3775 if (r) break; in setup_tree()
3809 r = setup_tree(NENCLOSE(node)->target, reg, state, env); in setup_tree()
3819 r = setup_tree(en->target, reg, state, env); in setup_tree()
3825 r = setup_tree(target, reg, state, env); in setup_tree()
3847 r = setup_tree(an->target, reg, state, env); in setup_tree()
3850 r = setup_tree(an->target, reg, (state | IN_NOT), env); in setup_tree()
3868 r = check_type_tree(an->target, ALLOWED_TYPE_IN_LB, in setup_tree()
3870 if (r < 0) return r; in setup_tree()
3871 if (r > 0) return ONIGERR_INVALID_LOOK_BEHIND_PATTERN; in setup_tree()
3872 r = setup_look_behind(node, reg, env); in setup_tree()
3873 if (r != 0) return r; in setup_tree()
3874 r = setup_tree(an->target, reg, state, env); in setup_tree()
3880 r = check_type_tree(an->target, ALLOWED_TYPE_IN_LB, in setup_tree()
3882 if (r < 0) return r; in setup_tree()
3883 if (r > 0) return ONIGERR_INVALID_LOOK_BEHIND_PATTERN; in setup_tree()
3884 r = setup_look_behind(node, reg, env); in setup_tree()
3885 if (r != 0) return r; in setup_tree()
3886 r = setup_tree(an->target, reg, (state | IN_NOT), env); in setup_tree()
3897 return r; in setup_tree()
4541 int r = 0; in optimize_node_left() local
4556 r = optimize_node_left(NCAR(nd), &nopt, &nenv); in optimize_node_left()
4557 if (r == 0) { in optimize_node_left()
4561 } while (r == 0 && IS_NOT_NULL(nd = NCDR(nd))); in optimize_node_left()
4571 r = optimize_node_left(NCAR(nd), &nopt, env); in optimize_node_left()
4572 if (r == 0) { in optimize_node_left()
4576 } while ((r == 0) && IS_NOT_NULL(nd = NCDR(nd))); in optimize_node_left()
4607 r = add_char_amb_opt_map_info(&opt->map, sn->s, sn->end, in optimize_node_left()
4609 if (r != 0) break; in optimize_node_left()
4706 r = optimize_node_left(NANCHOR(node)->target, &nopt, env); in optimize_node_left()
4707 if (r == 0) { in optimize_node_left()
4741 r = get_min_match_length(nodes[backs[0]], &min, env->scan_env); in optimize_node_left()
4742 if (r != 0) break; in optimize_node_left()
4743 r = get_max_match_length(nodes[backs[0]], &max, env->scan_env); in optimize_node_left()
4744 if (r != 0) break; in optimize_node_left()
4746 r = get_min_match_length(nodes[backs[i]], &tmin, env->scan_env); in optimize_node_left()
4747 if (r != 0) break; in optimize_node_left()
4748 r = get_max_match_length(nodes[backs[i]], &tmax, env->scan_env); in optimize_node_left()
4749 if (r != 0) break; in optimize_node_left()
4753 if (r == 0) set_mml(&opt->len, min, max); in optimize_node_left()
4764 r = optimize_node_left(NCALL(node)->target, opt, env); in optimize_node_left()
4777 r = optimize_node_left(qn->target, &nopt, env); in optimize_node_left()
4778 if (r) break; in optimize_node_left()
4833 r = optimize_node_left(en->target, opt, env); in optimize_node_left()
4853 r = optimize_node_left(en->target, opt, env); in optimize_node_left()
4863 r = optimize_node_left(en->target, opt, env); in optimize_node_left()
4874 r = ONIGERR_TYPE_BUG; in optimize_node_left()
4878 return r; in optimize_node_left()
4884 int r; in set_optimize_exact_info() local
4906 r = set_bm_skip(reg->exact, reg->exact_end, reg->enc, in set_optimize_exact_info()
4908 if (r) return r; in set_optimize_exact_info()
4960 int r; in set_optimize_info_from_tree() local
4970 r = optimize_node_left(node, &opt, &env); in set_optimize_info_from_tree()
4971 if (r) return r; in set_optimize_info_from_tree()
4990 r = set_optimize_exact_info(reg, &opt.exb); in set_optimize_info_from_tree()
5008 return r; in set_optimize_info_from_tree()
5267 int r, init_size; in onig_compile() local
5285 r = BBUF_INIT(reg, init_size); in onig_compile()
5286 if (r != 0) goto end; in onig_compile()
5300 r = onig_parse_make_tree(&root, pattern, pattern_end, reg, &scan_env); in onig_compile()
5301 if (r != 0) goto err; in onig_compile()
5309 r = disable_noname_group_capture(&root, reg, &scan_env); in onig_compile()
5311 r = numbered_ref_check(root); in onig_compile()
5313 if (r != 0) goto err; in onig_compile()
5319 r = unset_addr_list_init(&uslist, scan_env.num_call); in onig_compile()
5320 if (r != 0) goto err; in onig_compile()
5322 r = setup_subexp_call(root, &scan_env); in onig_compile()
5323 if (r != 0) goto err_unset; in onig_compile()
5324 r = subexp_recursive_check_trav(root, &scan_env); in onig_compile()
5325 if (r < 0) goto err_unset; in onig_compile()
5326 r = subexp_inf_recursive_check_trav(root, &scan_env); in onig_compile()
5327 if (r != 0) goto err_unset; in onig_compile()
5335 r = setup_tree(root, reg, 0, &scan_env); in onig_compile()
5336 if (r != 0) goto err_unset; in onig_compile()
5381 r = set_optimize_info_from_tree(root, reg, &scan_env); in onig_compile()
5382 if (r != 0) goto err_unset; in onig_compile()
5390 r = compile_tree(root, reg); in onig_compile()
5391 if (r == 0) { in onig_compile()
5392 r = add_opcode(reg, OP_END); in onig_compile()
5395 r = unset_addr_list_fix(&uslist, reg); in onig_compile()
5397 if (r) goto err; in onig_compile()
5426 return r; in onig_compile()
5446 return r; in onig_compile()
5455 int r; in onig_recompile() local
5458 r = onig_new(&new_reg, pattern, pattern_end, option, enc, syntax, einfo); in onig_recompile()
5459 if (r) return r; in onig_recompile()
5523 int r; in onig_new_without_alloc() local
5525 r = onig_reg_init(reg, option, ONIGENC_CASE_FOLD_DEFAULT, enc, syntax); in onig_new_without_alloc()
5526 if (r) return r; in onig_new_without_alloc()
5528 r = onig_compile(reg, pattern, pattern_end, einfo); in onig_new_without_alloc()
5529 return r; in onig_new_without_alloc()
5537 int r; in onig_new() local
5542 r = onig_reg_init(*reg, option, ONIGENC_CASE_FOLD_DEFAULT, enc, syntax); in onig_new()
5543 if (r) goto err; in onig_new()
5545 r = onig_compile(*reg, pattern, pattern_end, einfo); in onig_new()
5546 if (r) { in onig_new()
5551 return r; in onig_new()