static Set findFullFunctionDefs_keywords = new HashSet(splitAtSpace("static svoid ssvoid ssynchronized sbool sS sO sL")); // returns actual CNC static L> findFullFunctionDefs(L tok, bool topLevelOnly) { int n = l(tok); new L> functions; for (int i = 1; i < n; i += 2) { S t = tok.get(i); if (topLevelOnly && eq(t, "{")) i = findEndOfBlock(tok, i)-1; else if (findFullFunctionDefs_keywords.contains(t)) { int j = i+2; while (j < n && !eqOneOf(tok.get(j), ";", "=", "(", "{")) j += 2; if (eq(get(tok, j), "(") && isIdentifier(tok.get(j-2))) { int k = smartIndexOf(tok, "{", j); if (k < l(tok)) { k = findEndOfBlock(tok, k)+1; functions.add(subList(tok, i-1, k)); i = k-2; } } } } ret functions; }