From 79133371e8abb1a7cbdd24b3c62ce04d7227c4b0 Mon Sep 17 00:00:00 2001 From: nobu Date: Sat, 15 May 2004 04:38:39 +0000 Subject: * ext/syck/MANIFEST, ext/syck/depend: new file. * lib/yaml/rubytypes.rb: range of exponential floats. [ruby-core:02824] * test/yaml/test_yaml.rb: tests for strings start with colon and some round trip. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@6318 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- lib/yaml/rubytypes.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'lib/yaml') diff --git a/lib/yaml/rubytypes.rb b/lib/yaml/rubytypes.rb index 1f7f49633c..239688a6b2 100644 --- a/lib/yaml/rubytypes.rb +++ b/lib/yaml/rubytypes.rb @@ -371,7 +371,7 @@ end symbol_proc = Proc.new { |type, val| if String === val - val = YAML::load( "--- #{val}") if val =~ /^["'].*["']$/ + val = YAML::load( "--- #{val}") if val =~ /^["'].*['"]$/ val.intern else raise YAML::Error, "Invalid Symbol: " + val.inspect @@ -414,9 +414,9 @@ end YAML.add_ruby_type( /^range/ ) { |type, val| type, obj_class = YAML.read_type_class( type, ::Range ) - inr = '(\w+|[+-]*\d+(?:\.\d+)?|"(?:[^\\"]|\\.)*")' + inr = %r'(\w+|[+-]?\d+(?:\.\d+)?(?:e[+-]\d+)?|"(?:[^\\"]|\\.)*")' opts = {} - if String === val and val =~ /^#{inr}(\.{2,3})#{inr}$/ + if String === val and val =~ /^#{inr}(\.{2,3})#{inr}$/o r1, rdots, r2 = $1, $2, $3 opts = { 'begin' => YAML.load( "--- #{r1}" ), -- cgit v1.2.3