Libraryless. Click here for Pure Java version (1690L/11K/26K).
1 | !636 |
2 | !standard functions |
3 | !class JavaTok |
4 | !quicknew |
5 | |
6 | main { |
7 | psvm { |
8 | List<String> tok = JavaTok.split(loadMainJava()); |
9 | |
10 | // scan for classes, put list in "buf" |
11 | new StringBuilder buf; |
12 | int level = 0; |
13 | for (int i = 1; i+4 < tok.size(); i += 2) { |
14 | if (tok.get(i).equals("{")) ++level; |
15 | else if (tok.get(i).equals("}")) --level; |
16 | else if (level == 1 && tok.get(i).equals("static") && tok.get(i+2).equals("class")) |
17 | buf.append(quote(tok.get(i+4)) + ",\n"); |
18 | } |
19 | |
20 | // inject list into source code |
21 | for (int i = 1; i+4 < tok.size(); i += 2) |
22 | if (tok.get(i).equals("]") && tok.get(i+2).equals("innerClasses") |
23 | && tok.get(i+4).equals(";")) |
24 | tok.set(i+4, "={\n" + buf + "};"); // quick&dirty! |
25 | |
26 | saveMainJava(JavaTok.join(tok)); |
27 | } |
28 | } |
download show line numbers debug dex old transpilations
Travelled to 17 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, jtubtzbbkimh, lpdgvwnxivlt, mqqgnosmbjvj, mrjhfnjfopze, onxytkatvevr, pyentgdyhuwx, pzhvpgtvlbxg, teubizvjbppd, tslmcundralx, tvejysmllsmz, vouqrxazstgt
ID | Author/Program | Comment | Date |
---|---|---|---|
435 | #1000610 (pitcher) | 2015-08-18 14:38:53 | |
434 | #1000604 (pitcher) | 2015-08-18 14:38:53 |
Snippet ID: | #719 |
Snippet name: | List all inner classes (reflection enhancer) |
Eternal ID of this version: | #719/1 |
Text MD5: | 703137187a9b4f8e103bd36487756a80 |
Transpilation MD5: | 46e2aebd8987e7e3fe8c6bbe827b2600 |
Author: | stefan |
Category: | |
Type: | JavaX translator |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2015-08-18 14:38:53 |
Source code size: | 824 bytes / 28 lines |
Pitched / IR pitched: | No / Yes |
Views / Downloads: | 800 / 1861 |
Referenced in: | [show references] |