static S parseDoubleArrowTreeCI_defaultKey = ""; static Map parseDoubleArrowTreeCI(S text) { L lines = withoutEmpties(rtrimAll(lines(text))); if (empty(lines)) null; new L> nodes; new L indents; // indent of children Map tree = ciMap(); nodes.add(tree); indents.add(countIndent(first(lines))); for i over lines: { S s = lines.get(i); int indent = countIndent(s); while (indent < last(indents)) { removeLast(nodes); removeLast(indents); } L x = splitAtDoubleArrow(s); if (l(x) == 2) { // leaf (or tree with default) S next = get(lines, i+1); if (next != null && countIndent(next) > indent) { // tree with default Map newTree = ciMap(); last(nodes).put(first(x), newTree); nodes.add(newTree); indents.add(indent+1); newTree.put(parseDoubleArrowTreeCI_defaultKey, second(x)); } else // leaf last(nodes).put(first(x), second(x)); } else { Map newTree = ciMap(); last(nodes).put(trim(s), newTree); nodes.add(newTree); indents.add(indent+1); } } ret tree; }