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)

// func : func(LS tok, int iOpening, int iClosing) -> S[] {beg, end}
static L<S> replaceKeywordBlock_dyn2_legacy(L<S> tok, S keyword, O func) {
  for (int i = 0; i < 1000; i++) {
    //int idx = findCodeTokens(tok, keyword, "{");
    int idx = jfind(tok, keyword + " {");
    if (idx < 0)
      break;
    int idx2 = findCodeTokens(tok, idx, false, "{");
    int j = findEndOfBracketPart(tok, idx2);
    
    S[] be = (S[]) callF(func, tok, idx2, j-1);
    replaceTokens(tok, idx, idx2+2, be[0] + " ");
    tok.set(j-1, be[1]);
    reTok(tok, idx, j);
  }
  ret tok;
}

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: 383 / 414
Version history: 8 change(s)
Referenced in: [show references]