summaryrefslogtreecommitdiff
path: root/parsing
diff options
context:
space:
mode:
Diffstat (limited to 'parsing')
-rw-r--r--parsing/asttypes.mli2
-rw-r--r--parsing/parser.mly7
-rw-r--r--parsing/parsetree.mli2
-rw-r--r--parsing/printast.ml11
4 files changed, 17 insertions, 5 deletions
diff --git a/parsing/asttypes.mli b/parsing/asttypes.mli
index ecdfcc5fd4..3cbc5a8212 100644
--- a/parsing/asttypes.mli
+++ b/parsing/asttypes.mli
@@ -37,6 +37,8 @@ type override_flag = Override | Fresh
type closed_flag = Closed | Open
+type focus_flag = AutoFocus | NoFocus
+
type label = string
type 'a loc = 'a Location.loc = {
diff --git a/parsing/parser.mly b/parsing/parser.mly
index fb7d5745ae..0948ad6c7b 100644
--- a/parsing/parser.mly
+++ b/parsing/parser.mly
@@ -1446,8 +1446,13 @@ label_declarations:
| label_declarations SEMI label_declaration { $3 :: $1 }
;
label_declaration:
- mutable_flag label COLON poly_type { (mkrhs $2 2, $1, $4, symbol_rloc()) }
+ mutable_flag focus_flag label COLON poly_type { (mkrhs $3 3, $1, $2, $5, symbol_rloc()) }
;
+focus_flag:
+ | { NoFocus }
+ | MATCH { AutoFocus}
+;
+
/* "with" constraints (additional type equations over signature components) */
diff --git a/parsing/parsetree.mli b/parsing/parsetree.mli
index eeca81acf7..7c59dc017b 100644
--- a/parsing/parsetree.mli
+++ b/parsing/parsetree.mli
@@ -145,7 +145,7 @@ and type_kind =
| Ptype_variant of
(string loc * core_type list * core_type option * Location.t) list
| Ptype_record of
- (string loc * mutable_flag * core_type * Location.t) list
+ (string loc * mutable_flag * focus_flag * core_type * Location.t) list
and exception_declaration = core_type list
diff --git a/parsing/printast.ml b/parsing/printast.ml
index e3d5b018f6..bce1e14542 100644
--- a/parsing/printast.ml
+++ b/parsing/printast.ml
@@ -58,6 +58,11 @@ let fmt_mutable_flag f x =
| Mutable -> fprintf f "Mutable";
;;
+let fmt_focus_flag f = function
+ | AutoFocus -> fprintf f "AutoFocus"
+ | NoFocus -> fprintf f "NoFocus"
+;;
+
let fmt_virtual_flag f x =
match x with
| Virtual -> fprintf f "Virtual";
@@ -364,7 +369,7 @@ and type_kind i ppf x =
list (i+1) string_x_core_type_list_x_location ppf l;
| Ptype_record l ->
line i ppf "Ptype_record\n";
- list (i+1) string_x_mutable_flag_x_core_type_x_location ppf l;
+ list (i+1) label_definition ppf l;
and exception_declaration i ppf x = list i core_type ppf x
@@ -674,8 +679,8 @@ and string_x_core_type_list_x_location i ppf (s, l, r_opt, loc) =
list (i+1) core_type ppf l;
option (i+1) core_type ppf r_opt;
-and string_x_mutable_flag_x_core_type_x_location i ppf (s, mf, ct, loc) =
- line i ppf "\"%s\" %a %a\n" s.txt fmt_mutable_flag mf fmt_location loc;
+and label_definition i ppf (s, mf, ff, ct, loc) =
+ line i ppf "\"%s\" %a %a %a\n" s.txt fmt_mutable_flag mf fmt_focus_flag ff fmt_location loc;
core_type (i+1) ppf ct;
and string_list_x_location i ppf (l, loc) =