o składni pochodnej od C. Więc oto i jest:
https://dl.dropboxusercontent.com/u/40322040/LineCounter.jar
Program wykonany w Javie, więc wymaga zainstalowanego JRE.
Screen:

Może komuś sie przyda

1. Komentarze blokowe (/* ... */) wcale nie muszą rozpoczynać i kończyć linii.
{ boolean inComment = false; try { List<String> lines = Files.readAllLines(file.toPath(), Charset.defaultCharset()); for (int i = 0; i < lines.size(); i++) { this.linesTotal += 1; if (line.trim().length() > 0) { this.linesFilled += 1; } if (line.trim().startsWith("/*")) { inComment = true; } boolean isCommentLine = (line.trim().startsWith("//")) || (inComment); boolean isSyntaxLine = line.trim().replace(" ", "").matches("[\\{;\\}\\(\\)\\{\\}\\:]*"); if (isCommentLine) { this.linesComment += 1; } else if (!isSyntaxLine) { this.linesMeaningfull += 1; } else { } if (line.trim().endsWith("*/")) { inComment = false; } } } { Logger.getLogger(MainView.class.getName()).log(Level.SEVERE, null, ex); } }
boolean isSyntaxLine = line.trim().replace(" ", "").matches("[\\{;\\}\\(\\)\\{\\}\\:]*");
boolean isSyntaxLine = line .replace(" ", "") .replaceAll("[\\{;\\}\\(\\)\\{\\}\\:]*", "") .length() == 0;