X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;ds=sidebyside;f=helm%2Focaml%2Fcic%2FcicPushParser.ml;h=f9f14df106b971a457c2f10fbed7841bf6ab2c46;hb=2e8243f12626854bdc1e06f2e3d9160ff7901bd3;hp=31ded7ef22d74efab484affc82cd92f7dde82daf;hpb=58bc0455c51116f049a7135dfed6e235c271f0d2;p=helm.git diff --git a/helm/ocaml/cic/cicPushParser.ml b/helm/ocaml/cic/cicPushParser.ml index 31ded7ef2..f9f14df10 100644 --- a/helm/ocaml/cic/cicPushParser.ml +++ b/helm/ocaml/cic/cicPushParser.ml @@ -35,7 +35,6 @@ open Printf - *) module CicParser = @@ -612,6 +611,8 @@ let end_element ctxt tag = mk_obj_attributes (`Class `Projection :: acc) tl | ("class", "elimProp") :: tl -> mk_obj_attributes (`Class (`Elim Cic.Prop) :: acc) tl + | ("class", "elimCProp") :: tl -> + mk_obj_attributes (`Class (`Elim Cic.CProp) :: acc) tl | ("class", "elimSet") :: tl -> mk_obj_attributes (`Class (`Elim Cic.Set) :: acc) tl | ("class", "elimType") :: tl -> @@ -639,12 +640,24 @@ let parse uri filename = let xml_parser = P.create_parser callbacks in ctxt.xml_parser <- Some xml_parser; try - P.parse xml_parser (`File filename); + (try + P.parse xml_parser (`Gzip_file filename); + with exn -> + ctxt.xml_parser <- None; + (* ZACK: the above "<- None" is vital for garbage collection. Without it + * we keep in memory a circular structure parser -> callbacks -> ctxt -> + * parser. I don't know if the ocaml garbage collector is supposed to + * collect such structures, but for sure the expat bindings will (orribly) + * leak when used in conjunction with such structures *) + raise exn); + ctxt.xml_parser <- None; (* ZACK: same comment as above *) (* debug_print (string_of_stack stack);*) + (* assert (List.length ctxt.stack = 1) *) List.hd ctxt.stack with | Failure "int_of_string" -> parse_error ctxt "integer number expected" | Invalid_argument "bool_of_string" -> parse_error ctxt "boolean expected" + | P.Parse_error msg -> parse_error ctxt ("parse error: " ^ msg) | Parser_failure _ | Getter_failure _ as exn -> raise exn