Commit ec0d6acc authored by POTTIER Francois's avatar POTTIER Francois

Expose [Error.exit()] instead of [Error.errors()].

parent 8499c0de
......@@ -102,6 +102,10 @@ let warning positions format =
let errors () =
!errors
let exit () =
if errors() then
exit 1
let errorp v =
error [ Positions.position v ]
......
......@@ -48,10 +48,10 @@ val errorp: _ Positions.located -> ('a, out_channel, unit, 'b) format4 -> 'a
val signal: Positions.positions -> ('a, out_channel, unit, unit) format4 -> 'a
(* [errors] returns [true] if [signal] was previously called. Together
[signal] and [errors] allow reporting multiple errors before aborting. *)
(* [exit()] exits with exit code 1 if [signal] was previously called. Together,
[signal] and [exit] allow reporting multiple errors before aborting. *)
val errors: unit -> bool
val exit: unit -> unit
(* [warning] is like [signal], except it does not set a flag. *)
......
......@@ -386,7 +386,7 @@ let target_runs : run list -> targeted_run list =
(* Interpret all sentences, possibly displaying multiple errors. *)
let runs = List.map (target_run_1 Error.signal) runs in
(* Abort if an error occurred. *)
if Error.errors() then exit 1;
Error.exit();
(* Remove the options introduced by the first phase above. *)
let runs = List.map target_run_2 runs in
runs
......@@ -561,7 +561,7 @@ let message_table (detect_redundancy : bool) (runs : filtered_targeted_run list)
) table sentences_and_states
) Lr1.NodeMap.empty runs
in
if Error.errors() then exit 1;
Error.exit();
table
(* --------------------------------------------------------------------------- *)
......@@ -709,7 +709,7 @@ let () =
()
);
if Error.errors() then exit 1;
Error.exit();
exit 0
)
......
......@@ -931,8 +931,7 @@ let () =
(* If any fatal error was signaled up to this point, stop now. *)
let () =
if Error.errors() then
exit 1
Error.exit()
(* ------------------------------------------------------------------------ *)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment