From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id OAA04431; Fri, 6 Sep 2002 14:53:00 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id OAA04579 for ; Fri, 6 Sep 2002 14:52:59 +0200 (MET DST) Received: from verdot.inria.fr (verdot.inria.fr [128.93.11.7]) by concorde.inria.fr (8.11.1/8.11.1) with ESMTP id g86Cqx127637 for ; Fri, 6 Sep 2002 14:52:59 +0200 (MET DST) Received: (from ddr@localhost) by verdot.inria.fr (8.9.3/8.9.3) id OAA11809 for caml-list@inria.fr; Fri, 6 Sep 2002 14:52:59 +0200 Date: Fri, 6 Sep 2002 14:52:59 +0200 From: Daniel de Rauglaudre To: caml-list@inria.fr Subject: Re: pa_ifdef [Was: Re: [Caml-list] autoconf and caml] Message-ID: <20020906145259.C27346@verdot.inria.fr> References: <20020905135720.D5343@pauillac.inria.fr> <20020905161617.A29272@kruuna.Helsinki.FI> <20020906104614.GE607@barcelona.lrde.epita.fr> <3D7889EA.8060406@cs.cornell.edu> <20020906130717.647bd532.maxence.guesdon@inria.fr> <20020906123117.GC20833@cs.unibo.it> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <20020906123117.GC20833@cs.unibo.it>; from zack@cs.unibo.it on Fri, Sep 06, 2002 at 02:31:17PM +0200 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk 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