Last active
October 6, 2019 13:36
-
-
Save patricoferris/92a7fe4478ad59dbc9a35ab91ed0f024 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(* Part of the %inline expr_attrs productions *) | |
| FUN ext_attributes labeled_simple_pattern fun_def | |
{ let (l,o,p) = $3 in | |
Pexp_fun(l, o, p, $4), $2 } | |
(* the fun_def, lident_list and ext_attributes is then defined as the following *) | |
fun_def: | |
MINUSGREATER seq_expr | |
{ $2 } | |
| mkexp(COLON atomic_type MINUSGREATER seq_expr | |
{ Pexp_constraint ($4, $2) }) | |
{ $1 } | |
/* Cf #5939: we used to accept (fun p when e0 -> e) */ | |
| labeled_simple_pattern fun_def | |
{ | |
let (l,o,p) = $1 in | |
ghexp ~loc:$sloc (Pexp_fun(l, o, p, $2)) | |
} | |
| LPAREN TYPE lident_list RPAREN fun_def | |
{ mk_newtypes ~loc:$sloc $3 $5 } | |
; | |
labeled_simple_pattern: | |
QUESTION LPAREN label_let_pattern opt_default RPAREN | |
{ (Optional (fst $3), $4, snd $3) } | |
| QUESTION label_var | |
{ (Optional (fst $2), None, snd $2) } | |
| OPTLABEL LPAREN let_pattern opt_default RPAREN | |
{ (Optional $1, $4, $3) } | |
| OPTLABEL pattern_var | |
{ (Optional $1, None, $2) } | |
| TILDE LPAREN label_let_pattern RPAREN | |
{ (Labelled (fst $3), None, snd $3) } | |
| TILDE label_var | |
{ (Labelled (fst $2), None, snd $2) } | |
| LABEL simple_pattern | |
{ (Labelled $1, None, $2) } | |
| simple_pattern | |
{ (Nolabel, None, $1) } | |
; | |
%inline ext_attributes: | |
ext attributes { $1, $2 } | |
; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment