aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-03-28 00:56:35 +0000
committernaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-03-28 00:56:35 +0000
commit63dd50961e08172bb88358d95d50efee4c6eead0 (patch)
tree7aa314bf6392150a28f8b8590f0c170dac0c8679
parentc08277c62d4d372288eb0b8f222758542d9168b6 (diff)
downloadruby-63dd50961e08172bb88358d95d50efee4c6eead0.tar.gz
* lib/scanf.rb: fix %[egEFG] isn't accept.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27074 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog4
-rw-r--r--lib/scanf.rb6
-rw-r--r--test/scanf/test_scanf.rb10
3 files changed, 12 insertions, 8 deletions
diff --git a/ChangeLog b/ChangeLog
index 1248486f44..929853c225 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+Sun Mar 28 09:28:33 2010 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * lib/scanf.rb: fix %[egEFG] isn't accept.
+
Sun Mar 28 09:53:02 2010 Tanaka Akira <akr@fsij.org>
* time.c: rename small integer specialization related identifiers.
diff --git a/lib/scanf.rb b/lib/scanf.rb
index 386270b924..ed39a48292 100644
--- a/lib/scanf.rb
+++ b/lib/scanf.rb
@@ -409,11 +409,11 @@ module Scanf
[ "([-+][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 @@ module Scanf
attr_reader :string_left, :last_spec_tried,
:last_match_tried, :matched_count, :space
- SPECIFIERS = 'diuXxofeEgsc'
+ SPECIFIERS = 'diuXxofFeEgGsc'
REGEX = /
# possible space, followed by...
(?:\s*
diff --git a/test/scanf/test_scanf.rb b/test/scanf/test_scanf.rb
index 893b51e736..4526e73641 100644
--- a/test/scanf/test_scanf.rb
+++ b/test/scanf/test_scanf.rb
@@ -270,11 +270,11 @@ module ScanfTests
# 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