package ppxlib
Install
dune-project
Dependency
Authors
Maintainers
Sources
sha256=d0e8a1ebdc6220b1574d7a926f008460c5118ccef79bf9a0ce0242f34cff225a
sha512=6010a59be6af873eaf193670f9cc8c9a7f091cfd89ec6c5b68d1f0c72d7c6015eec6371c009fc473cf2cb37d24f0934d04d0eacefa567a4945234197c3b31741
doc/ppxlib/Ppxlib/Extension/index.html
Module Ppxlib.Extension
module Context : sig ... endval declare :
string ->
'context Context.t ->
(Migrate_parsetree.Ast_412.Parsetree.payload, 'a, 'context) Ast_pattern.t ->
(loc:Location.t -> path:string -> 'a) ->
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 Context.t ->
(Migrate_parsetree.Ast_412.Parsetree.payload, 'a, 'context) Ast_pattern.t ->
(loc:Location.t ->
path:string ->
arg:Longident.t Ppxlib__.Import.Asttypes.loc option ->
'a) ->
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 Context.t ->
(Migrate_parsetree.Ast_412.Parsetree.payload, 'a, 'context list)
Ast_pattern.t ->
(loc:Location.t -> path:string -> 'a) ->
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 Context.t ->
(Migrate_parsetree.Ast_412.Parsetree.payload, 'a, 'context list)
Ast_pattern.t ->
(loc:Location.t ->
path:string ->
arg:Longident.t Ppxlib__.Import.Asttypes.loc option ->
'a) ->
tmodule For_context : sig ... endThis module is used to implement Context_free.V1.map_top_down
val filter_by_context : 'a Context.t -> t list -> 'a For_context.t listGiven a context and a list of extension expander, returns all the ones that are for this context.
module Expert : sig ... endThis 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 check_unused : Ast_traverse.itermodule V2 : sig ... endmodule V3 : sig ... end