From 764da87ab02d30c578138bdb0f37e7c18f2d4371 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada Date: Tue, 13 Dec 2022 15:18:42 +0900 Subject: [PATCH] [Bug #19195] Allow optional newlines before closing parenthesis --- parse.y | 2 +- test/ruby/test_pattern_matching.rb | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/parse.y b/parse.y index 68352d7b79..2caea0f138 100644 --- a/parse.y +++ b/parse.y @@ -4901,7 +4901,7 @@ p_var_ref : '^' tIDENTIFIER } ; -p_expr_ref : '^' tLPAREN expr_value ')' +p_expr_ref : '^' tLPAREN expr_value rparen { /*%%%*/ $$ = NEW_BEGIN($3, &@$); diff --git a/test/ruby/test_pattern_matching.rb b/test/ruby/test_pattern_matching.rb index fbb934dc84..0337e5d945 100644 --- a/test/ruby/test_pattern_matching.rb +++ b/test/ruby/test_pattern_matching.rb @@ -464,6 +464,8 @@ END true end end + + assert_valid_syntax("1 in ^(1\n)") end def test_array_pattern