let sfold1sep f e entry symbl psymb psep =
let failed =
function
| [ symb; sep ] -> Fail.symb_failed_txt entry sep symb
| _ -> "failed" in
let parse_top =
function
| [ symb; _ ] -> Parse.parse_top_symb entry symb
| _ -> raise Stream.Failure in
let rec kont accu (__strm : _ Stream.t) =
match try Some (psep __strm)
with | Stream.Failure -> None
with
| Some () ->
let a =
(try
try psymb __strm
with
| Stream.Failure ->
let a =
(try parse_top symbl __strm
with
| Stream.Failure ->
raise (Stream.Error (failed symbl)))
in Obj.magic a
with | Stream.Failure -> raise (Stream.Error ""))
in kont (f a accu) __strm
| _ -> accu
in
fun (__strm : _ Stream.t) ->
let a = psymb __strm in kont (f a e) __strm