mirror of
https://github.com/BurntSushi/ripgrep.git
synced 2025-08-03 13:42:06 -07:00
Compare commits
5 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
a4d8db16f7 | ||
|
3bb387abdd | ||
|
7f0273c347 | ||
|
5b42999a3d | ||
|
8887250860 |
22
appveyor.yml
22
appveyor.yml
@@ -1,22 +1,3 @@
|
|||||||
environment:
|
|
||||||
matrix:
|
|
||||||
- TARGET: x86_64-pc-windows-msvc
|
|
||||||
- TARGET: i686-pc-windows-gnu
|
|
||||||
install:
|
|
||||||
- ps: Start-FileDownload "https://static.rust-lang.org/dist/rust-nightly-${env:TARGET}.exe"
|
|
||||||
- rust-nightly-%TARGET%.exe /VERYSILENT /NORESTART /DIR="C:\Program Files (x86)\Rust"
|
|
||||||
- SET PATH=%PATH%;C:\Program Files (x86)\Rust\bin
|
|
||||||
- SET PATH=%PATH%;C:\MinGW\bin
|
|
||||||
- rustc -V
|
|
||||||
- cargo -V
|
|
||||||
|
|
||||||
build: false
|
|
||||||
|
|
||||||
test_script:
|
|
||||||
- cargo build --verbose
|
|
||||||
- cargo test --verbose
|
|
||||||
|
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
global:
|
global:
|
||||||
PROJECT_NAME: xrep
|
PROJECT_NAME: xrep
|
||||||
@@ -56,7 +37,8 @@ test_script:
|
|||||||
|
|
||||||
before_deploy:
|
before_deploy:
|
||||||
# Generate artifacts for release
|
# Generate artifacts for release
|
||||||
- RUSTFLAGS="-C target-feature=+ssse3" cargo build --release --features simd-accel
|
- SET RUSTFLAGS="-C target-feature=+ssse3"
|
||||||
|
- cargo build --release --features simd-accel
|
||||||
- mkdir staging
|
- mkdir staging
|
||||||
# TODO update this part to copy the artifacts that make sense for your project
|
# TODO update this part to copy the artifacts that make sense for your project
|
||||||
- copy target\release\xrep.exe staging
|
- copy target\release\xrep.exe staging
|
||||||
|
14
src/glob.rs
14
src/glob.rs
@@ -214,7 +214,7 @@ impl Pattern {
|
|||||||
/// regular expression and will represent the matching semantics of this
|
/// regular expression and will represent the matching semantics of this
|
||||||
/// glob pattern and the options given.
|
/// glob pattern and the options given.
|
||||||
pub fn to_regex_with(&self, options: &MatchOptions) -> String {
|
pub fn to_regex_with(&self, options: &MatchOptions) -> String {
|
||||||
let sep = path::MAIN_SEPARATOR.to_string();
|
let sep = regex::quote(&path::MAIN_SEPARATOR.to_string());
|
||||||
let mut re = String::new();
|
let mut re = String::new();
|
||||||
re.push_str("(?-u)");
|
re.push_str("(?-u)");
|
||||||
if options.case_insensitive {
|
if options.case_insensitive {
|
||||||
@@ -235,14 +235,14 @@ impl Pattern {
|
|||||||
}
|
}
|
||||||
Token::Any => {
|
Token::Any => {
|
||||||
if options.require_literal_separator {
|
if options.require_literal_separator {
|
||||||
re.push_str(&format!("[^{}]", regex::quote(&sep)));
|
re.push_str(&format!("[^{}]", sep));
|
||||||
} else {
|
} else {
|
||||||
re.push_str(".");
|
re.push_str(".");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Token::ZeroOrMore => {
|
Token::ZeroOrMore => {
|
||||||
if options.require_literal_separator {
|
if options.require_literal_separator {
|
||||||
re.push_str(&format!("[^{}]*", regex::quote(&sep)));
|
re.push_str(&format!("[^{}]*", sep));
|
||||||
} else {
|
} else {
|
||||||
re.push_str(".*");
|
re.push_str(".*");
|
||||||
}
|
}
|
||||||
@@ -414,6 +414,8 @@ impl<'a> Parser<'a> {
|
|||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
|
use std::path::Path;
|
||||||
|
|
||||||
use regex::bytes::Regex;
|
use regex::bytes::Regex;
|
||||||
|
|
||||||
use super::{Error, Pattern, MatchOptions, SetBuilder, Token};
|
use super::{Error, Pattern, MatchOptions, SetBuilder, Token};
|
||||||
@@ -461,8 +463,9 @@ mod tests {
|
|||||||
#[test]
|
#[test]
|
||||||
fn $name() {
|
fn $name() {
|
||||||
let pat = Pattern::new($pat).unwrap();
|
let pat = Pattern::new($pat).unwrap();
|
||||||
|
let path = &Path::new($path).to_str().unwrap();
|
||||||
let re = Regex::new(&pat.to_regex_with(&$options)).unwrap();
|
let re = Regex::new(&pat.to_regex_with(&$options)).unwrap();
|
||||||
assert!(re.is_match($path.as_bytes()));
|
assert!(re.is_match(path.as_bytes()));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -475,8 +478,9 @@ mod tests {
|
|||||||
#[test]
|
#[test]
|
||||||
fn $name() {
|
fn $name() {
|
||||||
let pat = Pattern::new($pat).unwrap();
|
let pat = Pattern::new($pat).unwrap();
|
||||||
|
let path = &Path::new($path).to_str().unwrap();
|
||||||
let re = Regex::new(&pat.to_regex_with(&$options)).unwrap();
|
let re = Regex::new(&pat.to_regex_with(&$options)).unwrap();
|
||||||
assert!(!re.is_match($path.as_bytes()));
|
assert!(!re.is_match(path.as_bytes()));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@@ -239,6 +239,7 @@ impl<W: Send + io::Write> Printer<W> {
|
|||||||
fn line_number(&mut self, n: u64, sep: u8) {
|
fn line_number(&mut self, n: u64, sep: u8) {
|
||||||
if self.wtr.is_color() {
|
if self.wtr.is_color() {
|
||||||
let _ = self.wtr.fg(YELLOW);
|
let _ = self.wtr.fg(YELLOW);
|
||||||
|
let _ = self.wtr.attr(term::Attr::Bold);
|
||||||
}
|
}
|
||||||
self.write(n.to_string().as_bytes());
|
self.write(n.to_string().as_bytes());
|
||||||
if self.wtr.is_color() {
|
if self.wtr.is_color() {
|
||||||
|
@@ -37,6 +37,6 @@ pub fn stdout_is_atty() -> bool {
|
|||||||
unsafe {
|
unsafe {
|
||||||
let fd = winapi::winbase::STD_OUTPUT_HANDLE;
|
let fd = winapi::winbase::STD_OUTPUT_HANDLE;
|
||||||
let mut out = 0;
|
let mut out = 0;
|
||||||
kernel32::GetConsoleMode(handle, &mut out) != 0
|
kernel32::GetConsoleMode(kernel32::GetStdHandle(fd), &mut out) != 0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user