X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;f=helm%2Fsoftware%2Fcomponents%2Fcic%2FcicParser.ml;h=8334ccfb62e65aac3e4162731b23d2b3078b5597;hb=513a2c58442fcfb2545bbc2b146d5a73051d6740;hp=1e9a3a33c1444a553f9b7beaa8b5bee709a58254;hpb=9c9e979d4c45cf3b1ee01688b2c36fe49190ce98;p=helm.git diff --git a/helm/software/components/cic/cicParser.ml b/helm/software/components/cic/cicParser.ml index 1e9a3a33c..8334ccfb6 100644 --- a/helm/software/components/cic/cicParser.ml +++ b/helm/software/components/cic/cicParser.ml @@ -667,6 +667,7 @@ let end_element ctxt tag = push ctxt (match pop_tag_attrs ctxt with | [ "value", "definition"] -> Obj_flavour `Definition + | [ "value", "mutual_definition"] -> Obj_flavour `MutualDefinition | [ "value", "fact"] -> Obj_flavour `Fact | [ "value", "lemma"] -> Obj_flavour `Lemma | [ "value", "remark"] -> Obj_flavour `Remark @@ -678,7 +679,13 @@ let end_element ctxt tag = let class_modifiers = pop_class_modifiers ctxt in push ctxt (match pop_tag_attrs ctxt with - | ["value", "coercion"] -> Obj_class `Coercion + | ["value", "coercion"] -> Obj_class (`Coercion 0) + | ("value", "coercion")::["arity",n] + | ("arity",n)::["value", "coercion"] -> + let arity = try int_of_string n with Failure _ -> + parse_error "\"arity\" must be an integer" + in + Obj_class (`Coercion arity) | ["value", "elim"] -> (match class_modifiers with | [Cic_term (Cic.ASort (_, sort))] -> Obj_class (`Elim sort) @@ -691,8 +698,15 @@ let end_element ctxt tag = (function | Obj_field name -> (match Str.split (Str.regexp " ") name with - | [name] -> name, false - | [name;"coercion"] -> name,true + | [name] -> name, false, 0 + | [name;"coercion"] -> name,true,0 + | [name;"coercion"; n] -> + let n = + try int_of_string n + with Failure _ -> + parse_error "int expected after \"coercion\"" + in + name,true,n | _ -> parse_error "wrong \"field\"'s name attribute") @@ -703,7 +717,8 @@ let end_element ctxt tag = in Obj_class (`Record fields) | ["value", "projection"] -> Obj_class `Projection - | _ -> attribute_error ()) + | ["value", "inversion"] -> Obj_class `InversionPrinciple + | _ -> attribute_error ()) | tag -> match find_helm_exception ctxt with | Some (exn, arg) -> raise (Getter_failure (exn, arg)) @@ -757,7 +772,7 @@ let parse uri filename = | Getter_failure _ as exn -> raise exn | exn -> - raise (Parser_failure ("uncaught exception: " ^ Printexc.to_string exn)) + raise (Parser_failure ("CicParser: uncaught exception: " ^ Printexc.to_string exn)) (** {2 API implementation} *)