From ec9eabc6c2df764c2c51e72e23bb7512bb77d965 Mon Sep 17 00:00:00 2001 From: tadf Date: Sun, 10 Mar 2013 00:18:52 +0000 Subject: * complex.c: described syntax of string form. * rational.c: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39677 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- rational.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'rational.c') diff --git a/rational.c b/rational.c index a78b3202ec..e5992ed76f 100644 --- a/rational.c +++ b/rational.c @@ -571,6 +571,18 @@ f_rational_new_no_reduce2(VALUE klass, VALUE x, VALUE y) * * 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) -- cgit v1.2.3