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

17
LINES

< > BotCompany Repo | #1018260 // renameDollarVarsTo123

JavaX fragment (include)

1  
static S renameDollarVarsTo123(S s) {
2  
  ret renameDollarVarsTo123(javaTok(s));
3  
}
4  
5  
static S renameDollarVarsTo123(LS tok) {
6  
  new SS map;
7  
  for (int i = 1; i < l(tok); i += 2) {
8  
    S t = tok.get(i);
9  
    if (isDollarVar(t)) {
10  
      S v = map.get(t);
11  
      if (v == null)
12  
        map.put(t, v = "$" + (l(map)+1));
13  
      tok.set(i, v);
14  
    }
15  
  }
16  
  ret join(tok);
17  
}

Author comment

Began life as a copy of #1010854

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1018260
Snippet name: renameDollarVarsTo123
Eternal ID of this version: #1018260/1
Text MD5: 90d66840ba69294c58d4482c1fd5ef17
Author: stefan
Category: javax / parsing
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-09-12 18:30:13
Source code size: 377 bytes / 17 lines
Pitched / IR pitched: No / No
Views / Downloads: 307 / 340
Referenced in: [show references]