Граф коммитов

365 Коммитов

Автор SHA1 Сообщение Дата
naruse d078f51f57 * re.c (rb_reg_search): fix: 4th argument should be regexp
object. patched by shintaro kuwamoto [ruby-dev:41667] #3459

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29074 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-08-23 03:32:58 +00:00
nobu 8044ac7b43 * re.c (rb_reg_expr_str): fixed out-of-boundary access at invalid
multibyte characters.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28728 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-07-23 00:02:51 +00:00
naruse 203ebcbb92 * re.c (rb_reg_expr_str): fix broken Regexp#inspect when it
is ASCII-8BIT and non-ASCII character.
  The length of character should be from original byte string.
  [ruby-core:31431]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28715 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-07-22 07:29:32 +00:00
naruse 3a80743ccf * re.c (rb_reg_expr_str): ASCII incompatible strings
must always escape or converted.

* re.c (rb_reg_expr_str): use rb_str_buf_cat_escaped_char
  when resenc is given: for Regexp#inspect or error message.

  * re.c (rb_reg_desc): add 'n' for ENCODING_NONE.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28177 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-06-05 11:32:05 +00:00
naruse 4c897fdde1 * re.c (unescape_nonascii): \P{FOO} is also Unicode regexp. [ruby-core:30540]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28120 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-06-01 14:20:59 +00:00
mame 268f95bdc6 * re.c (rb_reg_s_union_m): update rdoc. [ruby-dev:41354]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27929 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-05-20 13:52:18 +00:00
marcandre 914efd0b60 * proc.c (proc_lambda, unnamed_parameters): Small documentation fixes.
* re.c: ditto

* string.c: ditto

* time.c: ditto

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27867 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-05-17 21:07:46 +00:00
marcandre 7729de4d91 * array.c: Documentation: change => in call-seq to ->.
Harmonize "#=>" in examples. [ruby-core:30206]

* bignum.c: ditto

* class.c: ditto

* compar.c: ditto

* cont.c: ditto

* dir.c: ditto

* encoding.c: ditto

* enum.c: ditto

* enumerator.c: ditto

* error.c: ditto

* eval.c: ditto

* file.c: ditto

* gc.c: ditto

* io.c: ditto

* load.c: ditto

* marshal.c: ditto

* math.c: ditto

* numeric.c: ditto

* object.c: ditto

* pack.c: ditto

* proc.c: ditto

* process.c: ditto

* random.c: ditto

* range.c: ditto

* re.c: ditto

* ruby.c: ditto

* signal.c: ditto

* sprintf.c: ditto

* string.c: ditto

* struct.c: ditto

* thread.c: ditto

* time.c: ditto

* transcode.c: ditto

* variable.c: ditto

* vm_eval.c: ditto

* vm_method.c: ditto

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27865 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-05-17 21:07:33 +00:00
naruse 0e586b35b8 * re.c (rb_reg_initialize_m): fix wrong index for the lang
option's value 'N'. reported by Masaya TARUI via IRC.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27743 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-05-12 01:06:24 +00:00
naruse f65aac7a90 Add description about Regexp(str, opt, lang). [ruby-core:29893]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27738 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-05-11 13:06:54 +00:00
marcandre 1dee5e34a3 * error.c: RDoc for subclasses of Exception. [ruby-core:28394]
* cont.c: ditto

* enumerator.c: ditto

* io.c: ditto

* math.c: ditto

* numeric.c: ditto

* proc.c: ditto

* re.c: ditto

* thread.c: ditto

* transcode.c: ditto. Thanks to Run Paint for some of the documentation.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27671 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-05-08 04:50:09 +00:00
marcandre 478c3e080b * eval.c (make_exception, rb_obj_extend): Fix error messages in case of wrong
number of arguments

* file.c (rb_f_test, rb_file_s_umask): ditto

* numeric.c (int_chr, num_step): ditto

* process.c (rb_f_sleep): ditto

* re.c (rb_reg_initialize_m): ditto

* signal.c (rb_f_kill, sig_trap): ditto

