X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;f=helm%2Fsoftware%2Fcomponents%2Fng_kernel%2FnReference.ml;h=be6760bf19e3702bf7da7d204b3a066b8a6313a1;hb=105236d275296be7ab2561f83ec539a1d166b445;hp=1b2c0cc2b09eb9be7a30d27d65b0a094f05801be;hpb=345f329e767d0b4a1a87d10e08f92657a95c10ac;p=helm.git diff --git a/helm/software/components/ng_kernel/nReference.ml b/helm/software/components/ng_kernel/nReference.ml index 1b2c0cc2b..be6760bf1 100644 --- a/helm/software/components/ng_kernel/nReference.ml +++ b/helm/software/components/ng_kernel/nReference.ml @@ -18,8 +18,8 @@ type spec = | Def of int (* height *) | Fix of int * int * int (* fixno, recparamno, height *) | CoFix of int - | Ind of bool * int (* inductive, indtyno *) - | Con of int * int (* indtyno, constrno *) + | Ind of bool * int * int (* inductive, indtyno, leftno *) + | Con of int * int * int (* indtyno, constrno, leftno *) type reference = Ref of NUri.uri * spec @@ -64,12 +64,14 @@ let reference_of_string = let h = int_of_string s_h in i,j,h in +(* let get2 s dot = let comma = String.rindex s ',' in let i = int_of_string (String.sub s (dot+5) (comma-dot-5)) in let j = int_of_string (String.sub s (comma+1) (String.length s-comma-2)) in i,j in +*) let get1 s dot = let i = int_of_string (String.sub s (dot+5) (String.length s-1-dot-5)) in i @@ -88,8 +90,8 @@ fun s -> | "def" -> let i = get1 s dot in Ref (u, Def i) | "fix" -> let i,j,h = get3 s dot in Ref (u, Fix (i,j,h)) | "cfx" -> let i = get1 s dot in Ref (u, CoFix (i)) - | "ind" -> let b,i = get2 s dot in Ref (u, Ind (b=1,i)) - | "con" -> let i,j = get2 s dot in Ref (u, Con (i,j)) + | "ind" -> let b,i,l = get3 s dot in Ref (u, Ind (b=1,i,l)) + | "con" -> let i,j,l = get3 s dot in Ref (u, Con (i,j,l)) | _ -> raise Not_found with Not_found -> raise (IllFormedReference (lazy s)) in @@ -108,14 +110,25 @@ let string_of_reference (Ref (u,indinfo)) = s2 ^ ".fix(" ^ string_of_int i ^ "," ^ string_of_int j ^ "," ^ string_of_int h ^ ")" | CoFix i -> s2 ^ ".cfx(" ^ string_of_int i ^ ")" - | Ind (b,i)->s2 ^".ind(" ^(if b then "1" else "0")^ "," ^ string_of_int i ^")" - | Con (i,j) -> s2 ^ ".con(" ^ string_of_int i ^ "," ^ string_of_int j ^ ")" + | Ind (b,i,l)->s2 ^".ind(" ^(if b then "1" else "0")^ "," ^ string_of_int i ^ + "," ^ string_of_int l ^ ")" + | Con (i,j,l) -> s2 ^ ".con(" ^ string_of_int i ^ "," ^ string_of_int j ^ + "," ^ string_of_int l ^ ")" ;; let mk_constructor j = function - | Ref (u, Ind (_,i)) -> - reference_of_string (string_of_reference (Ref (u, Con (i,j)))) - | _ -> assert false + | Ref (u, Ind (_,i,l)) -> + reference_of_string (string_of_reference (Ref (u, Con (i,j,l)))) + | r -> + raise (IllFormedReference (lazy ("NON INDUCTIVE TYPE REFERENCE: " ^ + string_of_reference r))); +;; +let mk_indty b = function + | Ref (u, Con (i,_,l)) -> + reference_of_string (string_of_reference (Ref (u, Ind (b,i,l)))) + | r -> + raise (IllFormedReference (lazy + ("NON INDUCTIVE TYPE CONSTRUCTOR REFERENCE: " ^ string_of_reference r))); ;; let mk_fix i j = function @@ -129,3 +142,11 @@ let mk_cofix i = function reference_of_string (string_of_reference (Ref (u, CoFix i))) | _ -> assert false ;; + +let reference_of_spec u spec = + reference_of_string (string_of_reference (Ref (u, spec))) +;; + + + +