]> matita.cs.unibo.it Git - helm.git/blob - helm/gTopLevel/disambiguatingParser.ml.in
ocaml 3.09 transition
[helm.git] / helm / gTopLevel / disambiguatingParser.ml.in
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 exception NoWellTypedInterpretation
27
28 module AndreaAndZackDisambiguatingParser =
29  struct
30   module EnvironmentP3 = CicTextualParser2.EnvironmentP3
31
32   module Make (C : DisambiguateTypes.Callbacks) =
33    struct
34     let disambiguate_term ~(dbd:Mysql.dbd) ~context ~metasenv
35       ?initial_ugraph ~aliases term_as_string
36     =
37       let module Disambiguate' = Disambiguate.Make (C) in
38       let term =
39         CicTextualParser2.parse_term (Stream.of_string term_as_string)
40       in
41       Disambiguate'.disambiguate_term ~dbd ~context ~metasenv
42         ?initial_ugraph ~aliases term
43    end
44  end
45
46
47 (*
48 module CSCTextualDisambiguatingParser =
49  struct
50   module EnvironmentP3 = OldDisambiguate.EnvironmentP3
51
52   module Make (C : DisambiguateTypes.Callbacks) =
53    struct
54     let
55      disambiguate_term mqi_handle context metasenv term_as_string environment
56     =
57      let module Disambiguate' = OldDisambiguate.Make (C) in
58       let name_context =
59        List.map
60         (function
61             Some (n,_) -> Some n
62           | None -> None
63         ) context
64       in
65        let lexbuf = Lexing.from_string term_as_string in
66         let dom,mk_metasenv_and_expr =
67          CicTextualParserContext.main
68           ~context:name_context ~metasenv CicTextualLexer.token lexbuf
69         in
70          Disambiguate'.disambiguate_input mqi_handle
71           context metasenv dom mk_metasenv_and_expr environment
72    end
73  end
74
75 module CSCTexDisambiguatingParser =
76  struct
77   module EnvironmentP3 = OldDisambiguate.EnvironmentP3
78
79   module Make (C : DisambiguateTypes.Callbacks) =
80    struct
81     let
82      disambiguate_term mqi_handle context metasenv term_as_string environment
83     =
84      let module Disambiguate' = OldDisambiguate.Make (C) in
85       let name_context =
86        List.map
87         (function
88             Some (n,_) -> Some n
89           | None -> None
90         ) context
91       in
92        let lexbuf = Lexing.from_string term_as_string in
93         let dom,mk_metasenv_and_expr =
94          TexCicTextualParserContext.main
95           ~context:name_context ~metasenv TexCicTextualLexer.token lexbuf
96         in
97          Disambiguate'.disambiguate_input mqi_handle
98           context metasenv dom mk_metasenv_and_expr environment
99    end
100  end
101 *)
102
103 @CHOSEN_TERM_PARSER@
104