mirror of
https://github.com/BurntSushi/ripgrep.git
synced 2025-02-09 14:14:56 +02:00
regex: fix HIR analysis bug
An alternate can be empty at this point, so we must handle it. We didn't before because the regex engine actually disallows empty alternates, however, this code runs before the regex compiler rejects the regex.
This commit is contained in:
parent
4359d8aac0
commit
bd222ae93f
@ -109,6 +109,7 @@ pub fn alternation_literals(expr: &Hir) -> Option<Vec<Vec<u8>>> {
|
||||
for alt in alts {
|
||||
let mut lit = vec![];
|
||||
match *alt.kind() {
|
||||
HirKind::Empty => {}
|
||||
HirKind::Literal(ref x) => extendlit(x, &mut lit),
|
||||
HirKind::Concat(ref exprs) => {
|
||||
for e in exprs {
|
||||
|
Loading…
x
Reference in New Issue
Block a user