Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: "Markus E.L." <ls-ocaml-developer-2006@m-e-leypold.de>
To: caml-list@yquem.inria.fr
Subject: Re: [Caml-list] scripting the toplevel
Date: Wed, 30 May 2007 18:46:35 +0200	[thread overview]
Message-ID: <d6veea9s44.fsf@hod.lan.m-e-leypold.de> (raw)
In-Reply-To: <g3fy5eb8zw.fsf@hod.lan.m-e-leypold.de> (Markus E. L.'s message of "Wed, 30 May 2007 17:56:35 +0200")


> 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


      reply	other threads:[~2007-05-30 16:37 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-05-30 15:27 Yitzhak Mandelbaum
2007-05-30 15:56 ` [Caml-list] " Markus E.L.
2007-05-30 16:46   ` Markus E.L. [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d6veea9s44.fsf@hod.lan.m-e-leypold.de \
    --to=ls-ocaml-developer-2006@m-e-leypold.de \
    --cc=caml-list@yquem.inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox