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.7 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 mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by yquem.inria.fr (Postfix) with ESMTP id 0A8EEBC37 for ; Wed, 16 Sep 2009 03:04:00 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AqMBAObVr0rRVdi4kGdsb2JhbACbBD8BAQEBCQkMBxMDsxyQMgEDAgSEEwWBVocv X-IronPort-AV: E=Sophos;i="4.44,393,1249250400"; d="scan'208";a="34367221" Received: from mail-px0-f184.google.com ([209.85.216.184]) by mail3-smtp-sop.national.inria.fr with ESMTP; 16 Sep 2009 03:03:59 +0200 Received: by pxi14 with SMTP id 14so3756361pxi.9 for ; Tue, 15 Sep 2009 18:03:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:received:in-reply-to :references:from:date:x-google-sender-auth:message-id:subject:to:cc :content-type:content-transfer-encoding; bh=dHaaK1z0iFi3LWTmlPhb9VG6DN8JxelgXOKSRCYp7l0=; b=pQb80PEzNI33M9o5FYhXDS+A0wVTGdNyaQpCFdkmJ8KUuG04d0MR5+hzEClmueXHIi UZU63dGp1i4K1H4z44OncmUTJqxs2GivjSWreAlkiuSTGAu7MkRz1HD/zBjo70sLzr3V LWzalQP5jorEcitidMHsB8D7u4Reh5Ewo5m2s= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:from:date :x-google-sender-auth:message-id:subject:to:cc:content-type :content-transfer-encoding; b=VJhWH53qUvlh7FH8D/S5hmWeenULupNdh2g4XUo5qKtT3HNCaGM1HTf3wnzjTsHR9J XA6szyUDUg0kaK0tgnbHo3SYFkOdg03HBT9keDJ1f6Y54fClyNYnIcIcum2d/hwSlgda uhPlsqRxg/HFrKKIHtRJLcEHATtqOlrnxHVeI= MIME-Version: 1.0 Sender: jake.donham@gmail.com Received: by 10.143.129.2 with SMTP id g2mr644768wfn.56.1253063038255; Tue, 15 Sep 2009 18:03:58 -0700 (PDT) In-Reply-To: <00A0564F-D9E3-4FFE-B8A6-E8F4FA5A11FC@recoil.org> References: <4b39c80a0909110659oc950714n809ad4f43cd56a62@mail.gmail.com> <4b39c80a0909150526x23ae0eb7o649e60722600a0fd@mail.gmail.com> <00A0564F-D9E3-4FFE-B8A6-E8F4FA5A11FC@recoil.org> From: Jake Donham Date: Tue, 15 Sep 2009 18:03:38 -0700 X-Google-Sender-Auth: a31b0c6f7287d37e Message-ID: Subject: Re: [Caml-list] Re: Generating comments from camlp4 To: Anil Madhavapeddy Cc: Alexey Rodriguez , OCaml List Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Spam: no; 0.00; camlp:01 anil:01 anil:01 camlp:01 ocamldoc:01 ocaml:01 ocaml:01 2009:98 wrote:01 caml-list:01 functions:01 lex:01 ast:02 output:02 string:02 On Tue, Sep 15, 2009 at 5:42 AM, Anil Madhavapeddy wrote: > I dont believe you can add comments with camlp4; I'm using type-conv to h= ack > on an ORM layer, and it would be lovely to have the generated functions a= lso > have comments to not dirty up the OCamldoc. =A0And also, to maintain sani= ty > when reading through pages of generated OCaml... Comments are not passed through the AST, but somehow they make it from the input file to the output file. It looks like in Camlp4/Printers/OCaml.ml there is a hook into the tokenizer to keep track of comments as they are tokenized (search for CommentFilter). Maybe there is some way to inject comments (at particular locations)? Possibly by calling Gram.lex_string and/or Gram.filter? A hack, no doubt. Jake