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

ruby-changes:26612

From: nobu <ko1@a...>
Date: Sun, 30 Dec 2012 23:33:51 +0900 (JST)
Subject: [ruby-changes:26612] nobu:r38663 (trunk): parse.y: escaped closing parenthsis

nobu	2012-12-30 23:33:38 +0900 (Sun, 30 Dec 2012)

  New Revision: 38663

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

  Log:
    parse.y: escaped closing parenthsis
    
    * parse.y (simple_re_meta): escaped closing parenthsis has different
      meaning.  [Bug #7610] [ruby-core:51088]

  Modified files:
    trunk/ChangeLog
    trunk/parse.y
    trunk/test/ruby/test_regexp.rb

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 38662)
+++ ChangeLog	(revision 38663)
@@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Sun Dec 30 23:33:36 2012  Nobuyoshi Nakada  <nobu@r...>
+
+	* parse.y (simple_re_meta): escaped closing parenthsis has different
+	  meaning.  [Bug #7610] [ruby-core:51088]
+
 Sun Dec 30 12:09:47 2012  Charlie Somerville  <charlie@c...>
 
 	* configure.in: use 4 argument form of AC_CHECK_HEADERS to force
Index: parse.y
===================================================================
--- parse.y	(revision 38662)
+++ parse.y	(revision 38663)
@@ -5971,6 +5971,7 @@ simple_re_meta(int c) https://github.com/ruby/ruby/blob/trunk/parse.y#L5971
     switch (c) {
       case '$': case '*': case '+': case '.':
       case '?': case '^': case '|':
+      case ')':
 	return TRUE;
       default:
 	return FALSE;
Index: test/ruby/test_regexp.rb
===================================================================
--- test/ruby/test_regexp.rb	(revision 38662)
+++ test/ruby/test_regexp.rb	(revision 38663)
@@ -179,6 +179,12 @@ class TestRegexp < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_regexp.rb#L179
     assert_equal(expected, result)
   end
 
+  def test_source_escaped_paren
+    bug7610 = '[ruby-core:51088]'
+    s = '\(a\)'
+    assert_equal(/#{s}/, eval("%r(#{s})"), bug7610)
+  end
+
   def test_source_unescaped
     expected, result = "!\"#%&',-/:;=@_`~".each_char.map {|c|
       [

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

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