[前][次][番号順一覧][スレッド一覧]

ruby-changes:17374

From: matz <ko1@a...>
Date: Thu, 30 Sep 2010 23:18:59 +0900 (JST)
Subject: [ruby-changes:17374] Ruby:r29379 (trunk): * parse.y (command_asgn): allow command_call to be right hand side

matz	2010-09-30 23:17:31 +0900 (Thu, 30 Sep 2010)

  New Revision: 29379

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=29379

  Log:
    * parse.y (command_asgn): allow command_call to be right hand side
      expression of chained assignment.  [ruby-dev:42313]

  Modified files:
    trunk/ChangeLog
    trunk/parse.y

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 29378)
+++ ChangeLog	(revision 29379)
@@ -3,6 +3,11 @@
 	* win32/win32.c (rb_w32_getenv): should return NULL if specified name
 	  is empty. a patch from Heesob Park at [ruby-core:32650]
 
+Thu Sep 30 15:18:23 2010  Yukihiro Matsumoto  <matz@r...>
+
+	* parse.y (command_asgn): allow command_call to be right hand side
+	  expression of chained assignment.  [ruby-dev:42313]
+
 Thu Sep 30 10:55:38 2010  NAKAMURA Usaku  <usa@r...>
 
 	* hash.c (ruby_setenv): workaround for old Windows. a patch from
Index: parse.y
===================================================================
--- parse.y	(revision 29378)
+++ parse.y	(revision 29379)
@@ -690,7 +690,7 @@
 %type <node> args call_args opt_call_args
 %type <node> paren_args opt_paren_args
 %type <node> command_args aref_args opt_block_arg block_arg var_ref var_lhs
-%type <node> mrhs superclass block_call block_command
+%type <node> command_asgn mrhs superclass block_call block_command
 %type <node> f_block_optarg f_block_opt
 %type <node> f_arglist f_args f_arg f_arg_item f_optarg f_marg f_marg_list f_margs
 %type <node> assoc_list assocs assoc undef_list backref string_dvar for_var
@@ -1060,15 +1060,7 @@
 			$$ = dispatch1(END, $3);
 		    %*/
 		    }
-		| lhs '=' command_call
-		    {
-		    /*%%%*/
-			value_expr($3);
-			$$ = node_assign($1, $3);
-		    /*%
-			$$ = dispatch2(assign, $1, $3);
-		    %*/
-		    }
+		| command_asgn
 		| mlhs '=' command_call
 		    {
 		    /*%%%*/
@@ -1225,6 +1217,27 @@
 		| expr
 		;
 
+command_asgn	: lhs '=' command_call
+		    {
+		    /*%%%*/
+			value_expr($3);
+			$$ = node_assign($1, $3);
+		    /*%
+			$$ = dispatch2(assign, $1, $3);
+		    %*/
+		    }
+		| lhs '=' command_asgn
+		    {
+		    /*%%%*/
+			value_expr($3);
+			$$ = node_assign($1, $3);
+		    /*%
+			$$ = dispatch2(assign, $1, $3);
+		    %*/
+		    }
+		;
+
+
 expr		: command_call
 		| expr keyword_and expr
 		    {

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]