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

17
LINES

< > BotCompany Repo | #1003848 - replaceKeywordBlockDyn

JavaX fragment (include)

// func returns S[] {beg, end}
static L<S> replaceKeywordBlockDyn(L<S> tok, S keyword, O func) {
  for (int i = 0; i < 1000; i++) {
    int idx = findCodeTokens(tok, keyword, "{");
    if (idx < 0)
      break;
    int j = findEndOfBracketPart(tok, idx+2);
    
    S[] be = (S[]) callF(func);
    tok.set(idx, be[0]);
    tok.set(idx+1, " ");
    tok.set(idx+2, "");
    tok.set(j-1, be[1]);
    reTok(tok, idx, j);
  }
  ret tok;
}

Author comment

Began life as a copy of #1001885

download  show line numbers  debug dex   

Travelled to 10 computer(s): aoiabmzegqzx, cbybwowwnfue, cfunsshuasjs, ddnzoavkxhuk, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, tslmcundralx, tvejysmllsmz

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: 322 / 826
Referenced in: [show references]

Formerly at http://tinybrain.de/1003848 & http://1003848.tinybrain.de