public class ModelTranslator extends ModelTranslator<Template,VariableDeclaration,Resolver,ExpressionStatement,ExpressionTranslator>
| Modifier and Type | Field and Description |
|---|---|
private ExpressionTranslator |
expressionTranslator |
private Resolver |
resolver |
| Constructor and Description |
|---|
ModelTranslator()
Creates the model translator.
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
addVisibleDeclarationsToResolver(Template model,
Resolver resolver)
Adds visible declarations of
model to resolver. |
protected VariableDeclaration[] |
createArray(int len)
Creates an array of .
|
protected Compound |
createCompound(CompoundTypeDescriptor type)
Creates a compound object.
|
Template |
createModel(de.uni_hildesheim.sse.vil.templatelang.templateLang.LanguageUnit tpl,
java.net.URI uri,
boolean registerSuccessful,
ImportResolver<Template> impResolver)
Creates a build model from a given implementation unit.
|
protected Typedef |
createTypedef(java.lang.String name,
TypeDescriptor<?> type)
Creates a typdef object.
|
(package private) void |
error(VilException exception,
org.eclipse.emf.ecore.EObject cause,
org.eclipse.emf.ecore.EStructuralFeature causeFeature)
Turns a buildlang exception into a xText error.
|
static java.lang.String |
getJavaQualifiedNameString(de.uni_hildesheim.sse.vil.templatelang.templateLang.JavaQualifiedName name)
Returns a string representing a qualified name.
|
protected ModelManagement<Template> |
getManagementInstance()
Returns the management instance.
|
private AlternativeStatement |
processAlternative(de.uni_hildesheim.sse.vil.templatelang.templateLang.Alternative alt)
Processes an alternative statement.
|
private ITemplateElement[] |
processBlock(de.uni_hildesheim.sse.vil.templatelang.templateLang.StmtBlock block)
Processes a block of rule elements.
|
private ContentStatement |
processContent(de.uni_hildesheim.sse.vil.templatelang.templateLang.Content content,
Resolver resolver)
Processes a content statement.
|
private Def |
processDef(de.uni_hildesheim.sse.vil.templatelang.templateLang.VilDef def,
Template template)
Processes a (sub-)template definition header.
|
private void |
processDefBody(DefInfo info)
Processes a (sub-)template body.
|
protected void |
processDefs(java.util.List<org.eclipse.emf.ecore.EObject> elts,
Template template)
Processes all template defs considering dependencies and terminates with
an error if not all can be resolved.
|
private FlushStatement |
processFlush()
Processes a content flush statement.
|
private FormattingConfiguration |
processFormattingHint(de.uni_hildesheim.sse.vil.templatelang.templateLang.FormattingHint hint)
Processes the formatting hint.
|
protected void |
processGlobalVariableDeclarations(java.util.List<org.eclipse.emf.ecore.EObject> elts,
Template result)
Processes the global script variable declarations.
|
private IndentationConfiguration |
processIndentHint(de.uni_hildesheim.sse.vil.templatelang.templateLang.IndentationHint hint)
Processes an indentation hint and returns the indentation configuration.
|
private JavaExtension |
processJavaExtension(de.uni_hildesheim.sse.vil.templatelang.templateLang.Extension ext,
java.util.Set<java.lang.String> knownTypes,
java.util.Set<java.lang.String> knownSignatures)
Processes a Java extension.
|
private JavaExtension |
processJavaExtension(JavaExtension javaExt,
java.util.Set<java.lang.String> knownTypes,
java.util.Set<java.lang.String> knownSignatures,
org.eclipse.emf.ecore.EObject cause,
org.eclipse.emf.ecore.EStructuralFeature causingFeature)
Processes a Java extension.
|
private void |
processJavaExtensions(de.uni_hildesheim.sse.vil.templatelang.templateLang.LanguageUnit tpl,
TemplateDescriptor desc)
Processes the Java extensions.
|
private LoopStatement |
processLoop(de.uni_hildesheim.sse.vil.templatelang.templateLang.Loop loop)
Processes a loop expression.
|
private Expression |
processSeparatorExpression(de.uni_hildesheim.sse.vil.expressions.expressionDsl.PrimaryExpression ex)
Processes a separator expression.
|
private ITemplateElement |
processStatement(de.uni_hildesheim.sse.vil.templatelang.templateLang.Stmt stmt)
Processes a statement.
|
private ITemplateElement |
processStatementOrStmtBlock(de.uni_hildesheim.sse.vil.templatelang.templateLang.Stmt stmt,
de.uni_hildesheim.sse.vil.templatelang.templateLang.StmtBlock block)
Processes an alternative statement or statement block.
|
private SwitchStatement |
processSwitch(de.uni_hildesheim.sse.vil.templatelang.templateLang.Switch swtch)
Processes a switch statement.
|
private WhileStatement |
processWhile(de.uni_hildesheim.sse.vil.templatelang.templateLang.While loop)
Processes a while statement.
|
protected void |
reProcessGlobalVariableDeclarations(Template model)
Re-processes global variable declarations to get rid of temporary "function pointer" expressions.
|
(package private) void |
warning(VilException exception,
org.eclipse.emf.ecore.EObject cause,
org.eclipse.emf.ecore.EStructuralFeature causeFeature)
Turns a buildlang exception into a xText warning.
|
convert, getExtensionImport, getResolver, postResolveImports, processAdvices, processCompoundContents, processCompounds, processImports, processTypedefContents, processTypedefs, processVariableDeclarations, processVariableDeclarations, resolveImports, resolveParameters, resolveParameters, warnVersionRestrictionscollect, copy, error, error, getErrorCount, getExpressionTranslator, getMessage, getMessageCount, select, warningerrorprivate ExpressionTranslator expressionTranslator
private Resolver resolver
public Template createModel(de.uni_hildesheim.sse.vil.templatelang.templateLang.LanguageUnit tpl, java.net.URI uri, boolean registerSuccessful, ImportResolver<Template> impResolver)
tpl - the language unit to be translateduri - the URI of the project to resolve (in order to find the
closest project, may be null)registerSuccessful - successfully created models shall be registeredimpResolver - the import resolver to use (may be null to use a new default import resolver)protected void processGlobalVariableDeclarations(java.util.List<org.eclipse.emf.ecore.EObject> elts,
Template result)
script - the script language unit to be processedresult - the result instance to be modifiedprivate IndentationConfiguration processIndentHint(de.uni_hildesheim.sse.vil.templatelang.templateLang.IndentationHint hint)
hint - the hintprivate FormattingConfiguration processFormattingHint(de.uni_hildesheim.sse.vil.templatelang.templateLang.FormattingHint hint)
hint - the hint to be processedprotected void reProcessGlobalVariableDeclarations(Template model)
model - the model to be processedprivate void processJavaExtensions(de.uni_hildesheim.sse.vil.templatelang.templateLang.LanguageUnit tpl,
TemplateDescriptor desc)
throws TranslatorException
tpl - the template to be processeddesc - the template descriptor to put the information intoTranslatorException - in case that resolving/processing/adding the Java extensions failsprivate JavaExtension processJavaExtension(de.uni_hildesheim.sse.vil.templatelang.templateLang.Extension ext, java.util.Set<java.lang.String> knownTypes, java.util.Set<java.lang.String> knownSignatures) throws TranslatorException
ext - the extension to be processedknownTypes - known type names (may be modified as a side effect)knownSignatures - known signatures due to Java extensions (may be modified as a side effect)TranslatorException - in case that resolving/processing/adding the Java extension failsprivate JavaExtension processJavaExtension(JavaExtension javaExt, java.util.Set<java.lang.String> knownTypes, java.util.Set<java.lang.String> knownSignatures, org.eclipse.emf.ecore.EObject cause, org.eclipse.emf.ecore.EStructuralFeature causingFeature) throws TranslatorException
ext - the extension to be processedknownTypes - known type names (may be modified as a side effect)knownSignatures - known signatures due to Java extensions (may be modified as a side effect)cause - the causing EObjectcausingFeature - the causing language featureTranslatorException - in case that resolving/processing/adding the Java extension failspublic static java.lang.String getJavaQualifiedNameString(de.uni_hildesheim.sse.vil.templatelang.templateLang.JavaQualifiedName name)
name - the qualified nameprotected ModelManagement<Template> getManagementInstance()
getManagementInstance in class ModelTranslator<Template,VariableDeclaration,Resolver,ExpressionStatement,ExpressionTranslator>protected void processDefs(java.util.List<org.eclipse.emf.ecore.EObject> elts,
Template template)
defs - the defs to be processedtemplate - the target template to store the defs inprivate Def processDef(de.uni_hildesheim.sse.vil.templatelang.templateLang.VilDef def, Template template) throws TranslatorException
def - the sub-templatetemplate - the target template to store the def inTranslatorException - in case that processing the definition failprivate void processDefBody(DefInfo info) throws TranslatorException
info - the def information object relating Ecore and model instanceTranslatorException - in case that processing the definition failprivate ITemplateElement[] processBlock(de.uni_hildesheim.sse.vil.templatelang.templateLang.StmtBlock block)
block - the block to be resolvedTranslatorException - in case that the translation fails due to semantic reasonsprivate ITemplateElement processStatement(de.uni_hildesheim.sse.vil.templatelang.templateLang.Stmt stmt) throws TranslatorException
stmt - the statement to be resolvedTranslatorException - in case that the translation fails due to semantic reasonsprivate ITemplateElement processStatementOrStmtBlock(de.uni_hildesheim.sse.vil.templatelang.templateLang.Stmt stmt, de.uni_hildesheim.sse.vil.templatelang.templateLang.StmtBlock block) throws TranslatorException
stmt - the statement (may be null)block - the statement block (may be null)TranslatorException - in case that the translation fails due to semantic reasonsprivate AlternativeStatement processAlternative(de.uni_hildesheim.sse.vil.templatelang.templateLang.Alternative alt) throws TranslatorException
alt - the alternative element from the languageTranslatorException - in case that the translation fails due to semantic reasonsprivate Expression processSeparatorExpression(de.uni_hildesheim.sse.vil.expressions.expressionDsl.PrimaryExpression ex) throws TranslatorException
ex - the ECore expression treeTranslatorException - in case that the translation failsprivate WhileStatement processWhile(de.uni_hildesheim.sse.vil.templatelang.templateLang.While loop) throws TranslatorException
loop - the ECore loop representationTranslatorException - in case that the translation failsprivate FlushStatement processFlush() throws TranslatorException
TranslatorException - in case that the translation failsprivate LoopStatement processLoop(de.uni_hildesheim.sse.vil.templatelang.templateLang.Loop loop) throws TranslatorException
loop - the loop expression to be processedTranslatorException - in case that the translation fails due to semantic reasonsprivate SwitchStatement processSwitch(de.uni_hildesheim.sse.vil.templatelang.templateLang.Switch swtch) throws TranslatorException
swtch - the switch statement from the languageTranslatorException - in case that the translation fails due to semantic reasonsprivate ContentStatement processContent(de.uni_hildesheim.sse.vil.templatelang.templateLang.Content content, Resolver resolver) throws TranslatorException
content - the statementTranslatorExceptionvoid error(VilException exception, org.eclipse.emf.ecore.EObject cause, org.eclipse.emf.ecore.EStructuralFeature causeFeature)
exception - the exception to usedcause - the cause (as instance of the EMF grammar model)causeFeature - the causing feature (as part of cause)void warning(VilException exception, org.eclipse.emf.ecore.EObject cause, org.eclipse.emf.ecore.EStructuralFeature causeFeature)
exception - the exception to usedcause - the cause (as instance of the EMF grammar model)causeFeature - the causing feature (as part of cause)protected VariableDeclaration[] createArray(int len)
ModelTranslatorcreateArray in class ModelTranslator<Template,VariableDeclaration,Resolver,ExpressionStatement,ExpressionTranslator>len - the length of the arrayprotected void addVisibleDeclarationsToResolver(Template model, Resolver resolver)
ModelTranslatormodel to resolver. This method
shall not consider imports as it is called by ModelTranslator.addImportedVariablesToResolver(IModel, boolean, Set).addVisibleDeclarationsToResolver in class ModelTranslator<Template,VariableDeclaration,Resolver,ExpressionStatement,ExpressionTranslator>model - the model to considerresolver - the resolver to add variables toprotected Typedef createTypedef(java.lang.String name, TypeDescriptor<?> type) throws VilException
ModelTranslatorcreateTypedef in class ModelTranslator<Template,VariableDeclaration,Resolver,ExpressionStatement,ExpressionTranslator>name - the name of the typdef/aliastype - the the typeVilExceptionprotected Compound createCompound(CompoundTypeDescriptor type) throws VilException
ModelTranslatorcreateCompound in class ModelTranslator<Template,VariableDeclaration,Resolver,ExpressionStatement,ExpressionTranslator>type - the the compound typeVilExceptionCopyright © 2009 - 2018 SSE. All Rights Reserved.