* Note that lastNode.getParent() should never return null, since only the
* node at 'indentationLevel == 0' has a null parent and we check that case.
*/
if (--indentationLevel < 0) {
pos.setErrorIndex(indexOfLineStart);
throw new LocalizedParseException(getDisplayLocale(),
Errors.Keys.NodeHasNoParent_1, new Object[] {node}, 0);
}
lastNode = lastNode.getParent();
}
if (i == p) {
/*
* The node we just created is a sibling of the previous node. This is
* illegal if level==0, in which case we have no parent. Otherwise add
* the sibling to the common parent and let the indentation level unchanged.
*/
final TreeTable.Node parent = lastNode.getParent();
if (parent == null) {
pos.setErrorIndex(indexOfLineStart);
throw new LocalizedParseException(getDisplayLocale(),
Errors.Keys.NodeHasNoParent_1, new Object[] {node}, 0);
}
parent.getChildren().add(node);
} else if (i > p) {
/*