ruby-changes:15197
From: naruse <ko1@a...>
Date: Sun, 28 Mar 2010 13:27:03 +0900 (JST)
Subject: [ruby-changes:15197] Ruby:r27077 (trunk): * lib/scanf.rb: fix max width modifier for %f.
naruse 2010-03-28 13:26:42 +0900 (Sun, 28 Mar 2010) New Revision: 27077 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=27077 Log: * lib/scanf.rb: fix max width modifier for %f. Modified files: trunk/ChangeLog trunk/lib/scanf.rb trunk/test/scanf/test_scanf.rb Index: ChangeLog =================================================================== --- ChangeLog (revision 27076) +++ ChangeLog (revision 27077) @@ -1,3 +1,7 @@ +Sun Mar 28 10:03:51 2010 NARUSE, Yui <naruse@r...> + + * lib/scanf.rb: fix max width modifier for %f. + Sun Mar 28 10:35:45 2010 Ryan Davis <ryand-ruby@z...> * lib/minitest/*.rb: Imported minitest 1.6.0 r5717. Index: lib/scanf.rb =================================================================== --- lib/scanf.rb (revision 27076) +++ lib/scanf.rb (revision 27077) @@ -410,11 +410,12 @@ # %f when /%\*?[efgEFG]/ - [ '([-+]?((\d+(?>(?=[^\d.]|$)))|(\d*(\.(\d*([eE][-+]?\d+)?)))))', :extract_float ] + [ '([-+]?(?:\d+(?![\d.])|\d*\.\d*(?:[eE][-+]?\d+)?))', :extract_float ] # %5f when /%\*?(\d+)[efgEFG]/ - [ "(\\S{1,#{$1}})", :extract_float ] + [ '(?=[-+]?(?:\d+(?![\d.])|\d*\.\d*(?:[eE][-+]?\d+)?))' + + "(\\S{1,#{$1}})", :extract_float ] # %5s when /%\*?(\d+)s/ Index: test/scanf/test_scanf.rb =================================================================== --- test/scanf/test_scanf.rb (revision 27076) +++ test/scanf/test_scanf.rb (revision 27077) @@ -269,7 +269,7 @@ [ "%[[:upper:]]", "ABCdefGHI", [ "ABC" ] ], # Testing 'f' - [ "%2f", "x", [0.0] ], # width-floats match anything (by design) + [ "%2f", "x", [] ], [ "%F", "1.23e45", [1.23e+45] ], [ "%e", "3.25ee", [3.25] ], [ "%E", "3..25", [3.0] ], -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/