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
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
Specs
apply_macro(file :: LogicalFile.t(), options :: list()) :: LogicalFile.t()
perform macro behaviour on a LogicalFile
Specs
generate macro invocation
Link to this section Functions
apply_macros/2
takes a LogicalFile
and a list of macro invocations
and applies each macro to transform the LogicalFile
.