sS makeSFSynonym(S oldName, S newName) { stdFunctions_clearCache(); S snippetID = stdFunctions_cached().get(oldName); if (snippetID == null) fail("Standard function " + oldName + " not found"); if (isStandardFunction(newName)) ret print("Standard function " + newName + "exists"); L tok = javaTok(loadSnippet(snippetID)); LL funcs = findFullFunctionDefs(tok, true); new L out; for (L tokF : funcs) { int i = indexOfAny(tokF, 0, "(", "{"); if (i < 0) continue; S fname = get(tok, i-2); if (!eq(fname, oldName)) continue; L args = tok_parseArgsList(tokF); jreplace(tokF = cloneList(tokF), oldName, newName); L start = subList(tokF, 0, i); bool isVoid = contains(start, "void"); out.add(join(start) + "(" + joinWithComma(trimAll(map tok_dropFinal(args))) + ") {\n" + " " + (isVoid ? "" : "ret ") + oldName + "(" + joinWithComma(map tok_lastIdentifier(args)) + ");\n" + "}"); } print(); S src = joinWithEmptyLines(out); printIndent(src); S newSnippetID = createSnippet(src, newName + " - synonym of " + oldName, snippetType_JavaXInclude()); checkMarkAnimation_bottomLeft(addStdFunction(newSnippetID, true), 2); stdFunctions_clearCache(); ret "Synonym made!"; }