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

13
LINES

< > BotCompany Repo | #1017025 // combineToDollarVarPattern

JavaX fragment (include)

1  
sS combineToDollarVarPattern(S a, S b) {
2  
  L<S> tok1 = codeTokens(dropPunctuation(javaTok(a)));
3  
  L<S> tok2 = codeTokens(dropPunctuation(javaTok(b)));
4  
  if (l(tok1) != l(tok2)) null;
5  
  new L<S> out;
6  
  Iterator<S> varNames = allWordsOfAlphabet(lowerCaseAlphabet());
7  
  varNames.next(); // Skip "$"
8  
  for i over tok1: {
9  
    S t = tok1.get(i);
10  
    out.add(eq(t, tok2.get(i)) ? t : "$" + varNames.next());
11  
  }
12  
  ret joinWithSpace(out);
13  
}

Author comment

Began life as a copy of #1017024

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: #1017025
Snippet name: combineToDollarVarPattern
Eternal ID of this version: #1017025/2
Text MD5: ede67b1c802bf287dd40166cbc9868a0
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-07-10 20:55:51
Source code size: 444 bytes / 13 lines
Pitched / IR pitched: No / No
Views / Downloads: 339 / 370
Version history: 1 change(s)
Referenced in: [show references]