* string.c (rb_str_aref_m, rb_str_aset_m, rb_str_count, rb_str_delete_bang,
  rb_str_slice_bang, rb_str_sub_bang, str_gsub): ditto

* proc.c (curry): rdoc fix

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27558 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-04-30 02:40:57 +00:00
drbrain 1325437297 * lib/rdoc: Import RDoc 2.5.2
* lib/rdoc/parser/ruby.rb (RDoc::Parser::Ruby): Don't parse rdoc
  files, reverts r24976 in favor of include directive support in C
  parser.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27283 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-04-10 06:36:13 +00:00
naruse 500c78c610 * re.c (make_regexp): use onig_new_with_source to keep
sourcefile and sourceline.

* re.c (onig_new_with_source): copied from onig_new in
  regcomp.c for keep sourcefile and sourceline.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27225 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-04-05 10:57:38 +00:00
naruse 10317605f0 * re.c (rb_reg_to_s): remove unused variable.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26854 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-03-09 05:56:39 +00:00
matz db37773e13 * include/ruby/oniguruma.h: updated to follow Oniguruma 5.9.2.
* re.c (make_regexp): use onig_new() instead of onig_alloc_init().

* re.c (rb_reg_to_s): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26791 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-03-01 21:54:59 +00:00
nobu 27e492bec7 * marshal.c (r_object0): register regexp object before encoding
name.  [ruby-dev:40414]

* re.c (rb_reg_alloc, rb_reg_init_str): split from rb_reg_new_str.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26661 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-02-13 19:45:35 +00:00
nobu be0197054c * re.c (match_aref): fixed indent.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26660 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-02-13 19:31:42 +00:00
nobu 4d786d21e3 * removed spaces just before tabs.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25930 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-11-26 05:25:08 +00:00
naruse 331fdbe822 * re.c (last_match): add "thread and method" to the scope.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25168 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-09-30 01:08:44 +00:00
marcandre b59109a844 * re.c (last_match): Added note to the doc that last_match is local to current scope [ruby-core:25833]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25165 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-09-29 16:38:00 +00:00
naruse 63c7ca40d8 * doc/re.rb: New document for Ruby's fork of Oniguruma.
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: svn+ssh://ci.ruby-lang.org/ruby/trunk@24973 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-09-17 00:40:49 +00:00
naruse e13ca98198 * parse.y (rb_char_to_option_kcode): ASCII-8BIT should also delay.
* re.c (parser_regx_options): return rb_ascii8bit_encindex on
  ASCII-8BIT. [ruby-dev:39300]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24832 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-09-10 17:07:38 +00:00
nobu bbd9c406d6 * re.c (rb_reg_hash): must calculate hash.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24793 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-09-08 13:11:32 +00:00
nobu 31b7ae00c0 * include/ruby/st.h (st_hash_func): use st_index_t.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24792 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-09-08 13:10:04 +00:00
nobu 7b9024f740 * re.c (Init_Regexp): new methods. [ruby-core:24748]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24755 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-09-05 00:33:54 +00:00
nobu 605e7d4a60 * re.c (update_char_offset): position should be long.
* 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: svn+ssh://ci.ruby-lang.org/ruby/trunk@24754 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-09-04 23:51:44 +00:00
nobu 7633eb4c51 * re.c (update_char_offset):
* 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: svn+ssh://ci.ruby-lang.org/ruby/trunk@24753 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-09-04 23:49:18 +00:00
naruse 6ab36c6e19 *regparse.c (CC_DUP_WARN): use rb_compile_warn if ScanEnv has source
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: svn+ssh://ci.ruby-lang.org/ruby/trunk@24716 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-08-30 08:00:31 +00:00
naruse a20bd463a8 * re.c (rb_reg_preprocess_dregexp): set encoding as ASCII-8BIT
when /n is specified and the embeded string is escaped text.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24683 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-08-27 06:10:30 +00:00
naruse 4155811dc1 * re.c (rb_reg_preprocess_dregexp): change Exception class to
RegexpError.

* test/ruby/test_m17n.rb (test_regexp_usascii): follow above.

