module U = NUri
module H = Hierarchy
module C = Cps
+module O = Options
module Y = Entity
module T = Txt
module TT = TxtTxt
module D = Crg
type status = {
- path: T.id list; (* current section path *)
- line: int; (* line number *)
- sort: int; (* first default sort index *)
- mk_uri:Y.uri_generator (* uri generator *)
+ path : T.id list; (* current section path *)
+ line : int; (* line number *)
+ sort : int; (* first default sort index *)
+ mk_uri: O.uri_generator (* uri generator *)
}
let henv_size = 7000 (* hash tables initial size *)
(* Internal functions *******************************************************)
-let initial_status mk_uri = {
- path = []; line = 1; sort = 0; mk_uri = mk_uri
-}
-
let name_of_id ?(r=true) id = Y.Name (id, r)
let mk_lref f i j k = f (D.TLRef ([Y.Apix k], i, j))
| T.Def -> [], Y.Abbr tt
| T.Th -> [], Y.Abbr tt
-let xlate_entity err f st = function
+let xlate_entity err f gen st = function
+ | T.Require _ ->
+ err st
| T.Section (Some name) ->
err {st with path = name :: st.path}
| T.Section None ->
let a = if meta <> "" then Y.Meta meta :: a else a in
let entity = Y.Mark st.line :: a, uri, b in
f {st with line = succ st.line} entity
+ | T.Generate _ ->
+ err st
(* Interface functions ******************************************************)
-let initial_status mk_uri =
- initial_status mk_uri
+let initial_status () =
+ Hashtbl.clear henv; {
+ path = []; line = 1; sort = 0; mk_uri = O.get_mk_uri ()
+}
+
+let refresh_status st = {st with
+ mk_uri = O.get_mk_uri ()
+}
let crg_of_txt = xlate_entity