return new DescendantReader(subjectValue, false);
} else if (subjectType.isExternalType()) {
if (subjectType instanceof NonTerminalType) {
// NonTerminal (both pattern and subject are non-terminals, so we can skip layout and stuff)
IConstructor tree = (IConstructor) subjectValue;
NonTerminalType nt = (NonTerminalType) subjectType;
if (!shallow) {
return new DescendantReader(tree, patType instanceof NonTerminalType);
}
else {
if (nt.isConcreteListType()){
checkMayOccur(patType, subjectType, ctx);
IConstructor ls = nt.getSymbol();
int delta = SymbolAdapter.isSepList(ls) ?
(SymbolAdapter.getSeparators(ls).length() + 1) : 1;
return new CFListIterator(TreeAdapter.getArgs(tree), delta);
}
else if (nt.isOptionalType()) {
checkMayOccur(patType, subjectType, ctx);
return new CFListIterator(TreeAdapter.getArgs(tree), 1);
}
}
}