static bool tok_repeatWithSleep_verbose; static L<S> tok_repeatWithSleep(L<S> tok) { int i; while ((i = jfind(tok, "repeat with sleep * {")) >= 0) { S seconds = tok.get(i+6); // int or id int idx = findCodeTokens(tok, i, false, "{"); int j = findEndOfBracketPart(tok, idx); if (tok_repeatWithSleep_verbose) print("idx=" + idx + ", j=" + j); clearTokens(tok, i, idx+1); tok.set(i, "repeat { pcall {"); tok.set(j-1, "} sleepSeconds(" + seconds + "); }"); reTok(tok, j-1, j); reTok(tok, i, idx+1); } while ((i = jfind(tok, "repeat with ms sleep * {")) >= 0) { S ms = tok.get(i+8); // int or id int idx = findCodeTokens(tok, i, false, "{"); int j = findEndOfBracketPart(tok, idx); if (tok_repeatWithSleep_verbose) print("idx=" + idx + ", j=" + j); clearTokens(tok, i, idx+1); tok.set(i, "repeat { pcall {"); tok.set(j-1, "} sleep(" + ms + "); }"); reTok(tok, j-1, j); reTok(tok, i, idx+1); } ret tok; }
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: | #1006502 |
Snippet name: | tok_repeatWithSleep |
Eternal ID of this version: | #1006502/2 |
Text MD5: | 641a78a1a806efffb526da2b223a4f01 |
Author: | stefan |
Category: | javax / transpiling |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2017-02-03 05:25:06 |
Source code size: | 1016 bytes / 29 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 527 / 586 |
Version history: | 1 change(s) |
Referenced in: | [show references] |