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

29
LINES

< > BotCompany Repo | #1017379 // Test tok_typeAA (OK)

JavaX source code (desktop) [tags: use-pretranspiled] - run with: x30.jar

Download Jar. Uses 3874K of libraries. Click here for Pure Java version (6533L/47K).

!7

static bool tok_isSingleTypeArg(L<S> tok, int iOpeningBracket) {
  int j = tok_findEndOfTypeArg(tok, iOpeningBracket);
  print("j: " + sfu(subList(tok, j)));
  ret neqGet(tok, j, ",");
}

svoid tok_typeAA(L<S> tok, Set<S> pairClasses) {
  int n = l(tok)-6;
  bool change = false;
  for (int i = 1; i < l(tok); i += 2) {
    if (!(eq(get(tok, i+2), "<") && contains(pairClasses, tok.get(i)))) continue;
    if (tok_isSingleTypeArg(tok, i+2)) {
      int j = findEndOfTypeArgs(tok, i+2)-1;
      S type = joinSubList(tok, i+4, j);
      replaceTokens_reTok(tok, i+4, j, type + ", " + type);
      change = true;
    }
  }
}

p-exp {
  for (S s : ll("Pair<A.B> p;", "Pair<A.B, C.D> p;", "Pair<A<B>> p;")) {
    L<S> tok = javaTok(s);
    tok_typeAA(tok, lithashset("Pair"));
    print(join(tok));
  }
}

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: #1017379
Snippet name: Test tok_typeAA (OK)
Eternal ID of this version: #1017379/6
Text MD5: 98b9a964c129fa65832ca2beea182fbc
Transpilation MD5: b24fc7ff4e796711da117013e77c8a44
Author: stefan
Category: javax
Type: JavaX source code (desktop)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-07-19 15:59:30
Source code size: 831 bytes / 29 lines
Pitched / IR pitched: No / No
Views / Downloads: 402 / 1082
Version history: 5 change(s)
Referenced in: [show references]