Commit Graph

16 Commits

Author SHA1 Message Date
akr 64bc558cc5 add a test for [ruby-dev:32675] reported by Keita Yamaguchi.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14510 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-23 02:22:27 +00:00
akr 5c71aadbed add a test.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14413 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-21 07:08:52 +00:00
akr 2d01290cfd * parse.y (arg tMATCH arg): call reg_named_capture_assign_gen if regexp
literal is used.
  (reg_named_capture_assign_gen): assign the result of named capture
  into local variables.
  [ruby-dev:32588]

* re.c: document the assignment by named captures.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14297 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-18 11:26:24 +00:00
akr f4592d7bb0 * re.c (rb_reg_expr_str): use \xHH instead of \OOO.
* regerror.c (to_ascii): ditto.
  (onig_snprintf_with_pattern): ditto.
  (onig_snprintf_with_pattern): ditto.

* string.c (rb_str_inspect): ditto.
  (rb_str_dump): ditto.

* parse.y (parser_yylex): ditto.

* ruby.c (proc_options): ditto.

* file.c (rb_f_test): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14164 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-09 21:48:05 +00:00
akr 08eb58d3dd * re.c (rb_reg_names): new method Regexp#names.
(rb_reg_named_captures): new method Regexp#named_captures
  (match_regexp): new method MatchData#regexp.
  (match_names): new method MatchData#names.

* lib/pp.rb (MatchData#pretty_print): show names of named captures.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14163 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-09 21:44:19 +00:00
akr e56e8c758d * re.c (rb_reg_s_last_match): accept named capture's name.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14161 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-09 13:35:38 +00:00
akr 7a7c26be73 document named capture of MatchData#{offset,begin,end,inspect}.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14159 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-09 07:35:54 +00:00
akr 18d8fbac54 * re.c (match_backref_number): new function for converting a backref
name/number to an integer.
  (match_offset): use match_backref_number.
  (match_begin): ditto.
  (match_end): ditto.
  (name_to_backref_number): raise IndexError instead of RuntimeError.
  (match_inspect): show capture index.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14158 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-09 07:12:44 +00:00
akr f1b7e60cb9 * encoding.c (rb_enc_mbclen): make it never fail.
(rb_enc_nth): don't check the return value of rb_enc_mbclen.
  (rb_enc_strlen): ditto.
  (rb_enc_precise_mbclen): return needmore(1) if e <= p.
  (rb_enc_get_ascii): new function for extracting ASCII character.

* include/ruby/encoding.h (rb_enc_get_ascii): declared.

* include/ruby/regex.h (ismbchar): removed.

* re.c (rb_reg_expr_str): use rb_enc_get_ascii.
  (unescape_escaped_nonascii): use rb_enc_precise_mbclen to determine
  the termination of escaped non-ASCII character.
  (unescape_nonascii): use rb_enc_precise_mbclen.
  (rb_reg_quote): use rb_enc_get_ascii.
  (rb_reg_regsub): use rb_enc_get_ascii.

* string.c (rb_str_reverse) don't check the return value of
  rb_enc_mbclen.
  (rb_str_split_m): don't call rb_enc_mbclen with e <= p.

* parse.y (is_identchar): use ISASCII.
  (parser_ismbchar): removed.
  (parser_precise_mbclen): new macro.
  (parser_isascii): new macro.
  (parser_tokadd_mbchar): use parser_precise_mbclen to check invalid
  character precisely.
  (parser_tokadd_string): use parser_isascii.
  (parser_yylex): ditto.
  (is_special_global_name): don't call is_identchar with e <= p.
  (rb_enc_symname_p): ditto.

  [ruby-dev:32455]

* ext/tk/sample/tkextlib/vu/canvSticker2.rb: remove coding cookie
  because the encoding is not UTF-8.  [ruby-dev:32475]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14131 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-08 02:50:43 +00:00
ko1 9c7aab17a5 * eval.c (rb_method_missing): fix stack trace.
* bootstraptest/test_knownbug.rb: move solved tests.
* bootstraptest/test_method.rb, test/ruby/test_regexp.rb: ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14026 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-11-27 01:47:34 +00:00
ko1 1e4278c98d * bootstraptest/test_knownbug.rb: move solved tests.
* bootstraptest/test_io.rb, test_marshal.rb, test_objectspace.rb:
  ditto.
* test/ruby/test_integer.rb, test_regexp.rb: ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14005 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-11-23 08:33:32 +00:00
tadf cbc22bf9bd added an assertion.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12872 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-08-05 04:06:08 +00:00
ksaito 09542e3269 * regparse.c, test/ruby/test_regexp.rb: fixed problem with UTF-8 characters that have U+00FE or invalid characters.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@7398 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-11-28 03:09:13 +00:00
ksaito 5fb312bd18 * regexec.c, test/ruby/test_regexp.rb: fixed segmentation falut ([ruby-dev:24887]).
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@7397 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-11-28 03:07:48 +00:00
akr 7dc3169658 add a test for a problem of [ruby-talk:116455]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@7142 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-10-29 23:22:57 +00:00
akr 1bc4363c5e add test for [ruby-dev:24643].
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@7141 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-10-29 22:45:13 +00:00