зеркало из https://github.com/github/ruby.git
parse.y: rewrite excessed_comma process
Currently, parser.y includes core parser and Ripper parser obscurity. In addition, *some* Ripper code uses the result of the core parser, which make it difficult to separate the two parsers. I want to simplify this, not by separating the two parsers, but by making *all* Ripper actions follows the core parser actions. In other words, all the core parser actions run always even in Ripper, and after that, Ripper-specific actions run. For tha sake, in principle, I want to put `/*% ripper: ... %*/` in the end of actions. Anyway, it is too dirty to put it within expressions, IMO. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61990 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
43aa218de3
Коммит
7ba7a2f70e
12
parse.y
12
parse.y
|
@ -2908,16 +2908,12 @@ block_param : f_arg ',' f_block_optarg ',' f_rest_arg opt_block_args_tail
|
|||
}
|
||||
| f_arg ','
|
||||
{
|
||||
#ifndef RIPPER
|
||||
/*%%%*/
|
||||
/* magic number for rest_id in iseq_set_arguments() */
|
||||
const ID excessed_comma = 1;
|
||||
#else
|
||||
const VALUE excessed_comma =
|
||||
/*% ripper: excessed_comma! %*/
|
||||
;
|
||||
#endif
|
||||
$$ = new_args_tail(p, Qnone, Qnone, Qnone, &@1);
|
||||
$$ = new_args(p, $1, Qnone, excessed_comma, Qnone, $$, &@$);
|
||||
$$ = new_args(p, $1, Qnone, excessed_comma, Qnone, new_args_tail(p, Qnone, Qnone, Qnone, &@1), &@$);
|
||||
/*% %*/
|
||||
/*% ripper: new_args(p, $1, Qnone, excessed_comma!, Qnone, new_args_tail(p, Qnone, Qnone, Qnone, NULL), NULL) %*/
|
||||
}
|
||||
| f_arg ',' f_rest_arg ',' f_arg opt_block_args_tail
|
||||
{
|
||||
|
|
Загрузка…
Ссылка в новой задаче