Lines Matching refs:r

56     UChar* r = (UChar* )xmalloc(len + 1);  in k_strdup()  local
57 CHECK_NULL_RETURN(r); in k_strdup()
58 xmemcpy(r, s, len); in k_strdup()
59 r[len] = (UChar )0; in k_strdup()
60 return r; in k_strdup()
251 int r; in add_opcode_rel_addr() local
253 r = add_opcode(reg, opcode); in add_opcode_rel_addr()
254 if (r) return r; in add_opcode_rel_addr()
255 r = add_rel_addr(reg, addr); in add_opcode_rel_addr()
256 return r; in add_opcode_rel_addr()
276 int r; in add_opcode_option() local
278 r = add_opcode(reg, opcode); in add_opcode_option()
279 if (r) return r; in add_opcode_option()
280 r = add_option(reg, option); in add_opcode_option()
281 return r; in add_opcode_option()
340 int r; in compile_tree_empty_check() local
344 r = add_opcode(reg, OP_NULL_CHECK_START); in compile_tree_empty_check()
345 if (r) return r; in compile_tree_empty_check()
346 r = add_mem_num(reg, reg->num_null_check); /* NULL CHECK ID */ in compile_tree_empty_check()
347 if (r) return r; in compile_tree_empty_check()
351 r = compile_tree(node, reg); in compile_tree_empty_check()
352 if (r) return r; in compile_tree_empty_check()
356 r = add_opcode(reg, OP_NULL_CHECK_END); in compile_tree_empty_check()
358 r = add_opcode(reg, OP_NULL_CHECK_END_MEMST); in compile_tree_empty_check()
360 r = add_opcode(reg, OP_NULL_CHECK_END_MEMST_PUSH); in compile_tree_empty_check()
362 if (r) return r; in compile_tree_empty_check()
363 r = add_mem_num(reg, saved_num_null_check); /* NULL CHECK ID */ in compile_tree_empty_check()
365 return r; in compile_tree_empty_check()
372 int r; in compile_call() local
374 r = add_opcode(reg, OP_CALL); in compile_call()
375 if (r) return r; in compile_call()
376 r = unset_addr_list_add(node->unset_addr_list, BBUF_GET_OFFSET_POS(reg), in compile_call()
378 if (r) return r; in compile_call()
379 r = add_abs_addr(reg, 0 /*dummy addr.*/); in compile_call()
380 return r; in compile_call()
387 int i, r; in compile_tree_n_times() local
390 r = compile_tree(node, reg); in compile_tree_n_times()
391 if (r) return r; in compile_tree_n_times()
438 int rlen, r, len, prev_len, slen, ambig; in compile_length_string_node() local
461 r = add_compile_string_length(prev, prev_len, slen, reg, ambig); in compile_length_string_node()
462 rlen += r; in compile_length_string_node()
469 r = add_compile_string_length(prev, prev_len, slen, reg, ambig); in compile_length_string_node()
470 rlen += r; in compile_length_string_node()
486 int r, len, prev_len, slen, ambig; in compile_string_node() local
509 r = add_compile_string(prev, prev_len, slen, reg, ambig); in compile_string_node()
510 if (r) return r; in compile_string_node()
540 int r, pad_size; in add_multi_byte_cclass()
547 r = add_bytes(reg, mbuf->p, mbuf->used); in add_multi_byte_cclass()
552 return r; in add_multi_byte_cclass()
589 int r; in compile_cclass_node() local
593 r = add_pointer(reg, cc); in compile_cclass_node()
594 return r; in compile_cclass_node()
603 r = add_bitset(reg, cc->bs); in compile_cclass_node()
612 r = add_multi_byte_cclass(cc->mbuf, reg); in compile_cclass_node()
620 r = add_bitset(reg, cc->bs); in compile_cclass_node()
621 if (r) return r; in compile_cclass_node()
622 r = add_multi_byte_cclass(cc->mbuf, reg); in compile_cclass_node()
626 return r; in compile_cclass_node()
664 int r; in compile_range_repeat_node() local
667 r = add_opcode(reg, qn->greedy ? OP_REPEAT : OP_REPEAT_NG); in compile_range_repeat_node()
668 if (r) return r; in compile_range_repeat_node()
669 r = add_mem_num(reg, num_repeat); /* OP_REPEAT ID */ in compile_range_repeat_node()
671 if (r) return r; in compile_range_repeat_node()
672 r = add_rel_addr(reg, target_len + SIZE_OP_REPEAT_INC); in compile_range_repeat_node()
673 if (r) return r; in compile_range_repeat_node()
675 r = entry_repeat_range(reg, num_repeat, qn->lower, qn->upper); in compile_range_repeat_node()
676 if (r) return r; in compile_range_repeat_node()
678 r = compile_tree_empty_check(qn->target, reg, empty_info); in compile_range_repeat_node()
679 if (r) return r; 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()
691 if (r) return r; in compile_range_repeat_node()
692 r = add_mem_num(reg, num_repeat); /* OP_REPEAT ID */ in compile_range_repeat_node()
693 return r; in compile_range_repeat_node()
794 int r, mod_tlen; in compile_quantifier_node() local
805 r = compile_tree_n_times(qn->target, qn->lower, reg); in compile_quantifier_node()
806 if (r) return r; in compile_quantifier_node()
809 r = add_opcode(reg, OP_ANYCHAR_ML_STAR_PEEK_NEXT); in compile_quantifier_node()
811 r = add_opcode(reg, OP_ANYCHAR_STAR_PEEK_NEXT); in compile_quantifier_node()
812 if (r) return r; in compile_quantifier_node()
814 r = add_state_check_num(reg, ckn); in compile_quantifier_node()
815 if (r) return r; in compile_quantifier_node()
822 r = add_opcode(reg, (CKN_ON ? in compile_quantifier_node()
827 r = add_opcode(reg, (CKN_ON ? in compile_quantifier_node()
831 if (r) return r; in compile_quantifier_node()
833 r = add_state_check_num(reg, ckn); in compile_quantifier_node()
835 return r; in compile_quantifier_node()
847 r = add_opcode_rel_addr(reg, OP_JUMP, in compile_quantifier_node()
849 if (r) return r; in compile_quantifier_node()
853 r = add_opcode(reg, OP_STATE_CHECK_PUSH); in compile_quantifier_node()
854 if (r) return r; in compile_quantifier_node()
855 r = add_state_check_num(reg, ckn); in compile_quantifier_node()
856 if (r) return r; in compile_quantifier_node()
857 r = add_rel_addr(reg, mod_tlen + SIZE_OP_JUMP); in compile_quantifier_node()
860 r = add_opcode_rel_addr(reg, OP_PUSH, mod_tlen + SIZE_OP_JUMP); in compile_quantifier_node()
862 if (r) return r; in compile_quantifier_node()
863 r = compile_tree_empty_check(qn->target, reg, empty_info); in compile_quantifier_node()
864 if (r) return r; in compile_quantifier_node()
865 r = add_opcode_rel_addr(reg, OP_JUMP, in compile_quantifier_node()
871 r = add_opcode_rel_addr(reg, OP_JUMP, mod_tlen); in compile_quantifier_node()
872 if (r) return r; in compile_quantifier_node()
874 r = compile_tree_empty_check(qn->target, reg, empty_info); in compile_quantifier_node()
875 if (r) return r; in compile_quantifier_node()
877 r = add_opcode(reg, OP_STATE_CHECK_PUSH_OR_JUMP); in compile_quantifier_node()
878 if (r) return r; in compile_quantifier_node()
879 r = add_state_check_num(reg, ckn); in compile_quantifier_node()
880 if (r) return r; in compile_quantifier_node()
881 r = add_rel_addr(reg, in compile_quantifier_node()
885 r = add_opcode_rel_addr(reg, OP_PUSH, -(mod_tlen + (int )SIZE_OP_PUSH)); in compile_quantifier_node()
890 r = add_opcode_rel_addr(reg, OP_JUMP, tlen); in compile_quantifier_node()
891 if (r) return r; in compile_quantifier_node()
892 r = compile_tree(qn->target, reg); in compile_quantifier_node()
895 r = 0; in compile_quantifier_node()
900 r = add_opcode(reg, OP_STATE_CHECK_PUSH); in compile_quantifier_node()
901 if (r) return r; in compile_quantifier_node()
902 r = add_state_check_num(reg, ckn); in compile_quantifier_node()
903 if (r) return r; in compile_quantifier_node()
904 r = add_rel_addr(reg, tlen); in compile_quantifier_node()
907 r = add_opcode_rel_addr(reg, OP_PUSH, tlen); in compile_quantifier_node()
909 if (r) return r; in compile_quantifier_node()
912 r = compile_tree(qn->target, reg); in compile_quantifier_node()
916 r = add_opcode(reg, OP_STATE_CHECK_PUSH); in compile_quantifier_node()
917 if (r) return r; in compile_quantifier_node()
918 r = add_state_check_num(reg, ckn); in compile_quantifier_node()
919 if (r) return r; in compile_quantifier_node()
920 r = add_rel_addr(reg, SIZE_OP_JUMP); in compile_quantifier_node()
923 r = add_opcode_rel_addr(reg, OP_PUSH, SIZE_OP_JUMP); in compile_quantifier_node()
926 if (r) return r; in compile_quantifier_node()
927 r = add_opcode_rel_addr(reg, OP_JUMP, tlen); in compile_quantifier_node()
928 if (r) return r; 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()
934 if (r) return r; in compile_quantifier_node()
935 r = add_opcode(reg, OP_STATE_CHECK); in compile_quantifier_node()
936 if (r) return r; in compile_quantifier_node()
937 r = add_state_check_num(reg, ckn); in compile_quantifier_node()
940 return r; in compile_quantifier_node()
1013 int i, r, mod_tlen; in compile_quantifier_node() local
1021 r = compile_tree_n_times(qn->target, qn->lower, reg); in compile_quantifier_node()
1022 if (r) return r; in compile_quantifier_node()
1025 r = add_opcode(reg, OP_ANYCHAR_ML_STAR_PEEK_NEXT); in compile_quantifier_node()
1027 r = add_opcode(reg, OP_ANYCHAR_STAR_PEEK_NEXT); in compile_quantifier_node()
1028 if (r) return r; in compile_quantifier_node()
1049 r = add_opcode_rel_addr(reg, OP_JUMP, SIZE_OP_PUSH_OR_JUMP_EXACT1); in compile_quantifier_node()
1051 r = add_opcode_rel_addr(reg, OP_JUMP, SIZE_OP_PUSH_IF_PEEK_NEXT); in compile_quantifier_node()
1053 r = add_opcode_rel_addr(reg, OP_JUMP, SIZE_OP_PUSH); in compile_quantifier_node()
1056 r = add_opcode_rel_addr(reg, OP_JUMP, SIZE_OP_JUMP); in compile_quantifier_node()
1058 if (r) return r; in compile_quantifier_node()
1061 r = compile_tree_n_times(qn->target, qn->lower, reg); in compile_quantifier_node()
1062 if (r) return r; in compile_quantifier_node()
1067 r = add_opcode_rel_addr(reg, OP_PUSH_OR_JUMP_EXACT1, in compile_quantifier_node()
1069 if (r) return r; in compile_quantifier_node()
1071 r = compile_tree_empty_check(qn->target, reg, empty_info); in compile_quantifier_node()
1072 if (r) return r; in compile_quantifier_node()
1073 r = add_opcode_rel_addr(reg, OP_JUMP, in compile_quantifier_node()
1077 r = add_opcode_rel_addr(reg, OP_PUSH_IF_PEEK_NEXT, in compile_quantifier_node()
1079 if (r) return r; in compile_quantifier_node()
1081 r = compile_tree_empty_check(qn->target, reg, empty_info); in compile_quantifier_node()
1082 if (r) return r; in compile_quantifier_node()
1083 r = add_opcode_rel_addr(reg, OP_JUMP, in compile_quantifier_node()
1087 r = add_opcode_rel_addr(reg, OP_PUSH, mod_tlen + SIZE_OP_JUMP); in compile_quantifier_node()
1088 if (r) return r; in compile_quantifier_node()
1089 r = compile_tree_empty_check(qn->target, reg, empty_info); in compile_quantifier_node()
1090 if (r) return r; in compile_quantifier_node()
1091 r = add_opcode_rel_addr(reg, OP_JUMP, in compile_quantifier_node()
1096 r = add_opcode_rel_addr(reg, OP_JUMP, mod_tlen); in compile_quantifier_node()
1097 if (r) return r; in compile_quantifier_node()
1098 r = compile_tree_empty_check(qn->target, reg, empty_info); in compile_quantifier_node()
1099 if (r) return r; in compile_quantifier_node()
1100 r = add_opcode_rel_addr(reg, OP_PUSH, -(mod_tlen + (int )SIZE_OP_PUSH)); in compile_quantifier_node()
1104 r = add_opcode_rel_addr(reg, OP_JUMP, tlen); in compile_quantifier_node()
1105 if (r) return r; in compile_quantifier_node()
1106 r = compile_tree(qn->target, reg); in compile_quantifier_node()
1113 r = compile_tree_n_times(qn->target, qn->lower, reg); in compile_quantifier_node()
1114 if (r) return r; in compile_quantifier_node()
1117 r = add_opcode_rel_addr(reg, OP_PUSH, in compile_quantifier_node()
1119 if (r) return r; in compile_quantifier_node()
1120 r = compile_tree(qn->target, reg); in compile_quantifier_node()
1121 if (r) return r; in compile_quantifier_node()
1125 r = add_opcode_rel_addr(reg, OP_PUSH, SIZE_OP_JUMP); in compile_quantifier_node()
1126 if (r) return r; in compile_quantifier_node()
1127 r = add_opcode_rel_addr(reg, OP_JUMP, tlen); in compile_quantifier_node()
1128 if (r) return r; 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()
1134 return r; in compile_quantifier_node()
1161 int r; in compile_option_node() local
1165 r = add_opcode_option(reg, OP_SET_OPTION_PUSH, node->option); in compile_option_node()
1166 if (r) return r; in compile_option_node()
1167 r = add_opcode_option(reg, OP_SET_OPTION, prev); in compile_option_node()
1168 if (r) return r; in compile_option_node()
1169 r = add_opcode(reg, OP_FAIL); in compile_option_node()
1170 if (r) return r; in compile_option_node()
1174 r = compile_tree(node->target, reg); in compile_option_node()
1178 if (r) return r; in compile_option_node()
1179 r = add_opcode_option(reg, OP_SET_OPTION, prev); in compile_option_node()
1181 return r; in compile_option_node()
1253 int r, len; in compile_effect_node() local
1262 r = add_opcode(reg, OP_CALL); in compile_effect_node()
1263 if (r) return r; in compile_effect_node()
1266 r = add_abs_addr(reg, (int )node->call_addr); in compile_effect_node()
1267 if (r) return r; in compile_effect_node()
1277 r = add_opcode_rel_addr(reg, OP_JUMP, len); in compile_effect_node()
1278 if (r) return r; in compile_effect_node()
1282 r = add_opcode(reg, OP_MEMORY_START_PUSH); in compile_effect_node()
1284 r = add_opcode(reg, OP_MEMORY_START); in compile_effect_node()
1285 if (r) return r; in compile_effect_node()
1286 r = add_mem_num(reg, node->regnum); in compile_effect_node()
1287 if (r) return r; in compile_effect_node()
1288 r = compile_tree(node->target, reg); in compile_effect_node()
1289 if (r) return r; in compile_effect_node()
1293 r = add_opcode(reg, (IS_EFFECT_RECURSION(node) in compile_effect_node()
1296 r = add_opcode(reg, (IS_EFFECT_RECURSION(node) in compile_effect_node()
1299 if (r) return r; in compile_effect_node()
1300 r = add_mem_num(reg, node->regnum); in compile_effect_node()
1301 if (r) return r; in compile_effect_node()
1302 r = add_opcode(reg, OP_RETURN); in compile_effect_node()
1308 r = add_opcode(reg, OP_MEMORY_END_PUSH); in compile_effect_node()
1310 r = add_opcode(reg, OP_MEMORY_END); in compile_effect_node()
1311 if (r) return r; in compile_effect_node()
1312 r = add_mem_num(reg, node->regnum); in compile_effect_node()
1319 r = compile_tree_n_times(qn->target, qn->lower, reg); in compile_effect_node()
1320 if (r) return r; in compile_effect_node()
1325 r = add_opcode_rel_addr(reg, OP_PUSH, len + SIZE_OP_POP + SIZE_OP_JUMP); in compile_effect_node()
1326 if (r) return r; in compile_effect_node()
1327 r = compile_tree(qn->target, reg); in compile_effect_node()
1328 if (r) return r; in compile_effect_node()
1329 r = add_opcode(reg, OP_POP); in compile_effect_node()
1330 if (r) return r; in compile_effect_node()
1331 r = add_opcode_rel_addr(reg, OP_JUMP, in compile_effect_node()
1335 r = add_opcode(reg, OP_PUSH_STOP_BT); in compile_effect_node()
1336 if (r) return r; in compile_effect_node()
1337 r = compile_tree(node->target, reg); in compile_effect_node()
1338 if (r) return r; in compile_effect_node()
1339 r = add_opcode(reg, OP_POP_STOP_BT); in compile_effect_node()
1348 return r; in compile_effect_node()
1387 int r, len; in compile_anchor_node() local
1390 case ANCHOR_BEGIN_BUF: r = add_opcode(reg, OP_BEGIN_BUF); break; in compile_anchor_node()
1391 case ANCHOR_END_BUF: r = add_opcode(reg, OP_END_BUF); break; in compile_anchor_node()
1392 case ANCHOR_BEGIN_LINE: r = add_opcode(reg, OP_BEGIN_LINE); break; in compile_anchor_node()
1393 case ANCHOR_END_LINE: r = add_opcode(reg, OP_END_LINE); break; in compile_anchor_node()
1394 case ANCHOR_SEMI_END_BUF: r = add_opcode(reg, OP_SEMI_END_BUF); break; in compile_anchor_node()
1395 case ANCHOR_BEGIN_POSITION: r = add_opcode(reg, OP_BEGIN_POSITION); break; in compile_anchor_node()
1397 case ANCHOR_WORD_BOUND: r = add_opcode(reg, OP_WORD_BOUND); break; in compile_anchor_node()
1398 case ANCHOR_NOT_WORD_BOUND: r = add_opcode(reg, OP_NOT_WORD_BOUND); break; in compile_anchor_node()
1400 case ANCHOR_WORD_BEGIN: r = add_opcode(reg, OP_WORD_BEGIN); break; in compile_anchor_node()
1401 case ANCHOR_WORD_END: r = add_opcode(reg, OP_WORD_END); break; in compile_anchor_node()
1405 r = add_opcode(reg, OP_PUSH_POS); in compile_anchor_node()
1406 if (r) return r; in compile_anchor_node()
1407 r = compile_tree(node->target, reg); in compile_anchor_node()
1408 if (r) return r; in compile_anchor_node()
1409 r = add_opcode(reg, OP_POP_POS); in compile_anchor_node()
1415 r = add_opcode_rel_addr(reg, OP_PUSH_POS_NOT, len + SIZE_OP_FAIL_POS); in compile_anchor_node()
1416 if (r) return r; in compile_anchor_node()
1417 r = compile_tree(node->target, reg); in compile_anchor_node()
1418 if (r) return r; in compile_anchor_node()
1419 r = add_opcode(reg, OP_FAIL_POS); in compile_anchor_node()
1425 r = add_opcode(reg, OP_LOOK_BEHIND); in compile_anchor_node()
1426 if (r) return r; in compile_anchor_node()
1428 r = get_char_length_tree(node->target, reg, &n); in compile_anchor_node()
1429 if (r) return ONIGERR_INVALID_LOOK_BEHIND_PATTERN; in compile_anchor_node()
1433 r = add_length(reg, n); in compile_anchor_node()
1434 if (r) return r; in compile_anchor_node()
1435 r = compile_tree(node->target, reg); in compile_anchor_node()
1443 r = add_opcode_rel_addr(reg, OP_PUSH_LOOK_BEHIND_NOT, in compile_anchor_node()
1445 if (r) return r; in compile_anchor_node()
1447 r = get_char_length_tree(node->target, reg, &n); in compile_anchor_node()
1448 if (r) return ONIGERR_INVALID_LOOK_BEHIND_PATTERN; in compile_anchor_node()
1452 r = add_length(reg, n); in compile_anchor_node()
1453 if (r) return r; in compile_anchor_node()
1454 r = compile_tree(node->target, reg); in compile_anchor_node()
1455 if (r) return r; in compile_anchor_node()
1456 r = add_opcode(reg, OP_FAIL_LOOK_BEHIND_NOT); in compile_anchor_node()
1465 return r; in compile_anchor_node()
1471 int len, type, r; in compile_length_tree() local
1478 r = compile_length_tree(NCONS(node).left, reg); in compile_length_tree()
1479 if (r < 0) return r; in compile_length_tree()
1480 len += r; in compile_length_tree()
1482 r = len; in compile_length_tree()
1489 n = r = 0; in compile_length_tree()
1491 r += compile_length_tree(NCONS(node).left, reg); in compile_length_tree()
1494 r += (SIZE_OP_PUSH + SIZE_OP_JUMP) * (n - 1); in compile_length_tree()
1500 r = compile_length_string_raw_node(&(NSTRING(node)), reg); in compile_length_tree()
1502 r = compile_length_string_node(node, reg); in compile_length_tree()
1506 r = compile_length_cclass_node(&(NCCLASS(node)), reg); in compile_length_tree()
1511 r = SIZE_OPCODE; in compile_length_tree()
1520 r = SIZE_OPCODE + SIZE_OPTION + SIZE_LENGTH + in compile_length_tree()
1526 r = ((!IS_IGNORECASE(reg->options) && br->back_static[0] <= 2) in compile_length_tree()
1530 r = SIZE_OPCODE + SIZE_LENGTH + (SIZE_MEMNUM * br->back_num); in compile_length_tree()
1537 r = SIZE_OP_CALL; in compile_length_tree()
1542 r = compile_length_quantifier_node(&(NQUANTIFIER(node)), reg); in compile_length_tree()
1546 r = compile_length_effect_node(&NEFFECT(node), reg); in compile_length_tree()
1550 r = compile_length_anchor_node(&(NANCHOR(node)), reg); in compile_length_tree()
1558 return r; in compile_length_tree()
1564 int n, type, len, pos, r = 0; in compile_tree() local
1570 r = compile_tree(NCONS(node).left, reg); in compile_tree()
1571 } while (r == 0 && IS_NOT_NULL(node = NCONS(node).right)); in compile_tree()
1589 r = add_opcode_rel_addr(reg, OP_PUSH, len + SIZE_OP_JUMP); in compile_tree()
1590 if (r) break; in compile_tree()
1592 r = compile_tree(NCONS(node).left, reg); in compile_tree()
1593 if (r) break; in compile_tree()
1596 r = add_opcode_rel_addr(reg, OP_JUMP, len); in compile_tree()
1597 if (r) break; in compile_tree()
1605 r = compile_string_raw_node(&(NSTRING(node)), reg); in compile_tree()
1607 r = compile_string_node(node, reg); in compile_tree()
1611 r = compile_cclass_node(&(NCCLASS(node)), reg); in compile_tree()
1625 r = add_opcode(reg, op); in compile_tree()
1631 r = add_opcode(reg, OP_ANYCHAR_ML); in compile_tree()
1633 r = add_opcode(reg, OP_ANYCHAR); in compile_tree()
1642 r = add_opcode(reg, OP_BACKREF_AT_LEVEL); in compile_tree()
1643 if (r) return r; in compile_tree()
1644 r = add_option(reg, (reg->options & ONIG_OPTION_IGNORECASE)); in compile_tree()
1645 if (r) return r; in compile_tree()
1646 r = add_length(reg, br->nest_level); in compile_tree()
1647 if (r) return r; in compile_tree()
1656 r = add_opcode(reg, OP_BACKREFN_IC); in compile_tree()
1657 if (r) return r; in compile_tree()
1658 r = add_mem_num(reg, n); in compile_tree()
1662 case 1: r = add_opcode(reg, OP_BACKREF1); break; in compile_tree()
1663 case 2: r = add_opcode(reg, OP_BACKREF2); break; in compile_tree()
1665 r = add_opcode(reg, OP_BACKREFN); in compile_tree()
1666 if (r) return r; in compile_tree()
1667 r = add_mem_num(reg, n); in compile_tree()
1677 r = add_opcode(reg, OP_BACKREF_MULTI_IC); in compile_tree()
1680 r = add_opcode(reg, OP_BACKREF_MULTI); in compile_tree()
1682 if (r) return r; in compile_tree()
1687 r = add_length(reg, br->back_num); in compile_tree()
1688 if (r) return r; in compile_tree()
1691 r = add_mem_num(reg, p[i]); in compile_tree()
1692 if (r) return r; in compile_tree()
1700 r = compile_call(&(NCALL(node)), reg); in compile_tree()
1705 r = compile_quantifier_node(&(NQUANTIFIER(node)), reg); in compile_tree()
1709 r = compile_effect_node(&NEFFECT(node), reg); in compile_tree()
1713 r = compile_anchor_node(&(NANCHOR(node)), reg); in compile_tree()
1723 return r; in compile_tree()
1731 int r = 0; in noname_disable_map() local
1738 r = noname_disable_map(&(NCONS(node).left), map, counter); in noname_disable_map()
1739 } while (r == 0 && IS_NOT_NULL(node = NCONS(node).right)); in noname_disable_map()
1746 r = noname_disable_map(ptarget, map, counter); in noname_disable_map()
1761 r = noname_disable_map(&(en->target), map, counter); in noname_disable_map()
1767 r = noname_disable_map(plink, map, counter); in noname_disable_map()
1771 r = noname_disable_map(&(en->target), map, counter); in noname_disable_map()
1779 return r; in noname_disable_map()
1813 int r = 0; in renumber_by_map() local
1819 r = renumber_by_map(NCONS(node).left, map); in renumber_by_map()
1820 } while (r == 0 && IS_NOT_NULL(node = NCONS(node).right)); in renumber_by_map()
1823 r = renumber_by_map(NQUANTIFIER(node).target, map); in renumber_by_map()
1826 r = renumber_by_map(NEFFECT(node).target, map); in renumber_by_map()
1830 r = renumber_node_backref(node, map); in renumber_by_map()
1837 return r; in renumber_by_map()
1843 int r = 0; in numbered_ref_check() local
1849 r = numbered_ref_check(NCONS(node).left); in numbered_ref_check()
1850 } while (r == 0 && IS_NOT_NULL(node = NCONS(node).right)); in numbered_ref_check()
1853 r = numbered_ref_check(NQUANTIFIER(node).target); in numbered_ref_check()
1856 r = numbered_ref_check(NEFFECT(node).target); in numbered_ref_check()
1868 return r; in numbered_ref_check()
1874 int r, i, pos, counter; in disable_noname_group_capture() local
1884 r = noname_disable_map(root, map, &counter); in disable_noname_group_capture()
1885 if (r != 0) return r; in disable_noname_group_capture()
1887 r = renumber_by_map(*root, map); in disable_noname_group_capture()
1888 if (r != 0) return r; in disable_noname_group_capture()
1936 int r = 0; in quantifiers_memory_node_info() local
1945 if (v > r) r = v; in quantifiers_memory_node_info()
1956 r = quantifiers_memory_node_info(NCALL(node).target); in quantifiers_memory_node_info()
1964 r = quantifiers_memory_node_info(qn->target); in quantifiers_memory_node_info()
1979 r = quantifiers_memory_node_info(en->target); in quantifiers_memory_node_info()
1997 return r; in quantifiers_memory_node_info()
2005 int r = 0; in get_min_match_length() local
2019 r = get_min_match_length(nodes[backs[0]], min, env); in get_min_match_length()
2020 if (r != 0) break; in get_min_match_length()
2023 r = get_min_match_length(nodes[backs[i]], &tmin, env); in get_min_match_length()
2024 if (r != 0) break; in get_min_match_length()
2038 r = get_min_match_length(NCALL(node).target, min, env); in get_min_match_length()
2044 r = get_min_match_length(NCONS(node).left, &tmin, env); in get_min_match_length()
2045 if (r == 0) *min += tmin; in get_min_match_length()
2046 } while (r == 0 && IS_NOT_NULL(node = NCONS(node).right)); in get_min_match_length()
2055 r = get_min_match_length(x, &tmin, env); in get_min_match_length()
2056 if (r != 0) break; in get_min_match_length()
2059 } while (r == 0 && IS_NOT_NULL(y = NCONS(y).right)); in get_min_match_length()
2089 r = get_min_match_length(qn->target, min, env); in get_min_match_length()
2090 if (r == 0) in get_min_match_length()
2105 r = get_min_match_length(en->target, min, env); in get_min_match_length()
2106 if (r == 0) { in get_min_match_length()
2115 r = get_min_match_length(en->target, min, env); in get_min_match_length()
2126 return r; in get_min_match_length()
2133 int r = 0; in get_max_match_length() local
2139 r = get_max_match_length(NCONS(node).left, &tmax, env); in get_max_match_length()
2140 if (r == 0) in get_max_match_length()
2142 } while (r == 0 && IS_NOT_NULL(node = NCONS(node).right)); in get_max_match_length()
2147 r = get_max_match_length(NCONS(node).left, &tmax, env); in get_max_match_length()
2148 if (r == 0 && *max < tmax) *max = tmax; in get_max_match_length()
2149 } while (r == 0 && IS_NOT_NULL(node = NCONS(node).right)); in get_max_match_length()
2189 r = get_max_match_length(nodes[backs[i]], &tmax, env); in get_max_match_length()
2190 if (r != 0) break; in get_max_match_length()
2199 r = get_max_match_length(NCALL(node).target, max, env); in get_max_match_length()
2210 r = get_max_match_length(qn->target, max, env); in get_max_match_length()
2211 if (r == 0 && *max != 0) { in get_max_match_length()
2230 r = get_max_match_length(en->target, max, env); in get_max_match_length()
2231 if (r == 0) { in get_max_match_length()
2240 r = get_max_match_length(en->target, max, env); in get_max_match_length()
2251 return r; in get_max_match_length()
2262 int r = 0; in get_char_length_tree1() local
2269 r = get_char_length_tree1(NCONS(node).left, reg, &tlen, level); in get_char_length_tree1()
2270 if (r == 0) in get_char_length_tree1()
2272 } while (r == 0 && IS_NOT_NULL(node = NCONS(node).right)); in get_char_length_tree1()
2280 r = get_char_length_tree1(NCONS(node).left, reg, &tlen, level); in get_char_length_tree1()
2281 while (r == 0 && IS_NOT_NULL(node = NCONS(node).right)) { in get_char_length_tree1()
2282 r = get_char_length_tree1(NCONS(node).left, reg, &tlen2, level); in get_char_length_tree1()
2283 if (r == 0) { in get_char_length_tree1()
2288 if (r == 0) { in get_char_length_tree1()
2291 r = GET_CHAR_LEN_TOP_ALT_VARLEN; in get_char_length_tree1()
2293 r = GET_CHAR_LEN_VARLEN; in get_char_length_tree1()
2316 r = get_char_length_tree1(qn->target, reg, &tlen, level); in get_char_length_tree1()
2317 if (r == 0) in get_char_length_tree1()
2321 r = GET_CHAR_LEN_VARLEN; in get_char_length_tree1()
2328 r = get_char_length_tree1(NCALL(node).target, reg, len, level); in get_char_length_tree1()
2330 r = GET_CHAR_LEN_VARLEN; in get_char_length_tree1()
2357 r = get_char_length_tree1(en->target, reg, len, level); in get_char_length_tree1()
2358 if (r == 0) { in get_char_length_tree1()
2367 r = get_char_length_tree1(en->target, reg, len, level); in get_char_length_tree1()
2379 r = GET_CHAR_LEN_VARLEN; in get_char_length_tree1()
2383 return r; in get_char_length_tree1()
2673 int type, r = 0; in check_type_tree() local
2683 r = check_type_tree(NCONS(node).left, type_mask, effect_mask, anchor_mask); in check_type_tree()
2684 } while (r == 0 && IS_NOT_NULL(node = NCONS(node).right)); in check_type_tree()
2688 r = check_type_tree(NQUANTIFIER(node).target, type_mask, effect_mask, in check_type_tree()
2698 r = check_type_tree(en->target, type_mask, effect_mask, anchor_mask); in check_type_tree()
2708 r = check_type_tree(NANCHOR(node).target, in check_type_tree()
2715 return r; in check_type_tree()
2727 int r = 0; in subexp_inf_recursive_check() local
2741 r |= ret; in subexp_inf_recursive_check()
2754 r = RECURSION_EXIST; in subexp_inf_recursive_check()
2758 r &= ret; in subexp_inf_recursive_check()
2764 r = subexp_inf_recursive_check(NQUANTIFIER(node).target, env, head); in subexp_inf_recursive_check()
2765 if (r == RECURSION_EXIST) { in subexp_inf_recursive_check()
2766 if (NQUANTIFIER(node).lower == 0) r = 0; in subexp_inf_recursive_check()
2778 r = subexp_inf_recursive_check(an->target, env, head); in subexp_inf_recursive_check()
2785 r = subexp_inf_recursive_check(NCALL(node).target, env, head); in subexp_inf_recursive_check()
2795 r = subexp_inf_recursive_check(NEFFECT(node).target, env, head); in subexp_inf_recursive_check()
2804 return r; in subexp_inf_recursive_check()
2811 int r = 0; in subexp_inf_recursive_check_trav() local
2818 r = subexp_inf_recursive_check_trav(NCONS(node).left, env); in subexp_inf_recursive_check_trav()
2819 } while (r == 0 && IS_NOT_NULL(node = NCONS(node).right)); in subexp_inf_recursive_check_trav()
2823 r = subexp_inf_recursive_check_trav(NQUANTIFIER(node).target, env); in subexp_inf_recursive_check_trav()
2834 r = subexp_inf_recursive_check_trav(an->target, env); in subexp_inf_recursive_check_trav()
2846 r = subexp_inf_recursive_check(en->target, env, 1); in subexp_inf_recursive_check_trav()
2847 if (r > 0) return ONIGERR_NEVER_ENDING_RECURSION; in subexp_inf_recursive_check_trav()
2850 r = subexp_inf_recursive_check_trav(en->target, env); in subexp_inf_recursive_check_trav()
2859 return r; in subexp_inf_recursive_check_trav()
2866 int r = 0; in subexp_recursive_check() local
2873 r |= subexp_recursive_check(NCONS(node).left); in subexp_recursive_check()
2878 r = subexp_recursive_check(NQUANTIFIER(node).target); in subexp_recursive_check()
2889 r = subexp_recursive_check(an->target); in subexp_recursive_check()
2896 r = subexp_recursive_check(NCALL(node).target); in subexp_recursive_check()
2897 if (r != 0) SET_CALL_RECURSION(node); in subexp_recursive_check()
2907 r = subexp_recursive_check(NEFFECT(node).target); in subexp_recursive_check()
2916 return r; in subexp_recursive_check()
2926 int r = 0; in subexp_recursive_check_trav() local
2936 if (ret == FOUND_CALLED_NODE) r = FOUND_CALLED_NODE; in subexp_recursive_check_trav()
2943 r = subexp_recursive_check_trav(NQUANTIFIER(node).target, env); in subexp_recursive_check_trav()
2945 if (r == FOUND_CALLED_NODE) in subexp_recursive_check_trav()
2958 r = subexp_recursive_check_trav(an->target, env); in subexp_recursive_check_trav()
2971 r = subexp_recursive_check(en->target); in subexp_recursive_check_trav()
2972 if (r != 0) SET_EFFECT_STATUS(node, NST_RECURSION); in subexp_recursive_check_trav()
2976 r = subexp_recursive_check_trav(en->target, env); in subexp_recursive_check_trav()
2978 r |= FOUND_CALLED_NODE; in subexp_recursive_check_trav()
2986 return r; in subexp_recursive_check_trav()
2993 int r = 0; in setup_subexp_call() local
2999 r = setup_subexp_call(NCONS(node).left, env); in setup_subexp_call()
3000 } while (r == 0 && IS_NOT_NULL(node = NCONS(node).right)); in setup_subexp_call()
3005 r = setup_subexp_call(NCONS(node).left, env); in setup_subexp_call()
3006 } while (r == 0 && IS_NOT_NULL(node = NCONS(node).right)); in setup_subexp_call()
3010 r = setup_subexp_call(NQUANTIFIER(node).target, env); in setup_subexp_call()
3013 r = setup_subexp_call(NEFFECT(node).target, env); in setup_subexp_call()
3082 r = setup_subexp_call(an->target, env); in setup_subexp_call()
3092 return r; in setup_subexp_call()
3134 int r, len; in setup_look_behind() local
3137 r = get_char_length_tree(an->target, reg, &len); in setup_look_behind()
3138 if (r == 0) in setup_look_behind()
3140 else if (r == GET_CHAR_LEN_VARLEN) in setup_look_behind()
3141 r = ONIGERR_INVALID_LOOK_BEHIND_PATTERN; in setup_look_behind()
3142 else if (r == GET_CHAR_LEN_TOP_ALT_VARLEN) { in setup_look_behind()
3144 r = divide_look_behind_alternatives(node); in setup_look_behind()
3146 r = ONIGERR_INVALID_LOOK_BEHIND_PATTERN; in setup_look_behind()
3149 return r; in setup_look_behind()
3243 int r; in divide_ambig_string_node() local
3256 r = divide_ambig_string_node_sub(reg, prev_ambig, prev_start, prev, in divide_ambig_string_node()
3258 if (r != 0) return r; in divide_ambig_string_node()
3279 r = divide_ambig_string_node_sub(reg, prev_ambig, prev_start, end, in divide_ambig_string_node()
3281 if (r != 0) return r; in divide_ambig_string_node()
3304 int r = state; in setup_comb_exp_check() local
3312 r = setup_comb_exp_check(NCONS(node).left, r, env); in setup_comb_exp_check()
3314 } while (r >= 0 && IS_NOT_NULL(node = NCONS(node).right)); in setup_comb_exp_check()
3323 r |= ret; in setup_comb_exp_check()
3388 r = setup_comb_exp_check(target, child_state, env); in setup_comb_exp_check()
3389 r |= add_state; in setup_comb_exp_check()
3403 r = setup_comb_exp_check(en->target, state, env); in setup_comb_exp_check()
3408 r = setup_comb_exp_check(en->target, state, env); in setup_comb_exp_check()
3419 r = setup_comb_exp_check(NCALL(node).target, state, env); in setup_comb_exp_check()
3427 return r; in setup_comb_exp_check()
3448 int r = 0; in setup_tree() local
3456 r = setup_tree(NCONS(node).left, reg, state, env); in setup_tree()
3457 if (IS_NOT_NULL(prev) && r == 0) { in setup_tree()
3458 r = next_setup(prev, NCONS(node).left, reg); in setup_tree()
3461 } while (r == 0 && IS_NOT_NULL(node = NCONS(node).right)); in setup_tree()
3467 r = setup_tree(NCONS(node).left, reg, (state | IN_ALT), env); in setup_tree()
3468 } while (r == 0 && IS_NOT_NULL(node = NCONS(node).right)); in setup_tree()
3476 r = divide_ambig_string_node(node, reg); in setup_tree()
3521 r = get_min_match_length(target, &d, env); in setup_tree()
3522 if (r) break; in setup_tree()
3526 r = quantifiers_memory_node_info(target); in setup_tree()
3527 if (r < 0) break; in setup_tree()
3528 if (r > 0) { in setup_tree()
3529 qn->target_empty_info = r; in setup_tree()
3533 r = get_max_match_length(target, &d, env); in setup_tree()
3534 if (r == 0 && d == 0) { in setup_tree()
3549 r = setup_tree(target, reg, state, env); in setup_tree()
3550 if (r) break; in setup_tree()
3564 r = onig_node_str_cat(node, sn->s, sn->end); in setup_tree()
3565 if (r) break; in setup_tree()
3599 r = setup_tree(NEFFECT(node).target, reg, state, env); in setup_tree()
3609 r = setup_tree(en->target, reg, state, env); in setup_tree()
3615 r = setup_tree(target, reg, state, env); in setup_tree()
3637 r = setup_tree(an->target, reg, state, env); in setup_tree()
3640 r = setup_tree(an->target, reg, (state | IN_NOT), env); in setup_tree()
3658 r = check_type_tree(an->target, ALLOWED_TYPE_IN_LB, in setup_tree()
3660 if (r < 0) return r; in setup_tree()
3661 if (r > 0) return ONIGERR_INVALID_LOOK_BEHIND_PATTERN; in setup_tree()
3662 r = setup_look_behind(node, reg, env); in setup_tree()
3663 if (r != 0) return r; in setup_tree()
3664 r = setup_tree(an->target, reg, state, env); in setup_tree()
3670 r = check_type_tree(an->target, ALLOWED_TYPE_IN_LB, in setup_tree()
3672 if (r < 0) return r; in setup_tree()
3673 if (r > 0) return ONIGERR_INVALID_LOOK_BEHIND_PATTERN; in setup_tree()
3674 r = setup_look_behind(node, reg, env); in setup_tree()
3675 if (r != 0) return r; in setup_tree()
3676 r = setup_tree(an->target, reg, (state | IN_NOT), env); in setup_tree()
3687 return r; in setup_tree()
4337 int r = 0; in optimize_node_left() local
4352 r = optimize_node_left(NCONS(nd).left, &nopt, &nenv); in optimize_node_left()
4353 if (r == 0) { in optimize_node_left()
4357 } while (r == 0 && IS_NOT_NULL(nd = NCONS(nd).right)); in optimize_node_left()
4367 r = optimize_node_left(NCONS(nd).left, &nopt, env); in optimize_node_left()
4368 if (r == 0) { in optimize_node_left()
4372 } while ((r == 0) && IS_NOT_NULL(nd = NCONS(nd).right)); in optimize_node_left()
4398 r = add_char_amb_opt_map_info(&opt->map, sn->s, sn->end, in optimize_node_left()
4400 if (r != 0) break; in optimize_node_left()
4500 r = optimize_node_left(NANCHOR(node).target, &nopt, env); in optimize_node_left()
4501 if (r == 0) { in optimize_node_left()
4535 r = get_min_match_length(nodes[backs[0]], &min, env->scan_env); in optimize_node_left()
4536 if (r != 0) break; in optimize_node_left()
4537 r = get_max_match_length(nodes[backs[0]], &max, env->scan_env); in optimize_node_left()
4538 if (r != 0) break; in optimize_node_left()
4540 r = get_min_match_length(nodes[backs[i]], &tmin, env->scan_env); in optimize_node_left()
4541 if (r != 0) break; in optimize_node_left()
4542 r = get_max_match_length(nodes[backs[i]], &tmax, env->scan_env); in optimize_node_left()
4543 if (r != 0) break; in optimize_node_left()
4547 if (r == 0) set_mml(&opt->len, min, max); in optimize_node_left()
4558 r = optimize_node_left(NCALL(node).target, opt, env); in optimize_node_left()
4571 r = optimize_node_left(qn->target, &nopt, env); in optimize_node_left()
4572 if (r) break; in optimize_node_left()
4627 r = optimize_node_left(en->target, opt, env); in optimize_node_left()
4647 r = optimize_node_left(en->target, opt, env); in optimize_node_left()
4657 r = optimize_node_left(en->target, opt, env); in optimize_node_left()
4668 r = ONIGERR_TYPE_BUG; in optimize_node_left()
4672 return r; in optimize_node_left()
4678 int r; in set_optimize_exact_info() local
4700 r = set_bm_skip(reg->exact, reg->exact_end, reg->enc, in set_optimize_exact_info()
4702 if (r) return r; in set_optimize_exact_info()
4754 int r; in set_optimize_info_from_tree() local
4764 r = optimize_node_left(node, &opt, &env); in set_optimize_info_from_tree()
4765 if (r) return r; in set_optimize_info_from_tree()
4784 r = set_optimize_exact_info(reg, &opt.exb); in set_optimize_info_from_tree()
4802 return r; in set_optimize_info_from_tree()
5050 int r, size;
5072 r = onig_alloc_init(&reg, ONIG_OPTION_NONE, ONIGENC_AMBIGUOUS_MATCH_DEFAULT,
5074 if (r != 0) {
5076 return r;
5137 int r, init_size; in onig_compile() local
5153 r = BBUF_INIT(reg, init_size); in onig_compile()
5154 if (r != 0) goto end; in onig_compile()
5168 r = onig_parse_make_tree(&root, pattern, pattern_end, reg, &scan_env); in onig_compile()
5169 if (r != 0) goto err; in onig_compile()
5177 r = disable_noname_group_capture(&root, reg, &scan_env); in onig_compile()
5179 r = numbered_ref_check(root); in onig_compile()
5181 if (r != 0) goto err; in onig_compile()
5191 r = unset_addr_list_init(&uslist, scan_env.num_call); in onig_compile()
5192 if (r != 0) goto err; in onig_compile()
5194 r = setup_subexp_call(root, &scan_env); in onig_compile()
5195 if (r != 0) goto err_unset; in onig_compile()
5196 r = subexp_recursive_check_trav(root, &scan_env); in onig_compile()
5197 if (r < 0) goto err_unset; in onig_compile()
5198 r = subexp_inf_recursive_check_trav(root, &scan_env); in onig_compile()
5199 if (r != 0) goto err_unset; in onig_compile()
5207 r = setup_tree(root, reg, 0, &scan_env); in onig_compile()
5208 if (r != 0) goto err_unset; in onig_compile()
5249 r = set_optimize_info_from_tree(root, reg, &scan_env); in onig_compile()
5250 if (r != 0) goto err_unset; in onig_compile()
5258 r = compile_tree(root, reg); in onig_compile()
5259 if (r == 0) { in onig_compile()
5260 r = add_opcode(reg, OP_END); in onig_compile()
5263 r = unset_addr_list_fix(&uslist, reg); in onig_compile()
5265 if (r) goto err; in onig_compile()
5294 return r; in onig_compile()
5314 return r; in onig_compile()
5323 int r; in onig_recompile() local
5326 r = onig_new(&new_reg, pattern, pattern_end, option, enc, syntax, einfo); in onig_recompile()
5327 if (r) return r; in onig_recompile()
5391 int r; in onig_new() local
5395 r = onig_alloc_init(reg, option, ONIGENC_AMBIGUOUS_MATCH_DEFAULT, in onig_new()
5397 if (r) return r; in onig_new()
5399 r = onig_compile(*reg, pattern, pattern_end, einfo); in onig_new()
5400 if (r) { in onig_new()
5404 return r; in onig_new()