private void genFactoryInitialization(ADT api) {
Iterator<Type> types = api.typeIterator(module);
int listTypeCount = 0;
while (types.hasNext()) {
Type type = types.next();
if (type instanceof ListType) {
if (type instanceof SeparatedListType) {
genSeparatedListInitialization(listTypeCount,
(SeparatedListType) type);
} else {
genNormalListTypeInitialization(type, listTypeCount);
}
listTypeCount++;
} else if (!typeConverter.isReserved(type.getId())) {
Iterator<Alternative> alts = type.alternativeIterator();
while (alts.hasNext()) {
Alternative alt = alts.next();
String funVar = funVariable(type, alt);
String afunName = type.getId() + "_" + alt.getId();
println(" "
+ patternVariable(type, alt)
+ " = factory.parse(\""
+ StringConversions.escapeQuotes(alt
.buildMatchPattern().toString()) + "\");");
println(" " + funVar + " = factory.makeAFun(\"" + "_"
+ afunName + "\", " + type.getAltArity(alt)
+ ", false);");
println();
}
}
}