ruby-changes:56105
From: Nobuyoshi <ko1@a...>
Date: Thu, 13 Jun 2019 22:21:33 +0900 (JST)
Subject: [ruby-changes:56105] Nobuyoshi Nakada: aa7211836b (trunk): Continue to the next line beginning with a pipeline
https://git.ruby-lang.org/ruby.git/commit/?id=aa7211836b From aa7211836b769231a2a8ef6b6ec2fd0ec882ef29 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada <nobu@r...> Date: Thu, 13 Jun 2019 22:19:47 +0900 Subject: Continue to the next line beginning with a pipeline diff --git a/parse.y b/parse.y index a31139f..58f0e4b 100644 --- a/parse.y +++ b/parse.y @@ -8678,10 +8678,11 @@ parser_yylex(struct parser_params *p) https://github.com/ruby/ruby/blob/trunk/parse.y#L8678 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 b3e2183..d2638c7 100644 --- a/test/ruby/test_syntax.rb +++ b/test/ruby/test_syntax.rb @@ -1384,6 +1384,7 @@ eom https://github.com/ruby/ruby/blob/trunk/test/ruby/test_syntax.rb#L1384 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 -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/