mirror of
https://github.com/BurntSushi/ripgrep.git
synced 2025-08-19 06:03:48 -07:00
committed by
Andrew Gallant
parent
df1bf4a042
commit
066f97d855
@@ -659,9 +659,18 @@ impl Tokens {
|
||||
for pat in patterns {
|
||||
let mut altre = String::new();
|
||||
self.tokens_to_regex(options, &pat, &mut altre);
|
||||
parts.push(altre);
|
||||
if !altre.is_empty() {
|
||||
parts.push(altre);
|
||||
}
|
||||
}
|
||||
|
||||
// It is possible to have an empty set in which case the
|
||||
// resulting alternation '()' would be an error.
|
||||
if !parts.is_empty() {
|
||||
re.push('(');
|
||||
re.push_str(&parts.join("|"));
|
||||
re.push(')');
|
||||
}
|
||||
re.push_str(&parts.join("|"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user