[Spoon-discuss] using spoon for development project
Nicolas Petitprez
nicolas.petitprez at gmail.com
Sat Dec 15 16:25:08 CET 2007
Hi,
You could access comments by using the getDocComment() available in
each AST node. Unfortunally, we doesn't find way to gets non-javadoc
comments from JDT (used to build spoon AST). So, you will only found
standard javadoc comments in CtType, CtField and CtMethod nodes. All
other comments are (for now) lost.
But you could access to source code by using SourcePosition available
in all nodes. I've think to made some manual processing in spoon to
add a better comments support, but i've never had time to do it.
I hope that I can be helpful
Nicolas
2007/12/15, junk at seguedevelopment.com <junk at seguedevelopment.com>:
>
> Hi -
>
> I have recently discovered Spoon and I think it is great. I have been
> playing around with the API in preparation for a project.
> While I see that it does indeed provide support for "accessing" the javadoc
> comments within a codebase (via the getDocComment() method) , I do not see
> any support for access generalized comments such as ones:
>
> //random comment
> //TODO: must fix this call below
> /* some more thoughts on this or that */
> etc...
> Am I missing something obvious in the API? I don't see any "visitor"
> callback method defined nor does the "spoon.reflect.code" package contain a
> class such as CtComment.java
> Is there another way to access the entire source-code via the ASP tree
> which would include the "comment" nodes? My project requires this level of
> control/analysis.
>
> Would it be easy for me to add this support (as of course provide the
> solution back into the general release of Spoon)?
>
> Any advice is greatly appreciated.
> Thanks in advance. I look forward to hearing a response and working more
> with Spoon.
>
> Cheers,
> /jeff mchugh
> SegueDevelopment.com
> _______________________________________________
> Spoon-discuss mailing list
> Spoon-discuss at lists.gforge.inria.fr
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/spoon-discuss
More information about the Spoon-discuss
mailing list