Skip to main content



      Home
Home » Language IDEs » Java Development Tools (JDT) » Locational attributes of ASTNodes.
Locational attributes of ASTNodes. [message #249867] Wed, 28 November 2007 08:22 Go to next message
Eclipse UserFriend
Dear friends,

I had posted a similar query sometime back but didnt get any reply.

How do we know the location of the various ASTNodes in the corresponding
source code? Here location would incorporate
1. Line number
2. Starting Column Position and,
3. Ending Column Position

Also, Is it possible to get the number of lines in a block, method, class,
etc. ?

Regards,
Rahul Mishra
Re: Locational attributes of ASTNodes. [message #249882 is a reply to message #249867] Thu, 29 November 2007 09:42 Go to previous message
Eclipse UserFriend
Originally posted by: jacek.pospychala.pl.ibm.com

Rahul,
you should get the offset and length of ASTNode pretty easily. To
convert them to line/column number values use IDocument API. Be sure to
use exactly the same IDocument from which AST was built, or you may get
wrong values or even BadLocationExceptions.

Rahul Mishra wrote:
> Dear friends,
>
> I had posted a similar query sometime back but didnt get any reply.
> How do we know the location of the various ASTNodes in the
> corresponding source code? Here location would incorporate
> 1. Line number
> 2. Starting Column Position and,
> 3. Ending Column Position
>
> Also, Is it possible to get the number of lines in a block, method,
> class, etc. ?
>
> Regards,
> Rahul Mishra
>
>
Previous Topic:Upcoming batch compiler change wrt -warn option
Next Topic:How to find unresolved types in an ICompilationUnit?
Goto Forum:
  


Current Time: Wed Apr 23 02:21:21 EDT 2025

Powered by FUDForum. Page generated in 0.02613 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top