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

parse.y: fix a typo

* parse.y (regexp_contents): fix a typo.  pointed out by wanabe.
  [ruby-dev:48741] [Bug #10543]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48655 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2014-11-30 11:05:58 +00:00
parent 1918ea16c7
commit d40aad1c09
3 changed files with 26 additions and 1 deletions

View file

@ -1,3 +1,8 @@
Sun Nov 30 20:05:55 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
* parse.y (regexp_contents): fix a typo. pointed out by wanabe.
[ruby-dev:48741] [Bug #10543]
Sun Nov 30 18:55:32 2014 Tanaka Akira <akr@fsij.org>
* test/ruby/test_process.rb (test_deadlock_by_signal_at_forking):

View file

@ -4261,7 +4261,7 @@ regexp_contents: /* none */
/*%
VALUE s1 = 0, s2 = 0, n1 = $1, n2 = $2;
if (ripper_is_node_yylval(n1)) {
s1 = RNODE(n2)->nd_cval;
s1 = RNODE(n1)->nd_cval;
n1 = RNODE(n1)->nd_rval;
}
if (ripper_is_node_yylval(n2)) {

View file

@ -18,4 +18,24 @@ class TestRipper::Sexp < Test::Unit::TestCase
assert_nil Ripper.sexp("/*/")
assert_nil Ripper.sexp("/+/")
end
def test_regexp_content
sexp = Ripper.sexp('//')
assert_nil search_sexp(:@tstring_content, search_sexp(:regexp_literal, sexp))
sexp = Ripper.sexp('/foo/')
assert_equal 'foo', search_sexp(:@tstring_content, search_sexp(:regexp_literal, sexp))[1]
sexp = Ripper.sexp('/(?<n>a(b|\g<n>))/')
assert_equal '(?<n>a(b|\g<n>))', search_sexp(:@tstring_content, search_sexp(:regexp_literal, sexp))[1]
end
def search_sexp(sym, sexp)
return sexp if !sexp or sexp[0] == sym
sexp.find do |e|
if Array === e and e = search_sexp(sym, e)
return e
end
end
end
end if ripper_test