file.addNamespace(n);
}
// Add file comment
str = file.toString() + "\n\n" + gen.getFileComment();
file.addComment(new CSharpComment(CSharpComment.BLOCK, str));
// Add type comment
cls.addComment(new CSharpComment(TYPE_COMMENT));
// Add enumeration
cls.addEnumeration(enm);
enm.addComment(new CSharpComment(ENUM_COMMENT));
// Add constructor
constr = new CSharpConstructor("TextReader input");
cls.addConstructor(constr);
constr.addComment(new CSharpComment(CONSTRUCTOR1_COMMENT));
constr.addInitializer("base(input)");
constr.addCode("CreatePatterns();");
// Add constructor
constr = new CSharpConstructor("TextReader input, " +
analyzer.getClassName() + " analyzer");
cls.addConstructor(constr);
constr.addComment(new CSharpComment(CONSTRUCTOR2_COMMENT));
constr.addInitializer("base(input, analyzer)");
constr.addCode("CreatePatterns();");
// Add tokenizer factory method
method = new CSharpMethod(CSharpMethod.PROTECTED + CSharpMethod.OVERRIDE,
"NewTokenizer",
"TextReader input",
"Tokenizer");
method.addComment(new CSharpComment(FACTORY_COMMENT));
method.addCode("return new " + tokenizer.getClassName() + "(input);");
cls.addMethod(method);
// Add init method
cls.addMethod(initMethod);
initMethod.addComment(new CSharpComment(INIT_METHOD_COMMENT));
initMethod.addCode("ProductionPattern pattern;");
initMethod.addCode("ProductionPatternAlternative alt;");
}