[前][次][番号順一覧][スレッド一覧]

ruby-changes:15194

From: naruse <ko1@a...>
Date: Sun, 28 Mar 2010 09:56:56 +0900 (JST)
Subject: [ruby-changes:15194] Ruby:r27074 (trunk): * lib/scanf.rb: fix %[egEFG] isn't accept.

naruse	2010-03-28 09:56:35 +0900 (Sun, 28 Mar 2010)

  New Revision: 27074

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=27074

  Log:
    * lib/scanf.rb: fix %[egEFG] isn't accept.

  Modified files:
    trunk/ChangeLog
    trunk/lib/scanf.rb
    trunk/test/scanf/test_scanf.rb

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 27073)
+++ ChangeLog	(revision 27074)
@@ -1,3 +1,7 @@
+Sun Mar 28 09:28:33 2010  NARUSE, Yui  <naruse@r...>
+
+	* lib/scanf.rb: fix %[egEFG] isn't accept.
+
 Sun Mar 28 09:53:02 2010  Tanaka Akira  <akr@f...>
 
 	* time.c: rename small integer specialization related identifiers.
Index: lib/scanf.rb
===================================================================
--- lib/scanf.rb	(revision 27073)
+++ lib/scanf.rb	(revision 27074)
@@ -409,11 +409,11 @@
           [ "([-+][0-7]{1,#{$1.to_i-1}}|[0-7]{1,#{$1}})", :extract_octal ]
 
           # %f
-        when /%\*?f/
+        when /%\*?[efgEFG]/
           [ '([-+]?((\d+(?>(?=[^\d.]|$)))|(\d*(\.(\d*([eE][-+]?\d+)?)))))', :extract_float ]
 
           # %5f
-        when /%\*?(\d+)f/
+        when /%\*?(\d+)[efgEFG]/
           [ "(\\S{1,#{$1}})", :extract_float ]
 
           # %5s
@@ -490,7 +490,7 @@
     attr_reader :string_left, :last_spec_tried,
                 :last_match_tried, :matched_count, :space
 
-    SPECIFIERS = 'diuXxofeEgsc'
+    SPECIFIERS = 'diuXxofFeEgGsc'
     REGEX = /
         # possible space, followed by...
           (?:\s*
Index: test/scanf/test_scanf.rb
===================================================================
--- test/scanf/test_scanf.rb	(revision 27073)
+++ test/scanf/test_scanf.rb	(revision 27074)
@@ -270,11 +270,11 @@
 
 # Testing 'f'
       [ "%2f", "x", [0.0] ],  # width-floats match anything (by design)
-      [ "%f", "1.23e45", [1.23e+45] ],
-      [ "%f", "3.25ee", [3.25] ],
-      [ "%f", "3..25", [3.0] ],
-      [ "%f", "+3.25", [3.25] ],
-      [ "%f", "+3.25e2", [325.0] ],
+      [ "%F", "1.23e45", [1.23e+45] ],
+      [ "%e", "3.25ee", [3.25] ],
+      [ "%E", "3..25", [3.0] ],
+      [ "%g", "+3.25", [3.25] ],
+      [ "%G", "+3.25e2", [325.0] ],
       [ "%f", "3.z", [3.0] ],
 
 # Testing embedded matches including literal '[' behavior

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]