* test/ruby/test_m17n.rb (test_regexp_embed): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24539 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-08-14 09:05:44 +00:00
naruse 88c0b8fec9 Fix error message of /.../n with embeded non ASCII-8BIT string.
* 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: svn+ssh://ci.ruby-lang.org/ruby/trunk@24398 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-08-05 01:38:36 +00:00
naruse acbb181219 use rb_enc_get to get the encoding of a Regexp object.
* 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: svn+ssh://ci.ruby-lang.org/ruby/trunk@24197 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-07-18 15:00:50 +00:00
matz 5d7a215f6e * re.c (reg_match_pos): adjust offset based on characters, not
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: svn+ssh://ci.ruby-lang.org/ruby/trunk@23916 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-06-30 09:06:48 +00:00
nobu 23a32d6444 * include/ruby/oniguruma.h, include/ruby/re.h, re.c, regcomp.c,
regenc.c, regerror.c, regexec.c, regint.h, regparse.c: use long.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23907 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-06-30 02:08:54 +00:00
nobu 22cde7b682 * dir.c, dln.c, parse.y, re.c, ruby.c, sprintf.c, strftime.c,
string.c, util.c, variable.c: use strlcpy, memcpy and snprintf
  instead of strcpy, strncpy and sprintf.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22984 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-03-17 01:29:17 +00:00
akr f414bd65ae * string.c (rb_str_subpat): accept capture name.
(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: svn+ssh://ci.ruby-lang.org/ruby/trunk@22959 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-03-14 18:04:21 +00:00
nobu 4de12b6ae9 * util.c (ruby_scan_oct, ruby_scan_hex): use size_t.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22957 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-03-14 09:25:20 +00:00
nobu 12d2c8ba41 stripped trailing spaces.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22552 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-22 14:23:33 +00:00
akr af7d8584c5 * re.c (Init_Regexp): define Regexp::FIXEDENCODING. [ruby-dev:38066]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22506 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-22 06:12:21 +00:00
matz 1c400db1d5 * re.c (match_array): replace match_check().
* re.c (match_values_at): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21999 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-03 05:20:27 +00:00
akr ce17decdfb * re.c: use strlcpy for error messages.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20792 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-12-16 10:44:36 +00:00
matz 3060c7438d * re.c (reg_enc_error): raise EncodingCompatibilityError for
encoding incompatibility.  [ruby-core:18600]

* re.c (rb_reg_prepare_enc): more consistent error message.
  [ruby-core:18611]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20626 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-12-11 04:40:08 +00:00
naruse d433a70b5d * re.c (rb_reg_initialize): raise RegexpError when encoding
is dummy encoding. [ruby-dev:37091]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20603 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-12-10 02:29:05 +00:00
matz 4ccfa1e9f8 * re.c (rb_reg_desc): re might be NULL.
* regerror.c (onig_error_code_to_format): message updated.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20243 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-11-18 06:51:19 +00:00
nobu 316b78a56d * re.c (rb_reg_regsub): returns -1 unless ascii as well as
rb_enc_ascget().  [ruby-dev:37097]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20237 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-11-15 13:46:52 +00:00
matz 1d38a821ea * re.c (unescape_escaped_nonascii): back out the last change on
the function.  [ruby-dev:36818]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19884 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-10-22 04:27:32 +00:00
matz fcce99c52d * re.c (rb_reg_initialize_m): specify ARG_ENCODING_NONE instead of
ARG_ENCODING_FIXED for Regexp.new("", nil, "n").  [ruby-dev:36761]

* test/ruby/test_regexp.rb (TestRegexp#test_initialize): test
  updated.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19832 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-10-18 10:29:06 +00:00
matz 98e6f9a79c * re.c (rb_reg_initialize_m): changed the message to clarify the
third option argument is now ignored.  [ruby-dev:36753]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19813 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-10-16 22:39:04 +00:00
matz 1e8bbf3154 * .gdbinit (rp): REGEXP handling fixed.
* 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: svn+ssh://ci.ruby-lang.org/ruby/trunk@19812 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-10-16 22:21:42 +00:00