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; } endif
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: | 1467 / 2367 |
| Version history: | 4 change(s) |
| Referenced in: | #1006654 - Standard functions list 2 (LIVE, continuation of #761) #1010085 - reTok_modify - reTok and call function on modified part #1012023 - reTok_multi - reTok multiple token ranges efficiently |