]> matita.cs.unibo.it Git - helm.git/commitdiff
Partial upgrade to the new disambiguating lexer/parser.
authorClaudio Sacerdoti Coen <claudio.sacerdoticoen@unibo.it>
Tue, 18 Mar 2003 13:01:31 +0000 (13:01 +0000)
committerClaudio Sacerdoti Coen <claudio.sacerdoticoen@unibo.it>
Tue, 18 Mar 2003 13:01:31 +0000 (13:01 +0000)
helm/searchEngine/searchEngine.ml

index 15fb92de786e6d110842ea8cc073a60343626a08..7fa835d8cc098927946104a35e2166a60b6928fd 100644 (file)
@@ -149,13 +149,15 @@ let callback (req: Http_types.request) outchan =
         let rec parse_tokens keys lookup = function (* TODO spostarla fuori *)
           | [] -> keys, lookup
           | "alias" :: key :: value :: rest ->
-              parse_tokens
-                (key::keys)
-                (fun id ->
-                  if id = key then
-                    Some (MQueryMisc.cic_textual_parser_uri_of_string value)
-                  else lookup id)
-                rest
+              let key' = CicTextualParser0.Id key in
+               parse_tokens
+                 (key'::keys)
+                 (fun id ->
+                   if id = key' then
+                     Some
+                      (CicTextualParser0.Uri (MQueryMisc.cic_textual_parser_uri_of_string value))
+                   else lookup id)
+                 rest
           | _ -> failwith "Can't parse aliases"
         in
         let parse_choices choices_raw =
@@ -174,7 +176,8 @@ let callback (req: Http_types.request) outchan =
             (fun _ -> None)
             choices
         in
-        let id_to_uris = parse_tokens [] (fun _ -> None) tokens in
+        let (id_to_uris : Disambiguate.domain_and_interpretation) =
+         parse_tokens [] (fun _ -> None) tokens in
         let id_to_choices =
           try
             let choices_raw = req#param "choices" in
@@ -184,6 +187,12 @@ let callback (req: Http_types.request) outchan =
         let module Chat: Disambiguate.Callbacks =
           struct
 
+            let get_metasenv () =
+             !CicTextualParser0.metasenv
+
+            let set_metasenv metasenv =
+              CicTextualParser0.metasenv := metasenv
+
             let output_html = prerr_endline
 
             let interactive_user_uri_choice
@@ -283,12 +292,15 @@ let callback (req: Http_types.request) outchan =
                         (List.map
                           (fun name ->
                             sprintf "\"alias %s cic:%s\""
-                              name
+                              (match name with
+                                  CicTextualParser0.Id name -> name
+                                | _ -> assert false (*CSC: completare *))
                               (match f name with
                               | None -> assert false
-                              | Some t ->
+                              | Some (CicTextualParser0.Uri t) ->
                                   MQueryMisc.string_of_cic_textual_parser_uri
-                                    t))
+                                    t
+                              | _ -> assert false (*CSC: completare *)))
                           domain)
                 in
                 let processed_line =