aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortenderlove <tenderlove@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-10-22 21:24:36 +0000
committertenderlove <tenderlove@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-10-22 21:24:36 +0000
commitca0cf1673409cae3f8425d6235dbcce9709fa61b (patch)
treea9b2db78df55f1f0d31b53310960ac8319a6867d
parentb3fb872d9db31d752aeefdb62b7ea928b9cadc42 (diff)
downloadruby-ca0cf1673409cae3f8425d6235dbcce9709fa61b.tar.gz
* ext/psych/lib/psych/scalar_scanner.rb: Updated the RegExp to catch
Strings earlier in the tokenization process. Thanks Kevin Menard! git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37290 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog5
-rw-r--r--ext/psych/lib/psych/scalar_scanner.rb4
2 files changed, 8 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index f39e0e9188..14471439d9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Tue Oct 23 06:15:40 2012 Aaron Patterson <aaron@tenderlovemaking.com>
+
+ * ext/psych/lib/psych/scalar_scanner.rb: Updated the RegExp to catch
+ Strings earlier in the tokenization process. Thanks Kevin Menard!
+
Tue Oct 23 06:12:39 2012 Aaron Patterson <aaron@tenderlovemaking.com>
* ext/psych/lib/psych/visitors/to_ruby.rb: Handle nil tags specially
diff --git a/ext/psych/lib/psych/scalar_scanner.rb b/ext/psych/lib/psych/scalar_scanner.rb
index ce4b767082..9130746347 100644
--- a/ext/psych/lib/psych/scalar_scanner.rb
+++ b/ext/psych/lib/psych/scalar_scanner.rb
@@ -24,7 +24,9 @@ module Psych
return string if @string_cache.key?(string)
case string
- when /^[A-Za-z_~]/
+ # Check for a String type, being careful not to get caught by hash keys, hex values, and
+ # special floats (e.g., -.inf).
+ when /^[^\d\.:-]?[A-Za-z_\s!@#\$%\^&\*\(\)\{\}\<\>\|\/\\~;=]+/
if string.length > 5
@string_cache[string] = true
return string