Libraryless. Click here for Pure Java version (5900L/33K).
svoid tok_forOver(LS tok) { jreplace (tok, "for <id> over <id>:", "for (int $2 = 0; $2 < l($4); $2++)"); jreplace (tok, "for <id> backwards over <id>:", "for (int $2 = l($5)-1; $2 >= 0; $2--)"); // index var and implicitly typed element var jreplace (tok, "for <id>, <id> over <id>: ", "for $2, var $4 over $6:"); // index var and explicitly typed element var jreplace (tok, "for <id>, <id> <id> over <id>: {", "for (int $2 = 0; $2 < l($7); $2++) { $4 $5 = $7.get($2);"); jreplace (tok, "for <id>, <id> <id> backwards over <id>: {", "for (int $2 = l($8)-1; $2 >= 0; $2--) { $4 $5 = $8.get($2);"); jreplace_dyn_allowDollarRefs(tok, "for immutable <id> to <id>: {", cIdx -> { S var = makeVar(); ret "for \*var*/ to $5: { int $3 = \*var*/;"; }); }
download show line numbers debug dex old transpilations
Travelled to 3 computer(s): bhatertpkbcr, mowyntqkapby, mqqgnosmbjvj
No comments. add comment
Snippet ID: | #1034586 |
Snippet name: | tok_forOver |
Eternal ID of this version: | #1034586/1 |
Text MD5: | 375a49afce0d9059db65e50f1e90c859 |
Transpilation MD5: | c573221b0dfb2503cf628978049e1f2d |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2022-02-19 06:09:47 |
Source code size: | 798 bytes / 17 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 132 / 194 |
Referenced in: | #1006654 - Standard functions list 2 (LIVE, continuation of #761) |