Bug 23116 - DCR: ModifierNode
Summary: DCR: ModifierNode
Status: RESOLVED WONTFIX
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 2.0   Edit
Hardware: PC Windows 2000
: P3 normal (vote)
Target Milestone: 2.1 M1   Edit
Assignee: Olivier Thomann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-09-03 10:59 EDT by Martin Aeschlimann CLA
Modified: 2002-09-10 08:50 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Aeschlimann CLA 2002-09-03 10:59:09 EDT
2.1

When working with modifiers on method or field declarations, the AST gives not 
much help with the simple getModifier: int.
Informations I am missing (and have to regain with the scanner):
- order of the modifiers
- positions of the modifiers

Would it make sense to have a Modifier Node?
Comment 1 Olivier Thomann CLA 2002-09-03 11:05:50 EDT
I would say that this should be done using the scanner. Jim, any comment?
Comment 2 Jim des Rivieres CLA 2002-09-03 11:33:50 EDT
I agree with Olivier that this kind of fine-grained lexical analysis should be 
done with the scanner. The approach taken from the outset was to keep the AST 
simple by eliminating a lot of the lexical details of the program text. The 
exact order and source positions of modifiers is one such example; the 
position of comments is another. All nodes carry accurate source positions, 
making it possible to tightly bound the range of source positions in which the 
tokens will be found. This support should be sufficient.

I recommend closing this DCR.
Comment 3 Martin Aeschlimann CLA 2002-09-03 11:55:22 EDT
Its my experience from working several weeks on the AST rewriting that the 
limitations you mention are acceptable: it's easy to set up a scanner to get 
positions of things like commas or semicolons. 
The only nasty nodes are the ones with modifiers and the arraycreation
- there are many different modifiers -> big case statement again
(maybe the scanner tokens could be categorized?)
-> I must build up a structure
- arraycreation is very complex due to the empty brakets which are only known 
by their number.

For both nodes its for example hard to get the end position of all modifiers or 
brackets.


Comment 4 Olivier Thomann CLA 2002-09-04 13:25:45 EDT
If we want to keep the DOM/AST API simple, we cannot add this new node. You can
always on your side create a structure that wraps the modifiers or the array
creation.
Ok to close?
Comment 5 Olivier Thomann CLA 2002-09-05 15:25:05 EDT
This won't be done as part of the DOM/AST API. It can easily be done using the
scanner and the positions of the ASTNodes.