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

23
LINES

< > BotCompany Repo | #1010085 // reTok_modify - reTok and call function on modified part

JavaX fragment (include) [tags: use-pretranspiled]

Transpiled version (2778L) is out of date.

1  
sbool reTok_modify_check;
2  
3  
static LS lambdaMapLike reTok_modify(IF1<LS> f, L<S> tok, int i, int j) {
4  
  ret reTok_modify(tok, i, j, f);
5  
}
6  
7  
// f: func(L<S>) -> L<S>
8  
static L<S> reTok_modify(L<S> tok, int i, int j, O f) {
9  
  // extend i to an "N" token
10  
  // and j to "C" (so j-1 is an "N" token)
11  
  i = i & ~1;
12  
  j = j | 1;
13  
  
14  
  L<S> t = javaTok(joinSubList(tok, i, j));
15  
  if (f != null) {
16  
    t = (L<S>) callF(f, t);
17  
    if (reTok_modify_check)
18  
      assertEquals("Improperly tokenized", javaTok(join(t)), t);
19  
  }
20  
  replaceListPart(tok, i, j, t);
21  
  
22  
  ret tok;
23  
}

Author comment

Began life as a copy of #1003367

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1010085
Snippet name: reTok_modify - reTok and call function on modified part
Eternal ID of this version: #1010085/10
Text MD5: 2170cddc068d9c55800fad82c60ccd60
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-10-23 04:41:39
Source code size: 582 bytes / 23 lines
Pitched / IR pitched: No / No
Views / Downloads: 432 / 511
Version history: 9 change(s)
Referenced in: [show references]