ruby-changes:48092
From: nobu <ko1@a...>
Date: Wed, 18 Oct 2017 22:08:58 +0900 (JST)
Subject: [ruby-changes:48092] nobu:r60206 (trunk): parse.y: relop
nobu 2017-10-18 22:08:53 +0900 (Wed, 18 Oct 2017) New Revision: 60206 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=60206 Log: parse.y: relop * parse.y (relop): extract to simplify comparisons. Modified files: trunk/parse.y Index: parse.y =================================================================== --- parse.y (revision 60205) +++ parse.y (revision 60206) @@ -914,7 +914,7 @@ static void token_info_pop_gen(struct pa https://github.com/ruby/ruby/blob/trunk/parse.y#L914 %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 https://github.com/ruby/ruby/blob/trunk/parse.y#L2093 { $$ = 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 https://github.com/ruby/ruby/blob/trunk/parse.y#L2166 } ; +relop : '>' {$$ = '>';} + | '<' {$$ = '<';} + | tGEQ {$$ = idGE;} + | tLEQ {$$ = idLE;} + ; + arg_value : arg { /*%%%*/ -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/