]> matita.cs.unibo.it Git - helm.git/commitdiff
A parser for aliases implemented (required by the Whelp).
authorClaudio Sacerdoti Coen <claudio.sacerdoticoen@unibo.it>
Tue, 30 Aug 2005 09:39:12 +0000 (09:39 +0000)
committerClaudio Sacerdoti Coen <claudio.sacerdoticoen@unibo.it>
Tue, 30 Aug 2005 09:39:12 +0000 (09:39 +0000)
helm/matita/matita.txt
helm/matita/matitaEngine.ml
helm/ocaml/cic_disambiguation/Makefile
helm/ocaml/cic_disambiguation/disambiguatePp.ml
helm/ocaml/cic_disambiguation/disambiguatePp.mli

index a8f18ea3210a69353682104ea40a313f30bf2849..412879c9c5f88b4457289a83e531b8dd5c7a9f1d 100644 (file)
@@ -70,6 +70,8 @@ TODO
   - riattaccare hbugs (brrr...) -> Zack
 
   GUI LOGICA
+  - fattorizzare codice fra MatitaEngine e DisambiguatePp (dove, fra l'altro,
+    ora io (=CSC) ho messo anche un parser!!!)
   - verificare se tutte le query sono ora ottimizzate (usando il comando
     explain) e usano gli indici in maniera ottimale; inoltre migliorare gli
     indici sulle tabelle hits and count
index 24872ffd0c408ceffdb163eb58499baa125946c8..c2db06efaeee6b5a708caecd5735a9eace2a94d9 100644 (file)
@@ -598,6 +598,8 @@ let eval_command opts status cmd =
       eval_coercion status coercion
   | GrafiteAst.Alias (loc, spec) -> 
      let aliases =
+      (*CSC: Warning: this code should be factorized with the corresponding
+             code in DisambiguatePp *)
       match spec with
       | GrafiteAst.Ident_alias (id,uri) -> 
          DisambiguateTypes.Environment.add 
index dcc99fdeccfe52af80c4a73b0818346dadb6a76f..064a1b2e1363fedd4064d0d9b72ddaa1106a3834 100644 (file)
@@ -7,8 +7,8 @@ REQUIRES = \
 NOTATIONS = number
 INTERFACE_FILES =              \
        disambiguateTypes.mli   \
-       disambiguatePp.mli      \
        disambiguateChoices.mli \
+       disambiguatePp.mli      \
        disambiguate.mli
 IMPLEMENTATION_FILES = \
        $(patsubst %.mli, %.ml, $(INTERFACE_FILES)) \
index decaa5f5c6e9a8b13f2ecba403a9412d2d3970a5..d6a33cfaedf76a1daa38daa1e1279a8d9f024d21 100644 (file)
 
 open DisambiguateTypes
 
+let parse_environment str =
+ let stream = Stream.of_string str in
+ let environment = ref Environment.empty in
+  try
+    while true do
+     let alias =
+      match GrafiteParser.parse_statement stream with
+         GrafiteAst.Executable (_, GrafiteAst.Command (_, GrafiteAst.Alias (_,alias)))
+           -> alias
+       | _ -> assert false in
+     let key,value =
+      (*CSC: Warning: this code should be factorized with the corresponding
+             code in MatitaEngine *)
+      match alias with
+         GrafiteAst.Ident_alias (id,uri) ->
+          Id id,
+          (uri,(fun _ _ _-> CicUtil.term_of_uri (UriManager.uri_of_string uri)))
+       | GrafiteAst.Symbol_alias (symb,instance,desc) ->
+          Symbol (symb,instance),
+          DisambiguateChoices.lookup_symbol_by_dsc symb desc
+       | GrafiteAst.Number_alias (instance,desc) ->
+          Num instance,
+          DisambiguateChoices.lookup_num_by_dsc desc
+     in
+      environment := Environment.add key value !environment;
+    done;
+    assert false
+  with End_of_file ->
+   !environment
+
 let pp_environment env =
   let aliases =
     Environment.fold
index 985ba32fc0bf3e3c9489fa2d0fa906903da3cbe7..68cecfaa89550131ef8a695fcef35df4a28bc0a8 100644 (file)
@@ -23,5 +23,5 @@
  * http://helm.cs.unibo.it/
  *)
 
+val parse_environment: string -> DisambiguateTypes.environment
 val pp_environment: DisambiguateTypes.environment -> string
-