Version française
Home     About     Download     Resources     Contact us    
Browse thread
Generating comments from camlp4
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Jake Donham <jake@d...>
Subject: Re: [Caml-list] Re: Generating comments from camlp4
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