decorator

Decorator-style macros.

exception macro_polo.macros.decorator.DecoratorMacroError

Error during invocation of decorator-style macros.

__init__(name, parameters, msg)

Create a new DecoratorStyleMacroError.

Parameters:
class macro_polo.macros.decorator.DecoratorMacroInvokerMacro

A macro that processes decorator-style macro invocations.

The syntax for invoking a decorator-style macro is @![name(parameters)] or @![name] (equivalent to @![name()]).

Decorator-style macro invocations must immediately precede a “block”, defined as either a single newline-terminated line, or a line followed by an indented block.

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

  1. parameters (as a token sequence)

  2. the block immediately following the invocation (as a token sequence).

When multiple decorator-style macros are stacked, they are invoked from bottom to top.

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 decorator macros.

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

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