Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

13
LINES

< > BotCompany Repo | #1019660 // tok_switchTo

JavaX fragment (include)

// -Syntax: switch to q();
// -rest of block is executed in Queue q()
svoid tok_switchTo(L<S> tok) {
  int i = -1;
  while ((i = jfind(tok, i+1, "switch to")) >= 0) {
    int semicolon = findEndOfStatement(tok, i)-1;
    int endOfOuterBlock = findEndOfBracketPart(tok, semicolon)-1;
    clearTokens(tok, i, i+4);
    tok.set(semicolon, ".add(r {");
    tok.set(endOfOuterBlock, "}); }");
    reTok(tok, i, endOfOuterBlock+1);
  }
}

download  show line numbers  debug dex  old transpilations   

Travelled to 11 computer(s): bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1019660
Snippet name: tok_switchTo
Eternal ID of this version: #1019660/4
Text MD5: 6ad46e9e03ffa54d1aaa4f0e7808d885
Author: stefan
Category: javax / transpiling
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-04-03 15:39:25
Source code size: 447 bytes / 13 lines
Pitched / IR pitched: No / No
Views / Downloads: 339 / 389
Version history: 3 change(s)
Referenced in: [show references]