diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-10-18 13:08:53 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-10-18 13:08:53 +0000 |
commit | c1c3d07332d32f0981d6019c3f851e51739f0eb2 (patch) | |
tree | 0924474058037da85876a48fbac3c92718fbddc5 /parse.y | |
parent | 05fee6c108e1452d9481e6fe488dede5fc6613c4 (diff) |
parse.y: relop
* parse.y (relop): extract to simplify comparisons.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60206 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'parse.y')
-rw-r--r-- | parse.y | 24 |
1 files changed, 9 insertions, 15 deletions
@@ -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 { /*%%%*/ |