Skip to main content

Module macros

Module macros 

Source
Expand description

Macro authoring and expansion: the LispMacro contract, macro objects, the registry-backed expander, and shape constructors for macro syntax.

Structs§

MacroCx
Expansion context passed to macros: the evaluation context, current phase, environment, expansion budget, and the active macro stack.
MacroExpansionLimits
Bounds that stop runaway macro expansion.
MacroObject
Runtime object wrapping a macro and whether its parser output is trusted.
NativeExprMacro
Macro implemented by a native Rust expansion function.
RegistryMacroExpander
Macro expander that resolves macros through the context registry, bounded by configurable expansion limits.
SourceTemplateMacro
Macro defined in source by a template expression instantiated from captures.

Traits§

LispMacro
Contract for an expandable macro: its name, its syntax shape, and the expansion that rewrites a matched form into a new expression.

Functions§

expand_expr
Fully expands macros in an expression within a macro context.
list_macro_shape
Builds a list shape with a fixed head symbol followed by the given tail.
list_macro_shape_with_rest
Builds a list shape with a fixed head and tail plus a trailing rest shape.
literal_head_shape
Builds a shape matching an exact head symbol, for macro syntax.
macro_value
Boxes a macro into a value, trusting its parser output.
macro_value_with_parser_trust
Boxes a macro into a value with an explicit parser-trust flag.
macroexpand_function
Builds the macroexpand function object that expands a quoted expression.
positional_macro_shape
Builds a macro syntax shape that captures named positional parameters and an optional rest parameter after the head symbol.
register_macro
Registers a macro in the context, trusting its parser, and returns its id.
register_macro_with_parser_trust
Registers a macro with an explicit parser-trust flag and returns its id.

Type Aliases§

NativeMacroImpl
Signature of a native macro expansion function.