let string_to_item ?filename () =
let name = sprintf "psl_parser:%s" (Option.value ~default:"<>" filename) in
Lines.Transform.make_merge_error
~name ?filename ~next:(fun linebuf ->
let open Lines.Buffer in
let rec get_line () =
match next_line linebuf with
| None -> `not_ready
| Some line ->
let line' = (line :> string) in
if line' = version_line
|| is_spaces_line line'
|| line' = header_line1
|| line' = header_line2
|| is_dashes_line line'
then
get_line ()
else
`output (line_to_item (current_position linebuf) line)
in
get_line()
) ()