[前][次][番号順一覧][スレッド一覧]

ruby-changes:25238

From: tenderlove <ko1@a...>
Date: Tue, 23 Oct 2012 06:24:49 +0900 (JST)
Subject: [ruby-changes:25238] tenderlove:r37290 (trunk): * ext/psych/lib/psych/scalar_scanner.rb: Updated the RegExp to catch

tenderlove	2012-10-23 06:24:36 +0900 (Tue, 23 Oct 2012)

  New Revision: 37290

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=37290

  Log:
    * ext/psych/lib/psych/scalar_scanner.rb: Updated the RegExp to catch
      Strings earlier in the tokenization process.  Thanks Kevin Menard!

  Modified files:
    trunk/ChangeLog
    trunk/ext/psych/lib/psych/scalar_scanner.rb

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 37289)
+++ ChangeLog	(revision 37290)
@@ -1,3 +1,8 @@
+Tue Oct 23 06:15:40 2012  Aaron Patterson <aaron@t...>
+
+	* 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@t...>
 
 	* ext/psych/lib/psych/visitors/to_ruby.rb: Handle nil tags specially
Index: ext/psych/lib/psych/scalar_scanner.rb
===================================================================
--- ext/psych/lib/psych/scalar_scanner.rb	(revision 37289)
+++ ext/psych/lib/psych/scalar_scanner.rb	(revision 37290)
@@ -24,7 +24,9 @@
       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

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]