aboutsummaryrefslogtreecommitdiff
path: root/parsing
diff options
context:
space:
mode:
authorPierre-Marie Pédrot2016-01-17 01:46:02 +0100
committerPierre-Marie Pédrot2016-01-17 01:49:24 +0100
commit88a16f49efd315aa1413da67f6d321a5fe269772 (patch)
tree9ed3e05a39e0e16f686aed58386b6a9912e5571a /parsing
parent15747cc2aaaeeb5d59ec90cda940c1dc6de01a6a (diff)
Simplification and type-safety of Pcoq thanks to GADTs in Genarg.
Diffstat (limited to 'parsing')
-rw-r--r--parsing/pcoq.ml12
1 files changed, 8 insertions, 4 deletions
diff --git a/parsing/pcoq.ml b/parsing/pcoq.ml
index d5acf59f6f..c87084f2cc 100644
--- a/parsing/pcoq.ml
+++ b/parsing/pcoq.ml
@@ -237,14 +237,15 @@ let new_entry etyp u s =
let e = Gram.entry_create ename in
Hashtbl.add utab s (TypedEntry (etyp, e)); e
-let create_entry u s etyp =
+let create_entry (type a) u s (etyp : a raw_abstract_argument_type) : a Gram.entry =
let utab = get_utable u in
try
let TypedEntry (typ, e) = Hashtbl.find utab s in
- let u = Entry.univ_name u in
- if not (argument_type_eq (unquote typ) (unquote etyp)) then
+ match abstract_argument_type_eq typ etyp with
+ | None ->
+ let u = Entry.univ_name u in
failwith ("Entry " ^ u ^ ":" ^ s ^ " already exists with another type");
- Obj.magic e
+ | Some Refl -> e
with Not_found ->
new_entry etyp u s
@@ -809,6 +810,9 @@ let rec parse_user_entry s sep =
let s = match s with "hyp" -> "var" | _ -> s in
Uentry s
+let arg_list = function Rawwit t -> Rawwit (ListArg t)
+let arg_opt = function Rawwit t -> Rawwit (OptArg t)
+
let rec interp_entry_name up_level s sep =
let rec eval = function
| Ulist1 e ->