summaryrefslogtreecommitdiff
path: root/src/parse_ast.ml
diff options
context:
space:
mode:
authorJon French2018-05-16 15:44:19 +0100
committerJon French2018-05-16 15:44:19 +0100
commita7563156f1ea9ca71c2d4cd0de4bad67f0f99b30 (patch)
tree882c978f6e50369e8ddb0f4871755e9f33b4a715 /src/parse_ast.ml
parente2d8fe4d847b6e8f71eecd7aa6d15799bd2a2e11 (diff)
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, ... }
Diffstat (limited to 'src/parse_ast.ml')
-rw-r--r--src/parse_ast.ml12
1 files changed, 10 insertions, 2 deletions
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 *)