public static ADT readADT(GenerationParameters params) {
Iterator<String> iter = params.getInputFiles().iterator();
String fileName = "";
try {
Factory factory = Factory.getInstance(SingletonFactory
.getInstance());
Modules all = factory.makeModules();
// Entries all = factory.makeEntries();
while (iter.hasNext()) {
fileName = iter.next();
FileInputStream fis = new FileInputStream(fileName);
try {
all = all.concat(factory.ModulesFromFile(fis));
} catch (IllegalArgumentException ex) {
fis.close();
if (params.getApiName() == null) {
throw new IllegalArgumentException(
"No API name specified");
}
fis = new FileInputStream(fileName);
all = factory.makeModules(factory.makeModule_Modulentry(
factory.makeModuleName_Name(""), factory
.makeImports(), factory.makeSorts(),
factory.EntriesFromFile(fis)));
}
}
return ADT.initialize(all);
} catch (FileNotFoundException e) {