diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-12-30 14:33:38 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-12-30 14:33:38 +0000 |
commit | 77df5bb1b5ab3e4d6ed32d0b43acb69b3167f5dd (patch) | |
tree | db8c33e6c55542025a1c378cc40bf3cae9a5ff69 | |
parent | a6c637f013b7a4031df13a56fdb00560369d2aa8 (diff) | |
download | ruby-77df5bb1b5ab3e4d6ed32d0b43acb69b3167f5dd.tar.gz |
parse.y: escaped closing parenthsis
* parse.y (simple_re_meta): escaped closing parenthsis has different
meaning. [Bug #7610] [ruby-core:51088]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38663 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | parse.y | 1 | ||||
-rw-r--r-- | test/ruby/test_regexp.rb | 6 |
3 files changed, 12 insertions, 0 deletions
@@ -1,3 +1,8 @@ +Sun Dec 30 23:33:36 2012 Nobuyoshi Nakada <nobu@ruby-lang.org> + + * 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@charliesomerville.com> * configure.in: use 4 argument form of AC_CHECK_HEADERS to force @@ -5971,6 +5971,7 @@ simple_re_meta(int c) switch (c) { case '$': case '*': case '+': case '.': case '?': case '^': case '|': + case ')': return TRUE; default: return FALSE; diff --git a/test/ruby/test_regexp.rb b/test/ruby/test_regexp.rb index 03c7fd4443..faafe336ec 100644 --- a/test/ruby/test_regexp.rb +++ b/test/ruby/test_regexp.rb @@ -179,6 +179,12 @@ class TestRegexp < Test::Unit::TestCase 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| [ |