1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

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
This commit is contained in:
nobu 2012-12-30 14:33:38 +00:00
parent a6c637f013
commit 77df5bb1b5
3 changed files with 12 additions and 0 deletions

View file

@ -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

View file

@ -5971,6 +5971,7 @@ simple_re_meta(int c)
switch (c) {
case '$': case '*': case '+': case '.':
case '?': case '^': case '|':
case ')':
return TRUE;
default:
return FALSE;

View file

@ -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|
[