diff --git a/parse.y b/parse.y index f6222ea52e..a9fccdd5f7 100644 --- a/parse.y +++ b/parse.y @@ -5468,11 +5468,6 @@ p_top_expr_body : p_expr ; p_expr : p_as - { - p->ctxt.in_alt_pattern = 0; - p->ctxt.capture_in_pattern = 0; - $$ = $1; - } ; p_as : p_expr tASSOC p_variable @@ -5494,6 +5489,7 @@ p_alt : p_alt[left] '|'[alt] if (p->ctxt.capture_in_pattern) { yyerror1(&@alt, "alternative pattern after variable capture"); } + p->ctxt.in_alt_pattern = 0; $$ = NEW_OR($left, $right, &@$, &@alt); /*% ripper: binary!($:left, ID2VAL(idOr), $:right) %*/ } diff --git a/test/.excludes-parsey/TestPatternMatching.rb b/test/.excludes-parsey/TestPatternMatching.rb deleted file mode 100644 index 20a1868d0c..0000000000 --- a/test/.excludes-parsey/TestPatternMatching.rb +++ /dev/null @@ -1 +0,0 @@ -exclude(:test_alternative_pattern_nested, "Deeply nested captures variables are missing a syntax error")