-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
DSL-specific tagging See merge request monticore/monticore!707
- Loading branch information
Showing
91 changed files
with
3,998 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
...ore-generator/src/main/java/de/monticore/codegen/cd2java/_tagging/CDTaggingDecorator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/* (c) https://github.com/MontiCore/monticore */ | ||
package de.monticore.codegen.cd2java._tagging; | ||
|
||
import de.monticore.cdbasis._ast.ASTCDCompilationUnit; | ||
import de.monticore.cdbasis._ast.ASTCDPackage; | ||
import de.monticore.codegen.cd2java.AbstractDecorator; | ||
import de.monticore.generating.templateengine.GlobalExtensionManagement; | ||
import de.se_rwth.commons.Joiners; | ||
import de.se_rwth.commons.Names; | ||
|
||
public class CDTaggingDecorator extends AbstractDecorator { | ||
protected final TaggerDecorator taggerDecorator; | ||
protected final TagConformsToSchemaCoCoDecorator coCoDecorator; | ||
|
||
public CDTaggingDecorator(GlobalExtensionManagement glex, TaggerDecorator taggerDecorator, TagConformsToSchemaCoCoDecorator coCoDecorator) { | ||
super(glex); | ||
this.taggerDecorator = taggerDecorator; | ||
this.coCoDecorator = coCoDecorator; | ||
} | ||
|
||
public void decorate(ASTCDCompilationUnit input, ASTCDCompilationUnit decoratedCD) { | ||
ASTCDPackage taggingPackage = getPackage(input, decoratedCD, TaggingConstants.TAGGING_PACKAGE); | ||
|
||
taggingPackage.addAllCDElements(taggerDecorator.decorate()); | ||
taggingPackage.addAllCDElements(coCoDecorator.decorate()); | ||
} | ||
|
||
@Override | ||
protected String getPackageName(ASTCDCompilationUnit origCD, String subPackage) { | ||
String cdDefName = origCD.getCDDefinition().getName(); | ||
// Note: We change from the TagDef/TagSchema package into the original grammars package | ||
if (cdDefName.toLowerCase().endsWith(TaggingConstants.TAGDEFINITION_SUFFIX.toLowerCase())) | ||
cdDefName = cdDefName.substring(0, cdDefName.length() - TaggingConstants.TAGDEFINITION_SUFFIX.length()); | ||
if (cdDefName.toLowerCase().endsWith(TaggingConstants.TAGSCHEMA_SUFFIX.toLowerCase())) | ||
cdDefName = cdDefName.substring(0, cdDefName.length() - TaggingConstants.TAGSCHEMA_SUFFIX.length()); | ||
// end changes | ||
String origPackage = Names.constructQualifiedName(origCD.getCDPackageList(), cdDefName); | ||
return (subPackage.isEmpty() ? origPackage : Joiners.DOT.join(origPackage, subPackage)).toLowerCase(); | ||
} | ||
} |
Oops, something went wrong.