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

22
LINES

< > BotCompany Repo | #1033327 // reTok_modify [cleaning up]

JavaX fragment (include)

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  
static LS reTok_modify(L<S> tok, int i, int j, IF1<LS> f) {
8  
  // extend i to an "N" token
9  
  // and j to "C" (so j-1 is an "N" token)
10  
  i = i & ~1;
11  
  j = j | 1;
12  
  
13  
  L<S> t = javaTok(joinSubList(tok, i, j));
14  
  if (f != null) {
15  
    t = f.get(t);
16  
    if (reTok_modify_check)
17  
      assertEquals("Improperly tokenized", javaTok(join(t)), t);
18  
  }
19  
  replaceListPart(tok, i, j, t);
20  
  
21  
  ret tok;
22  
}

Author comment

Began life as a copy of #1010085

download  show line numbers  debug dex  old transpilations   

Travelled to 3 computer(s): bhatertpkbcr, mowyntqkapby, mqqgnosmbjvj

No comments. add comment

Snippet ID: #1033327
Snippet name: reTok_modify [cleaning up]
Eternal ID of this version: #1033327/1
Text MD5: 1508b8894dcfb6041ebd7e845c22e38a
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:39:19
Source code size: 550 bytes / 22 lines
Pitched / IR pitched: No / No
Views / Downloads: 127 / 152
Referenced in: [show references]