ruby-changes:5560
From: tadf <ko1@a...>
Date: Tue, 10 Jun 2008 00:19:13 +0900 (JST)
Subject: [ruby-changes:5560] Ruby:r17064 (trunk): fixed
tadf 2008-06-10 00:13:45 +0900 (Tue, 10 Jun 2008) New Revision: 17064 Modified files: trunk/complex.c trunk/rational.c Log: fixed http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/complex.c?r1=17064&r2=17063&diff_format=u http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/rational.c?r1=17064&r2=17063&diff_format=u Index: complex.c =================================================================== --- complex.c (revision 17063) +++ complex.c (revision 17064) @@ -1132,7 +1132,7 @@ #define DENOMINATOR "[-+]?" DIGITS #define NUMBER "[-+]?" NUMERATOR "(?:\\/" DENOMINATOR ")?" #define NUMBERNOS NUMERATOR "(?:\\/" DENOMINATOR ")?" -#define PATTERN1 "\\A(" NUMBER "|\\(" NUMBER "\\))?[iIjJ]" +#define PATTERN1 "\\A((" NUMBER ")|\\((" NUMBER ")\\))?[iIjJ]" #define PATTERN2 "\\A(" NUMBER ")(([-+])(?:(" NUMBERNOS ")|\\((" NUMBER ")\\))?[iIjJ])?" static void @@ -1209,7 +1209,12 @@ sr = Qnil; si = f_aref(m, INT2FIX(1)); if (NIL_P(si)) - si = rb_str_new2("1"); + si = rb_str_new2("1"); + else { + si = f_aref(m, INT2FIX(2)); + if (NIL_P(si)) + si = f_aref(m, INT2FIX(3)); + } re = f_post_match(m); } if (NIL_P(m)) { @@ -1218,17 +1223,17 @@ return rb_assoc_new(Qnil, self); sr = f_aref(m, INT2FIX(1)); if (NIL_P(f_aref(m, INT2FIX(2)))) - si = Qnil; + si = Qnil; else { - VALUE t; + VALUE t; - si = f_aref(m, INT2FIX(3)); - t = f_aref(m, INT2FIX(4)); - if (NIL_P(t)) - t = f_aref(m, INT2FIX(5)); - if (NIL_P(t)) - t = rb_str_new2("1"); - rb_str_concat(si, t); + si = f_aref(m, INT2FIX(3)); + t = f_aref(m, INT2FIX(4)); + if (NIL_P(t)) + t = f_aref(m, INT2FIX(5)); + if (NIL_P(t)) + t = rb_str_new2("1"); + rb_str_concat(si, t); } re = f_post_match(m); } Index: rational.c =================================================================== --- rational.c (revision 17063) +++ rational.c (revision 17064) @@ -1422,8 +1422,9 @@ { VALUE a1, a2; - if (rb_scan_args(argc, argv, "02", &a1, &a2) == 1) - a2 = ONE; + a1 = Qnil; + a2 = Qnil; + rb_scan_args(argc, argv, "02", &a1, &a2); switch (TYPE(a1)) { case T_COMPLEX: -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/