23 #define errcpy(err, msg) strlcpy((err), (msg), ONIG_MAX_ERROR_MESSAGE_LEN)
25 #define BEG(no) (regs->beg[(no)])
26 #define END(no) (regs->end[(no)])
29 static const char casetable[] = {
30 '\000',
'\001',
'\002',
'\003',
'\004',
'\005',
'\006',
'\007',
31 '\010',
'\011',
'\012',
'\013',
'\014',
'\015',
'\016',
'\017',
32 '\020',
'\021',
'\022',
'\023',
'\024',
'\025',
'\026',
'\027',
33 '\030',
'\031',
'\032',
'\033',
'\034',
'\035',
'\036',
'\037',
35 '\040',
'\041',
'\042',
'\043',
'\044',
'\045',
'\046',
'\047',
37 '\050',
'\051',
'\052',
'\053',
'\054',
'\055',
'\056',
'\057',
39 '\060',
'\061',
'\062',
'\063',
'\064',
'\065',
'\066',
'\067',
41 '\070',
'\071',
'\072',
'\073',
'\074',
'\075',
'\076',
'\077',
43 '\100',
'\141',
'\142',
'\143',
'\144',
'\145',
'\146',
'\147',
45 '\150',
'\151',
'\152',
'\153',
'\154',
'\155',
'\156',
'\157',
47 '\160',
'\161',
'\162',
'\163',
'\164',
'\165',
'\166',
'\167',
49 '\170',
'\171',
'\172',
'\133',
'\134',
'\135',
'\136',
'\137',
51 '\140',
'\141',
'\142',
'\143',
'\144',
'\145',
'\146',
'\147',
53 '\150',
'\151',
'\152',
'\153',
'\154',
'\155',
'\156',
'\157',
55 '\160',
'\161',
'\162',
'\163',
'\164',
'\165',
'\166',
'\167',
57 '\170',
'\171',
'\172',
'\173',
'\174',
'\175',
'\176',
'\177',
58 '\200',
'\201',
'\202',
'\203',
'\204',
'\205',
'\206',
'\207',
59 '\210',
'\211',
'\212',
'\213',
'\214',
'\215',
'\216',
'\217',
60 '\220',
'\221',
'\222',
'\223',
'\224',
'\225',
'\226',
'\227',
61 '\230',
'\231',
'\232',
'\233',
'\234',
'\235',
'\236',
'\237',
62 '\240',
'\241',
'\242',
'\243',
'\244',
'\245',
'\246',
'\247',
63 '\250',
'\251',
'\252',
'\253',
'\254',
'\255',
'\256',
'\257',
64 '\260',
'\261',
'\262',
'\263',
'\264',
'\265',
'\266',
'\267',
65 '\270',
'\271',
'\272',
'\273',
'\274',
'\275',
'\276',
'\277',
66 '\300',
'\301',
'\302',
'\303',
'\304',
'\305',
'\306',
'\307',
67 '\310',
'\311',
'\312',
'\313',
'\314',
'\315',
'\316',
'\317',
68 '\320',
'\321',
'\322',
'\323',
'\324',
'\325',
'\326',
'\327',
69 '\330',
'\331',
'\332',
'\333',
'\334',
'\335',
'\336',
'\337',
70 '\340',
'\341',
'\342',
'\343',
'\344',
'\345',
'\346',
'\347',
71 '\350',
'\351',
'\352',
'\353',
'\354',
'\355',
'\356',
'\357',
72 '\360',
'\361',
'\362',
'\363',
'\364',
'\365',
'\366',
'\367',
73 '\370',
'\371',
'\372',
'\373',
'\374',
'\375',
'\376',
'\377',
76 # error >>> "You lose. You will need a translation table for your character set." <<<
82 const unsigned char *p1 = x, *p2 = y;
86 if ((tmp = casetable[(
unsigned)*p1++] - casetable[(
unsigned)*p2++]))
97 return memcmp(p1, p2, len);
102 rb_memsearch_ss(
const unsigned char *xs,
long m,
const unsigned char *ys,
long n)
104 const unsigned char *y;
106 if (y = memmem(ys, n, xs, m))
115 const unsigned char *x = xs, *xe = xs +
m;
116 const unsigned char *y = ys, *ye = ys +
n;
118 # if SIZEOF_VALUE == 8
119 # define VALUE_MAX 0xFFFFFFFFFFFFFFFFULL
120 # elif SIZEOF_VALUE == 4
121 # define VALUE_MAX 0xFFFFFFFFUL
127 rb_bug(
"!!too long pattern string!!");
129 if (!(y = memchr(y, *x, n - m + 1)))
133 for (hx = *x++, hy = *y++; x < xe; ++x, ++y) {
155 const unsigned char *x = xs, *xe = xs +
m;
156 const unsigned char *y = ys;
160 for (i = 0; i < 256; ++
i)
163 qstable[*x] = xe - x;
165 for (; y + m <= ys +
n; y += *(qstable + y[
m])) {
166 if (*xs == *y &&
memcmp(xs, y, m) == 0)
172 static inline unsigned int
175 register const unsigned int mix = 8353;
176 register unsigned int h = *x;
201 return (
unsigned char)h;
207 const unsigned char *x = xs, *xe = xs +
m;
208 const unsigned char *y = ys;
212 for (i = 0; i < 512; ++
i) {
215 for (; x < xe; ++x) {
220 if (*xs == *y &&
memcmp(xs, y, m) == 0)
229 const unsigned char *x = x0, *y = y0;
231 if (m > n)
return -1;
233 return memcmp(x0, y0, m) == 0 ? 0 : -1;
239 const unsigned char *ys;
241 if (ys = memchr(y, *x, n))
257 #define REG_LITERAL FL_USER5
258 #define REG_ENCODING_NONE FL_USER6
260 #define KCODE_FIXED FL_USER4
262 #define ARG_REG_OPTION_MASK \
263 (ONIG_OPTION_IGNORECASE|ONIG_OPTION_MULTILINE|ONIG_OPTION_EXTEND)
264 #define ARG_ENCODING_FIXED 16
265 #define ARG_ENCODING_NONE 32
338 const char *
p, *pend;
343 p =
s; pend = p +
len;
351 p +=
mbclen(p, pend, enc);
379 if (c ==
'\\' && p+clen < pend) {
380 int n = clen +
mbclen(p+clen, pend, enc);
393 c = (
unsigned char)*p;
413 snprintf(b,
sizeof(b),
"\\x%02X", c);
534 options =
RREGEXP(re)->ptr->options;
538 if (len >= 4 && ptr[0] ==
'(' && ptr[1] ==
'?') {
541 if ((len -= 2) > 0) {
553 if (len > 1 && *ptr ==
'-') {
572 if (*ptr ==
':' && ptr[len-1] ==
')') {
582 options =
RREGEXP(re)->ptr->options;
590 if ((options & embeddable) != embeddable) {
702 int back_num,
int *back_refs,
OnigRegex regex,
void *
arg)
736 int back_num,
int *back_refs,
OnigRegex regex,
void *
arg)
742 for (i = 0; i < back_num; i++)
794 r =
onig_compile(*reg, pattern, pattern_end, einfo, sourcefile, sourceline);
805 const char *sourcefile,
int sourceline)
821 onig_error_code_to_str((
UChar*)err, r, &einfo);
865 #if SIZEOF_LONG > SIZEOF_INT
866 return diff ? diff > 0 ? 1 : -1 : 0;
916 for (i = 0; i < num_pos; i++) {
946 if (!
RMATCH(match)->regexp) {
996 return RMATCH(match)->regexp;
1049 switch (
TYPE(backref)) {
1063 (
const unsigned char*)name,
1064 (
const unsigned char*)name +
strlen(name),
1186 #define MATCH_BUSY FL_USER2
1241 "incompatible encoding regexp match (%s regexp with %s string)",
1253 "invalid byte sequence in %s",
1275 rb_warn(
"regexp match /.../n against to %s string",
1288 const char *pattern;
1293 if (reg->
enc == enc)
return reg;
1303 if (unescaped ==
Qnil) {
1312 onig_error_code_to_str((
UChar*)err, r, &einfo);
1367 tmpreg = reg !=
RREGEXP(re)->ptr;
1368 if (!tmpreg)
RREGEXP(re)->usecnt++;
1371 if (!
NIL_P(match)) {
1391 if (!tmpreg)
RREGEXP(re)->usecnt--;
1410 onig_error_code_to_str((
UChar*)err, (
int)result);
1428 RMATCH(match)->regexp = re;
1429 RMATCH(match)->rmatch->char_offset_updated = 0;
1450 if (nth <= 0)
return Qnil;
1471 if (nth <= 0)
return Qnil;
1474 if (start == -1)
return Qnil;
1509 if (
BEG(0) == -1)
return Qnil;
1537 if (
BEG(0) == -1)
return Qnil;
1538 str =
RMATCH(match)->str;
1554 if (
BEG(0) == -1)
return Qnil;
1556 for (i=regs->
num_regs-1;
BEG(i) == -1 && i > 0; i--)
1558 if (i == 0)
return Qnil;
1598 target =
RMATCH(match)->str;
1600 for (i=start; i<regs->
num_regs; i++) {
1601 if (regs->
beg[i] == -1) {
1669 (
const unsigned char* )name, (
const unsigned char* )name_end, regs);
1725 switch (
TYPE(idx)) {
1816 return RMATCH(match)->str;
1826 int back_num,
int *back_refs,
OnigRegex regex,
void *arg0)
1831 for (i = 0; i < back_num; i++) {
1833 arg[back_refs[
i]].
len = name_end -
name;
1870 return rb_sprintf(
"#<%s:%p>", cname, (
void*)match);
1882 for (i = 0; i < num_regs; i++) {
1909 const char *
p = *pp;
1911 int meta_prefix = 0, ctrl_prefix = 0;
1914 if (p == end || *p++ !=
'\\') {
1915 errcpy(err,
"too short escaped multibyte character");
1921 errcpy(err,
"too short escape sequence");
1925 case '\\': code =
'\\';
break;
1926 case 'n': code =
'\n';
break;
1927 case 't': code =
'\t';
break;
1928 case 'r': code =
'\r';
break;
1929 case 'f': code =
'\f';
break;
1930 case 'v': code =
'\013';
break;
1931 case 'a': code =
'\007';
break;
1932 case 'e': code =
'\033';
break;
1935 case '0':
case '1':
case '2':
case '3':
1936 case '4':
case '5':
case '6':
case '7':
1938 code =
scan_oct(p, end < p+3 ? end-p : 3, &len);
1943 code =
scan_hex(p, end < p+2 ? end-p : 2, &len);
1945 errcpy(err,
"invalid hex escape");
1953 errcpy(err,
"duplicate meta escape");
1957 if (p+1 < end && *p++ ==
'-' && (*p & 0x80) == 0) {
1967 errcpy(err,
"too short meta escape");
1971 if (p == end || *p++ !=
'-') {
1972 errcpy(err,
"too short control escape");
1977 errcpy(err,
"duplicate control escape");
1981 if (p < end && (*p & 0x80) == 0) {
1991 errcpy(err,
"too short control escape");
1995 errcpy(err,
"unexpected escape sequence");
1998 if (code < 0 || 0xff < code) {
1999 errcpy(err,
"invalid escape code");
2016 const char *
p = *pp;
2018 char *chbuf =
ALLOCA_N(
char, chmaxlen);
2023 memset(chbuf, 0, chmaxlen);
2030 chbuf[chlen++] = byte;
2031 while (chlen < chmaxlen &&
2037 chbuf[chlen++] = byte;
2042 errcpy(err,
"invalid multibyte escape");
2045 if (1 < chlen || (chbuf[0] & 0x80)) {
2050 else if (*encp != enc) {
2051 errcpy(err,
"escaped non ASCII character in UTF-8 regexp");
2057 snprintf(escbuf,
sizeof(escbuf),
"\\x%02X", chbuf[0]&0xff);
2067 if ((0xd800 <= code && code <= 0xdfff) ||
2069 errcpy(err,
"invalid Unicode range");
2083 snprintf(escbuf,
sizeof(escbuf),
"\\x%02X", (
int)uv);
2095 errcpy(err,
"UTF-8 character in non UTF-8 regexp");
2106 const char *
p = *pp;
2107 int has_unicode = 0;
2111 while (p < end &&
ISSPACE(*p)) p++;
2118 errcpy(err,
"invalid Unicode range");
2126 while (p < end &&
ISSPACE(*p)) p++;
2129 if (has_unicode == 0) {
2130 errcpy(err,
"invalid Unicode list");
2143 const char *
p = *pp;
2148 errcpy(err,
"invalid Unicode escape");
2153 errcpy(err,
"invalid Unicode escape");
2173 errcpy(err,
"invalid multibyte character");
2177 if (1 < chlen || (*p & 0x80)) {
2182 else if (*encp != enc) {
2183 errcpy(err,
"non ASCII character in UTF-8 regexp");
2192 errcpy(err,
"too short escape sequence");
2196 case '1':
case '2':
case '3':
2197 case '4':
case '5':
case '6':
case '7':
2222 errcpy(err,
"too short escape sequence");
2230 if (p == end || *p++ !=
'}') {
2231 errcpy(err,
"invalid Unicode list");
2273 int has_property = 0;
2287 if (has_property && !*fixed_enc) {
2343 src_enc != ascii8bit) {
2347 src_enc = ascii8bit;
2359 if (fixed_enc != 0) {
2360 if (regexp_enc != 0 && regexp_enc != fixed_enc) {
2364 regexp_enc = fixed_enc;
2382 const char *sourcefile,
int sourceline)
2399 errcpy(err,
"can't make regexp with dummy encoding");
2404 if (unescaped ==
Qnil)
2410 errcpy(err,
"incompatible character encoding");
2413 if (fixed_enc != a_enc) {
2423 if ((options & ARG_ENCODING_FIXED) || fixed_enc) {
2432 sourcefile, sourceline);
2433 if (!re->ptr)
return -1;
2442 const char *sourcefile,
int sourceline)
2448 if (enc != ascii8bit) {
2450 errcpy(err,
"/.../n has a non escaped non ASCII character in non ASCII-8BIT script");
2457 options, err, sourcefile, sourceline);
2574 hashval =
RREGEXP(re)->ptr->options;
2598 if (re1 == re2)
return Qtrue;
2646 if (match1 == match2)
return Qtrue;
2744 if (pos < 0)
return Qnil;
2853 if (
rb_scan_args(argc, argv,
"11", &str, &initpos) == 2) {
2938 if (argc == 3 && !
NIL_P(argv[2])) {
2940 if (kcode[0] ==
'n' || kcode[0] ==
'N') {
2945 rb_warn(
"encoding option is ignored - %s", kcode);
2973 s +=
mbclen(s, send, enc);
2977 case '[':
case ']':
case '{':
case '}':
2978 case '(':
case ')':
case '|':
case '-':
2979 case '*':
case '.':
case '\\':
2980 case '?':
case '+':
case '^':
case '$':
2982 case '\t':
case '\f':
case '\v':
case '\n':
case '\r':
3009 int n =
mbclen(s, send, enc);
3017 case '[':
case ']':
case '{':
case '}':
3018 case '(':
case ')':
case '|':
case '-':
3019 case '*':
case '.':
case '\\':
3020 case '?':
case '+':
case '^':
case '$':
3128 else if (argc == 1) {
3144 int has_asciionly = 0;
3148 for (i = 0; i <
argc; i++) {
3159 if (!has_ascii_incompat)
3160 has_ascii_incompat =
enc;
3161 else if (has_ascii_incompat != enc)
3166 if (!has_ascii_compat_fixed)
3167 has_ascii_compat_fixed =
enc;
3168 else if (has_ascii_compat_fixed != enc)
3182 if (!has_ascii_incompat)
3183 has_ascii_incompat =
enc;
3184 else if (has_ascii_incompat != enc)
3192 if (!has_ascii_compat_fixed)
3193 has_ascii_compat_fixed =
enc;
3194 else if (has_ascii_compat_fixed != enc)
3200 if (has_ascii_incompat) {
3201 if (has_asciionly) {
3205 if (has_ascii_compat_fixed) {
3217 if (has_ascii_incompat) {
3218 result_enc = has_ascii_incompat;
3220 else if (has_ascii_compat_fixed) {
3221 result_enc = has_ascii_compat_fixed;
3274 err,
NULL, 0) != 0) {
3289 #define ASCGET(s,e,cl) (acompat ? (*(cl)=1,ISASCII((s)[0])?(s)[0]:-1) : rb_enc_ascget((s), (e), (cl), str_enc))
3299 s +=
mbclen(s, e, str_enc);
3305 if (c !=
'\\' || s == e)
continue;
3314 s +=
mbclen(s, e, str_enc);
3323 case '1':
case '2':
case '3':
case '4':
3324 case '5':
case '6':
case '7':
case '8':
case '9':
3334 if (s < e &&
ASCGET(s, e, &clen) ==
'<') {
3335 char *
name, *name_end;
3337 name_end = name = s + clen;
3338 while (name_end < e) {
3339 c =
ASCGET(name_end, e, &clen);
3340 if (c ==
'>')
break;
3341 name_end += c == -1 ?
mbclen(name_end, e, str_enc) : clen;
3345 (
long)(name_end - name));
3350 p = s = name_end + clen;
3376 while (
BEG(no) == -1 && no > 0) no--;
3377 if (no == 0)
continue;
3390 if (no >= regs->
num_regs)
continue;
3391 if (
BEG(no) == -1)
continue;
3396 if (!val)
return str;
3407 rb_warn(
"variable $KCODE is no longer effective");
3414 rb_warn(
"variable $KCODE is no longer effective; ignored");
3420 rb_warn(
"variable $= is no longer effective");
3427 rb_warn(
"variable $= is no longer effective; ignored");
3482 if (argc > 0 &&
rb_scan_args(argc, argv,
"01", &nth) == 1) {
VALUE rb_reg_match_last(VALUE)
static VALUE rb_reg_source(VALUE re)
#define RB_TYPE_P(obj, type)
static VALUE match_hash(VALUE match)
static VALUE rb_reg_hash(VALUE re)
void onig_set_warn_func(OnigWarnFunc f)
VALUE rb_reg_last_match(VALUE)
long rb_reg_adjust_startpos(VALUE, VALUE, long, int)
int onig_new(regex_t **reg, const UChar *pattern, const UChar *pattern_end, OnigOptionType option, OnigEncoding enc, const OnigSyntaxType *syntax, OnigErrorInfo *einfo)
unsigned int OnigOptionType
int onig_foreach_name(regex_t *reg, int(*func)(const UChar *, const UChar *, int, int *, regex_t *, void *), void *arg)
VALUE rb_ary_entry(VALUE ary, long offset)
static VALUE rb_reg_options_m(VALUE re)
static void reg_enc_error(VALUE re, VALUE str)
void rb_bug(const char *fmt,...)
RUBY_EXTERN VALUE rb_cMatch
void rb_enc_copy(VALUE obj1, VALUE obj2)
void rb_match_busy(VALUE)
static VALUE rb_reg_s_last_match(int argc, VALUE *argv)
static unsigned int rb_memsearch_qs_utf8_hash(const unsigned char *x)
size_t strlen(const char *)
#define ONIG_ENCODING_ASCII
VALUE rb_class_new_instance(int, VALUE *, VALUE)
#define scan_oct(s, l, e)
const char * rb_obj_classname(VALUE)
VALUE rb_str_buf_cat_ascii(VALUE, const char *)
static VALUE rb_reg_match_m(int argc, VALUE *argv, VALUE re)
static int unescape_nonascii(const char *p, const char *end, rb_encoding *enc, VALUE buf, rb_encoding **encp, int *has_property, onig_errmsg_buffer err)
static VALUE rb_enc_reg_error_desc(const char *s, long len, rb_encoding *enc, int options, const char *err)
static void kcode_setter(VALUE val, ID id)
void rb_define_singleton_method(VALUE obj, const char *name, VALUE(*func)(ANYARGS), int argc)
Defines a singleton method for obj.
static long rb_memsearch_qs_utf8(const unsigned char *xs, long m, const unsigned char *ys, long n)
VALUE rb_str_buf_append(VALUE, VALUE)
static VALUE match_inspect(VALUE match)
UChar * onigenc_get_right_adjust_char_head(OnigEncoding enc, const UChar *start, const UChar *s, const UChar *end)
int onigenc_set_default_encoding(OnigEncoding enc)
#define ARG_ENCODING_FIXED
static char * option_to_str(char str[4], int options)
#define rb_check_frozen(obj)
static VALUE match_equal(VALUE match1, VALUE match2)
VALUE rb_str_subseq(VALUE, long, long)
void onig_region_copy(OnigRegion *to, OnigRegion *from)
static VALUE match_getter(void)
#define ONIGENC_MBC_MAXLEN(enc)
static int append_utf8(unsigned long uv, VALUE buf, rb_encoding **encp, onig_errmsg_buffer err)
#define REG_ENCODING_NONE
static VALUE kcode_getter(void)
#define ONIGENC_CASE_FOLD_DEFAULT
static VALUE rb_reg_initialize_m(int argc, VALUE *argv, VALUE self)
static VALUE rb_reg_equal(VALUE re1, VALUE re2)
static int unescape_unicode_bmp(const char **pp, const char *end, VALUE buf, rb_encoding **encp, onig_errmsg_buffer err)
void rb_define_alloc_func(VALUE, rb_alloc_func_t)
static VALUE rb_reg_s_alloc(VALUE klass)
static VALUE rb_reg_desc(const char *s, long len, VALUE re)
rb_encoding * rb_default_internal_encoding(void)
static int pair_byte_cmp(const void *pair1, const void *pair2)
VALUE rb_ary_push(VALUE ary, VALUE item)
static VALUE match_string(VALUE match)
VALUE rb_reg_regsub(VALUE, VALUE, struct re_registers *, VALUE)
static void update_char_offset(VALUE match)
static void ignorecase_setter(VALUE val, ID id)
rb_encoding * rb_enc_compatible(VALUE str1, VALUE str2)
VALUE rb_reg_compile(VALUE str, int options, const char *sourcefile, int sourceline)
VALUE rb_enc_str_new(const char *, long, rb_encoding *)
static VALUE match_to_s(VALUE match)
int rb_reg_options(VALUE)
VALUE rb_str_buf_cat2(VALUE, const char *)
static int onig_new_with_source(regex_t **reg, const UChar *pattern, const UChar *pattern_end, OnigOptionType option, OnigEncoding enc, const OnigSyntaxType *syntax, OnigErrorInfo *einfo, const char *sourcefile, int sourceline)
#define MBCLEN_NEEDMORE_P(ret)
void rb_raise(VALUE exc, const char *fmt,...)
static int name_to_backref_number(struct re_registers *regs, VALUE regexp, const char *name, const char *name_end)
VALUE rb_enc_associate(VALUE obj, rb_encoding *enc)
static void rb_reg_expr_str(VALUE str, const char *s, long len, rb_encoding *enc, rb_encoding *resenc)
static long rb_memsearch_ss(const unsigned char *xs, long m, const unsigned char *ys, long n)
static VALUE match_aref(int argc, VALUE *argv, VALUE match)
VALUE rb_reg_nth_match(int, VALUE)
static VALUE rb_reg_casefold_p(VALUE re)
VALUE rb_lastline_get(void)
static int match_backref_number(VALUE match, VALUE backref)
int char_offset_num_allocated
rb_encoding * rb_utf8_encoding(void)
void rb_undef_method(VALUE klass, const char *name)
#define ENC_CODERANGE_BROKEN
static VALUE match_captures(VALUE match)
struct re_pattern_buffer * ptr
static VALUE last_paren_match_getter(void)
VALUE rb_str_append(VALUE, VALUE)
VALUE rb_reg_match_post(VALUE)
static int unescape_escaped_nonascii(const char **pp, const char *end, rb_encoding *enc, VALUE buf, rb_encoding **encp, onig_errmsg_buffer err)
int rb_reg_backref_number(VALUE match, VALUE backref)
VALUE rb_str_to_str(VALUE)
VALUE rb_str_equal(VALUE str1, VALUE str2)
RUBY_EXTERN VALUE rb_cRegexp
#define ENCODING_GET(obj)
static void rb_reg_raise_str(VALUE str, int options, const char *err)
#define ONIG_OPTION_EXTEND
st_index_t rb_hash_start(st_index_t)
#define MEMZERO(p, type, n)
int onig_compile(regex_t *reg, const UChar *pattern, const UChar *pattern_end, OnigErrorInfo *einfo, const char *sourcefile, int sourceline)
void rb_exc_raise(VALUE mesg)
static int rb_reg_initialize_str(VALUE obj, VALUE str, int options, onig_errmsg_buffer err, const char *sourcefile, int sourceline)
VALUE rb_reg_new_str(VALUE, int)
static VALUE rb_reg_s_union(VALUE self, VALUE args0)
static VALUE match_alloc(VALUE klass)
rb_encoding * rb_default_external_encoding(void)
memset(y->frac+ix+1, 0,(y->Prec-(ix+1))*sizeof(BDIGIT))
static st_index_t reg_hash(VALUE re)
#define scan_hex(s, l, e)
void onigenc_set_default_caseconv_table(const UChar *table ARG_UNUSED)
int rb_str_buf_cat_escaped_char(VALUE result, unsigned int c, int unicode_p)
static VALUE ignorecase_getter(void)
static int read_escaped_byte(const char **pp, const char *end, onig_errmsg_buffer err)
int rb_char_to_option_kcode(int c, int *option, int *kcode)
static VALUE rb_reg_preprocess_dregexp(VALUE ary, int options)
int rb_block_given_p(void)
long rb_str_offset(VALUE, long)
static int reg_named_captures_iter(const OnigUChar *name, const OnigUChar *name_end, int back_num, int *back_refs, OnigRegex regex, void *arg)
static int check_unicode_range(unsigned long code, onig_errmsg_buffer err)
#define StringValuePtr(v)
static void match_check(VALUE match)
VALUE rb_reg_new_ary(VALUE ary, int opt)
VALUE rb_reg_new(const char *, long, int)
static VALUE rb_reg_error_desc(VALUE str, int options, const char *err)
#define mbclen(p, e, enc)
#define StringValueCStr(v)
int rb_ascii8bit_encindex(void)
void rb_define_const(VALUE, const char *, VALUE)
static VALUE rb_reg_fixed_encoding_p(VALUE re)
VALUE rb_define_class(const char *name, VALUE super)
Defines a top-level class.
static int reg_names_iter(const OnigUChar *name, const OnigUChar *name_end, int back_num, int *back_refs, OnigRegex regex, void *arg)
int onig_name_to_backref_number(regex_t *reg, const UChar *name, const UChar *name_end, OnigRegion *region)
void rb_ary_store(VALUE ary, long idx, VALUE val)
void rb_backref_set(VALUE)
static int rb_enc_dummy_p(rb_encoding *enc)
static Regexp * make_regexp(const char *s, long len, rb_encoding *enc, int flags, onig_errmsg_buffer err, const char *sourcefile, int sourceline)
static VALUE match_values_at(int argc, VALUE *argv, VALUE match)
#define MBCLEN_CHARFOUND_P(ret)
void onig_region_free(OnigRegion *r, int free_self)
int onig_reg_init(regex_t *reg, OnigOptionType option, OnigCaseFoldType case_fold_flag, OnigEncoding enc, const OnigSyntaxType *syntax)
#define ONIGENC_LEFT_ADJUST_CHAR_HEAD(enc, start, s, end)
#define rb_enc_isprint(c, enc)
void onig_set_verb_warn_func(OnigWarnFunc f)
#define OBJ_INIT_COPY(obj, orig)
static VALUE match_regexp(VALUE match)
#define range(low, item, hi)
unsigned char buf[MIME_BUF_SIZE]
static void match_setter(VALUE val)
VALUE rb_check_regexp_type(VALUE re)
#define ALLOCA_N(type, n)
static VALUE rb_reg_inspect(VALUE re)
#define ENC_CODERANGE_UNKNOWN
VALUE rb_reg_init_str(VALUE re, VALUE s, int options)
#define rb_enc_mbc_to_codepoint(p, e, enc)
VALUE rb_reg_match(VALUE, VALUE)
VALUE rb_str_buf_cat(VALUE, const char *, long)
static VALUE reg_operand(VALUE s, int check)
int rb_enc_ascget(const char *p, const char *e, int *len, rb_encoding *enc)
VALUE rb_hash_aset(VALUE, VALUE, VALUE)
VALUE rb_str_resize(VALUE, long)
#define RREGEXP_SRC_PTR(r)
static void rb_reg_raise(const char *s, long len, const char *err, VALUE re)
static void rb_enc_reg_raise(const char *s, long len, rb_encoding *enc, int options, const char *err)
static VALUE rb_reg_preprocess(const char *p, const char *end, rb_encoding *enc, rb_encoding **fixed_enc, onig_errmsg_buffer err)
#define ONIG_MAX_ERROR_MESSAGE_LEN
VALUE rb_reg_match2(VALUE)
VALUE rb_sprintf(const char *format,...)
#define rb_enc_mbcput(c, buf, enc)
#define ONIG_OPTION_DEFAULT
long rb_memsearch(const void *, long, const void *, long, rb_encoding *)
#define MBCLEN_CHARFOUND_LEN(ret)
int rb_enc_precise_mbclen(const char *p, const char *e, rb_encoding *enc)
int rb_enc_unicode_p(rb_encoding *enc)
long rb_str_coderange_scan_restartable(const char *, const char *, rb_encoding *, int *)
static VALUE match_to_a(VALUE match)
int rb_scan_args(int argc, const VALUE *argv, const char *fmt,...)
int rb_uv_to_utf8(char[6], unsigned long)
long rb_reg_search(VALUE, VALUE, long, int)
VALUE rb_assoc_new(VALUE car, VALUE cdr)
VALUE rb_get_values_at(VALUE obj, long olen, int argc, VALUE *argv, VALUE(*func)(VALUE, long))
rb_encoding * rb_usascii_encoding(void)
static void re_warn(const char *s)
VALUE rb_reg_eqq(VALUE re, VALUE str)
VALUE rb_str_inspect(VALUE)
static VALUE postmatch_getter(void)
VALUE rb_str_buf_new(long)
static VALUE rb_reg_s_quote(VALUE c, VALUE str)
int rb_utf8_encindex(void)
VALUE rb_obj_encoding(VALUE obj)
int memcmp(const void *s1, const void *s2, size_t len)
static VALUE match_end(VALUE match, VALUE n)
VALUE rb_reg_check_preprocess(VALUE)
static VALUE rb_reg_s_union_m(VALUE self, VALUE args)
static VALUE last_match_getter(void)
static VALUE match_names(VALUE match)
static long reg_match_pos(VALUE re, VALUE *strp, long pos)
static void name_to_backref_error(VALUE name)
#define ONIG_OPTION_IGNORECASE
#define MEMCPY(p1, p2, type, n)
static VALUE match_begin(VALUE match, VALUE n)
#define ENC_CODERANGE_VALID
#define rb_enc_str_asciicompat_p(str)
VALUE rb_reg_nth_defined(int, VALUE)
#define ONIG_OPTION_MULTILINE
static VALUE rb_reg_to_s(VALUE re)
#define NEWOBJ_OF(obj, type, klass, flags)
VALUE rb_str_length(VALUE)
#define ENC_CODERANGE_7BIT
rb_encoding * rb_enc_get(VALUE obj)
int onig_noname_group_capture_is_active(regex_t *reg)
static VALUE prematch_getter(void)
char onig_errmsg_buffer[ONIG_MAX_ERROR_MESSAGE_LEN]
OnigPosition onig_search(regex_t *reg, const UChar *str, const UChar *end, const UChar *start, const UChar *range, OnigRegion *region, OnigOptionType option)
VALUE rb_exc_new3(VALUE etype, VALUE str)
long rb_str_sublen(VALUE, long)
int rb_enc_str_asciionly_p(VALUE)
static VALUE match_init_copy(VALUE obj, VALUE orig)
void rb_set_errinfo(VALUE err)
static int unescape_unicode_list(const char **pp, const char *end, VALUE buf, rb_encoding **encp, onig_errmsg_buffer err)
#define MBCLEN_INVALID_P(ret)
#define rb_enc_isspace(c, enc)
st_index_t rb_memhash(const void *ptr, long len)
VALUE rb_check_array_type(VALUE ary)
VALUE rb_reg_quote(VALUE)
st_index_t rb_str_hash(VALUE)
VALUE rb_str_catf(VALUE str, const char *format,...)
VALUE rb_reg_match_pre(VALUE)
RUBY_EXTERN VALUE rb_cObject
static int char_to_option(int c)
static VALUE match_size(VALUE match)
regex_t * rb_reg_prepare_re(VALUE re, VALUE str)
static VALUE match_entry(VALUE match, long n)
static Bigint * diff(Bigint *a, Bigint *b)
#define ARG_REG_OPTION_MASK
static rb_encoding * rb_reg_prepare_enc(VALUE re, VALUE str, int warn)
VALUE rb_backref_get(void)
void rb_define_virtual_variable(const char *, VALUE(*)(ANYARGS), void(*)(ANYARGS))
VALUE rb_ary_new2(long capa)
VALUE rb_str_new(const char *, long)
static int match_inspect_name_iter(const OnigUChar *name, const OnigUChar *name_end, int back_num, int *back_refs, OnigRegex regex, void *arg0)
struct rmatch_offset * char_offset
unsigned long ruby_scan_hex(const char *, size_t, size_t *)
#define rb_enc_asciicompat(enc)
static VALUE rb_reg_named_captures(VALUE re)
const char * rb_id2name(ID id)
#define rb_check_arity(argc, min, max)
void rb_global_variable(VALUE *)
static VALUE rb_reg_s_try_convert(VALUE dummy, VALUE re)
rb_encoding * rb_ascii8bit_encoding(void)
int rb_enc_find_index(const char *name)
static VALUE rb_reg_names(VALUE re)
static void rb_reg_check(VALUE re)
#define RREGEXP_SRC_LEN(r)
#define ARG_ENCODING_NONE
static VALUE rb_reg_init_copy(VALUE copy, VALUE re)
static long rb_memsearch_qs(const unsigned char *xs, long m, const unsigned char *ys, long n)
int rb_memcicmp(const void *, const void *, long)
VALUE rb_enc_reg_new(const char *, long, rb_encoding *, int)
VALUE rb_check_string_type(VALUE)
#define REALLOC_N(var, type, n)
void onig_free(regex_t *reg)
VALUE rb_reg_regcomp(VALUE)
int rb_enc_str_coderange(VALUE)
long rb_enc_strlen(const char *, const char *, rb_encoding *)
static int match(VALUE str, VALUE pat, VALUE hash, int(*cb)(VALUE, VALUE))
void rb_define_method(VALUE klass, const char *name, VALUE(*func)(ANYARGS), int argc)
#define rb_enc_mbmaxlen(enc)
void rb_warn(const char *fmt,...)
static VALUE match_array(VALUE match, int start)
VALUE rb_check_convert_type(VALUE, int, const char *, const char *)
static VALUE match_offset(VALUE match, VALUE n)
unsigned long ruby_scan_oct(const char *, size_t, size_t *)
ONIG_EXTERN const OnigSyntaxType * OnigDefaultSyntax
VALUE rb_ary_aref(int argc, VALUE *argv, VALUE ary)
#define rb_hash_uint(h, i)
VALUE rb_enc_str_buf_cat(VALUE str, const char *ptr, long len, rb_encoding *enc)
RUBY_EXTERN VALUE rb_eRegexpError
static int rb_reg_initialize(VALUE obj, const char *s, long len, rb_encoding *enc, int options, onig_errmsg_buffer err, const char *sourcefile, int sourceline)
int rb_memcmp(const void *p1, const void *p2, long len)