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


< > BotCompany Repo | #1003367 // reTok - javaTok in place

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

Libraryless. Click here for Pure Java version (2371L/15K).

static L<S> reTok(L<S> tok) {
  replaceCollection(tok, javaTok(tok));
  ret tok;

static L<S> reTok(L<S> tok, int i) {
  ret reTok(tok, i, i+1);

static L<S> reTok(L<S> tok, int i, int j) {
  // extend i to an "N" token
  // and j to "C" (so j-1 is an "N" token)
  i = max(i & ~1, 0);
  j = min(l(tok), j | 1);
  if (i >= j) ret tok;
  L<S> t = javaTok(joinSubList(tok, i, j));
  replaceListPart(tok, i, j, t);
  // fallback to safety
  // reTok(tok);
  ret tok;

ifclass IntRange
static LS reTok(LS tok, IntRange r) {
  if (r != null) reTok(tok, r.start, r.end);
  ret tok;

download  show line numbers  debug dex  old transpilations   

Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1003367
Snippet name: reTok - javaTok in place
Eternal ID of this version: #1003367/5
Text MD5: 5552a621749e3d47541e1217e4224323
Transpilation MD5: 73907893760070d3de32ff589fa89b21
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-09-28 22:26:28
Source code size: 627 bytes / 31 lines
Pitched / IR pitched: No / No
Views / Downloads: 649 / 1364
Version history: 4 change(s)
Referenced in: [show references]