Like grep, but uses tree-sitter grammars to search

Overview

tree-grepper

Works like grep, but uses tree-sitter to search for structure instead of strings.

Installing

This isn't available packaged anywhere. That's fine, use nix:

nix-env -if https://github.com/BrianHicks/tree-grepper/archive/refs/heads/main.tar.gz

If you have a Rust toolchain set up, you can also clone this repo and run cargo build.

Usage

Use it like grep (or really, more like ack/ag/pt/rg.)

$ tree-grepper -q elm '(import_clause (import) (upper_case_qid)@name)'
./src/Main.elm:4:7:name:Browser
./src/Main.elm:6:7:name:Html
./src/Main.elm:8:7:name:Html.Events
...

By default, tree-grepper will output one match per (newline-delimited) line. The columns here are filename, row, column, match name, and match text.

Note, however, that if your query includes a match with newlines in the text they will be included in the output! If this causes problems for your use case, try asking for JSON output (-f json) instead.

tree-grepper uses Tree-sitter's s-expressions to find matches. See the tree-sitter docs on queries for what all you can do there.

We add one important thing on top of the standard query stuff (including #eq? and #match?): if you name a pattern starting with an underscore, it will not be returned in the output. This is primarily useful for filtering out matches you don't really care about. For example, to match JavaScript calls to require but not other functions, you could do this:

(call_expression (identifier)@_fn (arguments . (string)@import .) (#eq? @_fn require))

In addition to text output, we support JSON output for scripting: just specify -f json. You also get more info (the match's end location and node kind) by asking for JSON output. This is handy for discovery: if you want to see the node names for your target language, try something like tree-grepper -q rust '(_)' -f json, replacing rust with the language of your choice.

Supported Languages

  • Elm
  • Haskell
  • JavaScript
  • Ruby
  • Rust
  • TypeScript

... and your favorite? We're open to PRs for adding whatever language you'd like!

For development, there's a nix-shell setup that'll get you everything you need. Set up nix (just Nix, not NixOS) and then run nix-shell in the root of this repository.

After that, you just need to add a tree-sitter grammar to the project. The tree-sitter project keeps an up-to-date list, so you may not even need to write your own!

  1. Add your grammar as a subtree to this repo: git subtree add --squash --prefix vendor/tree-sitter-LANGUAGE https://github.com/ORG/tree-sitter-LANG BRANCH (where BRANCH is whatever main branch the project uses) Add the update command to script/update-subtrees.sh as well!
  2. Set up compilation in build.rs by following the pattern there.
  3. Set up a new target in src/language.rs by following the patterns there.
  4. Add a test like all_LANG in src/main.rs
  5. Try to run with insta: cargo insta test and then cargo insta review. If the output looks right, open a PR!

License

See LICENSE in the source.

Comments
  • Add Elixir

    Add Elixir

    Adds Elixir Tree-sitter grammar. AFAIK I've followed the steps correctly, but, I'm having some issues running the tests locally (an env issue, not with the project itself).

    Thank you as well for making this!

    opened by jesse-c 12
  • Bump clap from 3.0.0-beta.2 to 3.0.0-beta.4

    Bump clap from 3.0.0-beta.2 to 3.0.0-beta.4

    Bumps clap from 3.0.0-beta.2 to 3.0.0-beta.4.

    Changelog

    Sourced from clap's changelog.

    v3.0.0-beta.4 (2021-08-14)

    Minimum Required Rust

    • As of this release, clap requires rustc 1.54.0 or greater.

    BREAKING CHANGES

    Added unicode_help, env features.

    • Gated behind env:

      • Arg
        • Arg::env
        • Arg::env_os
        • Arg::hide_env_values
      • ArgSettings
        • ArgSettings::HideEnvValues
    • Removed Methods

      • Arg
        • Arg::settings in favor of Arg::setting(Setting1 | Setting2)
        • Arg::multiple in favour of Arg::multiple_values and Arg::multiple_occurrences
    • Renamed Settings

      • AppSettings::DisableHelpFlags => AppSettings::DisableHelpFlag
      • AppSettings::DisableVersion => AppSettings::DisableVersionFlag
      • AppSettings::VersionlessSubcommands => AppSettings::DisableVersionForSubcommands
    • Renamed Variants

      • ErrorKind
        • ErrorKind::MissingArgumentOrSubcommand => ErrorKind::DisplayHelpOnMissingArgumentOrSubcommand
    • Changed

      • AppSettings::StrictUtf8 is now default and it and AppSettings::AllowInvalidUtf8 are replaced by
        • AppSettings::AllowInvalidUtf8ForExternalSubcommands
          • This only applies to the subcommand args. Before we paniced if the subcommand itself was invalid but now we will report an error up to the user.
        • ArgSettings::AllowInvalidUtf8
      • Allowing empty values is the default again with ArgSettings::AllowEmptyValues changing to ArgSettings::ForbidEmptyValues
      • AppSettings::GlobalVersion renamed to AppSettings::PropagateVersion and it is not applied globally anymore
      • Arg::env, Arg::env_os, Arg::last, Arg::require_equals, Arg::allow_hyphen_values, Arg::hide_possible_values, Arg::hide_default_value, Arg::hide_env_values, Arg::case_insensitive and Arg::multiple_values does not set ArgSettings::TakesValue anymore
      • Arg::require_delimiter does not set ArgSettings::TakesValue and ArgSettings::UseValueDelimiter anymore
      • Arg::require_equals does not disallow empty values anymore
      • Arg::default_value_if, Arg::default_value_if_os, Arg::default_value_ifs, Arg::default_value_ifs_os now takes the default value parameter as an option
      • Arg::index, Arg::number_of_values, Arg::min_values, Arg::max_values now takes usize
      • Arg::value_delimiter now accepts char instead of &str
      • ArgMatches::is_present does not handle subcommand names anymore

    ... (truncated)

    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    dependencies rust 
    opened by dependabot[bot] 5
  • cargo build failing

    cargo build failing

    Disclaimer: not a rust user, so there could be an oversight on my side. But cargo build mostly worked for me in the past.

    Running cargo build leads to this error:

    warning: cc1: fatal error: vendor/tree-sitter-c/src/parser.c: No such file or directory
    warning: compilation terminated.
    
    ...
    
    error occurred: Command "cc" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-gdwarf-4" "-fno-omit-frame-pointer" "-m64" "-I" "vendor/tree-sitter-c/src" "-o" "<PATH_TO_REPO>/tree-grepper/target/debug/build/tree-grepper-1a9b91f5eb854a89/out/vendor/tree-sitter-c/src/parser.o" "-c" "vendor/tree-sitter-c/src/parser.c" with args "cc" did not execute successfully (status code exit status: 1).
    
    ➜  tree-grepper git:(main) cargo --version   
    cargo 1.66.0 (d65d197ad 2022-11-15)
    ➜  tree-grepper git:(main) rustc --version     
    rustc 1.66.0 (69f9c33d7 2022-12-12)
    

    I used the most recent version of the git repo (commit: cc93c0330be512860db7e23011093341fb61b2f6 -> "│ Merge pull request #228 from BrianHicks/dependabot/cargo/cc-1.0.78")

    opened by tmerse 4
  • Trying to add `tree-sitter/tree-sitter-c`

    Trying to add `tree-sitter/tree-sitter-c`

    I've tried to follow the instructions perfectly, but I've never used nix before this.

    I added the following stanza to flakes.nix:

      tree-sitter-c = {
          url = "github:tree-sitter/tree-sitter-c";
          flake = false;
        };
    

    and the following line to the updateVendor stanza:

    ln -s ${inputs.tree-sitter-c} vendor/tree-sitter-c
    

    then ran direnv reload. I don't see an operation happening that is fetching the git repo from github, so I feel like I'm missing something (perhaps obvious).

    The update-vendor script runs, but never finds a path in /nix/store that has tree-sitter-c so it cannot update the symlink to the vendor directory.

    I'm stuck here, and hoping a nudge in the right direction might help me progress.

    opened by peterjmorgan 4
  • Bump tree-sitter from 0.20.0 to 0.20.1

    Bump tree-sitter from 0.20.0 to 0.20.1

    Bumps tree-sitter from 0.20.0 to 0.20.1.

    Commits
    • 062421d 0.20.1
    • 42360fc Bump library versions to 0.20.1
    • 862fe9e Merge pull request #1496 from tree-sitter/query-randomized-tests
    • 26dac9b Fix query bugs revealed by randomized tests
    • fea3eca Improve query execution logging
    • 142f4b6 Rename Query::step_is_definite -> is_pattern_guaranteed_at_step
    • f69c486 Add a randomized test for query matching
    • 3ac53cb Add link to Lua bindings
    • a0c085b Return an error when trying to inline a token
    • 4e2e059 Ensure 'extra' bit is set correctly when reusing a node
    • Additional commits viewable in compare view

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.

    Dependabot will merge this PR once CI passes on it, as requested by @BrianHicks.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    dependencies rust 
    opened by dependabot[bot] 3
  • Bump anyhow from 1.0.44 to 1.0.45

    Bump anyhow from 1.0.44 to 1.0.45

    Bumps anyhow from 1.0.44 to 1.0.45.

    Release notes

    Sourced from anyhow's releases.

    1.0.45

    • Fix non-compilable macro expansion if downstream crate calls anyhow!, ensure!, or bail! with format args and is built with #![no_std] or #![no_implicit_prelude] (#177)
    Commits
    • 33ab02c Release 1.0.45
    • c50588f Merge pull request #177 from dtolnay/format
    • 95351e3 Refer to format macro by absolute path
    • 263257b Prevent missing rust-src from reinstalling a nightly without miri
    • 3acbb33 Disable backtrace build on 1.50
    • 4c386df Update ui test suite to nightly-2021-10-13
    • b5556c9 Merge pull request #173 from dtolnay/newadhoc
    • ce20d04 Replace macro-generated calls to new_adhoc with Error::msg public API
    • 74fd4a2 Merge pull request #170 from dtolnay/ensure
    • c904c82 Bypass anyhow_kind-based dispatch for ensure! with default msg
    • Additional commits viewable in compare view

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.

    Dependabot will merge this PR once CI passes on it, as requested by @BrianHicks.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    dependencies rust 
    opened by dependabot[bot] 3
  • [RFC] Switch flake repos to git-submodules

    [RFC] Switch flake repos to git-submodules

    I saw you moved tree-sitter modules from git-submodules to flakes. But this a little limits the appearance to build from a non-nix build system. Why did you drop support for git-submodules?

    opened by Mephistophiles 2
  • tests fail for 2.4.1 on aarch64-linux during nix build

    tests fail for 2.4.1 on aarch64-linux during nix build

    in particular, it fails during tests:all_elm due to snapshot diff in src/snapshots/tree_grepper__tests__all_elm.snap.

    tested on a couple aarch64-linux machines by cloning the repo and running nix build .; builds fine on both x86_64-linux and aarch64-darwin architectures.

    @nix { "action": "setPhase", "phase": "unpackPhase" }
    unpacking sources
    unpacking source archive /nix/store/m1lwymy7crix0yjpz1pvynwigpajpzqp-source
    source root is source
    @nix { "action": "setPhase", "phase": "patchPhase" }
    patching sources
    @nix { "action": "setPhase", "phase": "updateAutotoolsGnuConfigScriptsPhase" }
    updateAutotoolsGnuConfigScriptsPhase
    @nix { "action": "setPhase", "phase": "configurePhase" }
    configuring
    [naersk] cargo_version (read): 1.58.0
    [naersk] cargo_message_format (set): json-diagnostic-rendered-ansi
    [naersk] cargo_release: --release
    [naersk] cargo_options: 
    [naersk] cargo_build_options: $cargo_release -j "$NIX_BUILD_CORES" --message-format=$cargo_message_format
    [naersk] cargo_test_options: $cargo_release -j "$NIX_BUILD_CORES"
    [naersk] RUST_TEST_THREADS: 4
    [naersk] cargo_bins_jq_filter: select(.reason == "compiler-artifact" and .executable != null and .profile.test == false)
    [naersk] cargo_build_output_json (created): /build/tmp.2yA9wKmoml
    [naersk] crate_sources: /nix/store/ji1czlc3rn4dgaxk99a69v2iscrffr8j-crates-io
    [naersk] RUSTFLAGS: 
    [naersk] CARGO_BUILD_RUSTFLAGS: 
    [naersk] CARGO_BUILD_RUSTFLAGS (updated): --remap-path-prefix /nix/store/ji1czlc3rn4dgaxk99a69v2iscrffr8j-crates-io=/sources
    [naersk] pre-installing dep /nix/store/rx4y648b4czjl1w6iaqi83xk0s29iqrl-tree-grepper-deps-2.4.1
    @nix { "action": "setPhase", "phase": "vendorPhase" }
    vendorPhase
    + ln -s /nix/store/i3xpjija6www6nsh0slj345fknz0h1a3-source vendor/tree-sitter-cpp
    + ln -s /nix/store/pp7c5w2ax2yqq0s6js4acwcm0raznsqz-source vendor/tree-sitter-elixir
    + ln -s /nix/store/jikm0mn77ig4dmi6bqairj8b43sqrx38-source vendor/tree-sitter-elm
    + ln -s /nix/store/jjcxzwrrs6nb3zsgy9cym3p9d7s82n0h-source vendor/tree-sitter-haskell
    + ln -s /nix/store/pqybkdf41sw75sjn2m1lkk8iz7dak4sv-source vendor/tree-sitter-javascript
    + ln -s /nix/store/cq2yl1qxpvxrwnjcymnsyibr34h41qkw-source vendor/tree-sitter-php
    + ln -s /nix/store/3kmibk473zaj5cci6xml93zqxm39dnai-source vendor/tree-sitter-ruby
    + ln -s /nix/store/3r0bjffqcr7r2ys3q7bkc083wwfb33li-source vendor/tree-sitter-rust
    + ln -s /nix/store/xibxgnqcsasgvxbwxzz66yksp48j1h5c-source vendor/tree-sitter-typescript
    @nix { "action": "setPhase", "phase": "buildPhase" }
    building
    cargo build $cargo_release -j "$NIX_BUILD_CORES" --message-format=$cargo_message_format
       Compiling tree-grepper v2.4.1 (/build/source)
        Finished release [optimized] target(s) in 2m 23s
    @nix { "action": "setPhase", "phase": "checkPhase" }
    running tests
       Compiling tree-grepper v2.4.1 (/build/source)
    warning: In file included from /nix/store/ypwq2n4h5fik81hchgxn6bjpynyay4dm-glibc-2.33-108-dev/include/bits/libc-header-start.h:33,
    warning:                  from /nix/store/ypwq2n4h5fik81hchgxn6bjpynyay4dm-glibc-2.33-108-dev/include/stdint.h:26,
    warning:                  from /nix/store/qxxm10h05039397bm9syfjp3rx482ls8-gcc-9.3.0/lib/gcc/aarch64-unknown-linux-gnu/9.3.0/include/stdint.h:9,
    warning:                  from vendor/tree-sitter-cpp/src/tree_sitter/parser.h:9,
    warning:                  from vendor/tree-sitter-cpp/src/parser.c:1:
    warning: /nix/store/ypwq2n4h5fik81hchgxn6bjpynyay4dm-glibc-2.33-108-dev/include/features.h:397:4: warning: #warning _FORTIFY_SOURCE requires compiling with optimization (-O) [-Wcpp]
    warning:   397 | #  warning _FORTIFY_SOURCE requires compiling with optimization (-O)
    warning:       |    ^~~~~~~
    warning: In file included from /nix/store/ypwq2n4h5fik81hchgxn6bjpynyay4dm-glibc-2.33-108-dev/include/bits/libc-header-start.h:33,
    warning:                  from /nix/store/ypwq2n4h5fik81hchgxn6bjpynyay4dm-glibc-2.33-108-dev/include/stdint.h:26,
    warning:                  from /nix/store/qxxm10h05039397bm9syfjp3rx482ls8-gcc-9.3.0/lib/gcc/aarch64-unknown-linux-gnu/9.3.0/include/stdint.h:9,
    warning:                  from vendor/tree-sitter-cpp/src/tree_sitter/parser.h:9,
    warning:                  from vendor/tree-sitter-cpp/src/scanner.cc:1:
    warning: /nix/store/ypwq2n4h5fik81hchgxn6bjpynyay4dm-glibc-2.33-108-dev/include/features.h:397:4: warning: #warning _FORTIFY_SOURCE requires compiling with optimization (-O) [-Wcpp]
    warning:   397 | #  warning _FORTIFY_SOURCE requires compiling with optimization (-O)
    warning:       |    ^~~~~~~
    warning: In file included from /nix/store/ypwq2n4h5fik81hchgxn6bjpynyay4dm-glibc-2.33-108-dev/include/bits/libc-header-start.h:33,
    warning:                  from /nix/store/ypwq2n4h5fik81hchgxn6bjpynyay4dm-glibc-2.33-108-dev/include/stdint.h:26,
    warning:                  from /nix/store/qxxm10h05039397bm9syfjp3rx482ls8-gcc-9.3.0/lib/gcc/aarch64-unknown-linux-gnu/9.3.0/include/stdint.h:9,
    warning:                  from vendor/tree-sitter-elixir/src/tree_sitter/parser.h:9,
    warning:                  from vendor/tree-sitter-elixir/src/parser.c:1:
    warning: /nix/store/ypwq2n4h5fik81hchgxn6bjpynyay4dm-glibc-2.33-108-dev/include/features.h:397:4: warning: #warning _FORTIFY_SOURCE requires compiling with optimization (-O) [-Wcpp]
    warning:   397 | #  warning _FORTIFY_SOURCE requires compiling with optimization (-O)
    warning:       |    ^~~~~~~
    warning: In file included from /nix/store/ypwq2n4h5fik81hchgxn6bjpynyay4dm-glibc-2.33-108-dev/include/bits/libc-header-start.h:33,
    warning:                  from /nix/store/ypwq2n4h5fik81hchgxn6bjpynyay4dm-glibc-2.33-108-dev/include/stdint.h:26,
    warning:                  from /nix/store/qxxm10h05039397bm9syfjp3rx482ls8-gcc-9.3.0/lib/gcc/aarch64-unknown-linux-gnu/9.3.0/include/stdint.h:9,
    warning:                  from vendor/tree-sitter-elixir/src/tree_sitter/parser.h:9,
    warning:                  from vendor/tree-sitter-elixir/src/scanner.cc:1:
    warning: /nix/store/ypwq2n4h5fik81hchgxn6bjpynyay4dm-glibc-2.33-108-dev/include/features.h:397:4: warning: #warning _FORTIFY_SOURCE requires compiling with optimization (-O) [-Wcpp]
    warning:   397 | #  warning _FORTIFY_SOURCE requires compiling with optimization (-O)
    warning:       |    ^~~~~~~
    warning: In file included from /nix/store/ypwq2n4h5fik81hchgxn6bjpynyay4dm-glibc-2.33-108-dev/include/bits/libc-header-start.h:33,
    warning:                  from /nix/store/ypwq2n4h5fik81hchgxn6bjpynyay4dm-glibc-2.33-108-dev/include/stdint.h:26,
    warning:                  from /nix/store/qxxm10h05039397bm9syfjp3rx482ls8-gcc-9.3.0/lib/gcc/aarch64-unknown-linux-gnu/9.3.0/include/stdint.h:9,
    warning:                  from vendor/tree-sitter-elm/src/tree_sitter/parser.h:9,
    warning:                  from vendor/tree-sitter-elm/src/parser.c:1:
    warning: /nix/store/ypwq2n4h5fik81hchgxn6bjpynyay4dm-glibc-2.33-108-dev/include/features.h:397:4: warning: #warning _FORTIFY_SOURCE requires compiling with optimization (-O) [-Wcpp]
    warning:   397 | #  warning _FORTIFY_SOURCE requires compiling with optimization (-O)
    warning:       |    ^~~~~~~
    warning: In file included from /nix/store/ypwq2n4h5fik81hchgxn6bjpynyay4dm-glibc-2.33-108-dev/include/bits/libc-header-start.h:33,
    warning:                  from /nix/store/ypwq2n4h5fik81hchgxn6bjpynyay4dm-glibc-2.33-108-dev/include/stdint.h:26,
    warning:                  from /nix/store/qxxm10h05039397bm9syfjp3rx482ls8-gcc-9.3.0/lib/gcc/aarch64-unknown-linux-gnu/9.3.0/include/stdint.h:9,
    warning:                  from vendor/tree-sitter-elm/src/tree_sitter/parser.h:9,
    warning:                  from vendor/tree-sitter-elm/src/scanner.cc:1:
    warning: /nix/store/ypwq2n4h5fik81hchgxn6bjpynyay4dm-glibc-2.33-108-dev/include/features.h:397:4: warning: #warning _FORTIFY_SOURCE requires compiling with optimization (-O) [-Wcpp]
    warning:   397 | #  warning _FORTIFY_SOURCE requires compiling with optimization (-O)
    warning:       |    ^~~~~~~
    warning: In file included from /nix/store/ypwq2n4h5fik81hchgxn6bjpynyay4dm-glibc-2.33-108-dev/include/bits/libc-header-start.h:33,
    warning:                  from /nix/store/ypwq2n4h5fik81hchgxn6bjpynyay4dm-glibc-2.33-108-dev/include/stdint.h:26,
    warning:                  from /nix/store/qxxm10h05039397bm9syfjp3rx482ls8-gcc-9.3.0/lib/gcc/aarch64-unknown-linux-gnu/9.3.0/include/stdint.h:9,
    warning:                  from vendor/tree-sitter-haskell/src/tree_sitter/parser.h:9,
    warning:                  from vendor/tree-sitter-haskell/src/parser.c:1:
    warning: /nix/store/ypwq2n4h5fik81hchgxn6bjpynyay4dm-glibc-2.33-108-dev/include/features.h:397:4: warning: #warning _FORTIFY_SOURCE requires compiling with optimization (-O) [-Wcpp]
    warning:   397 | #  warning _FORTIFY_SOURCE requires compiling with optimization (-O)
    warning:       |    ^~~~~~~
    warning: In file included from /nix/store/ypwq2n4h5fik81hchgxn6bjpynyay4dm-glibc-2.33-108-dev/include/bits/libc-header-start.h:33,
    warning:                  from /nix/store/ypwq2n4h5fik81hchgxn6bjpynyay4dm-glibc-2.33-108-dev/include/stdint.h:26,
    warning:                  from /nix/store/qxxm10h05039397bm9syfjp3rx482ls8-gcc-9.3.0/lib/gcc/aarch64-unknown-linux-gnu/9.3.0/include/stdint.h:9,
    warning:                  from vendor/tree-sitter-haskell/src/tree_sitter/parser.h:9,
    warning:                  from vendor/tree-sitter-haskell/src/scanner.c:12:
    warning: /nix/store/ypwq2n4h5fik81hchgxn6bjpynyay4dm-glibc-2.33-108-dev/include/features.h:397:4: warning: #warning _FORTIFY_SOURCE requires compiling with optimization (-O) [-Wcpp]
    warning:   397 | #  warning _FORTIFY_SOURCE requires compiling with optimization (-O)
    warning:       |    ^~~~~~~
    warning: In file included from /nix/store/ypwq2n4h5fik81hchgxn6bjpynyay4dm-glibc-2.33-108-dev/include/bits/libc-header-start.h:33,
    warning:                  from /nix/store/ypwq2n4h5fik81hchgxn6bjpynyay4dm-glibc-2.33-108-dev/include/stdint.h:26,
    warning:                  from /nix/store/qxxm10h05039397bm9syfjp3rx482ls8-gcc-9.3.0/lib/gcc/aarch64-unknown-linux-gnu/9.3.0/include/stdint.h:9,
    warning:                  from vendor/tree-sitter-javascript/src/tree_sitter/parser.h:9,
    warning:                  from vendor/tree-sitter-javascript/src/parser.c:1:
    warning: /nix/store/ypwq2n4h5fik81hchgxn6bjpynyay4dm-glibc-2.33-108-dev/include/features.h:397:4: warning: #warning _FORTIFY_SOURCE requires compiling with optimization (-O) [-Wcpp]
    warning:   397 | #  warning _FORTIFY_SOURCE requires compiling with optimization (-O)
    warning:       |    ^~~~~~~
    warning: In file included from /nix/store/ypwq2n4h5fik81hchgxn6bjpynyay4dm-glibc-2.33-108-dev/include/bits/libc-header-start.h:33,
    warning:                  from /nix/store/ypwq2n4h5fik81hchgxn6bjpynyay4dm-glibc-2.33-108-dev/include/stdint.h:26,
    warning:                  from /nix/store/qxxm10h05039397bm9syfjp3rx482ls8-gcc-9.3.0/lib/gcc/aarch64-unknown-linux-gnu/9.3.0/include/stdint.h:9,
    warning:                  from vendor/tree-sitter-javascript/src/tree_sitter/parser.h:9,
    warning:                  from vendor/tree-sitter-javascript/src/scanner.c:1:
    warning: /nix/store/ypwq2n4h5fik81hchgxn6bjpynyay4dm-glibc-2.33-108-dev/include/features.h:397:4: warning: #warning _FORTIFY_SOURCE requires compiling with optimization (-O) [-Wcpp]
    warning:   397 | #  warning _FORTIFY_SOURCE requires compiling with optimization (-O)
    warning:       |    ^~~~~~~
    warning: In file included from /nix/store/ypwq2n4h5fik81hchgxn6bjpynyay4dm-glibc-2.33-108-dev/include/bits/libc-header-start.h:33,
    warning:                  from /nix/store/ypwq2n4h5fik81hchgxn6bjpynyay4dm-glibc-2.33-108-dev/include/stdint.h:26,
    warning:                  from /nix/store/qxxm10h05039397bm9syfjp3rx482ls8-gcc-9.3.0/lib/gcc/aarch64-unknown-linux-gnu/9.3.0/include/stdint.h:9,
    warning:                  from vendor/tree-sitter-php/src/tree_sitter/parser.h:9,
    warning:                  from vendor/tree-sitter-php/src/parser.c:1:
    warning: /nix/store/ypwq2n4h5fik81hchgxn6bjpynyay4dm-glibc-2.33-108-dev/include/features.h:397:4: warning: #warning _FORTIFY_SOURCE requires compiling with optimization (-O) [-Wcpp]
    warning:   397 | #  warning _FORTIFY_SOURCE requires compiling with optimization (-O)
    warning:       |    ^~~~~~~
    warning: In file included from /nix/store/ypwq2n4h5fik81hchgxn6bjpynyay4dm-glibc-2.33-108-dev/include/bits/libc-header-start.h:33,
    warning:                  from /nix/store/ypwq2n4h5fik81hchgxn6bjpynyay4dm-glibc-2.33-108-dev/include/stdint.h:26,
    warning:                  from /nix/store/qxxm10h05039397bm9syfjp3rx482ls8-gcc-9.3.0/lib/gcc/aarch64-unknown-linux-gnu/9.3.0/include/stdint.h:9,
    warning:                  from vendor/tree-sitter-php/src/tree_sitter/parser.h:9,
    warning:                  from vendor/tree-sitter-php/src/scanner.cc:1:
    warning: /nix/store/ypwq2n4h5fik81hchgxn6bjpynyay4dm-glibc-2.33-108-dev/include/features.h:397:4: warning: #warning _FORTIFY_SOURCE requires compiling with optimization (-O) [-Wcpp]
    warning:   397 | #  warning _FORTIFY_SOURCE requires compiling with optimization (-O)
    warning:       |    ^~~~~~~
    warning: In file included from /nix/store/ypwq2n4h5fik81hchgxn6bjpynyay4dm-glibc-2.33-108-dev/include/bits/libc-header-start.h:33,
    warning:                  from /nix/store/ypwq2n4h5fik81hchgxn6bjpynyay4dm-glibc-2.33-108-dev/include/stdint.h:26,
    warning:                  from /nix/store/qxxm10h05039397bm9syfjp3rx482ls8-gcc-9.3.0/lib/gcc/aarch64-unknown-linux-gnu/9.3.0/include/stdint.h:9,
    warning:                  from vendor/tree-sitter-ruby/src/tree_sitter/parser.h:9,
    warning:                  from vendor/tree-sitter-ruby/src/parser.c:1:
    warning: /nix/store/ypwq2n4h5fik81hchgxn6bjpynyay4dm-glibc-2.33-108-dev/include/features.h:397:4: warning: #warning _FORTIFY_SOURCE requires compiling with optimization (-O) [-Wcpp]
    warning:   397 | #  warning _FORTIFY_SOURCE requires compiling with optimization (-O)
    warning:       |    ^~~~~~~
    warning: In file included from /nix/store/ypwq2n4h5fik81hchgxn6bjpynyay4dm-glibc-2.33-108-dev/include/bits/libc-header-start.h:33,
    warning:                  from /nix/store/ypwq2n4h5fik81hchgxn6bjpynyay4dm-glibc-2.33-108-dev/include/stdint.h:26,
    warning:                  from /nix/store/qxxm10h05039397bm9syfjp3rx482ls8-gcc-9.3.0/lib/gcc/aarch64-unknown-linux-gnu/9.3.0/include/stdint.h:9,
    warning:                  from vendor/tree-sitter-ruby/src/tree_sitter/parser.h:9,
    warning:                  from vendor/tree-sitter-ruby/src/scanner.cc:1:
    warning: /nix/store/ypwq2n4h5fik81hchgxn6bjpynyay4dm-glibc-2.33-108-dev/include/features.h:397:4: warning: #warning _FORTIFY_SOURCE requires compiling with optimization (-O) [-Wcpp]
    warning:   397 | #  warning _FORTIFY_SOURCE requires compiling with optimization (-O)
    warning:       |    ^~~~~~~
    warning: In file included from /nix/store/ypwq2n4h5fik81hchgxn6bjpynyay4dm-glibc-2.33-108-dev/include/bits/libc-header-start.h:33,
    warning:                  from /nix/store/ypwq2n4h5fik81hchgxn6bjpynyay4dm-glibc-2.33-108-dev/include/stdint.h:26,
    warning:                  from /nix/store/qxxm10h05039397bm9syfjp3rx482ls8-gcc-9.3.0/lib/gcc/aarch64-unknown-linux-gnu/9.3.0/include/stdint.h:9,
    warning:                  from vendor/tree-sitter-rust/src/tree_sitter/parser.h:9,
    warning:                  from vendor/tree-sitter-rust/src/parser.c:1:
    warning: /nix/store/ypwq2n4h5fik81hchgxn6bjpynyay4dm-glibc-2.33-108-dev/include/features.h:397:4: warning: #warning _FORTIFY_SOURCE requires compiling with optimization (-O) [-Wcpp]
    warning:   397 | #  warning _FORTIFY_SOURCE requires compiling with optimization (-O)
    warning:       |    ^~~~~~~
    warning: In file included from /nix/store/ypwq2n4h5fik81hchgxn6bjpynyay4dm-glibc-2.33-108-dev/include/bits/libc-header-start.h:33,
    warning:                  from /nix/store/ypwq2n4h5fik81hchgxn6bjpynyay4dm-glibc-2.33-108-dev/include/stdint.h:26,
    warning:                  from /nix/store/qxxm10h05039397bm9syfjp3rx482ls8-gcc-9.3.0/lib/gcc/aarch64-unknown-linux-gnu/9.3.0/include/stdint.h:9,
    warning:                  from vendor/tree-sitter-rust/src/tree_sitter/parser.h:9,
    warning:                  from vendor/tree-sitter-rust/src/scanner.c:1:
    warning: /nix/store/ypwq2n4h5fik81hchgxn6bjpynyay4dm-glibc-2.33-108-dev/include/features.h:397:4: warning: #warning _FORTIFY_SOURCE requires compiling with optimization (-O) [-Wcpp]
    warning:   397 | #  warning _FORTIFY_SOURCE requires compiling with optimization (-O)
    warning:       |    ^~~~~~~
    warning: In file included from /nix/store/ypwq2n4h5fik81hchgxn6bjpynyay4dm-glibc-2.33-108-dev/include/bits/libc-header-start.h:33,
    warning:                  from /nix/store/ypwq2n4h5fik81hchgxn6bjpynyay4dm-glibc-2.33-108-dev/include/stdint.h:26,
    warning:                  from /nix/store/qxxm10h05039397bm9syfjp3rx482ls8-gcc-9.3.0/lib/gcc/aarch64-unknown-linux-gnu/9.3.0/include/stdint.h:9,
    warning:                  from vendor/tree-sitter-typescript/typescript/src/tree_sitter/parser.h:9,
    warning:                  from vendor/tree-sitter-typescript/typescript/src/parser.c:1:
    warning: /nix/store/ypwq2n4h5fik81hchgxn6bjpynyay4dm-glibc-2.33-108-dev/include/features.h:397:4: warning: #warning _FORTIFY_SOURCE requires compiling with optimization (-O) [-Wcpp]
    warning:   397 | #  warning _FORTIFY_SOURCE requires compiling with optimization (-O)
    warning:       |    ^~~~~~~
    warning: In file included from /nix/store/ypwq2n4h5fik81hchgxn6bjpynyay4dm-glibc-2.33-108-dev/include/bits/libc-header-start.h:33,
    warning:                  from /nix/store/ypwq2n4h5fik81hchgxn6bjpynyay4dm-glibc-2.33-108-dev/include/stdint.h:26,
    warning:                  from /nix/store/qxxm10h05039397bm9syfjp3rx482ls8-gcc-9.3.0/lib/gcc/aarch64-unknown-linux-gnu/9.3.0/include/stdint.h:9,
    warning:                  from vendor/tree-sitter-typescript/typescript/src/tree_sitter/parser.h:9,
    warning:                  from vendor/tree-sitter-typescript/typescript/src/../../common/scanner.h:1,
    warning:                  from vendor/tree-sitter-typescript/typescript/src/scanner.c:1:
    warning: /nix/store/ypwq2n4h5fik81hchgxn6bjpynyay4dm-glibc-2.33-108-dev/include/features.h:397:4: warning: #warning _FORTIFY_SOURCE requires compiling with optimization (-O) [-Wcpp]
    warning:   397 | #  warning _FORTIFY_SOURCE requires compiling with optimization (-O)
    warning:       |    ^~~~~~~
        Finished test [unoptimized + debuginfo] target(s) in 1m 16s
         Running unittests (target/debug/deps/tree_grepper-e0ac10aa105a161a)
    
    running 19 tests
    test language::tests::parse_query_problem ... ok
    test extractor::tests::test_underscore_names_are_ignored ... ok
    test extractor::tests::test_matches_are_extracted ... ok
    test language::tests::to_str_reflects_from_str ... ok
    test language::tests::parse_query_smoke_test ... ok
    test extractor::tests::test_underscore_names_can_still_be_used_in_matchers ... ok
    test tests::all_haskell ... ok
    test tests::all_javascript ... ok
    test tests::all_php ... ok
    stored new snapshot /build/source/src/snapshots/tree_grepper__tests__all_elm.snap.new
    test tests::all_elm ... FAILED
    test tests::all_elixir ... ok
    test tests::all_typescript ... ok
    test tests::all_cpp ... ok
    test tests::json_output ... ok
    test tests::lines_output ... ok
    test tests::all_ruby ... ok
    test tests::pretty_json_output ... ok
    test tests::json_lines_output ... ok
    test tests::all_rust ... ok
    
    failures:
    
    ---- tests::all_elm stdout ----
    ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ Snapshot Differences ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
    Snapshot file: src/snapshots/tree_grepper__tests__all_elm.snap
    Snapshot: all_elm
    Source: src/main.rs:284
    -old snapshot
    +new results
    ────────────────────────────────────────────────────────────────────────────────
    call(&["tree-grepper", "-q", "elm", "(_)", "--format=pretty-json", "--sort",
           "--no-gitignore", "vendor/tree-sitter-elm/examples"])
    ────────────┬───────────────────────────────────────────────────────────────────
     5013  5013 │           "column": 127
     5014  5014 │         }
     5015  5015 │       },
     5016  5016 │       {
     5017       │-        "kind": "ERROR",
           5017 │+        "kind": "case_of_branch",
     5018  5018 │         "name": "query",
     5019       │-        "text": "True ->\n                                                                                                                            case ab of\n                                                                                                                                True ->\n                                                                                                                                    case ab of\n                                                                                                                                        True ->\n                                                                                                                                            Just\n                                                                                                                                                { s = 5\n                                                                                                                                                }\n\n                                                                                                                                        _ ->\n                                                                                                                                            Nothing\n\n                                                                                                                                _ ->\n                                                                                                                                    Nothing",
           5019 │+        "text": "True ->\n                                                                                                                            case ab of\n                                                                                                                                True ->\n                                                                                                                                    case ab of\n                                                                                                                                        True ->\n                                                                                                                                            Just\n                                                                                                                                                { s = 5\n                                                                                                                                                }\n\n                                                                                                                                        _ ->\n                                                                                                                                            Nothing\n\n                                                                                                                                _ ->\n                                                                                                                                    Nothing\n\n                                                                                                                                _ ->\n                                                                                                                                    Nothing",
     5020  5020 │         "start": {
     5021  5021 │           "row": 34,
     5022  5022 │           "column": 121
     5023  5023 │         },
     5024  5024 │         "end": {
     5025       │-          "row": 47,
           5025 │+          "row": 50,
     5026  5026 │           "column": 140
     5027  5027 │         }
     5028  5028 │       },
     5029  5029 │       {
    ┈┈┈┈┈┈┈┈┈┈┈┈┼┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈
     5091  5091 │           "column": 128
     5092  5092 │         }
     5093  5093 │       },
     5094  5094 │       {
     5095       │-        "kind": "bin_op_expr",
     5096       │-        "name": "query",
     5097       │-        "text": "case ab of\n                                                                                                                                True ->\n                                                                                                                                    case ab of\n                                                                                                                                        True ->\n                                                                                                                                            Just\n                                                                                                                                                { s = 5\n                                                                                                                                                }",
     5098       │-        "start": {
     5099       │-          "row": 35,
     5100       │-          "column": 125
     5101       │-        },
     5102       │-        "end": {
     5103       │-          "row": 41,
     5104       │-          "column": 146
     5105       │-        }
     5106       │-      },
     5107       │-      {
     5108  5095 │         "kind": "case_of_expr",
     5109  5096 │         "name": "query",
     5110       │-        "text": "case ab of\n                                                                                                                                True ->\n                                                                                                                                    case ab of\n                                                                                                                                        True ->\n                                                                                                                                            Just",
           5097 │+        "text": "case ab of\n                                                                                                                                True ->\n                                                                                                                                    case ab of\n                                                                                                                                        True ->\n                                                                                                                                            Just\n                                                                                                                                                { s = 5\n                                                                                                                                                }\n\n                                                                                                                                        _ ->\n                                                                                                                                            Nothing\n\n                                                                                                                                _ ->\n                                                                                                                                    Nothing\n\n                                                                                                                                _ ->\n                                                                                                                                    Nothing",
     5111  5098 │         "start": {
     5112  5099 │           "row": 35,
     5113  5100 │           "column": 125
     5114  5101 │         },
     5115  5102 │         "end": {
     5116       │-          "row": 39,
     5117       │-          "column": 145
           5103 │+          "row": 50,
           5104 │+          "column": 140
     5118  5105 │         }
     5119  5106 │       },
     5120  5107 │       {
     5121  5108 │         "kind": "case",
    ┈┈┈┈┈┈┈┈┈┈┈┈┼┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈
     5184  5171 │       },
     5185  5172 │       {
     5186  5173 │         "kind": "case_of_branch",
     5187  5174 │         "name": "query",
     5188       │-        "text": "True ->\n                                                                                                                                    case ab of\n                                                                                                                                        True ->\n                                                                                                                                            Just",
           5175 │+        "text": "True ->\n                                                                                                                                    case ab of\n                                                                                                                                        True ->\n                                                                                                                                            Just\n                                                                                                                                                { s = 5\n                                                                                                                                                }\n\n                                                                                                                                        _ ->\n                                                                                                                                            Nothing",
     5189  5176 │         "start": {
     5190  5177 │           "row": 36,
     5191  5178 │           "column": 129
     5192  5179 │         },
     5193  5180 │         "end": {
     5194       │-          "row": 39,
     5195       │-          "column": 145
           5181 │+          "row": 44,
           5182 │+          "column": 148
     5196  5183 │         }
     5197  5184 │       },
     5198  5185 │       {
     5199  5186 │         "kind": "pattern",
    ┈┈┈┈┈┈┈┈┈┈┈┈┼┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈
     5262  5249 │       },
     5263  5250 │       {
     5264  5251 │         "kind": "case_of_expr",
     5265  5252 │         "name": "query",
     5266       │-        "text": "case ab of\n                                                                                                                                        True ->\n                                                                                                                                            Just",
           5253 │+        "text": "case ab of\n                                                                                                                                        True ->\n                                                                                                                                            Just\n                                                                                                                                                { s = 5\n                                                                                                                                                }\n\n                                                                                                                                        _ ->\n                                                                                                                                            Nothing",
     5267  5254 │         "start": {
     5268  5255 │           "row": 37,
     5269  5256 │           "column": 133
     5270  5257 │         },
     5271  5258 │         "end": {
     5272       │-          "row": 39,
     5273       │-          "column": 145
           5259 │+          "row": 44,
           5260 │+          "column": 148
     5274  5261 │         }
     5275  5262 │       },
     5276  5263 │       {
     5277  5264 │         "kind": "case",
    ┈┈┈┈┈┈┈┈┈┈┈┈┼┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈
     5340  5327 │       },
     5341  5328 │       {
     5342  5329 │         "kind": "case_of_branch",
     5343  5330 │         "name": "query",
     5344       │-        "text": "True ->\n                                                                                                                                            Just",
           5331 │+        "text": "True ->\n                                                                                                                                            Just\n                                                                                                                                                { s = 5\n                                                                                                                                                }",
     5345  5332 │         "start": {
     5346  5333 │           "row": 38,
     5347  5334 │           "column": 137
     5348  5335 │         },
     5349  5336 │         "end": {
     5350       │-          "row": 39,
     5351       │-          "column": 145
           5337 │+          "row": 41,
           5338 │+          "column": 146
     5352  5339 │         }
     5353  5340 │       },
     5354  5341 │       {
     5355  5342 │         "kind": "pattern",
    ┈┈┈┈┈┈┈┈┈┈┈┈┼┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈
     5416  5403 │           "column": 144
     5417  5404 │         }
     5418  5405 │       },
     5419  5406 │       {
     5420       │-        "kind": "value_expr",
           5407 │+        "kind": "function_call_expr",
     5421  5408 │         "name": "query",
     5422       │-        "text": "Just",
           5409 │+        "text": "Just\n                                                                                                                                                { s = 5\n                                                                                                                                                }",
     5423  5410 │         "start": {
     5424  5411 │           "row": 39,
     5425  5412 │           "column": 141
     5426  5413 │         },
     5427  5414 │         "end": {
     5428       │-          "row": 39,
     5429       │-          "column": 145
           5415 │+          "row": 41,
           5416 │+          "column": 146
     5430  5417 │         }
     5431  5418 │       },
     5432  5419 │       {
     5433       │-        "kind": "upper_case_qid",
           5420 │+        "kind": "value_expr",
     5434  5421 │         "name": "query",
     5435  5422 │         "text": "Just",
     5436  5423 │         "start": {
     5437  5424 │           "row": 39,
    ┈┈┈┈┈┈┈┈┈┈┈┈┼┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈
     5442  5429 │           "column": 145
     5443  5430 │         }
     5444  5431 │       },
     5445  5432 │       {
     5446       │-        "kind": "upper_case_identifier",
           5433 │+        "kind": "upper_case_qid",
     5447  5434 │         "name": "query",
     5448  5435 │         "text": "Just",
     5449  5436 │         "start": {
     5450  5437 │           "row": 39,
    ┈┈┈┈┈┈┈┈┈┈┈┈┼┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈
     5455  5442 │           "column": 145
     5456  5443 │         }
     5457  5444 │       },
     5458  5445 │       {
     5459       │-        "kind": "operator",
     5460       │-        "name": "query",
     5461       │-        "text": "",
     5462       │-        "start": {
     5463       │-          "row": 39,
     5464       │-          "column": 145
     5465       │-        },
     5466       │-        "end": {
     5467       │-          "row": 39,
     5468       │-          "column": 145
     5469       │-        }
     5470       │-      },
     5471       │-      {
     5472       │-        "kind": "operator_identifier",
           5446 │+        "kind": "upper_case_identifier",
     5473  5447 │         "name": "query",
     5474       │-        "text": "",
           5448 │+        "text": "Just",
     5475  5449 │         "start": {
     5476  5450 │           "row": 39,
     5477       │-          "column": 145
           5451 │+          "column": 141
     5478  5452 │         },
     5479  5453 │         "end": {
     5480  5454 │           "row": 39,
     5481  5455 │           "column": 145
    ┈┈┈┈┈┈┈┈┈┈┈┈┼┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈
     5559  5533 │           "column": 152
     5560  5534 │         }
     5561  5535 │       },
     5562  5536 │       {
           5537 │+        "kind": "case_of_branch",
           5538 │+        "name": "query",
           5539 │+        "text": "_ ->\n                                                                                                                                            Nothing",
           5540 │+        "start": {
           5541 │+          "row": 43,
           5542 │+          "column": 137
           5543 │+        },
           5544 │+        "end": {
           5545 │+          "row": 44,
           5546 │+          "column": 148
           5547 │+        }
           5548 │+      },
           5549 │+      {
           5550 │+        "kind": "pattern",
           5551 │+        "name": "query",
           5552 │+        "text": "_",
           5553 │+        "start": {
           5554 │+          "row": 43,
           5555 │+          "column": 137
           5556 │+        },
           5557 │+        "end": {
           5558 │+          "row": 43,
           5559 │+          "column": 138
           5560 │+        }
           5561 │+      },
           5562 │+      {
           5563 │+        "kind": "anything_pattern",
           5564 │+        "name": "query",
           5565 │+        "text": "_",
           5566 │+        "start": {
           5567 │+          "row": 43,
           5568 │+          "column": 137
           5569 │+        },
           5570 │+        "end": {
           5571 │+          "row": 43,
           5572 │+          "column": 138
           5573 │+        }
           5574 │+      },
           5575 │+      {
     5563  5576 │         "kind": "underscore",
     5564  5577 │         "name": "query",
     5565  5578 │         "text": "_",
     5566  5579 │         "start": {
    ┈┈┈┈┈┈┈┈┈┈┈┈┼┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈
     5585  5598 │           "column": 141
     5586  5599 │         }
     5587  5600 │       },
     5588  5601 │       {
     5589       │-        "kind": "ERROR",
           5602 │+        "kind": "value_expr",
     5590  5603 │         "name": "query",
     5591       │-        "text": "N",
           5604 │+        "text": "Nothing",
     5592  5605 │         "start": {
     5593  5606 │           "row": 44,
     5594  5607 │           "column": 141
     5595  5608 │         },
     5596  5609 │         "end": {
     5597  5610 │           "row": 44,
     5598       │-          "column": 142
           5611 │+          "column": 148
     5599  5612 │         }
     5600  5613 │       },
     5601  5614 │       {
     5602       │-        "kind": "lower_case_identifier",
           5615 │+        "kind": "upper_case_qid",
     5603  5616 │         "name": "query",
     5604       │-        "text": "othing",
           5617 │+        "text": "Nothing",
     5605  5618 │         "start": {
     5606  5619 │           "row": 44,
     5607       │-          "column": 142
           5620 │+          "column": 141
     5608  5621 │         },
     5609  5622 │         "end": {
     5610  5623 │           "row": 44,
     5611  5624 │           "column": 148
     5612  5625 │         }
     5613  5626 │       },
     5614  5627 │       {
           5628 │+        "kind": "upper_case_identifier",
           5629 │+        "name": "query",
           5630 │+        "text": "Nothing",
           5631 │+        "start": {
           5632 │+          "row": 44,
           5633 │+          "column": 141
           5634 │+        },
           5635 │+        "end": {
           5636 │+          "row": 44,
           5637 │+          "column": 148
           5638 │+        }
           5639 │+      },
           5640 │+      {
           5641 │+        "kind": "case_of_branch",
           5642 │+        "name": "query",
           5643 │+        "text": "_ ->\n                                                                                                                                    Nothing",
           5644 │+        "start": {
           5645 │+          "row": 46,
           5646 │+          "column": 129
           5647 │+        },
           5648 │+        "end": {
           5649 │+          "row": 47,
           5650 │+          "column": 140
           5651 │+        }
           5652 │+      },
           5653 │+      {
           5654 │+        "kind": "pattern",
           5655 │+        "name": "query",
           5656 │+        "text": "_",
           5657 │+        "start": {
           5658 │+          "row": 46,
           5659 │+          "column": 129
           5660 │+        },
           5661 │+        "end": {
           5662 │+          "row": 46,
           5663 │+          "column": 130
           5664 │+        }
           5665 │+      },
           5666 │+      {
           5667 │+        "kind": "anything_pattern",
           5668 │+        "name": "query",
           5669 │+        "text": "_",
           5670 │+        "start": {
           5671 │+          "row": 46,
           5672 │+          "column": 129
           5673 │+        },
           5674 │+        "end": {
           5675 │+          "row": 46,
           5676 │+          "column": 130
           5677 │+        }
           5678 │+      },
           5679 │+      {
     5615  5680 │         "kind": "underscore",
     5616  5681 │         "name": "query",
     5617  5682 │         "text": "_",
     5618  5683 │         "start": {
    ┈┈┈┈┈┈┈┈┈┈┈┈┼┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈
     5637  5702 │           "column": 133
     5638  5703 │         }
     5639  5704 │       },
     5640  5705 │       {
     5641       │-        "kind": "ERROR",
           5706 │+        "kind": "value_expr",
           5707 │+        "name": "query",
           5708 │+        "text": "Nothing",
           5709 │+        "start": {
           5710 │+          "row": 47,
           5711 │+          "column": 133
           5712 │+        },
           5713 │+        "end": {
           5714 │+          "row": 47,
           5715 │+          "column": 140
           5716 │+        }
           5717 │+      },
           5718 │+      {
           5719 │+        "kind": "upper_case_qid",
     5642  5720 │         "name": "query",
     5643       │-        "text": "N",
           5721 │+        "text": "Nothing",
     5644  5722 │         "start": {
     5645  5723 │           "row": 47,
     5646  5724 │           "column": 133
     5647  5725 │         },
     5648  5726 │         "end": {
     5649  5727 │           "row": 47,
     5650       │-          "column": 134
           5728 │+          "column": 140
     5651  5729 │         }
     5652  5730 │       },
     5653  5731 │       {
     5654       │-        "kind": "lower_case_identifier",
           5732 │+        "kind": "upper_case_identifier",
     5655  5733 │         "name": "query",
     5656       │-        "text": "othing",
           5734 │+        "text": "Nothing",
     5657  5735 │         "start": {
     5658  5736 │           "row": 47,
     5659       │-          "column": 134
           5737 │+          "column": 133
     5660  5738 │         },
     5661  5739 │         "end": {
     5662  5740 │           "row": 47,
     5663  5741 │           "column": 140
    ────────────┴───────────────────────────────────────────────────────────────────
    To update snapshots run `cargo insta review`
    thread 'tests::all_elm' panicked at 'snapshot assertion for 'all_elm' failed in line 284', /sources/insta-1.13.0/src/runtime.rs:391:9
    note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
    
    
    failures:
        tests::all_elm
    
    test result: FAILED. 18 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out; finished in 3.30s
    
    error: test failed, to rerun pass '--bin tree-grepper'
    
    opened by jali-clarke 2
  • Bump clap from 3.2.7 to 3.2.8

    Bump clap from 3.2.7 to 3.2.8

    Bumps clap from 3.2.7 to 3.2.8.

    Release notes

    Sourced from clap's releases.

    v3.2.8

    [3.2.8] - 2022-06-30

    Features

    • Added Command::mut_subcommand to mirror Command::mut_arg
    Changelog

    Sourced from clap's changelog.

    [3.2.8] - 2022-06-30

    Features

    • Added Command::mut_subcommand to mirror Command::mut_arg
    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    opened by dependabot[bot] 2
  • Bump cc from 1.0.71 to 1.0.72

    Bump cc from 1.0.71 to 1.0.72

    Bumps cc from 1.0.71 to 1.0.72.

    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.

    Dependabot will merge this PR once CI passes on it, as requested by @BrianHicks.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    dependencies rust 
    opened by dependabot[bot] 2
  • Bump serde from 1.0.149 to 1.0.150

    Bump serde from 1.0.149 to 1.0.150

    Bumps serde from 1.0.149 to 1.0.150.

    Release notes

    Sourced from serde's releases.

    v1.0.150

    • Relax some trait bounds from the Serialize impl of HashMap and BTreeMap (#2334)
    • Enable Serialize and Deserialize impls of std::sync::atomic types on more platforms (#2337, thanks @​badboy)
    Commits
    • d493649 Release 1.0.150
    • 0e947e6 Merge pull request #2338 from serde-rs/atomic
    • 9249dab Deduplicate atomic_impl macro calls
    • 7440e56 Deduplicate atomic_impl macro implementations
    • 0d79306 Update atomic_impl macros to have same input syntax in all cfgs
    • 37faaf2 Mention target_has_atomic stabilization
    • 650358f Replace obsolete comment about target_has_atomic support
    • 6159ead Invert use_target_has_atomic cfg
    • 692ac99 Format PR 2337 with rustfmt
    • 86161ce Adjust spacing in some macro matchers
    • Additional commits viewable in compare view

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    dependencies rust 
    opened by dependabot[bot] 1
  • Add support for dynamically loading grammar libraries at runtime

    Add support for dynamically loading grammar libraries at runtime

    Can you please add support for dynamically loading (any) grammar libraries at runtime? The current approach of vendoring every existing grammar and linking them in build-time is not scalable and not compatible with linux distributions.

    This issue has been already solved e.g. in diffsitter (https://github.com/afnanenayet/diffsitter/pull/177) or helix (https://github.com/helix-editor/helix/pull/432).

    You can either load a grammar library for the specified language from the system library path (this is typically /lib:/usr/lib:/usr/local/lib, but the path may vary between linux distros; the point is that you don’t depend on exact path, this is handled by libc) as any other system library – grammar libraries are expected to be named libtree-sitter-<lang>.so (diffsitter’s approach).

    Or you can look up grammar libraries directly in some predefined directory (e.g. /usr/lib/tree-sitter or some app-specific dir) named as <lang>.so (helix’s approach).

    The former is better, but both are acceptable for Linux distros – in the latter case, we can just symlink <your-directory-for-grammars> to e.g. /usr/lib/tree-sitter where system-wide grammars are installed by the system’s package manager (and used by all programs that use tree-sitter). These approaches are not mutually exclusive – you can support both.

    Also, you can continue to provide some grammars with tree-grepper (as both diffsitter and helix do, they use git submodules) for the convenience of the users that build tree-grepper themselves and their distro don’t provide tree-sitter grammars yet (for example, Alpine Linux and Arch Linux (AUR) already provide many grammars). The aim is to allow package maintainers to package grammars separately and give users the freedom to choose what grammars they will install.

    (I opened the same issue also in https://github.com/Wilfred/difftastic/issues/123)

    opened by jirutka 1
  • support for more languages

    support for more languages

    We should hypothetically be able to support any language in the list at https://tree-sitter.github.io/tree-sitter/#available-parsers. Instructions for contributing are in the README at https://github.com/BrianHicks/tree-grepper#supported-languages

    good first issue 
    opened by BrianHicks 1
Owner
Brian Hicks
Brian Hicks
singe's grep - a fast grep using single-file parallelism

singrep singe's grep - a fast grep using single-file parallelism singrep makes use of deterministic kernel file cache'ing to read the file fast enough

Dominic White 44 Nov 18, 2022
A syntax highlighter for Node powered by Tree Sitter. Written in Rust.

tree-sitter-highlight A syntax highlighter for Node.js powered by Tree Sitter. Written in Rust. Usage The following will output HTML: const treeSitter

Devon Govett 211 Dec 20, 2022
Tree-sitter - An incremental parsing system for programming tools

tree-sitter Tree-sitter is a parser generator tool and an incremental parsing library. It can build a concrete syntax tree for a source file and effic

null 10.6k Jan 9, 2023
A tree-sitter based AST difftool to get meaningful semantic diffs

diffsitter Disclaimer diffsitter is very much a work in progress and nowhere close to production ready (yet). Contributions are always welcome! Summar

Afnan Enayet 1.3k Jan 8, 2023
Semantic find-and-replace using tree-sitter-based macro expansion

Semantic find-and-replace using tree-sitter-based macro expansion

Isaac Clayton 15 Nov 10, 2022
Mypyc DSL grammar for tree-sitter

tree-sitter-mypyc Mypyc DSL grammar for tree-sitter. Installing (Neovim) This is based on the Neovim Tree-sitter docs for adding new parsers. Basicall

dosisod 3 Dec 30, 2022
tree-sitter meets Kakoune

kak-tree-sitter This is a binary server that interfaces tree-sitter with kakoune. Features Install Usage Design Credits Features Semantic highlighting

Dimitri Sabadie 5 May 3, 2023
rehype plugin to use tree-sitter to highlight code in pre code blocks

rehype-tree-sitter rehype plugin to use tree-sitter to highlight code in <pre><code> blocks Contents What is this? When should I use this? Install Use

null 5 Jul 25, 2023
Grep with human-friendly search output

hgrep: Human-friendly GREP hgrep is a grep tool to search files with given pattern and print the matched code snippets with human-friendly syntax high

Linda_pp 345 Jan 4, 2023
Fgr - Find & Grep utility with SQL-like query language

fgr Find & Grep utility with SQL-like query language. Examples # Find all files with name equal to sample under the current directory: fgr -e name=sam

Igor 3 Dec 22, 2022
GREP like cli tool written in rust.

Show [ grep,tail,cat ] like cli tool written in rust. Only one release as of now which does very basic function,code has been refactored where other f

Siri 4 Jul 24, 2023
A bit like tee, a bit like script, but all with a fake tty. Lets you remote control and watch a process

teetty teetty is a wrapper binary to execute a command in a pty while providing remote control facilities. This allows logging the stdout of a process

Armin Ronacher 259 Jan 3, 2023
Count your code by tokens, types of syntax tree nodes, and patterns in the syntax tree. A tokei/scc/cloc alternative.

tcount (pronounced "tee-count") Count your code by tokens, types of syntax tree nodes, and patterns in the syntax tree. Quick Start Simply run tcount

Adam P. Regasz-Rethy 48 Dec 7, 2022
As-tree - Print a list of paths as a tree of paths 🌳

as-tree Print a list of paths as a tree of paths. For example, given: dir1/foo.txt dir1/bar.txt dir2/qux.txt it will print: . ├── dir1 │ ├── foo.tx

Jake Zimmerman 396 Dec 10, 2022
Baby's first Rust CLI project. Basic implementation of grep. Written in about 100 SLOC.

minigrep Coding project from Chapter 12 of the The Rust Programming Language book. Usage Compile and run as so minigrep QUERY FILENAME QUERY being the

Anis 2 Oct 2, 2021
A syntax-highlighting pager for git, diff, and grep output

Get Started Install delta and add this to your ~/.gitconfig: [core] pager = delta [interactive] diffFilter = delta --color-only [delta]

Dan Davison 16k Dec 31, 2022
A simplified recreation of the command-line utility grep written in Rust.

smolgrep A simplified recreation of the command-line utility grep written in Rust. Download and run Download Rust On Mac/Linux Open a terminal and ent

Thi Dinh 0 Dec 27, 2021
Command-line tool that provides a workflow for extending, editing, diffing, and writing to vim-style grep lines.

Grug Grug is a command-line tool that provides a workflow for expanding, editing, diffing, and writing edits to files using vim-styled grep lines (suc

null 4 Apr 25, 2023
rpsc is a *nix command line tool to quickly search for file systems items matching varied criterions like permissions, extended attributes and much more.

rpsc rpsc is a *nix command line tool to quickly search for file systems items matching varied criterions like permissions, extended attributes and mu

null 3 Dec 15, 2022