Generator¶
Some of the language described on this page make working with the generator easier or fix shortcomings of the generator. Generators and generator plans are not made to be extensible, so fixing issues is difficult. Sometimes other workarounds can be found and will me mentioned in this documentation if they are known.
Generator Facade¶
com.mbeddr.mpsutil.generatorfacade
This language contains a class GeneratorFacade ⧉ that helps with running the generator. It includes a method
runGenerator
with different signatures that can run the generator with a specific generation plan for a defined model
with a custom handler for generator messages and custom generation parameters such as save transient models (default: false) or
generate in parallel (default: yes, four threads).
GenUtil¶
com.mbeddr.mpsutil.genutil
This language helps with managing user objects and creating temporary nodes for them:
This expression creates a new node and assigns Base Language expressions to keys of it. The keys are set internally with the setref statement, which takes a key, a context node (here: the newly created node), and a target expression, creating a new user object for this node. For typical values, setref and getref should be used to set and retrieve values from the user object. For int values, use setint and getint.
Mapping Labels¶
com.mbeddr.mpsutil.mappingLabels
This language provides intentions for automatically creating mapping labels. One of the use cases is to migrate reference macros ⧉ that use strings to identify target nodes to resolve the target by mapping labels instead.
postprocessGeneratedFiles¶
com.mbeddr.mpsutil.postprocessGeneratedFiles
Add a new node generated files postprocessor facet to the plugin aspect of a language to declare a new facet executed after files are generated (textGen). It supports post-processor functions with a node parameter and a path parameter containing the path of the generated file. This method can be, for example, used to copy the generated files to a different folder:
For simple duplicating the TextGen outcome, There's also the built-in JetBrains annotation CopyOutcome ⧉.
XModel Actions¶
com.mbeddr.mpsutil.xmodel.actions
This language adds actions for automatically deriving generation plans ⧉.
For a single or list of modules, there's the action Generation Plan for Languages
, which can be found in the context menu that
opens when you right-click the modules in the logical view. There's also an action Derive Generation Plan which derives
a generation plan for a model that you must select in a dialog that opens when executing this action. You can find it
in the same places as the text preview action (for example, in the context menu of models).