From a7563156f1ea9ca71c2d4cd0de4bad67f0f99b30 Mon Sep 17 00:00:00 2001 From: Jon French Date: Wed, 16 May 2018 15:44:19 +0100 Subject: Add support for inline val-spec declaration for mappings This means that a mapping which formerly had to be pre-declared like val name : a <-> b ... mapping name { x <-> y, ... } can now be shortened to mapping name : a <-> b { x <-> y, ... } --- src/parse_ast.ml | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'src/parse_ast.ml') diff --git a/src/parse_ast.ml b/src/parse_ast.ml index 607285c7..c31d548c 100644 --- a/src/parse_ast.ml +++ b/src/parse_ast.ml @@ -344,6 +344,14 @@ tannot_opt_aux = (* Optional type annotation for functions *) Typ_annot_opt_none | Typ_annot_opt_some of typquant * atyp +type +typschm_opt_aux = + TypSchm_opt_none +| TypSchm_opt_some of typschm + +type +typschm_opt = + TypSchm_opt_aux of typschm_opt_aux * l type effect_opt_aux = (* Optional effect annotation for functions *) @@ -456,7 +464,7 @@ type mapcl = | MCL_aux of ( mapcl_aux) * l type mapdef_aux = (* mapping definition (bidirectional pattern-match function) *) - | MD_mapping of id * ( mapcl) list + | MD_mapping of id * typschm_opt * ( mapcl) list type mapdef = | MD_aux of ( mapdef_aux) * l @@ -498,7 +506,7 @@ scattered_def_aux = (* Function and type union definitions that can be spread a | SD_scattered_funcl of funcl (* scattered function definition clause *) | SD_scattered_variant of id * name_scm_opt * typquant (* scattered union definition header *) | SD_scattered_unioncl of id * type_union (* scattered union definition member *) - | SD_scattered_mapping of id + | SD_scattered_mapping of id * tannot_opt | SD_scattered_mapcl of id * mapcl | SD_scattered_end of id (* scattered definition end *) -- cgit v1.2.3