8000 parse.y: fix segv with Ripper#yydebug · jruby/ruby@e39f7e6 · GitHub
[go: up one dir, main page]

Skip to content

Commit e39f7e6

Browse files
committed
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. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67305 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
1 parent ae5d9a7 commit e39f7e6

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

parse.y

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9350,7 +9350,7 @@ parser_token_value_print(struct parser_params *p, enum yytokentype type, const Y
93509350
#ifndef RIPPER
93519351
v = rb_id2str(valp->id);
93529352
#else
9353-
v = valp->val;
9353+
v = valp->node->nd_rval;
93549354
#endif
93559355
rb_parser_printf(p, "%"PRIsVALUE, v);
93569356
break;

test/ripper/test_ripper.rb

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,15 @@ def test_yydebug_equals
6565
assert_predicate @ripper, :yydebug
6666
end
6767

68+
def test_yydebug_ident
69+
out = StringIO.new
70+
ripper = Ripper.new 'test_xxxx'
71+
ripper.yydebug = true
72+
ripper.debug_output = out
73+
ripper.parse
74+
assert_include out.string[/.*"local variable or method".*/], 'test_xxxx'
75+
end
76+
6877
def test_regexp_with_option
6978
bug11932 = '[ruby-core:72638] [Bug #11932]'
7079
src = '/[\xC0-\xF0]/u'.dup.force_encoding(Encoding::UTF_8)

0 commit comments

Comments
 (0)
0