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.

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);
}

// f: func(L<S>) -> L<S>
static L<S> reTok_modify(L<S> tok, int i, int j, O 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 = (L<S>) callF(f, 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 #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: 433 / 511
Version history: 9 change(s)
Referenced in: [show references]