use prerr_* instead of fprintf where possible

This commit is contained in:
Moritz Gmeiner 2024-08-27 18:45:26 +02:00
commit d2077774f7
2 changed files with 11 additions and 11 deletions

View file

@ -50,14 +50,14 @@ let print_error (e : lox_error) =
assert (num_errors <> 0);
Printf.fprintf stderr "found %d %s:\n" num_errors
(if num_errors = 1 then "LexerError" else "LexerErrors");
List.iter (fun e -> LexerError.show e |> Printf.fprintf stderr "%s\n") es
List.iter (fun e -> LexerError.show e |> prerr_endline) es
| ParserError es ->
let num_errors = List.length es in
assert (num_errors <> 0);
Printf.fprintf stderr "found %d %s:\n" num_errors
(if num_errors = 1 then "ParserError" else "ParserErrors");
List.iter (fun e -> ParserError.show e |> Printf.fprintf stderr "%s\n") es
| RuntimeError e -> RuntimeError.show e |> Printf.fprintf stderr "%s\n"
List.iter (fun e -> ParserError.show e |> prerr_endline) es
| RuntimeError e -> RuntimeError.show e |> prerr_endline
let of_lexer_error e = Result.map_error (fun e -> LexerError e) e
let of_parser_error e = Result.map_error (fun e -> ParserError e) e