Ruby 2.0.0p247(2013-06-27revision41674)

- Main Page
- Modules
- Data Structures
- Files

- File List
- Globals

Data Structures | Macros | Typedefs | Functions | Variables
re.c File Reference
`#include "ruby/ruby.h"`
`#include "ruby/re.h"`
`#include "ruby/encoding.h"`
`#include "ruby/util.h"`
`#include "internal.h"`
`#include "regint.h"`
`#include <ctype.h>`
Include dependency graph for re.c:

Go to the source code of this file.

## Data Structures
struct | pair_t
struct | backref_name_tag

## Macros
#define | errcpy(err, msg) strlcpy((err), (msg), ONIG_MAX_ERROR_MESSAGE_LEN)
#define | BEG(no) (regs->beg[(no)])
#define | END(no) (regs->end[(no)])
#define | REG_LITERAL FL_USER5
#define | REG_ENCODING_NONE FL_USER6
#define | KCODE_FIXED FL_USER4
#define | ARG_REG_OPTION_MASK (ONIG_OPTION_IGNORECASE|ONIG_OPTION_MULTILINE|ONIG_OPTION_EXTEND)
#define | ARG_ENCODING_FIXED 16
#define | ARG_ENCODING_NONE 32
#define | MATCH_BUSY FL_USER2
#define | ASCGET(s, e, cl) (acompat ? (*(cl)=1,ISASCII((s)[0])?(s)[0]:-1) : rb_enc_ascget((s), (e), (cl), str_enc))

## Typedefs
typedef char | onig_errmsg_buffer [ONIG_MAX_ERROR_MESSAGE_LEN]

## Functions
int | rb_memcicmp (const void *x, const void *y, long len)
int | rb_memcmp (const void *p1, const void *p2, long len)
static long | rb_memsearch_ss (const unsigned char *xs, long m, const unsigned char *ys, long n)
static long | rb_memsearch_qs (const unsigned char *xs, long m, const unsigned char *ys, long n)
static unsigned int | rb_memsearch_qs_utf8_hash (const unsigned char *x)
static long | rb_memsearch_qs_utf8 (const unsigned char *xs, long m, const unsigned char *ys, long n)
long | rb_memsearch (const void *x0, long m, const void *y0, long n, rb_encoding *enc)
static int | char_to_option (int c)
static char * | option_to_str (char str[4], int options)
int | rb_char_to_option_kcode (int c, int *option, int *kcode)
static void | rb_reg_check (VALUE re)
static void | rb_reg_expr_str (VALUE str, const char *s, long len, rb_encoding *enc, rb_encoding *resenc)
static VALUE | rb_reg_desc (const char *s, long len, VALUE re)
static VALUE | rb_reg_source (VALUE re)
static VALUE | rb_reg_inspect (VALUE re)
static VALUE | rb_reg_to_s (VALUE re)
static void | rb_reg_raise (const char *s, long len, const char *err, VALUE re)
static VALUE | rb_enc_reg_error_desc (const char *s, long len, rb_encoding *enc, int options, const char *err)
static void | rb_enc_reg_raise (const char *s, long len, rb_encoding *enc, int options, const char *err)
static VALUE | rb_reg_error_desc (VALUE str, int options, const char *err)
static void | rb_reg_raise_str (VALUE str, int options, const char *err)
static VALUE | rb_reg_casefold_p (VALUE re)
static VALUE | rb_reg_options_m (VALUE re)
static int | reg_names_iter (const OnigUChar *name, const OnigUChar *name_end, int back_num, int *back_refs, OnigRegex regex, void *arg)
static VALUE | rb_reg_names (VALUE re)
static int | reg_named_captures_iter (const OnigUChar *name, const OnigUChar *name_end, int back_num, int *back_refs, OnigRegex regex, void *arg)
static VALUE | rb_reg_named_captures (VALUE re)
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)
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_alloc (VALUE klass)
static int | pair_byte_cmp (const void *pair1, const void *pair2)
static void | update_char_offset (VALUE match)
static void | match_check (VALUE match)
static VALUE | match_init_copy (VALUE obj, VALUE orig)
static VALUE | match_regexp (VALUE match)
static VALUE | match_names (VALUE match)
static VALUE | match_size (VALUE match)
static int | match_backref_number (VALUE match, VALUE backref)
int | rb_reg_backref_number (VALUE match, VALUE backref)
static VALUE | match_offset (VALUE match, VALUE n)
static VALUE | match_begin (VALUE match, VALUE n)
static VALUE | match_end (VALUE match, VALUE n)
void | rb_match_busy (VALUE match)
static VALUE | rb_reg_fixed_encoding_p (VALUE re)
static VALUE | rb_reg_preprocess (const char *p, const char *end, rb_encoding *enc, rb_encoding **fixed_enc, onig_errmsg_buffer err)
static void | reg_enc_error (VALUE re, VALUE str)
static rb_encoding * | rb_reg_prepare_enc (VALUE re, VALUE str, int warn)
regex_t * | rb_reg_prepare_re (VALUE re, VALUE str)
long | rb_reg_adjust_startpos (VALUE re, VALUE str, long pos, int reverse)
long | rb_reg_search (VALUE re, VALUE str, long pos, int reverse)
VALUE | rb_reg_nth_defined (int nth, VALUE match)
VALUE | rb_reg_nth_match (int nth, VALUE match)
VALUE | rb_reg_last_match (VALUE match)
VALUE | rb_reg_match_pre (VALUE match)
VALUE | rb_reg_match_post (VALUE match)
VALUE | rb_reg_match_last (VALUE match)
static VALUE | last_match_getter (void)
static VALUE | prematch_getter (void)
static VALUE | postmatch_getter (void)
static VALUE | last_paren_match_getter (void)
static VALUE | match_array (VALUE match, int start)
static VALUE | match_to_a (VALUE match)
static VALUE | match_captures (VALUE match)
static int | name_to_backref_number (struct re_registers *regs, VALUE regexp, const char *name, const char *name_end)
static VALUE | match_aref (int argc, VALUE *argv, VALUE match)
static VALUE | match_entry (VALUE match, long n)
static VALUE | match_values_at (int argc, VALUE *argv, VALUE match)
static VALUE | match_to_s (VALUE match)
static VALUE | match_string (VALUE match)
static int | match_inspect_name_iter (const OnigUChar *name, const OnigUChar *name_end, int back_num, int *back_refs, OnigRegex regex, void *arg0)
static VALUE | match_inspect (VALUE match)
static int | read_escaped_byte (const char **pp, const char *end, onig_errmsg_buffer err)
static int | unescape_escaped_nonascii (const char **pp, const char *end, rb_encoding *enc, VALUE buf, rb_encoding **encp, onig_errmsg_buffer err)
static int | check_unicode_range (unsigned long code, onig_errmsg_buffer err)
static int | append_utf8 (unsigned long uv, VALUE buf, rb_encoding **encp, onig_errmsg_buffer err)
static int | unescape_unicode_list (const char **pp, const char *end, VALUE buf, rb_encoding **encp, onig_errmsg_buffer err)
static int | unescape_unicode_bmp (const char **pp, const char *end, VALUE buf, rb_encoding **encp, onig_errmsg_buffer err)
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)
VALUE | rb_reg_check_preprocess (VALUE str)
static VALUE | rb_reg_preprocess_dregexp (VALUE ary, int options)
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)
static int | rb_reg_initialize_str (VALUE obj, VALUE str, int options, onig_errmsg_buffer err, const char *sourcefile, int sourceline)
static VALUE | rb_reg_s_alloc (VALUE klass)
VALUE | rb_reg_alloc (void)
VALUE | rb_reg_new_str (VALUE s, int options)
VALUE | rb_reg_init_str (VALUE re, VALUE s, int options)
VALUE | rb_reg_new_ary (VALUE ary, int opt)
VALUE | rb_enc_reg_new (const char *s, long len, rb_encoding *enc, int options)
VALUE | rb_reg_new (const char *s, long len, int options)
VALUE | rb_reg_compile (VALUE str, int options, const char *sourcefile, int sourceline)
VALUE | rb_reg_regcomp (VALUE str)
static st_index_t | reg_hash (VALUE re)
static VALUE | rb_reg_hash (VALUE re)
static VALUE | rb_reg_equal (VALUE re1, VALUE re2)
static VALUE | match_hash (VALUE match)
static VALUE | match_equal (VALUE match1, VALUE match2)
static VALUE | reg_operand (VALUE s, int check)
static long | reg_match_pos (VALUE re, VALUE *strp, long pos)
VALUE | rb_reg_match (VALUE re, VALUE str)
VALUE | rb_reg_eqq (VALUE re, VALUE str)
VALUE | rb_reg_match2 (VALUE re)
static VALUE | rb_reg_match_m (int argc, VALUE *argv, VALUE re)
static VALUE | rb_reg_initialize_m (int argc, VALUE *argv, VALUE self)
VALUE | rb_reg_quote (VALUE str)
static VALUE | rb_reg_s_quote (VALUE c, VALUE str)
int | rb_reg_options (VALUE re)
VALUE | rb_check_regexp_type (VALUE re)
static VALUE | rb_reg_s_try_convert (VALUE dummy, VALUE re)
static VALUE | rb_reg_s_union (VALUE self, VALUE args0)
static VALUE | rb_reg_s_union_m (VALUE self, VALUE args)
static VALUE | rb_reg_init_copy (VALUE copy, VALUE re)
VALUE | rb_reg_regsub (VALUE str, VALUE src, struct re_registers *regs, VALUE regexp)
static VALUE | kcode_getter (void)
static void | kcode_setter (VALUE val, ID id)
static VALUE | ignorecase_getter (void)
static void | ignorecase_setter (VALUE val, ID id)
static VALUE | match_getter (void)
static void | match_setter (VALUE val)
static VALUE | rb_reg_s_last_match (int argc, VALUE *argv)
static void | re_warn (const char *s)
void | Init_Regexp (void)

