Skip to content

Commit

Permalink
* ext/psych/lib/psych/scalar_scanner.rb: Updated the RegExp to catch
Browse files Browse the repository at this point in the history
  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
  • Loading branch information
tenderlove committed Oct 22, 2012
1 parent b3fb872 commit ca0cf16
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
5 changes: 5 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
Tue Oct 23 06:15:40 2012 Aaron Patterson <[email protected]>

* 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 <[email protected]>

* ext/psych/lib/psych/visitors/to_ruby.rb: Handle nil tags specially
Expand Down
4 changes: 3 additions & 1 deletion ext/psych/lib/psych/scalar_scanner.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ def tokenize string
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
Expand Down

0 comments on commit ca0cf16

Please sign in to comment.