1 (* Copyright (C) 2004, HELM Team.
3 * This file is part of HELM, an Hypertextual, Electronic
4 * Library of Mathematics, developed at the Computer Science
5 * Department, University of Bologna, Italy.
7 * HELM is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or (at your option) any later version.
12 * HELM is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with HELM; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place - Suite 330, Boston,
22 * For details, see the HELM World-Wide-Web page,
23 * http://helm.cs.unibo.it/
26 (** {2 Disambiguation interface} *)
28 (* the integer is an offset to be added to each location *)
29 (* list of located error messages, each list is a tuple:
30 * - environment in string form
34 * - significancy of the error message, if false the error is likely to be
35 * useless for the final user ... *)
36 exception NoWellTypedInterpretation of
38 ((Stdpp.location list * string * string) list *
39 (DisambiguateTypes.domain_item * string) list *
40 (Stdpp.location * string) Lazy.t *
42 exception PathNotWellFormed
44 type 'a disambiguator_input = string * int * 'a
46 type domain = domain_tree list
48 Node of Stdpp.location list * DisambiguateTypes.domain_item * domain
50 type ('term,'metasenv,'subst,'graph) test_result =
51 | Ok of 'term * 'metasenv * 'subst * 'graph
52 | Ko of (Stdpp.location * string) Lazy.t
53 | Uncertain of (Stdpp.location * string) Lazy.t
55 exception Try_again of string Lazy.t
58 env:'alias DisambiguateTypes.Environment.t ->
59 mk_choice:('alias -> 'term DisambiguateTypes.codomain_item) ->
60 DisambiguateTypes.Environment.key ->
61 [`Num_arg of string | `Args of 'term list] -> 'term
63 val find_in_context: string -> string option list -> int
64 val domain_of_ast_term: context:
65 string option list -> CicNotationPt.term -> domain
66 val domain_of_term: context:
67 string option list -> CicNotationPt.term -> domain
69 context:string option list -> CicNotationPt.term CicNotationPt.obj -> domain
71 module type Disambiguator =
73 val disambiguate_thing:
78 string_context_of_context:('context -> string option list) ->
79 initial_ugraph:'ugraph ->
81 ('metasenv -> 'raw_thing -> 'raw_thing) *
82 (('refined_thing,'metasenv,'subst,'ugraph) test_result ->
83 ('refined_thing,'metasenv,'subst,'ugraph) test_result) ->
84 mk_implicit:(bool -> 'alias) ->
85 description_of_alias:('alias -> string) ->
86 aliases:'alias DisambiguateTypes.Environment.t ->
87 universe:'alias list DisambiguateTypes.Environment.t option ->
89 DisambiguateTypes.interactive_user_uri_choice_type ->
90 DisambiguateTypes.input_or_locate_uri_type ->
91 DisambiguateTypes.Environment.key ->
94 pp_thing:('ast_thing -> string) ->
95 domain_of_thing:(context: string option list -> 'ast_thing -> domain) ->
98 env:'alias DisambiguateTypes.Environment.t ->
102 localization_tbl:'cichash ->
105 'metasenv -> 'subst -> 'context -> 'uri -> use_coercions:bool ->
106 'raw_thing -> 'ugraph -> localization_tbl:'cichash ->
107 ('refined_thing, 'metasenv,'subst,'ugraph) test_result) ->
108 localization_tbl:'cichash ->
109 string * int * 'ast_thing ->
110 ((DisambiguateTypes.Environment.key * 'alias) list *
111 'metasenv * 'subst * 'refined_thing * 'ugraph)
115 module Make (C : DisambiguateTypes.Callbacks) : Disambiguator