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

ruby-changes:25235

From: tenderlove <ko1@a...>
Date: Tue, 23 Oct 2012 06:06:37 +0900 (JST)
Subject: [ruby-changes:25235] tenderlove:r37287 (trunk): * ext/psych/lib/psych/scalar_scanner.rb: Fix scalar_scanner to

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

  New Revision: 37287

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

  Log:
    * ext/psych/lib/psych/scalar_scanner.rb: Fix scalar_scanner to
      understand strings starting with an underscore and containing only
      digits.  Thanks Kelley Reynolds.
    
    * test/psych/test_scalar_scanner.rb: test for fix

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

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 37286)
+++ ChangeLog	(revision 37287)
@@ -1,3 +1,11 @@
+Tue Oct 23 06:04:07 2012  Aaron Patterson <aaron@t...>
+
+	* ext/psych/lib/psych/scalar_scanner.rb: Fix scalar_scanner to
+	  understand strings starting with an underscore and containing only
+	  digits.  Thanks Kelley Reynolds.
+
+	* test/psych/test_scalar_scanner.rb: test for fix
+
 Tue Oct 23 06:00:41 2012  Aaron Patterson <aaron@t...>
 
 	* ext/psych/lib/psych.rb: Changed comment in psych.rb to update new
Index: ext/psych/lib/psych/scalar_scanner.rb
===================================================================
--- ext/psych/lib/psych/scalar_scanner.rb	(revision 37286)
+++ ext/psych/lib/psych/scalar_scanner.rb	(revision 37287)
@@ -24,7 +24,7 @@
       return string if @string_cache.key?(string)
 
       case string
-      when /^[A-Za-z~]/
+      when /^[A-Za-z_~]/
         if string.length > 5
           @string_cache[string] = true
           return string
Index: test/psych/test_scalar_scanner.rb
===================================================================
--- test/psych/test_scalar_scanner.rb	(revision 37286)
+++ test/psych/test_scalar_scanner.rb	(revision 37287)
@@ -87,5 +87,9 @@
     def test_scan_true
       assert_equal true, ss.tokenize('true')
     end
+
+    def test_scan_strings_starting_with_underscores
+      assert_equal "_100", ss.tokenize('_100')
+    end
   end
 end

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

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