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

14
LINES

< > BotCompany Repo | #1023410 // tok_expandVarCopies (+var)

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (1763L/12K).

1  
// +var => "var", +var
2  
// i.e. pattern "+<id>"
3  
svoid tok_expandVarCopies(L<S> tok) {
4  
  bool change = false;
5  
  for (int i = 3; i+2 < l(tok); i += 2) {
6  
    if (!eq(tok.get(i), "+")) continue;
7  
    if (!eqOneOf(tok.get(i-2), "(", ",", "{")) continue;
8  
    S s = tok.get(i+2);
9  
    if (!isIdentifier(s)) continue;
10  
    tok.set(i, quote(s) + ", ");
11  
    change = true;
12  
  }
13  
  if (change) reTok(tok);
14  
}

download  show line numbers  debug dex  old transpilations   

Travelled to 7 computer(s): bhatertpkbcr, cfunsshuasjs, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1023410
Snippet name: tok_expandVarCopies (+var)
Eternal ID of this version: #1023410/1
Text MD5: 826b935536da6f58616894315392ad14
Transpilation MD5: ea77e096867c9544347c423a0523955d
Author: stefan
Category: javax / transpiling
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-06-17 22:53:00
Source code size: 403 bytes / 14 lines
Pitched / IR pitched: No / No
Views / Downloads: 199 / 264
Referenced in: [show references]