Project

General

Profile

Actions

Feature #12686

closed

Updated by nobu (Nobuyoshi Nakada) almost 9 years ago

It sounds nothing wrong with it, to me.

diff --git i/parse.y w/parse.y
index 17f0f9c..7a14941 100644
--- i/parse.y
+++ w/parse.y
@@ -2659,7 +2659,7 @@ primary		: literal
 			$<val>1 = cmdarg_stack;
 			CMDARG_SET(0);
 		    }
-		  expr {SET_LEX_STATE(EXPR_ENDARG);} rparen
+		  stmt {SET_LEX_STATE(EXPR_ENDARG);} rparen
 		    {
 			CMDARG_SET($<val>1);
 		    /*%%%*/
diff --git i/test/ruby/test_syntax.rb w/test/ruby/test_syntax.rb
index ce01358..9b5b9f1 100644
--- i/test/ruby/test_syntax.rb
+++ w/test/ruby/test_syntax.rb
@@ -827,6 +827,10 @@
     end
   end
 
+  def test_stmt_lparen_arg
+    assert_valid_syntax("foo (bar rescue nil)")
+  end
+
   private
 
   def not_label(x) @result = x; @not_label ||= nil end

Updated by nobu (Nobuyoshi Nakada) almost 9 years ago

tLPAREN_ARG has been introduced at 1.7, I think we can clear up spaces and parentheses rules now.

Updated by nobu (Nobuyoshi Nakada) almost 9 years ago

  • Status changed from Open to Closed

Applied in changeset r55965.


parse.y: lparen_arg statement

  • parse.y (primary): allow parenthesised statement as a method
    argument. [Feature ]
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0