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

16
LINES

< > BotCompany Repo | #1004949 // jreplaceExpandRefs

JavaX fragment (include)

// "$1" is first code token, "$2" second code token etc.
static S jreplaceExpandRefs(S s, L<S> tokref) {
  if (!contains(s, '$')) ret s;
  L<S> tok = javaTok(s);
  for (int i = 1; i < l(tok); i += 2) {
    S t = tok.get(i);
    if (t.startsWith("$") && isInteger(t.substring(1))) {
      S x = tokref.get(-1+parseInt(t.substring(1))*2);
      tok.set(i, x);
    } else if (t.equals("\\")) {
      tok.set(i, "");
      i += 2;
    }
  }
  ret join(tok);
}

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1004949
Snippet name: jreplaceExpandRefs
Eternal ID of this version: #1004949/7
Text MD5: 0d8daac63bcd0efafa485afeba5991b1
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-03-23 15:55:20
Source code size: 472 bytes / 16 lines
Pitched / IR pitched: No / No
Views / Downloads: 521 / 833
Version history: 6 change(s)
Referenced in: [show references]