summaryrefslogtreecommitdiffstats
path: root/lib/yaml
diff options
context:
space:
mode:
authorwhy <why@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-06-17 16:55:54 +0000
committerwhy <why@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-06-17 16:55:54 +0000
commit1a2900e232d02462aeb51e1aa10a6e7731c07a27 (patch)
tree718fc605c85aa7d3c2b05fbfbc46c41320b74db9 /lib/yaml
parentd0ba5ecff28f3c13445e29795a322f5576bacbee (diff)
downloadruby-1a2900e232d02462aeb51e1aa10a6e7731c07a27.tar.gz
ruby-1a2900e232d02462aeb51e1aa10a6e7731c07a27.tar.xz
ruby-1a2900e232d02462aeb51e1aa10a6e7731c07a27.zip
* ext/syck/gram.c: added grammar for certain empty sequence entries.
* ext/syck/handler.c, ext/syck/syck.c, ext/syck/syck.h: track bad anchors. * ext/syck/token.c: added pause token, tag possible circular references. * lib/yaml/rubytypes.rb: parsing YMD time as Date instance. * ext/syck/rubyext.c: ditto. DomainType, PrivateType, BadAlias classes. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@3954 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/yaml')
-rw-r--r--lib/yaml/rubytypes.rb12
1 files changed, 2 insertions, 10 deletions
diff --git a/lib/yaml/rubytypes.rb b/lib/yaml/rubytypes.rb
index b2ac61584..2597c86a5 100644
--- a/lib/yaml/rubytypes.rb
+++ b/lib/yaml/rubytypes.rb
@@ -451,17 +451,9 @@ class Time
end
end
-YAML.add_builtin_type( 'time' ) { |type, val|
- if val =~ /\A(\d{4})\-(\d{1,2})\-(\d{1,2})[Tt](\d{2})\:(\d{2})\:(\d{2})(\.\d{1,2})?(Z|[-+][0-9][0-9](?:\:[0-9][0-9])?)\Z/
- YAML.mktime( *$~.to_a[1,8] )
- elsif val =~ /\A(\d{4})\-(\d{1,2})\-(\d{1,2})[ \t]+(\d{2})\:(\d{2})\:(\d{2})(\.\d+)?[ \t]+(Z|[-+][0-9][0-9](?:\:[0-9][0-9])?)\Z/
- YAML.mktime( *$~.to_a[1,8] )
- elsif val =~ /\A(\d{4})\-(\d{1,2})\-(\d{1,2})[ \t]+(\d{2})\:(\d{2})\:(\d{2})(\.\d{1,2})?\Z/
- YAML.mktime( *$~.to_a[1,7] )
- elsif val =~ /\A(\d{4})\-(\d{1,2})\-(\d{1,2})\Z/
+YAML.add_builtin_type( 'time#ymd' ) { |type, val|
+ if val =~ /\A(\d{4})\-(\d{1,2})\-(\d{1,2})\Z/
Date.new($1.to_i, $2.to_i, $3.to_i)
- elsif type == :Implicit
- :InvalidType
else
raise YAML::TypeError, "Invalid !time string: " + val.inspect
end