aboutsummaryrefslogtreecommitdiff
path: root/interp/constrextern.ml
diff options
context:
space:
mode:
Diffstat (limited to 'interp/constrextern.ml')
-rw-r--r--interp/constrextern.ml28
1 files changed, 23 insertions, 5 deletions
diff --git a/interp/constrextern.ml b/interp/constrextern.ml
index 63079993c8..95df626d4c 100644
--- a/interp/constrextern.ml
+++ b/interp/constrextern.ml
@@ -359,14 +359,14 @@ let make_notation_gen loc ntn mknot mkprim destprim l bl =
(* Special case to avoid writing "- 3" for e.g. (Z.opp 3) *)
| "- _", [Some (Numeral p)] when not (NumTok.Signed.is_zero p) ->
assert (bl=[]);
- mknot (loc,ntn,([mknot (loc,(InConstrEntrySomeLevel,"( _ )"),l,[])]),[])
+ mknot (loc,ntn,([mknot (loc,(InConstrEntry,"( _ )"),l,[])]),[])
| _ ->
match decompose_notation_key ntn, l with
- | (InConstrEntrySomeLevel,[Terminal "-"; Terminal x]), [] ->
+ | (InConstrEntry,[Terminal "-"; Terminal x]), [] ->
begin match NumTok.Unsigned.parse_string x with
| Some n -> mkprim (loc, Numeral (NumTok.SMinus,n))
| None -> mknot (loc,ntn,l,bl) end
- | (InConstrEntrySomeLevel,[Terminal x]), [] ->
+ | (InConstrEntry,[Terminal x]), [] ->
begin match NumTok.Unsigned.parse_string x with
| Some n -> mkprim (loc, Numeral (NumTok.SPlus,n))
| None -> mknot (loc,ntn,l,bl) end
@@ -486,7 +486,13 @@ and apply_notation_to_pattern ?loc gr ((subst,substlist),(no_implicit,nb_to_drop
function
| NotationRule (_,ntn as specific_ntn) ->
begin
- match availability_of_entry_coercion custom (fst ntn) with
+ let notation_entry_level = match (fst ntn) with
+ | InConstrEntry -> InConstrEntrySomeLevel
+ | InCustomEntry s ->
+ let (_,level,_) = Notation.level_of_notation ntn in
+ InCustomEntryLevel (s, level)
+ in
+ match availability_of_entry_coercion custom notation_entry_level with
| None -> raise No_match
| Some coercion ->
match availability_of_notation specific_ntn (tmp_scope,scopes) with
@@ -1089,6 +1095,9 @@ let rec extern inctx ?impargs scopes vars r =
| GFloat f -> extern_float f (snd scopes)
+ | GArray(u,t,def,ty) ->
+ CArray(u,Array.map (extern inctx scopes vars) t, extern inctx scopes vars def, extern_typ scopes vars ty)
+
in insert_entry_coercion coercion (CAst.make ?loc c)
and extern_typ ?impargs (subentry,(_,scopes)) =
@@ -1260,7 +1269,13 @@ and extern_notation (custom,scopes as allscopes) vars t rules =
(* Try availability of interpretation ... *)
match keyrule with
| NotationRule (_,ntn as specific_ntn) ->
- (match availability_of_entry_coercion custom (fst ntn) with
+ let notation_entry_level = match (fst ntn) with
+ | InConstrEntry -> InConstrEntrySomeLevel
+ | InCustomEntry s ->
+ let (_,level,_) = Notation.level_of_notation ntn in
+ InCustomEntryLevel (s, level)
+ in
+ (match availability_of_entry_coercion custom notation_entry_level with
| None -> raise No_match
| Some coercion ->
match availability_of_notation specific_ntn scopes with
@@ -1457,6 +1472,9 @@ let rec glob_of_pat avoid env sigma pat = DAst.make @@ match pat with
| PSort Sorts.InType -> GSort (UAnonymous {rigid=true})
| PInt i -> GInt i
| PFloat f -> GFloat f
+ | PArray(t,def,ty) ->
+ let glob_of = glob_of_pat avoid env sigma in
+ GArray (None, Array.map glob_of t, glob_of def, glob_of ty)
let extern_constr_pattern env sigma pat =
extern true (InConstrEntrySomeLevel,(None,[])) Id.Set.empty (glob_of_pat Id.Set.empty env sigma pat)