ruby-changes:27625
From: tadf <ko1@a...>
Date: Sun, 10 Mar 2013 09:19:03 +0900 (JST)
Subject: [ruby-changes:27625] tadf:r39677 (trunk): * complex.c: described syntax of string form.
tadf 2013-03-10 09:18:52 +0900 (Sun, 10 Mar 2013) New Revision: 39677 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=39677 Log: * complex.c: described syntax of string form. * rational.c: ditto. Modified files: trunk/ChangeLog trunk/complex.c trunk/rational.c Index: complex.c =================================================================== --- complex.c (revision 39676) +++ complex.c (revision 39677) @@ -483,6 +483,24 @@ f_complex_new2(VALUE klass, VALUE x, VAL https://github.com/ruby/ruby/blob/trunk/complex.c#L483 * * Complex(1, 2) #=> (1+2i) * Complex('1+2i') #=> (1+2i) + * + * Syntax of string form: + * + * complex = real part | [ sign ] , imaginary part + * | real part , sign , imaginary part + * | rational , "@" , rational ; + * real part = rational ; + * imaginary part = imaginary unit | unsigned rational , imaginary unit ; + * rational = [ sign ] , unsigned rational ; + * unsigned rational = numerator | numerator , "/" , denominator ; + * numerator = integer part | fractional part | integer part , fractional part ; + * denominator = digits ; + * integer part = digits ; + * fractional part = "." , digits , [ ( "e" | "E" ) , [ sign ] , digits ] ; + * imaginary unit = "i" | "I" | "j" | "J" ; + * sign = "-" | "+" ; + * digits = digit , [ { digit | "_" , digit } ] ; + * digit = "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" ; */ static VALUE nucomp_f_complex(int argc, VALUE *argv, VALUE klass) Index: ChangeLog =================================================================== --- ChangeLog (revision 39676) +++ ChangeLog (revision 39677) @@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Sun Mar 10 09:12:51 2013 Tadayoshi Funaba <tadf@d...> + + * complex.c: described syntax of string form. + * rational.c: ditto. + Sat Mar 9 11:58:39 2013 Nobuyoshi Nakada <nobu@r...> * marshal.c (w_extended): check for prepended object. Index: rational.c =================================================================== --- rational.c (revision 39676) +++ rational.c (revision 39677) @@ -571,6 +571,18 @@ f_rational_new_no_reduce2(VALUE klass, V https://github.com/ruby/ruby/blob/trunk/rational.c#L571 * * Rational(1, 2) #=> (1/2) * Rational('1/2') #=> (1/2) + * + * Syntax of string form: + * + * rational = [ sign ] , unsigned rational ; + * unsigned rational = numerator | numerator , "/" , denominator ; + * numerator = integer part | fractional part | integer part , fractional part ; + * denominator = digits ; + * integer part = digits ; + * fractional part = "." , digits , [ ( "e" | "E" ) , [ sign ] , digits ] ; + * sign = "-" | "+" ; + * digits = digit , [ { digit | "_" , digit } ] ; + * digit = "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" ; */ static VALUE nurat_f_rational(int argc, VALUE *argv, VALUE klass) -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/