String extName = baseLanguage.getTransformationName(toplevelDecl);
String fullExtName = getFullRenamedDeclarationName(extName);
checkModuleName(extName, toplevelDecl);
RelativePath strExtension = environment.createOutPath(baseProcessor.getRelativeNamespaceSep() + extName + ".str");
IStrategoTerm transBody = baseLanguage.getTransformationBody(toplevelDecl);
if (isApplication(transBody, "TransformationDef"))
transBody = ATermCommands.factory.makeListCons(ATermCommands.makeAppl("Rules", "Rules", 1, transBody.getSubterm(0)), (IStrategoList) transBody.getSubterm(1));
log.log("The name of the transformation is '" + extName + "'.", Log.DETAIL);
log.log("The full name of the transformation is '" + fullExtName + "'.", Log.DETAIL);
if (dependsOnModel)
return;
String qualifiedMain = "main-" + fullExtName.replace('/', '_');
IStrategoTerm renamedTransBody = STRCommands.renameRules(transBody, "main", qualifiedMain);
String strImports = " imports " + StringCommands.printListSeparated(availableSTRImports, " ") + "\n";
String strExtensionTerm = "Module(" + "\"" + fullExtName+ "\"" + ", " + renamedTransBody + ")" + "\n";
String strExtensionContent = SDFCommands.prettyPrintSTR(ATermCommands.atermFromString(strExtensionTerm), baseProcessor.getInterpreter());
int index = strExtensionContent.indexOf('\n');
if (index >= 0)
strExtensionContent =
strExtensionContent.substring(0, index + 1) + "\n"
+ strImports + "\n"
+ strExtensionContent.substring(index + 1);
else
strExtensionContent += strImports;
driverResult.generateFile(strExtension, strExtensionContent);
availableSTRImports.add(fullExtName);
log.log("Wrote Stratego file to '" + strExtension.getAbsolutePath() + "'.", Log.DETAIL);
/*
* adapt current transformation
*/
if (FileCommands.exists(strExtension))