1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Continue to the next line beginning with a pipeline

This commit is contained in:
Nobuyoshi Nakada 2019-06-13 22:19:47 +09:00
parent 043f010c28
commit aa7211836b
No known key found for this signature in database
GPG key ID: 4BC7D6DF58D8DF60
2 changed files with 3 additions and 1 deletions

View file

@ -8678,10 +8678,11 @@ parser_yylex(struct parser_params *p)
case '\13': /* '\v' */
space_seen = 1;
break;
case '|':
case '&':
case '.': {
dispatch_delayed_token(p, tIGNORED_NL);
if (peek(p, '.') == (c == '&')) {
if (c == '|' ? peek(p, '>') : (peek(p, '.') == (c == '&'))) {
pushback(p, c);
dispatch_scan_event(p, tSP);
goto retry;

View file

@ -1384,6 +1384,7 @@ eom
x = nil
assert_equal("121", eval('x = 12 |> pow(2) |> to_s 11'))
assert_equal(12, x)
assert_equal([2, 4, 6], eval("1.. |> take 3\n|> map do @1 * 2 end"))
end
private