Package org.eclipse.epsilon.egl
Class EgxModule
-
- All Implemented Interfaces:
IModule
,ModuleElement
,IEgxModule
,IEolModule
,IErlModule
- Direct Known Subclasses:
EgxModuleParallel
,LazyEgxModule
public class EgxModule extends ErlModule implements IEgxModule
- Since:
- 1.6 extends ERL rather than EGL.
-
-
Field Summary
Fields Modifier and Type Field Description protected NamedRuleList<GenerationRule>
declaredGenerationRules
protected NamedRuleList<GenerationRule>
generationRules
-
Fields inherited from class org.eclipse.epsilon.erl.ErlModule
declaredPost, declaredPre, post, pre
-
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
Constructors Constructor Description EgxModule()
EgxModule(String outputRoot)
CallsEgxModule(Path)
.EgxModule(Path outputRoot)
Instantiates the module and the context configured for outputting generated files to the specified directory.EgxModule(EglTemplateFactory templateFactory)
EgxModule(IEgxContext context)
Instantiates the module with the specified execution context.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ModuleElement
adapt(AST cst, ModuleElement parentAst)
void
build(AST cst, IModule module)
protected GenerationRule
createGenerationRule(AST generationRuleAst)
Subclasses may override this method to change the implementation ofGenerationRule
that is instantiated after parsing an EGX program.protected org.antlr.runtime.Lexer
createLexer(org.antlr.runtime.ANTLRInputStream inputStream)
EpsilonParser
createParser(org.antlr.runtime.TokenStream tokenStream)
IEgxContext
getContext()
List<GenerationRule>
getDeclaredGenerationRules()
List<GenerationRule>
getGenerationRules()
HashMap<String,Class<?>>
getImportConfiguration()
String
getMainRule()
boolean
parse(File file)
boolean
parse(String code, File file)
boolean
parse(URI uri)
protected Object
processRules()
Main rule processing logic.protected void
setFileGeneratingTemplateFactory(Path outputRoot)
Convenience method for initialising aEglFileGeneratingTemplateFactory
with the specified output path.-
Methods inherited from class org.eclipse.epsilon.erl.ErlModule
calculateSuperRules, execute, execute, executeImpl, getDeclaredPost, getDeclaredPre, getPost, getPre, postExecution, prepareExecution
-
Methods inherited from class org.eclipse.epsilon.eol.EolModule
checkImports, clearCache, execute, getDeclaredModelDeclarations, getDeclaredOperations, getImports, getImportsByExtension, getMain, getModelDeclarations, 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, invokeMainRule
-
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.egl.IEgxModule
getTemplateFactory, setTemplateFactory
-
Methods inherited from interface org.eclipse.epsilon.eol.IEolModule
configure, execute, getConfigurationProperties, getDeclaredModelDeclarations, getDeclaredOperations, getImports, getMain, getModelDeclarations, getOperations, getParentModule, getParseProblems, getPostOperationStatements, setContext, setParentModule
-
Methods inherited from interface org.eclipse.epsilon.erl.IErlModule
getDeclaredPost, getDeclaredPre, getPost, getPre
-
Methods inherited from interface org.eclipse.epsilon.common.module.IModule
createAst, getSourceUri, 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
-
generationRules
protected NamedRuleList<GenerationRule> generationRules
-
declaredGenerationRules
protected NamedRuleList<GenerationRule> declaredGenerationRules
-
-
Constructor Detail
-
EgxModule
public EgxModule()
-
EgxModule
public EgxModule(String outputRoot) throws EglRuntimeException
CallsEgxModule(Path)
.- Parameters:
outputRoot
-- Throws:
EglRuntimeException
- Since:
- 1.6
- See Also:
EgxModule(Path)
-
EgxModule
public EgxModule(Path outputRoot) throws EglRuntimeException
Instantiates the module and the context configured for outputting generated files to the specified directory.- Parameters:
outputRoot
- The base location to send output files to.- Throws:
EglRuntimeException
- If the path could not be resolved.- Since:
- 1.6
-
EgxModule
public EgxModule(IEgxContext context)
Instantiates the module with the specified execution context.- Parameters:
context
- The execution context
-
EgxModule
public EgxModule(EglTemplateFactory templateFactory)
-
-
Method Detail
-
setFileGeneratingTemplateFactory
protected void setFileGeneratingTemplateFactory(Path outputRoot) throws EglRuntimeException
Convenience method for initialising aEglFileGeneratingTemplateFactory
with the specified output path.- Parameters:
outputRoot
-- Throws:
EglRuntimeException
- Since:
- 1.6
-
createLexer
protected org.antlr.runtime.Lexer createLexer(org.antlr.runtime.ANTLRInputStream inputStream)
- Overrides:
createLexer
in classErlModule
-
createParser
public EpsilonParser createParser(org.antlr.runtime.TokenStream tokenStream)
- Overrides:
createParser
in classErlModule
-
getMainRule
public String getMainRule()
- Overrides:
getMainRule
in classErlModule
-
build
public void build(AST cst, IModule module)
- Specified by:
build
in interfaceModuleElement
- Overrides:
build
in classErlModule
-
adapt
public ModuleElement adapt(AST cst, ModuleElement parentAst)
-
createGenerationRule
protected GenerationRule createGenerationRule(AST generationRuleAst)
Subclasses may override this method to change the implementation ofGenerationRule
that is instantiated after parsing an EGX program.
-
getDeclaredGenerationRules
public List<GenerationRule> getDeclaredGenerationRules()
- Specified by:
getDeclaredGenerationRules
in interfaceIEgxModule
-
parse
public boolean parse(URI uri) throws Exception
- Specified by:
parse
in interfaceIModule
- Overrides:
parse
in classAbstractModule
- Throws:
Exception
-
parse
public boolean parse(String code, File file) throws Exception
- Specified by:
parse
in interfaceIEolModule
- Specified by:
parse
in interfaceIModule
- Overrides:
parse
in classAbstractModule
- Throws:
Exception
-
processRules
protected Object processRules() throws EolRuntimeException
Description copied from class:ErlModule
Main rule processing logic. Non-abstract for compatibility.- Overrides:
processRules
in classErlModule
- Returns:
- The result of executing this module.
- Throws:
EolRuntimeException
-
getImportConfiguration
public HashMap<String,Class<?>> getImportConfiguration()
- Overrides:
getImportConfiguration
in classErlModule
-
getGenerationRules
public List<GenerationRule> getGenerationRules()
- Specified by:
getGenerationRules
in interfaceIEgxModule
-
getContext
public IEgxContext getContext()
- Specified by:
getContext
in interfaceIEgxModule
- Specified by:
getContext
in interfaceIEolModule
- Specified by:
getContext
in interfaceIErlModule
- Overrides:
getContext
in classErlModule
-
-