mirror of
https://github.com/BurntSushi/ripgrep.git
synced 2025-01-13 21:28:13 +02:00
81341702af
Previously, ripgrep core was responsible for escaping regex patterns and implementing the --line-regexp flag. This commit moves that responsibility down into the matchers such that ripgrep just needs to hand the patterns it gets off to the matcher builder. The builder will then take care of escaping and all that. This was done to make pattern construction completely owned by the matcher builders. With the arrival regex-automata, this means we can move to the HIR very quickly and then never move back to the concrete syntax. We can then build our regex directly from the HIR. This overall can save quite a bit of time, especially when searching for large dictionaries. We still aren't quite as fast as GNU grep when searching something on the scale of /usr/share/dict/words, but we are basically within spitting distance. Prior to this, we were about an order of magnitude slower. This architecture in particular lets us write a pretty simple fast path that avoids AST parsing and HIR translation entirely: the case where one is just searching for a literal. In that case, we can hand construct the HIR directly. |
||
---|---|---|
.. | ||
src | ||
Cargo.toml | ||
LICENSE-MIT | ||
README.md | ||
UNLICENSE |
grep-pcre2
The grep-pcre2
crate provides an implementation of the Matcher
trait from
the grep-matcher
crate. This implementation permits PCRE2 to be used in the
grep
crate for fast line oriented searching.
Dual-licensed under MIT or the UNLICENSE.
Documentation
NOTE: You probably don't want to use this crate directly. Instead, you
should prefer the facade defined in the
grep
crate.
If you're looking to just use PCRE2 from Rust, then you probably want the
pcre2
crate, which provide high level safe bindings to PCRE2.
Usage
Add this to your Cargo.toml
:
[dependencies]
grep-pcre2 = "0.1"