mirror of
https://github.com/BurntSushi/ripgrep.git
synced 2025-08-02 05:02:01 -07:00
Compare commits
7 Commits
grep-0.2.9
...
ag/index
Author | SHA1 | Date | |
---|---|---|---|
|
60a1db34a6 | ||
|
87b33c96c0 | ||
|
5e975c43f8 | ||
|
7efa2e46d3 | ||
|
db0b92b62d | ||
|
33b81cac48 | ||
|
6a13a4f64d |
12
Cargo.lock
generated
12
Cargo.lock
generated
@@ -152,7 +152,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "grep"
|
name = "grep"
|
||||||
version = "0.2.9"
|
version = "0.2.10"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"grep-cli",
|
"grep-cli",
|
||||||
"grep-matcher",
|
"grep-matcher",
|
||||||
@@ -179,6 +179,14 @@ dependencies = [
|
|||||||
"winapi-util",
|
"winapi-util",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "grep-index"
|
||||||
|
version = "0.0.1"
|
||||||
|
dependencies = [
|
||||||
|
"bstr 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"regex-syntax 0.6.14 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "grep-matcher"
|
name = "grep-matcher"
|
||||||
version = "0.1.5"
|
version = "0.1.5"
|
||||||
@@ -224,7 +232,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "grep-searcher"
|
name = "grep-searcher"
|
||||||
version = "0.1.9"
|
version = "0.1.10"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bstr",
|
"bstr",
|
||||||
"bytecount",
|
"bytecount",
|
||||||
|
@@ -32,6 +32,7 @@ members = [
|
|||||||
"crates/globset",
|
"crates/globset",
|
||||||
"crates/grep",
|
"crates/grep",
|
||||||
"crates/cli",
|
"crates/cli",
|
||||||
|
"crates/index",
|
||||||
"crates/matcher",
|
"crates/matcher",
|
||||||
"crates/pcre2",
|
"crates/pcre2",
|
||||||
"crates/printer",
|
"crates/printer",
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "grep"
|
name = "grep"
|
||||||
version = "0.2.9" #:version
|
version = "0.2.10" #:version
|
||||||
authors = ["Andrew Gallant <jamslam@gmail.com>"]
|
authors = ["Andrew Gallant <jamslam@gmail.com>"]
|
||||||
description = """
|
description = """
|
||||||
Fast line oriented regex searching as a library.
|
Fast line oriented regex searching as a library.
|
||||||
@@ -19,7 +19,7 @@ grep-matcher = { version = "0.1.5", path = "../matcher" }
|
|||||||
grep-pcre2 = { version = "0.1.5", path = "../pcre2", optional = true }
|
grep-pcre2 = { version = "0.1.5", path = "../pcre2", optional = true }
|
||||||
grep-printer = { version = "0.1.6", path = "../printer" }
|
grep-printer = { version = "0.1.6", path = "../printer" }
|
||||||
grep-regex = { version = "0.1.10", path = "../regex" }
|
grep-regex = { version = "0.1.10", path = "../regex" }
|
||||||
grep-searcher = { version = "0.1.9", path = "../searcher" }
|
grep-searcher = { version = "0.1.10", path = "../searcher" }
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
termcolor = "1.0.4"
|
termcolor = "1.0.4"
|
||||||
|
@@ -146,9 +146,9 @@ pub const DEFAULT_TYPES: &[(&str, &[&str])] = &[
|
|||||||
]),
|
]),
|
||||||
("mako", &["*.mako", "*.mao"]),
|
("mako", &["*.mako", "*.mao"]),
|
||||||
("man", &["*.[0-9lnpx]", "*.[0-9][cEFMmpSx]"]),
|
("man", &["*.[0-9lnpx]", "*.[0-9][cEFMmpSx]"]),
|
||||||
("markdown", &["*.markdown", "*.md", "*.mdown", "*.mkdn"]),
|
("markdown", &["*.markdown", "*.md", "*.mdown", "*.mkd", "*.mkdn"]),
|
||||||
("matlab", &["*.m"]),
|
("matlab", &["*.m"]),
|
||||||
("md", &["*.markdown", "*.md", "*.mdown", "*.mkdn"]),
|
("md", &["*.markdown", "*.md", "*.mdown", "*.mkd", "*.mkdn"]),
|
||||||
("meson", &["meson.build", "meson_options.txt"]),
|
("meson", &["meson.build", "meson_options.txt"]),
|
||||||
("minified", &["*.min.html", "*.min.css", "*.min.js"]),
|
("minified", &["*.min.html", "*.min.css", "*.min.js"]),
|
||||||
("mint", &["*.mint"]),
|
("mint", &["*.mint"]),
|
||||||
@@ -167,7 +167,12 @@ pub const DEFAULT_TYPES: &[(&str, &[&str])] = &[
|
|||||||
("pascal", &["*.pas", "*.dpr", "*.lpr", "*.pp", "*.inc"]),
|
("pascal", &["*.pas", "*.dpr", "*.lpr", "*.pp", "*.inc"]),
|
||||||
("pdf", &["*.pdf"]),
|
("pdf", &["*.pdf"]),
|
||||||
("perl", &["*.perl", "*.pl", "*.PL", "*.plh", "*.plx", "*.pm", "*.t"]),
|
("perl", &["*.perl", "*.pl", "*.PL", "*.plh", "*.plx", "*.pm", "*.t"]),
|
||||||
("php", &["*.php", "*.php3", "*.php4", "*.php5", "*.phtml"]),
|
("php", &[
|
||||||
|
// note that PHP 6 doesn't exist
|
||||||
|
// See: https://wiki.php.net/rfc/php6
|
||||||
|
"*.php", "*.php3", "*.php4", "*.php5", "*.php7", "*.php8",
|
||||||
|
"*.pht", "*.phtml"
|
||||||
|
]),
|
||||||
("po", &["*.po"]),
|
("po", &["*.po"]),
|
||||||
("pod", &["*.pod"]),
|
("pod", &["*.pod"]),
|
||||||
("postscript", &["*.eps", "*.ps"]),
|
("postscript", &["*.eps", "*.ps"]),
|
||||||
|
19
crates/index/Cargo.toml
Normal file
19
crates/index/Cargo.toml
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
[package]
|
||||||
|
publish = false
|
||||||
|
name = "grep-index"
|
||||||
|
version = "0.0.1" #:version
|
||||||
|
authors = ["Andrew Gallant <jamslam@gmail.com>"]
|
||||||
|
description = """
|
||||||
|
Grep, but with an index.
|
||||||
|
"""
|
||||||
|
documentation = "https://docs.rs/grep-index"
|
||||||
|
homepage = "https://github.com/BurntSushi/ripgrep"
|
||||||
|
repository = "https://github.com/BurntSushi/ripgrep"
|
||||||
|
readme = "README.md"
|
||||||
|
keywords = ["regex", "grep", "search", "index", "ngram"]
|
||||||
|
license = "Unlicense/MIT"
|
||||||
|
edition = "2018"
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
bstr = "0.2"
|
||||||
|
regex-syntax = "0.6.14"
|
21
crates/index/LICENSE-MIT
Normal file
21
crates/index/LICENSE-MIT
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
The MIT License (MIT)
|
||||||
|
|
||||||
|
Copyright (c) 2015 Andrew Gallant
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in
|
||||||
|
all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
THE SOFTWARE.
|
8
crates/index/README.md
Normal file
8
crates/index/README.md
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
grep-index
|
||||||
|
----------
|
||||||
|
WIP.
|
||||||
|
|
||||||
|
[](https://github.com/BurntSushi/ripgrep/actions)
|
||||||
|
[](https://crates.io/crates/grep-index)
|
||||||
|
|
||||||
|
Dual-licensed under MIT or the [UNLICENSE](http://unlicense.org).
|
24
crates/index/UNLICENSE
Normal file
24
crates/index/UNLICENSE
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
This is free and unencumbered software released into the public domain.
|
||||||
|
|
||||||
|
Anyone is free to copy, modify, publish, use, compile, sell, or
|
||||||
|
distribute this software, either in source code form or as a compiled
|
||||||
|
binary, for any purpose, commercial or non-commercial, and by any
|
||||||
|
means.
|
||||||
|
|
||||||
|
In jurisdictions that recognize copyright laws, the author or authors
|
||||||
|
of this software dedicate any and all copyright interest in the
|
||||||
|
software to the public domain. We make this dedication for the benefit
|
||||||
|
of the public at large and to the detriment of our heirs and
|
||||||
|
successors. We intend this dedication to be an overt act of
|
||||||
|
relinquishment in perpetuity of all present and future rights to this
|
||||||
|
software under copyright law.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||||
|
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||||
|
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||||
|
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||||
|
OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
|
For more information, please refer to <http://unlicense.org/>
|
7
crates/index/src/lib.rs
Normal file
7
crates/index/src/lib.rs
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
/*!
|
||||||
|
TODO
|
||||||
|
*/
|
||||||
|
|
||||||
|
#![allow(warnings)]
|
||||||
|
|
||||||
|
mod literal;
|
1040
crates/index/src/literal.rs
Normal file
1040
crates/index/src/literal.rs
Normal file
File diff suppressed because it is too large
Load Diff
@@ -191,7 +191,7 @@ impl ConfiguredHIR {
|
|||||||
/// text anchors. We disable it by not returning a line terminator, since
|
/// text anchors. We disable it by not returning a line terminator, since
|
||||||
/// without a line terminator, the fast search path can't be executed.
|
/// without a line terminator, the fast search path can't be executed.
|
||||||
///
|
///
|
||||||
/// See: https://github.com/BurntSushi/ripgrep/issues/2260
|
/// See: <https://github.com/BurntSushi/ripgrep/issues/2260>
|
||||||
pub fn line_terminator(&self) -> Option<LineTerminator> {
|
pub fn line_terminator(&self) -> Option<LineTerminator> {
|
||||||
if self.is_any_anchored() {
|
if self.is_any_anchored() {
|
||||||
None
|
None
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "grep-searcher"
|
name = "grep-searcher"
|
||||||
version = "0.1.9" #:version
|
version = "0.1.10" #:version
|
||||||
authors = ["Andrew Gallant <jamslam@gmail.com>"]
|
authors = ["Andrew Gallant <jamslam@gmail.com>"]
|
||||||
description = """
|
description = """
|
||||||
Fast line oriented regex searching as a library.
|
Fast line oriented regex searching as a library.
|
||||||
|
@@ -108,7 +108,7 @@ impl<'s, M: Matcher, S: Sink> Core<'s, M, S> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn match_by_line(&mut self, buf: &[u8]) -> Result<bool, S::Error> {
|
pub fn match_by_line(&mut self, buf: &[u8]) -> Result<bool, S::Error> {
|
||||||
if dbg!(self.is_line_by_line_fast()) {
|
if self.is_line_by_line_fast() {
|
||||||
self.match_by_line_fast(buf)
|
self.match_by_line_fast(buf)
|
||||||
} else {
|
} else {
|
||||||
self.match_by_line_slow(buf)
|
self.match_by_line_slow(buf)
|
||||||
|
Reference in New Issue
Block a user