out("class Factory {");
out("public static " + myShortener.fun(PSI_ELEMENT_CLASS) + " createElement(" + myShortener.fun(AST_NODE_CLASS) + " node) {");
out("IElementType type = node.getElementType();");
boolean first = true;
for (String elementType : sortedCompositeTypes.keySet()) {
<BUG>final BnfRule rule = sortedCompositeTypes.get(elementType);
String psiClass = getRulePsiClassName(rule, myPsiImplClassFormat);</BUG>
out((!first ? "else" : "") + " if (type == " + elementType + ") {");
out("return new " + psiClass + "(node);");
first = false;

out("class Factory {");
out("public static " + myShortener.fun(PSI_ELEMENT_CLASS) + " createElement(" + myShortener.fun(AST_NODE_CLASS) + " node) {");
out("IElementType type = node.getElementType();");
boolean first = true;
for (String elementType : sortedCompositeTypes.keySet()) {
BnfRule rule = sortedCompositeTypes.get(elementType);
if (myAbstractRules.contains(rule.getName())) continue;
String psiClass = getRulePsiClassName(rule, myPsiImplClassFormat);
out((!first ? "else" : "") + " if (type == " + elementType + ") {");
out("return new " + psiClass + "(node);");
first = false;
