2 ||M|| This file is part of HELM, an Hypertextual, Electronic
3 ||A|| Library of Mathematics, developed at the Computer Science
4 ||T|| Department, University of Bologna, Italy.
6 ||T|| HELM is free software; you can redistribute it and/or
7 ||A|| modify it under the terms of the GNU General Public License
8 \ / version 2 or (at your option) any later version.
9 \ / This software is distributed as is, NO WARRANTY.
10 V_______________________________________________________________ *)
17 type id = string (* identifier *)
19 type name = id * bool (* token, real? *)
21 type meta = Main (* main object *)
22 | InProp (* inhabitant of a proposition *)
23 | Progress (* uncompleted object *)
24 | Private (* private global definition *)
27 n_name: name option; (* name *)
28 n_apix: int; (* additional position index *)
29 n_degr: int; (* degree *)
30 n_sort: int; (* sort *)
34 r_meta: meta list; (* metaliguistic classification *)
35 r_info: (string * string) option; (* metaliguistic annotation: language (defaults to "en-US"), text *)
38 type 'term bind = Abst of 'term (* declaration: domain *)
39 | Abbr of 'term (* definition: body *)
40 | Void (* exclusion *)
42 type 'term entity = root_attrs * node_attrs * uri * 'term bind (* attrs, uri, binder *)
44 (* helpers ******************************************************************)
46 let node_attrs ?(apix=0) ?name ?(degr=0) ?(sort=0) () = {
47 n_apix = apix; n_name = name; n_degr = degr; n_sort = sort
50 let root_attrs ?(meta=[]) ?info () = {
51 r_meta = meta; r_info = info;
54 let empty_node = node_attrs ()
56 let empty_root = root_attrs ()
58 let common f (ra, na, u, _) = f ra na u
60 let rec name err f a = match a.n_name with
61 | Some (n, r) -> f n r
64 let rec info err f a = match a.r_info with
65 | Some (lg, tx) -> f lg tx
68 let xlate f xlate_term = function
69 | ra, na, uri, Abst t ->
70 let f t = f (ra, na, uri, Abst t) in xlate_term f t
71 | ra, na, uri, Abbr t ->
72 let f t = f (ra, na, uri, Abbr t) in xlate_term f t