package dunolint
Install
dune-project
Dependency
Authors
Maintainers
Sources
sha256=1b064927c9e1ef5352a1886ae34a206fef0ce6a913c19a77b0162acc108e0e50
sha512=6cbc08ba318bef6584d15a4491e3dde1bf436109ce0f8b7c400a9f91bbcee64c5785bc924df11eafe98243ec2f188a7f92c58c5062729f3e2af1e9977f1a5e67
doc/dunolint.dunolinter/Dunolinter/Sexp_handler/Make_sexpable_list/index.html
Module Sexp_handler.Make_sexpable_list
Source
A util to create a handler for multiple args with the same sexpable type. The handler will expect a list of arguments, which will each be parsed and written (or replaced) according to the sexp serializer provided.
Parameters
module _ : sig ... end
module M : Base.Sexpable.S
Signature
t
is type OCaml representation of what the field encodes. It does not need to encapsulate the complete information that code be represented by dune, only that part that dunolint wants to lint.
If the stanza already exists, parse the value currently present. The sexps_rewriter
is given in order to find locations of the supplied sexp to supply to the error messages. Errors are raised if the arguments do not have the expected shape for that field.
Write as a new field. This is used to create the field the first time it is introduced in a stanza, such as when a new dune file is created by dunolint.
When the field is already present, it may be necessary to merge the existing values with the expected one. In this case we do not write the field from scratch, instead we refactor it using a rewrite. The field
sexp is expected to be taken from the sexps_rewriter
and must be the original sexp that represent the entire field.
If the stanza already exists, all we do is some linting, that is we update it if needed, and perhaps generating some errors or warnings along the way. To be called with the sexps that follow the "(library)" atom, which are labeled "fields".
This has the effect of side-effecting the File_rewriter
that is contained by the sexps_rewriter
parameter. For this call to be useful, it is assumed that the caller is going to output the resulting rewrite, and do something with it. The field
sexp is expected to be taken from the sexps_rewriter
and must be the original sexp that represent the entire field.