Download Jar. Uses 3874K of libraries. Click here for Pure Java version (6533L/47K).
1 | !7 |
2 | |
3 | static bool tok_isSingleTypeArg(L<S> tok, int iOpeningBracket) { |
4 | int j = tok_findEndOfTypeArg(tok, iOpeningBracket); |
5 | print("j: " + sfu(subList(tok, j))); |
6 | ret neqGet(tok, j, ","); |
7 | } |
8 | |
9 | svoid tok_typeAA(L<S> tok, Set<S> pairClasses) { |
10 | int n = l(tok)-6; |
11 | bool change = false; |
12 | for (int i = 1; i < l(tok); i += 2) { |
13 | if (!(eq(get(tok, i+2), "<") && contains(pairClasses, tok.get(i)))) continue; |
14 | if (tok_isSingleTypeArg(tok, i+2)) { |
15 | int j = findEndOfTypeArgs(tok, i+2)-1; |
16 | S type = joinSubList(tok, i+4, j); |
17 | replaceTokens_reTok(tok, i+4, j, type + ", " + type); |
18 | change = true; |
19 | } |
20 | } |
21 | } |
22 | |
23 | p-exp { |
24 | for (S s : ll("Pair<A.B> p;", "Pair<A.B, C.D> p;", "Pair<A<B>> p;")) { |
25 | L<S> tok = javaTok(s); |
26 | tok_typeAA(tok, lithashset("Pair")); |
27 | print(join(tok)); |
28 | } |
29 | } |
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: | 403 / 1083 |
Version history: | 5 change(s) |
Referenced in: | [show references] |