static tok_p_new(L<S> tok) { bigbigloop: do { bool changes = false; bigloop: for (int i : jfindAll(tok, "p-")) { int j = i+4; new L<S> 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); }
Began life as a copy of #1014244
download show line numbers debug dex old transpilations
Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1014245 |
Snippet name: | tok_p_new - replace p-... {} (new version, dev.) |
Eternal ID of this version: | #1014245/1 |
Text MD5: | 62f3bb95b374a7fa5244e38da4681681 |
Author: | stefan |
Category: | javax / transpiling |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2018-04-17 16:09:35 |
Source code size: | 2164 bytes / 46 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 353 / 391 |
Referenced in: | -