Module Ppxlib.ExtensionSource
Declare extenders to rewrite extension nodes.
type (_, _) equality = | Eq : ('a, 'a) Ppxlib.Extension.equality| Ne : (_, _) Ppxlib.Extension.equality
Type of declared extensions.
val declare :
string ->
'context Ppxlib.Extension.Context.t ->
(Astlib.Ast_502.Parsetree.payload, 'a, 'context) Ppxlib.Ast_pattern.t ->
(loc:Ppxlib.Location.t -> path:string -> 'a) ->
Ppxlib.Extension.tdeclare name context pattern expander declares the extension names name for context.
expander is responsible for producing the code to replace the extension in the AST. It receives as argument:
loc: the location of the enclosing node. For instance for expression it is thepexp_locfieldpath: the current module path
val declare_with_path_arg :
string ->
'context Ppxlib.Extension.Context.t ->
(Astlib.Ast_502.Parsetree.payload, 'a, 'context) Ppxlib.Ast_pattern.t ->
(loc:Ppxlib.Location.t ->
path:string ->
arg:Ppxlib.Longident.t Ppxlib_ast.Asttypes.loc option ->
'a) ->
Ppxlib.Extension.tSame as declare except that the extension name takes an additional path argument. The path is the part of the name that start with a capitalized component. For instance in the following, the extension "map" would receive the path argument Foo.Bar:
let%map.Foo.Bar x = 1 in
...val declare_inline :
string ->
'context Ppxlib.Extension.Context.t ->
(Astlib.Ast_502.Parsetree.payload, 'a, 'context list) Ppxlib.Ast_pattern.t ->
(loc:Ppxlib.Location.t -> path:string -> 'a) ->
Ppxlib.Extension.tInline the result of the expansion into its parent. Only works for these contexts:
class_fieldclass_type_fieldsignature_itemstructure_item
val declare_inline_with_path_arg :
string ->
'context Ppxlib.Extension.Context.t ->
(Astlib.Ast_502.Parsetree.payload, 'a, 'context list) Ppxlib.Ast_pattern.t ->
(loc:Ppxlib.Location.t ->
path:string ->
arg:Ppxlib.Longident.t Ppxlib_ast.Asttypes.loc option ->
'a) ->
Ppxlib.Extension.tThis module is used to implement Context_free.map_top_down
val filter_by_context :
'a Ppxlib.Extension.Context.t ->
Ppxlib.Extension.t list ->
'a Ppxlib.Extension.For_context.t listGiven a context and a list of extension expander, returns all the ones that are for this context.
This module allows to declare extensions that do not produce a value of the context type. This is typically useful for extensions point that depends on more things from the context than the path and location.
val collect_unhandled_extension_errors :
Ppxlib.Location.Error.t list Ppxlib.Ast_traverse.fold