TextGen language aspect
Introduction
The TextGen language aspect defines a model to text transformation. It comes in handy each time you need to convert your models into the text form directly. The language contains constructs to print out text, transform nodes into text values and give the output some reasonable layout.
Operations
The append command performs the transformation and adds resulting text to the output. You can use found error command to report problems in the model. The with indent command demarcates blocks with increased indentation. Alternatively, the increase depth and decrease depth commands manipulate the current indentation depth without being limited to a block structure. The indent buffer command applies the current indentation (as specified by with ident or increase/decrease depth) for the current line.
Operation |
Arguments |
---|---|
append |
any number of:
|
found error |
error text |
decrease depth |
decrease indentation level from now onwards |
increase depth |
increase indentation level from now on |
indent buffer |
apply indentation to the current line |
with indent { <code> } |
increase indentation level for the <code> |
Examples
- Here is an example of the text gen component for the ForeachStatement (jetbrain.mps.baseLanguage).
- This is an artificial example of the text gen:
producing following code block containing a number of lines with indentation: