int start = 0;
int end = innerSource.indexOf('\u0001', start); // look for boundary markers
if (end == -1) {
// if we have just one part simply parse and set
Context<Node> context = getContext();
Node innerRoot = parseRawBlock(innerSource).resultValue;
setContext(context); // we need to save and restore the context since we might be recursing
return push(tight ? new TightListItemNode(innerRoot) : new LooseListItemNode(innerRoot));
}
// ok, we have several parts, so create the root node and attach all part roots
push(tight ? new TightListItemNode() : new LooseListItemNode());
while (true) {
end = innerSource.indexOf('\u0001', start);
if (end == -1) end = innerSource.length();
String sourcePart = innerSource.substring(start, end);
Context<Node> context = getContext();
Node node = parseRawBlock(sourcePart).resultValue;
setContext(context);
peek().addChild(node.getChildren().get(0)); // skip one superfluous level
if (end == innerSource.length()) return true;
start = end + 1;
}
}