public abstract class AbstractModelTranslator<M extends Script,L extends de.uni_hildesheim.sse.vilBuildLanguage.LanguageUnit> extends ModelTranslator<M,VariableDeclaration,Resolver,ExpressionStatement,ExpressionTranslator>
| Modifier and Type | Class and Description |
|---|---|
protected class |
AbstractModelTranslator.AbstractRuleTranslator<D extends org.eclipse.emf.ecore.EObject,R extends Rule>
An extensible rule translator.
|
protected class |
AbstractModelTranslator.RuleTranslator
Implements a translator for VIL rules.
|
| Modifier and Type | Field and Description |
|---|---|
private ExpressionTranslator |
expressionTranslator |
private Resolver |
resolver |
private AbstractModelTranslator.RuleTranslator |
ruleTranslator |
| Modifier | Constructor and Description |
|---|---|
|
AbstractModelTranslator()
Creates a model translator.
|
protected |
AbstractModelTranslator(ExpressionTranslator expressionTranslator,
Resolver resolver)
Creates a model translator.
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
addVisibleDeclarationsToResolver(M model,
Resolver resolver)
Adds visible declarations of
model to resolver. |
protected void |
checkConstants(Script project,
L cause)
Performs static tests on the constants.
|
protected VariableDeclaration[] |
createArray(int len)
Creates an array of .
|
protected Compound |
createCompound(CompoundTypeDescriptor type)
Creates a compound object.
|
protected M |
createScript(L script,
java.net.URI uri,
boolean registerSuccessful,
java.util.List<de.uni_hildesheim.sse.vilBuildLanguage.LanguageUnit> inProgress,
Imports<M> imports,
ImportResolver<M> impResolver)
Creates a script instance from an EMF instance.
|
protected abstract M |
createScript(java.lang.String name,
ModelImport<M> parent,
Script.ScriptDescriptor<M> descriptor,
TypeRegistry registry)
Creates a script instance.
|
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.
|
protected java.util.List<org.eclipse.emf.ecore.EObject> |
getContents(L script)
Returns the actual contents of
script. |
protected abstract ModelManagement<M> |
getManagementInstance()
Returns the management instance.
|
protected abstract IModelLoader<M> |
getModelLoader() |
private static boolean |
isProtected(de.uni_hildesheim.sse.vilBuildLanguage.RuleDeclaration rule)
Returns whether a rule is protected.
|
protected void |
processAdditionalContents(L unit,
java.util.List<org.eclipse.emf.ecore.EObject> elements,
M result)
Extension point for
processContents(LanguageUnit, Script). |
protected void |
processContents(L script,
M result)
Processes the contents of a language unit and stores the results in
result. |
protected void |
processGlobalVariableDeclarations(java.util.List<org.eclipse.emf.ecore.EObject> elts,
M result)
Processes the global script variable declarations.
|
protected Imports<M> |
processImports(org.eclipse.emf.common.util.EList<de.uni_hildesheim.sse.vil.expressions.expressionDsl.Import> imports,
org.eclipse.emf.common.util.EList<de.uni_hildesheim.sse.vilBuildLanguage.Require> requires)
Processes the imports and returns an summarizing instance.
|
protected void |
reProcessGlobalVariableDeclarations(M model)
Re-processes global variable declarations to get rid of temporary "function pointer" expressions.
|
private java.util.List<Expression> |
resolveExpressions(org.eclipse.emf.common.util.EList<de.uni_hildesheim.sse.vil.expressions.expressionDsl.LogicalExpression> expressions)
Resolves a set of expressions.
|
private void |
resolveRuleExpressions(RuleDescriptor descriptor,
Rule.Side side,
org.eclipse.emf.common.util.EList<de.uni_hildesheim.sse.vil.expressions.expressionDsl.LogicalExpression> expressions)
Resolves rule 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
private AbstractModelTranslator.RuleTranslator ruleTranslator
public AbstractModelTranslator()
protected AbstractModelTranslator(ExpressionTranslator expressionTranslator, Resolver resolver)
expressionTranslator - the expression translator to useresolver - the resolver to useprotected M createScript(L script, java.net.URI uri, boolean registerSuccessful, java.util.List<de.uni_hildesheim.sse.vilBuildLanguage.LanguageUnit> inProgress, Imports<M> imports, ImportResolver<M> impResolver) throws TranslatorException
script - the EMF instance to work onuri - the URI of the project to resolve (in order to find the
closest project, may be null)registerSuccessful - successfully created models shall be registeredinProgress - the scripts currently being translatedimports - the global importsimpResolver - the import resolver to use (may be null to use a new default import resolver)TranslatorException - in case that a problem occurredprotected void processContents(L script, M result) throws TranslatorException
result.
Calls #processAdditionalContents(LanguageUnit, Script) if the contents is processable.script - the script language unit to be processedresult - the result instance to be modifiedTranslatorException - in case that processing failsprotected void processGlobalVariableDeclarations(java.util.List<org.eclipse.emf.ecore.EObject> elts,
M result)
script - the script language unit to be processedresult - the result instance to be modifiedprotected void reProcessGlobalVariableDeclarations(M model)
model - the model to be processedprotected java.util.List<org.eclipse.emf.ecore.EObject> getContents(L script)
script.script - the script to return the contents forprotected void processAdditionalContents(L unit, java.util.List<org.eclipse.emf.ecore.EObject> elements, M result) throws TranslatorException
processContents(LanguageUnit, Script).unit - the language unit to processscript - the script language unit to be processedresult - the result instance to be modifiedTranslatorException - in case that processing failsprotected abstract M createScript(java.lang.String name, ModelImport<M> parent, Script.ScriptDescriptor<M> descriptor, TypeRegistry registry)
name - Name of the project.parent - the super script to inherit from (as a script import, may be null, shall be member of
imports or also null)descriptor - the descriptor carrying parameters, advices and imports (may be null)registry - the responsible type registryprotected Imports<M> processImports(org.eclipse.emf.common.util.EList<de.uni_hildesheim.sse.vil.expressions.expressionDsl.Import> imports, org.eclipse.emf.common.util.EList<de.uni_hildesheim.sse.vilBuildLanguage.Require> requires) throws TranslatorException
imports - the imports to be processedTranslatorException - in case that processing the imports failsprotected abstract ModelManagement<M> getManagementInstance()
getManagementInstance in class ModelTranslator<M extends Script,VariableDeclaration,Resolver,ExpressionStatement,ExpressionTranslator>protected abstract IModelLoader<M> getModelLoader()
protected void checkConstants(Script project, L cause)
project - the project createdcause - the causing ECore elementTranslatorException - in case that a problem occurredprivate java.util.List<Expression> resolveExpressions(org.eclipse.emf.common.util.EList<de.uni_hildesheim.sse.vil.expressions.expressionDsl.LogicalExpression> expressions) throws TranslatorException
expressions - the expressions to be resolvedexpressions in case of errors)
or null in case of errorsTranslatorExceptionprivate void resolveRuleExpressions(RuleDescriptor descriptor, Rule.Side side, org.eclipse.emf.common.util.EList<de.uni_hildesheim.sse.vil.expressions.expressionDsl.LogicalExpression> expressions) throws TranslatorException
descriptor - the rule descriptor as target for the dataside - the rule sideexpressions - the expressions to be resolvedTranslatorException - in case of resolution problemsprotected VariableDeclaration[] createArray(int len)
ModelTranslatorcreateArray in class ModelTranslator<M extends Script,VariableDeclaration,Resolver,ExpressionStatement,ExpressionTranslator>len - the length of the arrayprivate static boolean isProtected(de.uni_hildesheim.sse.vilBuildLanguage.RuleDeclaration rule)
rule - the rule to be testedtrue if it is protected, false elsevoid 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 cause of the featurevoid 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 cause of the featureprotected void addVisibleDeclarationsToResolver(M 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<M extends Script,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<M extends Script,VariableDeclaration,Resolver,ExpressionStatement,ExpressionTranslator>name - the name of the typdef/aliastype - the the typeVilExceptionprotected Compound createCompound(CompoundTypeDescriptor type) throws VilException
ModelTranslatorcreateCompound in class ModelTranslator<M extends Script,VariableDeclaration,Resolver,ExpressionStatement,ExpressionTranslator>type - the the compound typeVilExceptionCopyright © 2009 - 2018 SSE. All Rights Reserved.