summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorknu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-12-31 15:36:22 +0000
committerknu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-12-31 15:36:22 +0000
commit3f1da781c56e779e303b23d0bf0053780f342e5b (patch)
tree61924cdd34e889e6936baf258823be999b180af2
parent54a55edb9627bd31eda8d486f43cb34b65ee3295 (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--ChangeLog4
-rw-r--r--NEWS4
-rw-r--r--parse.y7
3 files changed, 9 insertions, 6 deletions
diff --git a/ChangeLog b/ChangeLog
index 027553638b..7eb163d375 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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.
diff --git a/NEWS b/NEWS
index 524bc9e481..e0e5157c5e 100644
--- a/NEWS
+++ b/NEWS
@@ -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:
diff --git a/parse.y b/parse.y
index ed61a7ce80..44d4888413 100644
--- a/parse.y
+++ b/parse.y
@@ -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);