]> matita.cs.unibo.it Git - helm.git/blobdiff - helm/software/lambda-delta/complete_rg/crgTxt.ml
dr
[helm.git] / helm / software / lambda-delta / complete_rg / crgTxt.ml
index 267ef384f9201f678565c162024b2e0c55ddd61f..34727aff9a28e00ea756f2eaab3aba2cbe803045 100644 (file)
 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 *)
@@ -30,10 +31,6 @@ let henv = Hashtbl.create henv_size (* optimized global environment *)
 
 (* 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))
@@ -113,7 +110,9 @@ let mk_contents tt = function
    | 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               ->
@@ -144,10 +143,18 @@ let xlate_entity err f st = function
       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