sS replaceStarsWithCountingDollarVars(S s) { ret join(replaceStarsWithCountingDollarVars(javaTokWithAllBrackets_cached(s))); } static LS replaceStarsWithCountingDollarVars(LS tok) { int varCounter = 0; tok = cloneList(tok); for (int i = 1; i < l(tok); i += 2) if (eq(tok.get(i), "*")) tok.set(i, "$" + (++varCounter)); ret tok; }