summaryrefslogtreecommitdiffstats
path: root/re.c
Commit message (Collapse)AuthorAgeFilesLines
* * removed spaces just before tabs.nobu2009-11-261-5/+5
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@25930 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * re.c (last_match): add "thread and method" to the scope.naruse2009-09-301-1/+1
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@25168 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * re.c (last_match): Added note to the doc that last_match is local to ↵marcandre2009-09-291-0/+3
| | | | | | current scope [ruby-core:25833] git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@25165 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * doc/re.rb: New document for Ruby's fork of Oniguruma.naruse2009-09-171-0/+3
| | | | | | | | | | written by Run Paint Run Run [ruby-core:25420] * re.c: import document in doc/re.rb. * .document: add doc/re.rb. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@24973 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * parse.y (rb_char_to_option_kcode): ASCII-8BIT should also delay.naruse2009-09-101-2/+2
| | | | | | | * re.c (parser_regx_options): return rb_ascii8bit_encindex on ASCII-8BIT. [ruby-dev:39300] git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@24832 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * re.c (rb_reg_hash): must calculate hash.nobu2009-09-081-1/+1
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@24793 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * include/ruby/st.h (st_hash_func): use st_index_t.nobu2009-09-081-15/+13
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@24792 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * re.c (Init_Regexp): new methods. [ruby-core:24748]nobu2009-09-051-0/+3
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@24755 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * re.c (update_char_offset): position should be long.nobu2009-09-041-0/+49
| | | | | | | | | | * re.c (match_hash, match_equal): new methods. [ruby-core:24748] * re.c (reg_match_pos, rb_reg_eqq, rb_reg_s_quote): get rid of use VALUE as int. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@24754 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * re.c (update_char_offset):nobu2009-09-041-5/+5
| | | | | | | | | | | | * re.c (rb_reg_equal): * re.c (reg_match_pos): * re.c (rb_reg_eqq): * re.c (static VALUE): * re.c (Init_Regexp): [ruby-core:24748] git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@24753 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* *regparse.c (CC_DUP_WARN): use rb_compile_warn if ScanEnv has sourcenaruse2009-08-301-15/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | information. [ruby-dev:39105] *re.c (rb_reg_compile): add sourcefile and sourceline to the arguments. *re.c (make_regexp): ditto. *re.c (rb_reg_initialize): ditto. *re.c (rb_reg_initialize_str): ditto. *re.c (rb_reg_compile): ditto. *regcomp.c (onig_compile): ditto. *regint.h (onig_compile): ditto. *re.c (reg_compile_gen): follow above. *re.c (rb_reg_to_s): ditto. *re.c (make_regexp): ditto. *re.c (rb_reg_initialize): ditto. *re.c (rb_reg_initialize_str): ditto. *re.c (rb_reg_new_str): ditto. *re.c (rb_enc_reg_new): ditto. *re.c (rb_reg_initialize_m): ditto. *re.c (rb_reg_init_copy): ditto. *regcomp.c (onig_new): ditto. *regcomp.c (onig_compile): set sourcefile and sourceline to scan_env. *regparse.h (ScanEnv): add sourcefile and sourceline. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@24716 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * re.c (rb_reg_preprocess_dregexp): set encoding as ASCII-8BITnaruse2009-08-271-3/+5
| | | | | | when /n is specified and the embeded string is escaped text. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@24683 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * re.c (rb_reg_preprocess_dregexp): change Exception class tonaruse2009-08-141-1/+1
| | | | | | | | | | RegexpError. * test/ruby/test_m17n.rb (test_regexp_usascii): follow above. * test/ruby/test_m17n.rb (test_regexp_embed): ditto. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@24539 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Fix error message of /.../n with embeded non ASCII-8BIT string.naruse2009-08-051-3/+10
| | | | | | | | | | | | * re.c (rb_reg_preprocess_dregexp): add options to arguments. * re.c (rb_reg_new_ary): follow above. * re.c (rb_reg_preprocess_dregexp): change error message when /.../n has a non escaped non ASCII character in non ASCII-8BIT script. [ruby-dev:38524] git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@24398 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* use rb_enc_get to get the encoding of a Regexp object.naruse2009-07-181-1/+1
| | | | | | | | | * re.c (reg_enc_error): use rb_enc_get to get the encoding of a Regexp object. REGEXP(re)->ptr->enc is the encoding of the regexp engin for patterns and target strings. [ruby-core:23208] git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@24197 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * re.c (reg_match_pos): adjust offset based on characters, notmatz2009-06-301-1/+1
| | | | | | | | | | bytes. [ruby-dev:38722] * string.c (rb_str_offset): new function. * string.c (rb_str_index_m): no call to rb_reg_adjust_startpos(). git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@23916 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * include/ruby/oniguruma.h, include/ruby/re.h, re.c, regcomp.c,nobu2009-06-301-16/+23
| | | | | | | regenc.c, regerror.c, regexec.c, regint.h, regparse.c: use long. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@23907 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * dir.c, dln.c, parse.y, re.c, ruby.c, sprintf.c, strftime.c,nobu2009-03-171-1/+1
| | | | | | | | string.c, util.c, variable.c: use strlcpy, memcpy and snprintf instead of strcpy, strncpy and sprintf. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@22984 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c (rb_str_subpat): accept capture name.akr2009-03-141-0/+5
| | | | | | | | | | | | | | | | | | | (rb_str_aref): follow above change. (rb_str_aref_m): pass the 2nd argument to rb_str_subpat. (rb_str_subpat_set): accept capture name. (rb_str_aset): follow above change. (rb_str_partition): ditto. (rb_str_aset_m): pass the 2nd argument to rb_str_subpat_set. * include/ruby/intern.h (rb_reg_backref_number): declared. * re.c (rb_reg_backref_number): defined. [ruby-core:21057] git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@22959 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * util.c (ruby_scan_oct, ruby_scan_hex): use size_t.nobu2009-03-141-4/+4
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@22957 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* stripped trailing spaces.nobu2009-02-221-10/+10
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@22552 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * re.c (Init_Regexp): define Regexp::FIXEDENCODING. [ruby-dev:38066]akr2009-02-221-0/+1
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@22506 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * re.c (match_array): replace match_check().matz2009-02-031-4/+10
| | | | | | * re.c (match_values_at): ditto. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@21999 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * re.c: use strlcpy for error messages.akr2008-12-161-26/+27
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@20792 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * re.c (reg_enc_error): raise EncodingCompatibilityError formatz2008-12-111-2/+2
| | | | | | | | | encoding incompatibility. [ruby-core:18600] * re.c (rb_reg_prepare_enc): more consistent error message. [ruby-core:18611] git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@20626 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * re.c (rb_reg_initialize): raise RegexpError when encodingnaruse2008-12-101-0/+5
| | | | | | is dummy encoding. [ruby-dev:37091] git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@20603 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * re.c (rb_reg_desc): re might be NULL.matz2008-11-181-1/+1
| | | | | | * regerror.c (onig_error_code_to_format): message updated. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@20243 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * re.c (rb_reg_regsub): returns -1 unless ascii as well asnobu2008-11-151-1/+1
| | | | | | | rb_enc_ascget(). [ruby-dev:37097] git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@20237 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * re.c (unescape_escaped_nonascii): back out the last change onmatz2008-10-221-6/+2
| | | | | | the function. [ruby-dev:36818] git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@19884 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * re.c (rb_reg_initialize_m): specify ARG_ENCODING_NONE instead ofmatz2008-10-181-1/+1
| | | | | | | | | ARG_ENCODING_FIXED for Regexp.new("", nil, "n"). [ruby-dev:36761] * test/ruby/test_regexp.rb (TestRegexp#test_initialize): test updated. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@19832 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * re.c (rb_reg_initialize_m): changed the message to clarify thematz2008-10-161-1/+1
| | | | | | third option argument is now ignored. [ruby-dev:36753] git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@19813 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * .gdbinit (rp): REGEXP handling fixed.matz2008-10-161-2/+6
| | | | | | | | | | * string.c (rb_str_rindex_m): need not to call rb_enc_check on regexp. * re.c (unescape_escaped_nonascii): try ASCII-8BIT encoding for broken strings. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@19812 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* rdoc update.akr2008-10-111-2/+9
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@19757 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * re.c (rb_reg_desc): Regexps of ASCII Compatible encoding maynaruse2008-09-191-2/+6
| | | | | | | contain non-ASCII characters. So in that case its encoding must keep original encoding. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@19433 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * re.c (rb_reg_desc): Regexp#inspect should be US-ASCII.naruse2008-09-161-1/+1
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@19384 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * re.c (rb_reg_quote): use rb_enc_mbcput to generate ASCIIakr2008-09-151-14/+14
| | | | | | | incompatible characters properly. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@19369 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * include/ruby/oniguruma.h (OnigEncodingTypeST): add end argument forakr2008-09-131-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | left_adjust_char_head. (ONIGENC_LEFT_ADJUST_CHAR_HEAD): add end argument. (onigenc_get_left_adjust_char_head): ditto. * include/ruby/encoding.h (rb_enc_left_char_head): add end argument. * regenc.h (onigenc_single_byte_left_adjust_char_head): ditto. * regenc.c (onigenc_get_right_adjust_char_head): follow the interface change. (onigenc_get_right_adjust_char_head_with_prev): ditto. (onigenc_get_prev_char_head): ditto. (onigenc_step_back): ditto. (onigenc_get_left_adjust_char_head): ditto. (onigenc_single_byte_code_to_mbc): ditto. * re.c: ditto. * string.c: ditto. * io.c: ditto. * regexec.c: ditto. * enc/euc_jp.c: ditto. * enc/cp949.c: ditto. * enc/shift_jis.c: ditto. * enc/gbk.c: ditto. * enc/big5.c: ditto. * enc/euc_tw.c: ditto. * enc/euc_kr.c: ditto. * enc/emacs_mule.c: ditto. * enc/gb18030.c: ditto. * enc/utf_8.c: ditto. * enc/utf_16le.c: ditto. * enc/utf_16be.c: ditto. * enc/utf_32le.c: ditto. * enc/utf_32be.c: ditto. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@19334 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * include/ruby/oniguruma.h (onigenc_get_right_adjust_char_head): addakr2008-09-131-1/+1
| | | | | | | | | | | | | | | | | | | end argument. * include/ruby/encoding.h (rb_enc_right_char_head): add end argument. * regenc.c (onigenc_get_right_adjust_char_head): use end argument. * re.c (rb_reg_adjust_startpos): follow the interface change. * string.c (rb_str_index): ditto. * regexec.c (backward_search_range): ditto. (onig_search): ditto. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@19330 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * vm.c (rb_mRubyVMFrozenCore): registered for GC.akr2008-09-081-5/+3
| | | | | | | | | | * re.c (rb_reg_preprocess_dregexp): fix GC problem on MacOS X with powerpc-apple-darwin8-gcc-4.0.1 (GCC) 4.0.1 (Apple Computer, Inc. build 5367). git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@19241 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * re.c (rb_reg_inspect): don't raise for uninitialized Regexp.akr2008-08-181-1/+3
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@18697 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * object.c (rb_obj_untrusted): new method Object#untrusted?.shugo2008-08-131-1/+1
| | | | | | | | | | | | | | | (rb_obj_untrust): new method Object#untrust. (rb_obj_trust): new method Object#trust. * array.c, debug.c, time.c, include/ruby/ruby.h, re.c, variable.c, string.c, io.c, dir.c, vm_method.c, struct.c, class.c, hash.c, ruby.c, marshal.c: fixes for Object#untrusted?. * test/ruby/test_module.rb, test/ruby/test_array.rb, test/ruby/test_object.rb, test/ruby/test_string.rb, test/ruby/test_marshal.rb, test/ruby/test_hash.rb: added tests for Object#untrusted?. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@18568 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * compile.c (insn_data_to_s_detail), file.c (rb_stat_inspect),nobu2008-07-221-3/+1
| | | | | | | | | | | | | | iseq.c (ruby_iseq_disasm_insn, ruby_iseq_disasm), process.c (pst_message), re.c (match_inspect): use rb_str_catf. * dir.c (dir_inspect), iseq.c (iseq_inspect, insn_operand_intern): use rb_sprintf. * error.c (rb_name_error, rb_raise, rb_loaderror, rb_fatal): use rb_vsprintf. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@18158 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * re.c (rb_reg_s_union): useless rb_enc_get call removed to preventakr2008-07-201-1/+1
| | | | | | | SEGV by Regexp.union("", nil). git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@18137 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * re.c (unescape_nonascii): add has_property argument not toakr2008-07-041-3/+9
| | | | | | | | | raise error by /\p{Hiragana}\u{3042}/ in EUC-JP script. (rb_reg_preprocess): use has_property argument to make regexp encoding fixed. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@17884 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * re.c (unescape_nonascii): make regexp fixed_encoding if \p is used.akr2008-07-041-0/+6
| | | | | | | fixed [ruby-core:17279]. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@17882 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * include/ruby/ruby.h (struct RRegexp): new field usecnt. replaceakr2008-06-281-39/+35
| | | | | | | | | | | | | | | | | | | | | str and len by src. * gc.c (gc_mark_children): mark src field of regexp. (obj_free): don't free str field. * re.c (REG_BUSY): removed. (rb_reg_initialize): prohibit re-initialize regexp. (rb_reg_search): use usecnt to prevent freeing regexp currently using. this prevents SEGV by: r = /\A((a.)*(a.)*)*b/ r =~ "ab" + "\xc2\xa1".force_encoding("euc-jp") t = Thread.new { r =~ "ab"*8 + "\xc2\xa1".force_encoding("utf-8")} sleep 0.2 r =~ "ab"*8 + "\xc2\xa1".force_encoding("euc-jp") git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@17635 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * array.c, bignum.c, cont.c, dir.c, dln.c, encoding.c, enumerator.c,ko12008-06-081-1/+1
| | | | | | | | | | | | | | | | | | | enumerator.c (enumerator_allocate), eval_jump.c, file.c, hash.c, io.c, load.c, pack.c, proc.c, random.c, re.c, ruby.c, st.c, string.c, thread.c, thread_pthread.c, time.c, util.c, variable.c, vm.c, gc.c: allocated memory objects by xmalloc (ruby_xmalloc) should be freed by xfree (ruby_xfree). * ext/curses/curses.c, ext/dbm/dbm.c, ext/digest/digest.c, ext/gdbm/gdbm.c, ext/json/ext/parser/parser.c, ext/json/ext/parser/unicode.c, ext/openssl/ossl_cipher.c, ext/openssl/ossl_hmac.c, ext/openssl/ossl_pkey_ec.c, ext/sdbm/init.c, ext/strscan/strscan.c, ext/zlib/zlib.c: ditto. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@17017 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * io.c (rb_f_open), re.c (rb_reg_search), transcode.c (str_transcode):nobu2008-06-071-2/+1
| | | | | | | | | suppress warnings. * util.c (quorem, rv_alloc, nrv_alloc): only used in dtoa(). git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@16873 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * re.c: fix SEGV by Regexp.allocate.names, Match.allocate.names, etc.mame2008-06-021-11/+38
| | | | | | | | | | | * test/ruby/test_regexp.rb: add tests for above. * io.c: fix SEGV by IO.allocate.print, etc. * test/ruby/test_io.rb: add tests for above. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@16757 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * suppress warnings with -Wwrite-string.nobu2008-05-311-1/+1
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@16716 b2dd03c8-39d4-4d8f-98ff-823fe69b080e