diff options
Diffstat (limited to 'ext/psych/lib')
-rw-r--r-- | ext/psych/lib/psych/scalar_scanner.rb | 4 |
1 files changed, 3 insertions, 1 deletions
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 |