]
Claus Ibsen commented on FORGE-2571:
------------------------------------
See also
Roaster - Add api to get the line number and absolute position
--------------------------------------------------------------
Key: FORGE-2571
URL:
https://issues.jboss.org/browse/FORGE-2571
Project: Forge
Issue Type: Feature Request
Affects Versions: 3.0.0.Beta1
Reporter: Claus Ibsen
When using Roaster to parse java source code, you have the various types, such as fields
FieldSource<JavaClassSource> field
MethodSource<JavaClassSource> method
and so on
The backing JDT AST has the position of where those types are in the source code.
It would be good to have an api that can provide
- the absolute position (absolute char position)
- the line number
- the relative position in the line
You can derive the latter two values from the absolute position.
The AST has the absolute start position in code alike:
org.jboss.forge.roaster._shade.org.eclipse.jdt.core.dom.ASTNode#getStartPosition
The need for this is to be able to provide better feedback to the end users, where in the
source code the node is, such as if you use it to parse and validate, or if you want to
build a custom search function etc.