Skip to content
This repository has been archived by the owner on Apr 11, 2019. It is now read-only.

Switch to tuple syntax for matching effects #15

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 14 additions & 11 deletions parsing/parser.mly
Original file line number Diff line number Diff line change
Expand Up @@ -1541,9 +1541,9 @@ match_cases:
| match_cases BAR match_case { $3 :: $1 }
;
match_case:
pattern MINUSGREATER seq_expr
computation_pattern MINUSGREATER seq_expr
{ Exp.case $1 $3 }
| pattern WHEN seq_expr MINUSGREATER seq_expr
| computation_pattern WHEN seq_expr MINUSGREATER seq_expr
{ Exp.case $1 ~guard:$3 $5 }
;
fun_def:
Expand Down Expand Up @@ -1599,6 +1599,13 @@ type_constraint:
;

/* Patterns */
computation_pattern:
| pattern
{ $1 }
| EXCEPTION pattern %prec prec_constr_appl
{ mkpat(Ppat_exception $2) }
| EFFECT pattern COMMA pattern
{ mkpat(Ppat_effect($2, $4)) }

pattern:
simple_pattern
Expand Down Expand Up @@ -1627,10 +1634,6 @@ pattern:
{ expecting 3 "pattern" }
| LAZY simple_pattern
{ mkpat(Ppat_lazy $2) }
| EXCEPTION pattern %prec prec_constr_appl
{ mkpat(Ppat_exception $2) }
| EFFECT simple_pattern simple_pattern
{ mkpat(Ppat_effect($2, $3)) }
| pattern attribute
{ Pat.attr $1 $2 }
;
Expand Down Expand Up @@ -1666,15 +1669,15 @@ simple_pattern_not_ident:
{ mkpat(Ppat_array []) }
| LBRACKETBAR pattern_semi_list opt_semi error
{ unclosed "[|" 1 "|]" 4 }
| LPAREN pattern RPAREN
| LPAREN computation_pattern RPAREN
{ reloc_pat $2 }
| LPAREN pattern error
| LPAREN computation_pattern error
{ unclosed "(" 1 ")" 3 }
| LPAREN pattern COLON core_type RPAREN
| LPAREN computation_pattern COLON core_type RPAREN
{ mkpat(Ppat_constraint($2, $4)) }
| LPAREN pattern COLON core_type error
| LPAREN computation_pattern COLON core_type error
{ unclosed "(" 1 ")" 5 }
| LPAREN pattern COLON error
| LPAREN computation_pattern COLON error
{ expecting 4 "type" }
| LPAREN MODULE UIDENT RPAREN
{ mkpat(Ppat_unpack (mkrhs $3 3)) }
Expand Down