View Source LogicalFile.Macro behaviour (LogicalFile v1.0.4)

A Macro represents a LogicalFile transformation.

Each Macro is implemented by a module through the apply_macro callback with zero or more arguments in a keyword list.

A 'Macro invocation' is specified as a tuple in the form {module, [options keyword list]}. A macro is called through the apply_macro callback which takes a LogicalFile and returns a possibly transformed LogicalFile.

The macro processor applies macros in turn to a base LogicalFile and each macro is expected to return a valid LogicalFile.

Sample macro implementations are provided for handling file includes (LogicalFile.Macros.Include) and single-line comments (LogicalFile.Macros.LineComment).

Link to this section Summary

Callbacks

perform macro behaviour on a LogicalFile

generate macro invocation

Functions

apply_macros/2 takes a LogicalFile and a list of macro invocations and applies each macro to transform the LogicalFile.

Link to this section Callbacks

Link to this callback

apply_macro(file, options)

View Source

Specs

apply_macro(file :: LogicalFile.t(), options :: list()) :: LogicalFile.t()

perform macro behaviour on a LogicalFile

Specs

invocation(options :: list()) :: tuple()

generate macro invocation

Link to this section Functions

Link to this function

apply_macros(unprocessed_file, macro_list)

View Source

apply_macros/2 takes a LogicalFile and a list of macro invocations and applies each macro to transform the LogicalFile.