BurntSushi/ripgrep
Glossary
Terms used throughout the ripgrep code and documentation.
| Term | Meaning |
|---|---|
rg |
The name of the ripgrep binary. The crate is ripgrep, the binary is rg. Defined in the [[bin]] section of Cargo.toml. |
| Haystack | A single file (or stdin) that is being searched. The struct lives in crates/core/haystack.rs. The pattern (regex) is the "needle"; everything else is the haystack. |
| Matcher | A trait in crates/matcher/src/lib.rs that abstracts over regex implementations. Implemented by RegexMatcher (in crates/regex) and the optional pcre2::RegexMatcher (in crates/pcre2). |
| Searcher | The type that drives the line-oriented search loop. Defined in crates/searcher/src/searcher/mod.rs. Pulls bytes from a source, hands chunks to a matcher, and pushes results to a sink. |
| Sink | A trait that receives match callbacks from a Searcher. Implementations live in crates/printer/src/{standard,summary,json}.rs. |
| LowArgs / HiArgs | Two layers of CLI argument representation. LowArgs (in crates/core/flags/lowargs.rs) is a near-1-to-1 reflection of the parsed command line. HiArgs (in crates/core/flags/hiargs.rs) resolves config files, environment, and cross-flag dependencies into a ready-to-use struct. |
| Walk / WalkParallel | The recursive directory iterators in crates/ignore/src/walk.rs. Walk is single-threaded; WalkParallel farms work out to a thread pool. |
| Override | A glob filter from the -g/--glob or --iglob CLI flags. Lives in crates/ignore/src/overrides.rs. Overrides take priority over gitignore rules. |
| Type / typeset | A named set of file globs (e.g., rust = ["*.rs"]) used by the -t/-T flags. Defined in crates/ignore/src/types.rs and crates/ignore/src/default_types.rs. |
| Gitignore | A .gitignore, .ignore, or .rgignore file. The matcher is in crates/ignore/src/gitignore.rs. ripgrep also respects global gitignores, jujutsu (.jj) repos, and core.excludesFile. |
| Glob | A single Unix-style wildcard pattern. Compiled to a regex by crates/globset/src/glob.rs. |
| GlobSet | A collection of compiled globs that can be matched against a single path simultaneously. Defined in crates/globset/src/lib.rs. |
| Mode | One of Search, Files, Types, or Generate(...). Determines which top-level entry point in crates/core/main.rs runs. |
| SearchMode | Which printer to use for results: Standard, Summary, or JSON. |
| Multi-line mode | Search mode where a single regex match may span multiple lines. Triggered by -U/--multiline. Implemented in crates/searcher via the multi_line config flag. |
| Passthru | When --passthru is set, ripgrep emits non-matching lines as well as matching ones. Useful when piping through other filters. |
| Preprocessor | An external command set with --pre that ripgrep invokes per file to transform a haystack before searching. Run in crates/cli/src/process.rs. |
| Decompression | When -z/--search-zip is set, ripgrep auto-detects compressed files and pipes them through a helper (gzip, bzip2, xz, lz4, zstd, brotli). Logic in crates/cli/src/decompress.rs. |
| PCRE2 | An alternative regex engine, enabled at compile time with the pcre2 Cargo feature and at runtime with -P/--pcre2. Brings look-around and backreferences. |
| Hyperlink format | A template like file://{host}{path}#{line} used to emit terminal hyperlinks. Defined in crates/printer/src/hyperlink/. |
| mmap (memory-mapped search) | Searching a file by mapping it into the process address space. Faster for single large files; safer to disable for many small files. The choice lives in crates/searcher/src/searcher/mmap.rs. |
| Context line | A non-matching line printed alongside a match because of -A/-B/-C. Modeled by SinkContext. |
| Replacement | A pattern provided to -r/--replace that rewrites the matched text in the output. Implemented via crates/matcher/src/interpolate.rs. |
| Special mode | Short-circuit modes that print and exit, like --help, --version, --pcre2-version. Defined in crates/core/flags/lowargs.rs::SpecialMode. |
| Generate mode | Modes that produce ancillary artifacts: --generate man, --generate complete-bash, etc. Defined in crates/core/flags/lowargs.rs::GenerateMode. |
Built by Factory AutoWiki from public repository content. It is a generated preview for codebase exploration, not source-maintained documentation.