* parse.y (command): moved return/break/next from command_call for

better error message.

* parse.y (call_args): void value check added.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21527 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
matz 2009-01-15 06:06:47 +00:00
Родитель 0149e4515d
Коммит 2a0b6280bb
2 изменённых файлов: 30 добавлений и 24 удалений

Просмотреть файл

@ -7,6 +7,11 @@ Thu Jan 15 14:17:57 2009 Yukihiro Matsumoto <matz@ruby-lang.org>
* parse.y (stmt): explicit error for "Object::Far += foo 1" just * parse.y (stmt): explicit error for "Object::Far += foo 1" just
as "Object::Far += 1". as "Object::Far += 1".
* parse.y (command): moved return/break/next from command_call for
better error message.
* parse.y (call_args): void value check added.
Thu Jan 15 13:10:58 2009 NAKAMURA Usaku <usa@ruby-lang.org> Thu Jan 15 13:10:58 2009 NAKAMURA Usaku <usa@ruby-lang.org>
* win32/Makefile.sub (COMPILERFLAG): for enc/trans/gb18030.c. * win32/Makefile.sub (COMPILERFLAG): for enc/trans/gb18030.c.

49
parse.y
Просмотреть файл

@ -1212,30 +1212,6 @@ expr_value : expr
command_call : command command_call : command
| block_command | block_command
| keyword_return call_args
{
/*%%%*/
$$ = NEW_RETURN(ret_args($2));
/*%
$$ = dispatch1(return, $2);
%*/
}
| keyword_break call_args
{
/*%%%*/
$$ = NEW_BREAK(ret_args($2));
/*%
$$ = dispatch1(break, $2);
%*/
}
| keyword_next call_args
{
/*%%%*/
$$ = NEW_NEXT(ret_args($2));
/*%
$$ = dispatch1(next, $2);
%*/
}
; ;
block_command : block_call block_command : block_call
@ -1362,6 +1338,30 @@ command : operation command_args %prec tLOWEST
$$ = dispatch1(yield, $2); $$ = dispatch1(yield, $2);
%*/ %*/
} }
| keyword_return call_args
{
/*%%%*/
$$ = NEW_RETURN(ret_args($2));
/*%
$$ = dispatch1(return, $2);
%*/
}
| keyword_break call_args
{
/*%%%*/
$$ = NEW_BREAK(ret_args($2));
/*%
$$ = dispatch1(break, $2);
%*/
}
| keyword_next call_args
{
/*%%%*/
$$ = NEW_NEXT(ret_args($2));
/*%
$$ = dispatch1(next, $2);
%*/
}
; ;
mlhs : mlhs_basic mlhs : mlhs_basic
@ -2337,6 +2337,7 @@ opt_call_args : none
call_args : command call_args : command
{ {
/*%%%*/ /*%%%*/
value_expr($1);
$$ = NEW_LIST($1); $$ = NEW_LIST($1);
/*% /*%
$$ = arg_add(arg_new(), $1); $$ = arg_add(arg_new(), $1);