Libraryless. Click here for Pure Java version (2832L/17K).
sS structure_convertTokenMarkersToExplicit(S s) { ret join(structure_convertTokenMarkersToExplicit(javaTokForStructure(s))); } static LS structure_convertTokenMarkersToExplicit(LS tok) { // find references & convert to explicit new TreeSet<Int> refs; for (int i = 1; i < l(tok); i += 2) { S t = tok.get(i); if (t.startsWith("t") && isInteger(t.substring(1))) { refs.add(parseInt(t.substring(1))); tok.set(i, "r" + substring(t, 1)); } } if (empty(refs)) ret tok; // add markers for (int i : refs) { int idx = i*2+1; if (idx >= l(tok)) continue; // broken structure S t = ""; if (endsWithLetterOrDigit(tok.get(idx-1))) t = " "; tok.set(idx, t + "m" + i + " " + tok.get(idx)); } ret tok; }
Began life as a copy of #1010235
download show line numbers debug dex old transpilations
Travelled to 4 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, vouqrxazstgt
No comments. add comment
Snippet ID: | #1030716 |
Snippet name: | structure_convertTokenMarkersToExplicit |
Eternal ID of this version: | #1030716/2 |
Text MD5: | b3a1ad3eec1752ff1f242ff007418429 |
Transpilation MD5: | 22939e97254901ad0435ae59f8c3731f |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2021-03-16 16:12:13 |
Source code size: | 793 bytes / 29 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 176 / 246 |
Version history: | 1 change(s) |
Referenced in: | #1006654 - Standard functions list 2 (LIVE, continuation of #761) #1030949 - Transpiler output of #1031393 |