mirror of
https://github.com/BurntSushi/ripgrep.git
synced 2025-08-01 04:32:01 -07:00
Previously, when `file` is empty (literally empty, as in, zero byte), `rg -f file` and `rg -vf file` would behave identically. This is odd and also doesn't match how GNU grep behaves. It's also not logically correct. An empty file means _zero_ patterns which is an empty set. An empty set matches nothing. Inverting the empty set should result in matching everything. This was because of an errant optimization that lets ripgrep quit early if it can statically detect that no matches are possible. Moreover, there was *also* a bug in how we constructed the PCRE2 pattern when there are zero patterns. PCRE2 doesn't have a concept of sets of patterns (unlike the `regex` crate), so we need to fake it with an empty character class. Fixes #1332, Fixes #3001, Closes #3041
ripgrep core
This is the core ripgrep crate. In particular, main.rs
is where the main
function lives.
Most of ripgrep core consists of two things:
- The definition of the CLI interface, including docs for every flag.
- Glue code that brings the
grep-matcher
,grep-regex
,grep-searcher
andgrep-printer
crates together to actually execute the search.
Currently, there are no plans to make ripgrep core available as an independent library. However, much of the heavy lifting of ripgrep is done via its constituent crates, which can be reused independent of ripgrep. Unfortunately, there is no guide or tutorial to teach folks how to do this yet.