static Set findFunctionDefs_keywords = new HashSet(splitAtSpace("static svoid ssvoid ssynchronized sbool sS sO sL")); static L findFunctionDefs(L tok) { int n = l(tok); new L functions; for (int i = 1; i < n; i += 2) if (findFunctionDefs_keywords.contains(tok.get(i))) findFunctionDefs_step(tok, i, functions); ret functions; } svoid findFunctionDefs_step(LS tok, int i, LS functions) { int j = i+2; while (j < n && !findFunctionsDefs_checkToken(tok.get(j))) j += 2; if (isIdentifier(tok.get(j-2)) && eqGet(tok, j, "(") || eqGet(tok, j, "{") && eq(t, "svoid")) functions.add(tok.get(j-2)); } sbool findFunctionsDefs_checkToken(S t) { if (t.length() != 1) false; char c = t.charAt(0); ret c == ';' || c == '=' || c == '(' || c == '{' || c == '#'; }