{"repo":"comby-tools/comby","free":true,"listed":false,"github":"https://github.com/comby-tools/comby","clone":"git clone https://github.com/comby-tools/comby.git","description":"A code rewrite tool for structural search and replace that supports ~every language.","language":"OCaml","stars":2670,"topics":["program-transformation","search-and-replace","linting","refactoring","syntax-transformation","parsing","parser-combinators","rewriting","syntax","regex"],"license":"Apache-2.0","category":"deployment-docker-iac","readme_excerpt":"comby See the usage documentation. A short example below shows how comby simplifies matching and rewriting compared to regex approaches like sed . Comby supports interactive review mode (click here to see it in action). Install (pre-built binaries) Mac OS X - brew install comby Ubuntu Linux - bash click to expand an example invocation for the docker image Running with docker on stdin : Or try it live. Isn't a regex approach like sed good enough? Sometimes, yes. But often, small changes and refactorings are complicated by nested expressions, comments, or strings. Consider the following C-like snippet. Say the challenge is to rewrite the two if conditions to the value 1 . Can you write a regular expression that matches the contents of the two if condition expressions, and only those two? Feel free to share your pattern with @rvtond on Twitter. To match these with comby, all you need to write is if (:[condition]) , and specify one flag that this language is C-like. The replacement is if (1) . See the live example. Build from source - Install opam. TL;DR do sh <(curl -sL https://raw.githubusercontent.com/ocaml/opam/master/shell/install.sh) - Run this if you don't have an OCaml 5 switch installed (it bootstraps the OCaml compiler): - Run eval $(opam env) - Install OS dependencies: - Linux: sudo apt-get install autoconf libpcre3-dev pkg-config zlib1g-dev m4 libgmp-dev libev4 libsqlite3-dev - Mac: brew install pkg-config gmp pcre libev - Then install the library dependencies: - Buil","default_branch":null,"files":null,"tree":[],"storefront":"/r/comby-tools","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/comby-tools/comby/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}