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

19
LINES

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

JavaX fragment (include)

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(join(subList(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 9 computer(s): aoiabmzegqzx, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, tslmcundralx, tvejysmllsmz

No comments. add comment

Snippet ID: #1010085
Snippet name: reTok_modify - reTok and call function on modified part
Eternal ID of this version: #1010085/3
Text MD5: fd47f78e6b4aae61fc3464b635cab182
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-09-02 09:37:23
Source code size: 469 bytes / 19 lines
Pitched / IR pitched: No / No
Views / Downloads: 233 / 236
Version history: 2 change(s)
Referenced in: [show references]

Formerly at http://tinybrain.de/1010085 & http://1010085.tinybrain.de