зеркало из https://github.com/github/ruby.git
* 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
This commit is contained in:
Родитель
c08277c62d
Коммит
63dd50961e
|
@ -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.
|
||||
|
|
|
@ -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*
|
||||
|
|
|
@ -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
|
||||
|
|
Загрузка…
Ссылка в новой задаче