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.0 required=5.0 tests=none 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 35C38BC37 for ; Tue, 15 Sep 2009 14:42:06 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AqoDAHcor0rCRgOEgWdsb2JhbACBU45GizEBARYkwSeEFwWBVnI X-IronPort-AV: E=Sophos;i="4.44,390,1249250400"; d="scan'208";a="46622561" Received: from fork.recoil.org ([194.70.3.132]) by mail4-smtp-sop.national.inria.fr with SMTP; 15 Sep 2009 14:42:05 +0200 Received: (qmail 26451 invoked by uid 3023); 15 Sep 2009 12:42:04 -0000 Received: from 94-194-206-35.zone8.bethere.co.uk (HELO sneak.config) (94.194.206.35) (smtp-auth username remote@recoil.org, mechanism cram-md5) by fork.recoil.org (qpsmtpd/0.32) with ESMTP; Tue, 15 Sep 2009 13:42:03 +0100 Cc: OCaml List Message-Id: <00A0564F-D9E3-4FFE-B8A6-E8F4FA5A11FC@recoil.org> From: Anil Madhavapeddy To: Alexey Rodriguez In-Reply-To: <4b39c80a0909150526x23ae0eb7o649e60722600a0fd@mail.gmail.com> Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Mime-Version: 1.0 (Apple Message framework v936) Subject: Re: [Caml-list] Re: Generating comments from camlp4 Date: Tue, 15 Sep 2009 13:42:01 +0100 References: <4b39c80a0909110659oc950714n809ad4f43cd56a62@mail.gmail.com> <4b39c80a0909150526x23ae0eb7o649e60722600a0fd@mail.gmail.com> X-Mailer: Apple Mail (2.936) X-Spam: no; 0.00; anil:01 anil:01 camlp:01 camlp:01 ocamldoc:01 ocaml:01 ocamldoc:01 tokens:01 tokens:01 cheers:01 sig:01 sig:01 lexing:01 cheers:01 beginner's:01 I dont believe you can add comments with camlp4; I'm using type-conv to hack on an ORM layer, and it would be lovely to have the generated functions also have comments to not dirty up the OCamldoc. And also, to maintain sanity when reading through pages of generated OCaml... -anil On 15 Sep 2009, at 13:26, Alexey Rodriguez wrote: > 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