1 | // returns true if it worked ok |
2 | static bool expandEllipsis(OccTree2 tree) { |
3 | bool ok = true; |
4 | OccTree2 node = null; |
5 | int safety = 0; |
6 | while (++safety < 1000 && (node = findNode(tree, E.state("..."))) != null) { |
7 | OccTree2 p = node.parent; |
8 | L<OccTree2> l = findNodes(tree, p.e); |
9 | l.remove(p); |
10 | if (empty(l)) { |
11 | print("Couldn't expand ellipsis after " + p.e); |
12 | ok = false; |
13 | } |
14 | p.replaceWith(cloneOccTree(first(l))); |
15 | } |
16 | if (node != null) { |
17 | print("Expand ellipsis: Warning - Safety count reached (" + safety + ")"); |
18 | ok = false; |
19 | } |
20 | ret ok; |
21 | } |
download show line numbers debug dex old transpilations
Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, ddnzoavkxhuk, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1003563 |
Snippet name: | expandEllipsis - replace "[...]" in occ tree with matching subtree |
Eternal ID of this version: | #1003563/1 |
Text MD5: | f6fcfab839a4bdf765bbbc1b2c5001fb |
Author: | stefan |
Category: | javax / talking robots |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2016-07-19 17:44:19 |
Source code size: | 601 bytes / 21 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 494 / 511 |
Referenced in: | [show references] |