зеркало из https://github.com/github/ruby.git
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
This commit is contained in:
Родитель
ae5d9a7664
Коммит
e39f7e64b7
2
parse.y
2
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;
|
||||
|
|
|
@ -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)
|
||||
|
|
Загрузка…
Ссылка в новой задаче