let read_all () = In_channel.set_binary_mode stdin true; let open Types in let t = Emitter.create and culr = Processing.Culriser.create ~s:[| 0; 2; 1; 3; 4 |] ~f:[ (function RGB (r, g, _) -> (g > 0 || r = 255) | _ -> true) ] [| Simple 0; Simple 1; Simple 2; RGB (255, 0, 127); RGB (0, 200, 0) |] in Emitter.serialise t (Ansi [ Fg (Processing.Culriser.next culr) ]); Angstrom_unix.parse_many ~buf_size:4096 Parse.culr_parse (fun c -> c |> Processing.ansi_filter |> Processing.Culriser.add_colour culr t |> 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) ); *) | _ -> ()