On 1/01/2015 1:35 p.m., ketmar via Digitalmars-d wrote:
On Thu, 01 Jan 2015 13:21:16 +1300
Rikki Cattermole via Digitalmars-d <digitalmars-d@puremagic.com> wrote:

Although this is a little extreme compared to my original post...

a little. ;-)

yes, processing ASTs with CTFE will be great, but this is huge task.
replacing Ddoc with CTFE which receives an array (tuple? ;-) of
functions with documentation text (preprocessed a little, see below) is
a lighter task. then we can use compile-time introspection to get
function args and so, and format the output as we like.

"small preprocessing" converts the following:

   /** text0
     * text1
     * text2
     */

to:

   text0
   text1
   text2

i.e. just removing that indentation with corresponding '*'. it's easy
and must be done for any formatting, so it can be done before invoking
CTFE. just make sure that the following will not be processed:

   /** text0
     * text1
       heh
     * text2
     */

there is no vertical line of '*', so no need to remove leading '*' here.

I was thinking one simpler.
$(D myfunction, $0)

This will be enough of a big task, but enough of a pay off to make it worth while. The AST stuff would guaranteed be a DIP (second to last CTFE implementation type, well as I define it anyway).

Reply via email to