static boolean findFunctionDefinitions_debug; static List findFunctionDefinitions(String src) { Pattern pattern = Pattern.compile("(?:static|svoid|ssynchronized|sbool|^sS|^sO|^sL)[^={]*\\s+([\\w$]+)\\s*\\("); //System.out.println("Scanning for functions"); List functions = new ArrayList(); for (String line : toLines(src)) { line = jreplace(line, "svoid {", "svoid $2() {"); Matcher matcher = pattern.matcher(line); if (matcher.find()) { String f = matcher.group(1); functions.add(f); if (findFunctionDefinitions_debug) System.out.println("Function found: " + f + " in line: " + line); } } return functions; }