static L ai_parseTree_getChildren(AI_BottomUpParser1 parser, L productions, PTElement e) { if (e.children == null) { e.children = ai_parseTree_makeChildren(parser, productions, e); for (PTElement child : unnull(e.children)) child.parent = e; } ret e.children; } static L ai_parseTree_makeChildren(AI_BottomUpParser1 parser, L productions, final PTElement e) { if (e instanceof ChooseCategory) ret map(((ChooseCategory) e).categories, func(S cat) -> PTElement { new HaveCategory(((ChooseCategory) e).word, cat) }); if (e instanceof HaveCategory) { final HaveCategory h = cast e; L l = ai_buParser1_reconstructedProductions(parser, productions, h.word, h.category); ret map(l, func(ai_Reconstructed r) -> PTElement { r.production.b == null ? new HaveCategory(r.a, r.production.a, r) : new ChoosePart(h.word, r) }); } if (e instanceof ChoosePart) { ai_Reconstructed r = ((ChoosePart) e).reconstruction; ret (L) ll(new HaveCategory(r.a, r.production.a), new HaveCategory(r.b, r.production.b)); } null; }