module

Module-level macros.

exception macro_polo.macros.module.ModuleMacroError

Errors during invocation of module-level macros.

__init__(name, parameters, msg)

Create a new ModuleMacroError.

Parameters:
class macro_polo.macros.module.ModuleMacroInvokerMacro

A macro that processes module-level macro invocations.

The syntax for invoking a module-level macro is ![name(parameters)] or ![name] (equivalent to ![name()]).

Module-level macro invocations must come before all other code (with the exception of a docstring), and must each appear on their own line.

When invoked, the registered macro is called with two arguments:

  1. parameters (as a token sequence)

  2. the remainder of the module starting from the line immediately following the

    invocation (as a token sequence).

Macros are defined by macros (which can be updated after this class is instantiated).

__init__(macros=<factory>)
Parameters:

macros (Mapping[str, ParameterizedMacro])

Return type:

None

macros: Mapping[str, ParameterizedMacro]

A mapping of names to module macros.

When a module macro is invoked, its name is looked up here.

This mapping may be shared with other macros, such as a ImporterMacro.