6.2.1 Report header and end
The generator definition always starts with a header (except
for MERL snippets used in symbols, identifier generators etc.). There are two
alternative syntaxes for the header:
report 'reportName'
and
reportName()
Generators written prior to MetaEdit+
5.0 always use the version with keyword
report whereas the generators in 5.0
and later may use either version.
When using the shorter version of the header without the
keyword, it is also possible to define a parameter
list
for the arguments to be
passed into the generator when it is called:
reportName(@arg1, @arg2)
The arguments from the
caller are passed by value. The parameters will behave like local variables
within the generator. For more information about variables, see Section
6.5, and for calling subgenerators, see
Section
6.3.12.
If a generator uses the
report keyword in its header, the
definition must be terminated with the keyword
endreport
For brevity’s sake, the report
header and end is not present in the generators used in metamodeling tools for
identifier generators, and in the Symbol Editor for text element contents and
conditions.
Generator names and prefixes
The prefix of a generator name can be used to affect the user
interface shown to a modeler:
| If
the name begins with an underscore, ‘_’, the
generator is not shown in the list of generators the modeler can run. This is
useful for hiding subgenerators from modelers.
|
| If
the name begins with a double underscore ‘__’, it is not shown to
modelers or as a subgenerator in the hierarchical view of the Generator Editor.
This is useful for ‘utility’ subgenerators that are called from
almost all generators, and which might otherwise clutter up the hierarchical
view for the metamodeler. Rather than showing these subgenerators many times
throughout the hierarchy, they are shown once at the top level of the
hierarchy. |
| If
the name begins with an exclamation mark,
‘!’, the generator is added as a button on the action toolbar of the
Diagram Editor and other editors. The button shows the name without the
exclamation mark; since there is limited space in a button, such names should be
limited to a few letters (or then an icon can be defined for this generator).
These generators are also not shown in the list of generators the modeler can
run. Usually, such a generator simply calls a normal generator that will be
visible in that list. |
Similarly, there are
some reserved names for generators:
| ‘_imagemap_href’
is called to generate the href="..."
hyperlink for an element in an HTML image map automatically output by the
filename...print command (see Section 6.4.6). |
| ‘__LiveCheck’
(with two ‘_’ as prefix) will display its results in the Live Check
pane at the bottom of the Diagram
Editor. |