[#11952] NORETURN — "Nobuyoshi.Nakada" <nobu.nakada@...>

なかだです。

24 messages 2001/01/10
[#11956] Re: NORETURN — WATANABE Hirofumi <eban@...> 2001/01/10

わたなべです.

[#11957] Re: NORETURN — matz@... (Yukihiro Matsumoto) 2001/01/10

まつもと ゆきひろです

[#11958] Re: NORETURN — WATANABE Hirofumi <eban@...> 2001/01/10

わたなべです.

[#11959] CVS branches (Re: Re: NORETURN) — matz@... (Yukihiro Matsumoto) 2001/01/10

[#12087] string#index, gsub, []= のバグ? — Beyond <beyond@...>

18 messages 2001/01/27
[#12091] Re: string#index, gsub, []= のバグ? — matz@... (Yukihiro Matsumoto) 2001/01/27

まつもと ゆきひろです

[ruby-dev:12021] Re: [BUG] Regexp.last_match(nth)

From: Koji Arai <JCA02266@...>
Date: 2001-01-14 22:00:03 UTC
List: ruby-dev #12021
新井です。

> 新井です。
> 
> ruby 1.7 の Regexp.last_match がSEGVします

ありゃ?もしかしてこう?(でないと非互換)

/(.)(.)(.)/ =~ "abc" 
p Regexp.last_match      # => #<MatchData:0x40198810>
p Regexp.last_match(0)   # => "abc"
p Regexp.last_match(1)   # => "a"
p Regexp.last_match(2)   # => "b"
p Regexp.last_match(3)   # => "c"
p Regexp.last_match(4)   # => nil

# 以下のパッチだとコンパイル時にwarning出ます。すいません

Index: re.c
===================================================================
RCS file: /ruby/ruby/re.c,v
retrieving revision 1.36
diff -u -r1.36 re.c
--- re.c	2001/01/13 10:47:12	1.36
+++ re.c	2001/01/14 21:49:28
@@ -734,9 +734,9 @@
     VALUE nth;
 
     if (rb_scan_args(argc, argv, "01", &nth) == 1) {
-	rb_reg_nth_match(NUM2INT(nth), rb_backref_get());
+	return rb_reg_nth_match(NUM2INT(nth), rb_backref_get());
     }
-    return rb_reg_last_match(rb_backref_get());
+    return match_getter();
 }
 
 static VALUE
@@ -1366,7 +1366,7 @@
     rb_define_singleton_method(rb_cRegexp, "compile", rb_reg_s_new, -1);
     rb_define_singleton_method(rb_cRegexp, "quote", rb_reg_s_quote, -1);
     rb_define_singleton_method(rb_cRegexp, "escape", rb_reg_s_quote, -1);
-    rb_define_singleton_method(rb_cRegexp, "last_match", rb_reg_s_last_match, 0);
+    rb_define_singleton_method(rb_cRegexp, "last_match", rb_reg_s_last_match, -1);
 
     rb_define_method(rb_cRegexp, "initialize", rb_reg_initialize_m, -1);
     rb_define_method(rb_cRegexp, "clone", rb_reg_clone, 0);

In This Thread