Skip to main content



      Home
Home » Language IDEs » Java Development Tools (JDT) » Parsing comments via JDT AST (from dkl_eclipse@yahoo.com)
Parsing comments via JDT AST (from dkl_eclipse@yahoo.com) [message #181831] Sat, 09 October 2004 06:08 Go to next message
Eclipse UserFriend
Eclipse Developer <dkl_eclipse@yahoo.com> wrote on 10/09/2004 03:48:49 AM:


Hi All,
I apologize ahead of time if I've posted to the
wrong list, but I'm not sure the folks on the user
lists will be able to answer my finicky question(s).

The questions are

1) Is there a way to enable parsing of *all* comments,
not just those in front of TypeDeclarations, and
MethodDeclarations? I currently have the
JavaCore.COMPILER_DOC_COMMENT_SUPPORT set to
JavaCore.ENABLED, and yet the parser seems to drop
comments within methods. (The parser "kind" is set to
K_COMPILATION_UNIT)

2) Is there a way to get the parser to parse
LINE_COMMENTs as in "//" and BLOCK_COMMENTs as in "/*
... */"? Although I see the constant definitions on the
ASTNode class, I never see BlockComment/LineComment(s)
in my ASTs. Any clues as to what I could be doing
wrong?

Thanks,
Denis
Re: Parsing comments via JDT AST (from dkl_eclipse@yahoo.com) [message #181839 is a reply to message #181831] Sat, 09 October 2004 06:21 Go to previous message
Eclipse UserFriend
Frederic Fusier wrote:

You set the correct compiler option to pars and get *all* comments.
Comments you get through getJavadoc() API method in BodyDeclaration
are only Javadoc ones written just before corresponding declaration.

For all the other comments (ie. LineComment, BlockComment and orphan
Javadoc), you can get them using getComments() API method of
org.eclipse.jdt.core.dom.CompilationUnit returned by the ASTParser.

In this list you'll get all comments parsed in your compilation unit
in the order of appearance in the code.

> Eclipse Developer <dkl_eclipse@yahoo.com> wrote on 10/09/2004 03:48:49 AM:
>
>
> Hi All,
> I apologize ahead of time if I've posted to the
> wrong list, but I'm not sure the folks on the user
> lists will be able to answer my finicky question(s).
>
> The questions are
>
> 1) Is there a way to enable parsing of *all* comments,
> not just those in front of TypeDeclarations, and
> MethodDeclarations? I currently have the
> JavaCore.COMPILER_DOC_COMMENT_SUPPORT set to
> JavaCore.ENABLED, and yet the parser seems to drop
> comments within methods. (The parser "kind" is set to
> K_COMPILATION_UNIT)
>
> 2) Is there a way to get the parser to parse
> LINE_COMMENTs as in "//" and BLOCK_COMMENTs as in "/*
> .. */"? Although I see the constant definitions on the
> ASTNode class, I never see BlockComment/LineComment(s)
> in my ASTs. Any clues as to what I could be doing
> wrong?
>
> Thanks,
> Denis
>
>
>
Previous Topic:Just looking for two classes
Next Topic:junitLaunchConfigs extension point
Goto Forum:
  


Current Time: Mon May 12 01:30:55 EDT 2025

Powered by FUDForum. Page generated in 0.11829 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top