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=0.1 required=5.0 tests=AWL autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by yquem.inria.fr (Postfix) with ESMTP id 24083BC37 for ; Tue, 15 Sep 2009 14:45:52 +0200 (CEST) X-IronPort-AV: E=Sophos;i="4.44,390,1249250400"; d="scan'208";a="32826150" Received: from arvin.irisa.fr (HELO [131.254.11.86]) ([131.254.11.86]) by mail2-relais-roc.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-SHA; 15 Sep 2009 14:45:52 +0200 Message-ID: <4AAF8C34.30009@irisa.fr> Date: Tue, 15 Sep 2009 14:44:36 +0200 From: Tiphaine Turpin User-Agent: Thunderbird 2.0.0.19 (X11/20090216) MIME-Version: 1.0 To: Alexey Rodriguez , caml-list@yquem.inria.fr Subject: Re: [Caml-list] Re: Generating comments from camlp4 References: <4b39c80a0909110659oc950714n809ad4f43cd56a62@mail.gmail.com> <4b39c80a0909150526x23ae0eb7o649e60722600a0fd@mail.gmail.com> In-Reply-To: <4b39c80a0909150526x23ae0eb7o649e60722600a0fd@mail.gmail.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Spam: no; 0.00; irisa:01 camlp:01 redefines:01 odoc:01 odoc:01 val:01 val:01 ocamldoc:01 camlp:01 tokens:01 tokens:01 cheers:01 sig:01 sig:01 ocamldoc:01 I just remembered that I once faced a similar problem. I solved it rather easily using a custom documentation generator wich justs redefines a few methods to discard the appropriate elements (those starting with a n underscore in my case). Here is the code : open Odoc_info open Value class my_doc_gen = object (this) inherit Odoc_html.html as super method synthetic name = (Name.simple name).[0] = '_' method html_of_attribute b a = if not (this#synthetic a.att_value.val_name) then super#html_of_attribute b a method html_of_method b a = if not (this#synthetic a.met_value.val_name) then super#html_of_method b a end let my_generator = new my_doc_gen let _ = Odoc_args.set_doc_generator (Some (my_generator :> Odoc_args.doc_generator)) Alexey Rodriguez a écrit : > 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 wrote: > >> Dear list, >> >> Is there a way to generate comments from camlp4 code? >> >> We have preprocessors that generate the following kind of code in signatures: >> >> >>> <:sig_item< >>> $sig_generator the_type_declaration$; >>> >> >>> >> 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: >> >> >>> <:sig_item< >>> (** / **) >>> $sig_generator the_type_declaration$; >>> (** / **) >>> >> >>> >> 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 >> >> > > _______________________________________________ > Caml-list mailing list. Subscription management: > http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list > Archives: http://caml.inria.fr > Beginner's list: http://groups.yahoo.com/group/ocaml_beginners > Bug reports: http://caml.inria.fr/bin/caml-bugs > >