Lines Matching refs:reg

179 add_opcode(regex_t* reg, int opcode)  in add_opcode()  argument
181 BBUF_ADD1(reg, opcode); in add_opcode()
187 add_state_check_num(regex_t* reg, int num) in add_state_check_num() argument
191 BBUF_ADD(reg, &n, SIZE_STATE_CHECK_NUM); in add_state_check_num()
197 add_rel_addr(regex_t* reg, int addr) in add_rel_addr() argument
201 BBUF_ADD(reg, &ra, SIZE_RELADDR); in add_rel_addr()
206 add_abs_addr(regex_t* reg, int addr) in add_abs_addr() argument
210 BBUF_ADD(reg, &ra, SIZE_ABSADDR); in add_abs_addr()
215 add_length(regex_t* reg, int len) in add_length() argument
219 BBUF_ADD(reg, &l, SIZE_LENGTH); in add_length()
224 add_mem_num(regex_t* reg, int num) in add_mem_num() argument
228 BBUF_ADD(reg, &n, SIZE_MEMNUM); in add_mem_num()
233 add_pointer(regex_t* reg, void* addr) in add_pointer() argument
237 BBUF_ADD(reg, &ptr, SIZE_POINTER); in add_pointer()
242 add_option(regex_t* reg, OnigOptionType option) in add_option() argument
244 BBUF_ADD(reg, &option, SIZE_OPTION); in add_option()
249 add_opcode_rel_addr(regex_t* reg, int opcode, int addr) in add_opcode_rel_addr() argument
253 r = add_opcode(reg, opcode); in add_opcode_rel_addr()
255 r = add_rel_addr(reg, addr); in add_opcode_rel_addr()
260 add_bytes(regex_t* reg, UChar* bytes, int len) in add_bytes() argument
262 BBUF_ADD(reg, bytes, len); in add_bytes()
267 add_bitset(regex_t* reg, BitSetRef bs) in add_bitset() argument
269 BBUF_ADD(reg, bs, SIZE_BITSET); in add_bitset()
274 add_opcode_option(regex_t* reg, int opcode, OnigOptionType option) in add_opcode_option() argument
278 r = add_opcode(reg, opcode); in add_opcode_option()
280 r = add_option(reg, option); in add_opcode_option()
284 static int compile_length_tree(Node* node, regex_t* reg);
285 static int compile_tree(Node* node, regex_t* reg);
338 compile_tree_empty_check(Node* node, regex_t* reg, int empty_info) in compile_tree_empty_check() argument
341 int saved_num_null_check = reg->num_null_check; in compile_tree_empty_check()
344 r = add_opcode(reg, OP_NULL_CHECK_START); in compile_tree_empty_check()
346 r = add_mem_num(reg, reg->num_null_check); /* NULL CHECK ID */ in compile_tree_empty_check()
348 reg->num_null_check++; in compile_tree_empty_check()
351 r = compile_tree(node, reg); 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()
363 r = add_mem_num(reg, saved_num_null_check); /* NULL CHECK ID */ in compile_tree_empty_check()
370 compile_call(CallNode* node, regex_t* reg) in compile_call() argument
374 r = add_opcode(reg, OP_CALL); in compile_call()
376 r = unset_addr_list_add(node->unset_addr_list, BBUF_GET_OFFSET_POS(reg), in compile_call()
379 r = add_abs_addr(reg, 0 /*dummy addr.*/); in compile_call()
385 compile_tree_n_times(Node* node, int n, regex_t* reg) in compile_tree_n_times() argument
390 r = compile_tree(node, reg); in compile_tree_n_times()
398 regex_t* reg, int ignore_case) in add_compile_string_length() argument
415 regex_t* reg, int ignore_case) in add_compile_string() argument
418 add_opcode(reg, op); in add_compile_string()
421 add_length(reg, mb_len); in add_compile_string()
425 add_length(reg, mb_len * str_len); in add_compile_string()
427 add_length(reg, str_len); in add_compile_string()
430 add_bytes(reg, s, mb_len * str_len); in add_compile_string()
436 compile_length_string_node(Node* node, regex_t* reg) in compile_length_string_node() argument
439 OnigEncoding enc = reg->enc; in compile_length_string_node()
461 r = add_compile_string_length(prev, prev_len, slen, reg, ambig); in compile_length_string_node()
469 r = add_compile_string_length(prev, prev_len, slen, reg, ambig); in compile_length_string_node()
475 compile_length_string_raw_node(StrNode* sn, regex_t* reg) in compile_length_string_raw_node() argument
480 return add_compile_string_length(sn->s, 1 /* sb */, sn->end - sn->s, reg, 0); in compile_length_string_raw_node()
484 compile_string_node(Node* node, regex_t* reg) in compile_string_node() argument
487 OnigEncoding enc = reg->enc; in compile_string_node()
509 r = add_compile_string(prev, prev_len, slen, reg, ambig); in compile_string_node()
519 return add_compile_string(prev, prev_len, slen, reg, ambig); in compile_string_node()
523 compile_string_raw_node(StrNode* sn, regex_t* reg) in compile_string_raw_node() argument
528 return add_compile_string(sn->s, 1 /* sb */, sn->end - sn->s, reg, 0); in compile_string_raw_node()
532 add_multi_byte_cclass(BBuf* mbuf, regex_t* reg) in add_multi_byte_cclass() argument
535 add_length(reg, mbuf->used); in add_multi_byte_cclass()
536 return add_bytes(reg, mbuf->p, mbuf->used); in add_multi_byte_cclass()
541 UChar* p = BBUF_GET_ADD_ADDRESS(reg) + SIZE_LENGTH; in add_multi_byte_cclass()
544 add_length(reg, mbuf->used + (WORD_ALIGNMENT_SIZE - 1)); in add_multi_byte_cclass()
545 if (pad_size != 0) add_bytes(reg, PadBuf, pad_size); in add_multi_byte_cclass()
547 r = add_bytes(reg, mbuf->p, mbuf->used); in add_multi_byte_cclass()
551 if (pad_size != 0) add_bytes(reg, PadBuf, pad_size); in add_multi_byte_cclass()
557 compile_length_cclass_node(CClassNode* cc, regex_t* reg) in compile_length_cclass_node() argument
570 if (ONIGENC_MBC_MINLEN(reg->enc) > 1 || bitset_is_empty(cc->bs)) { in compile_length_cclass_node()
587 compile_cclass_node(CClassNode* cc, regex_t* reg) in compile_cclass_node() argument
592 add_opcode(reg, OP_CCLASS_NODE); in compile_cclass_node()
593 r = add_pointer(reg, cc); in compile_cclass_node()
599 add_opcode(reg, OP_CCLASS_NOT); in compile_cclass_node()
601 add_opcode(reg, OP_CCLASS); in compile_cclass_node()
603 r = add_bitset(reg, cc->bs); in compile_cclass_node()
606 if (ONIGENC_MBC_MINLEN(reg->enc) > 1 || bitset_is_empty(cc->bs)) { in compile_cclass_node()
608 add_opcode(reg, OP_CCLASS_MB_NOT); in compile_cclass_node()
610 add_opcode(reg, OP_CCLASS_MB); in compile_cclass_node()
612 r = add_multi_byte_cclass(cc->mbuf, reg); in compile_cclass_node()
616 add_opcode(reg, OP_CCLASS_MIX_NOT); in compile_cclass_node()
618 add_opcode(reg, OP_CCLASS_MIX); in compile_cclass_node()
620 r = add_bitset(reg, cc->bs); in compile_cclass_node()
622 r = add_multi_byte_cclass(cc->mbuf, reg); in compile_cclass_node()
630 entry_repeat_range(regex_t* reg, int id, int lower, int upper) in entry_repeat_range() argument
636 if (reg->repeat_range_alloc == 0) { in entry_repeat_range()
639 reg->repeat_range = p; in entry_repeat_range()
640 reg->repeat_range_alloc = REPEAT_RANGE_ALLOC; in entry_repeat_range()
642 else if (reg->repeat_range_alloc <= id) { in entry_repeat_range()
644 n = reg->repeat_range_alloc + REPEAT_RANGE_ALLOC; in entry_repeat_range()
645 p = (OnigRepeatRange* )xrealloc(reg->repeat_range, in entry_repeat_range()
648 reg->repeat_range = p; in entry_repeat_range()
649 reg->repeat_range_alloc = n; in entry_repeat_range()
652 p = reg->repeat_range; in entry_repeat_range()
662 regex_t* reg) in compile_range_repeat_node() argument
665 int num_repeat = reg->num_repeat; in compile_range_repeat_node()
667 r = add_opcode(reg, qn->greedy ? OP_REPEAT : OP_REPEAT_NG); in compile_range_repeat_node()
669 r = add_mem_num(reg, num_repeat); /* OP_REPEAT ID */ in compile_range_repeat_node()
670 reg->num_repeat++; in compile_range_repeat_node()
672 r = add_rel_addr(reg, target_len + SIZE_OP_REPEAT_INC); in compile_range_repeat_node()
675 r = entry_repeat_range(reg, num_repeat, qn->lower, qn->upper); in compile_range_repeat_node()
678 r = compile_tree_empty_check(qn->target, reg, empty_info); in compile_range_repeat_node()
683 reg->num_call > 0 || 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()
692 r = add_mem_num(reg, num_repeat); /* OP_REPEAT ID */ in compile_range_repeat_node()
712 compile_length_quantifier_node(QuantifierNode* qn, regex_t* reg) in compile_length_quantifier_node() argument
718 int tlen = compile_length_tree(qn->target, reg); in compile_length_quantifier_node()
722 ckn = ((reg->num_comb_exp_check > 0) ? qn->comb_exp_check_num : 0); in compile_length_quantifier_node()
792 compile_quantifier_node(QuantifierNode* qn, regex_t* reg) in compile_quantifier_node() argument
798 int tlen = compile_length_tree(qn->target, reg); in compile_quantifier_node()
802 ckn = ((reg->num_comb_exp_check > 0) ? qn->comb_exp_check_num : 0); in compile_quantifier_node()
805 r = compile_tree_n_times(qn->target, qn->lower, reg); in compile_quantifier_node()
808 if (IS_MULTILINE(reg->options)) 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()
814 r = add_state_check_num(reg, ckn); in compile_quantifier_node()
818 return add_bytes(reg, NSTRING(qn->next_head_exact).s, 1); in compile_quantifier_node()
821 if (IS_MULTILINE(reg->options)) { 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()
833 r = add_state_check_num(reg, ckn); in compile_quantifier_node()
847 r = add_opcode_rel_addr(reg, OP_JUMP, in compile_quantifier_node()
853 r = add_opcode(reg, OP_STATE_CHECK_PUSH); in compile_quantifier_node()
855 r = add_state_check_num(reg, ckn); 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()
863 r = compile_tree_empty_check(qn->target, reg, empty_info); 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()
874 r = compile_tree_empty_check(qn->target, reg, empty_info); in compile_quantifier_node()
877 r = add_opcode(reg, OP_STATE_CHECK_PUSH_OR_JUMP); in compile_quantifier_node()
879 r = add_state_check_num(reg, ckn); 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()
892 r = compile_tree(qn->target, reg); in compile_quantifier_node()
900 r = add_opcode(reg, OP_STATE_CHECK_PUSH); in compile_quantifier_node()
902 r = add_state_check_num(reg, ckn); 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()
912 r = compile_tree(qn->target, reg); in compile_quantifier_node()
916 r = add_opcode(reg, OP_STATE_CHECK_PUSH); in compile_quantifier_node()
918 r = add_state_check_num(reg, ckn); 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()
927 r = add_opcode_rel_addr(reg, OP_JUMP, tlen); 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()
935 r = add_opcode(reg, OP_STATE_CHECK); in compile_quantifier_node()
937 r = add_state_check_num(reg, ckn); in compile_quantifier_node()
946 compile_length_quantifier_node(QuantifierNode* qn, regex_t* reg) in compile_length_quantifier_node() argument
951 int tlen = compile_length_tree(qn->target, reg); in compile_length_quantifier_node()
1011 compile_quantifier_node(QuantifierNode* qn, regex_t* reg) in compile_quantifier_node() argument
1016 int tlen = compile_length_tree(qn->target, reg); in compile_quantifier_node()
1021 r = compile_tree_n_times(qn->target, qn->lower, reg); in compile_quantifier_node()
1024 if (IS_MULTILINE(reg->options)) 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()
1029 return add_bytes(reg, NSTRING(qn->next_head_exact).s, 1); in compile_quantifier_node()
1032 if (IS_MULTILINE(reg->options)) in compile_quantifier_node()
1033 return add_opcode(reg, OP_ANYCHAR_ML_STAR); in compile_quantifier_node()
1035 return add_opcode(reg, OP_ANYCHAR_STAR); 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()
1061 r = compile_tree_n_times(qn->target, qn->lower, reg); in compile_quantifier_node()
1067 r = add_opcode_rel_addr(reg, OP_PUSH_OR_JUMP_EXACT1, in compile_quantifier_node()
1070 add_bytes(reg, NSTRING(qn->head_exact).s, 1); in compile_quantifier_node()
1071 r = compile_tree_empty_check(qn->target, reg, empty_info); in compile_quantifier_node()
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()
1080 add_bytes(reg, NSTRING(qn->next_head_exact).s, 1); in compile_quantifier_node()
1081 r = compile_tree_empty_check(qn->target, reg, empty_info); in compile_quantifier_node()
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()
1089 r = compile_tree_empty_check(qn->target, reg, empty_info); 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()
1098 r = compile_tree_empty_check(qn->target, reg, empty_info); 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()
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()
1117 r = add_opcode_rel_addr(reg, OP_PUSH, in compile_quantifier_node()
1120 r = compile_tree(qn->target, reg); in compile_quantifier_node()
1125 r = add_opcode_rel_addr(reg, OP_PUSH, SIZE_OP_JUMP); in compile_quantifier_node()
1127 r = add_opcode_rel_addr(reg, OP_JUMP, tlen); 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()
1139 compile_length_option_node(EffectNode* node, regex_t* reg) in compile_length_option_node() argument
1142 OnigOptionType prev = reg->options; in compile_length_option_node()
1144 reg->options = node->option; in compile_length_option_node()
1145 tlen = compile_length_tree(node->target, reg); in compile_length_option_node()
1146 reg->options = prev; in compile_length_option_node()
1159 compile_option_node(EffectNode* node, regex_t* reg) in compile_option_node() argument
1162 OnigOptionType prev = reg->options; in compile_option_node()
1165 r = add_opcode_option(reg, OP_SET_OPTION_PUSH, node->option); in compile_option_node()
1167 r = add_opcode_option(reg, OP_SET_OPTION, prev); in compile_option_node()
1169 r = add_opcode(reg, OP_FAIL); in compile_option_node()
1173 reg->options = node->option; in compile_option_node()
1174 r = compile_tree(node->target, reg); in compile_option_node()
1175 reg->options = prev; in compile_option_node()
1179 r = add_opcode_option(reg, OP_SET_OPTION, prev); in compile_option_node()
1185 compile_length_effect_node(EffectNode* node, regex_t* reg) in compile_length_effect_node() argument
1191 return compile_length_option_node(node, reg); in compile_length_effect_node()
1194 tlen = compile_length_tree(node->target, reg); in compile_length_effect_node()
1206 if (BIT_STATUS_AT(reg->bt_mem_end, node->regnum)) in compile_length_effect_node()
1216 if (BIT_STATUS_AT(reg->bt_mem_start, node->regnum)) in compile_length_effect_node()
1221 len += tlen + (BIT_STATUS_AT(reg->bt_mem_end, node->regnum) in compile_length_effect_node()
1229 tlen = compile_length_tree(qn->target, reg); in compile_length_effect_node()
1248 static int get_char_length_tree(Node* node, regex_t* reg, int* len);
1251 compile_effect_node(EffectNode* node, regex_t* reg) in compile_effect_node() argument
1256 return compile_option_node(node, reg); in compile_effect_node()
1262 r = add_opcode(reg, OP_CALL); in compile_effect_node()
1264 node->call_addr = BBUF_GET_OFFSET_POS(reg) + SIZE_ABSADDR + SIZE_OP_JUMP; in compile_effect_node()
1266 r = add_abs_addr(reg, (int )node->call_addr); in compile_effect_node()
1268 len = compile_length_tree(node->target, reg); in compile_effect_node()
1270 if (BIT_STATUS_AT(reg->bt_mem_end, node->regnum)) in compile_effect_node()
1277 r = add_opcode_rel_addr(reg, OP_JUMP, len); in compile_effect_node()
1281 if (BIT_STATUS_AT(reg->bt_mem_start, node->regnum)) 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()
1286 r = add_mem_num(reg, node->regnum); in compile_effect_node()
1288 r = compile_tree(node->target, reg); in compile_effect_node()
1292 if (BIT_STATUS_AT(reg->bt_mem_end, node->regnum)) 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()
1300 r = add_mem_num(reg, node->regnum); in compile_effect_node()
1302 r = add_opcode(reg, OP_RETURN); in compile_effect_node()
1307 if (BIT_STATUS_AT(reg->bt_mem_end, node->regnum)) 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()
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()
1322 len = compile_length_tree(qn->target, reg); in compile_effect_node()
1325 r = add_opcode_rel_addr(reg, OP_PUSH, len + SIZE_OP_POP + SIZE_OP_JUMP); in compile_effect_node()
1327 r = compile_tree(qn->target, reg); in compile_effect_node()
1329 r = add_opcode(reg, OP_POP); 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()
1337 r = compile_tree(node->target, reg); in compile_effect_node()
1339 r = add_opcode(reg, OP_POP_STOP_BT); in compile_effect_node()
1352 compile_length_anchor_node(AnchorNode* node, regex_t* reg) in compile_length_anchor_node() argument
1358 tlen = compile_length_tree(node->target, reg); in compile_length_anchor_node()
1385 compile_anchor_node(AnchorNode* node, regex_t* reg) in compile_anchor_node() argument
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()
1407 r = compile_tree(node->target, reg); in compile_anchor_node()
1409 r = add_opcode(reg, OP_POP_POS); in compile_anchor_node()
1413 len = compile_length_tree(node->target, reg); in compile_anchor_node()
1415 r = add_opcode_rel_addr(reg, OP_PUSH_POS_NOT, len + SIZE_OP_FAIL_POS); in compile_anchor_node()
1417 r = compile_tree(node->target, reg); 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()
1428 r = get_char_length_tree(node->target, reg, &n); in compile_anchor_node()
1433 r = add_length(reg, n); in compile_anchor_node()
1435 r = compile_tree(node->target, reg); in compile_anchor_node()
1442 len = compile_length_tree(node->target, reg); in compile_anchor_node()
1443 r = add_opcode_rel_addr(reg, OP_PUSH_LOOK_BEHIND_NOT, in compile_anchor_node()
1447 r = get_char_length_tree(node->target, reg, &n); in compile_anchor_node()
1452 r = add_length(reg, n); in compile_anchor_node()
1454 r = compile_tree(node->target, reg); in compile_anchor_node()
1456 r = add_opcode(reg, OP_FAIL_LOOK_BEHIND_NOT); in compile_anchor_node()
1469 compile_length_tree(Node* node, regex_t* reg) in compile_length_tree() argument
1478 r = compile_length_tree(NCONS(node).left, reg); in compile_length_tree()
1491 r += compile_length_tree(NCONS(node).left, reg); 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()
1526 r = ((!IS_IGNORECASE(reg->options) && br->back_static[0] <= 2) 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()
1562 compile_tree(Node* node, regex_t* reg) in compile_tree() argument
1570 r = compile_tree(NCONS(node).left, reg); in compile_tree()
1579 len += compile_length_tree(NCONS(x).left, reg); in compile_tree()
1584 pos = reg->used + len; /* goal position */ in compile_tree()
1587 len = compile_length_tree(NCONS(node).left, reg); in compile_tree()
1589 r = add_opcode_rel_addr(reg, OP_PUSH, len + SIZE_OP_JUMP); in compile_tree()
1592 r = compile_tree(NCONS(node).left, reg); in compile_tree()
1595 len = pos - (reg->used + SIZE_OP_JUMP); in compile_tree()
1596 r = add_opcode_rel_addr(reg, OP_JUMP, len); 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()
1630 if (IS_MULTILINE(reg->options)) 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()
1644 r = add_option(reg, (reg->options & ONIG_OPTION_IGNORECASE)); in compile_tree()
1646 r = add_length(reg, br->nest_level); in compile_tree()
1655 if (IS_IGNORECASE(reg->options)) { in compile_tree()
1656 r = add_opcode(reg, OP_BACKREFN_IC); 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()
1667 r = add_mem_num(reg, n); in compile_tree()
1676 if (IS_IGNORECASE(reg->options)) { 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()
1687 r = add_length(reg, br->back_num); in compile_tree()
1691 r = add_mem_num(reg, p[i]); 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()
1872 disable_noname_group_capture(Node** root, regex_t* reg, ScanEnv* env) in disable_noname_group_capture() argument
1906 reg->num_mem = env->num_named; in disable_noname_group_capture()
1908 return onig_renumber_name_table(reg, map); in disable_noname_group_capture()
1914 unset_addr_list_fix(UnsetAddrList* uslist, regex_t* reg) in unset_addr_list_fix() argument
1926 BBUF_WRITE(reg, offset, &addr, SIZE_ABSADDR); in unset_addr_list_fix()
2259 get_char_length_tree1(Node* node, regex_t* reg, int* len, int level) in get_char_length_tree1() argument
2269 r = get_char_length_tree1(NCONS(node).left, reg, &tlen, level); in get_char_length_tree1()
2280 r = get_char_length_tree1(NCONS(node).left, reg, &tlen, level); in get_char_length_tree1()
2282 r = get_char_length_tree1(NCONS(node).left, reg, &tlen2, level); in get_char_length_tree1()
2306 s += enc_len(reg->enc, s); in get_char_length_tree1()
2316 r = get_char_length_tree1(qn->target, reg, &tlen, level); in get_char_length_tree1()
2328 r = get_char_length_tree1(NCALL(node).target, reg, len, level); in get_char_length_tree1()
2357 r = get_char_length_tree1(en->target, reg, len, level); in get_char_length_tree1()
2367 r = get_char_length_tree1(en->target, reg, len, level); in get_char_length_tree1()
2387 get_char_length_tree(Node* node, regex_t* reg, int* len) in get_char_length_tree() argument
2389 return get_char_length_tree1(node, reg, len, 0); in get_char_length_tree()
2394 is_not_included(Node* x, Node* y, regex_t* reg) in is_not_included() argument
2455 if (ONIGENC_IS_CODE_SB_WORD(reg->enc, i)) return 0; in is_not_included()
2464 if (! ONIGENC_IS_CODE_SB_WORD(reg->enc, i)) { in is_not_included()
2526 return (ONIGENC_IS_MBC_WORD(reg->enc, xs->s, xs->end) ? 0 : 1); in is_not_included()
2529 return (ONIGENC_IS_MBC_WORD(reg->enc, xs->s, xs->end) ? 1 : 0); in is_not_included()
2540 code = ONIGENC_MBC_TO_CODE(reg->enc, xs->s, in is_not_included()
2541 xs->s + ONIGENC_MBC_MAXLEN(reg->enc)); in is_not_included()
2542 return (onig_is_code_in_cc(reg->enc, code, cc) != 0 ? 0 : 1); in is_not_included()
2578 get_head_value_node(Node* node, int exact, regex_t* reg) in get_head_value_node() argument
2599 n = get_head_value_node(NCONS(node).left, exact, reg); in get_head_value_node()
2610 !NSTRING_IS_RAW(node) && IS_IGNORECASE(reg->options)) { in get_head_value_node()
2613 if (! ONIGENC_IS_MBC_AMBIGUOUS(reg->enc, reg->ambig_flag, in get_head_value_node()
2631 n = get_head_value_node(qn->target, exact, reg); in get_head_value_node()
2642 OnigOptionType options = reg->options; in get_head_value_node()
2644 reg->options = NEFFECT(node).option; in get_head_value_node()
2645 n = get_head_value_node(NEFFECT(node).target, exact, reg); in get_head_value_node()
2646 reg->options = options; in get_head_value_node()
2652 n = get_head_value_node(en->target, exact, reg); in get_head_value_node()
2660 n = get_head_value_node(NANCHOR(node).target, exact, reg); in get_head_value_node()
3024 n = onig_name_to_group_numbers(env->reg, cn->name, cn->name_end, &refs); in setup_subexp_call()
3132 setup_look_behind(Node* node, regex_t* reg, ScanEnv* env) in setup_look_behind() argument
3137 r = get_char_length_tree(an->target, reg, &len); in setup_look_behind()
3153 next_setup(Node* node, Node* next_node, regex_t* reg) in next_setup() argument
3163 qn->next_head_exact = get_head_value_node(next_node, 1, reg); in next_setup()
3170 x = get_head_value_node(qn->target, 0, reg); in next_setup()
3172 y = get_head_value_node(next_node, 0, reg); in next_setup()
3173 if (IS_NOT_NULL(y) && is_not_included(x, y, reg)) { in next_setup()
3197 divide_ambig_string_node_sub(regex_t* reg, int prev_ambig, in divide_ambig_string_node_sub() argument
3208 wp += ONIGENC_MBC_TO_NORMALIZE(reg->enc, reg->ambig_flag, in divide_ambig_string_node_sub()
3236 divide_ambig_string_node(Node* node, regex_t* reg) in divide_ambig_string_node() argument
3249 prev_ambig = ONIGENC_IS_MBC_AMBIGUOUS(reg->enc, reg->ambig_flag, &p, end); in divide_ambig_string_node()
3253 if (prev_ambig != (ambig = ONIGENC_IS_MBC_AMBIGUOUS(reg->enc, in divide_ambig_string_node()
3254 reg->ambig_flag, &p, end))) { in divide_ambig_string_node()
3256 r = divide_ambig_string_node_sub(reg, prev_ambig, prev_start, prev, in divide_ambig_string_node()
3271 wp += ONIGENC_MBC_TO_NORMALIZE(reg->enc, reg->ambig_flag, in divide_ambig_string_node()
3279 r = divide_ambig_string_node_sub(reg, prev_ambig, prev_start, end, in divide_ambig_string_node()
3445 setup_tree(Node* node, regex_t* reg, int state, ScanEnv* env) in setup_tree() argument
3456 r = setup_tree(NCONS(node).left, reg, state, env); in setup_tree()
3458 r = next_setup(prev, NCONS(node).left, reg); in setup_tree()
3467 r = setup_tree(NCONS(node).left, reg, (state | IN_ALT), env); in setup_tree()
3475 if (IS_IGNORECASE(reg->options) && !NSTRING_IS_RAW(node)) { in setup_tree()
3476 r = divide_ambig_string_node(node, reg); in setup_tree()
3549 r = setup_tree(target, reg, state, env); in setup_tree()
3583 qn->head_exact = get_head_value_node(qn->target, 1, reg); in setup_tree()
3597 OnigOptionType options = reg->options; in setup_tree()
3598 reg->options = NEFFECT(node).option; in setup_tree()
3599 r = setup_tree(NEFFECT(node).target, reg, state, env); in setup_tree()
3600 reg->options = options; 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()
3662 r = setup_look_behind(node, reg, env); in setup_tree()
3664 r = setup_tree(an->target, reg, state, env); in setup_tree()
3674 r = setup_look_behind(node, reg, env); in setup_tree()
3676 r = setup_tree(an->target, reg, (state | IN_NOT), env); in setup_tree()
4676 set_optimize_exact_info(regex_t* reg, OptExactInfo* e) in set_optimize_exact_info() argument
4683 reg->exact = (UChar* )xmalloc(e->len); in set_optimize_exact_info()
4684 CHECK_NULL_RETURN_VAL(reg->exact, ONIGERR_MEMORY); in set_optimize_exact_info()
4685 xmemcpy(reg->exact, e->s, e->len); in set_optimize_exact_info()
4686 reg->exact_end = reg->exact + e->len; in set_optimize_exact_info()
4687 reg->optimize = ONIG_OPTIMIZE_EXACT_IC; in set_optimize_exact_info()
4692 reg->exact = k_strdup(e->s, e->s + e->len); in set_optimize_exact_info()
4693 CHECK_NULL_RETURN_VAL(reg->exact, ONIGERR_MEMORY); in set_optimize_exact_info()
4694 reg->exact_end = reg->exact + e->len; in set_optimize_exact_info()
4697 ONIGENC_IS_ALLOWED_REVERSE_MATCH(reg->enc, reg->exact, reg->exact_end); in set_optimize_exact_info()
4700 r = set_bm_skip(reg->exact, reg->exact_end, reg->enc, in set_optimize_exact_info()
4701 reg->map, &(reg->int_map)); in set_optimize_exact_info()
4704 reg->optimize = (allow_reverse != 0 in set_optimize_exact_info()
4708 reg->optimize = ONIG_OPTIMIZE_EXACT; in set_optimize_exact_info()
4712 reg->dmin = e->mmd.min; in set_optimize_exact_info()
4713 reg->dmax = e->mmd.max; in set_optimize_exact_info()
4715 if (reg->dmin != ONIG_INFINITE_DISTANCE) { in set_optimize_exact_info()
4716 reg->threshold_len = reg->dmin + (reg->exact_end - reg->exact); in set_optimize_exact_info()
4723 set_optimize_map_info(regex_t* reg, OptMapInfo* m) in set_optimize_map_info() argument
4728 reg->map[i] = m->map[i]; in set_optimize_map_info()
4730 reg->optimize = ONIG_OPTIMIZE_MAP; in set_optimize_map_info()
4731 reg->dmin = m->mmd.min; in set_optimize_map_info()
4732 reg->dmax = m->mmd.max; in set_optimize_map_info()
4734 if (reg->dmin != ONIG_INFINITE_DISTANCE) { in set_optimize_map_info()
4735 reg->threshold_len = reg->dmin + 1; in set_optimize_map_info()
4740 set_sub_anchor(regex_t* reg, OptAncInfo* anc) in set_sub_anchor() argument
4742 reg->sub_anchor |= anc->left_anchor & ANCHOR_BEGIN_LINE; in set_sub_anchor()
4743 reg->sub_anchor |= anc->right_anchor & ANCHOR_END_LINE; in set_sub_anchor()
4747 static void print_optimize_info(FILE* f, regex_t* reg);
4751 set_optimize_info_from_tree(Node* node, regex_t* reg, ScanEnv* scan_env) in set_optimize_info_from_tree() argument
4758 env.enc = reg->enc; in set_optimize_info_from_tree()
4759 env.options = reg->options; in set_optimize_info_from_tree()
4760 env.ambig_flag = reg->ambig_flag; in set_optimize_info_from_tree()
4767 reg->anchor = opt.anc.left_anchor & (ANCHOR_BEGIN_BUF | in set_optimize_info_from_tree()
4770 reg->anchor |= opt.anc.right_anchor & (ANCHOR_END_BUF | ANCHOR_SEMI_END_BUF); in set_optimize_info_from_tree()
4772 if (reg->anchor & (ANCHOR_END_BUF | ANCHOR_SEMI_END_BUF)) { in set_optimize_info_from_tree()
4773 reg->anchor_dmin = opt.len.min; in set_optimize_info_from_tree()
4774 reg->anchor_dmax = opt.len.max; in set_optimize_info_from_tree()
4778 select_opt_exact_info(reg->enc, &opt.exb, &opt.exm); in set_optimize_info_from_tree()
4784 r = set_optimize_exact_info(reg, &opt.exb); in set_optimize_info_from_tree()
4785 set_sub_anchor(reg, &opt.exb.anc); in set_optimize_info_from_tree()
4790 set_optimize_map_info(reg, &opt.map); in set_optimize_info_from_tree()
4791 set_sub_anchor(reg, &opt.map.anc); in set_optimize_info_from_tree()
4794 reg->sub_anchor |= opt.anc.left_anchor & ANCHOR_BEGIN_LINE; in set_optimize_info_from_tree()
4796 reg->sub_anchor |= opt.anc.right_anchor & ANCHOR_END_LINE; in set_optimize_info_from_tree()
4800 print_optimize_info(stderr, reg); in set_optimize_info_from_tree()
4806 clear_optimize_info(regex_t* reg) in clear_optimize_info() argument
4808 reg->optimize = ONIG_OPTIMIZE_NONE; in clear_optimize_info()
4809 reg->anchor = 0; in clear_optimize_info()
4810 reg->anchor_dmin = 0; in clear_optimize_info()
4811 reg->anchor_dmax = 0; in clear_optimize_info()
4812 reg->sub_anchor = 0; in clear_optimize_info()
4813 reg->exact_end = (UChar* )NULL; in clear_optimize_info()
4814 reg->threshold_len = 0; in clear_optimize_info()
4815 if (IS_NOT_NULL(reg->exact)) { in clear_optimize_info()
4816 xfree(reg->exact); in clear_optimize_info()
4817 reg->exact = (UChar* )NULL; in clear_optimize_info()
4921 print_optimize_info(FILE* f, regex_t* reg) in print_optimize_info() argument
4926 fprintf(f, "optimize: %s\n", on[reg->optimize]); in print_optimize_info()
4927 fprintf(f, " anchor: "); print_anchor(f, reg->anchor); in print_optimize_info()
4928 if ((reg->anchor & ANCHOR_END_BUF_MASK) != 0) in print_optimize_info()
4929 print_distance_range(f, reg->anchor_dmin, reg->anchor_dmax); in print_optimize_info()
4932 if (reg->optimize) { in print_optimize_info()
4933 fprintf(f, " sub anchor: "); print_anchor(f, reg->sub_anchor); in print_optimize_info()
4938 if (reg->exact) { in print_optimize_info()
4941 for (p = reg->exact; p < reg->exact_end; p++) { in print_optimize_info()
4944 fprintf(f, "]: length: %d\n", (reg->exact_end - reg->exact)); in print_optimize_info()
4946 else if (reg->optimize & ONIG_OPTIMIZE_MAP) { in print_optimize_info()
4950 if (reg->map[i]) n++; in print_optimize_info()
4957 if (reg->map[i] != 0) { in print_optimize_info()
4960 if (ONIGENC_MBC_MAXLEN(reg->enc) == 1 && in print_optimize_info()
4961 ONIGENC_IS_CODE_PRINT(reg->enc, (OnigCodePoint )i)) in print_optimize_info()
4975 onig_free_body(regex_t* reg) in onig_free_body() argument
4977 if (IS_NOT_NULL(reg->p)) xfree(reg->p); in onig_free_body()
4978 if (IS_NOT_NULL(reg->exact)) xfree(reg->exact); in onig_free_body()
4979 if (IS_NOT_NULL(reg->int_map)) xfree(reg->int_map); in onig_free_body()
4980 if (IS_NOT_NULL(reg->int_map_backward)) xfree(reg->int_map_backward); in onig_free_body()
4981 if (IS_NOT_NULL(reg->repeat_range)) xfree(reg->repeat_range); in onig_free_body()
4982 if (IS_NOT_NULL(reg->chain)) onig_free(reg->chain); in onig_free_body()
4985 onig_names_free(reg); in onig_free_body()
4990 onig_free(regex_t* reg) in onig_free() argument
4992 if (IS_NOT_NULL(reg)) { in onig_free()
4993 onig_free_body(reg); in onig_free()
4994 xfree(reg); in onig_free()
5013 #define REGEX_CHAIN_HEAD(reg) do {\ argument
5014 while (IS_NOT_NULL((reg)->chain)) {\
5015 (reg) = (reg)->chain;\
5029 onig_chain_reduce(regex_t* reg) in onig_chain_reduce() argument
5033 prev = reg; in onig_chain_reduce()
5036 reg->state = ONIG_STATE_MODIFY; in onig_chain_reduce()
5042 REGEX_TRANSFER(reg, head); in onig_chain_reduce()
5051 regex_t* reg;
5056 if (IS_NOT_NULL(from->chain) && ONIG_STATE(reg) == ONIG_STATE_NORMAL) {
5072 r = onig_alloc_init(&reg, ONIG_OPTION_NONE, ONIGENC_AMBIGUOUS_MATCH_DEFAULT,
5079 xmemcpy(reg, from, sizeof(onig_t));
5080 reg->chain = (regex_t* )NULL;
5081 reg->state = ONIG_STATE_NORMAL;
5084 reg->p = (UChar* )xmalloc(reg->alloc);
5085 if (IS_NULL(reg->p)) goto mem_error;
5086 xmemcpy(reg->p, from->p, reg->alloc);
5090 reg->exact = (UChar* )xmalloc(from->exact_end - from->exact);
5091 if (IS_NULL(reg->exact)) goto mem_error;
5092 reg->exact_end = reg->exact + (from->exact_end - from->exact);
5093 xmemcpy(reg->exact, from->exact, reg->exact_end - reg->exact);
5098 reg->int_map = (int* )xmalloc(size);
5099 if (IS_NULL(reg->int_map)) goto mem_error;
5100 xmemcpy(reg->int_map, from->int_map, size);
5105 reg->int_map_backward = (int* )xmalloc(size);
5106 if (IS_NULL(reg->int_map_backward)) goto mem_error;
5107 xmemcpy(reg->int_map_backward, from->int_map_backward, size);
5111 reg->name_table = names_clone(from); /* names_clone is not implemented */
5115 *to = reg;
5125 static void print_compiled_byte_code_list P_((FILE* f, regex_t* reg));
5132 onig_compile(regex_t* reg, const UChar* pattern, const UChar* pattern_end, in onig_compile() argument
5144 reg->state = ONIG_STATE_COMPILING; in onig_compile()
5147 print_enc_string(stderr, reg->enc, pattern, pattern_end); in onig_compile()
5150 if (reg->alloc == 0) { in onig_compile()
5153 r = BBUF_INIT(reg, init_size); in onig_compile()
5157 reg->used = 0; in onig_compile()
5159 reg->num_mem = 0; in onig_compile()
5160 reg->num_repeat = 0; in onig_compile()
5161 reg->num_null_check = 0; in onig_compile()
5162 reg->repeat_range_alloc = 0; in onig_compile()
5163 reg->repeat_range = (OnigRepeatRange* )NULL; in onig_compile()
5165 reg->num_comb_exp_check = 0; in onig_compile()
5168 r = onig_parse_make_tree(&root, pattern, pattern_end, reg, &scan_env); in onig_compile()
5175 !ONIG_IS_OPTION_ON(reg->options, ONIG_OPTION_CAPTURE_GROUP)) { in onig_compile()
5177 r = disable_noname_group_capture(&root, reg, &scan_env); in onig_compile()
5201 reg->num_call = scan_env.num_call; in onig_compile()
5204 reg->num_call = 0; in onig_compile()
5207 r = setup_tree(root, reg, 0, &scan_env); in onig_compile()
5210 reg->capture_history = scan_env.capture_history; in onig_compile()
5211 reg->bt_mem_start = scan_env.bt_mem_start; in onig_compile()
5212 reg->bt_mem_start |= reg->capture_history; in onig_compile()
5213 if (IS_FIND_CONDITION(reg->options)) in onig_compile()
5214 BIT_STATUS_ON_ALL(reg->bt_mem_end); in onig_compile()
5216 reg->bt_mem_end = scan_env.bt_mem_end; in onig_compile()
5217 reg->bt_mem_end |= reg->capture_history; in onig_compile()
5244 reg->num_comb_exp_check = scan_env.num_comb_exp_check; in onig_compile()
5247 clear_optimize_info(reg); in onig_compile()
5249 r = set_optimize_info_from_tree(root, reg, &scan_env); in onig_compile()
5258 r = compile_tree(root, reg); in onig_compile()
5260 r = add_opcode(reg, OP_END); in onig_compile()
5263 r = unset_addr_list_fix(&uslist, reg); in onig_compile()
5269 if ((reg->num_repeat != 0) || (reg->bt_mem_end != 0)) in onig_compile()
5270 reg->stack_pop_level = STACK_POP_LEVEL_ALL; in onig_compile()
5272 if (reg->bt_mem_start != 0) in onig_compile()
5273 reg->stack_pop_level = STACK_POP_LEVEL_MEM_START; in onig_compile()
5275 reg->stack_pop_level = STACK_POP_LEVEL_FREE; in onig_compile()
5287 onig_print_names(stderr, reg); in onig_compile()
5289 print_compiled_byte_code_list(stderr, reg); in onig_compile()
5293 reg->state = ONIG_STATE_NORMAL; in onig_compile()
5319 onig_recompile(regex_t* reg, const UChar* pattern, const UChar* pattern_end, in onig_recompile() argument
5328 if (ONIG_STATE(reg) == ONIG_STATE_NORMAL) { in onig_recompile()
5329 onig_transfer(reg, new_reg); in onig_recompile()
5332 onig_chain_link_add(reg, new_reg); in onig_recompile()
5341 onig_alloc_init(regex_t** reg, OnigOptionType option, OnigAmbigType ambig_flag, in onig_alloc_init() argument
5355 *reg = (regex_t* )xmalloc(sizeof(regex_t)); in onig_alloc_init()
5356 if (IS_NULL(*reg)) return ONIGERR_MEMORY; in onig_alloc_init()
5357 (*reg)->state = ONIG_STATE_MODIFY; in onig_alloc_init()
5366 (*reg)->enc = enc; in onig_alloc_init()
5367 (*reg)->options = option; in onig_alloc_init()
5368 (*reg)->syntax = syntax; in onig_alloc_init()
5369 (*reg)->optimize = 0; in onig_alloc_init()
5370 (*reg)->exact = (UChar* )NULL; in onig_alloc_init()
5371 (*reg)->int_map = (int* )NULL; in onig_alloc_init()
5372 (*reg)->int_map_backward = (int* )NULL; in onig_alloc_init()
5373 (*reg)->chain = (regex_t* )NULL; in onig_alloc_init()
5375 (*reg)->p = (UChar* )NULL; in onig_alloc_init()
5376 (*reg)->alloc = 0; in onig_alloc_init()
5377 (*reg)->used = 0; in onig_alloc_init()
5378 (*reg)->name_table = (void* )NULL; in onig_alloc_init()
5380 (*reg)->ambig_flag = ambig_flag; in onig_alloc_init()
5381 (*reg)->ambig_flag &= ONIGENC_SUPPORT_AMBIG_FLAG(enc); in onig_alloc_init()
5387 onig_new(regex_t** reg, const UChar* pattern, const UChar* pattern_end, in onig_new() argument
5395 r = onig_alloc_init(reg, option, ONIGENC_AMBIGUOUS_MATCH_DEFAULT, in onig_new()
5399 r = onig_compile(*reg, pattern, pattern_end, einfo); in onig_new()
5401 onig_free(*reg); in onig_new()
5402 *reg = NULL; in onig_new()
5854 print_compiled_byte_code_list(FILE* f, regex_t* reg) in print_compiled_byte_code_list() argument
5857 UChar* bp = reg->p; in print_compiled_byte_code_list()
5858 UChar* end = reg->p + reg->used; in print_compiled_byte_code_list()
5860 fprintf(f, "code length: %d\n", reg->used); in print_compiled_byte_code_list()
5865 if (bp > reg->p) { in print_compiled_byte_code_list()
5871 onig_print_compiled_byte_code(f, bp, &bp, reg->enc); in print_compiled_byte_code_list()