package ppxlib

  1. Overview
  2. Docs
Standard infrastructure for ppx rewriters

Install

Dune Dependency

Authors

Maintainers

Sources

ppxlib-0.36.0.tbz
sha256=5aba1bce14c53108614130110c843d004bf93bd2cf3a0778fd7086b85390a434
sha512=1e3e8fee42fe74bffc178dbcbb2db8ec38dd23e71f6fed3c4c92618cf93892f5847787e6e9abb322f5c85d29a76afde28ce840b42e10fedc14cd82ba578ad06a

doc/ppxlib/Ppxlib/Expansion_context/Deriver/index.html

Module Expansion_context.DeriverSource

Sourcetype t

Type of expansion contexts for derivers

Sourceval derived_item_loc : t -> Location.t

Return the location of the item to which the deriver is being applied

Sourceval code_path : t -> Code_path.t

Return the code path for the given context In Driver, Deriving and Extension, the context is initialized so that the file_path component of the code_path is determined from the first location found in the input AST. That means that:

  • It's the empty string in empty structures or signatures
  • It can be altered by line directives
Sourceval input_name : t -> string

Return the input name for the given context. In Driver, Deriving and Extension, the context argument is initialized so that the input_name matches the input filename passed to the driver on the command line. That means that:

  • It has a value even for empty files
  • It is not affected by line directives
  • It is "_none_" when using Driver.map_structure or Driver.map_signature
Sourceval tool_name : t -> string

Can be used within a ppx preprocessor to know which tool is calling it "ocamlc", "ocamlopt", "ocamldep", "ocaml", ... .

Sourceval with_loc_and_path : (loc:Location.t -> path:string -> 'a) -> ctxt:t -> 'a

Wrap a fun ~loc ~path into a fun ~ctxt

Sourceval inline : t -> bool

Whether the derived code is going to be inlined in the source

OCaml

Innovation. Community. Security.