!7 cprint { transient Set requestedFunctions; transient Set have; transient new Set blockedFunctions; transient Set newFunctions; transient Set imported; transient Set toImport; transient new SS modifiers; transient S loadableUtilsSnippetID = #1030952; transient S includeSnippetID = #1030953; start-thread { LS transpilerLines = mapLines(loadSnippet(#1030949), s -> dropLeadingAngleBracketStuff(s)); requestedFunctions = asSet(startingWithIC_dropAndTrim("Compiling function:", transpilerLines); print(n2(requestedFunctions, "requested function")); for (PairS p : parseColonPropertyPairs(lines(transpilerLines))) if (eqOneOf(p.a, "mapLike", "mapMethodLike", "nuLike", "lambdaMapLike", "curry1Like")) modifiers.put(p.b, p.a); print(n2(modifiers, "function modifier")); S text = loadSnippet(loadableUtilsSnippetID); have = asSet(lmap tok_lastIdentifier(jextractAll("please include function .", text))); print("Have " + n2(have, "function")); new Matches m; for (S comment : trimAll(getJavaLineComments(text))) if (find3("don't include function *", comment, m)) blockedFunctions.add($1); print(n2(blockedFunctions, "blocked function")); newFunctions = setMinusSet(setMinusSet(requestedFunctions, blockedFunctions), have); print(n2(newFunctions, "new function")); imported = asSet(lmap tok_lastIdentifier(jextractAll("import static loadableUtils.utils.;", loadSnippet(includeSnippetID)))); print(n2(imported, "imported function")); toImport = setMinusSet(have, imported); print(n2(toImport) + " to import"); } void appendThem { if (empty(newFunctions)) ret with print("Nothing to do"); S text = loadSnippet(loadableUtilsSnippetID); text += "\n\n" + mapToLines(newFunctions, f -> "please include function " + f + "."); editSnippet(loadableUtilsSnippetID, text); } void appendImported { if (empty(toImport)) ret with print("Nothing to do"); S text = loadSnippet(includeSnippetID); text += "\n\n" + mapToLines(toImport, f -> "import static loadableUtils.utils." + f + ";"); editSnippet(includeSnippetID, text); } }