## Variables
VALUE | rb_eRegexpError
VALUE | rb_cMatch
VALUE | rb_cRegexp
static VALUE | reg_cache

## Macro Definition Documentation

#define ARG_ENCODING_FIXED 16

Definition at line 264 of file re.c.

Referenced by Init_Regexp(), rb_char_to_option_kcode(), rb_reg_initialize(), and rb_reg_options().

#define ARG_ENCODING_NONE 32

Definition at line 265 of file re.c.

Referenced by Init_Regexp(), rb_char_to_option_kcode(), rb_reg_initialize(), rb_reg_initialize_m(), rb_reg_initialize_str(), rb_reg_options(), and rb_reg_preprocess_dregexp().

#define ARG_REG_OPTION_MASK (ONIG_OPTION_IGNORECASE|ONIG_OPTION_MULTILINE|ONIG_OPTION_EXTEND)

Definition at line 262 of file re.c.

Referenced by rb_reg_initialize(), and rb_reg_options().

#define ASCGET | ( |  | s,
|  |  | e,
|  |  | cl
| ) |  | (acompat ? (*(cl)=1,ISASCII((s)[0])?(s)[0]:-1) : rb_enc_ascget((s), (e), (cl), str_enc))

Referenced by rb_reg_regsub().

#define BEG | ( |  | no) |  | (regs->beg[(no)])

Definition at line 25 of file re.c.

Referenced by match_begin(), match_end(), match_offset(), rb_reg_match_last(), rb_reg_match_post(), rb_reg_match_pre(), rb_reg_nth_defined(), rb_reg_nth_match(), rb_reg_regsub(), and update_char_offset().

#define END | ( |  | no) |  | (regs->end[(no)])

Definition at line 26 of file re.c.

Referenced by get_event_id(), rb_reg_match_post(), rb_reg_nth_match(), rb_reg_regsub(), symbol2event_flag(), update_char_offset(), and yyparse().

#define errcpy | ( |  | err,
|  |  | msg
| ) |  | strlcpy((err), (msg), ONIG_MAX_ERROR_MESSAGE_LEN)

Definition at line 23 of file re.c.

Referenced by append_utf8(), check_unicode_range(), rb_reg_initialize(), rb_reg_initialize_str(), read_escaped_byte(), unescape_escaped_nonascii(), unescape_nonascii(), unescape_unicode_bmp(), and unescape_unicode_list().

#define KCODE_FIXED FL_USER4

Definition at line 260 of file re.c.

Referenced by rb_reg_equal(), rb_reg_fixed_encoding_p(), rb_reg_initialize(), and rb_reg_options().

#define MATCH_BUSY FL_USER2

Definition at line 1186 of file re.c.

Referenced by rb_match_busy(), and rb_reg_search().

#define REG_ENCODING_NONE FL_USER6

Definition at line 258 of file re.c.

Referenced by rb_reg_desc(), rb_reg_initialize(), rb_reg_options(), and rb_reg_prepare_enc().

#define REG_LITERAL FL_USER5

Definition at line 257 of file re.c.

Referenced by rb_reg_compile(), and rb_reg_initialize().

## Typedef Documentation

typedef char onig_errmsg_buffer[ONIG_MAX_ERROR_MESSAGE_LEN]

Definition at line 22 of file re.c.

## Function Documentation

static int append_utf8 | ( | unsigned long | uv,
|  | VALUE | buf,
|  | rb_encoding ** | encp,
|  | onig_errmsg_buffer | err
| ) |  |
| static

Definition at line 2081 of file re.c.

References check_unicode_range(), errcpy, backref_name_tag::len, rb_str_buf_cat(), rb_utf8_encoding(), rb_uv_to_utf8(), and snprintf.

Referenced by unescape_unicode_bmp(), and unescape_unicode_list().

static int char_to_option | ( | int | c) |  |
| static

Definition at line 268 of file re.c.

References ONIG_OPTION_EXTEND, ONIG_OPTION_IGNORECASE, ONIG_OPTION_MULTILINE, and val.

Referenced by rb_char_to_option_kcode(), and rb_reg_to_s().

static int check_unicode_range | ( | unsigned long | code,
|  | onig_errmsg_buffer | err
| ) |  |
| static

Definition at line 2070 of file re.c.

References errcpy.

Referenced by append_utf8().

static VALUE ignorecase_getter | ( | void | ) |  |
| static

Definition at line 3418 of file re.c.

References Qfalse, and rb_warn().

Referenced by Init_Regexp().

static void ignorecase_setter | ( | VALUE | val,
|  | ID | id
| ) |  |
| static

Definition at line 3425 of file re.c.

References rb_warn().

Referenced by Init_Regexp().

void Init_Regexp | ( | void | ) |  |

Definition at line 3522 of file re.c.

References ARG_ENCODING_FIXED, ARG_ENCODING_NONE, CLASS_OF, ignorecase_getter(), ignorecase_setter(), INT2FIX, kcode_getter(), kcode_setter(), last_match_getter(), last_paren_match_getter(), match_alloc(), match_aref(), match_begin(), match_captures(), match_end(), match_equal(), match_getter(), match_hash(), match_init_copy(), match_inspect(), match_names(), match_offset(), match_regexp(), match_setter(), match_size(), match_string(), match_to_a(), match_to_s(), match_values_at(), ONIG_ENCODING_ASCII, ONIG_OPTION_EXTEND, ONIG_OPTION_IGNORECASE, ONIG_OPTION_MULTILINE, onig_set_verb_warn_func(), onig_set_warn_func(), onigenc_set_default_caseconv_table(), onigenc_set_default_encoding(), postmatch_getter(), prematch_getter(), rb_class_new_instance(), rb_cObject, rb_define_alloc_func(), rb_define_class(), rb_define_const(), rb_define_method(), rb_define_singleton_method(), rb_define_virtual_variable(), rb_eRegexpError, rb_eStandardError, rb_global_variable(), rb_obj_encoding(), rb_reg_casefold_p(), rb_reg_eqq(), rb_reg_equal(), rb_reg_fixed_encoding_p(), rb_reg_hash(), rb_reg_init_copy(), rb_reg_initialize_m(), rb_reg_inspect(), rb_reg_match(), rb_reg_match2(), rb_reg_match_m(), rb_reg_match_post(), rb_reg_match_pre(), rb_reg_named_captures(), rb_reg_names(), rb_reg_options_m(), rb_reg_s_alloc(), rb_reg_s_last_match(), rb_reg_s_quote(), rb_reg_s_try_convert(), rb_reg_s_union_m(), rb_reg_source(), rb_reg_to_s(), rb_undef_method(), re_warn(), and UChar.

