1
(************************************************************************)
2
(* v * The Coq Proof Assistant / The Coq Development Team *)
3
(* <O___,, * CNRS-Ecole Polytechnique-INRIA Futurs-Universite Paris Sud *)
4
(* \VV/ **************************************************************)
5
(* // * This file is distributed under the terms of the *)
6
(* * GNU Lesser General Public License Version 2.1 *)
7
(************************************************************************)
9
(* $Id: line_oriented_parser.ml 5920 2004-07-16 20:01:26Z herbelin $ *)
11
let line_oriented_channel_to_option stop_string input_channel =
14
let current_length = ref 0 in
16
if (i - !count) >= !current_length then begin
17
count := !count + !current_length + 1;
18
buff := input_line input_channel;
19
if !buff = stop_string then
22
current_length := String.length !buff;
26
Some (String.get !buff (i - !count))
28
let flush_until_end_of_stream char_stream =
29
Stream.iter (function _ -> ()) char_stream