Download Jar. Uses 1177K of libraries. Click here for Pure Java version (7637L/55K).
!7 p-exp { jtattoo(); S input = first(mL("Monolog examples")); TextNode root = new(input); processNode_recursive(root, 10); showFrame(jDynamicTree(root, func(CTNode n) -> Collection<CTNode> { n.children })); } svoid processNode_recursive(CTNode n, int depthCounter) { if (n == null || depthCounter <= 0) ret; processNode(n); for (CTNode child : n.children) processNode_recursive(child, depthCounter-1); } svoid processNode(CTNode n) { if (n instanceof TextNode) { TextNode tn = cast n; OpNode op = new("javaTokPlusCurly_dontKeep"); if (n.add(op)) op.add(TokNode(javaTokPlusCurly_dontKeep(tn.text))); } if (n instanceof TokNode) { TokNode tn = cast n; if (containsSubList(tn.tok, ll("=", "", ">"))) { OpNode op = new("splitAtDoubleArrow"); if (n.add(op)) op.add(ObjectNode(splitAtDoubleArrow(tn.tok))); } L<Int> l = indicesOfSubList(tn.tok, ll("&", "", "&")); if (nempty(l)) { OpNode op = new("split at &&"); if (n.add(op)) for (L<S> subTok : splitAroundSubListIndices(tn.tok, l, 3)) op.add(TokNode(subTok)); } } if (n instanceof ObjectNode) { ObjectNode on = cast n; O o = on.obj; if (o instanceof S) n.add(TextNode((S) o)); Collection c; if (on.obj instanceof Collection && l((c = (Collection) on.obj)) == 2) { OpNode op = new("Split Collection"); if (n.add(op)) for (O e : c) op.add(ObjectNode(e)); } } }
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: | 344 / 769 |
Version history: | 4 change(s) |
Referenced in: | #1017538 - Computation Tree On Lists [dev.] #1017599 - Computation tree for parsing with OpNode results [dev.] |