let string ?strict s =
let buf = Buffer.create 23 in
let store = Buffer.add_char buf in
let rec parse (__strm : _ Stream.t) =
match Stream.peek __strm with
| Some '\\' ->
(Stream.junk __strm;
let _ =
(try backslash_in_string (strict <> None) store __strm
with | Stream.Failure -> raise (Stream.Error ""))
in parse __strm)
| Some c ->
(Stream.junk __strm;
let s = __strm in (store c; parse s))
| _ -> Buffer.contents buf
in parse (Stream.of_string s)