Previous Up Next

3  Metavariables for scripts

Metavariables for scripts can only be inherited from transformation rules. In the spirit of scripting languages such as Python that use dynamic typing, metavariables for scripts do not include type declarations.

script_metavariables   ::=  @ script:language [depends on dep] @ script_metadecl * @@
|@ initialize:language @
|@ finalize:language @
language   ::=  python
script_metadecl   ::=  id << rulename_id.id ;

Currently, the only scripting language that is supported is Python. The set of available scripting languages may be extended at some point.

Script rules declared with initialize are run before the treatment of any file. Script rules declared with finalize are run when the treatment of all of the files has completed. There can be at most one of each per scripting language (thus currently at most one of each). Initialize and finalize script rules do not have access to SmPL metavariables. Nevertheless, a finalize script rule can access any variables initialized by the other script rules, allowing information to be transmitted from the matching process to the finalize rule.


Previous Up Next