summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--parse.y2
-rw-r--r--test/ripper/test_ripper.rb9
2 files changed, 10 insertions, 1 deletions
diff --git a/parse.y b/parse.y
index 0dcf3103e5..b78d878b91 100644
--- a/parse.y
+++ b/parse.y
@@ -9350,7 +9350,7 @@ parser_token_value_print(struct parser_params *p, enum yytokentype type, const Y
#ifndef RIPPER
v = rb_id2str(valp->id);
#else
- v = valp->val;
+ v = valp->node->nd_rval;
#endif
rb_parser_printf(p, "%"PRIsVALUE, v);
break;
diff --git a/test/ripper/test_ripper.rb b/test/ripper/test_ripper.rb
index e7d20a66a0..13a5294618 100644
--- a/test/ripper/test_ripper.rb
+++ b/test/ripper/test_ripper.rb
@@ -65,6 +65,15 @@ class TestRipper::Ripper < Test::Unit::TestCase
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)