ruby-changes:55098
From: nobu <ko1@a...>
Date: Tue, 19 Mar 2019 11:35:55 +0900 (JST)
Subject: [ruby-changes:55098] nobu:r67305 (trunk): parse.y: fix segv with Ripper#yydebug
nobu 2019-03-19 11:35:50 +0900 (Tue, 19 Mar 2019) New Revision: 67305 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=67305 Log: parse.y: fix segv with Ripper#yydebug * parse.y (parser_token_value_print): in ripper, ID values are wrapped in NODE_RIPPER at set_yylval_name(), so print the Symbol wrapped together. Modified files: trunk/parse.y trunk/test/ripper/test_ripper.rb Index: parse.y =================================================================== --- parse.y (revision 67304) +++ parse.y (revision 67305) @@ -9350,7 +9350,7 @@ parser_token_value_print(struct parser_p https://github.com/ruby/ruby/blob/trunk/parse.y#L9350 #ifndef RIPPER v = rb_id2str(valp->id); #else - v = valp->val; + v = valp->node->nd_rval; #endif rb_parser_printf(p, "%"PRIsVALUE, v); break; Index: test/ripper/test_ripper.rb =================================================================== --- test/ripper/test_ripper.rb (revision 67304) +++ test/ripper/test_ripper.rb (revision 67305) @@ -65,6 +65,15 @@ class TestRipper::Ripper < Test::Unit::T https://github.com/ruby/ruby/blob/trunk/test/ripper/test_ripper.rb#L65 assert_predicate @ripper, :yydebug end + def test_yydebug_ident + out = StringIO.new + ripper = Ripper.new 'test_xxxx' + ripper.yydebug = true + ripper.debug_output = out + ripper.parse + assert_include out.string[/.*"local variable or method".*/], 'test_xxxx' + end + def test_regexp_with_option bug11932 = '[ruby-core:72638] [Bug #11932]' src = '/[\xC0-\xF0]/u'.dup.force_encoding(Encoding::UTF_8) -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/