* parse.y (relop): extract to simplify comparisons.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60206 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2017-10-18 13:08:53 +00:00
Родитель 05fee6c108
Коммит c1c3d07332
1 изменённых файлов: 9 добавлений и 15 удалений

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

@ -914,7 +914,7 @@ static void token_info_pop_gen(struct parser_params*, const char *token, size_t
%type <node> mlhs mlhs_head mlhs_basic mlhs_item mlhs_node mlhs_post mlhs_inner
%type <id> fsym keyword_variable user_variable sym symbol operation operation2 operation3
%type <id> cname fname op f_rest_arg f_block_arg opt_f_block_arg f_norm_arg f_bad_arg
%type <id> f_kwrest f_label f_arg_asgn call_op call_op2 reswords
%type <id> f_kwrest f_label f_arg_asgn call_op call_op2 reswords relop
/*%%%*/
/*%
%type <val> program then do
@ -2093,21 +2093,9 @@ arg : lhs '=' arg_rhs
{
$$ = call_bin_op($1, idCmp, $3);
}
| arg '>' arg
| arg relop arg %prec '>'
{
$$ = call_bin_op($1, '>', $3);
}
| arg tGEQ arg
{
$$ = call_bin_op($1, idGE, $3);
}
| arg '<' arg
{
$$ = call_bin_op($1, '<', $3);
}
| arg tLEQ arg
{
$$ = call_bin_op($1, idLE, $3);
$$ = call_bin_op($1, $2, $3);
}
| arg tEQ arg
{
@ -2178,6 +2166,12 @@ arg : lhs '=' arg_rhs
}
;
relop : '>' {$$ = '>';}
| '<' {$$ = '<';}
| tGEQ {$$ = idGE;}
| tLEQ {$$ = idLE;}
;
arg_value : arg
{
/*%%%*/