Bug 50697 - Improve DOM/AST support for locating all comments
Summary: Improve DOM/AST support for locating all comments
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 2.1   Edit
Hardware: All All
: P3 enhancement (vote)
Target Milestone: 3.0 M7   Edit
Assignee: Frederic Fusier CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 46126
  Show dependency tree
 
Reported: 2004-01-27 13:23 EST by Jim des Rivieres CLA
Modified: 2004-02-11 10:02 EST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jim des Rivieres CLA 2004-01-27 13:23:10 EST
When an AST is built by AST.parse*(...), the entire source string is parsed. 
Except for the Javadoc comments, the positions of all the other comments are 
unavailable from the resulting AST. This is unfortunate, and causes clients 
that wishing to determine the location of comments to re-scan the source.
Comment 1 Jim des Rivieres CLA 2004-01-27 13:32:06 EST
For M7, we have made the following changes to the DOM/AST API:

- added CompilationUnit.getCommentTable() to record locations of all comments
found in the source
- added 2 new node types, LineComment and BlockComment, to represent end-of-
line and traditional comments respectively
- these new nodes are placeholders for comments
- these new node types only occur in the comment table (since they can occur 
anywhere (lexically), there is no way to properly parent them in the regular 
AST nodes that reflects their position)
- AST.parse*(...) now returns sets the comment table on the compilation unit
to include all comments (including attached and free-floating doc comments)
Comment 2 Frederic Fusier CLA 2004-01-28 04:54:00 EST
Reopen to assign the bug to me.
Comment 3 Frederic Fusier CLA 2004-01-28 04:54:44 EST
Test cases need to be completed...
Comment 4 David Audel CLA 2004-02-11 10:02:07 EST
Verified for 3.0M7