public static String removeComments(String s) { CSlicer tester = new CSlicer(); tester.appendLine(s); return tester.getContent().toString(); //return s.replaceAll("(?m)/(/.*$|\\*(\\*[^/]|[^*])*?\\*/)", " "); } // public static boolean[] computeCumulativeParseability(String[] lines) {
public static String removeComments(String s) { CSlicer tester = new CSlicer(); tester.appendLine(s); return tester.getContent().toString(); //return s.replaceAll("(?m)/(/.*$|\\*(\\*[^/]|[^*])*?\\*/)", " "); } // public static boolean[] computeCumulativeParseability(String[] lines) {
public static void getParseableIncrements(String source, Callback cb) { String[] lines = getLines(source); CSlicer tester = new CSlicer(); for (String line : lines) { //System.out.print('.'); tester.appendLine(line); if (tester.isParsable()) { if (!cb.apply(tester.getContent(), tester.getSemiColonCount())) { break; } } else { //System.err.println("Not parseable : state = " + tester.state + ", blocks = " + StringUtils.implode(tester.blocks, ",")); } } }
public static void getParseableIncrements(String source, Callback cb) { String[] lines = getLines(source); CSlicer tester = new CSlicer(); for (String line : lines) { //System.out.print('.'); tester.appendLine(line); if (tester.isParsable()) { if (!cb.apply(tester.getContent(), tester.getSemiColonCount())) { break; } } else { //System.err.println("Not parseable : state = " + tester.state + ", blocks = " + StringUtils.implode(tester.blocks, ",")); } } }