Lines Matching refs:r

112   int r;  in bbuf_clone()  local
117 r = BBUF_INIT(to, from->alloc); in bbuf_clone()
118 if (r != 0) return r; in bbuf_clone()
137 r = SET_ALL_MULTI_BYTE_RANGE(enc, &(mbuf));\
138 if (r) return r;\
233 UChar *r; in strdup_with_null() local
238 r = (UChar* )xmalloc(slen + term_len); in strdup_with_null()
239 CHECK_NULL_RETURN(r); in strdup_with_null()
240 xmemcpy(r, s, slen); in strdup_with_null()
243 r[slen + i] = (UChar )0; in strdup_with_null()
245 return r; in strdup_with_null()
272 UChar* r; in strcat_capa() local
275 r = (UChar* )xrealloc(dest, capa + 1); in strcat_capa()
277 r = (UChar* )xmalloc(capa + 1); in strcat_capa()
279 CHECK_NULL_RETURN(r); in strcat_capa()
280 onig_strcpy(r + (dest_end - dest), src, src_end); in strcat_capa()
281 return r; in strcat_capa()
289 UChar* r; in strcat_capa_from_static() local
291 r = (UChar* )xmalloc(capa + 1); in strcat_capa_from_static()
292 CHECK_NULL_RETURN(r); in strcat_capa_from_static()
293 onig_strcpy(r, dest, dest_end); in strcat_capa_from_static()
294 onig_strcpy(r + (dest_end - dest), src, src_end); in strcat_capa_from_static()
295 return r; in strcat_capa_from_static()
466 int r; in onig_names_free() local
469 r = names_clear(reg); in onig_names_free()
470 if (r) return r; in onig_names_free()
502 int r = (*(arg->func))(e->name, in i_names() local
507 if (r != 0) { in i_names()
508 arg->ret = r; in i_names()
647 int r; in onig_names_free() local
650 r = names_clear(reg); in onig_names_free()
651 if (r) return r; in onig_names_free()
681 int i, r; in onig_foreach_name() local
688 r = (*func)(e->name, e->name + e->name_len, e->back_num, in onig_foreach_name()
691 if (r != 0) return r; in onig_foreach_name()
1674 int r; in new_code_range() local
1680 r = BBUF_INIT(*pbuf, INIT_MULTI_BYTE_RANGE_SIZE); in new_code_range()
1681 if (r) return r; in new_code_range()
1691 int r, inc_n, pos; in add_code_range_to_buf() local
1701 r = new_code_range(pbuf); in add_code_range_to_buf()
1702 if (r) return r; in add_code_range_to_buf()
1779 int r, i, n; in not_code_range_buf() local
1793 r = 0; in not_code_range_buf()
1799 r = add_code_range_to_buf(pbuf, pre, from - 1); in not_code_range_buf()
1800 if (r != 0) return r; in not_code_range_buf()
1806 r = add_code_range_to_buf(pbuf, to + 1, ~((OnigCodePoint )0)); in not_code_range_buf()
1808 return r; in not_code_range_buf()
1822 int r; in or_code_range_buf() local
1833 r = 0; in or_code_range_buf()
1859 r = bbuf_clone(pbuf, bbuf2); in or_code_range_buf()
1862 r = not_code_range_buf(enc, bbuf2, pbuf); in or_code_range_buf()
1864 if (r != 0) return r; in or_code_range_buf()
1869 r = add_code_range_to_buf(pbuf, from, to); in or_code_range_buf()
1870 if (r != 0) return r; in or_code_range_buf()
1879 int i, r; in and_code_range1() local
1894 r = add_code_range_to_buf(pbuf, from1, from2-1); in and_code_range1()
1895 if (r != 0) return r; in and_code_range1()
1909 r = add_code_range_to_buf(pbuf, from1, to1); in and_code_range1()
1910 if (r != 0) return r; in and_code_range1()
1918 int r; in and_code_range_buf() local
1955 r = add_code_range_to_buf(pbuf, from, to); in and_code_range_buf()
1956 if (r != 0) return r; in and_code_range_buf()
1964 r = and_code_range1(pbuf, from1, to1, data2, n2); in and_code_range_buf()
1965 if (r != 0) return r; in and_code_range_buf()
1975 int r, not1, not2; in and_cclass() local
2006 r = or_code_range_buf(enc, buf1, 0, buf2, 0, &pbuf); in and_cclass()
2009 r = and_code_range_buf(buf1, not1, buf2, not2, &pbuf); in and_cclass()
2010 if (r == 0 && not1 != 0) { in and_cclass()
2012 r = not_code_range_buf(enc, pbuf, &tbuf); in and_cclass()
2013 if (r != 0) { in and_cclass()
2015 return r; in and_cclass()
2021 if (r != 0) return r; in and_cclass()
2025 return r; in and_cclass()
2033 int r, not1, not2; in or_cclass() local
2064 r = and_code_range_buf(buf1, 0, buf2, 0, &pbuf); in or_cclass()
2067 r = or_code_range_buf(enc, buf1, not1, buf2, not2, &pbuf); in or_cclass()
2068 if (r == 0 && not1 != 0) { in or_cclass()
2070 r = not_code_range_buf(enc, pbuf, &tbuf); in or_cclass()
2071 if (r != 0) { in or_cclass()
2073 return r; in or_cclass()
2079 if (r != 0) return r; in or_cclass()
2083 return r; in or_cclass()
2313 int r = 0; in fetch_range_quantifier() local
2371 r = 2; /* fixed */ in fetch_range_quantifier()
2390 return r; /* 0: normal {n,m}, 2: fixed {n} */ in fetch_range_quantifier()
2500 int r, sign, is_num, exist_level; in fetch_name_with_level() local
2517 r = 0; in fetch_name_with_level()
2535 r = ONIGERR_INVALID_CHAR_IN_GROUP_NAME; in fetch_name_with_level()
2543 if (is_num == 2) r = ONIGERR_INVALID_GROUP_NAME; in fetch_name_with_level()
2552 r = ONIGERR_INVALID_GROUP_NAME; in fetch_name_with_level()
2557 r = ONIGERR_INVALID_CHAR_IN_GROUP_NAME; in fetch_name_with_level()
2561 if (r == 0 && c != end_code) { in fetch_name_with_level()
2580 r = ONIGERR_INVALID_GROUP_NAME; in fetch_name_with_level()
2585 if (r == 0) { in fetch_name_with_level()
2599 onig_scan_env_set_error_string(env, r, *src, name_end); in fetch_name_with_level()
2600 return r; in fetch_name_with_level()
2613 int r, is_num, sign; in fetch_name() local
2628 r = 0; in fetch_name()
2643 r = ONIGERR_INVALID_GROUP_NAME; in fetch_name()
2654 r = ONIGERR_INVALID_GROUP_NAME; in fetch_name()
2659 r = ONIGERR_INVALID_CHAR_IN_GROUP_NAME; in fetch_name()
2663 if (r == 0) { in fetch_name()
2668 if (is_num == 2) r = ONIGERR_INVALID_GROUP_NAME; in fetch_name()
2678 r = ONIGERR_INVALID_CHAR_IN_GROUP_NAME; in fetch_name()
2680 r = ONIGERR_INVALID_GROUP_NAME; in fetch_name()
2687 r = ONIGERR_INVALID_CHAR_IN_GROUP_NAME; in fetch_name()
2693 r = ONIGERR_INVALID_GROUP_NAME; in fetch_name()
2701 r = ONIGERR_INVALID_GROUP_NAME; in fetch_name()
2723 onig_scan_env_set_error_string(env, r, *src, name_end); in fetch_name()
2724 return r; in fetch_name()
2732 int r, is_num, sign; in fetch_name() local
2746 r = 0; in fetch_name()
2768 r = ONIGERR_INVALID_CHAR_IN_GROUP_NAME; in fetch_name()
2778 r = ONIGERR_INVALID_CHAR_IN_GROUP_NAME; in fetch_name()
2780 if (r == 0 && c != end_code) { in fetch_name()
2781 r = ONIGERR_INVALID_GROUP_NAME; in fetch_name()
2785 if (r == 0) { in fetch_name()
2789 r = ONIGERR_INVALID_GROUP_NAME; in fetch_name()
2800 onig_scan_env_set_error_string(env, r, *src, name_end); in fetch_name()
2801 return r; in fetch_name()
3123 int r, num; in fetch_token() local
3199 r = fetch_range_quantifier(&p, end, tok, env); in fetch_token()
3200 if (r < 0) return r; /* error */ in fetch_token()
3201 if (r == 0) goto greedy_check; in fetch_token()
3202 else if (r == 2) { /* {n} */ in fetch_token()
3460 r = fetch_name_with_level((OnigCodePoint )c, &p, end, &name_end, in fetch_token()
3462 if (r == 1) tok->u.backref.exist_level = 1; in fetch_token()
3465 r = fetch_name(&p, end, &name_end, env, &back_num, 1); in fetch_token()
3467 if (r < 0) return r; in fetch_token()
3529 r = fetch_name((OnigCodePoint )c, &p, end, &name_end, env, &gnum, 1); in fetch_token()
3530 if (r < 0) return r; in fetch_token()
3649 r = fetch_range_quantifier(&p, end, tok, env); in fetch_token()
3650 if (r < 0) return r; /* error */ in fetch_token()
3651 if (r == 0) goto greedy_check; in fetch_token()
3652 else if (r == 2) { /* {n} */ in fetch_token()
3755 int i, r; in add_ctype_to_cc_by_range() local
3767 r = add_code_range_to_buf(&(cc->mbuf), j, in add_ctype_to_cc_by_range()
3769 if (r != 0) return r; in add_ctype_to_cc_by_range()
3781 r = add_code_range_to_buf(&(cc->mbuf), in add_ctype_to_cc_by_range()
3784 if (r != 0) return r; in add_ctype_to_cc_by_range()
3809 r = add_code_range_to_buf(&(cc->mbuf), prev, in add_ctype_to_cc_by_range()
3811 if (r != 0) return r; in add_ctype_to_cc_by_range()
3816 r = add_code_range_to_buf(&(cc->mbuf), prev, 0x7fffffff); in add_ctype_to_cc_by_range()
3817 if (r != 0) return r; in add_ctype_to_cc_by_range()
3827 int c, r; in add_ctype_to_cc() local
3832 r = ONIGENC_GET_CTYPE_CODE_RANGE(enc, ctype, &sb_out, &ranges); in add_ctype_to_cc()
3833 if (r == 0) { in add_ctype_to_cc()
3836 else if (r != ONIG_NO_SUPPORT_CONFIG) { in add_ctype_to_cc()
3837 return r; in add_ctype_to_cc()
3840 r = 0; in add_ctype_to_cc()
3906 return r; in add_ctype_to_cc()
3934 int not, i, r; in parse_posix_bracket() local
3956 r = add_ctype_to_cc(cc, pb->ctype, not, env); in parse_posix_bracket()
3957 if (r != 0) return r; in parse_posix_bracket()
3987 int r; in fetch_char_property_to_ctype() local
3993 r = 0; in fetch_char_property_to_ctype()
4000 r = ONIGENC_PROPERTY_NAME_TO_CTYPE(enc, start, prev); in fetch_char_property_to_ctype()
4001 if (r < 0) break; in fetch_char_property_to_ctype()
4004 return r; in fetch_char_property_to_ctype()
4007 r = ONIGERR_INVALID_CHAR_PROPERTY_NAME; in fetch_char_property_to_ctype()
4012 onig_scan_env_set_error_string(env, r, *src, prev); in fetch_char_property_to_ctype()
4013 return r; in fetch_char_property_to_ctype()
4020 int r, ctype; in parse_char_property() local
4029 r = add_ctype_to_cc(cc, ctype, 0, env); in parse_char_property()
4030 if (r != 0) return r; in parse_char_property()
4054 int r; in next_state_class() local
4063 r = add_code_range(&(cc->mbuf), env, *vs, *vs); in next_state_class()
4064 if (r < 0) return r; in next_state_class()
4079 int r; in next_state_val() local
4086 r = add_code_range(&(cc->mbuf), env, *vs, *vs); in next_state_val()
4087 if (r < 0) return r; in next_state_val()
4106 r = add_code_range(&(cc->mbuf), env, *vs, v); in next_state_val()
4107 if (r < 0) return r; in next_state_val()
4121 r = add_code_range(&(cc->mbuf), env, (OnigCodePoint )*vs, v); in next_state_val()
4122 if (r < 0) return r; in next_state_val()
4176 int r, neg, len, fetched, and_start; in parse_char_class() local
4189 r = fetch_token_in_cc(tok, src, end, env); in parse_char_class()
4190 if (r == TK_CHAR && tok->u.c == '^' && tok->escaped == 0) { in parse_char_class()
4192 r = fetch_token_in_cc(tok, src, end, env); in parse_char_class()
4198 if (r < 0) return r; in parse_char_class()
4199 if (r == TK_CC_CLOSE) { in parse_char_class()
4205 r = tok->type = TK_CHAR; /* allow []...] */ in parse_char_class()
4215 while (r != TK_CC_CLOSE) { in parse_char_class()
4217 switch (r) { in parse_char_class()
4224 r = len; in parse_char_class()
4246 r = fetch_token_in_cc(tok, &p, end, env); in parse_char_class()
4247 if (r < 0) goto err; in parse_char_class()
4248 if (r != TK_RAW_BYTE || tok->base != base) { in parse_char_class()
4256 r = ONIGERR_TOO_SHORT_MULTI_BYTE_STRING; in parse_char_class()
4262 r = ONIGERR_TOO_SHORT_MULTI_BYTE_STRING; in parse_char_class()
4268 r = fetch_token_in_cc(tok, &p, end, env); in parse_char_class()
4297 r = len; in parse_char_class()
4302 r = next_state_val(cc, &vs, v, &val_israw, in_israw, in_type, &val_type, in parse_char_class()
4304 if (r != 0) goto err; in parse_char_class()
4308 r = parse_posix_bracket(cc, &p, end, env); in parse_char_class()
4309 if (r < 0) goto err; in parse_char_class()
4310 if (r == 1) { /* is not POSIX bracket */ in parse_char_class()
4321 r = add_ctype_to_cc(cc, tok->u.prop.ctype, tok->u.prop.not, env); in parse_char_class()
4322 if (r != 0) return r; in parse_char_class()
4325 r = next_state_class(cc, &vs, &val_type, &state, env); in parse_char_class()
4326 if (r != 0) goto err; in parse_char_class()
4335 r = add_ctype_to_cc(cc, ctype, tok->u.prop.not, env); in parse_char_class()
4336 if (r != 0) return r; in parse_char_class()
4343 r = fetch_token_in_cc(tok, &p, end, env); in parse_char_class()
4344 if (r < 0) goto err; in parse_char_class()
4346 if (r == TK_CC_CLOSE) { /* allow [x-] */ in parse_char_class()
4352 else if (r == TK_CC_AND) { in parse_char_class()
4363 r = fetch_token_in_cc(tok, &p, end, env); in parse_char_class()
4364 if (r < 0) goto err; in parse_char_class()
4367 if (r == TK_CC_RANGE || and_start != 0) in parse_char_class()
4377 r = fetch_token_in_cc(tok, &p, end, env); in parse_char_class()
4378 if (r < 0) goto err; in parse_char_class()
4380 if (r == TK_CC_CLOSE) goto range_end_val; /* allow [a-b-] */ in parse_char_class()
4381 else if (r == TK_CC_AND) { in parse_char_class()
4390 r = ONIGERR_UNMATCHED_RANGE_SPECIFIER_IN_CHAR_CLASS; in parse_char_class()
4400 r = parse_char_class(&anode, tok, &p, end, env); in parse_char_class()
4401 if (r != 0) goto cc_open_err; in parse_char_class()
4403 r = or_cclass(cc, acc, env->enc); in parse_char_class()
4407 if (r != 0) goto err; in parse_char_class()
4414 r = next_state_val(cc, &vs, 0, &val_israw, 0, val_type, in parse_char_class()
4416 if (r != 0) goto err; in parse_char_class()
4423 r = and_cclass(prev_cc, cc, env->enc); in parse_char_class()
4424 if (r != 0) goto err; in parse_char_class()
4436 r = ONIGERR_PREMATURE_END_OF_CHAR_CLASS; in parse_char_class()
4440 r = ONIGERR_PARSER_BUG; in parse_char_class()
4446 r = tok->type; in parse_char_class()
4448 r = fetch_token_in_cc(tok, &p, end, env); in parse_char_class()
4449 if (r < 0) goto err; in parse_char_class()
4454 r = next_state_val(cc, &vs, 0, &val_israw, 0, val_type, in parse_char_class()
4456 if (r != 0) goto err; in parse_char_class()
4460 r = and_cclass(prev_cc, cc, env->enc); in parse_char_class()
4461 if (r != 0) goto err; in parse_char_class()
4496 return r; in parse_char_class()
4506 int r, num; in parse_enclose() local
4532 r = fetch_token(tok, &p, end, env); in parse_enclose()
4533 if (r < 0) return r; in parse_enclose()
4534 r = parse_subexp(np, tok, term, &p, end, env); in parse_enclose()
4535 if (r < 0) return r; in parse_enclose()
4580 r = fetch_name((OnigCodePoint )c, &p, end, &name_end, env, &num, 0); in parse_enclose()
4581 if (r < 0) return r; in parse_enclose()
4588 r = name_add(env->reg, name, name_end, num, env); in parse_enclose()
4589 if (r != 0) return r; in parse_enclose()
4692 r = fetch_token(tok, &p, end, env); in parse_enclose()
4693 if (r < 0) return r; in parse_enclose()
4694 r = parse_subexp(&target, tok, term, &p, end, env); in parse_enclose()
4696 if (r < 0) return r; in parse_enclose()
4726 r = fetch_token(tok, &p, end, env); in parse_enclose()
4727 if (r < 0) return r; in parse_enclose()
4728 r = parse_subexp(&target, tok, term, &p, end, env); in parse_enclose()
4729 if (r < 0) return r; in parse_enclose()
4737 r = scan_env_set_mem_node(env, NENCLOSE(*np)->regnum, *np); in parse_enclose()
4738 if (r != 0) return r; in parse_enclose()
4927 int r; in clear_not_flag_cclass() local
4933 r = not_code_range_buf(enc, cc->mbuf, &tbuf); in clear_not_flag_cclass()
4934 if (r != 0) return r; in clear_not_flag_cclass()
4997 int r, i, len; in i_apply_case_fold() local
5017 r = onig_node_str_cat(snode, buf, buf + len); in i_apply_case_fold()
5018 if (r < 0) { in i_apply_case_fold()
5020 return r; in i_apply_case_fold()
5038 int r, len, group = 0; in parse_exp() local
5055 r = parse_enclose(np, tok, TK_SUBEXP_CLOSE, src, end, env); in parse_exp()
5056 if (r < 0) return r; in parse_exp()
5057 if (r == 1) group = 1; in parse_exp()
5058 else if (r == 2) { /* option only */ in parse_exp()
5063 r = fetch_token(tok, src, end, env); in parse_exp()
5064 if (r < 0) return r; in parse_exp()
5065 r = parse_subexp(&target, tok, term, src, end, env); in parse_exp()
5067 if (r < 0) return r; in parse_exp()
5088 r = fetch_token(tok, src, end, env); in parse_exp()
5089 if (r < 0) return r; in parse_exp()
5090 if (r != TK_STRING) break; in parse_exp()
5092 r = onig_node_str_cat(*np, tok->backp, *src); in parse_exp()
5093 if (r < 0) return r; in parse_exp()
5111 r = fetch_token(tok, src, end, env); in parse_exp()
5117 r = fetch_token(tok, src, end, env); in parse_exp()
5118 if (r < 0) return r; in parse_exp()
5119 if (r != TK_RAW_BYTE) { in parse_exp()
5135 r = node_str_cat_char(*np, (UChar )tok->u.c); in parse_exp()
5136 if (r < 0) return r; in parse_exp()
5193 r = ONIGENC_GET_CTYPE_CODE_RANGE(env->enc, tok->u.prop.ctype, in parse_exp()
5195 if (r == 0 && in parse_exp()
5260 r = parse_char_property(np, tok, src, end, env); in parse_exp()
5261 if (r != 0) return r; in parse_exp()
5268 r = parse_char_class(np, tok, src, end, env); in parse_exp()
5269 if (r != 0) return r; in parse_exp()
5280 r = ONIGENC_APPLY_ALL_CASE_FOLD(env->enc, env->case_fold_flag, in parse_exp()
5282 if (r != 0) { in parse_exp()
5284 return r; in parse_exp()
5368 r = fetch_token(tok, src, end, env); in parse_exp()
5369 if (r < 0) return r; in parse_exp()
5372 if (r == TK_OP_REPEAT || r == TK_INTERVAL) { in parse_exp()
5377 (r == TK_INTERVAL ? 1 : 0)); in parse_exp()
5380 r = set_quantifier(qn, *targetp, group, env); in parse_exp()
5381 if (r < 0) { in parse_exp()
5383 return r; in parse_exp()
5397 if (r == 0) { in parse_exp()
5400 else if (r == 1) { in parse_exp()
5403 else if (r == 2) { /* split case: /abc+/ */ in parse_exp()
5422 return r; in parse_exp()
5429 int r; in parse_branch() local
5433 r = parse_exp(&node, tok, term, src, end, env); in parse_branch()
5434 if (r < 0) return r; in parse_branch()
5436 if (r == TK_EOT || r == term || r == TK_ALT) { in parse_branch()
5442 while (r != TK_EOT && r != term && r != TK_ALT) { in parse_branch()
5443 r = parse_exp(&node, tok, term, src, end, env); in parse_branch()
5444 if (r < 0) return r; in parse_branch()
5458 return r; in parse_branch()
5466 int r; in parse_subexp() local
5470 r = parse_branch(&node, tok, term, src, end, env); in parse_subexp()
5471 if (r < 0) { in parse_subexp()
5473 return r; in parse_subexp()
5476 if (r == term) { in parse_subexp()
5479 else if (r == TK_ALT) { in parse_subexp()
5482 while (r == TK_ALT) { in parse_subexp()
5483 r = fetch_token(tok, src, end, env); in parse_subexp()
5484 if (r < 0) return r; in parse_subexp()
5485 r = parse_branch(&node, tok, term, src, end, env); in parse_subexp()
5486 if (r < 0) return r; in parse_subexp()
5503 return r; in parse_subexp()
5509 int r; in parse_regexp() local
5512 r = fetch_token(&tok, src, end, env); in parse_regexp()
5513 if (r < 0) return r; in parse_regexp()
5514 r = parse_subexp(top, &tok, TK_EOT, src, end, env); in parse_regexp()
5515 if (r < 0) return r; in parse_regexp()
5523 int r; in onig_parse_make_tree() local
5541 r = parse_regexp(root, &p, (UChar* )end, env); in onig_parse_make_tree()
5543 return r; in onig_parse_make_tree()