static tok_p_new(L tok) { bigbigloop: do { bool changes = false; bigloop: for (int i : jfindAll(tok, "p-")) { int j = i+4; new L clauses; while (isIdentifier(get(tok, j))) { clauses.add(get(tok, j)); S t = get(tok, j+2); if (eq(t, "-")) { j += 4; continue; } if (eq(t, "{")) { j += 2; break; } continue bigloop; // not a match } // i points to "p", j points to "{" clearTokens(tok, i+1, j-1); // drop clauses for (S c : clauses) { if (eqOneOf(c, "autorestart", "autoupdate")) tokAppend(tok, j, " autoUpdate();"); if (eqOneOf(c, "noconsole")) jreplace(tok, "p-noconsole-autoupdate {", "p-noconsole { autoUpdate();"); jreplace(tok, "p-pretty {", "p-noconsole {"); replaceKeywordBlock(tok, "p-awt-noconsole", "p-awt {", ";\nhideConsole(); }"); replaceKeywordBlock(tok, "p-substance-noconsole", "p-substance {", ";\nhideConsole(); }"); replaceKeywordBlock(tok, "p-nimbus-noconsole", "p-nimbus {", ";\nhideConsole(); }"); replaceKeywordBlock(tok, "p-subst-noconsole", "p-subst {", ";\nhideConsole(); }"); replaceKeywordBlock(tok, "p-noconsole", "p-subst {", ";\nhideConsole(); }"); replaceKeywordBlock(tok, "p-subst", "p-substance-thread {", "}"); replaceKeywordBlock(tok, "p-substance-thread", "p { substance();", "}"); replaceKeywordBlock(tok, "p-magellan-thread", "p { magellan();", "}"); replaceKeywordBlock(tok, "p-substance", "p-awt { substance();", "}"); replaceKeywordBlock(tok, "p-nimbus", "p-awt { nimbus();", "}"); replaceKeywordBlock(tok, "p-center", "p { centerConsole(); ", "}"); jreplace(tok, "p-type {", "p-typewriter {"); jreplace(tok, "p-tt {", "p-typewriter {"); replaceKeywordBlock(tok, "p-awt", "p { swing {", "}}"); replaceKeywordBlock(tok, "p-typewriter", "p { typeWriterConsole();", "}"); replaceKeywordBlock(tok, "p-lowprio", "p { lowPriorityThread(r " + "{", "}); }"); changes = true; reTok(tok, i, j+1); continue bigbigloop; } } while (changes); tok_p_old(tok); }