The Generator Module

class smacha.generator.Generator(parser, templater, verbose=False, base_vars=['name', 'manifest', 'function_name', 'node_name', 'outcomes', 'userdata'], container_persistent_vars=['params'], sub_script_persistent_vars=['userdata', 'remapping', 'transitions'], buffer_names=['base_header', 'imports', 'defs', 'class_defs', 'cb_defs', 'main_def', 'header', 'header_userdata', 'body', 'footer', 'execute', 'base_footer', 'main'], buffer_types=['list', 'list', 'list', 'list', 'list', 'list', 'dict', 'dict', 'list', 'list', 'list', 'list', 'list'], container_insertion_order=['prepend', 'prepend', 'prepend', 'prepend', 'prepend', 'prepend', 'prepend', 'prepend', 'append', 'append', 'append', 'append', 'append'], buffer_insertion_order=['append', 'append', 'append', 'append', 'append', 'append', 'append', 'append', 'append', 'prepend', 'prepend', 'prepend', 'prepend'], local_var_lists=['local_vars'])[source]

Main SMACHA code generator class.

This class recursively processes the state machines described in SMACHA YAML scripts while generating executable code by rendering from templates that they reference.


Generate SMACH code from a parsed SMACHA yaml script.

Parameters:script (dict or ruamel.yaml.comments.CommentedMap) – The parsed YAML script.
Returns:The generated code.
Return type:str