diff options
author | Andrew Gallant <jamslam@gmail.com> | 2019-04-10 21:50:31 -0400 |
---|---|---|
committer | Andrew Gallant <jamslam@gmail.com> | 2019-04-14 19:29:27 -0400 |
commit | bd222ae93fa0cabe7d51ba8db40ece99579bdaed (patch) | |
tree | 54c6c4b2aaae675bfaed8f6b8d22f2e8cb4505c4 | |
parent | 4359d8aac0307f7ee36faa7b1ab64646f6160efc (diff) |
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.
-rw-r--r-- | grep-regex/src/multi.rs | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/grep-regex/src/multi.rs b/grep-regex/src/multi.rs index 501e5aca..6e43e975 100644 --- a/grep-regex/src/multi.rs +++ b/grep-regex/src/multi.rs @@ -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 { |