diff options
author | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2019-06-13 22:03:10 +0900 |
---|---|---|
committer | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2019-06-13 22:03:10 +0900 |
commit | 043f010c28e82ea38978bf8ed885416f133b5b75 (patch) | |
tree | 7e3fd87929df736b475adeb37eabe4d2221da7a5 /parse.y | |
parent | f169043d81524b5b529f2c1e9c35437ba5bc3a7a (diff) | |
download | ruby-043f010c28e82ea38978bf8ed885416f133b5b75.tar.gz |
parse.y: moved pipeline to expr
To allow arguments without parentheses.
Diffstat (limited to 'parse.y')
-rw-r--r-- | parse.y | 48 |
1 files changed, 31 insertions, 17 deletions
@@ -1496,6 +1496,37 @@ expr : command_call $$ = call_uni_op(p, method_cond(p, $2, &@2), '!', &@1, &@$); } | arg + | pipeline + ; + +pipeline : expr tPIPE operation2 opt_paren_args + { + /*%%%*/ + $$ = new_command_qcall(p, ID2VAL(idPIPE), $1, $3, $4, Qnull, &@3, &@$); + /*% %*/ + /*% ripper: command_call!($1, ID2VAL(idPIPE), $3, $4) %*/ + } + | expr tPIPE operation2 opt_paren_args brace_block + { + /*%%%*/ + $$ = new_command_qcall(p, ID2VAL(idPIPE), $1, $3, $4, $5, &@3, &@$); + /*% %*/ + /*% ripper: method_add_block!(command_call!($1, ID2VAL(idPIPE), $3, $4), $5) %*/ + } + | expr tPIPE operation2 command_args + { + /*%%%*/ + $$ = new_command_qcall(p, ID2VAL(idPIPE), $1, $3, $4, Qnull, &@3, &@$); + /*% %*/ + /*% ripper: command_call!($1, ID2VAL(idPIPE), $3, $4) %*/ + } + | expr tPIPE operation2 command_args do_block + { + /*%%%*/ + $$ = new_command_qcall(p, ID2VAL(idPIPE), $1, $3, $4, $5, &@3, &@$); + /*% %*/ + /*% ripper: method_add_block!(command_call!($1, ID2VAL(idPIPE), $3, $4), $5) %*/ + } ; expr_value : expr @@ -2271,29 +2302,12 @@ arg : lhs '=' arg_rhs /*% %*/ /*% ripper: ifop!($1, $3, $6) %*/ } - | pipeline | primary { $$ = $1; } ; -pipeline : arg tPIPE operation2 opt_paren_args - { - /*%%%*/ - $$ = new_command_qcall(p, ID2VAL(idPIPE), $1, $3, $4, Qnull, &@3, &@$); - /*% %*/ - /*% ripper: command_call!($1, ID2VAL(idPIPE), $3, $4) %*/ - } - | arg tPIPE operation2 opt_paren_args brace_block - { - /*%%%*/ - $$ = new_command_qcall(p, ID2VAL(idPIPE), $1, $3, $4, $5, &@3, &@$); - /*% %*/ - /*% ripper: method_add_block!(command_call!($1, ID2VAL(idPIPE), $3, $4), $5) %*/ - } - ; - relop : '>' {$$ = '>';} | '<' {$$ = '<';} | tGEQ {$$ = idGE;} |