### Install Comby with Opam Source: https://github.com/comby-tools/comby/blob/master/README.md Commands to install Comby from source using opam, including setting up an OCaml switch and installing dependencies. ```bash opam init opam switch create 5.1.0 5.1.0 ``` ```bash eval $(opam env) ``` ```bash git clone https://github.com/comby-tools/comby cd comby opam install . --deps-only ``` ```bash make make test ``` ```bash make install ``` -------------------------------- ### Install Comby OS Dependencies (Linux) Source: https://github.com/comby-tools/comby/blob/master/README.md Installs necessary OS-level dependencies for building Comby on Linux. ```bash sudo apt-get install autoconf libpcre3-dev pkg-config zlib1g-dev m4 libgmp-dev libev4 libsqlite3-dev ``` -------------------------------- ### Run Comby Docker Image Source: https://github.com/comby-tools/comby/blob/master/README.md Example of running the Comby Docker image to perform a pattern match and rewrite on stdin. ```bash docker run -a stdin -a stdout -a stderr -i comby/comby '(:[emoji] hi)' 'bye :[emoji]' lisp -stdin <<< '(👋 hi)' ``` -------------------------------- ### Install Comby OS Dependencies (Mac) Source: https://github.com/comby-tools/comby/blob/master/README.md Installs necessary OS-level dependencies for building Comby on macOS. ```bash brew install pkg-config gmp pcre libev ``` -------------------------------- ### Query Hover Information via GraphQL Source: https://github.com/comby-tools/comby/blob/master/lib/semantic/README.md Use this GraphQL query to get hover information for a specific code location. Ensure you provide the correct repository, commit, path, line, and character. ```bash curl 'https://sourcegraph.com/.api/graphql' \ --data-raw $'{"query":"query Hover($repository: String\u0021, $commit: String\u0021, $path: String\u0021, $line: Int\u0021, $character: Int\u0021) {\n repository(name: $repository) {\n commit(rev: $commit) {\n blob(path: $path) {\n lsif {\n hover(line: $line, character: $character) {\n markdown {\n text\n }\n range {\n start {\n line\n character\n }\n end {\n line\n character\n }\n }\n }\n }\n }\n }\n }\n}","variables":{"line":10,"character":30,"commit":"HEAD","path":"lib/codeintel/semantic/hash.go","repository":"github.com/sourcegraph/sourcegraph"},"operationName":"Hover"}' \ --compressed ``` -------------------------------- ### Comby C-like Code Rewrite Source: https://github.com/comby-tools/comby/blob/master/README.md Demonstrates Comby's ability to match and rewrite specific parts of C-like code, simplifying complex conditions. ```c 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; ``` -------------------------------- ### Add file_names argument to Compare_core.diff_strings Source: https://github.com/comby-tools/comby/blob/master/lib/app/vendored/patdiff/CHANGES.md The `Compare_core.diff_strings` function now accepts an optional `?file_names` argument. ```ocaml add a `?file_names` argument to `Compare_core.diff_strings` ``` -------------------------------- ### Full split with Pcre.full_split in patdiff_core.ml Source: https://github.com/comby-tools/comby/blob/master/lib/app/vendored/patdiff/CHANGES.md When using `Pcre.full_split` in `patdiff_core.ml` with `pcre-ocaml` version 7.1.3 or later, pass `~max:(-1)` to maintain behavior consistent with earlier versions due to a bug fix in the `pcre-ocaml` library. ```ocaml Pcre.full_split in patdiff_core.ml rely on a bug of pcre-ocaml <= 7.1.2. To get the same behavior with pcre-ocaml >= 7.1.3 we need to pass ~max:(-1). ``` -------------------------------- ### Comby Pattern for C-like Code Source: https://github.com/comby-tools/comby/blob/master/README.md Shows the Comby pattern to match the condition within C-like if statements. ```comby if (:[condition]) ``` -------------------------------- ### Automatic Git Commit Signing Source: https://github.com/comby-tools/comby/blob/master/lib/app/vendored/patdiff/CONTRIBUTING.md This command automatically signs your Git commits if your 'user.name' and 'user.email' Git configurations are set. This simplifies the contribution process by ensuring the 'Signed-off-by' line is added automatically. ```git git commit -s ``` -------------------------------- ### Git Commit Signing Source: https://github.com/comby-tools/comby/blob/master/lib/app/vendored/patdiff/CONTRIBUTING.md This is the standard format for the 'Signed-off-by' line in a Git commit message. It is required for all contributions to the Comby project. ```git Signed-off-by: Joe Smith ``` -------------------------------- ### Comby Replacement for C-like Code Source: https://github.com/comby-tools/comby/blob/master/README.md Specifies the replacement string for the Comby pattern, changing the condition to a constant value. ```comby if (1) ``` -------------------------------- ### Iterate over diff hunks and lines with iter_ansi Source: https://github.com/comby-tools/comby/blob/master/lib/app/vendored/patdiff/CHANGES.md Use `iter_ansi` to iterate along the lines of a diff and the breaks between hunks. This function offers more flexibility for processing diff content. ```ocaml val iter_ansi : f_hunk_break:((int*int) -> (int*int) -> unit) -> f_line:(string -> unit) -> string Patience_diff.Hunk.t list -> unit ``` -------------------------------- ### Developer Certificate of Origin Source: https://github.com/comby-tools/comby/blob/master/lib/app/vendored/patdiff/CONTRIBUTING.md This is the standard text for the Developer Certificate of Origin (DCO) that contributors must agree to. It certifies that the contribution is original or has the right to be submitted under the project's license. ```text Developer Certificate of Origin Version 1.1 Copyright (C) 2004, 2006 The Linux Foundation and its contributors. 1 Letterman Drive Suite D4700 San Francisco, CA, 94129 Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Developer's Certificate of Origin 1.1 By making a contribution to this project, I certify that: (a) The contribution was created in whole or in part by me and I have the right to submit it under the open source license indicated in the file; or (b) The contribution is based upon previous work that, to the best of my knowledge, is covered under an appropriate open source license and I have the right under that license to submit that work with modifications, whether created in whole or in part by me, under the same open source license (unless I am permitted to submit under a different license), as indicated in the file; or (c) The contribution was provided directly to me by some other person who certified (a), (b) or (c) and I have not modified it. (d) I understand and agree that this project and the contribution are public and that a record of the contribution (including all personal information I submit with it, including my sign-off) is maintained indefinitely and may be redistributed consistent with this project or the open source license(s) involved. ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.