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

17
LINES

< > BotCompany Repo | #1018806 // replaceKeywordBlock_dyn2

JavaX fragment (include)

1  
// func : func(LS tok, int iOpening, int iClosing) -> S[] {beg, end}
2  
static L<S> replaceKeywordBlock_dyn2(L<S> tok, S keyword, F3<LS, Int, Int, S[]> 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, tok, idx+2, j-1);
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 #1003848

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1018806
Snippet name: replaceKeywordBlock_dyn2
Eternal ID of this version: #1018806/4
Text MD5: 49bae998e303b450c04adf45dd4c1d01
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-10-13 20:46:32
Source code size: 526 bytes / 17 lines
Pitched / IR pitched: No / No
Views / Downloads: 368 / 407
Version history: 3 change(s)
Referenced in: [show references]