├── .gitattributes ├── .github ├── dependabot.yml └── workflows │ └── main.yml ├── .gitignore ├── Cargo.toml ├── LICENSE-MIT ├── README.md ├── UNLICENSE ├── examples ├── filter_before_line_10.rs ├── filter_before_line_number.rs └── filter_function_items_before_line_10.rs ├── proc_macros ├── Cargo.toml └── src │ └── lib.rs ├── rustfmt.toml ├── src ├── args.rs ├── bin │ └── tree-sitter-grep.rs ├── language.rs ├── lib.rs ├── line_buffer.rs ├── lines.rs ├── macros.rs ├── matcher.rs ├── plugin.rs ├── printer │ ├── color.rs │ ├── counter.rs │ ├── mod.rs │ ├── standard.rs │ ├── stats.rs │ └── util.rs ├── project_file_walker.rs ├── query_context.rs ├── searcher │ ├── core.rs │ ├── glue.rs │ ├── mmap.rs │ └── mod.rs ├── sink.rs ├── treesitter.rs ├── use_printer.rs └── use_searcher.rs └── tests ├── fixtures ├── c_project │ └── example.h ├── cpp_project │ └── example.cpp ├── csharp_project │ └── example.cs ├── css_project │ └── example.css ├── dockerfile_project │ └── Dockerfile ├── elisp_project │ └── example.el ├── elm_project │ └── example.elm ├── go_project │ └── example.go ├── html_project │ └── example.html ├── java_project │ └── example.java ├── json_project │ └── example.json ├── kotlin_project │ └── example.kt ├── lua_project │ └── example.lua ├── match_inside_macro │ └── foo.rs ├── mixed_project │ ├── javascript_src │ │ └── index.js │ ├── rust_src │ │ └── lib.rs │ └── typescript_src │ │ └── index.tsx ├── no_recognized_file_types │ ├── something.scala │ └── subdir │ │ └── something.scala ├── objective_c_project │ └── example.h ├── python_project │ └── example.py ├── ruby_project │ └── example.rb ├── rust_overlapping │ └── src │ │ └── lib.rs ├── rust_overlapping_start_same_line │ └── src │ │ └── lib.rs ├── rust_overlapping_with_preceding_lines │ └── src │ │ └── lib.rs ├── rust_project │ ├── Cargo.toml │ ├── function-item.scm │ ├── function-itemz.scm │ └── src │ │ ├── helpers.rs │ │ ├── lib.rs │ │ └── stop.rs ├── rust_project_byte_offset │ ├── Cargo.toml │ ├── function-item.scm │ ├── function-itemz.scm │ └── src │ │ ├── helpers.rs │ │ ├── lib.rs │ │ └── stop.rs ├── sorting_maybe_nesting_related │ ├── foo.rs │ └── query.scm ├── swift_project │ └── example.swift ├── tree_sitter_query_project │ └── example.scm └── typescript_project │ └── hello.ts ├── languages.rs ├── output.rs └── shared.rs /.gitattributes: -------------------------------------------------------------------------------- 1 | tests/fixtures/rust_project_byte_offset/** eol=lf 2 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/helixbass/tree-sitter-grep/HEAD/.github/dependabot.yml -------------------------------------------------------------------------------- /.github/workflows/main.yml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/helixbass/tree-sitter-grep/HEAD/.github/workflows/main.yml -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | target 2 | Cargo.lock 3 | tmp* 4 | -------------------------------------------------------------------------------- /Cargo.toml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/helixbass/tree-sitter-grep/HEAD/Cargo.toml -------------------------------------------------------------------------------- /LICENSE-MIT: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/helixbass/tree-sitter-grep/HEAD/LICENSE-MIT -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/helixbass/tree-sitter-grep/HEAD/README.md -------------------------------------------------------------------------------- /UNLICENSE: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/helixbass/tree-sitter-grep/HEAD/UNLICENSE -------------------------------------------------------------------------------- /examples/filter_before_line_10.rs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/helixbass/tree-sitter-grep/HEAD/examples/filter_before_line_10.rs -------------------------------------------------------------------------------- /examples/filter_before_line_number.rs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/helixbass/tree-sitter-grep/HEAD/examples/filter_before_line_number.rs -------------------------------------------------------------------------------- /examples/filter_function_items_before_line_10.rs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/helixbass/tree-sitter-grep/HEAD/examples/filter_function_items_before_line_10.rs -------------------------------------------------------------------------------- /proc_macros/Cargo.toml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/helixbass/tree-sitter-grep/HEAD/proc_macros/Cargo.toml -------------------------------------------------------------------------------- /proc_macros/src/lib.rs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/helixbass/tree-sitter-grep/HEAD/proc_macros/src/lib.rs -------------------------------------------------------------------------------- /rustfmt.toml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/helixbass/tree-sitter-grep/HEAD/rustfmt.toml -------------------------------------------------------------------------------- /src/args.rs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/helixbass/tree-sitter-grep/HEAD/src/args.rs -------------------------------------------------------------------------------- /src/bin/tree-sitter-grep.rs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/helixbass/tree-sitter-grep/HEAD/src/bin/tree-sitter-grep.rs -------------------------------------------------------------------------------- /src/language.rs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/helixbass/tree-sitter-grep/HEAD/src/language.rs -------------------------------------------------------------------------------- /src/lib.rs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/helixbass/tree-sitter-grep/HEAD/src/lib.rs -------------------------------------------------------------------------------- /src/line_buffer.rs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/helixbass/tree-sitter-grep/HEAD/src/line_buffer.rs -------------------------------------------------------------------------------- /src/lines.rs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/helixbass/tree-sitter-grep/HEAD/src/lines.rs -------------------------------------------------------------------------------- /src/macros.rs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/helixbass/tree-sitter-grep/HEAD/src/macros.rs -------------------------------------------------------------------------------- /src/matcher.rs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/helixbass/tree-sitter-grep/HEAD/src/matcher.rs -------------------------------------------------------------------------------- /src/plugin.rs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/helixbass/tree-sitter-grep/HEAD/src/plugin.rs -------------------------------------------------------------------------------- /src/printer/color.rs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/helixbass/tree-sitter-grep/HEAD/src/printer/color.rs -------------------------------------------------------------------------------- /src/printer/counter.rs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/helixbass/tree-sitter-grep/HEAD/src/printer/counter.rs -------------------------------------------------------------------------------- /src/printer/mod.rs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/helixbass/tree-sitter-grep/HEAD/src/printer/mod.rs -------------------------------------------------------------------------------- /src/printer/standard.rs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/helixbass/tree-sitter-grep/HEAD/src/printer/standard.rs -------------------------------------------------------------------------------- /src/printer/stats.rs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/helixbass/tree-sitter-grep/HEAD/src/printer/stats.rs -------------------------------------------------------------------------------- /src/printer/util.rs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/helixbass/tree-sitter-grep/HEAD/src/printer/util.rs -------------------------------------------------------------------------------- /src/project_file_walker.rs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/helixbass/tree-sitter-grep/HEAD/src/project_file_walker.rs -------------------------------------------------------------------------------- /src/query_context.rs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/helixbass/tree-sitter-grep/HEAD/src/query_context.rs -------------------------------------------------------------------------------- /src/searcher/core.rs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/helixbass/tree-sitter-grep/HEAD/src/searcher/core.rs -------------------------------------------------------------------------------- /src/searcher/glue.rs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/helixbass/tree-sitter-grep/HEAD/src/searcher/glue.rs -------------------------------------------------------------------------------- /src/searcher/mmap.rs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/helixbass/tree-sitter-grep/HEAD/src/searcher/mmap.rs -------------------------------------------------------------------------------- /src/searcher/mod.rs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/helixbass/tree-sitter-grep/HEAD/src/searcher/mod.rs -------------------------------------------------------------------------------- /src/sink.rs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/helixbass/tree-sitter-grep/HEAD/src/sink.rs -------------------------------------------------------------------------------- /src/treesitter.rs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/helixbass/tree-sitter-grep/HEAD/src/treesitter.rs -------------------------------------------------------------------------------- /src/use_printer.rs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/helixbass/tree-sitter-grep/HEAD/src/use_printer.rs -------------------------------------------------------------------------------- /src/use_searcher.rs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/helixbass/tree-sitter-grep/HEAD/src/use_searcher.rs -------------------------------------------------------------------------------- /tests/fixtures/c_project/example.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/helixbass/tree-sitter-grep/HEAD/tests/fixtures/c_project/example.h -------------------------------------------------------------------------------- /tests/fixtures/cpp_project/example.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/helixbass/tree-sitter-grep/HEAD/tests/fixtures/cpp_project/example.cpp -------------------------------------------------------------------------------- /tests/fixtures/csharp_project/example.cs: -------------------------------------------------------------------------------- 1 | namespace YL.Utils.Json {} 2 | -------------------------------------------------------------------------------- /tests/fixtures/css_project/example.css: -------------------------------------------------------------------------------- 1 | h1 { 2 | text-transform: uppercase; 3 | } 4 | -------------------------------------------------------------------------------- /tests/fixtures/dockerfile_project/Dockerfile: -------------------------------------------------------------------------------- 1 | WORKDIR /usr/src/app 2 | -------------------------------------------------------------------------------- /tests/fixtures/elisp_project/example.el: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/helixbass/tree-sitter-grep/HEAD/tests/fixtures/elisp_project/example.el -------------------------------------------------------------------------------- /tests/fixtures/elm_project/example.elm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/helixbass/tree-sitter-grep/HEAD/tests/fixtures/elm_project/example.elm -------------------------------------------------------------------------------- /tests/fixtures/go_project/example.go: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/helixbass/tree-sitter-grep/HEAD/tests/fixtures/go_project/example.go -------------------------------------------------------------------------------- /tests/fixtures/html_project/example.html: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/helixbass/tree-sitter-grep/HEAD/tests/fixtures/html_project/example.html -------------------------------------------------------------------------------- /tests/fixtures/java_project/example.java: -------------------------------------------------------------------------------- 1 | @ThreadSafe 2 | public final class Constants {} 3 | -------------------------------------------------------------------------------- /tests/fixtures/json_project/example.json: -------------------------------------------------------------------------------- 1 | { 2 | "hello": "ok" 3 | } 4 | -------------------------------------------------------------------------------- /tests/fixtures/kotlin_project/example.kt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/helixbass/tree-sitter-grep/HEAD/tests/fixtures/kotlin_project/example.kt -------------------------------------------------------------------------------- /tests/fixtures/lua_project/example.lua: -------------------------------------------------------------------------------- 1 | function hello() 2 | end 3 | -------------------------------------------------------------------------------- /tests/fixtures/match_inside_macro/foo.rs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/helixbass/tree-sitter-grep/HEAD/tests/fixtures/match_inside_macro/foo.rs -------------------------------------------------------------------------------- /tests/fixtures/mixed_project/javascript_src/index.js: -------------------------------------------------------------------------------- 1 | const js_foo = () => {} 2 | -------------------------------------------------------------------------------- /tests/fixtures/mixed_project/rust_src/lib.rs: -------------------------------------------------------------------------------- 1 | fn foo() {} 2 | -------------------------------------------------------------------------------- /tests/fixtures/mixed_project/typescript_src/index.tsx: -------------------------------------------------------------------------------- 1 | const foo = () => {} 2 | -------------------------------------------------------------------------------- /tests/fixtures/no_recognized_file_types/something.scala: -------------------------------------------------------------------------------- 1 | I don't know Scala 2 | -------------------------------------------------------------------------------- /tests/fixtures/no_recognized_file_types/subdir/something.scala: -------------------------------------------------------------------------------- 1 | I don't know Scala 2 | -------------------------------------------------------------------------------- /tests/fixtures/objective_c_project/example.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/helixbass/tree-sitter-grep/HEAD/tests/fixtures/objective_c_project/example.h -------------------------------------------------------------------------------- /tests/fixtures/python_project/example.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/helixbass/tree-sitter-grep/HEAD/tests/fixtures/python_project/example.py -------------------------------------------------------------------------------- /tests/fixtures/ruby_project/example.rb: -------------------------------------------------------------------------------- 1 | if x > y 2 | whee() 3 | end 4 | -------------------------------------------------------------------------------- /tests/fixtures/rust_overlapping/src/lib.rs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/helixbass/tree-sitter-grep/HEAD/tests/fixtures/rust_overlapping/src/lib.rs -------------------------------------------------------------------------------- /tests/fixtures/rust_overlapping_start_same_line/src/lib.rs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/helixbass/tree-sitter-grep/HEAD/tests/fixtures/rust_overlapping_start_same_line/src/lib.rs -------------------------------------------------------------------------------- /tests/fixtures/rust_overlapping_with_preceding_lines/src/lib.rs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/helixbass/tree-sitter-grep/HEAD/tests/fixtures/rust_overlapping_with_preceding_lines/src/lib.rs -------------------------------------------------------------------------------- /tests/fixtures/rust_project/Cargo.toml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/helixbass/tree-sitter-grep/HEAD/tests/fixtures/rust_project/Cargo.toml -------------------------------------------------------------------------------- /tests/fixtures/rust_project/function-item.scm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/helixbass/tree-sitter-grep/HEAD/tests/fixtures/rust_project/function-item.scm -------------------------------------------------------------------------------- /tests/fixtures/rust_project/function-itemz.scm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/helixbass/tree-sitter-grep/HEAD/tests/fixtures/rust_project/function-itemz.scm -------------------------------------------------------------------------------- /tests/fixtures/rust_project/src/helpers.rs: -------------------------------------------------------------------------------- 1 | pub fn helper() {} 2 | -------------------------------------------------------------------------------- /tests/fixtures/rust_project/src/lib.rs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/helixbass/tree-sitter-grep/HEAD/tests/fixtures/rust_project/src/lib.rs -------------------------------------------------------------------------------- /tests/fixtures/rust_project/src/stop.rs: -------------------------------------------------------------------------------- 1 | fn stop_it() {} 2 | -------------------------------------------------------------------------------- /tests/fixtures/rust_project_byte_offset/Cargo.toml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/helixbass/tree-sitter-grep/HEAD/tests/fixtures/rust_project_byte_offset/Cargo.toml -------------------------------------------------------------------------------- /tests/fixtures/rust_project_byte_offset/function-item.scm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/helixbass/tree-sitter-grep/HEAD/tests/fixtures/rust_project_byte_offset/function-item.scm -------------------------------------------------------------------------------- /tests/fixtures/rust_project_byte_offset/function-itemz.scm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/helixbass/tree-sitter-grep/HEAD/tests/fixtures/rust_project_byte_offset/function-itemz.scm -------------------------------------------------------------------------------- /tests/fixtures/rust_project_byte_offset/src/helpers.rs: -------------------------------------------------------------------------------- 1 | pub fn helper() {} 2 | -------------------------------------------------------------------------------- /tests/fixtures/rust_project_byte_offset/src/lib.rs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/helixbass/tree-sitter-grep/HEAD/tests/fixtures/rust_project_byte_offset/src/lib.rs -------------------------------------------------------------------------------- /tests/fixtures/rust_project_byte_offset/src/stop.rs: -------------------------------------------------------------------------------- 1 | fn stop_it() {} 2 | -------------------------------------------------------------------------------- /tests/fixtures/sorting_maybe_nesting_related/foo.rs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/helixbass/tree-sitter-grep/HEAD/tests/fixtures/sorting_maybe_nesting_related/foo.rs -------------------------------------------------------------------------------- /tests/fixtures/sorting_maybe_nesting_related/query.scm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/helixbass/tree-sitter-grep/HEAD/tests/fixtures/sorting_maybe_nesting_related/query.scm -------------------------------------------------------------------------------- /tests/fixtures/swift_project/example.swift: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/helixbass/tree-sitter-grep/HEAD/tests/fixtures/swift_project/example.swift -------------------------------------------------------------------------------- /tests/fixtures/tree_sitter_query_project/example.scm: -------------------------------------------------------------------------------- 1 | (function_item) @f 2 | -------------------------------------------------------------------------------- /tests/fixtures/typescript_project/hello.ts: -------------------------------------------------------------------------------- 1 | const x = 3; 2 | -------------------------------------------------------------------------------- /tests/languages.rs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/helixbass/tree-sitter-grep/HEAD/tests/languages.rs -------------------------------------------------------------------------------- /tests/output.rs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/helixbass/tree-sitter-grep/HEAD/tests/output.rs -------------------------------------------------------------------------------- /tests/shared.rs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/helixbass/tree-sitter-grep/HEAD/tests/shared.rs --------------------------------------------------------------------------------