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 'term DisambiguateTypes.environment ->
59 DisambiguateTypes.Environment.key ->
60 ?num:string -> ?args:'term list -> unit -> 'term
62 val find_in_context: string -> string option list -> int
63 val domain_of_ast_term: context:
64 string option list -> CicNotationPt.term -> domain
65 val domain_of_term: context:
66 string option list -> CicNotationPt.term -> domain
68 context:string option list -> CicNotationPt.term CicNotationPt.obj -> domain
70 module type Disambiguator =
72 val disambiguate_thing:
77 mk_implicit:(bool -> 'refined_term) ->
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 aliases:'refined_term DisambiguateTypes.codomain_item
85 DisambiguateTypes.Environment.t ->
86 universe:'refined_term DisambiguateTypes.codomain_item list
87 DisambiguateTypes.Environment.t option ->
89 DisambiguateTypes.interactive_user_uri_choice_type ->
90 DisambiguateTypes.input_or_locate_uri_type ->
91 DisambiguateTypes.Environment.key ->
92 'refined_term DisambiguateTypes.codomain_item list) ->
94 pp_thing:('ast_thing -> string) ->
95 domain_of_thing:(context: string option list -> 'ast_thing -> domain) ->
98 env:'refined_term DisambiguateTypes.codomain_item
99 DisambiguateTypes.Environment.t ->
103 localization_tbl:'cichash ->
106 'metasenv -> 'subst -> 'context -> 'uri -> use_coercions:bool ->
107 'raw_thing -> 'ugraph -> localization_tbl:'cichash ->
108 ('refined_thing, 'metasenv,'subst,'ugraph) test_result) ->
109 localization_tbl:'cichash ->
110 string * int * 'ast_thing ->
111 ((DisambiguateTypes.Environment.key *
112 'refined_term DisambiguateTypes.codomain_item) list *
113 'metasenv * 'subst * 'refined_thing * 'ugraph)
117 module Make (C : DisambiguateTypes.Callbacks) : Disambiguator