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

17
LINES

< > BotCompany Repo | #1018808 // replaceKeywordBlock_dyn2_legacy - avoid syntax problem with func and many parameters

JavaX fragment (include)

1  
// func : func(LS tok, int iOpening, int iClosing) -> S[] {beg, end}
2  
static L<S> replaceKeywordBlock_dyn2_legacy(L<S> tok, S keyword, O func) {
3  
  for (int i = 0; i < 1000; i++) {
4  
    //int idx = findCodeTokens(tok, keyword, "{");
5  
    int idx = jfind(tok, keyword + " {");
6  
    if (idx < 0)
7  
      break;
8  
    int idx2 = findCodeTokens(tok, idx, false, "{");
9  
    int j = findEndOfBracketPart(tok, idx2);
10  
    
11  
    S[] be = (S[]) callF(func, tok, idx2, j-1);
12  
    replaceTokens(tok, idx, idx2+2, be[0] + " ");
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 #1018806

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: #1018808
Snippet name: replaceKeywordBlock_dyn2_legacy - avoid syntax problem with func and many parameters
Eternal ID of this version: #1018808/9
Text MD5: b8257cfd3ea57bbcc4e20e8fa4c9fe4b
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-09-27 01:07:36
Source code size: 584 bytes / 17 lines
Pitched / IR pitched: No / No
Views / Downloads: 300 / 341
Version history: 8 change(s)
Referenced in: [show references]