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)

sbool reTok_modify_check;

static LS lambdaMapLike reTok_modify(IF1<LS> f, L<S> tok, int i, int j) {
  ret reTok_modify(tok, i, j, f);
}

static LS reTok_modify(L<S> tok, int i, int j, IF1<LS> f) {
  // extend i to an "N" token
  // and j to "C" (so j-1 is an "N" token)
  i = i & ~1;
  j = j | 1;
  
  L<S> t = javaTok(joinSubList(tok, i, j));
  if (f != null) {
    t = f.get(t);
    if (reTok_modify_check)
      assertEquals("Improperly tokenized", javaTok(join(t)), t);
  }
  replaceListPart(tok, i, j, t);
  
  ret tok;
}

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