ruby-changes:37883
From: nobu <ko1@a...>
Date: Sat, 14 Mar 2015 02:15:16 +0900 (JST)
Subject: [ruby-changes:37883] nobu:r49964 (trunk): parse.y: empty paren
nobu 2015-03-14 02:14:53 +0900 (Sat, 14 Mar 2015) New Revision: 49964 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=49964 Log: parse.y: empty paren * parse.y (primary): empty parentheses at cmdarg can be null. [ruby-core:68477] [Bug #10957] Modified files: trunk/ChangeLog trunk/parse.y trunk/test/ruby/test_syntax.rb Index: ChangeLog =================================================================== --- ChangeLog (revision 49963) +++ ChangeLog (revision 49964) @@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Sat Mar 14 02:14:50 2015 Nobuyoshi Nakada <nobu@r...> + + * parse.y (primary): empty parentheses at cmdarg can be null. + [ruby-core:68477] [Bug #10957] + Fri Mar 13 15:04:36 2015 Nobuyoshi Nakada <nobu@r...> * ext/stringio/stringio.c (strio_close): don't raise on dobule Index: parse.y =================================================================== --- parse.y (revision 49963) +++ parse.y (revision 49964) @@ -2102,7 +2102,7 @@ arg : lhs '=' arg https://github.com/ruby/ruby/blob/trunk/parse.y#L2102 value_expr($1); value_expr($3); $$ = NEW_DOT2($1, $3); - if (nd_type($1) == NODE_LIT && FIXNUM_P($1->nd_lit) && + if ($1 && nd_type($1) == NODE_LIT && FIXNUM_P($1->nd_lit) && nd_type($3) == NODE_LIT && FIXNUM_P($3->nd_lit)) { deferred_nodes = list_append(deferred_nodes, $$); } @@ -2116,7 +2116,7 @@ arg : lhs '=' arg https://github.com/ruby/ruby/blob/trunk/parse.y#L2116 value_expr($1); value_expr($3); $$ = NEW_DOT3($1, $3); - if (nd_type($1) == NODE_LIT && FIXNUM_P($1->nd_lit) && + if ($1 && nd_type($1) == NODE_LIT && FIXNUM_P($1->nd_lit) && nd_type($3) == NODE_LIT && FIXNUM_P($3->nd_lit)) { deferred_nodes = list_append(deferred_nodes, $$); } Index: test/ruby/test_syntax.rb =================================================================== --- test/ruby/test_syntax.rb (revision 49963) +++ test/ruby/test_syntax.rb (revision 49964) @@ -557,6 +557,12 @@ eom https://github.com/ruby/ruby/blob/trunk/test/ruby/test_syntax.rb#L557 assert_syntax_error(src, /formal argument/, bug10545) end + def test_null_range_cmdarg + bug10957 = '[ruby-core:68477] [Bug #10957]' + assert_ruby_status(['-c', '-e', 'p ()..0'], "", bug10957) + assert_ruby_status(['-c', '-e', 'p ()...0'], "", bug10957) + end + private def not_label(x) @result = x; @not_label ||= nil end -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/