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

17
LINES

< > BotCompany Repo | #1003848 // replaceKeywordBlockDyn

JavaX fragment (include)

1  
// func returns S[] {beg, end}
2  
static L<S> replaceKeywordBlockDyn(L<S> tok, S keyword, O func) {
3  
  for (int i = 0; i < 1000; i++) {
4  
    int idx = findCodeTokens(tok, keyword, "{");
5  
    if (idx < 0)
6  
      break;
7  
    int j = findEndOfBracketPart(tok, idx+2);
8  
    
9  
    S[] be = (S[]) callF(func);
10  
    tok.set(idx, be[0]);
11  
    tok.set(idx+1, " ");
12  
    tok.set(idx+2, "");
13  
    tok.set(j-1, be[1]);
14  
    reTok(tok, idx, j);
15  
  }
16  
  ret tok;
17  
}

Author comment

Began life as a copy of #1001885

download  show line numbers  debug dex  old transpilations   

Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, ddnzoavkxhuk, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1003848
Snippet name: replaceKeywordBlockDyn
Eternal ID of this version: #1003848/1
Text MD5: 6aa188509282e8c27ba2e08dee990569
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2016-08-07 01:39:57
Source code size: 449 bytes / 17 lines
Pitched / IR pitched: No / No
Views / Downloads: 588 / 1138
Referenced in: [show references]