]> matita.cs.unibo.it Git - helm.git/blob - helm/software/components/disambiguation/disambiguate.mli
The aliases and multi_aliases in the lexicon status are now
[helm.git] / helm / software / components / disambiguation / disambiguate.mli
1 (* Copyright (C) 2004, HELM Team.
2  * 
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.
6  * 
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.
11  * 
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.
16  *
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,
20  * MA  02111-1307, USA.
21  * 
22  * For details, see the HELM World-Wide-Web page,
23  * http://helm.cs.unibo.it/
24  *)
25
26 (** {2 Disambiguation interface} *)
27
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
31   * - environment patch
32   * - location
33   * - error message
34   * - significancy of the error message, if false the error is likely to be
35   *   useless for the final user ... *)
36 exception NoWellTypedInterpretation of
37  int *
38  ((Stdpp.location list * string * string) list *
39   (DisambiguateTypes.domain_item * string) list *
40   (Stdpp.location * string) Lazy.t *
41   bool) list
42 exception PathNotWellFormed
43
44 type 'a disambiguator_input = string * int * 'a
45     
46 type domain = domain_tree list
47 and domain_tree = 
48   Node of Stdpp.location list * DisambiguateTypes.domain_item * domain
49
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
54
55 exception Try_again of string Lazy.t
56
57 val resolve : 
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
62
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
68 val domain_of_obj: 
69   context:string option list -> CicNotationPt.term CicNotationPt.obj -> domain
70
71 module type Disambiguator =
72 sig
73   val disambiguate_thing:
74     context:'context ->
75     metasenv:'metasenv ->
76     subst:'subst ->
77     use_coercions:bool ->
78     string_context_of_context:('context -> string option list) ->
79     initial_ugraph:'ugraph ->
80     hint: 
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 ->
88     lookup_in_library:(
89       DisambiguateTypes.interactive_user_uri_choice_type ->
90       DisambiguateTypes.input_or_locate_uri_type ->
91       DisambiguateTypes.Environment.key ->
92       'alias list) ->
93     uri:'uri ->
94     pp_thing:('ast_thing -> string) ->
95     domain_of_thing:(context: string option list -> 'ast_thing -> domain) ->
96     interpretate_thing:(
97       context:'context ->
98       env:'alias DisambiguateTypes.Environment.t ->
99       uri:'uri ->
100       is_path:bool -> 
101       'ast_thing -> 
102       localization_tbl:'cichash -> 
103         'raw_thing) ->
104     refine_thing:(
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)
112     list * bool
113 end
114
115 module Make (C : DisambiguateTypes.Callbacks) : Disambiguator
116