val refresh_status: status -> status
-val crg_of_txt: (status -> 'a) -> (status -> Crg.entity -> 'a) ->
- status -> Txt.command -> 'a
+val crg_of_txt: (status -> 'a) -> (status -> Crg.entity -> 'a) ->
+ (Txt.command -> unit) -> status -> Txt.command -> 'a
let aut_xl = initial_lexer AutLexer.token
-let entity_of_input lexbuf = function
- | Text ->
+let parbuf = ref [] (* parser buffer *)
+
+let gen_text command =
+ parbuf := TxtEntity command :: !parbuf
+
+let entity_of_input lexbuf i = match i, !parbuf with
+ | Text, [] ->
begin match TxtParser.entry (token txt_xl) lexbuf with
| Some e, unget -> txt_xl.unget <- unget; Some (TxtEntity e)
| None, _ -> None
end
- | Automath ->
+ | Text, hd :: tl ->
+ parbuf := tl; Some hd
+ | Automath, _ ->
begin match AutParser.entry (token aut_xl) lexbuf with
| Some e, unget -> aut_xl.unget <- unget; Some (AutEntity e)
| None, _ -> None
match entity, !old with
| AutEntity e, true -> MA.meta_of_aut frr h st.mst e
| AutEntity e, false -> DA.crg_of_aut err g st.dst e
- | TxtEntity e, false -> DT.crg_of_txt crr d st.tst e
+ | TxtEntity e, false -> DT.crg_of_txt crr d gen_text st.tst e
| _ -> assert false
in
let st = if !L.level > 2 then count_input st entity else st in