Ruby 3.0.5p211 (2022-11-24 revision ba5cf0f7c52d4d35cc6a173c89eda98ceffa2dcf)
|
#include "ruby/internal/config.h"
#include <ctype.h>
#include "encindex.h"
#include "internal.h"
#include "internal/hash.h"
#include "internal/imemo.h"
#include "internal/re.h"
#include "internal/string.h"
#include "internal/variable.h"
#include "regint.h"
#include "ruby/encoding.h"
#include "ruby/re.h"
#include "ruby/util.h"
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 | VALUE_MAX ((VALUE)~(VALUE)0) |
#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 | NAME_TO_NUMBER(regs, re, name, name_ptr, name_end) |
#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] |
Enumerations | |
enum | { OPTBUF_SIZE = 4 } |
Variables | |
VALUE | rb_eRegexpError |
VALUE | rb_cMatch |
VALUE | rb_cRegexp |
#define ARG_REG_OPTION_MASK (ONIG_OPTION_IGNORECASE|ONIG_OPTION_MULTILINE|ONIG_OPTION_EXTEND) |
#define ASCGET | ( | s, | |
e, | |||
cl | |||
) | (acompat ? (*(cl)=1,ISASCII((s)[0])?(s)[0]:-1) : rb_enc_ascget((s), (e), (cl), str_enc)) |
#define errcpy | ( | err, | |
msg | |||
) | strlcpy((err), (msg), ONIG_MAX_ERROR_MESSAGE_LEN) |
#define NAME_TO_NUMBER | ( | regs, | |
re, | |||
name, | |||
name_ptr, | |||
name_end | |||
) |
typedef char onig_errmsg_buffer[ONIG_MAX_ERROR_MESSAGE_LEN] |
void Init_Regexp | ( | void | ) |
Definition at line 4023 of file re.c.
References ARG_ENCODING_FIXED, ARG_ENCODING_NONE, CLASS_OF, INT2FIX, ONIG_ENCODING_ASCII, ONIG_OPTION_EXTEND, ONIG_OPTION_IGNORECASE, ONIG_OPTION_MULTILINE, onig_set_verb_warn_func(), onig_set_warn_func(), onigenc_set_default_encoding(), rb_class_new_instance(), rb_cMatch, rb_cObject, rb_cRegexp, rb_define_alloc_func(), rb_define_class(), rb_define_const(), rb_define_method, rb_define_singleton_method, ruby::backward::cxxanyargs::rb_define_virtual_variable(), rb_eRegexpError, rb_eStandardError, rb_gvar_ractor_local(), rb_obj_encoding(), rb_reg_eqq(), rb_reg_match(), rb_reg_match2(), rb_reg_match_post(), rb_reg_match_pre(), and rb_undef_method().
Definition at line 1358 of file re.c.
References FL_TEST, len, match, MATCH_BUSY, NIL_P, rb_backref_get(), rb_backref_set(), and rb_cMatch.
Definition at line 329 of file re.c.
References ARG_ENCODING_FIXED, ARG_ENCODING_NONE, ENCINDEX_EUC_JP, ENCINDEX_Windows_31J, rb_ascii8bit_encindex, and rb_utf8_encindex.
Referenced by rb_reg_fragment_setenc().
Definition at line 3605 of file re.c.
References rb_check_convert_type(), and T_REGEXP.
VALUE rb_enc_reg_new | ( | const char * | s, |
long | len, | ||
rb_encoding * | enc, | ||
int | options | ||
) |
Definition at line 2946 of file re.c.
References err, len, NULL, rb_enc_str_new(), rb_fstring(), RB_OBJ_WRITE, rb_reg_alloc(), RREGEXP, and RRegexp::src.
Referenced by rb_reg_new().
void rb_match_busy | ( | VALUE | match | ) |
Definition at line 1305 of file re.c.
References FL_SET, match, and MATCH_BUSY.
Referenced by date__httpdate(), date__iso8601(), date__jisx0301(), date__parse(), date__rfc2822(), date__rfc3339(), and date__xmlschema().
Definition at line 1317 of file re.c.
References match, NIL_P, and re_registers::num_regs.
Referenced by rb_f_global_variables().
Definition at line 1327 of file re.c.
References BEG, FALSE, match, NIL_P, and re_registers::num_regs.
Referenced by rb_f_global_variables().
void rb_match_unbusy | ( | VALUE | match | ) |
Definition at line 1311 of file re.c.
References FL_UNSET, match, and MATCH_BUSY.
Definition at line 247 of file re.c.
References LIKELY, memcmp(), rb_enc_mbminlen, rb_utf8_encoding(), and SIZEOF_VALUE.
Definition at line 1518 of file re.c.
References onigenc_get_right_adjust_char_head(), ONIGENC_LEFT_ADJUST_CHAR_HEAD, ONIGENC_MBC_MAXLEN, range, RSTRING_LEN, RSTRING_PTR, str, and UChar.
VALUE rb_reg_alloc | ( | void | ) |
Definition at line 2900 of file re.c.
References rb_cRegexp.
Referenced by rb_enc_reg_new(), rb_reg_compile(), and rb_reg_new_str().
Definition at line 2718 of file re.c.
References err, Qnil, rb_enc_get(), RB_GC_GUARD, RSTRING_LEN, RSTRING_PTR, str, and StringValue.
Definition at line 2966 of file re.c.
References err, FL_SET, Qnil, rb_obj_freeze(), rb_reg_alloc(), rb_set_errinfo(), rb_str_new, REG_LITERAL, and str.
Referenced by rb_parser_reg_compile().
Definition at line 3224 of file re.c.
References FALSE, NIL_P, Qfalse, Qnil, Qtrue, rb_backref_set(), rb_reg_search(), and str.
Referenced by Init_Regexp().
Definition at line 1750 of file re.c.
References match, and rb_reg_nth_match().
Definition at line 3194 of file re.c.
References LONG2FIX, NULL, Qnil, rb_str_sublen(), and str.
Referenced by Init_Regexp().
Definition at line 3253 of file re.c.
References LONG2FIX, Qnil, rb_backref_set(), rb_lastline_get(), rb_reg_search(), rb_str_sublen(), and T_STRING.
Referenced by Init_Regexp().
Definition at line 1811 of file re.c.
References BEG, match, NIL_P, re_registers::num_regs, Qnil, and rb_reg_nth_match().
Definition at line 3353 of file re.c.
References re_registers::beg, re_registers::end, err, len, NIL_P, NULL, NUM2LONG, onig_error_code_to_str(), onig_free(), ONIG_MISMATCH, ONIG_OPTION_NONE, onig_search(), Qfalse, Qtrue, rb_reg_prepare_re0(), rb_str_length(), rb_str_subpos(), rb_sym2str(), RREGEXP, RREGEXP_PTR, RSTRING_LEN, RSTRING_PTR, str, StringValue, SYMBOL_P, and UChar.
Definition at line 1794 of file re.c.
References BEG, END, match, NIL_P, Qnil, rb_str_subseq(), RMATCH, RSTRING_LEN, and str.
Referenced by Init_Regexp().
Definition at line 1768 of file re.c.
References BEG, match, NIL_P, Qnil, rb_str_subseq(), RMATCH, and str.
Referenced by Init_Regexp().
Definition at line 2960 of file re.c.
References len, rb_ascii8bit_encoding(), and rb_enc_reg_new().
Definition at line 2938 of file re.c.
References rb_obj_freeze(), and rb_reg_new_str().
Definition at line 2906 of file re.c.
References rb_reg_alloc(), and rb_reg_init_str().
Referenced by rb_reg_new_ary(), and rb_reg_regcomp().
Definition at line 1725 of file re.c.
References BEG, re_registers::end, END, len, match, NIL_P, re_registers::num_regs, Qnil, rb_str_subseq(), RMATCH, and str.
Referenced by rb_reg_last_match(), and rb_reg_match_last().
Definition at line 3593 of file re.c.
References ARG_ENCODING_FIXED, ARG_ENCODING_NONE, ARG_REG_OPTION_MASK, KCODE_FIXED, RBASIC, REG_ENCODING_NONE, and RREGEXP_PTR.
Definition at line 1511 of file re.c.
References err, rb_reg_prepare_re0(), and str.
regex_t * rb_reg_prepare_re0 | ( | VALUE | re, |
VALUE | str, | ||
onig_errmsg_buffer | err | ||
) |
Definition at line 1471 of file re.c.
References re_pattern_buffer::enc, err, len, onig_error_code_to_str(), onig_new(), OnigDefaultSyntax, re_pattern_buffer::options, ptr, Qnil, rb_eArgError, RB_GC_GUARD, rb_raise(), RREGEXP_PTR, RSTRING_GETMEM, str, and UChar.
Referenced by rb_reg_match_p(), rb_reg_prepare_re(), and rb_reg_start_with_p().
Definition at line 3475 of file re.c.
References mbclen, memcpy, 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, RSTRING_PTR, str, and t.
Definition at line 2984 of file re.c.
References ENCODING_GET, memcmp(), rb_reg_new_str(), RSTRING_LEN, RSTRING_PTR, and str.
int rb_reg_region_copy | ( | struct re_registers * | to, |
const struct re_registers * | from | ||
) |
Definition at line 956 of file re.c.
References re_registers::allocated, onig_region_copy(), ONIGERR_MEMORY, and rb_gc().
Referenced by rb_reg_start_with_p().
VALUE rb_reg_regsub | ( | VALUE | str, |
VALUE | src, | ||
struct re_registers * | regs, | ||
VALUE | regexp | ||
) |
Definition at line 3790 of file re.c.
References ASCGET, BEG, END, mbclen, name, NAME_TO_NUMBER, NIL_P, re_registers::num_regs, onig_noname_group_capture_is_active(), rb_enc_asciicompat, rb_enc_get(), rb_enc_str_buf_cat(), rb_eRuntimeError, rb_raise(), rb_str_buf_new(), rb_str_subseq(), RREGEXP_PTR, RSTRING_GETMEM, RSTRING_LEN, RSTRING_PTR, and str.
Definition at line 1628 of file re.c.
References rb_reg_search0(), and str.
Referenced by rb_reg_eqq(), and rb_reg_match2().
Definition at line 1634 of file re.c.
References err, FL_TEST, len, match, MATCH_BUSY, MEMZERO, NIL_P, onig_error_code_to_str(), onig_free(), onig_match(), ONIG_MISMATCH, ONIG_OPTION_NONE, onig_region_free(), ptr, Qnil, rb_backref_get(), rb_backref_set(), rb_cMatch, rb_memerror(), rb_reg_prepare_re0(), rb_reg_region_copy(), rb_str_new4, RMATCH, RREGEXP, RREGEXP_PTR, RSTRING_GETMEM, str, and UChar.
VALUE rb_cMatch |
Definition at line 940 of file re.c.
Referenced by Init_Regexp(), rb_backref_set_string(), and rb_reg_start_with_p().
VALUE rb_cRegexp |
Definition at line 2301 of file re.c.
Referenced by Init_Regexp(), and rb_reg_alloc().
VALUE rb_eRegexpError |
Definition at line 28 of file re.c.
Referenced by Init_Regexp().