diff options
author | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2019-06-13 22:19:47 +0900 |
---|---|---|
committer | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2019-06-13 22:19:47 +0900 |
commit | aa7211836b769231a2a8ef6b6ec2fd0ec882ef29 (patch) | |
tree | e0a6bf725ecd79bdc2122a6c44f932d6cc8f0469 | |
parent | 043f010c28e82ea38978bf8ed885416f133b5b75 (diff) | |
download | ruby-aa7211836b769231a2a8ef6b6ec2fd0ec882ef29.tar.gz |
Continue to the next line beginning with a pipeline
-rw-r--r-- | parse.y | 3 | ||||
-rw-r--r-- | test/ruby/test_syntax.rb | 1 |
2 files changed, 3 insertions, 1 deletions
@@ -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; diff --git a/test/ruby/test_syntax.rb b/test/ruby/test_syntax.rb index b3e2183830..d2638c79b4 100644 --- a/test/ruby/test_syntax.rb +++ b/test/ruby/test_syntax.rb @@ -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 |