From: Stefano Zacchiroli Date: Fri, 23 Sep 2005 13:51:47 +0000 (+0000) Subject: avoid generating useless parens in mathml contextes that do not require them (e.g... X-Git-Tag: LAST_BEFORE_NEW~33 X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=commitdiff_plain;h=3ee1d126d7608ce91fb0c76f37896dedb606e3a3;p=helm.git avoid generating useless parens in mathml contextes that do not require them (e.g. exponent, fractions, ...) --- diff --git a/helm/ocaml/cic_notation/cicNotationPres.ml b/helm/ocaml/cic_notation/cicNotationPres.ml index 633d702a9..c4679bef7 100644 --- a/helm/ocaml/cic_notation/cicNotationPres.ml +++ b/helm/ocaml/cic_notation/cicNotationPres.ml @@ -331,17 +331,19 @@ let render ids_to_uris = 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 + (* use the one below to reset precedence and associativity *) + let invoke_reinit t = aux [] true (ref None) `None 0 uris t in match l with - | 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.Sub (t1, t2) -> Mpres.Msub (attrs, invoke' t1, invoke_reinit t2) + | A.Sup (t1, t2) -> Mpres.Msup (attrs, invoke' t1, invoke_reinit t2) + | A.Below (t1, t2) -> Mpres.Munder (attrs, invoke' t1, invoke_reinit t2) + | A.Above (t1, t2) -> Mpres.Mover (attrs, invoke' t1, invoke_reinit t2) | A.Frac (t1, t2) - | A.Over (t1, t2) -> Mpres.Mfrac (attrs, invoke' t1, invoke' t2) + | A.Over (t1, t2) -> Mpres.Mfrac (attrs, invoke_reinit t1, invoke_reinit t2) | A.Atop (t1, 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) + Mpres.Mfrac(atop_attributes @ attrs, invoke_reinit t1, invoke_reinit t2) + | A.Sqrt t -> Mpres.Msqrt (attrs, invoke_reinit t) + | A.Root (t1, t2) -> Mpres.Mroot (attrs, invoke_reinit t1, invoke_reinit t2) | A.Box ((_, spacing, _) as kind, terms) -> let children = aux_children mathonly spacing xref pos prec uris