* encindex.h: separate encoding index constants from internal.h.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51861 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* re.c (rb_memsearch_wchar, rb_memsearch_qchar): test matching
till the end of string. [ruby-core:70592] [Bug #11488]
* test/ruby/test_m17n.rb (test_include?, tet_index): add tests by
Tom Stuart.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51685 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* re.c (rb_memsearch): should match only char boundaries in wide
character encodings. [ruby-core:70220] [Bug #11413]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51470 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* include/ruby/encoding.h (ENC_CODERANGE_CLEAN_P): predicate that
tells if the coderange is clean, that is 7bit or valid, and no
needs to scrub.
* re.c (rb_reg_expr_str): use ENC_CODERANGE_CLEAN_P.
* string.c (enc_strlen, rb_enc_cr_str_buf_cat, rb_str_scrub):
ditto.
* string.c (rb_str_enumerate_chars): ditto, and suppress a warning
by gcc6.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51278 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* range.c (range_step, range_each): String#upto should never
modifies the receiver, use frozen strings to enumerate symbols.
* re.c (reg_operand): matching target is not modified.
* ext/socket/constants.c (constant_arg): str_to_int never modifies
argument strings.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50306 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* re.c (match_aref): RMatch::regexp is Qnil after matching by a
string since r45451. [ruby-core:68209] [Bug #10877]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49675 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* re.c (rb_reg_region_copy): new function to try with GC if copy
failed and return the error.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48672 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* re.c (CHECK_REGION_COPIED): onig_region_copy() can fail when
memory exhausted but returns nothing, so check by if allocated.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48669 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* re.c (unescape_nonascii): make dynamically compiled US-ASCII
regexps ASCII-8BIT encoding if binary (hexadecimal, control,
meta) escapes are contained, as well as literal regexps.
[ruby-dev:48626] [Bug #10382]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47992 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* process.c (rlimit_resource_type, rlimit_resource_value): get rid
of function calls in RSTRING_PTR(), as it evaluates the argument
twice.
* re.c (match_backref_number): ditto.
* signal.c (esignal_init, rb_f_kill, trap_signm): ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47006 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* re.c (match_aref): should not ignore name after NUL byte.
[ruby-dev:48275] [Bug #9902]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46344 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* string.c (rb_pat_search): match result should be infected by the
pattern.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45460 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* re.c (match_regexp): set regexp for MatchData from string.
* re.c (rb_backref_set_string): create MatchData from string and
set backref.
* string.c (rb_pat_search, rb_str_sub, rb_str_sub_bang, str_gsub),
(scan_once, rb_str_scan, rb_str_partition): use rb_str_index
instead of rb_reg_search() when pattern is a String. based on
the patch by Sam Rawlins <sam.rawlins@gmail.com> [Fixes GH-579]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45451 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* re.c (match_inspect): preserve class name encoding by PRIsVALUE.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45449 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* internal.h: add prototype for rb_reg_search0
* re.c: rename rb_reg_search to rb_reg_search0, add set_backref_str
argument to allow callers to indicate that they don't require the
backref string to be allocated
* string.c: don't allocate backref str if replacement string is provided
Closes GH-578. [Bug #9676] [ruby-core:61682]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45414 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
add links to `Object#hash` to each #`hash` methods rdocs.
[Fixes GH-567]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45329 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
if it is ASCII incompatible encoding. [ruby-core:56063] [Bug #8650]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42167 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
parameter `slot'. You don't need to write a cast (VALUE *) any more.
* class.c, compile.c, hash.c, iseq.c, proc.c, re.c, variable.c,
vm.c, vm_method.c: remove cast expressions for OBJ_WRITE().
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41548 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Regexp#to_s suppress extra its whole regexp options by calling
onig_new with its source, but it doesn't call rb_reg_preprocess.
Therefore its Unicode escapes (\u{XXXX}) are given as is,
and it may cause duplicated charclass warning for example
"[\u{33}]" (3 is duplicated) or "[\u{a}\u{b}]" (u is duplicated).
[ruby-core:53649] [Bug #8151]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40063 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
to char offset; the return value of rb_reg_search is byte offset,
but other than it of rb_str_rpartition expects char offset.
[Bug #8138] [ruby-dev:47183]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39906 b2dd03c8-39d4-4d8f-98ff-823fe69b080e