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


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

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

Libraryless. Click here for Pure Java version (2778L/18K).

sbool reTok_modify_check;

// 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   

Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, 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/4
Text MD5: 680cb43e46f1b8398c9b975dc6852d32
Transpilation MD5: 671ebf25434202e4a81469036a1b34ab
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-06-09 13:06:12
Source code size: 467 bytes / 19 lines
Pitched / IR pitched: No / No
Views / Downloads: 284 / 308
Version history: 3 change(s)
Referenced in: [show references]

Formerly at &