99(* ***********************************************************************)
1010
1111(* i*)
12- open Pp
1312open CErrors
1413open Util
1514open Names
@@ -40,7 +39,7 @@ module NamedDecl = Context.Named.Declaration
4039let hole = CAst. make @@ CHole (None )
4140
4241let is_reserved_type ~flags na t =
43- not flags. ExternFlags. raw && flags.ExternFlags. use_implicit_types &&
42+ flags.ExternFlags. use_implicit_types &&
4443 match na with
4544 | Anonymous -> false
4645 | Name id ->
@@ -53,49 +52,6 @@ let is_reserved_type ~flags na t =
5352 true
5453 with Not_found | No_match -> false
5554
56- (* *********************************************************************)
57- (* Control printing of records *)
58-
59- let is_record indsp =
60- try
61- let _ = Structure. find (Global. env () ) indsp in
62- true
63- with Not_found -> false
64-
65- let encode_record r =
66- let indsp = Nametab. global_inductive r in
67- if not (is_record indsp) then
68- user_err ?loc:r.CAst. loc
69- (str " This type is not a structure type." );
70- indsp
71-
72- module PrintingRecordRecord =
73- PrintingInductiveMake (struct
74- let encode _env = encode_record
75- let field = " Record"
76- let title = " Types leading to pretty-printing using record notation: "
77- let member_message s b =
78- str " Terms of " ++ s ++
79- str
80- (if b then " are printed using record notation"
81- else " are not printed using record notation" )
82- end )
83-
84- module PrintingRecordConstructor =
85- PrintingInductiveMake (struct
86- let encode _env = encode_record
87- let field = " Constructor"
88- let title = " Types leading to pretty-printing using constructor form: "
89- let member_message s b =
90- str " Terms of " ++ s ++
91- str
92- (if b then " are printed using constructor form"
93- else " are not printed using constructor form" )
94- end )
95-
96- module PrintingRecord = Goptions. MakeRefTable (PrintingRecordRecord )
97- module PrintingConstructor = Goptions. MakeRefTable (PrintingRecordConstructor )
98-
9955(* *********************************************************************)
10056(* Various externalisation functions *)
10157
@@ -222,8 +178,8 @@ let drop_implicits_in_patt ~flags cst nb_expl ?(tags=[]) args =
222178 in
223179 let try_impls_fit (imps ,args ,tags ) =
224180 if not ! Constrintern. parsing_explicit &&
225- (( flags.ExternFlags. raw || flags. ExternFlags. implicits) &&
226- List. exists is_status_implicit imps)
181+ flags.ExternFlags. implicits &&
182+ List. exists is_status_implicit imps
227183 (* Note: !print_implicits_explicit_args=true not supported for patterns *)
228184 then None
229185 else impls_fit [] (imps,args,tags)
@@ -296,20 +252,16 @@ let pattern_printable_in_both_syntax ~flags (ind,_ as c) =
296252 List. exists (fun (_ ,impls ) ->
297253 (List. length impls > = nb_params) &&
298254 let params,args = Util.List. chop nb_params impls in
299- not flags.ExternFlags. raw && not flags. ExternFlags. implicits &&
255+ not flags.ExternFlags. implicits &&
300256 (List. for_all is_status_implicit params)&& (List. for_all (fun x -> not (is_status_implicit x)) args)
301257 ) impl_st
302258
303259let extern_record_pattern ~flags cstrsp args =
260+ if not (ExternFlags.Records. use_record_syntax flags.ExternFlags. records (fst cstrsp))
261+ then None
262+ else
304263 try
305- if flags.ExternFlags. raw then raise_notrace Exit ;
306264 let projs = Structure. find_projections (Global. env () ) (fst cstrsp) in
307- if PrintingRecord. active (fst cstrsp) then
308- ()
309- else if PrintingConstructor. active (fst cstrsp) then
310- raise_notrace Exit
311- else if not flags.ExternFlags. records then
312- raise_notrace Exit ;
313265 let rec ip projs args acc =
314266 match projs, args with
315267 | [] , [] -> acc
@@ -333,7 +285,7 @@ let extern_record_pattern ~flags cstrsp args =
333285(* Better to use extern_glob_constr composed with injection/retraction ?? *)
334286let rec extern_cases_pattern_in_scope ~flags ((custom ,(lev_after :int option )),scopes as allscopes ) vars pat =
335287 try
336- if ! Flags. in_debugger || flags.ExternFlags. raw || flags. ExternFlags. raw_literals then raise No_match ;
288+ if ! Flags. in_debugger || flags.ExternFlags. raw_literals then raise No_match ;
337289 let (na,p,key) = uninterp_prim_token_cases_pattern ~print_float: flags.float pat scopes in
338290 match availability_of_entry_coercion custom constr_lowest_level with
339291 | None -> raise No_match
@@ -343,7 +295,7 @@ let rec extern_cases_pattern_in_scope ~flags ((custom,(lev_after:int option)),sc
343295 (insert_pat_alias ?loc (insert_pat_delimiters ?loc (CAst. make ?loc @@ CPatPrim p) key) na)
344296 with No_match ->
345297 try
346- if ! Flags. in_debugger || flags. ExternFlags. raw || not flags.ExternFlags. notations then raise No_match ;
298+ if ! Flags. in_debugger || not flags.ExternFlags. notations then raise No_match ;
347299 extern_notation_pattern ~flags allscopes vars pat
348300 (uninterp_cases_pattern_notations (Global. env () ) pat)
349301 with No_match ->
@@ -483,7 +435,7 @@ let extern_ind_pattern_in_scope ~flags (custom,scopes as allscopes) vars ind arg
483435 CAst. make @@ CPatCstr (c, Some args, [] )
484436 else
485437 try
486- if flags. ExternFlags. raw || not flags.ExternFlags. notations || Inductiveops. inductive_has_local_defs (Global. env() ) ind
438+ if not flags.ExternFlags. notations || Inductiveops. inductive_has_local_defs (Global. env() ) ind
487439 then raise No_match ;
488440 extern_notation_ind_pattern ~flags allscopes vars ind args
489441 (uninterp_ind_pattern_notations (Global. env () ) ind)
@@ -511,7 +463,7 @@ let is_gvar id c = match DAst.get c with
511463| _ -> false
512464
513465let is_projection ~flags nargs r =
514- if not ! Flags. in_debugger && not flags. ExternFlags. raw && flags.ExternFlags. projections then
466+ if not ! Flags. in_debugger && flags.ExternFlags. projections then
515467 try
516468 match r with
517469 | GlobRef. ConstRef c ->
@@ -546,7 +498,6 @@ let adjust_implicit_arguments ~flags inctx n args impl =
546498 | a ::args , imp ::impl when is_status_implicit imp ->
547499 let tail = exprec (args,impl) in
548500 let visible =
549- flags.ExternFlags. raw ||
550501 (flags.ExternFlags. implicits && flags.ExternFlags. implicits_explicit_args) ||
551502 (is_needed_for_correct_partial_application tail imp) ||
552503 (flags.ExternFlags. implicits_defensive &&
@@ -583,15 +534,11 @@ let is_start_implicit = function
583534
584535let extern_record ~flags ref args =
585536 try
586- if flags.ExternFlags. raw then raise_notrace Exit ;
587537 let cstrsp = match ref with GlobRef. ConstructRef c -> c | _ -> raise Not_found in
538+ if not (ExternFlags.Records. use_record_syntax flags.ExternFlags. records (fst cstrsp))
539+ then None
540+ else
588541 let struc = Structure. find (Global. env () ) (fst cstrsp) in
589- if PrintingRecord. active (fst cstrsp) then
590- ()
591- else if PrintingConstructor. active (fst cstrsp) then
592- raise_notrace Exit
593- else if not flags.ExternFlags. records then
594- raise_notrace Exit ;
595542 let projs = struc.Structure. projections in
596543 let rec cut args n =
597544 if Int. equal n 0 then args
@@ -633,9 +580,9 @@ let extern_global impl f us =
633580let extern_applied_ref ~flags inctx impl (cf ,f ) us args =
634581 try
635582 if not ! Constrintern. parsing_explicit &&
636- (( flags.ExternFlags. raw ||
637- (flags. ExternFlags. implicits && not flags.ExternFlags. implicits_explicit_args)) &&
638- List. exists is_status_implicit impl)
583+ flags.ExternFlags. implicits &&
584+ not flags.ExternFlags. implicits_explicit_args &&
585+ List. exists is_status_implicit impl
639586 then raise Expl ;
640587 let impl = if ! Constrintern. parsing_explicit then [] else impl in
641588 let n = List. length args in
@@ -706,7 +653,7 @@ let match_coercion_app c = match DAst.get c with
706653
707654let remove_one_coercion ~flags inctx c =
708655 try match match_coercion_app c with
709- | Some (loc ,r ,args ) when not ( flags.ExternFlags. raw || flags. ExternFlags. coercions) ->
656+ | Some (loc ,r ,args ) when not flags.ExternFlags. coercions ->
710657 let nargs = List. length args in
711658 (match Coercionops. hide_coercion r with
712659 | Some nparams when
@@ -1232,22 +1179,16 @@ and extern_local_binder depth scopes eenv = function
12321179 (na::assums,na::ids,
12331180 CLocalAssum ([CAst. make na],extern_relevance_info eenv.uvars r,Default bk,ty) :: l))
12341181
1235- | GLocalPattern ((p ,_ ),_ ,bk ,ty ) ->
1236- let ty =
1237- if eenv.flags.raw then Some (extern_typ depth scopes eenv ty) else None in
1182+ | GLocalPattern ((p ,_ ),_ ,bk ,_ ) ->
12381183 let p = mkCPatOr (List. map (extern_cases_pattern ~flags: eenv.flags eenv.vars) p) in
12391184 let (assums,ids,l) = extern_local_binder depth scopes eenv l in
1240- let p = match ty with
1241- | None -> p
1242- | Some ty -> CAst. make @@ (CPatCast (p,ty)) in
12431185 (assums,ids, CLocalPattern p :: l)
12441186
12451187and extern_eqn depth inctx scopes eenv {CAst. loc;v =(ids ,pll ,c )} =
12461188 let pll = List. map (List. map (extern_cases_pattern_in_scope ~flags: eenv.flags scopes eenv.vars)) pll in
12471189 make ?loc (pll,extern depth inctx scopes eenv c)
12481190
12491191and extern_notations depth inctx scopes eenv nargs t =
1250- if eenv.flags.raw then raise No_match ;
12511192 try extern_possible_prim_token ~flags: eenv.flags scopes t
12521193 with No_match ->
12531194 if not eenv.flags.notations then raise No_match ;
0 commit comments