package sexps-rewriter
Install
Dune Dependency
Authors
Maintainers
Sources
sha256=bcc2177b21daf06d379806045cab266ef9017968645dd8fb445594222e0f1d07
sha512=e7c546d98d1b0da412d63366cce777cc50a24f89c60ce9af67bb6698e6c12a620480daaefb5e186d6d5daf6143ac2b65a6f26a8daea0588055cfcfef90c13401
doc/README.html
file-rewriter
File-rewriter is an OCaml library for applying small rewrites to tweak or refactor your files. It provides a convenient interface to apply surgical textual substitutions on the fly, while navigating the contents of a file through an abstract representation containing code locations.
Other libraries
The repository also contain sexps_rewriter
, a specialized version of the main library dedicated to rewriting sexp files.
Motivation
We created these libraries as part of an ongoing work to create linting and refactoring tools for the many dune
files found in big monorepos (see dunolint).
Acknowledgments
We've been inspired by this blog post.
In particular, we've reused the idea of registering substitutions while itering through the locations of an AST. While we didn't reuse any particular project or existing code for our libraries, we're thankful to Jeremie Dimino and Jane Street for the work and technics discussed in their blog post.