Hello, It's really important for a Javascript editor to know the offsets of each syntax tree node and of whatever the node contains (I'm not really saying tokens but... constituent parts and keywords are the minimum).
So it would be great to provide or document how offsets are to be computed for the String fields from the Nashorn Tree API. (Ideally the API could also be changed to use an IdentifierTree or some other Tree subclass which provides the start/endPosition.) A few examples: * MemberSelectTree has a String getIdentifier. Since I *assume* that the MemberSelectTree.getEndPosition is right after the identifier, I have to subtract the identifier length to get the identifier start offset. * VariableTree has a String getName(). It seems to me that VariableTree.getStartPosition is the 'name' startPosition. This also means you cannot really know where 'var' actually is -- it could be on another line altogether; it's also odd to me that 'var' is outside the [start, end] range for the VariableTree. * ContinueTree and BreakTree both have a String getLabel * LabeledStatementTree has a String getLabel * FunctionExpressionTree and FunctionDeclarationTree both have a String getName but I'm not sure how the offset for that is computed. Also not sure how the offset of the 'function' keyword would be computed. Could somebody explain this to me? I'll make a nice list for future reference. --emi