Hi Johan,

I've used the trunk API a bit over the weekend for something similar.
You can get start/end like so:

   AstNode node = ....
   int startIndex = node.getAbsolutePosition();
   int endIndex = startIndex + node.getLength();

There are a couple bugs in the lengths on some of the nodes, and I
submitted a bug with patch to correct them
(https://bugzilla.mozilla.org/show_bug.cgi?id=468396).  To the extent
I've used it so far, this seems to allow me to properly identify the
exact source section for any AST node from the original full source.

There is also AstNode.getPosition(), which gives you a position
relative to the parent node.  I've not found a use for looking at the
data in that perspective yet.

I cannot answer your other questions.

Ryan
_______________________________________________
dev-tech-js-engine-rhino mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-js-engine-rhino

Reply via email to