summaryrefslogtreecommitdiff
path: root/object.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2002-10-23 10:17:30 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2002-10-23 10:17:30 +0000
commitd4f2f6a7f708b010d9777f12bdcb84a449f61aa9 (patch)
tree87328c69b8296e0ecd38a456e2c4d74e40f28184 /object.c
parent9562813d338b5f2870408e95747d71502590c14f (diff)
* eval.c (rb_eval): added NODE_DSYM, symbol literal with
interpolation. * node.h: ditto. * intern.h: prototypes; rb_is_junk_id, rb_str_dump, rb_str_intern * object.c (sym_inspect): escape and quote for non-alphanumeric symbols. * parse.y (dsym, tokadd_string, yylex): extended symbol literals. * parse.y (rb_is_junk_id): added. * string.c (rb_str_dump, rb_str_intern) : make extern. * lib/mkmf.rb (create_makefile): deffile should be removed by distclean, not clean. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2985 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'object.c')
-rw-r--r--object.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/object.c b/object.c
index f505854..6f36ec7 100644
--- a/object.c
+++ b/object.c
@@ -519,11 +519,16 @@ sym_inspect(sym)
{
VALUE str;
char *name;
+ ID id = SYM2ID(sym);
- name = rb_id2name(SYM2ID(sym));
+ name = rb_id2name(id);
str = rb_str_new(0, strlen(name)+1);
RSTRING(str)->ptr[0] = ':';
strcpy(RSTRING(str)->ptr+1, name);
+ if (rb_is_junk_id(id)) {
+ str = rb_str_dump(str);
+ strncpy(RSTRING(str)->ptr, ":\"", 2);
+ }
return str;
}