16 lines
596 B
OCaml
16 lines
596 B
OCaml
let read_all () =
|
|
In_channel.set_binary_mode stdin true;
|
|
let t = Emitter.create
|
|
and culr = Processing.Culriser.create [ Simple 4; Simple 1 ] in
|
|
Angstrom_unix.parse_many ~buf_size:4096 Parse.culr_parse
|
|
(fun c ->
|
|
c |> Processing.ansi_filter
|
|
|> Processing.Culriser.add_colour culr
|
|
|> List.iter (Emitter.serialise t))
|
|
stdin
|
|
|> function
|
|
| _, Ok _ ->
|
|
Emitter.flush t
|
|
(* print_endline ("didn't parse this much: " ^ string_of_int unparsed.len ^ "\nunparsed:\n" ^ (Bigstringaf.substring unparsed.buf ~off:unparsed.off ~len:unparsed.len) ); *)
|
|
| _ -> ()
|