// generate class definitions
//-----------------------------------------
System.err.println("generating class definitions...");
final File od = outDir;
ModelGenerator generator = null;
Controller controller;
if( out==xml ) {
generator = ModelGenerator.xmlGenerator;
controller = new ControllerImpl(grammarController) {
public OutputStream getOutput( TypeItem item ) throws IOException {
return new FileOutputStream(
new File( od, item.getTypeName()+".xml") );
}
};
} else {
generator = ModelGenerator.javaGenerator;
controller = new ControllerImpl(grammarController) {
public OutputStream getOutput( TypeItem item ) throws IOException {
return new FileOutputStream(
getJavaFile( od, item.getTypeName() ) );
}
};
}
generator.generate( grammar, symbolizer, controller );
System.err.println("done.");
return 0;
}