[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | Markus E.L. <ls-ocaml-developer-2006@m...> |
| Subject: | Re: [Caml-list] scripting the toplevel |
> I picked the following trick from Gerd Stolpmann's findlib; > > exception Toplevel_error of string;; > > let toplevel_exec s = > let l = Lexing.from_string s in > let ph = !Toploop.parse_toplevel_phrase l in > let fmt = Format.make_formatter (fun _ _ _ -> ()) (fun _ -> ()) in > if not (Toploop.execute_phrase false fmt ph) > then raise (Toplevel_error s) > ;; You'd probably want to have a different formatter at 'fmt = ...': This formatter just suppresses arror messages which was good enough for my purposes (extending the toplevel by some new directives :-) ). Regards -- Markus