caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Alexey Rodriguez <mrchebas@gmail.com>
To: Jake Donham <jake@donham.org>
Cc: Anil Madhavapeddy <anil@recoil.org>, OCaml List <caml-list@inria.fr>
Subject: Re: [Caml-list] Re: Generating comments from camlp4
Date: Wed, 16 Sep 2009 09:48:49 +0200	[thread overview]
Message-ID: <4b39c80a0909160048t1721d410s1b0e6221dbab84c1@mail.gmail.com> (raw)
In-Reply-To: <c7e4e9f0909151803s7ed5575vab309b8780655ca4@mail.gmail.com>

Thanks for the tip Jake. I arrived to a similar conclusion by doing
experiments on source files with comments but I did not pinpoint the
exact location in camlp4's sources. As you say, a solution that
injects comments would probably look very hacky. I decided to go for
Tiphaine's suggestion. After 45 minutes of hacking on the generator, I
had decent looking ocamldoc. Thanks Tiphaine!

Cheers,

Alexey

On Wed, Sep 16, 2009 at 3:03 AM, Jake Donham <jake@donham.org> wrote:
> On Tue, Sep 15, 2009 at 5:42 AM, Anil Madhavapeddy <anil@recoil.org> wrote:
>> 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...
>
> 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
>


  reply	other threads:[~2009-09-16  7:48 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-09-11 13:59 Alexey Rodriguez
2009-09-15 12:26 ` Alexey Rodriguez
2009-09-15 12:42   ` [Caml-list] " Anil Madhavapeddy
2009-09-16  1:03     ` Jake Donham
2009-09-16  7:48       ` Alexey Rodriguez [this message]
2009-09-16  8:02         ` Tiphaine Turpin
2009-09-15 12:44   ` Tiphaine Turpin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4b39c80a0909160048t1721d410s1b0e6221dbab84c1@mail.gmail.com \
    --to=mrchebas@gmail.com \
    --cc=anil@recoil.org \
    --cc=caml-list@inria.fr \
    --cc=jake@donham.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).