Ajout de | au debut des pattern-matchings et des definitions de types.

git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@340 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
master
Xavier Leroy 1995-10-18 15:32:39 +00:00
parent 0d4e1ea7a2
commit 54af548aa7
1 changed files with 13 additions and 7 deletions

View File

@ -322,14 +322,14 @@ expr:
{ mkexp(Pexp_apply($1, List.rev $2)) } { mkexp(Pexp_apply($1, List.rev $2)) }
| LET rec_flag let_bindings IN expr %prec prec_let | LET rec_flag let_bindings IN expr %prec prec_let
{ mkexp(Pexp_let($2, List.rev $3, $5)) } { mkexp(Pexp_let($2, List.rev $3, $5)) }
| FUNCTION match_cases %prec prec_fun | FUNCTION opt_bar match_cases %prec prec_fun
{ mkexp(Pexp_function(List.rev $2)) } { mkexp(Pexp_function(List.rev $3)) }
| FUN simple_pattern fun_def %prec prec_fun | FUN simple_pattern fun_def %prec prec_fun
{ mkexp(Pexp_function([$2, $3])) } { mkexp(Pexp_function([$2, $3])) }
| MATCH expr WITH match_cases %prec prec_match | MATCH expr WITH opt_bar match_cases %prec prec_match
{ mkexp(Pexp_match($2, List.rev $4)) } { mkexp(Pexp_match($2, List.rev $5)) }
| TRY expr WITH match_cases %prec prec_try | TRY expr WITH opt_bar match_cases %prec prec_try
{ mkexp(Pexp_try($2, List.rev $4)) } { mkexp(Pexp_try($2, List.rev $5)) }
| expr_comma_list | expr_comma_list
{ mkexp(Pexp_tuple(List.rev $1)) } { mkexp(Pexp_tuple(List.rev $1)) }
| constr_longident simple_expr %prec prec_constr_appl | constr_longident simple_expr %prec prec_constr_appl
@ -538,10 +538,14 @@ type_kind:
{ (Ptype_abstract, Some $2) } { (Ptype_abstract, Some $2) }
| EQUAL constructor_declarations | EQUAL constructor_declarations
{ (Ptype_variant(List.rev $2), None) } { (Ptype_variant(List.rev $2), None) }
| EQUAL BAR constructor_declarations
{ (Ptype_variant(List.rev $3), None) }
| EQUAL LBRACE label_declarations RBRACE | EQUAL LBRACE label_declarations RBRACE
{ (Ptype_record(List.rev $3), None) } { (Ptype_record(List.rev $3), None) }
| EQUAL core_type EQUAL constructor_declarations %prec prec_type_def | EQUAL core_type EQUAL constructor_declarations %prec prec_type_def
{ (Ptype_variant(List.rev $4), Some $2) } { (Ptype_variant(List.rev $4), Some $2) }
| EQUAL core_type EQUAL BAR constructor_declarations %prec prec_type_def
{ (Ptype_variant(List.rev $5), Some $2) }
| EQUAL core_type EQUAL LBRACE label_declarations RBRACE %prec prec_type_def | EQUAL core_type EQUAL LBRACE label_declarations RBRACE %prec prec_type_def
{ (Ptype_record(List.rev $5), Some $2) } { (Ptype_record(List.rev $5), Some $2) }
; ;
@ -724,5 +728,7 @@ mutable_flag:
/* empty */ { Immutable } /* empty */ { Immutable }
| MUTABLE { Mutable } | MUTABLE { Mutable }
; ;
opt_bar:
/* empty */ { () }
| BAR { () }
%% %%