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
public class HutnModule extends EolModule implements IHutnModule
-
-
Field Summary
Fields Modifier and Type Field Description protected java.io.FileconfigFileDirectoryprotected HutnDocumentdocumentprotected booleanhutnIsValidprotected booleanmetaModelIsValidprotected Specspec-
Fields inherited from class org.eclipse.epsilon.eol.EolModule
compilationContext, context, declaredModelDeclarations, declaredOperations, imports, main, modelDeclarations, operations, postOperationStatements
-
Fields inherited from class org.eclipse.epsilon.eol.AbstractModule
parseProblems, parser, sourceFile, sourceUri
-
-
Constructor Summary
Constructors Constructor Description HutnModule()HutnModule(IHutnContext context)Instantiates the module with the specified execution context.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ModuleElementadapt(AST cst, ModuleElement parentAst)voidbuild(AST cst, IModule module)protected org.antlr.runtime.LexercreateLexer(org.antlr.runtime.ANTLRInputStream inputStream)EpsilonParsercreateParser(org.antlr.runtime.TokenStream tokenStream)AbstractEmfModelgenerateEmfModel()IHutnContextgetContext()SpecgetIntermediateModel()java.lang.StringgetMainRule()java.lang.StringgetModelFile()java.util.List<java.lang.String>getNsUris()booleanhasValidHutn()Returns false only if the HUTN source passed to parse is not valid HUTN.booleanhasValidMetaModel()protected booleaninvokeMainRule(java.util.List<org.antlr.runtime.CommonToken> comments)protected booleanparsingWasSuccessful()voidsetConfigFileDirectory(java.io.File configFileDirectory)java.util.List<java.io.File>storeEmfModel(java.io.File baseDirectory, java.lang.String defaultModelPath, java.lang.String inferredMetamodelPath)Generates an EMF model for the HUTN source passed to parse.voidstoreIntermediateModel(java.io.File destination)voidstoreIntermediateModelTransformation(java.io.File destination)voidstoreIntermediateModelTransformationForAllInputModels(java.io.File destination)protected voidtranslateAst(AST ast)-
Methods inherited from class org.eclipse.epsilon.eol.EolModule
checkImports, clearCache, compile, execute, executeImpl, getCompilationContext, getDeclaredModelDeclarations, getDeclaredOperations, getImportConfiguration, getImports, getImportsByExtension, getMain, getModelDelcarations, getOperations, getParentModule, getPostOperationStatements, prepareContext, setContext, 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
compile, 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 Detail
-
document
protected HutnDocument document
-
spec
protected Spec spec
-
metaModelIsValid
protected boolean metaModelIsValid
-
configFileDirectory
protected java.io.File configFileDirectory
-
hutnIsValid
protected boolean hutnIsValid
-
-
Constructor Detail
-
HutnModule
public HutnModule()
-
HutnModule
public HutnModule(IHutnContext context)
Instantiates the module with the specified execution context.- Parameters:
context- The execution context- Since:
- 1.6
-
-
Method Detail
-
createLexer
protected org.antlr.runtime.Lexer createLexer(org.antlr.runtime.ANTLRInputStream inputStream)
- Overrides:
createLexerin classEolModule
-
createParser
public EpsilonParser createParser(org.antlr.runtime.TokenStream tokenStream)
- Overrides:
createParserin classEolModule
-
adapt
public ModuleElement adapt(AST cst, ModuleElement parentAst)
-
getMainRule
public java.lang.String getMainRule()
- Overrides:
getMainRulein classEolModule
-
getContext
public IHutnContext getContext()
- Specified by:
getContextin interfaceIEolModule- Overrides:
getContextin classEolModule
-
invokeMainRule
protected boolean invokeMainRule(java.util.List<org.antlr.runtime.CommonToken> comments) throws java.lang.Exception- Overrides:
invokeMainRulein classAbstractModule- Throws:
java.lang.Exception
-
parsingWasSuccessful
protected boolean parsingWasSuccessful()
-
build
public void build(AST cst, IModule module)
- Specified by:
buildin interfaceModuleElement- Overrides:
buildin classEolModule
-
translateAst
protected void translateAst(AST ast) throws HutnException
- Throws:
HutnException
-
hasValidHutn
public boolean hasValidHutn()
Description copied from interface:IHutnModuleReturns 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:
hasValidHutnin interfaceIHutnModule
-
setConfigFileDirectory
public void setConfigFileDirectory(java.io.File configFileDirectory)
- Specified by:
setConfigFileDirectoryin interfaceIHutnModule
-
hasValidMetaModel
public boolean hasValidMetaModel()
- Specified by:
hasValidMetaModelin interfaceIHutnModule
-
getNsUris
public java.util.List<java.lang.String> getNsUris()
- Specified by:
getNsUrisin interfaceIHutnModule
-
getModelFile
public java.lang.String getModelFile()
- Specified by:
getModelFilein interfaceIHutnModule
-
generateEmfModel
public AbstractEmfModel generateEmfModel() throws HutnGenerationException
- Specified by:
generateEmfModelin interfaceIHutnModule- Returns:
- an in-memory EMF model for the HUTN source passed to parse.
- Throws:
HutnGenerationException
-
storeEmfModel
public java.util.List<java.io.File> storeEmfModel(java.io.File baseDirectory, java.lang.String defaultModelPath, java.lang.String inferredMetamodelPath) throws HutnGenerationExceptionDescription copied from interface:IHutnModuleGenerates 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:
storeEmfModelin interfaceIHutnModule- Returns:
- the list of Files generated by this method invocation.
- Throws:
HutnGenerationException
-
getIntermediateModel
public Spec getIntermediateModel()
- Specified by:
getIntermediateModelin interfaceIHutnModule
-
storeIntermediateModel
public void storeIntermediateModel(java.io.File destination)
- Specified by:
storeIntermediateModelin interfaceIHutnModule
-
storeIntermediateModelTransformation
public void storeIntermediateModelTransformation(java.io.File destination) throws HutnGenerationException- Specified by:
storeIntermediateModelTransformationin interfaceIHutnModule- Throws:
HutnGenerationException
-
storeIntermediateModelTransformationForAllInputModels
public void storeIntermediateModelTransformationForAllInputModels(java.io.File destination) throws HutnGenerationException- Specified by:
storeIntermediateModelTransformationForAllInputModelsin interfaceIHutnModule- Throws:
HutnGenerationException
-
-