diff options
| author | knu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-12-31 15:36:22 +0000 |
|---|---|---|
| committer | knu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-12-31 15:36:22 +0000 |
| commit | 3f1da781c56e779e303b23d0bf0053780f342e5b (patch) | |
| tree | 61924cdd34e889e6936baf258823be999b180af2 | |
| parent | 54a55edb9627bd31eda8d486f43cb34b65ee3295 (diff) | |
* parse.y (dsym): Allow empty symbols. [merge from 1.9]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@26221 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
| -rw-r--r-- | ChangeLog | 4 | ||||
| -rw-r--r-- | NEWS | 4 | ||||
| -rw-r--r-- | parse.y | 7 |
3 files changed, 9 insertions, 6 deletions
@@ -1,3 +1,7 @@ +Fri Jan 1 00:33:13 2010 Akinori MUSHA <knu@iDaemons.org> + + * parse.y (dsym): Allow empty symbols. [merge from 1.9] + Fri Jan 1 00:12:52 2010 Akinori MUSHA <knu@iDaemons.org> * object.c, intern.h: Export rb_sym_to_s. @@ -11,6 +11,10 @@ with all sufficient information, see the ChangeLog file. === Lexical changes +* empty symbol literal + + Empty symbol (:"") is allowed. + * looser splat opetator You can write things like: @@ -2282,8 +2282,7 @@ dsym : tSYMBEG xstring_contents tSTRING_END { lex_state = EXPR_END; if (!($$ = $2)) { - $$ = NEW_NIL(); - yyerror("empty symbol literal"); + $$ = NEW_LIT(ID2SYM(rb_intern(""))); } else { VALUE lit; @@ -2294,10 +2293,6 @@ dsym : tSYMBEG xstring_contents tSTRING_END 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); |
