Package org.eclipse.epsilon.hutn
Class HutnModule
java.lang.Object
org.eclipse.epsilon.common.module.AbstractModuleElement
org.eclipse.epsilon.eol.AbstractModule
org.eclipse.epsilon.eol.EolModule
org.eclipse.epsilon.hutn.HutnModule
- All Implemented Interfaces:
IModule
,ModuleElement
,IEolModule
,IHutnModule
-
Field Summary
Modifier and TypeFieldDescriptionprotected File
protected HutnDocument
protected boolean
protected boolean
protected Spec
Fields inherited from class org.eclipse.epsilon.eol.EolModule
context, declaredModelDeclarations, declaredOperations, imports, main, modelDeclarations, operations, postOperationStatements
Fields inherited from class org.eclipse.epsilon.eol.AbstractModule
parseProblems, parser, sourceFile, sourceUri
-
Constructor Summary
ConstructorDescriptionHutnModule
(IHutnContext context) Instantiates the module with the specified execution context. -
Method Summary
Modifier and TypeMethodDescriptionadapt
(AST cst, ModuleElement parentAst) void
protected org.antlr.runtime.Lexer
createLexer
(org.antlr.runtime.ANTLRInputStream inputStream) createParser
(org.antlr.runtime.TokenStream tokenStream) boolean
Returns false only if the HUTN source passed to parse is not valid HUTN.boolean
protected boolean
invokeMainRule
(List<org.antlr.runtime.CommonToken> comments) protected boolean
void
setConfigFileDirectory
(File configFileDirectory) storeEmfModel
(File baseDirectory, String defaultModelPath, String inferredMetamodelPath) Generates an EMF model for the HUTN source passed to parse.void
storeIntermediateModel
(File destination) void
storeIntermediateModelTransformation
(File destination) void
protected void
translateAst
(AST ast) Methods inherited from class org.eclipse.epsilon.eol.EolModule
checkImports, clearCache, createDebugger, execute, executeImpl, getDeclaredModelDeclarations, getDeclaredOperations, getImportConfiguration, getImportManager, getImports, getImportsByExtension, getMain, getModelDeclarations, getOperations, getParentModule, getPostOperationStatements, prepareContext, setContext, setImportManager, setMain, setParentModule, toString
Methods inherited from class org.eclipse.epsilon.eol.AbstractModule
assignAnnotations, assignComment, assignComments, createAst, extractComments, getParseProblems, getSourceFile, getSourceUri, parse, parse
Methods inherited from class org.eclipse.epsilon.common.module.AbstractModuleElement
equals, getChildren, getComments, getData, getDebugInfo, getFile, getModule, getParent, getRegion, getUri, hashCode, setModule, setParent, setRegion, setUri
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.eclipse.epsilon.eol.IEolModule
configure, getConfigurationProperties, getParseProblems, parse
Methods inherited from interface org.eclipse.epsilon.common.module.IModule
createAst, getSourceUri, parse, parse, parse, parse, parse
Methods inherited from interface org.eclipse.epsilon.common.module.ModuleElement
getChildren, getComments, getData, getFile, getModule, getParent, getRegion, getUri, setModule, setParent, setRegion, setUri
-
Field Details
-
document
-
spec
-
metaModelIsValid
protected boolean metaModelIsValid -
configFileDirectory
-
hutnIsValid
protected boolean hutnIsValid
-
-
Constructor Details
-
HutnModule
public HutnModule() -
HutnModule
Instantiates the module with the specified execution context.- Parameters:
context
- The execution context- Since:
- 1.6
-
-
Method Details
-
createLexer
protected org.antlr.runtime.Lexer createLexer(org.antlr.runtime.ANTLRInputStream inputStream) - Overrides:
createLexer
in classEolModule
-
createParser
- Overrides:
createParser
in classEolModule
-
adapt
-
getMainRule
- Overrides:
getMainRule
in classEolModule
-
getContext
- Specified by:
getContext
in interfaceIEolModule
- Overrides:
getContext
in classEolModule
-
invokeMainRule
- Overrides:
invokeMainRule
in classAbstractModule
- Throws:
Exception
-
parsingWasSuccessful
protected boolean parsingWasSuccessful() -
build
- Specified by:
build
in interfaceModuleElement
- Overrides:
build
in classEolModule
-
translateAst
- Throws:
HutnException
-
hasValidHutn
public boolean hasValidHutn()Description copied from interface:IHutnModule
Returns false only if the HUTN source passed to parse is not valid HUTN. True is returned when the HUTN is valid, regardless of whether it conforms to the metamodel specified in the preamble.- Specified by:
hasValidHutn
in interfaceIHutnModule
-
setConfigFileDirectory
- Specified by:
setConfigFileDirectory
in interfaceIHutnModule
-
hasValidMetaModel
public boolean hasValidMetaModel()- Specified by:
hasValidMetaModel
in interfaceIHutnModule
-
getNsUris
- Specified by:
getNsUris
in interfaceIHutnModule
-
getModelFile
- Specified by:
getModelFile
in interfaceIHutnModule
-
generateEmfModel
- Specified by:
generateEmfModel
in interfaceIHutnModule
- Returns:
- an in-memory EMF model for the HUTN source passed to parse.
- Throws:
HutnGenerationException
-
storeEmfModel
public List<File> storeEmfModel(File baseDirectory, String defaultModelPath, String inferredMetamodelPath) throws HutnGenerationException Description copied from interface:IHutnModule
Generates an EMF model for the HUTN source passed to parse.
The model is stored in the given baseDirectory, with filename defaultModelPath. The HUTN source may contain a modelFile attribute (in a model package, in the Spec preamble). When a modelFile attribute is specified in the HUTN source, that value takes precedence over defaultModelPath.
When a metamodel is inferred (because no metamodel is specfied in the Spec preamble), it is generated in the given baseDirectory, with filename inferredMetamodelPath.
- Specified by:
storeEmfModel
in interfaceIHutnModule
- Returns:
- the list of Files generated by this method invocation.
- Throws:
HutnGenerationException
-
getIntermediateModel
- Specified by:
getIntermediateModel
in interfaceIHutnModule
-
storeIntermediateModel
- Specified by:
storeIntermediateModel
in interfaceIHutnModule
-
storeIntermediateModelTransformation
- Specified by:
storeIntermediateModelTransformation
in interfaceIHutnModule
- Throws:
HutnGenerationException
-
storeIntermediateModelTransformationForAllInputModels
public void storeIntermediateModelTransformationForAllInputModels(File destination) throws HutnGenerationException - Specified by:
storeIntermediateModelTransformationForAllInputModels
in interfaceIHutnModule
- Throws:
HutnGenerationException
-