]> matita.cs.unibo.it Git - helm.git/blobdiff - helm/ocaml/cic_transformations/cexpr2pres.ml
1. folded maction are now selectable
[helm.git] / helm / ocaml / cic_transformations / cexpr2pres.ml
index 40f185dcdbc773ed5d2b03b08d8a97ea6074e05a..f6a3b490d48e4f1e3a717a27ebb015c28e02be31 100644 (file)
@@ -49,7 +49,13 @@ let countterm current_size t =
         let c1 = current_size + (String.length name) in 
         countsubst subst c1
     | CE.LocalVar (_,name) -> current_size + (String.length name)
-    | CE.Meta (_,name) -> current_size + (String.length name)
+    | CE.Meta (_,name,l) ->
+       List.fold_left
+        (fun i t ->
+          match t with
+             None -> i
+           | Some t' -> aux i t'
+        ) (current_size + String.length name) l
     | CE.Num (_,value) -> current_size + (String.length value)
     | CE.Appl (_,l) -> 
         List.fold_left aux current_size l
@@ -134,11 +140,20 @@ let rec cexpr2pres ?(priority = 0) ?(assoc = false) ?(tail = []) t =
         if tail = [] then
           P.Mi (attr,name)
         else P.Mrow([],P.Mi (attr,name)::tail)
-    | CE.Meta (xref,name) ->
+    | CE.Meta (xref,name,l) ->
         let attr = make_attributes [Some "helm","xref"] [xref] in
-        if tail = [] then
-          P.Mi (attr,name)
-        else P.Mrow([],P.Mi (attr,name)::tail)
+        let l' =
+         List.map
+          (function
+              None -> P.Mo [] "_"
+            | Some t -> cexpr2pres t
+          ) l
+        in
+         if tail = [] then
+           P.Mrow ([],P.Mi (attr,name) :: P.Mo ([],"[") :: l' @ [P.Mo ([],"]")])
+         else
+           P.Mrow
+            ([],P.Mi (attr,name):: P.Mo ([],"[") :: l' @ [P.Mo ([],"]")] @ tail)
     | CE.Num (xref,value) -> 
         let attr = make_attributes [Some "helm","xref"] [xref] in
         if tail = [] then
@@ -293,11 +308,20 @@ cexpr2pres_charcount ?(priority = 0) ?(assoc = false) ?(tail = []) t =
         if tail = [] then
           P.Mi (attr,name)
         else P.Mrow ([],P.Mi (attr,name)::tail)
-    | CE.Meta (xref,name) ->
+    | CE.Meta (xref,name,l) ->
         let attr = make_attributes [Some "helm","xref"] [xref] in
-        if tail = [] then
-          P.Mi (attr,name)
-        else P.Mrow ([],P.Mi (attr,name)::tail)
+        let l' =
+         List.map
+          (function
+              None -> P.Mo [] "_"
+            | Some t -> cexpr2pres t
+          ) l
+        in
+         if tail = [] then
+           P.Mrow ([],P.Mi (attr,name) :: P.Mo ([],"[") :: l' @ [P.Mo ([],"]")])
+         else
+           P.Mrow
+            ([],P.Mi (attr,name):: P.Mo ([],"[") :: l' @ [P.Mo ([],"]")] @ tail)
     | CE.Num (xref,value) -> 
         let attr = make_attributes [Some "helm","xref"] [xref] in
         if tail = [] then