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=2.8 required=5.0 tests=AWL,DNS_FROM_RFC_POST, 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 mail4-relais-sop.national.inria.fr (mail4-relais-sop.national.inria.fr [192.134.164.105]) by yquem.inria.fr (Postfix) with ESMTP id AC23DBC37 for ; Tue, 15 Sep 2009 14:26:39 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Au4AAPMkr0rRVdvfkGdsb2JhbACSCokBPwEBAQEJCQwHEwOvfoEuj1wBAwIEhBMFgVZy X-IronPort-AV: E=Sophos;i="4.44,390,1249250400"; d="scan'208";a="46621283" Received: from mail-ew0-f223.google.com ([209.85.219.223]) by mail4-smtp-sop.national.inria.fr with ESMTP; 15 Sep 2009 14:26:39 +0200 Received: by ewy23 with SMTP id 23so3678807ewy.26 for ; Tue, 15 Sep 2009 05:26:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:content-type :content-transfer-encoding; bh=g44i4Q7vVdjGAi50dsXpKNEKPbj8y5WpwHd6+lLd4OE=; b=N5jibDDsCynwx/XG82+hQTRRrFC6+TOX8C8Xo1cQwoQNTHJe8GQiCkNOl510u1dIgw t74vFN16hkeCIZaJolKE9Zdz1K0vpmBhOyMJxoNzvfYEHDkHGJ8iqf0oqThpRIBQSpdr 4+F3OtoOoCG66IzbIdLWy3QwXZEedSVk67yl4= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; b=sM3v5Ehpp91ENBfL96lvbCB2HIO00t2r3ZBiqzVA0fwuGDnuzyklaw8fffksCcwP+t x4pWGiagUh07F8kvEQzOhT26LbijCkPtpXM2vCJ+HT7AM+mWqjXv7ACpSGRz862ognSp fso+I/wmQL9HLLwxX7dB8yQLsX+zKZU8WUgA0= MIME-Version: 1.0 Received: by 10.210.9.17 with SMTP id 17mr7528397ebi.23.1253017598998; Tue, 15 Sep 2009 05:26:38 -0700 (PDT) In-Reply-To: <4b39c80a0909110659oc950714n809ad4f43cd56a62@mail.gmail.com> References: <4b39c80a0909110659oc950714n809ad4f43cd56a62@mail.gmail.com> Date: Tue, 15 Sep 2009 14:26:38 +0200 Message-ID: <4b39c80a0909150526x23ae0eb7o649e60722600a0fd@mail.gmail.com> Subject: Re: Generating comments from camlp4 From: Alexey Rodriguez To: OCaml List Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Spam: no; 0.00; camlp:01 ocamldoc:01 camlp:01 tokens:01 tokens:01 cheers:01 sig:01 sig:01 ocamldoc:01 lexing:01 cheers:01 2009:98 wrote:01 signatures:01 signatures:01 Just an update on the situation. We are using Jane Street's excellent type_conv library to generate code for user-defined types when preprocessing. However, these generated functions appear in ocamldoc documentation and we would like to avoid that. The easiest solution seemed to be to bracket the generated code with stop tags: (** / **). In camlp4 comments are tokens but I do not quite see how to generate tokens from camlp4 quotations. So at the moment I have the impression that I cannot solve this problem at the camlp4 level. Cheers, Alexey On Fri, Sep 11, 2009 at 3:59 PM, Alexey Rodriguez wrot= e: > Dear list, > > Is there a way to generate comments from camlp4 code? > > We have preprocessors that generate the following kind of code in signatu= res: > >> =A0<:sig_item< >> =A0 =A0$sig_generator the_type_declaration$; >> =A0>> > > However, these extra function signatures show up in the output of > ocamldoc which is very annoying. We thought of using "ocamldoc stop" > tags (** / **), but we do not know how to generate such comments from > camlp4. Do you know of a way to do this: > >> =A0<:sig_item< >> =A0 =A0(** / **) >> =A0 =A0$sig_generator the_type_declaration$; >> =A0 =A0(** / **) >> =A0>> > > Comments are not part of the AST so I suppose we have to do some > hacking at the lexing level. > > Note that having a dummy preprocessor that generates empty signatures > is not an option: this causes type checking errors that require a lot > of effort to circumvent. > > Cheers, > > Alexey >