]
George Gastaldi moved FORGE-2571 to ROASTER-89:
-----------------------------------------------
Project: Roaster (was: Forge)
Key: ROASTER-89 (was: FORGE-2571)
Affects Version/s: 2.17.4.Final
(was: 3.0.0.Beta1)
Roaster - Add api to get the line number and absolute position
--------------------------------------------------------------
Key: ROASTER-89
URL:
https://issues.jboss.org/browse/ROASTER-89
Project: Roaster
Issue Type: Feature Request
Affects Versions: 2.17.4.Final
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.