grep-0.2.4/COPYING010064400017500000144000000001761345371621100117310ustar0000000000000000This project is dual-licensed under the Unlicense and MIT licenses. You may use this code under the terms of either license. grep-0.2.4/Cargo.toml.orig010064400017500000144000000020361345517765400136000ustar0000000000000000[package] name = "grep" version = "0.2.4" #:version authors = ["Andrew Gallant "] description = """ Fast line oriented regex searching as a library. """ documentation = "http://burntsushi.net/rustdoc/grep/" homepage = "https://github.com/BurntSushi/ripgrep" repository = "https://github.com/BurntSushi/ripgrep" readme = "README.md" keywords = ["regex", "grep", "egrep", "search", "pattern"] license = "Unlicense/MIT" [dependencies] grep-cli = { version = "0.1.2", path = "../grep-cli" } grep-matcher = { version = "0.1.2", path = "../grep-matcher" } grep-pcre2 = { version = "0.1.3", path = "../grep-pcre2", optional = true } grep-printer = { version = "0.1.2", path = "../grep-printer" } grep-regex = { version = "0.1.3", path = "../grep-regex" } grep-searcher = { version = "0.1.4", path = "../grep-searcher" } [dev-dependencies] termcolor = "1.0.4" walkdir = "2.2.7" [features] simd-accel = ["grep-searcher/simd-accel"] pcre2 = ["grep-pcre2"] # This feature is DEPRECATED. Runtime dispatch is used for SIMD now. avx-accel = [] grep-0.2.4/Cargo.toml0000644000000026160000000000000100360ustar00# THIS FILE IS AUTOMATICALLY GENERATED BY CARGO # # When uploading crates to the registry Cargo will automatically # "normalize" Cargo.toml files for maximal compatibility # with all versions of Cargo and also rewrite `path` dependencies # to registry (e.g., crates.io) dependencies # # If you believe there's an error in this file please file an # issue against the rust-lang/cargo repository. If you're # editing this file be aware that the upstream Cargo.toml # will likely look very different (and much more reasonable) [package] name = "grep" version = "0.2.4" authors = ["Andrew Gallant "] description = "Fast line oriented regex searching as a library.\n" homepage = "https://github.com/BurntSushi/ripgrep" documentation = "http://burntsushi.net/rustdoc/grep/" readme = "README.md" keywords = ["regex", "grep", "egrep", "search", "pattern"] license = "Unlicense/MIT" repository = "https://github.com/BurntSushi/ripgrep" [dependencies.grep-cli] version = "0.1.2" [dependencies.grep-matcher] version = "0.1.2" [dependencies.grep-pcre2] version = "0.1.3" optional = true [dependencies.grep-printer] version = "0.1.2" [dependencies.grep-regex] version = "0.1.3" [dependencies.grep-searcher] version = "0.1.4" [dev-dependencies.termcolor] version = "1.0.4" [dev-dependencies.walkdir] version = "2.2.7" [features] avx-accel = [] pcre2 = ["grep-pcre2"] simd-accel = ["grep-searcher/simd-accel"] grep-0.2.4/LICENSE-MIT010064400017500000144000000020711345371621100123260ustar0000000000000000The 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. grep-0.2.4/README.md010064400017500000144000000020731345371621100121530ustar0000000000000000grep ---- ripgrep, as a library. [![Linux build status](https://api.travis-ci.org/BurntSushi/ripgrep.svg)](https://travis-ci.org/BurntSushi/ripgrep) [![Windows build status](https://ci.appveyor.com/api/projects/status/github/BurntSushi/ripgrep?svg=true)](https://ci.appveyor.com/project/BurntSushi/ripgrep) [![](https://img.shields.io/crates/v/grep.svg)](https://crates.io/crates/grep) Dual-licensed under MIT or the [UNLICENSE](http://unlicense.org). ### Documentation [https://docs.rs/grep](https://docs.rs/grep) NOTE: This crate isn't ready for wide use yet. Ambitious individuals can probably piece together the parts, but there is no high level documentation describing how all of the pieces fit together. ### Usage Add this to your `Cargo.toml`: ```toml [dependencies] grep = "0.2" ``` and this to your crate root: ```rust extern crate grep; ``` ### Features This crate provides a `pcre2` feature (disabled by default) which, when enabled, re-exports the `grep-pcre2` crate as an alternative `Matcher` implementation to the standard `grep-regex` implementation. grep-0.2.4/UNLICENSE010064400017500000144000000022731345371621100121460ustar0000000000000000This 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 grep-0.2.4/examples/simplegrep.rs010064400017500000144000000040001345371621100152170ustar0000000000000000extern crate grep; extern crate termcolor; extern crate walkdir; use std::env; use std::error::Error; use std::ffi::OsString; use std::process; use grep::cli; use grep::printer::{ColorSpecs, StandardBuilder}; use grep::regex::RegexMatcher; use grep::searcher::{BinaryDetection, SearcherBuilder}; use termcolor::ColorChoice; use walkdir::WalkDir; fn main() { if let Err(err) = try_main() { eprintln!("{}", err); process::exit(1); } } fn try_main() -> Result<(), Box> { let mut args: Vec = env::args_os().collect(); if args.len() < 2 { return Err("Usage: simplegrep [ ...]".into()); } if args.len() == 2 { args.push(OsString::from("./")); } search(cli::pattern_from_os(&args[1])?, &args[2..]) } fn search(pattern: &str, paths: &[OsString]) -> Result<(), Box> { let matcher = RegexMatcher::new_line_matcher(&pattern)?; let mut searcher = SearcherBuilder::new() .binary_detection(BinaryDetection::quit(b'\x00')) .line_number(false) .build(); let mut printer = StandardBuilder::new() .color_specs(ColorSpecs::default_with_color()) .build(cli::stdout( if cli::is_tty_stdout() { ColorChoice::Auto } else { ColorChoice::Never } )); for path in paths { for result in WalkDir::new(path) { let dent = match result { Ok(dent) => dent, Err(err) => { eprintln!("{}", err); continue; } }; if !dent.file_type().is_file() { continue; } let result = searcher.search_path( &matcher, dent.path(), printer.sink_with_path(&matcher, dent.path()), ); if let Err(err) = result { eprintln!("{}: {}", dent.path().display(), err); } } } Ok(()) } grep-0.2.4/src/lib.rs010064400017500000144000000012501345371621100125730ustar0000000000000000/*! ripgrep, as a library. This library is intended to provide a high level facade to the crates that make up ripgrep's core searching routines. However, there is no high level documentation available yet guiding users on how to fit all of the pieces together. Every public API item in the constituent crates is documented, but examples are sparse. A cookbook and a guide are planned. */ #![deny(missing_docs)] pub extern crate grep_cli as cli; pub extern crate grep_matcher as matcher; #[cfg(feature = "pcre2")] pub extern crate grep_pcre2 as pcre2; pub extern crate grep_printer as printer; pub extern crate grep_regex as regex; pub extern crate grep_searcher as searcher; grep-0.2.4/.cargo_vcs_info.json0000644000000001120000000000000120250ustar00{ "git": { "sha1": "1a2a24ea74c1081f492804b2682e9fc0788fb75f" } }