]> matita.cs.unibo.it Git - helm.git/blobdiff - helm/ocaml/mathql_interpreter/mQueryIO.ml
optimized and patched
[helm.git] / helm / ocaml / mathql_interpreter / mQueryIO.ml
index 14199e513136d396f88380fe130346200d430395..e99dc0d72b5c9b5270e3c376b6bdfcc34905e5eb 100644 (file)
@@ -55,18 +55,20 @@ let txt_path out p = out "/"; P.flat_list out (txt_str out) "/" p
 let text_of_result out sep x =
    let txt_attr _ p l b = 
       txt_path out p;
-      if l <> [] then begin 
-         out " = "; P.flat_list out (txt_str out) ", " l
+      begin match l with
+         | []  -> ()
+        | [s] -> out " = "; txt_str out s
+         | l   -> out " = {"; P.flat_list out (txt_str out) ", " l; out "}"
       end; 
-      if b then out ("; " ^ sep)
+      if b then out ("; ")
    in
    let txt_group l = out "{"; I.x_grp_iter txt_attr () l; out "}" in 
    let txt_res _ s l b = 
       txt_str out s; 
       if l <> [] then begin 
-         out " = "; P.flat_list out txt_group ", " l
+         out " attr "; P.flat_list out txt_group ", " l
       end;
-      if b then out "; "
+      if b then out ("; " ^ sep)
    in
    I.x_iter txt_res () x; out sep
 
@@ -124,7 +126,7 @@ and text_of_query out sep x =
       | M.From av -> txt_avar av
    and txt_set = function
       | M.Fun (p, pl, xl)      -> 
-         let o = {L.out = out; L.path = txt_path; 
+         let o = {L.out = out; L.sep = ""; L.path = txt_path; 
                  L.query = text_of_query; L.result = text_of_result
                 } 
         in
@@ -158,7 +160,7 @@ and text_of_query out sep x =
    txt_set x; out sep
 
 let text_out_spec out sep =
-   {L.out = out; L.path = txt_path; 
+   {L.out = out; L.sep = sep; L.path = txt_path; 
     L.query = text_of_query; L.result = text_of_result
    }