ruby-changes:67165
From: Nobuyoshi <ko1@a...>
Date: Sun, 15 Aug 2021 11:40:31 +0900 (JST)
Subject: [ruby-changes:67165] 2aa6826e81 (master): Extract the wrapped value when yydebug [Bug #18075]
https://git.ruby-lang.org/ruby.git/commit/?id=2aa6826e81 From 2aa6826e81ec880f5e98fa995e44fae0819be95d Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada <nobu@r...> Date: Sun, 15 Aug 2021 01:33:31 +0900 Subject: Extract the wrapped value when yydebug [Bug #18075] --- parse.y | 2 +- test/ripper/test_ripper.rb | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/parse.y b/parse.y index 4c4cbcf..cd69710 100644 --- a/parse.y +++ b/parse.y @@ -10791,7 +10791,7 @@ parser_token_value_print(struct parser_params *p, enum yytokentype type, const Y https://github.com/ruby/ruby/blob/trunk/parse.y#L10791 #ifndef RIPPER v = valp->node->nd_lit; #else - v = valp->val; + v = get_value(valp->val); #endif rb_parser_printf(p, "%+"PRIsVALUE, v); break; diff --git a/test/ripper/test_ripper.rb b/test/ripper/test_ripper.rb index ab841b7..76276c5 100644 --- a/test/ripper/test_ripper.rb +++ b/test/ripper/test_ripper.rb @@ -75,6 +75,15 @@ class TestRipper::Ripper < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ripper/test_ripper.rb#L75 assert_include out.string[/.*"local variable or method".*/], 'test_xxxx' end + def test_yydebug_string + out = StringIO.new + ripper = Ripper.new '"woot"' + ripper.yydebug = true + ripper.debug_output = out + ripper.parse + assert_include out.string[/.*"literal content".*/], 'woot' + end + def test_regexp_with_option bug11932 = '[ruby-core:72638] [Bug #11932]' src = '/[\xC0-\xF0]/u'.dup.force_encoding(Encoding::UTF_8) -- cgit v1.1 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/