let verbose = false
exception Failure of string
+exception Multiple_interpretations
let fail msg = raise (Failure msg)
module DisambiguateCallbacks =
List.filter
(fun uri -> not (String.sub uri (String.length uri - 4) 4 = ".var"))
- let interactive_interpretation_choice _ = fail "Multiple interpretations"
+ let interactive_interpretation_choice _ = raise Multiple_interpretations
let input_or_locate_uri ~title = fail "Unknown identifier"
end
| Cic.AInductiveDefinition _ ->
debug_print "AInductiveDefinition: boh ..."
-let test_uri uri = try test_uri uri; true with _ -> false
+let test_uri uri =
+ try
+ test_uri uri;
+ `Ok
+ with
+ | Multiple_interpretations -> `Maybe
+ | exn ->
+ prerr_endline (sprintf "Top Level Uncaught Exception: %s"
+ (Printexc.to_string exn));
+ `Nok
let _ =
let idx = ref 0 in
let ok = ref [] in
let nok = ref [] in
+ let maybe = ref [] in
try
let mode = if Sys.argv.(1) = "-" then `Stdin else `Cmdline in
while true do
in
printf "Testing URI: %-55s " (uri_str ^ " ..."); flush stdout;
let uri = UriManager.uri_of_string uri_str in
- if test_uri uri then begin
- print_endline "\e[01;32m[ OK ]\e[00m";
- ok := uri_str :: !ok
- end else begin
- print_endline "\e[01;31m[ FAILED ]\e[00m";
- nok := uri_str :: !nok
- end
+ match test_uri uri with
+ | `Ok ->
+ print_endline "\e[01;32m[ OK ]\e[00m";
+ ok := uri_str :: !ok
+ | `Nok ->
+ print_endline "\e[01;31m[ FAILED ]\e[00m";
+ nok := uri_str :: !nok
+ | `Maybe ->
+ print_endline "\e[01;33m[ MANY ]\e[00m";
+ maybe := uri_str :: !maybe
done
with Invalid_argument _ | End_of_file ->
print_newline ();
List.iter (fun s -> print_endline ("\t" ^ s)) (List.rev !ok);
print_endline "Failed URIs:";
List.iter (fun s -> print_endline ("\t" ^ s)) (List.rev !nok);
+ print_endline "Multiple answers URIs:";
+ List.iter (fun s -> print_endline ("\t" ^ s)) (List.rev !maybe);
print_newline ()