X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;f=helm%2Fsoftware%2Fcomponents%2Fcic_disambiguation%2FdisambiguateChoices.ml;h=ed3f82fe8ecd2a0ce16b5034ccd41d7a8d12ac2b;hb=430d6307ae5776ed000a78358a2881cb88936c37;hp=bf14623d7a6943e28839b6d5379237c960594230;hpb=aa941d8c9c451264a721364db1e412b877d4a08f;p=helm.git diff --git a/helm/software/components/cic_disambiguation/disambiguateChoices.ml b/helm/software/components/cic_disambiguation/disambiguateChoices.ml index bf14623d7..ed3f82fe8 100644 --- a/helm/software/components/cic_disambiguation/disambiguateChoices.ml +++ b/helm/software/components/cic_disambiguation/disambiguateChoices.ml @@ -44,7 +44,7 @@ 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 -> let env',rest = @@ -66,18 +66,26 @@ let mk_choice (dsc, args, appl_pattern) = "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 +;;