static VALUE kcode_getter | ( | void | ) |  |
| static

Definition at line 3405 of file re.c.

References Qnil, and rb_warn().

Referenced by Init_Regexp().

static void kcode_setter | ( | VALUE | val,
|  | ID | id
| ) |  |
| static

Definition at line 3412 of file re.c.

References rb_warn().

Referenced by Init_Regexp().

static VALUE last_match_getter | ( | void | ) |  |
| static

Definition at line 1563 of file re.c.

References rb_backref_get(), and rb_reg_last_match().

Referenced by Init_Regexp().

static VALUE last_paren_match_getter | ( | void | ) |  |
| static

Definition at line 1581 of file re.c.

References rb_backref_get(), and rb_reg_match_last().

Referenced by Init_Regexp().

static Regexp* make_regexp | ( | const char * | s,
|  | long | len,
|  | rb_encoding * | enc,
|  | int | flags,
|  | onig_errmsg_buffer | err,
|  | const char * | sourcefile,
|  | int | sourceline
| ) |  |
| static

Definition at line 804 of file re.c.

References onig_error_code_to_str(), onig_new_with_source(), OnigDefaultSyntax, and UChar.

Referenced by rb_reg_initialize().

static VALUE match_alloc | ( | VALUE | klass) |  |
| static

Definition at line 843 of file re.c.

References ALLOC, match(), MEMZERO, NEWOBJ_OF, and T_MATCH.

Referenced by Init_Regexp(), and rb_reg_search().

static VALUE match_aref | ( | int | argc,
|  | VALUE * | argv,
|  | VALUE | match
| ) |  |
| static

Definition at line 1712 of file re.c.

References FIX2INT, FIXNUM_P, match_check(), match_to_a(), name_to_backref_number(), NIL_P, p, rb_ary_aref(), rb_id2name(), rb_reg_nth_match(), rb_scan_args(), RMATCH, RMATCH_REGS, StringValuePtr, strlen(), SYM2ID, T_STRING, T_SYMBOL, and TYPE.

Referenced by Init_Regexp().

static VALUE match_array | ( | VALUE | match,
|  | int | start
| ) |  |
| static

Definition at line 1587 of file re.c.

References re_registers::beg, re_registers::end, i, match_check(), re_registers::num_regs, OBJ_TAINT, OBJ_TAINTED, Qnil, rb_ary_new2(), rb_ary_push(), rb_str_subseq(), RMATCH, and RMATCH_REGS.

Referenced by match_captures(), and match_to_a().

static int match_backref_number | ( | VALUE | match,
|  | VALUE | backref
| ) |  |
| static

Definition at line 1040 of file re.c.

References match_check(), name, NUM2INT, onig_name_to_backref_number(), rb_eIndexError, rb_id2name(), rb_raise(), RMATCH, RMATCH_REGS, RREGEXP, StringValueCStr, strlen(), SYM2ID, T_STRING, T_SYMBOL, and TYPE.

Referenced by match_begin(), match_end(), match_offset(), rb_reg_backref_number(), and rb_reg_s_last_match().

static VALUE match_begin | ( | VALUE | match,
|  | VALUE | n
| ) |  |
| static

Definition at line 1135 of file re.c.

References BEG, rmatch_offset::beg, rmatch::char_offset, i, INT2FIX, match_backref_number(), match_check(), re_registers::num_regs, Qnil, rb_eIndexError, rb_raise(), RMATCH, RMATCH_REGS, and update_char_offset().

Referenced by Init_Regexp().

static VALUE match_captures | ( | VALUE | match) |  |
| static

Definition at line 1660 of file re.c.

References match_array().

Referenced by Init_Regexp().

static void match_check | ( | VALUE | match) |  |
| static

Definition at line 944 of file re.c.

References rb_eTypeError, rb_raise(), and RMATCH.

Referenced by match_aref(), match_array(), match_backref_number(), match_begin(), match_end(), match_names(), match_offset(), match_regexp(), match_size(), match_string(), match_to_s(), match_values_at(), rb_reg_match_last(), rb_reg_match_post(), rb_reg_match_pre(), rb_reg_nth_defined(), and rb_reg_nth_match().

static VALUE match_end | ( | VALUE | match,
|  | VALUE | n
| ) |  |
| static

Definition at line 1170 of file re.c.

References BEG, rmatch::char_offset, rmatch_offset::end, i, INT2FIX, match_backref_number(), match_check(), re_registers::num_regs, Qnil, rb_eIndexError, rb_raise(), RMATCH, RMATCH_REGS, and update_char_offset().

Referenced by Init_Regexp().

static VALUE match_entry | ( | VALUE | match,
|  | long | n
| ) |  |
| static

Definition at line 1753 of file re.c.

References rb_reg_nth_match().

Referenced by match_values_at().

static VALUE match_equal | ( | VALUE | match1,
|  | VALUE | match2
| ) |  |
| static

Definition at line 2648 of file re.c.

References re_registers::beg, re_registers::end, memcmp(), re_registers::num_regs, Qfalse, Qtrue, rb_reg_equal(), rb_str_equal(), RB_TYPE_P, RMATCH, RMATCH_REGS, and T_MATCH.

Referenced by Init_Regexp().

static VALUE match_getter | ( | void | ) |  |
| static

Definition at line 3431 of file re.c.

References match(), NIL_P, Qnil, rb_backref_get(), and rb_match_busy().

Referenced by Init_Regexp(), and rb_reg_s_last_match().

static VALUE match_hash | ( | VALUE | match) |  |
| static

Definition at line 2625 of file re.c.

References re_registers::beg, re_registers::end, LONG2FIX, re_registers::num_regs, rb_hash_end, rb_hash_start(), rb_hash_uint, rb_memhash(), rb_str_hash(), reg_hash(), RMATCH, and RMATCH_REGS.

Referenced by Init_Regexp().

static VALUE match_init_copy | ( | VALUE | obj,
|  | VALUE | orig
| ) |  |
| static

Definition at line 953 of file re.c.

References rmatch::char_offset, rmatch::char_offset_num_allocated, rmatch::char_offset_updated, MEMCPY, re_registers::num_regs, OBJ_INIT_COPY, onig_region_copy(), REALLOC_N, rmatch::regs, RMATCH, and RMATCH_REGS.

Referenced by Init_Regexp().

static VALUE match_inspect | ( | VALUE | match) |  |
| static

Definition at line 1864 of file re.c.

References ALLOCA_N, i, backref_name_tag::len, match_inspect_name_iter(), MEMZERO, name, names, re_registers::num_regs, onig_foreach_name(), Qnil, rb_obj_classname(), rb_reg_nth_match(), rb_sprintf(), rb_str_buf_append(), rb_str_buf_cat(), rb_str_buf_cat2(), rb_str_buf_new2, rb_str_catf(), rb_str_inspect(), RMATCH, RMATCH_REGS, RREGEXP, and v.

Referenced by Init_Regexp().

