X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;f=helm%2Fsoftware%2Fcomponents%2Fcic_disambiguation%2FdisambiguateChoices.ml;h=b540033dcfe67ed68f2b7bc2fc3ba3b3b6f788f8;hb=62f476a05884d451bfb90d845ea2b1c0a1c77f96;hp=64d2cf8e0343155736784a6c67d9370fc9ab8343;hpb=f9ec0bd466364409050ffccc94e9cb863e2ddf28;p=helm.git diff --git a/helm/software/components/cic_disambiguation/disambiguateChoices.ml b/helm/software/components/cic_disambiguation/disambiguateChoices.ml index 64d2cf8e0..b540033dc 100644 --- a/helm/software/components/cic_disambiguation/disambiguateChoices.ml +++ b/helm/software/components/cic_disambiguation/disambiguateChoices.ml @@ -44,9 +44,10 @@ let lookup_num_by_dsc dsc = List.find (has_description dsc) !num_choices with Not_found -> raise (Choice_not_found (lazy ("Num with dsc " ^ dsc))) -let mk_choice (dsc, args, appl_pattern) = +let mk_choice ~mk_appl ~mk_implicit ~term_of_uri (dsc, args, appl_pattern)= dsc, - (fun env _ cic_args -> + `Sym_interp + (fun cic_args -> let env',rest = let names = List.map (function CicNotationPt.IdentArg (_, name) -> name) args @@ -62,21 +63,30 @@ let mk_choice (dsc, args, appl_pattern) = try combine_with_rest names cic_args with Invalid_argument _ -> - raise (Invalid_choice (lazy ("The notation " ^ dsc ^ " expects more arguments"))) + raise (Invalid_choice (lazy (Stdpp.dummy_loc, + "The notation " ^ dsc ^ " expects more arguments"))) in let combined = - TermAcicContent.instantiate_appl_pattern env' appl_pattern + TermAcicContent.instantiate_appl_pattern + ~mk_appl ~mk_implicit ~term_of_uri env' appl_pattern in match rest with [] -> combined - | _::_ -> Cic.Appl (combined::rest)) + | _::_ -> mk_appl (combined::rest)) -let lookup_symbol_by_dsc symbol dsc = +let lookup_symbol_by_dsc ~mk_appl ~mk_implicit ~term_of_uri symbol dsc = try - mk_choice + mk_choice ~mk_appl ~mk_implicit ~term_of_uri (List.find (fun (dsc', _, _) -> dsc = dsc') (TermAcicContent.lookup_interpretations symbol)) with TermAcicContent.Interpretation_not_found | Not_found -> raise (Choice_not_found (lazy (sprintf "Symbol %s, dsc %s" symbol dsc))) +let cic_lookup_symbol_by_dsc = lookup_symbol_by_dsc + ~mk_implicit:(function + | true -> Cic.Implicit (Some `Type) + | false -> Cic.Implicit None) + ~mk_appl:(function (Cic.Appl l)::tl -> Cic.Appl (l@tl) | l -> Cic.Appl l) + ~term_of_uri:CicUtil.term_of_uri +;;