]> matita.cs.unibo.it Git - helm.git/blobdiff - helm/ocaml/cic_notation/cicNotationPres.ml
use uniform naming for referencing cicNotation* modules
[helm.git] / helm / ocaml / cic_notation / cicNotationPres.ml
index c66566613f64e57fffa33d74896337d11310c11c..8d548e1ebf641c72b034589aead5edb8bd485a1a 100644 (file)
  * http://helm.cs.unibo.it/
  *)
 
-module P = Mpresentation
+module Ast = CicNotationPt
+module Mpres = Mpresentation
 
-type mathml_markup = boxml_markup Mpresentation.mpres
+type mathml_markup = boxml_markup Mpres.mpres
 and boxml_markup = mathml_markup Box.box
 
 type markup = mathml_markup
@@ -104,22 +105,22 @@ let box_of mathonly spec attrs children =
               @ attrs
             in
               match kind with
-                | CicNotationPt.H ->
+                | Ast.H ->
                     if List.for_all eligible_math children then
                       Mpresentation.Mrow (attrs',
                         dress (List.map promote_to_math children))
                     else
                       mpres_of_box (Box.H (attrs',
                         List.map box_of_mpres children))
-(*                 | CicNotationPt.H when List.for_all genuine_math children ->
+(*                 | Ast.H when List.for_all genuine_math children ->
                     Mpresentation.Mrow (attrs', dress children) *)
-               | CicNotationPt.V ->
+               | Ast.V ->
                    mpres_of_box (Box.V (attrs',
                       List.map box_of_mpres children))
-               | CicNotationPt.HV ->
+               | Ast.HV ->
                    mpres_of_box (Box.HV (attrs',
                       List.map box_of_mpres children))
-               | CicNotationPt.HOV ->
+               | Ast.HOV ->
                    mpres_of_box (Box.HOV (attrs',
                       List.map box_of_mpres children))
 
@@ -151,15 +152,15 @@ let pp_pos =
 
 let is_atomic t =
   let rec aux_mpres = function
-    | P.Mi _
-    | P.Mo _
-    | P.Mn _
-    | P.Ms _
-    | P.Mtext _
-    | P.Mspace _ -> true
-    | P.Mobject (_, box) -> aux_box box
-    | P.Maction (_, [mpres])
-    | P.Mrow (_, [mpres]) -> aux_mpres mpres
+    | Mpres.Mi _
+    | Mpres.Mo _
+    | Mpres.Mn _
+    | Mpres.Ms _
+    | Mpres.Mtext _
+    | Mpres.Mspace _ -> true
+    | Mpres.Mobject (_, box) -> aux_box box
+    | Mpres.Maction (_, [mpres])
+    | Mpres.Mrow (_, [mpres]) -> aux_mpres mpres
     | _ -> false
   and aux_box = function
     | Box.Space _
@@ -193,7 +194,7 @@ let add_parens child_prec child_assoc child_pos curr_prec t =
     t
 
 let render ids_to_uris =
-  let module A = CicNotationPt in
+  let module A = Ast in
   let module P = Mpresentation in
   let use_unicode = true in
   let lookup_uri = function
@@ -227,20 +228,20 @@ let render ids_to_uris =
           (RenderingAttrs.number_attributes `MathML)
           @ make_href xmlattrs xref uris
         in
-        P.Mn (attrs, literal)
+        Mpres.Mn (attrs, literal)
     | A.Symbol (literal, _) ->
         let attrs =
           (RenderingAttrs.symbol_attributes `MathML)
           @ make_href xmlattrs xref uris
         in
-        P.Mo (attrs, to_unicode literal)
+        Mpres.Mo (attrs, to_unicode literal)
     | A.Ident (literal, subst)
     | A.Uri (literal, subst) ->
         let attrs =
           (RenderingAttrs.ident_attributes `MathML)
           @ make_href xmlattrs xref (ref [])
         in
-        let name = P.Mi (attrs, to_unicode literal) in
+        let name = Mpres.Mi (attrs, to_unicode literal) in
         (match subst with
         | Some []
         | None -> name
@@ -252,8 +253,8 @@ let render ids_to_uris =
                     (List.map
                       (fun (name, t) ->
                         box_of mathonly (A.H, false, false) [] [
-                          P.Mi ([], name);
-                          P.Mo ([], to_unicode "\\def");
+                          Mpres.Mi ([], name);
+                          Mpres.Mo ([], to_unicode "\\def");
                           aux [] mathonly xref pos prec uris t ])
                       substs))
                 @ [ closed_brace ])
@@ -264,15 +265,15 @@ let render ids_to_uris =
                       let var_name = UriManager.name_of_uri var_uri in
                       let href_attr = Some "xlink", "href", var in
                       box_of mathonly (A.H, false, false) [] [
-                        P.Mi ([href_attr], var_name);
-                        P.Mo ([], to_unicode "\\def");
+                        Mpres.Mi ([href_attr], var_name);
+                        Mpres.Mo ([], to_unicode "\\def");
                         aux [] mathonly xref pos prec uris t ])
                     substs)) *)
             in
             let substs_maction = toggle_action [ hidden_substs; substs' ] in
             box_of mathonly (A.H, false, false) [] [ name; substs_maction ])
     | A.Literal l -> aux_literal xmlattrs xref prec uris l
-    | A.UserInput -> P.Mtext ([], "%")
+    | A.UserInput -> Mpres.Mtext ([], "%")
     | A.Layout l -> aux_layout mathonly xref pos prec uris l
     | A.Magic _
     | A.Variable _ -> assert false  (* should have been instantiated *)
@@ -318,23 +319,23 @@ let render ids_to_uris =
   and aux_literal xmlattrs xref prec uris l =
     let attrs = make_href xmlattrs xref uris in
     (match l with
-    | `Symbol s -> P.Mo (attrs, to_unicode s)
-    | `Keyword s -> P.Mo (attrs, to_unicode s)
-    | `Number s  -> P.Mn (attrs, to_unicode s))
+    | `Symbol s -> Mpres.Mo (attrs, to_unicode s)
+    | `Keyword s -> Mpres.Mo (attrs, to_unicode s)
+    | `Number s  -> Mpres.Mn (attrs, to_unicode s))
   and aux_layout mathonly xref pos prec uris l =
     let attrs = make_xref xref in
     let invoke' t = aux [] true (ref None) pos prec uris t in
     match l with
-    | A.Sub (t1, t2) -> P.Msub (attrs, invoke' t1, invoke' t2)
-    | A.Sup (t1, t2) -> P.Msup (attrs, invoke' t1, invoke' t2)
-    | A.Below (t1, t2) -> P.Munder (attrs, invoke' t1, invoke' t2)
-    | A.Above (t1, t2) -> P.Mover (attrs, invoke' t1, invoke' t2)
+    | A.Sub (t1, t2) -> Mpres.Msub (attrs, invoke' t1, invoke' t2)
+    | A.Sup (t1, t2) -> Mpres.Msup (attrs, invoke' t1, invoke' t2)
+    | A.Below (t1, t2) -> Mpres.Munder (attrs, invoke' t1, invoke' t2)
+    | A.Above (t1, t2) -> Mpres.Mover (attrs, invoke' t1, invoke' t2)
     | A.Frac (t1, t2)
-    | A.Over (t1, t2) -> P.Mfrac (attrs, invoke' t1, invoke' t2)
+    | A.Over (t1, t2) -> Mpres.Mfrac (attrs, invoke' t1, invoke' t2)
     | A.Atop (t1, t2) ->
-        P.Mfrac (atop_attributes @ attrs, invoke' t1, invoke' t2)
-    | A.Sqrt t -> P.Msqrt (attrs, invoke' t)
-    | A.Root (t1, t2) -> P.Mroot (attrs, invoke' t1, invoke' t2)
+        Mpres.Mfrac (atop_attributes @ attrs, invoke' t1, invoke' t2)
+    | A.Sqrt t -> Mpres.Msqrt (attrs, invoke' t)
+    | A.Root (t1, t2) -> Mpres.Mroot (attrs, invoke' t1, invoke' t2)
     | A.Box ((_, spacing, _) as kind, terms) ->
         let children =
           aux_children mathonly spacing xref pos prec uris