]> matita.cs.unibo.it Git - helm.git/blob - helm/software/components/disambiguation/disambiguate.mli
New modules stack:
[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   'term DisambiguateTypes.environment ->
59   DisambiguateTypes.Environment.key ->
60     ?num:string -> ?args:'term list -> unit -> 'term
61
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
67 val domain_of_obj: 
68   context:string option list -> CicNotationPt.term CicNotationPt.obj -> domain
69
70 module type Disambiguator =
71 sig
72   val disambiguate_thing:
73     context:'context ->
74     metasenv:'metasenv ->
75     subst:'subst ->
76     use_coercions:bool ->
77     mk_implicit:(bool -> 'refined_term) ->
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     aliases:'refined_term DisambiguateTypes.codomain_item 
85       DisambiguateTypes.Environment.t ->
86     universe:'refined_term DisambiguateTypes.codomain_item list
87       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       'refined_term DisambiguateTypes.codomain_item 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:'refined_term DisambiguateTypes.codomain_item
99              DisambiguateTypes.Environment.t ->
100       uri:'uri ->
101       is_path:bool -> 
102       'ast_thing -> 
103       localization_tbl:'cichash -> 
104         'raw_thing) ->
105     refine_thing:(
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)
114     list * bool
115 end
116
117 module Make (C : DisambiguateTypes.Callbacks) : Disambiguator
118