Compare commits

..

7 Commits

Author SHA1 Message Date
Andrew Gallant
60a1db34a6 index: embarking on a most ambitious project... 2022-08-22 14:49:35 -04:00
Malte
87b33c96c0 ignore/types: improve 'markdown' and 'php' types
This adds some lesser known extensions.

Notably, it adds php7 and php8, but not php6. Apparently,
php6 was never a thing: https://wiki.php.net/rfc/php6

PR #2263
2022-07-18 10:35:09 -04:00
Andrew Gallant
5e975c43f8 doc: appease rustdoc 2022-07-15 10:13:55 -04:00
Andrew Gallant
7efa2e46d3 grep-0.2.10 2022-07-15 10:06:53 -04:00
Andrew Gallant
db0b92b62d grep: bump grep-searcher to 0.1.10
This was a result of leaving a stray 'dbg!'.
2022-07-15 10:06:31 -04:00
Andrew Gallant
33b81cac48 grep-searcher-0.1.10 2022-07-15 10:05:46 -04:00
Andrew Gallant
6a13a4f64d searcher: remove stray 'dbg!' 2022-07-15 10:05:20 -04:00
13 changed files with 1143 additions and 10 deletions

12
Cargo.lock generated
View File

@@ -152,7 +152,7 @@ dependencies = [
[[package]]
name = "grep"
version = "0.2.9"
version = "0.2.10"
dependencies = [
"grep-cli",
"grep-matcher",
@@ -179,6 +179,14 @@ dependencies = [
"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]]
name = "grep-matcher"
version = "0.1.5"
@@ -224,7 +232,7 @@ dependencies = [
[[package]]
name = "grep-searcher"
version = "0.1.9"
version = "0.1.10"
dependencies = [
"bstr",
"bytecount",

View File

@@ -32,6 +32,7 @@ members = [
"crates/globset",
"crates/grep",
"crates/cli",
"crates/index",
"crates/matcher",
"crates/pcre2",
"crates/printer",

View File

@@ -1,6 +1,6 @@
[package]
name = "grep"
version = "0.2.9" #:version
version = "0.2.10" #:version
authors = ["Andrew Gallant <jamslam@gmail.com>"]
description = """
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-printer = { version = "0.1.6", path = "../printer" }
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]
termcolor = "1.0.4"

View File

@@ -146,9 +146,9 @@ pub const DEFAULT_TYPES: &[(&str, &[&str])] = &[
]),
("mako", &["*.mako", "*.mao"]),
("man", &["*.[0-9lnpx]", "*.[0-9][cEFMmpSx]"]),
("markdown", &["*.markdown", "*.md", "*.mdown", "*.mkdn"]),
("markdown", &["*.markdown", "*.md", "*.mdown", "*.mkd", "*.mkdn"]),
("matlab", &["*.m"]),
("md", &["*.markdown", "*.md", "*.mdown", "*.mkdn"]),
("md", &["*.markdown", "*.md", "*.mdown", "*.mkd", "*.mkdn"]),
("meson", &["meson.build", "meson_options.txt"]),
("minified", &["*.min.html", "*.min.css", "*.min.js"]),
("mint", &["*.mint"]),
@@ -167,7 +167,12 @@ pub const DEFAULT_TYPES: &[(&str, &[&str])] = &[
("pascal", &["*.pas", "*.dpr", "*.lpr", "*.pp", "*.inc"]),
("pdf", &["*.pdf"]),
("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"]),
("pod", &["*.pod"]),
("postscript", &["*.eps", "*.ps"]),

19
crates/index/Cargo.toml Normal file
View 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
View 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
View File

@@ -0,0 +1,8 @@
grep-index
----------
WIP.
[![Build status](https://github.com/BurntSushi/ripgrep/workflows/ci/badge.svg)](https://github.com/BurntSushi/ripgrep/actions)
[![](https://img.shields.io/crates/v/grep-regex.svg)](https://crates.io/crates/grep-index)
Dual-licensed under MIT or the [UNLICENSE](http://unlicense.org).

24
crates/index/UNLICENSE Normal file
View 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
View File

@@ -0,0 +1,7 @@
/*!
TODO
*/
#![allow(warnings)]
mod literal;

1040
crates/index/src/literal.rs Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -191,7 +191,7 @@ impl ConfiguredHIR {
/// text anchors. We disable it by not returning a line terminator, since
/// 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> {
if self.is_any_anchored() {
None

View File

@@ -1,6 +1,6 @@
[package]
name = "grep-searcher"
version = "0.1.9" #:version
version = "0.1.10" #:version
authors = ["Andrew Gallant <jamslam@gmail.com>"]
description = """
Fast line oriented regex searching as a library.

View File

@@ -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> {
if dbg!(self.is_line_by_line_fast()) {
if self.is_line_by_line_fast() {
self.match_by_line_fast(buf)
} else {
self.match_by_line_slow(buf)