Commit 7a6df0d1 authored by Pietro Abate's avatar Pietro Abate
Browse files

[r2003-10-24 09:10:24 by szach] added a flag to decide whether to catch...

[r2003-10-24 09:10:24 by szach] added a flag to decide whether to catch exceptions in toplevel or not

Original author: szach
Date: 2003-10-24 09:10:24+00:00
parent 7b94686c
......@@ -4,6 +4,10 @@ open Ident
exception InvalidInputFilename of string
exception InvalidObjectFilename of string
(* if set to false toplevel exception aren't cought. Useful for debugging with
* OCAMLRUNPARAM="b" *)
let catch_exceptions = true
(* retuns a filename without the suffix suff if any *)
let prefix filename suff =
if Filename.check_suffix filename suff then
......@@ -305,9 +309,16 @@ let rec phrases ppf phs = match phs with
| { descr = Ast.Directive `Help } :: rest ->
directive_help ppf;
phrases ppf rest
| { descr = Ast.Directive (`Dump pexpr) } :: rest ->
Format.fprintf ppf "%a@."
Value.dump_xml (Eval.eval !eval_env
(fst (Typer.type_expr !typing_env pexpr)));
phrases ppf rest
| [] -> ()
let catch_exn ppf_err = function
let catch_exn ppf_err exn =
if not catch_exceptions then raise exn;
match exn with
| (End_of_file | Failure _ | Not_found | Invalid_argument _ | Sys.Break)
as e ->
raise e
......
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