[#23332] to_str再考 — matz@... (Yukihiro Matsumoto)

まつもと ゆきひろです

15 messages 2004/04/05

[#23380] [SEGV] make test-all (bccwin32 ruby1.9.0) — "H.Yamamoto" <ocean@...2.ccsnet.ne.jp>

山本です。

17 messages 2004/04/15
[#23400] Re: [SEGV] make test-all (bccwin32 ruby1.9.0) — "H.Yamamoto" <ocean@...2.ccsnet.ne.jp> 2004/04/16

山本です。落ちる場所がわかりました。

[#23402] Re: [SEGV] make test-all (bccwin32 ruby1.9.0) — "H.Yamamoto" <ocean@...2.ccsnet.ne.jp> 2004/04/16

山本です。

[#23403] Re: [SEGV] make test-all (bccwin32 ruby1.9.0) — nobu.nakada@... 2004/04/16

なかだです。

[#23405] Re: [SEGV] make test-all (bccwin32 ruby1.9.0) — "H.Yamamoto" <ocean@...2.ccsnet.ne.jp> 2004/04/16

山本です。

[#23407] Re: [SEGV] make test-all (bccwin32 ruby1.9.0) — "H.Yamamoto" <ocean@...2.ccsnet.ne.jp> 2004/04/16

山本です。

[ruby-dev:23328] {a: 1, b: 2} syntax error

From: Minero Aoki <aamine@...>
Date: 2004-04-05 09:11:10 UTC
List: ruby-dev #23328
青木です。

{a: 1, b: 2} 形式のハッシュでペアを二つ以上書くとエラーになります。

  % ruby -v -e 'p({a: 1, b: 2})'
  ruby 1.9.0 (2004-04-03) [i686-linux]
  -e:1: parse error
  p({a: 1, b: 2})
          ^
-------------------------------------------------------------------
青木峰郎

Index: parse.y
===================================================================
RCS file: /src/ruby/parse.y,v
retrieving revision 1.318
diff -u -r1.318 parse.y
--- parse.y	20 Mar 2004 16:45:35 -0000	1.318
+++ parse.y	5 Apr 2004 09:07:18 -0000
@@ -261,7 +261,7 @@
 %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> f_arglist f_args f_optarg f_opt f_block_arg opt_f_block_arg
-%type <node> assoc_list assocs assoc undef_list backref string_dvar
+%type <node> assoc_list assocs assoc kwargs undef_list backref string_dvar
 %type <node> block_var opt_block_var brace_block cmd_brace_block do_block lhs none
 %type <node> mlhs mlhs_head mlhs_basic mlhs_entry mlhs_item mlhs_node
 %type <id>   fitem variable sym symbol operation operation2 operation3
@@ -2381,9 +2381,9 @@
 			}
 			$$ = $1;
 		    }
-		| tLABEL arg_value
+		| kwargs trailer
 		    {
-			$$ = list_append(NEW_LIST(NEW_LIT(ID2SYM($1))), $2);
+			$$ = $1;
 		    }
 		;
 
@@ -2397,6 +2397,17 @@
 assoc		: arg_value tASSOC arg_value
 		    {
 			$$ = list_append(NEW_LIST($1), $3);
+		    }
+		;
+
+kwargs		: tLABEL arg_value
+		    {
+			$$ = list_append(NEW_LIST(NEW_LIT(ID2SYM($1))), $2);
+		    }
+		| kwargs ',' tLABEL arg_value
+		    {
+			$$ = list_append(NEW_LIST(NEW_LIT(ID2SYM($3))), $4);
+			$$ = list_concat($1, $$);
 		    }
 		;
 

In This Thread

Prev Next