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

21
LINES

< > BotCompany Repo | #1012010 // jreplace_singlePosition (TODO)

JavaX fragment (include)

static boolean jreplace_singlePosition(L<S> tok, int i, S in, S out) {
  L<S> tokin = javaTok(in);
  jfind_preprocess(tokin);
  S[] toks = toStringArray(codeTokensOnly(tokin));

    int i = findCodeTokens(tok, 1, ignoreCase, toks, condition);
    if (i < 0)
      ret anyChange;
    L<S> subList = tok.subList(i-1, i+l(tokin)-1); // N to N
    S expansion = jreplaceExpandRefs(out, subList);
    int end = i+l(tokin)-2;
    clearAllTokens(tok, i, end); // C to C
    tok.set(i, expansion);
    if (reTok) // would this ever be false??
      reTok(tok, i, end);
    anyChange = true;
  }
  throw fail("woot? 10000! " + quote(in) + " => " + quote(out));
}

static bool jreplace_debug;

Author comment

Began life as a copy of #1002133

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1012010
Snippet name: jreplace_singlePosition (TODO)
Eternal ID of this version: #1012010/1
Text MD5: 8852d0102695691612c3e338dd9cd726
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-11-16 02:00:47
Source code size: 702 bytes / 21 lines
Pitched / IR pitched: No / No
Views / Downloads: 419 / 446
Referenced in: [show references]