caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Daniel de Rauglaudre <daniel.de_rauglaudre@inria.fr>
To: caml-list@inria.fr
Subject: Re: pa_ifdef [Was: Re: [Caml-list] autoconf and caml]
Date: Fri, 6 Sep 2002 14:52:59 +0200	[thread overview]
Message-ID: <20020906145259.C27346@verdot.inria.fr> (raw)
In-Reply-To: <20020906123117.GC20833@cs.unibo.it>; from zack@cs.unibo.it on Fri, Sep 06, 2002 at 02:31:17PM +0200

Hi,

On Fri, Sep 06, 2002 at 02:31:17PM +0200, Stefano Zacchiroli wrote:

> BTW, last time I used it I was a bit annoyed because you can "ifdef"
> only on type declaration or single "let" bindings IIRC while if you are
> using such a tool you usually expect to be able to "ifdef" on a whole
> block of code in a C-like fashion.
> 
> I don't know if such an extension to the pa_ifdef module is feasible
> with camlp4 ...

Yes, it is possible. In pa_ifdef.ml, there is a call to the grammar
entry Pcaml.str_item:
      | si = Pcaml.str_item -> SdStr si

If you want it to work in "normal" syntax, just change the rule into:
      | sil = LIST1 Pcaml.str_item ->
          SdStr
            (match sil with
             [ [x] -> x
             | _ -> <:str_item< declare $list:sil$ end >> ])

If you prefer the "revised syntax", the syntax rule must be:
      | sil = LIST1 [ x = Pcaml.str_item; ";" -> x ] ->

I did not implement it in pa_ifdef.ml because of this difference
between "normal" and "revised" syntax.

-- 
Daniel de RAUGLAUDRE
daniel.de_rauglaudre@inria.fr
http://cristal.inria.fr/~ddr/
-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


  reply	other threads:[~2002-09-06 12:53 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-09-04 15:20 [Caml-list] autoconf and caml Kenneth Oksanen
2002-09-05 11:57 ` Xavier Leroy
2002-09-05 12:23   ` Kenneth Oksanen
2002-09-05 12:53     ` Olivier Andrieu
2002-09-05 13:16     ` Lauri Alanko
2002-09-06 10:12       ` Kenneth Oksanen
2002-09-06 10:25         ` Jun P.FURUSE
2002-09-06 10:46         ` Yann Régis-Gianas
2002-09-06 10:56           ` Yaron M. Minsky
2002-09-06 11:07             ` Maxence Guesdon
2002-09-06 12:31               ` pa_ifdef [Was: Re: [Caml-list] autoconf and caml] Stefano Zacchiroli
2002-09-06 12:52                 ` Daniel de Rauglaudre [this message]
2002-09-08 10:07                   ` Stefano Zacchiroli
2002-09-09  8:59                     ` Daniel de Rauglaudre
2002-09-06 11:33             ` [Caml-list] autoconf and caml Yann Régis-Gianas
2002-09-06 11:22               ` Yaron M. Minsky
2002-09-06 11:28                 ` Jérôme Marant
2002-09-06 11:41                   ` Yaron M. Minsky
2002-09-06  9:42   ` Hendrik Tews

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=20020906145259.C27346@verdot.inria.fr \
    --to=daniel.de_rauglaudre@inria.fr \
    --cc=caml-list@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;
as well as URLs for NNTP newsgroup(s).