static int match_inspect_name_iter | ( | const OnigUChar * | name,
|  | const OnigUChar * | name_end,
|  | int | back_num,
|  | int * | back_refs,
|  | OnigRegex | regex,
|  | void * | arg0
| ) |  |
| static

Definition at line 1830 of file re.c.

References arg, i, backref_name_tag::len, name, and backref_name_tag::name.

Referenced by match_inspect().

static VALUE match_names | ( | VALUE | match) |  |
| static

Definition at line 1014 of file re.c.

References match_check(), rb_reg_names(), and RMATCH.

Referenced by Init_Regexp().

static VALUE match_offset | ( | VALUE | match,
|  | VALUE | n
| ) |  |
| static

Definition at line 1099 of file re.c.

References BEG, rmatch_offset::beg, rmatch::char_offset, rmatch_offset::end, i, INT2FIX, match_backref_number(), match_check(), re_registers::num_regs, Qnil, rb_assoc_new(), rb_eIndexError, rb_raise(), RMATCH, RMATCH_REGS, and update_char_offset().

Referenced by Init_Regexp().

static VALUE match_regexp | ( | VALUE | match) |  |
| static

Definition at line 993 of file re.c.

References match_check(), and RMATCH.

Referenced by Init_Regexp().

static void match_setter | ( | VALUE | val) |  |
| static

Definition at line 3441 of file re.c.

References Check_Type, NIL_P, rb_backref_set(), and T_MATCH.

Referenced by Init_Regexp().

static VALUE match_size | ( | VALUE | match) |  |
| static

Definition at line 1033 of file re.c.

References INT2FIX, match_check(), and RMATCH_REGS.

Referenced by Init_Regexp().

static VALUE match_string | ( | VALUE | match) |  |
| static

Definition at line 1818 of file re.c.

References match_check(), and RMATCH.

Referenced by cParser_initialize(), Init_Regexp(), and JSON_parse_string().

static VALUE match_to_a | ( | VALUE | match) |  |
| static

Definition at line 1641 of file re.c.

References match_array().

Referenced by Init_Regexp(), and match_aref().

static VALUE match_to_s | ( | VALUE | match) |  |
| static

Definition at line 1795 of file re.c.

References match_check(), NIL_P, OBJ_TAINT, OBJ_TAINTED, rb_reg_last_match(), rb_str_new(), and RMATCH.

Referenced by Init_Regexp().

static VALUE match_values_at | ( | int | argc,
|  | VALUE * | argv,
|  | VALUE | match
| ) |  |
| static

Definition at line 1774 of file re.c.

References match_check(), match_entry(), re_registers::num_regs, rb_get_values_at(), and RMATCH_REGS.

Referenced by Init_Regexp().

static int name_to_backref_number | ( | struct re_registers * | regs,
|  | VALUE | regexp,
|  | const char * | name,
|  | const char * | name_end
| ) |  |
| static

Definition at line 1666 of file re.c.

References onig_name_to_backref_number(), rb_eIndexError, rb_raise(), rb_str_new(), RREGEXP, StringValuePtr, and UNREACHABLE.

Referenced by match_aref(), and rb_reg_regsub().

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
| ) |  |
| static

Definition at line 782 of file re.c.

References err, IS_NULL, malloc, NULL, onig_compile(), onig_free(), onig_reg_init(), ONIGENC_CASE_FOLD_DEFAULT, and ONIGERR_MEMORY.

Referenced by make_regexp().

static char* option_to_str | ( | char | str[4],
|  | int | options
| ) |  |
| static

Definition at line 290 of file re.c.

References ONIG_OPTION_EXTEND, ONIG_OPTION_IGNORECASE, ONIG_OPTION_MULTILINE, and p.

Referenced by rb_enc_reg_error_desc(), rb_reg_desc(), and rb_reg_to_s().

static int pair_byte_cmp | ( | const void * | pair1,
|  | const void * | pair2
| ) |  |
| static

Definition at line 862 of file re.c.

References diff().

Referenced by update_char_offset().

static VALUE postmatch_getter | ( | void | ) |  |
| static

Definition at line 1575 of file re.c.

References rb_backref_get(), and rb_reg_match_post().

Referenced by Init_Regexp().

static VALUE prematch_getter | ( | void | ) |  |
| static

Definition at line 1569 of file re.c.

References rb_backref_get(), and rb_reg_match_pre().

Referenced by Init_Regexp().

int rb_char_to_option_kcode | ( | int | c,
|  | int * | option,
|  | int * | kcode
| ) |  |

Definition at line 301 of file re.c.

References ARG_ENCODING_FIXED, ARG_ENCODING_NONE, char_to_option(), rb_ascii8bit_encindex(), rb_enc_find_index(), and rb_utf8_encindex().

Referenced by parser_regx_options(), and reg_fragment_setenc_gen().

VALUE rb_check_regexp_type | ( | VALUE | re) |  |

Definition at line 3095 of file re.c.

References rb_check_convert_type(), and T_REGEXP.

Referenced by rb_reg_s_try_convert(), and rb_reg_s_union().

static VALUE rb_enc_reg_error_desc | ( | const char * | s,
|  | long | len,
|  | rb_encoding * | enc,
|  | int | options,
|  | const char * | err
| ) |  |
| static

Definition at line 614 of file re.c.

References NULL, option_to_str(), rb_default_external_encoding(), rb_default_internal_encoding(), rb_enc_associate(), rb_eRegexpError, rb_exc_new3(), rb_reg_expr_str(), rb_str_buf_cat2(), and rb_str_buf_new2.

Referenced by rb_enc_reg_raise(), and rb_reg_error_desc().

VALUE rb_enc_reg_new | ( | const char * | s,
|  | long | len,
|  | rb_encoding * | enc,
|  | int | options
| ) |  |

Definition at line 2511 of file re.c.

References err, NULL, rb_enc_reg_raise(), rb_reg_alloc(), and rb_reg_initialize().

Referenced by rb_reg_new().

static void rb_enc_reg_raise | ( | const char * | s,
|  | long | len,
|  | rb_encoding * | enc,
|  | int | options,
|  | const char * | err
| ) |  |
| static

Definition at line 631 of file re.c.

References rb_enc_reg_error_desc(), and rb_exc_raise().

Referenced by rb_enc_reg_new().

void rb_match_busy | ( | VALUE | match) |  |

Definition at line 1189 of file re.c.

References FL_SET, and MATCH_BUSY.

Referenced by date__httpdate(), date__iso8601(), date__jisx0301(), date__parse(), date__rfc2822(), date__rfc3339(), date__strptime_internal(), date__xmlschema(), match_getter(), nucomp_s_convert(), nurat_s_convert(), and rb_reg_match_m().

int rb_memcicmp | ( | const void * | x,
|  | const void * | y,
|  | long | len
| ) |  |

Definition at line 80 of file re.c.

Referenced by parser_encode_length(), and rb_file_identical_p().

int rb_memcmp | ( | const void * | p1,
|  | const void * | p2,
|  | long | len
| ) |  |

Definition at line 95 of file re.c.

References memcmp().

long rb_memsearch | ( | const void * | x0,
|  | long | m,
|  | const void * | y0,
|  | long | n,
|  | rb_encoding * | enc
| ) |  |

Definition at line 227 of file re.c.

References memcmp(), rb_memsearch_qs(), rb_memsearch_qs_utf8(), rb_memsearch_ss(), rb_utf8_encoding(), and SIZEOF_VALUE.

Referenced by rb_str_index(), and rb_str_split_m().

static long rb_memsearch_qs | ( | const unsigned char * | xs,
|  | long | m,
|  | const unsigned char * | ys,
|  | long | n
| ) |  |
| inline static

Definition at line 153 of file re.c.

References i, and memcmp().

Referenced by rb_memsearch().

static long rb_memsearch_qs_utf8 | ( | const unsigned char * | xs,
|  | long | m,
|  | const unsigned char * | ys,
|  | long | n
| ) |  |
| inline static

Definition at line 205 of file re.c.

References i, memcmp(), and rb_memsearch_qs_utf8_hash().

Referenced by rb_memsearch().

static unsigned int rb_memsearch_qs_utf8_hash | ( | const unsigned char * | x) |  |
| inline static

Definition at line 173 of file re.c.

Referenced by rb_memsearch_qs_utf8().

static long rb_memsearch_ss | ( | const unsigned char * | xs,
|  | long | m,
|  | const unsigned char * | ys,
|  | long | n
| ) |  |
| inline static

Definition at line 113 of file re.c.

References CHAR_BIT, rb_bug(), and SIZEOF_VALUE.

Referenced by rb_memsearch().

long rb_reg_adjust_startpos | ( | VALUE | re,
|  | VALUE | str,
|  | long | pos,
|  | int | reverse
| ) |  |

Definition at line 1321 of file re.c.

References onigenc_get_right_adjust_char_head(), ONIGENC_LEFT_ADJUST_CHAR_HEAD, ONIGENC_MBC_MAXLEN, p, range, rb_reg_prepare_enc(), RSTRING_LEN, RSTRING_PTR, and UChar.

VALUE rb_reg_alloc | ( | void | ) |  |

Definition at line 2481 of file re.c.

References rb_reg_s_alloc().

Referenced by rb_enc_reg_new(), rb_reg_compile(), and rb_reg_new_str().

int rb_reg_backref_number | ( | VALUE | match,
|  | VALUE | backref
| ) |  |

Definition at line 1075 of file re.c.

References match_backref_number().

Referenced by rb_str_subpat(), and rb_str_subpat_set().

static VALUE rb_reg_casefold_p | ( | VALUE | re) |  |
| static

Definition at line 662 of file re.c.

References ONIG_OPTION_IGNORECASE, Qfalse, Qtrue, rb_reg_check(), and RREGEXP.

Referenced by Init_Regexp().

static void rb_reg_check | ( | VALUE | re) |  |
| static

Definition at line 327 of file re.c.

References rb_eTypeError, rb_raise(), RREGEXP, RREGEXP_SRC, and RREGEXP_SRC_PTR.

Referenced by rb_reg_casefold_p(), rb_reg_desc(), rb_reg_equal(), rb_reg_init_copy(), rb_reg_initialize_m(), rb_reg_named_captures(), rb_reg_names(), rb_reg_options(), rb_reg_prepare_enc(), rb_reg_prepare_re(), rb_reg_source(), rb_reg_to_s(), and reg_hash().

VALUE rb_reg_check_preprocess | ( | VALUE | str) |  |

Definition at line 2304 of file re.c.

References buf, err, p, Qnil, rb_enc_get(), RB_GC_GUARD, rb_reg_error_desc(), rb_reg_preprocess(), RSTRING_LEN, RSTRING_PTR, and StringValue.

Referenced by reg_fragment_check_gen().

VALUE rb_reg_compile | ( | VALUE | str,
|  | int | options,
|  | const char * | sourcefile,
|  | int | sourceline
| ) |  |

Definition at line 2530 of file re.c.

References err, FL_SET, Qnil, rb_reg_alloc(), rb_reg_error_desc(), rb_reg_initialize_str(), rb_set_errinfo(), rb_str_new(), and REG_LITERAL.

Referenced by reg_compile_gen().

static VALUE rb_reg_desc | ( | const char * | s,
|  | long | len,
|  | VALUE | re
| ) |  |
| static

Definition at line 425 of file re.c.

References NULL, OBJ_INFECT, option_to_str(), rb_default_external_encoding(), rb_default_internal_encoding(), rb_enc_asciicompat, rb_enc_associate(), rb_enc_copy(), rb_enc_get(), rb_reg_check(), rb_reg_expr_str(), rb_str_buf_cat2(), rb_str_buf_new2, rb_usascii_encoding(), RBASIC, REG_ENCODING_NONE, and RREGEXP.

Referenced by rb_reg_inspect(), and rb_reg_raise().

VALUE rb_reg_eqq | ( | VALUE | re,
|  | VALUE | str
| ) |  |

Definition at line 2776 of file re.c.

References FALSE, NIL_P, Qfalse, Qnil, Qtrue, rb_backref_set(), rb_reg_search(), and reg_operand().

Referenced by Init_Regexp().

static VALUE rb_reg_equal | ( | VALUE | re1,
|  | VALUE | re2
| ) |  |
| static

Definition at line 2601 of file re.c.

References ENCODING_GET, FL_TEST, KCODE_FIXED, memcmp(), re_pattern_buffer::options, RRegexp::ptr, Qfalse, Qtrue, rb_reg_check(), RB_TYPE_P, RREGEXP, RREGEXP_SRC_LEN, RREGEXP_SRC_PTR, and T_REGEXP.

Referenced by Init_Regexp(), and match_equal().

static VALUE rb_reg_error_desc | ( | VALUE | str,
|  | int | options,
|  | const char * | err
| ) |  |
| static

Definition at line 637 of file re.c.

References rb_enc_get(), rb_enc_reg_error_desc(), RSTRING_LEN, and RSTRING_PTR.

Referenced by rb_reg_check_preprocess(), rb_reg_compile(), and rb_reg_raise_str().

static void rb_reg_expr_str | ( | VALUE | str,
|  | const char * | s,
|  | long | len,
|  | rb_encoding * | enc,
|  | rb_encoding * | resenc
| ) |  |
| static

Definition at line 335 of file re.c.

References c, ENC_CODERANGE_7BIT, ENC_CODERANGE_UNKNOWN, ENC_CODERANGE_VALID, mbclen, MBCLEN_CHARFOUND_LEN, MBCLEN_CHARFOUND_P, p, rb_enc_ascget(), rb_enc_asciicompat, rb_enc_isprint, rb_enc_isspace, rb_enc_mbc_to_codepoint, rb_enc_precise_mbclen(), rb_enc_unicode_p(), rb_str_buf_cat(), rb_str_buf_cat_escaped_char(), rb_str_coderange_scan_restartable(), and snprintf.

Referenced by rb_enc_reg_error_desc(), rb_reg_desc(), and rb_reg_to_s().

static VALUE rb_reg_fixed_encoding_p | ( | VALUE | re) |  |
| static

Definition at line 1224 of file re.c.

References FL_TEST, KCODE_FIXED, Qfalse, and Qtrue.

Referenced by Init_Regexp(), rb_reg_prepare_enc(), and rb_reg_s_union().

static VALUE rb_reg_hash | ( | VALUE | re) |  |
| static

Definition at line 2567 of file re.c.

References LONG2FIX, and reg_hash().

Referenced by Init_Regexp().

static VALUE rb_reg_init_copy | ( | VALUE | copy,
|  | VALUE | re
| ) |  |
| static

Definition at line 3268 of file re.c.

References err, NULL, OBJ_INIT_COPY, rb_enc_get(), rb_reg_check(), rb_reg_initialize(), rb_reg_options(), rb_reg_raise(), RREGEXP_SRC_LEN, and RREGEXP_SRC_PTR.

Referenced by Init_Regexp().

VALUE rb_reg_init_str | ( | VALUE | re,
|  | VALUE | s,
|  | int | options
| ) |  |

Definition at line 2493 of file re.c.

References err, NULL, rb_reg_initialize_str(), and rb_reg_raise_str().

Referenced by rb_reg_new_str().

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
| ) |  |
| static

Definition at line 2385 of file re.c.

References ARG_ENCODING_FIXED, ARG_ENCODING_NONE, ARG_REG_OPTION_MASK, errcpy, FL_TEST, KCODE_FIXED, make_regexp(), OBJ_FREEZE, OBJ_UNTRUSTED, RRegexp::ptr, Qnil, rb_ascii8bit_encoding(), rb_check_frozen, rb_enc_associate(), rb_enc_dummy_p(), rb_enc_str_new(), rb_eSecurityError, rb_eTypeError, RB_GC_GUARD, rb_raise(), rb_reg_preprocess(), rb_safe_level, rb_usascii_encoding(), REG_ENCODING_NONE, REG_LITERAL, RREGEXP, RSTRING_LEN, and RSTRING_PTR.

