]> matita.cs.unibo.it Git - helm.git/blob - matitaB/components/disambiguation/disambiguate.mli
Matitaweb: first attempt at web UI for disambiguation.
[helm.git] / matitaB / 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 (*
58 val set_choose_uris_callback:
59   DisambiguateTypes.interactive_user_uri_choice_type -> unit
60
61 val set_choose_interp_callback:
62   DisambiguateTypes.interactive_interpretation_choice_type -> unit
63
64 val set_choose_disamb_callback:
65   DisambiguateTypes.interactive_ast_choice_type -> unit
66
67 (** @raise Ambiguous_input if called, default value for internal
68   * choose_uris_callback if not set otherwise with set_choose_uris_callback
69   * above *)
70 val mono_uris_callback: DisambiguateTypes.interactive_user_uri_choice_type
71
72 (** @raise Ambiguous_input if called, default value for internal
73   * choose_interp_callback if not set otherwise with set_choose_interp_callback
74   * above *)
75 val mono_interp_callback: DisambiguateTypes.interactive_interpretation_choice_type
76 *)
77
78 val resolve : 
79   env:'alias1 DisambiguateTypes.InterprEnv.t ->
80   universe: GrafiteAst.alias_spec list DisambiguateTypes.Environment.t ->
81   mk_choice:('alias1 -> 'term DisambiguateTypes.codomain_item) ->
82   DisambiguateTypes.InterprEnv.key -> 'alias1 option -> 
83    [`Num_arg of string | `Args of 'term list] -> 'term
84
85 val find_in_context: string -> string option list -> int
86 val domain_of_term: context:
87   string option list -> NotationPt.term -> domain
88 val domain_of_obj: 
89   context:string option list -> NotationPt.term NotationPt.obj -> domain
90
91 val disambiguate_thing:
92   context:'context ->
93   metasenv:'metasenv ->
94   subst:'subst ->
95   use_coercions:bool ->
96   string_context_of_context:('context -> string option list) ->
97   initial_ugraph:'ugraph ->
98   expty: 'refined_thing option ->
99   mk_implicit:(bool -> 'alias) ->
100   description_of_alias:('alias -> string) ->
101   fix_instance:(DisambiguateTypes.domain_item -> 'alias list -> 'alias list) ->
102   aliases:'alias DisambiguateTypes.InterprEnv.t ->
103   universe:GrafiteAst.alias_spec list DisambiguateTypes.Environment.t ->
104   lookup_in_library:(
105     DisambiguateTypes.interactive_user_uri_choice_type ->
106     DisambiguateTypes.input_or_locate_uri_type ->
107     DisambiguateTypes.Environment.key ->
108     'alias list) ->
109   uri:'uri ->
110   pp_thing:('ast_thing -> string) ->
111   pp_term:(NotationPt.term -> string) ->
112   domain_of_thing:(context: string option list -> 'ast_thing -> domain) ->
113   interpretate_thing:(
114     context:'context ->
115     env:'alias DisambiguateTypes.InterprEnv.t ->
116     universe: GrafiteAst.alias_spec list DisambiguateTypes.Environment.t ->
117     uri:'uri ->
118     is_path:bool -> 
119     'ast_thing -> 
120     localization_tbl:'cichash -> 
121       'raw_thing) ->
122   refine_thing:(
123     'metasenv -> 'subst -> 'context -> 'uri -> use_coercions:bool ->
124     'raw_thing -> 'refined_thing option -> 'ugraph -> localization_tbl:'cichash -> 
125       ('refined_thing, 'metasenv,'subst,'ugraph) test_result) ->
126   visit:(pp_term:(NotationPt.term -> string) ->
127          (NotationPt.term -> bool) -> 'ast_thing -> 
128         ((NotationPt.term -> 'ast_thing) * NotationPt.term) option) -> 
129   mk_localization_tbl:(int -> 'cichash) ->
130   'ast_thing disambiguator_input ->
131   ('ast_thing * 'metasenv * 'subst * 'refined_thing * 'ugraph) list * bool
132
133 val bfvisit :
134   pp_term:(NotationPt.term -> string) -> 
135   (NotationPt.term -> bool) ->
136    NotationPt.term -> ((NotationPt.term -> NotationPt.term) * NotationPt.term) option
137
138 val bfvisit_obj :
139   pp_term:(NotationPt.term -> string) -> 
140   (NotationPt.term -> bool) ->
141    NotationPt.term NotationPt.obj -> ((NotationPt.term -> NotationPt.term NotationPt.obj) * NotationPt.term) option