* @param files the files to parse
* @param first the index of the first file
*/
private static void profile(Grammar grammar, String[] files, int first) {
File file = new File(files[first]);
Tokenizer tokenizer;
Parser parser;
Node node;
int fileCount = files.length - first;
long time;
int counter;
// Profile tokenizer
try {
System.out.println("Tokenizing " + fileCount + " file(s)...");
tokenizer = grammar.createTokenizer(new FileReader(file));
time = System.currentTimeMillis();
counter = 0;
for (int i = first; i < files.length; i++) {
if (i > first) {
file = new File(files[i]);
tokenizer.reset(new FileReader(file));
}
while (tokenizer.next() != null) {
counter++;
}
}
time = System.currentTimeMillis() - time + 1;
System.out.println(" Time elapsed: " + time + " millisec");