// func : func(LS tok, int iOpening, int iClosing) -> S[] {beg, end} static L replaceKeywordBlock_dyn2_legacy(L tok, S keyword, O func) { for (int i = 0; i < 1000; i++) { //int idx = findCodeTokens(tok, keyword, "{"); int idx = jfind(tok, keyword + " {"); if (idx < 0) break; int idx2 = findCodeTokens(tok, idx, false, "{"); int j = findEndOfBracketPart(tok, idx2); S[] be = (S[]) callF(func, tok, idx2, j-1); replaceTokens(tok, idx, idx2+2, be[0] + " "); tok.set(j-1, be[1]); reTok(tok, idx, j); } ret tok; }