Thursday 15 January 2015

search - How to count all if() instructions (Java) -



search - How to count all if() instructions (Java) -

is there way count if() (or else()) instructions without using bufferedreader search distinguish words ? if there isn't - how can guess if if() instruction within /* comment:

/* if(*condition*){ *do something* } */

is comment, not instruction?

have @ answer: http://stackoverflow.com/a/22760693/981828

what trying accomplish far trivial,

you have utilize parser such antlr or javacc

edit:

alternativly run perl one-liner command line, should strip file of comments. if running windows, install cygwin.

perl -0pe 's#/\*(.|\n)*?\*/##g; s|//.*?\n|\n|g' test.java >> newfile.java

and count if( , else( within newfile.java bufferedreader , tokenizer

search if-statement count

No comments:

Post a Comment