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

19
LINES

< > BotCompany Repo | #1017693 // dollarVarsToStars_underscores

JavaX fragment (include)

1  
static S dollarVarsToStars_underscores(S s) {
2  
  ret dollarVarsToStars_underscores(s, null);
3  
}
4  
5  
static S dollarVarsToStars_underscores(S s, L<S> varNames_out) {
6  
  ret join(dollarVarsToStars_underscores(javaTok(s), varNames_out));
7  
}
8  
9  
static L<S> dollarVarsToStars_underscores(L<S> tok, L<S> varNames_out) {
10  
  for (int i = 1; i < l(tok); i += 2) {
11  
    S t = tok.get(i);
12  
    if (isDollarVar(t)) {
13  
      listAdd(varNames_out, t);
14  
      tok.set(i, joinWithSpace(rep("*", underscoreWordCount(t))));
15  
    } else if (eq(t, "*"))
16  
      listAdd(varNames_out, "*");
17  
  }
18  
  ret tok;
19  
}

Author comment

Began life as a copy of #1010854

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1017693
Snippet name: dollarVarsToStars_underscores
Eternal ID of this version: #1017693/3
Text MD5: 78d681c12a55cabbfabaaa26b116f385
Author: stefan
Category: javax / parsing
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-08-17 13:04:23
Source code size: 589 bytes / 19 lines
Pitched / IR pitched: No / No
Views / Downloads: 489 / 509
Version history: 2 change(s)
Referenced in: [show references]