The mwe2 file controls the workflow, it generates all the necessary files. In xtext it is in a file with a name like: Generate????.mwe2 |
This .mwe2 file starts with module information and then has a 'Workflow' which contains a list of components which are written in java. |
These interfaces are defined at the links on the right: |
So, in more detail, here is an example of a component:
Generator component
The component that we are interested in is the 'Generator' component, it is called from the mwe2 file like this:
component = Generator { pathRtProject = runtimeProject pathUiProject = "${runtimeProject}.ui" pathTestProject = "${runtimeProject}.tests" projectNameRt = projectName projectNameUi = "${projectName}.ui" encoding = encoding language = auto-inject { uri = grammarURI fragment = grammarAccess.GrammarAccessFragment auto-inject {} fragment = .... } } |
This sets up some properties and then lists fragments in language property.
When InvokeInternal is called in Generator then the main packages are defined in OutputImpl and registered. |
There is a 'Generator' component for xtext here.
Fragments
These are defined in xtext rather than the mwe structure. Here are some examples of fragments.
Example - Antlr
The mwe2 file contains the following:
// The antlr parser generator fragment. fragment = parser.antlr.XtextAntlrGeneratorFragment { antlrParam = "-Xconversiontimeout" antlrParam = "10000" } // generates a more lightweight Antlr parser and lexer tailored for content assist fragment = parser.antlr.XtextAntlrUiGeneratorFragment auto-inject { antlrParam = "-Xconversiontimeout" antlrParam = "10000" }
These fragments are defined here: