From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: * X-Spam-Status: No, score=1.0 required=5.0 tests=AWL,SPF_NEUTRAL autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from discorde.inria.fr (discorde.inria.fr [192.93.2.38]) by yquem.inria.fr (Postfix) with ESMTP id BDA77BC6C for ; Thu, 26 Jul 2007 16:05:02 +0200 (CEST) Received: from peray.inria.fr (ausone.inria.fr [128.93.8.95]) by discorde.inria.fr (8.13.6/8.13.6) with SMTP id l6QE50Xl017555; Thu, 26 Jul 2007 16:05:00 +0200 Received: by peray.inria.fr (sSMTP sendmail emulation); Thu, _d Jul 2007 16:04:35 +0200 From: "Nicolas Pouillard" Cc: caml-list@inria.fr Subject: Re: [Caml-list] Question on camlp4 3.10 To: Benedikt Grundmann References: <9b415f950707260646v2dd6be3ds71a6d6ff3cd12fd8@mail.gmail.com> <1185457805-sup-9231@ausone.inria.fr> <9b415f950707260657v6f2f92c6s84e2334f8c34e137@mail.gmail.com> In-Reply-To: <9b415f950707260657v6f2f92c6s84e2334f8c34e137@mail.gmail.com> Date: Thu, 26 Jul 2007 16:04:35 +0200 Message-Id: <1185458485-sup-4306@ausone.inria.fr> User-Agent: Sup/0.1 Content-Disposition: inline Content-Type: text/plain; charset=utf-8 X-j-chkmail-Score: MSGID : 46A8AA0C.000 on discorde : j-chkmail score : X : 0/20 1 0.000 -> 1 X-Miltered: at discorde with ID 46A8AA0C.000 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; camlp:01 camlp:01 traversing:01 syntax:01 endline:01 struct:01 endline:01 cheers:01 26,:98 caml-list:01 declaration:02 module:03 module:03 macro:03 let:03 Excerpts from Benedikt Grundmann's message of Thu Jul 26 15:57:29 +0200 2007: > Thanks, > > But that gives me only the first part of my example. What about the > second one? Is there an easy way to do that? > Ah, sorry I didn't read the second part. It's a lot harder to have it correct unless you completely ignore "open". You should do that with a Camlp4 filter, that store the module path while traversing module declaration in a topdown way. > > 2007/7/26, Nicolas Pouillard : > > Look at the Camlp4MacroParser extension, there is __FILE__. > > > > Excerpts from Benedikt Grundmann's message of Thu Jul 26 15:46:26 +0200 2007: > > > How can I get the name of the module where my syntax extension is > > > applied? For simplicity assume that I would like to write a MODULE > > > macro similar to __FILE__ in c. > > > > > > shell> cat > test.ml > > > let _ = print_endline MODULE > > > > > > shell> ./test > > > Test > > > shell> cat > test2.ml > > > module M = > > > struct > > > let _ = print_endline MODULE > > > end > > > > > > shell> ./test2 > > > Test.M > > > > > > > > > Cheers, > > > > > > Bene > > > > > > > -- > > Nicolas Pouillard aka Ertai > > > -- Nicolas Pouillard aka Ertai