Referenced by rb_enc_reg_new(), rb_reg_init_copy(), rb_reg_initialize_m(), and rb_reg_initialize_str().

static VALUE rb_reg_initialize_m | ( | int | argc,
|  | VALUE * | argv,
|  | VALUE | self
| ) |  |
| static

Definition at line 2911 of file re.c.

References ARG_ENCODING_NONE, err, FIX2INT, FIXNUM_P, NIL_P, NULL, ONIG_OPTION_IGNORECASE, rb_ascii8bit_encoding(), rb_check_arity, rb_enc_get(), rb_enc_str_new(), rb_reg_check(), rb_reg_initialize(), rb_reg_initialize_str(), rb_reg_options(), rb_reg_raise_str(), RB_TYPE_P, rb_warn(), RREGEXP_SRC_LEN, RREGEXP_SRC_PTR, RSTRING_LEN, RTEST, StringValuePtr, and T_REGEXP.

Referenced by Init_Regexp().

static int rb_reg_initialize_str | ( | VALUE | obj,
|  | VALUE | str,
|  | int | options,
|  | onig_errmsg_buffer | err,
|  | const char * | sourcefile,
|  | int | sourceline
| ) |  |
| static

Definition at line 2446 of file re.c.

References ARG_ENCODING_NONE, ENC_CODERANGE_7BIT, errcpy, OBJ_INFECT, rb_ascii8bit_encoding(), rb_enc_get(), rb_enc_str_coderange(), RB_GC_GUARD, rb_reg_initialize(), RSTRING_LEN, and RSTRING_PTR.

Referenced by rb_reg_compile(), rb_reg_init_str(), and rb_reg_initialize_m().

static VALUE rb_reg_inspect | ( | VALUE | re) |  |
| static

Definition at line 491 of file re.c.

References rb_any_to_s(), rb_reg_desc(), RREGEXP, RREGEXP_SRC, RREGEXP_SRC_LEN, and RREGEXP_SRC_PTR.

Referenced by Init_Regexp().

VALUE rb_reg_last_match | ( | VALUE | match) |  |

Definition at line 1483 of file re.c.

References rb_reg_nth_match().

Referenced by last_match_getter(), match_to_s(), and vm_getspecial().

VALUE rb_reg_match | ( | VALUE | re,
|  | VALUE | str
| ) |  |

Definition at line 2746 of file re.c.

References LONG2FIX, Qnil, rb_str_sublen(), and reg_match_pos().

Referenced by Init_Regexp(), and rb_str_match().

VALUE rb_reg_match2 | ( | VALUE | re) |  |

Definition at line 2805 of file re.c.

References LONG2FIX, Qnil, rb_backref_set(), rb_lastline_get(), rb_reg_search(), rb_str_sublen(), RB_TYPE_P, and T_STRING.

Referenced by Init_Regexp().

VALUE rb_reg_match_last | ( | VALUE | match) |  |

Definition at line 1546 of file re.c.

References BEG, i, match_check(), NIL_P, re_registers::num_regs, Qnil, rb_reg_nth_match(), and RMATCH_REGS.

Referenced by last_paren_match_getter(), and vm_getspecial().

static VALUE rb_reg_match_m | ( | int | argc,
|  | VALUE * | argv,
|  | VALUE | re
| ) |  |
| static

Definition at line 2853 of file re.c.

References NIL_P, NUM2LONG, Qnil, rb_backref_get(), rb_backref_set(), rb_block_given_p(), rb_match_busy(), rb_scan_args(), rb_yield(), reg_match_pos(), and result.

Referenced by Init_Regexp().

VALUE rb_reg_match_post | ( | VALUE | match) |  |

Definition at line 1528 of file re.c.

References BEG, END, match_check(), NIL_P, OBJ_TAINT, OBJ_TAINTED, Qnil, rb_str_subseq(), RMATCH, RMATCH_REGS, and RSTRING_LEN.

Referenced by Init_Regexp(), postmatch_getter(), and vm_getspecial().

VALUE rb_reg_match_pre | ( | VALUE | match) |  |

Definition at line 1501 of file re.c.

References BEG, match_check(), NIL_P, OBJ_TAINT, OBJ_TAINTED, Qnil, rb_str_subseq(), RMATCH, and RMATCH_REGS.

Referenced by Init_Regexp(), prematch_getter(), and vm_getspecial().

static VALUE rb_reg_named_captures | ( | VALUE | re) |  |
| static

Definition at line 773 of file re.c.

References hash(), onig_foreach_name(), rb_hash_new(), rb_reg_check(), reg_named_captures_iter(), and RREGEXP.

Referenced by Init_Regexp().

static VALUE rb_reg_names | ( | VALUE | re) |  |
| static

Definition at line 726 of file re.c.

References onig_foreach_name(), rb_ary_new(), rb_reg_check(), reg_names_iter(), and RREGEXP.

Referenced by Init_Regexp(), and match_names().

VALUE rb_reg_new | ( | const char * | s,
|  | long | len,
|  | int | options
| ) |  |

Definition at line 2524 of file re.c.

References rb_ascii8bit_encoding(), and rb_enc_reg_new().

Referenced by date__strptime_internal(), proc_options(), and regcomp().

VALUE rb_reg_new_ary | ( | VALUE | ary,
|  | int | opt
| ) |  |

Definition at line 2505 of file re.c.

References rb_reg_new_str(), and rb_reg_preprocess_dregexp().

VALUE rb_reg_new_str | ( | VALUE | s,
|  | int | options
| ) |  |

Definition at line 2487 of file re.c.

References rb_reg_alloc(), and rb_reg_init_str().

Referenced by r_object0(), rb_reg_new_ary(), rb_reg_regcomp(), and rb_reg_s_union().

VALUE rb_reg_nth_defined | ( | int | nth,
|  | VALUE | match
| ) |  |

Definition at line 1439 of file re.c.

References BEG, match_check(), NIL_P, re_registers::num_regs, Qfalse, Qnil, Qtrue, and RMATCH_REGS.

VALUE rb_reg_nth_match | ( | int | nth,
|  | VALUE | match
| ) |  |

Definition at line 1457 of file re.c.

References BEG, END, re_registers::end, match_check(), NIL_P, re_registers::num_regs, OBJ_INFECT, Qnil, rb_str_subseq(), RMATCH, and RMATCH_REGS.

Referenced by date__strptime_internal(), httpdate_type1_cb(), httpdate_type2_cb(), httpdate_type3_cb(), iso8601_bas_datetime_cb(), iso8601_ext_datetime_cb(), iso8601_ext_time_cb(), jisx0301_cb(), match_aref(), match_entry(), match_inspect(), parse_day_cb(), parse_ddd_cb(), parse_dot_cb(), parse_eu_cb(), parse_frag_cb(), parse_iso21_cb(), parse_iso22_cb(), parse_iso23_cb(), parse_iso24_cb(), parse_iso25_cb(), parse_iso26_cb(), parse_iso_cb(), parse_jis_cb(), parse_mday_cb(), parse_mon_cb(), parse_sla_cb(), parse_time2_cb(), parse_time_cb(), parse_us_cb(), parse_vms11_cb(), parse_vms12_cb(), parse_year_cb(), rb_reg_last_match(), rb_reg_match_last(), rb_reg_s_last_match(), rb_str_rpartition(), rb_str_sub_bang(), rb_str_subpat(), rfc2822_cb(), rfc3339_cb(), scan_once(), str_gsub(), vm_getspecial(), xmlschema_datetime_cb(), xmlschema_time_cb(), and xmlschema_trunc_cb().

int rb_reg_options | ( | VALUE | re) |  |

Definition at line 3083 of file re.c.

References ARG_ENCODING_FIXED, ARG_ENCODING_NONE, ARG_REG_OPTION_MASK, KCODE_FIXED, options(), rb_reg_check(), RBASIC, REG_ENCODING_NONE, and RREGEXP.

Referenced by rb_reg_init_copy(), rb_reg_initialize_m(), rb_reg_options_m(), and w_object().

static VALUE rb_reg_options_m | ( | VALUE | re) |  |
| static

Definition at line 694 of file re.c.

References INT2NUM, options(), and rb_reg_options().

Referenced by Init_Regexp().

static rb_encoding* rb_reg_prepare_enc | ( | VALUE | re,
|  | VALUE | str,
|  | int | warn
| ) |  |
| static

Definition at line 1247 of file re.c.

References ENC_CODERANGE_7BIT, ENC_CODERANGE_BROKEN, rb_ascii8bit_encoding(), rb_eArgError, rb_enc_asciicompat, rb_enc_get(), rb_enc_name, rb_enc_str_asciicompat_p, rb_enc_str_coderange(), rb_raise(), rb_reg_check(), rb_reg_fixed_encoding_p(), rb_warn(), RBASIC, reg_enc_error(), REG_ENCODING_NONE, and RREGEXP.

Referenced by rb_reg_adjust_startpos(), and rb_reg_prepare_re().

regex_t* rb_reg_prepare_re | ( | VALUE | re,
|  | VALUE | str
| ) |  |

Definition at line 1282 of file re.c.

References re_pattern_buffer::enc, err, onig_error_code_to_str(), onig_new(), OnigDefaultSyntax, re_pattern_buffer::options, Qnil, rb_eArgError, RB_GC_GUARD, rb_raise(), rb_reg_check(), rb_reg_prepare_enc(), rb_reg_preprocess(), rb_reg_raise(), RREGEXP, RREGEXP_SRC_LEN, RREGEXP_SRC_PTR, RSTRING_LEN, RSTRING_PTR, and UChar.

Referenced by rb_reg_search(), and strscan_do_scan().

static VALUE rb_reg_preprocess | ( | const char * | p,
|  | const char * | end,
|  | rb_encoding * | enc,
|  | rb_encoding ** | fixed_enc,
|  | onig_errmsg_buffer | err
| ) |  |
| static

Definition at line 2274 of file re.c.

References buf, Qnil, rb_enc_asciicompat, rb_enc_associate(), rb_str_buf_new(), and unescape_nonascii().

Referenced by rb_reg_check_preprocess(), rb_reg_initialize(), rb_reg_prepare_re(), and rb_reg_preprocess_dregexp().

static VALUE rb_reg_preprocess_dregexp | ( | VALUE | ary,
|  | int | options
| ) |  |
| static

Definition at line 2327 of file re.c.

References ARG_ENCODING_NONE, buf, ENC_CODERANGE_7BIT, err, i, p, Qnil, RARRAY_LEN, RARRAY_PTR, rb_ascii8bit_encoding(), rb_eArgError, rb_enc_associate(), rb_enc_get(), rb_enc_name, rb_enc_str_coderange(), rb_eRegexpError, rb_raise(), rb_reg_preprocess(), rb_str_buf_append(), rb_str_new3, result, RSTRING_LEN, RSTRING_PTR, and StringValue.

Referenced by rb_reg_new_ary().

VALUE rb_reg_quote | ( | VALUE | str) |  |

Definition at line 2965 of file re.c.

References c, mbclen, OBJ_INFECT, rb_enc_ascget(), rb_enc_associate(), rb_enc_copy(), rb_enc_get(), rb_enc_mbcput, rb_enc_str_asciionly_p(), rb_str_new(), rb_str_new3, rb_str_resize(), rb_usascii_encoding(), RSTRING_LEN, and RSTRING_PTR.

Referenced by get_pat(), and rb_reg_s_quote().

static void rb_reg_raise | ( | const char * | s,
|  | long | len,
|  | const char * | err,
|  | VALUE | re
| ) |  |
| static

Definition at line 606 of file re.c.

References rb_eRegexpError, rb_raise(), rb_reg_desc(), and RSTRING_PTR.

Referenced by rb_reg_init_copy(), rb_reg_prepare_re(), and rb_reg_search().

static void rb_reg_raise_str | ( | VALUE | str,
|  | int | options,
|  | const char * | err
| ) |  |
| static

Definition at line 644 of file re.c.

References rb_exc_raise(), and rb_reg_error_desc().

Referenced by rb_reg_init_str(), and rb_reg_initialize_m().

VALUE rb_reg_regcomp | ( | VALUE | str) |  |

Definition at line 2547 of file re.c.

References ENCODING_GET, memcmp(), rb_reg_new_str(), reg_cache, RREGEXP_SRC_LEN, RREGEXP_SRC_PTR, RSTRING_LEN, and RSTRING_PTR.

Referenced by get_pat(), and rb_str_split_m().

VALUE rb_reg_regsub | ( | VALUE | str,
|  | VALUE | src,
|  | struct re_registers * | regs,
|  | VALUE | regexp
| ) |  |

Definition at line 3286 of file re.c.

References ASCGET, BEG, c, END, mbclen, name, name_to_backref_number(), re_registers::num_regs, onig_noname_group_capture_is_active(), p, rb_enc_asciicompat, rb_enc_get(), rb_enc_str_buf_cat(), rb_eRuntimeError, rb_raise(), rb_str_buf_new(), RREGEXP, RSTRING_LEN, RSTRING_PTR, and val.

Referenced by rb_str_sub_bang(), and str_gsub().

static VALUE rb_reg_s_alloc | ( | VALUE | klass) |  |
| static

Definition at line 2469 of file re.c.

References NEWOBJ_OF, and T_REGEXP.

Referenced by Init_Regexp(), and rb_reg_alloc().

static VALUE rb_reg_s_last_match | ( | int | argc,
|  | VALUE * | argv
| ) |  |
| static

Definition at line 3478 of file re.c.

References match(), match_backref_number(), match_getter(), NIL_P, Qnil, rb_backref_get(), rb_reg_nth_match(), and rb_scan_args().

Referenced by Init_Regexp().

static VALUE rb_reg_s_quote | ( | VALUE | c,
|  | VALUE | str
| ) |  |
| static

Definition at line 3077 of file re.c.

References rb_reg_quote(), reg_operand(), and TRUE.

Referenced by Init_Regexp(), and rb_reg_s_union().

static VALUE rb_reg_s_try_convert | ( | VALUE | dummy,
|  | VALUE | re
| ) |  |
| static

Definition at line 3118 of file re.c.

References rb_check_regexp_type().

Referenced by Init_Regexp().

static VALUE rb_reg_s_union | ( | VALUE | self,
|  | VALUE | args0
| ) |  |
| static

Definition at line 3124 of file re.c.

References arg, argc, args, i, NIL_P, Qnil, RARRAY_LEN, rb_ary_entry(), rb_ascii8bit_encoding(), rb_check_regexp_type(), rb_class_new_instance(), rb_eArgError, rb_enc_asciicompat, rb_enc_associate(), rb_enc_copy(), rb_enc_get(), rb_enc_name, rb_enc_str_asciicompat_p, rb_enc_str_asciionly_p(), rb_raise(), rb_reg_fixed_encoding_p(), rb_reg_new_str(), rb_reg_s_quote(), rb_reg_to_s(), rb_str_append(), rb_str_buf_cat_ascii(), rb_str_buf_new(), rb_str_new2, StringValue, and v.

Referenced by rb_reg_s_union_m().

static VALUE rb_reg_s_union_m | ( | VALUE | self,
|  | VALUE | args
| ) |  |
| static

Definition at line 3256 of file re.c.

References NIL_P, RARRAY_LEN, rb_ary_entry(), rb_check_array_type(), rb_reg_s_union(), and v.

