Transpiled version (6246L) is out of date.
svoid tok_for_unpair(LS tok) { jreplace(tok, "for (unpair <id> <id>, <id> :", "for (unpair $4 $5, $4 $7 :"); jreplace(tok, "for (<id> <id>, <id> : unpair", "for (unpair $3 $4, $3 $6 :"); jreplace(tok, "for (<id> <id>, <id> <id> : unpair", "for (unpair $3 $4, $6 $7 :"); int i = -1; while ((i = jfind(tok, i+1, "for (unpair <id> <id>, <id> <id> :")) >= 0) { S type1 = tok.get(i+6), var1 = tok.get(i+8); S type2 = tok.get(i+12), var2 = tok.get(i+14); int iColon = indexOf(tok, ":", i); int iClosing = findEndOfBracketPart(tok, iColon)-1; int iCurly = iClosing+2; tok_statementToBlock(tok, iCurly); S pairVar = makeVar(); replaceTokens(tok, i+4, iColon-1, tok_toNonPrimitiveTypes("Pair<" + type1 + ", " + type2 + ">") + " " + pairVar); tok.set(iCurly, "{ " + type1 + " " + var1 + " = pairA(" + pairVar + "); " + type2 + " " + var2 + " = pairB(" + pairVar + "); "); reTok(tok, i, iCurly+1); } // typeless version i = -1; while ((i = jfind(tok, i+1, "for (<id>, <id> : unpair")) >= 0) { S var1 = tok.get(i+4); S var2 = tok.get(i+8); int iColon = indexOf(tok, ":", i); int iClosing = findEndOfBracketPart(tok, iColon)-1; int iCurly = iClosing+2; tok_statementToBlock(tok, iCurly); S pairVar = makeVar(); replaceTokens(tok, i+4, iColon+3, "var " + pairVar + ":"); tok.set(iCurly, "{ " + "var " + var1 + " = pairA(" + pairVar + "); " + "var " + var2 + " = pairB(" + pairVar + "); "); reTok(tok, i, iCurly+1); } }
download show line numbers debug dex old transpilations
Travelled to 8 computer(s): bhatertpkbcr, cfunsshuasjs, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv
No comments. add comment
Snippet ID: | #1023091 |
Snippet name: | tok_for_unpair |
Eternal ID of this version: | #1023091/22 |
Text MD5: | b713cb0f507b71b8f06dd069251b0b58 |
Author: | stefan |
Category: | javax / transpiling |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2022-03-12 19:50:36 |
Source code size: | 1575 bytes / 39 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 362 / 518 |
Version history: | 21 change(s) |
Referenced in: | [show references] |