ruby-changes:14391
From: knu <ko1@a...>
Date: Fri, 1 Jan 2010 00:36:36 +0900 (JST)
Subject: [ruby-changes:14391] Ruby:r26221 (ruby_1_8): * parse.y (dsym): Allow empty symbols. [merge from 1.9]
knu 2010-01-01 00:36:22 +0900 (Fri, 01 Jan 2010) New Revision: 26221 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=26221 Log: * parse.y (dsym): Allow empty symbols. [merge from 1.9] Modified files: branches/ruby_1_8/ChangeLog branches/ruby_1_8/NEWS branches/ruby_1_8/parse.y Index: ruby_1_8/parse.y =================================================================== --- ruby_1_8/parse.y (revision 26220) +++ ruby_1_8/parse.y (revision 26221) @@ -2282,8 +2282,7 @@ { lex_state = EXPR_END; if (!($$ = $2)) { - $$ = NEW_NIL(); - yyerror("empty symbol literal"); + $$ = NEW_LIT(ID2SYM(rb_intern(""))); } else { VALUE lit; @@ -2294,10 +2293,6 @@ break; case NODE_STR: lit = $$->nd_lit; - if (RSTRING(lit)->len == 0) { - yyerror("empty symbol literal"); - break; - } if (strlen(RSTRING(lit)->ptr) == RSTRING(lit)->len) { $$->nd_lit = ID2SYM(rb_intern(RSTRING($$->nd_lit)->ptr)); nd_set_type($$, NODE_LIT); Index: ruby_1_8/NEWS =================================================================== --- ruby_1_8/NEWS (revision 26220) +++ ruby_1_8/NEWS (revision 26221) @@ -11,6 +11,10 @@ === Lexical changes +* empty symbol literal + + Empty symbol (:"") is allowed. + * looser splat opetator You can write things like: Index: ruby_1_8/ChangeLog =================================================================== --- ruby_1_8/ChangeLog (revision 26220) +++ ruby_1_8/ChangeLog (revision 26221) @@ -1,3 +1,7 @@ +Fri Jan 1 00:33:13 2010 Akinori MUSHA <knu@i...> + + * parse.y (dsym): Allow empty symbols. [merge from 1.9] + Fri Jan 1 00:12:52 2010 Akinori MUSHA <knu@i...> * object.c, intern.h: Export rb_sym_to_s. -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/