Referenced by Init_Regexp().

long rb_reg_search | ( | VALUE | re,
|  | VALUE | str,
|  | long | pos,
|  | int | reverse
| ) |  |

Definition at line 1352 of file re.c.

References err, FL_TAINT, FL_TEST, FL_UNSET, match(), match_alloc(), MATCH_BUSY, MEMZERO, NIL_P, OBJ_INFECT, OBJ_TAINT, onig_error_code_to_str(), onig_free(), ONIG_MISMATCH, ONIG_OPTION_NONE, onig_region_copy(), onig_region_free(), onig_search(), Qnil, range, rb_backref_get(), rb_backref_set(), rb_reg_prepare_re(), rb_reg_raise(), rb_safe_level, rb_str_new4, result, RMATCH, RMATCH_REGS, RREGEXP, RREGEXP_SRC_LEN, RREGEXP_SRC_PTR, RSTRING_LEN, RSTRING_PTR, and UChar.

Referenced by rb_reg_eqq(), rb_reg_match2(), rb_str_index_m(), rb_str_partition(), rb_str_rindex_m(), rb_str_rpartition(), rb_str_scan(), rb_str_split_m(), rb_str_sub_bang(), rb_str_subpat(), rb_str_subpat_set(), reg_match_pos(), scan_once(), and str_gsub().

static VALUE rb_reg_source | ( | VALUE | re) |  |
| static

Definition at line 468 of file re.c.

References OBJ_TAINT, OBJ_TAINTED, rb_enc_get(), rb_enc_str_new(), rb_reg_check(), RREGEXP_SRC_LEN, and RREGEXP_SRC_PTR.

Referenced by Init_Regexp().

static VALUE rb_reg_to_s | ( | VALUE | re) |  |
| static

Definition at line 521 of file re.c.

References char_to_option(), err, NULL, OBJ_INFECT, onig_free(), onig_new(), ONIG_OPTION_DEFAULT, ONIG_OPTION_EXTEND, ONIG_OPTION_IGNORECASE, ONIG_OPTION_MULTILINE, OnigDefaultSyntax, option_to_str(), options(), rb_enc_copy(), rb_enc_get(), rb_reg_check(), rb_reg_expr_str(), rb_str_buf_cat2(), rb_str_buf_new2, RREGEXP, RREGEXP_SRC_LEN, RREGEXP_SRC_PTR, and UChar.

Referenced by Init_Regexp(), and rb_reg_s_union().

static void re_warn | ( | const char * | s) |  |
| static

Definition at line 3493 of file re.c.

References rb_warn().

Referenced by Init_Regexp().

static int read_escaped_byte | ( | const char ** | pp,
|  | const char * | end,
|  | onig_errmsg_buffer | err
| ) |  |
| static

Definition at line 1912 of file re.c.

References errcpy, backref_name_tag::len, p, scan_hex, and scan_oct.

Referenced by unescape_escaped_nonascii().

static void reg_enc_error | ( | VALUE | re,
|  | VALUE | str
| ) |  |
| static

Definition at line 1238 of file re.c.

References rb_eEncCompatError, rb_enc_get(), rb_enc_name, and rb_raise().

Referenced by rb_reg_prepare_enc().

static st_index_t reg_hash | ( | VALUE | re) |  |
| static

Definition at line 2574 of file re.c.

References rb_hash_end, rb_hash_uint, rb_memhash(), rb_reg_check(), RREGEXP, RREGEXP_SRC_LEN, and RREGEXP_SRC_PTR.

Referenced by match_hash(), and rb_reg_hash().

static long reg_match_pos | ( | VALUE | re,
|  | VALUE * | strp,
|  | long | pos
| ) |  |
| static

Definition at line 2675 of file re.c.

References NIL_P, NUM2INT, Qnil, rb_backref_set(), rb_reg_search(), rb_str_length(), rb_str_offset(), reg_operand(), and TRUE.

Referenced by rb_reg_match(), and rb_reg_match_m().

static int reg_named_captures_iter | ( | const OnigUChar * | name,
|  | const OnigUChar * | name_end,
|  | int | back_num,
|  | int * | back_refs,
|  | OnigRegex | regex,
|  | void * | arg
| ) |  |
| static

Definition at line 735 of file re.c.

References hash(), i, INT2NUM, rb_ary_new2(), rb_ary_store(), rb_hash_aset(), and rb_str_new().

Referenced by rb_reg_named_captures().

static int reg_names_iter | ( | const OnigUChar * | name,
|  | const OnigUChar * | name_end,
|  | int | back_num,
|  | int * | back_refs,
|  | OnigRegex | regex,
|  | void * | arg
| ) |  |
| static

Definition at line 701 of file re.c.

References rb_ary_push(), and rb_str_new().

Referenced by rb_reg_names().

static VALUE reg_operand | ( | VALUE | s,
|  | int | check
| ) |  |
| static

Definition at line 2664 of file re.c.

References rb_check_string_type(), rb_str_to_str(), rb_sym_to_s(), and SYMBOL_P.

Referenced by rb_reg_eqq(), rb_reg_s_quote(), and reg_match_pos().

static int unescape_escaped_nonascii | ( | const char ** | pp,
|  | const char * | end,
|  | rb_encoding * | enc,
|  | VALUE | buf,
|  | rb_encoding ** | encp,
|  | onig_errmsg_buffer | err
| ) |  |
| static

Definition at line 2018 of file re.c.

References ALLOCA_N, errcpy, MBCLEN_INVALID_P, MBCLEN_NEEDMORE_P, p, rb_enc_mbmaxlen, rb_enc_precise_mbclen(), rb_str_buf_cat(), read_escaped_byte(), and snprintf.

Referenced by unescape_nonascii().

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

Definition at line 2168 of file re.c.

References c, errcpy, MBCLEN_CHARFOUND_LEN, MBCLEN_CHARFOUND_P, rb_enc_precise_mbclen(), rb_str_buf_cat(), ruby_scan_oct(), unescape_escaped_nonascii(), unescape_unicode_bmp(), and unescape_unicode_list().

Referenced by rb_reg_preprocess().

static int unescape_unicode_bmp | ( | const char ** | pp,
|  | const char * | end,
|  | VALUE | buf,
|  | rb_encoding ** | encp,
|  | onig_errmsg_buffer | err
| ) |  |
| static

Definition at line 2145 of file re.c.

References append_utf8(), errcpy, backref_name_tag::len, p, and ruby_scan_hex().

Referenced by unescape_nonascii().

static int unescape_unicode_list | ( | const char ** | pp,
|  | const char * | end,
|  | VALUE | buf,
|  | rb_encoding ** | encp,
|  | onig_errmsg_buffer | err
| ) |  |
| static

Definition at line 2108 of file re.c.

References append_utf8(), errcpy, ISSPACE, backref_name_tag::len, p, and ruby_scan_hex().

Referenced by unescape_nonascii().

static void update_char_offset | ( | VALUE | match) |  |
| static

Definition at line 873 of file re.c.

References ALLOCA_N, BEG, rmatch_offset::beg, pair_t::byte_pos, c, rmatch::char_offset, rmatch::char_offset_num_allocated, rmatch::char_offset_updated, pair_t::char_pos, END, rmatch_offset::end, i, key, re_registers::num_regs, p, pair_byte_cmp(), rb_enc_get(), rb_enc_mbmaxlen, rb_enc_strlen(), REALLOC_N, rmatch::regs, RMATCH, and RSTRING_PTR.

Referenced by match_begin(), match_end(), and match_offset().

## Variable Documentation

VALUE rb_cMatch

Definition at line 840 of file re.c.

VALUE rb_cRegexp

Definition at line 1909 of file re.c.

VALUE rb_eRegexpError

Definition at line 20 of file re.c.

VALUE reg_cache
| static

Definition at line 2544 of file re.c.

Referenced by rb_reg_regcomp().