Comby

A code rewrite tool for structural search and replace that supports ~every language.
Alternatives To Comby
Project NameStarsDownloadsRepos Using ThisPackages Using ThisMost Recent CommitTotal ReleasesLatest ReleaseOpen IssuesLicenseLanguage
Sh6,31621616 days ago157June 18, 202396bsd-3-clauseGo
A shell parser, formatter, and interpreter with bash support; includes shfmt
Comby1,996
9 months ago62apache-2.0OCaml
A code rewrite tool for structural search and replace that supports ~every language.
Core1,464221 hours ago6January 30, 201585mitTypeScript
Open source Dota 2 data platform
Typescript Eslint Parser9196,9231,9995 years ago49January 18, 2019otherJavaScript
An ESLint custom parser which leverages TypeScript ESTree to allow for ESLint to lint TypeScript source code.
Mail Parser3111420a year ago84February 26, 202116apache-2.0Python
Tokenizer for raw mails
Spacy Api Docker246
a year ago23mitPython
spaCy REST API, wrapped in a Docker container.
Rats241
a month ago44agpl-3.0HTML
Movie Ratings Synchronization with Python
Goose Parser222165 years ago87April 17, 20193mitJavaScript
Universal scraping tool, which allows you to extract data using multiple environments
Black Widow168
a year ago13June 17, 20222gpl-3.0Python
GUI based offensive penetration testing tool (Open Source)
Csharp Datatables Parser120
2 years ago9April 04, 2016C#
C# Serverside parser for the popuplar jQuery datatables plugin.
Alternatives To Comby
Select To Compare


Alternative Project Comparisons
Readme

comby

Apache-2.0 Build Status codecov Downloads Commit Gitter

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).

Need help writing patterns or have other problems? Post them in Gitter.

Install (pre-built binaries)

Mac OS X

  • brew install comby

Ubuntu Linux

  • bash <(curl -sL get-comby.netlify.app)

  • Other Linux distributions: The PCRE library is dynamically linked in the Ubuntu binary. For other distributions like Arch Linux, a fixup is needed: sudo ln -s /usr/lib/libpcre.so /usr/lib/libpcre.so.3. On Fedora, use sudo ln -s /usr/lib64/libpcre.so /usr/lib64/libpcre.so.3. Alternatively, consider building from source.

Windows

Docker

  • docker pull comby/comby
click to expand an example invocation for the docker image

Running with docker on stdin:

docker run -a stdin -a stdout -a stderr -i comby/comby '(:[emoji] hi)' 'bye :[emoji]' lisp -stdin <<< '(👋 hi)'

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.

if (fgets(line, 128, file_pointer) == Null) // 1) if (...) returns 0
      return 0;
...
if (scanf("%d) %d", &x, &y) == 2) // 2) if (scanf("%d) %d", &x, &y) == 2) returns 0
      return 0;

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 OCaml installed (it bootstraps the OCaml compiler):

opam init
opam switch create 4.11.0 4.11.0
  • 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:

git clone https://github.com/comby-tools/comby
cd comby 
opam install . --deps-only
  • Build and test
make
make test
  • Install comby on your PATH by running
make install
Popular Docker Projects
Popular Parser Projects
Popular Virtualization Categories
Related Searches

Get A Weekly Email With Trending Projects For These Categories
No Spam. Unsubscribe easily at any time.
Javascript
Python
Java
Typescript
Php
C
Go
Docker
Rust
Swift
Parsing
Linting
Regex
Ocaml
Refactoring
Reason
Parser Combinators