summaryrefslogtreecommitdiff
path: root/parse.y
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-05-21 16:01:49 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-05-21 16:01:49 +0000
commit498365d0ee972a6c301e3a238f6e0918d114e81a (patch)
tree125d4ee3f6a43596ad530a0b56cec859a988bc52 /parse.y
parent77324837a35cf4308f227727986c8e6699ffdcd8 (diff)
*** empty log message ***
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3842 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'parse.y')
-rw-r--r--parse.y21
1 files changed, 18 insertions, 3 deletions
diff --git a/parse.y b/parse.y
index 090a8b9467..c9ef8932f9 100644
--- a/parse.y
+++ b/parse.y
@@ -135,6 +135,7 @@ static NODE *arg_concat();
static NODE *arg_prepend();
static NODE *literal_concat();
static NODE *new_evstr();
+static NODE *evstr2dstr();
static NODE *call_op();
static int in_defined = 0;
@@ -1870,6 +1871,9 @@ strings : string
if (!node) {
node = NEW_STR(rb_str_new(0, 0));
}
+ else {
+ node = evstr2dstr(node);
+ }
$$ = node;
}
;
@@ -1962,7 +1966,7 @@ word_list : /* none */
}
| word_list word ' '
{
- $$ = list_append($1, $2);
+ $$ = list_append($1, evstr2dstr($2));
}
;
@@ -4344,6 +4348,7 @@ yylex()
(!peek('=') || (lex_p + 1 < lex_pend && lex_p[1] == '>'))) {
result = tIDENTIFIER;
tokadd(c);
+ tokfix();
}
else {
pushback(c);
@@ -4402,9 +4407,9 @@ yylex()
lex_state = EXPR_END;
}
}
- tokfix();
yylval.id = rb_intern(tok());
- if ((dyna_in_block() && rb_dvar_defined(yylval.id)) || local_id(yylval.id)) {
+ if (is_local_id(yylval.id) &&
+ ((dyna_in_block() && rb_dvar_defined(yylval.id)) || local_id(yylval.id))) {
lex_state = EXPR_END;
}
return result;
@@ -4648,6 +4653,16 @@ literal_concat(head, tail)
}
static NODE *
+evstr2dstr(node)
+ NODE *node;
+{
+ if (nd_type(node) == NODE_EVSTR) {
+ node = list_append(NEW_DSTR(rb_str_new(0, 0)), node);
+ }
+ return node;
+}
+
+static NODE *
new_evstr(node)
NODE *node;
{