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

28
LINES

< > BotCompany Repo | #1011087 // doubleFor (complicated version, abandoned)

JavaX fragment (include)

1  
/* complicated version - TODO */
2  
// for (S key, S value : map)
3  
/*static void doubleFor(L<S> tok) {
4  
  int i;
5  
  while ((i = jfind(tok, "for (<id> <id>, <id> <id> :")) >= 0) {
6  
    int iComma = indexOf(tok, ",", i);
7  
    S valType = tok.get(iComma+2);
8  
    S valName = tok.get(iComma+4);
9  
    int expStart = indexOf(tok, ":", i)+2;
10  
    int expEnd = findEndOfBracketPart(expStart-2);
11  
    assertEquals(")", tok.get(expEnd));
12  
    assertEquals("{", tok.get(expEnd+2));
13  
    replaceTokens(tok, iComma, expStart, ": keys(");
14  
    tok.set(expEnd, "))");
15  
    tok.set(expEnd+2, "{ " + valType + " " + valName + " = " + 
16  
    S type = tok.get(i+2), id = tok.get(i+4);
17  
      int j = scanOverExpression(tok, bracketMap, i+8, "|");
18  
      S exp = join(tok.subList(i+8, j));
19  
      j += 2;
20  
      int k = scanOverExpression(tok, bracketMap, j, "]");
21  
      S where = join(tok.subList(j, k));
22  
      ++k;
23  
      
24  
      S code = "filter(" + exp + ", func(" + type + " " + id + ") { " + where + " })";
25  
      replaceTokens(tok, i, k, code);
26  
      reTok(tok, i, k);
27  
    }
28  
}*/

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1011087
Snippet name: doubleFor (complicated version, abandoned)
Eternal ID of this version: #1011087/1
Text MD5: 1a5ff43910f34a39f8e23916c4dfdb7e
Author: stefan
Category: javax / a.i.
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-10-12 02:57:39
Source code size: 1067 bytes / 28 lines
Pitched / IR pitched: No / No
Views / Downloads: 415 / 455
Referenced in: [show references]