diff options
| -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); |
