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

ruby-changes:28117

From: nagachika <ko1@a...>
Date: Sun, 7 Apr 2013 03:07:20 +0900 (JST)
Subject: [ruby-changes:28117] nagachika:r40169 (ruby_2_0_0): merge revision(s) 39858: [Backport #8135]

nagachika	2013-04-07 03:07:04 +0900 (Sun, 07 Apr 2013)

  New Revision: 40169

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

  Log:
    merge revision(s) 39858: [Backport #8135]
    
    * parse.y (simple_re_meta): escape all closing characters, not only
      round parenthesis.  [ruby-core:53578] [Bug #8133]

  Modified directories:
    branches/ruby_2_0_0/
  Modified files:
    branches/ruby_2_0_0/ChangeLog
    branches/ruby_2_0_0/parse.y
    branches/ruby_2_0_0/test/ruby/test_regexp.rb
    branches/ruby_2_0_0/version.h

Index: ruby_2_0_0/ChangeLog
===================================================================
--- ruby_2_0_0/ChangeLog	(revision 40168)
+++ ruby_2_0_0/ChangeLog	(revision 40169)
@@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/ChangeLog#L1
+Sun Apr  7 03:01:49 2013  Nobuyoshi Nakada  <nobu@r...>
+
+	* parse.y (simple_re_meta): escape all closing characters, not only
+	  round parenthesis.  [ruby-core:53578] [Bug #8133]
+
 Sun Apr  7 02:54:40 2013  Narihiro Nakamura  <authornari@g...>
 
 	* gc.c: Improve accuracy of objspace_live_num() and
Index: ruby_2_0_0/parse.y
===================================================================
--- ruby_2_0_0/parse.y	(revision 40168)
+++ ruby_2_0_0/parse.y	(revision 40169)
@@ -5974,7 +5974,7 @@ simple_re_meta(int c) https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/parse.y#L5974
     switch (c) {
       case '$': case '*': case '+': case '.':
       case '?': case '^': case '|':
-      case ')':
+      case ')': case ']': case '}': case '>':
 	return TRUE;
       default:
 	return FALSE;
Index: ruby_2_0_0/version.h
===================================================================
--- ruby_2_0_0/version.h	(revision 40168)
+++ ruby_2_0_0/version.h	(revision 40169)
@@ -1,6 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/version.h#L1
 #define RUBY_VERSION "2.0.0"
 #define RUBY_RELEASE_DATE "2013-04-07"
-#define RUBY_PATCHLEVEL 108
+#define RUBY_PATCHLEVEL 109
 
 #define RUBY_RELEASE_YEAR 2013
 #define RUBY_RELEASE_MONTH 4
Index: ruby_2_0_0/test/ruby/test_regexp.rb
===================================================================
--- ruby_2_0_0/test/ruby/test_regexp.rb	(revision 40168)
+++ ruby_2_0_0/test/ruby/test_regexp.rb	(revision 40169)
@@ -180,9 +180,15 @@ class TestRegexp < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/test/ruby/test_regexp.rb#L180
   end
 
   def test_source_escaped_paren
-    bug7610 = '[ruby-core:51088]'
-    s = '\(a\)'
-    assert_equal(/#{s}/, eval("%r(#{s})"), bug7610)
+    bug7610 = '[ruby-core:51088] [Bug #7610]'
+    bug8133 = '[ruby-core:53578] [Bug #8133]'
+    [
+     ["(", ")", bug7610], ["[", "]", bug8133],
+     ["{", "}", bug8133], ["<", ">", bug8133],
+    ].each do |lparen, rparen, bug|
+      s = "\\#{lparen}a\\#{rparen}"
+      assert_equal(/#{s}/, eval("%r#{lparen}#{s}#{rparen}"), bug)
+    end
   end
 
   def test_source_unescaped

Property changes on: ruby_2_0_0
___________________________________________________________________
Modified: svn:mergeinfo
   Merged /trunk:r39858


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

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