X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;f=helm%2Fsoftware%2Fcomponents%2Fcic%2FcicParser.ml;h=30e7a0b38903385fdee48dee1dbc28a0458e4467;hb=cab8b6ddde6291eb2bccad550bbd4634c00986ae;hp=9fac7badba3a10e0b8eb166df6ca67d88ff31bc0;hpb=b699884bb9816aa55f9bd0a2d7bffde4dc03c643;p=helm.git diff --git a/helm/software/components/cic/cicParser.ml b/helm/software/components/cic/cicParser.ml index 9fac7badb..30e7a0b38 100644 --- a/helm/software/components/cic/cicParser.ml +++ b/helm/software/components/cic/cicParser.ml @@ -296,23 +296,30 @@ let uri_list_of_string = fun s -> List.map uri_of_string (Str.split space_RE s) +let impredicative_set = ref true;; + let sort_of_string ctxt = function | "Prop" -> Cic.Prop - | "Set" -> Cic.Set - | "CProp" -> Cic.CProp (* THIS CASE IS HERE ONLY TO ALLOW THE PARSING OF COQ LIBRARY * THIS SHOULD BE REMOVED AS SOON AS univ_maker OR COQ'S EXPORTATION * IS FIXED *) + | "CProp" -> Cic.CProp (CicUniv.fresh ~uri:ctxt.uri ()) | "Type" -> Cic.Type (CicUniv.fresh ~uri:ctxt.uri ()) + | "Set" when !impredicative_set -> Cic.Set + | "Set" -> Cic.Type (CicUniv.fresh ~uri:ctxt.uri ()) | s -> let len = String.length s in - if not(len > 5) then parse_error ctxt "sort expected"; - if not(String.sub s 0 5 = "Type:") then parse_error ctxt "sort expected"; - try - Cic.Type - (CicUniv.fresh - ~uri:ctxt.uri - ~id:(int_of_string (String.sub s 5 (len - 5))) ()) + let sort_len, mk_sort = + if len > 5 && String.sub s 0 5 = "Type:" then 5,fun x -> Cic.Type x + else if len > 6 && String.sub s 0 6 = "CProp:" then 6,fun x->Cic.CProp x + else parse_error ctxt "sort expected" + in + let s = String.sub s sort_len (len - sort_len) in + let i = String.index s ':' in + let id = int_of_string (String.sub s 0 i) in + let suri = String.sub s (i+1) (len - sort_len - i - 1) in + let uri = UriManager.uri_of_string suri in + try mk_sort (CicUniv.fresh ~uri ~id ()) with | Failure "int_of_string" | Invalid_argument _ -> parse_error ctxt "sort expected"