Download Jar. Uses 1177K of libraries. Click here for Pure Java version (7637L/55K).
1 | !7 |
2 | |
3 | p-exp { |
4 | jtattoo(); |
5 | S input = first(mL("Monolog examples")); |
6 | TextNode root = new(input); |
7 | |
8 | processNode_recursive(root, 10); |
9 | |
10 | showFrame(jDynamicTree(root, func(CTNode n) -> Collection<CTNode> { n.children })); |
11 | } |
12 | |
13 | svoid processNode_recursive(CTNode n, int depthCounter) { |
14 | if (n == null || depthCounter <= 0) ret; |
15 | processNode(n); |
16 | for (CTNode child : n.children) |
17 | processNode_recursive(child, depthCounter-1); |
18 | } |
19 | |
20 | svoid processNode(CTNode n) { |
21 | if (n instanceof TextNode) { |
22 | TextNode tn = cast n; |
23 | |
24 | OpNode op = new("javaTokPlusCurly_dontKeep"); |
25 | if (n.add(op)) |
26 | op.add(TokNode(javaTokPlusCurly_dontKeep(tn.text))); |
27 | } |
28 | |
29 | if (n instanceof TokNode) { |
30 | TokNode tn = cast n; |
31 | if (containsSubList(tn.tok, ll("=", "", ">"))) { |
32 | OpNode op = new("splitAtDoubleArrow"); |
33 | if (n.add(op)) |
34 | op.add(ObjectNode(splitAtDoubleArrow(tn.tok))); |
35 | } |
36 | |
37 | L<Int> l = indicesOfSubList(tn.tok, ll("&", "", "&")); |
38 | if (nempty(l)) { |
39 | OpNode op = new("split at &&"); |
40 | if (n.add(op)) |
41 | for (L<S> subTok : splitAroundSubListIndices(tn.tok, l, 3)) |
42 | op.add(TokNode(subTok)); |
43 | } |
44 | } |
45 | |
46 | if (n instanceof ObjectNode) { |
47 | ObjectNode on = cast n; |
48 | O o = on.obj; |
49 | |
50 | if (o instanceof S) |
51 | n.add(TextNode((S) o)); |
52 | |
53 | Collection c; |
54 | if (on.obj instanceof Collection && l((c = (Collection) on.obj)) == 2) { |
55 | OpNode op = new("Split Collection"); |
56 | if (n.add(op)) |
57 | for (O e : c) |
58 | op.add(ObjectNode(e)); |
59 | } |
60 | } |
61 | } |
Began life as a copy of #1017532
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: | #1017536 |
Snippet name: | Flexible Computation Tree v1, shortened [OK] |
Eternal ID of this version: | #1017536/5 |
Text MD5: | ff6ee2949b4ab915a51b07f4d6de5d97 |
Transpilation MD5: | 5fa2c8091db12ab8f9e6f8eb2ea59ad8 |
Author: | stefan |
Category: | javax / a.i. |
Type: | JavaX source code (desktop) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2018-07-29 17:06:26 |
Source code size: | 1585 bytes / 61 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 343 / 769 |
Version history: | 4 change(s) |
Referenced in: | [show references] |