let lines () =
let buf = parsing_buffer () in
make ~name:"lines"
~feed:(feed_string buf)
~next:(function
| true -> (match next_line buf with
| Some line -> `output line
| None -> (match contents buf with
| [], None -> `end_of_stream
| [], Some unfinished_line ->
(empty buf; `output unfinished_line)
| _ -> assert false
)
)
| false -> (match next_line buf with
| None -> `not_ready
| Some line -> `output line
)
)
()