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)

1  
static boolean jreplace_singlePosition(L<S> tok, int i, S in, S out) {
2  
  L<S> tokin = javaTok(in);
3  
  jfind_preprocess(tokin);
4  
  S[] toks = toStringArray(codeTokensOnly(tokin));
5  
6  
    int i = findCodeTokens(tok, 1, ignoreCase, toks, condition);
7  
    if (i < 0)
8  
      ret anyChange;
9  
    L<S> subList = tok.subList(i-1, i+l(tokin)-1); // N to N
10  
    S expansion = jreplaceExpandRefs(out, subList);
11  
    int end = i+l(tokin)-2;
12  
    clearAllTokens(tok, i, end); // C to C
13  
    tok.set(i, expansion);
14  
    if (reTok) // would this ever be false??
15  
      reTok(tok, i, end);
16  
    anyChange = true;
17  
  }
18  
  throw fail("woot? 10000! " + quote(in) + " => " + quote(out));
19  
}
20  
21  
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: 421 / 449
Referenced in: [show references]