Module Macro.Hook


module Hook: sig .. end
Various callbacks for syntax extensions to cooperate nicely with macros. Hooks are run in the same order they were declared.

val define_params : (Macro.param list -> unit) -> unit
Register a hook to be run after the parameters of a macro have been read.
val define : (Macro.param list ->
Camlp4.PreCast.Syntax.Ast.expr -> Camlp4.PreCast.Syntax.Ast.expr) ->
unit
Register hook f to be run after the body of a macro has been read; f params boby returns the new body of the macro. If several hooks are registered, they are applied in the order of declaration (each receiving the body transformed by the previous one).
val macro_expansion : (Camlp4.PreCast.Syntax.Ast.expr -> Camlp4.PreCast.Syntax.Ast.expr) -> unit
At a macro call site, we substitute the macros parameters in the body e of the macro and then apply all functions registered with macro_expansion in the order they were given to obtain the final expression.