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