summaryrefslogtreecommitdiff
path: root/parse.y
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-06-19 19:43:59 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-06-19 19:43:59 +0000
commit9a7a11564c9e36819fbb54034e3b17391b912d30 (patch)
treeafed2a8ece376a52c7bfcc6d1a897f90a8f8d618 /parse.y
parent362c3c0e5d552a81e571536ea6c293e4b812a0f5 (diff)
* parse.y (rb_intern2): use rb_intern2 to intern without trailing
equal sign. * parse.y (rb_intern2, ripper_id2sym): fixed indent. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12575 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'parse.y')
-rw-r--r--parse.y18
1 files changed, 7 insertions, 11 deletions
diff --git a/parse.y b/parse.y
index 5bd59c69dd..56df203b8d 100644
--- a/parse.y
+++ b/parse.y
@@ -8461,11 +8461,7 @@ rb_intern2(const char *name, long len)
if (name[last] == '=') {
/* attribute assignment */
- char *buf = ALLOCA_N(char,last+1);
-
- strncpy(buf, name, last);
- buf[last] = '\0';
- id = rb_intern(buf);
+ id = rb_intern2(name, last);
if (id > tLAST_TOKEN && !is_attrset_id(id)) {
id = rb_id_attrset(id);
goto id_register;
@@ -8481,9 +8477,9 @@ rb_intern2(const char *name, long len)
break;
}
if (!ISDIGIT(*m)) {
- while (m <= name + last && is_identchar(*m)) {
- m += mbclen(*m);
- }
+ while (m <= name + last && is_identchar(*m)) {
+ m += mbclen(*m);
+ }
}
if (*m) id = ID_JUNK;
new_id:
@@ -8976,13 +8972,13 @@ ripper_id2sym(ID id)
return ID2SYM(rb_intern(name));
}
switch (id) {
- case tOROP:
+ case tOROP:
name = "||";
break;
- case tANDOP:
+ case tANDOP:
name = "&&";
break;
- default:
+ default:
name = rb_id2name(id);
if (!name) {
rb_bug("cannot convert ID to string: %ld", (unsigned long)id);