X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;f=matitaB%2Fcomponents%2Fcontent_pres%2FtermContentPres.ml;h=13c70be473f506f435a311467dbd4e624b35842d;hb=d6f1365a9f1cb48af8a7b32cf074373466779e7e;hp=d51e4bf02ca392d08571431af6d41bdddcf8d4af;hpb=4e89ae4ac9b001c0479d68d9f74fe81fca6ecd2d;p=helm.git diff --git a/matitaB/components/content_pres/termContentPres.ml b/matitaB/components/content_pres/termContentPres.ml index d51e4bf02..13c70be47 100644 --- a/matitaB/components/content_pres/termContentPres.ml +++ b/matitaB/components/content_pres/termContentPres.ml @@ -66,13 +66,13 @@ let vbox = box Ast.V let hvbox = box Ast.HV let hovbox = box Ast.HOV let break = Ast.Layout Ast.Break -let space = Ast.Literal (`Symbol " ") -let builtin_symbol s = Ast.Literal (`Symbol s) -let keyword k = add_keyword_attrs (Ast.Literal (`Keyword k)) +let space = Ast.Literal (`Symbol (" ", (None,None))) +let builtin_symbol s = Ast.Literal (`Symbol (s,(None,None))) +let keyword k = add_keyword_attrs (Ast.Literal (`Keyword (k,(None,None)))) let number s = add_xml_attrs (* (RenderingAttrs.number_attributes `MathML) *) () - (Ast.Literal (`Number s)) + (Ast.Literal (`Number (s,(None,None)))) let ident i = add_xml_attrs (* (RenderingAttrs.ident_attributes `MathML) *) () @@ -317,9 +317,9 @@ class type g_status = method content_pres_db: db end -class virtual status = +class virtual status uid = object - inherit NCic.status + inherit NCic.status uid val content_pres_db = initial_db method content_pres_db = content_pres_db method set_content_pres_db v = {< content_pres_db = v >} @@ -337,8 +337,8 @@ let set_compiled21 status f = status#set_content_pres_db { status#content_pres_db with compiled21 = Some f } -let add_idrefs = - List.fold_right (fun idref t -> Ast.AttributedTerm (`IdRef idref, t)) +(* let add_idrefs = + List.fold_right (fun idref t -> Ast.AttributedTerm (`IdRef idref, t)) *) let instantiate21 idrefs env l1 = let rec subst_singleton pos env = @@ -376,10 +376,14 @@ let instantiate21 idrefs env l1 = [ value ] | Ast.Magic m -> subst_magic pos env m | Ast.Literal l as t -> - let t = add_idrefs idrefs t in - (match l with - | `Keyword k -> [ add_keyword_attrs t ] - | _ -> [ t ]) + (match idrefs with + | [] -> [t] + | desc::_ -> + let desc = Some desc in + (match l with + | `Keyword (k,_) -> [ Ast.Literal (`Keyword (k,(None,desc))) ] + | `Symbol (s,_) -> [ Ast.Literal (`Symbol (s,(None,desc))) ] + | `Number (n,_) -> [ Ast.Literal (`Number (n,(None,desc))) ])) | Ast.Layout l -> [ Ast.Layout (subst_layout pos env l) ] | t -> [ NotationUtil.visit_ast (subst_singleton pos env) t ] and subst_magic pos env = function @@ -470,17 +474,24 @@ let rec pp_ast1 status term = | NotationEnv.DisambiguationValue _ as v -> v in let ast_env_of_env env = + (* prerr_endline ("### pp_env: " ^ NotationPp.pp_env status env); *) List.map (fun (var, (ty, value)) -> (var, (ty, pp_value value))) env in - prerr_endline ("### pattern matching from 2 to 1 on term " ^ NotationPp.pp_term status term); +(* prerr_endline ("### pattern matching from 2 to 1 on term " ^ + * NotationPp.pp_term status term); *) let res = match term with | Ast.AttributedTerm (attrs, term') -> Ast.AttributedTerm (attrs, pp_ast1 status term') | _ -> (match get_compiled21 status term with - | None -> pp_ast0 status term (pp_ast1 status) + | None -> (* prerr_endline "### ramo 1"; *) + pp_ast0 status term (pp_ast1 status) | Some (env, ctors, pid) -> + (* prerr_endline "### ramo 2"; + prerr_endline ("### constructors:\n" ^ + (String.concat "\n\n" (List.map (NotationPp.pp_term status) ctors)) ^ + "\n\n### constructors end") *) let idrefs = List.flatten (List.map NotationUtil.get_idrefs ctors) in @@ -491,7 +502,8 @@ let rec pp_ast1 status term = in instantiate21 idrefs (ast_env_of_env env) l1) in - prerr_endline ("### pattern matching finished: " ^ NotationPp.pp_term status res); + (* prerr_endline ("### pattern matching finished: " ^ NotationPp.pp_term + * status res);*) res let load_patterns21 status t =