Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
[Caml-list] autoconf and caml
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Daniel de Rauglaudre <daniel.de_rauglaudre@i...>
Subject: Re: pa_ifdef [Was: Re: [Caml-list] autoconf and caml]

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, 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 ->
            (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 because of this difference
between "normal" and "revised" syntax.

To unsubscribe, mail Archives:
Bug reports: FAQ:
Beginner's list: