[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[news.eclipse.tools.jdt] Analyzing IF statements using Eclipse ASTParser

Hi,

I want to differentiate between the two if statements by parsing using 
Eclipse ASTParser.

The if statements are -
if (c==1)
if (a<10 && b>0)

Using the visitor pattern I am able to identify both statements as 
"ifstatement"s...

Now, I also need to count "how many" conditions/branches are inside the 
statement.

For example, in the 1st if statement above, there is 1 condition (c==1) and 
in the second if statement above there are two conditions (a<10 and b>0).

Please advice how can I find how many branches are inside the ifstatement.

A reply with a small example will be very appreciated as I am a newbie to 
the ASTParser.

Thanks for your help in advance.

Regards,

Fayezin