1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

*** empty log message ***

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3842 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2003-05-21 16:01:49 +00:00
parent 77324837a3
commit 498365d0ee

21
parse.y
View file

@ -135,6 +135,7 @@ static NODE *arg_concat();
static NODE *arg_prepend(); static NODE *arg_prepend();
static NODE *literal_concat(); static NODE *literal_concat();
static NODE *new_evstr(); static NODE *new_evstr();
static NODE *evstr2dstr();
static NODE *call_op(); static NODE *call_op();
static int in_defined = 0; static int in_defined = 0;
@ -1870,6 +1871,9 @@ strings : string
if (!node) { if (!node) {
node = NEW_STR(rb_str_new(0, 0)); node = NEW_STR(rb_str_new(0, 0));
} }
else {
node = evstr2dstr(node);
}
$$ = node; $$ = node;
} }
; ;
@ -1962,7 +1966,7 @@ word_list : /* none */
} }
| word_list word ' ' | 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] == '>'))) { (!peek('=') || (lex_p + 1 < lex_pend && lex_p[1] == '>'))) {
result = tIDENTIFIER; result = tIDENTIFIER;
tokadd(c); tokadd(c);
tokfix();
} }
else { else {
pushback(c); pushback(c);
@ -4402,9 +4407,9 @@ yylex()
lex_state = EXPR_END; lex_state = EXPR_END;
} }
} }
tokfix();
yylval.id = rb_intern(tok()); 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; lex_state = EXPR_END;
} }
return result; return result;
@ -4647,6 +4652,16 @@ literal_concat(head, tail)
return head; return head;
} }
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 * static NODE *
new_evstr(node) new_evstr(node)
NODE *node; NODE *node;