Skip to main content



      Home
Home » Newcomers » Newcomers » Using Eclipse AST Parser
Using Eclipse AST Parser [message #215017] Mon, 11 June 2007 08:03
Eclipse UserFriend
Originally posted by: nitrousfiz.googlemail.com

Hello,

I need to write a (parser) program that will behave in the following way -

Input - some line number
Processing - identify all variable names in that line & find line numbers of
the declarations of the identified variables
Output - line numbers of the declarations of the identified variables

Example: Suppose you are given the following Java program -

-------------------------------------------------------
1. public class HelloWorld {
2. public static void main(String[] args) {
3. int a;
4. int b;
5. int c;
6. a=1;
7. b=2;
8. c=3;
9. a=a+c;
10. }
11. }
-------------------------------------------------------

Input: Line 9

Processing:
* Identify variables in line 9 - variables a and c
* Find declaration line number of variable a & c - Lines 3 and 5
* Output these line numbers

Output: Lines 3, 5

I was told that this is possible by using the Eclipse AST Parser.

Please advice how can I start solving this problem using it and what code to
put inside which method(s) in the AST explorer/traverser?

Thanks for your help.

Fayezin
Previous Topic:Creating popup menu actions during runtime
Next Topic:Question about the Problems view
Goto Forum:
  


Current Time: Wed Jun 04 23:12:42 EDT 2025

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

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

Back to the top