Skip to content

Commit 093df67

Browse files
committed
Change literal extraction for look-arounds
1 parent 515ccff commit 093df67

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

regex-automata/src/meta/strategy.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,11 @@ impl Pre<()> {
258258
if !info.props()[0].look_set().is_empty() {
259259
return None;
260260
}
261+
// For a similar reason, we require that it has zero look-around
262+
// expressions.
263+
if info.props()[0].contains_lookaround_expr() {
264+
return None;
265+
}
261266
// Finally, currently, our prefilters are all oriented around
262267
// leftmost-first match semantics, so don't try to use them if the
263268
// caller asked for anything else.

regex-syntax/src/hir/literal.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,8 +172,9 @@ impl Extractor {
172172
use crate::hir::HirKind::*;
173173

174174
match *hir.kind() {
175-
Empty | Look(_) => Seq::singleton(self::Literal::exact(vec![])),
176-
LookAround(_) => Seq::infinite(),
175+
Empty | Look(_) | LookAround(_) => {
176+
Seq::singleton(self::Literal::exact(vec![]))
177+
}
177178
Literal(hir::Literal(ref bytes)) => {
178179
let mut seq =
179180
Seq::singleton(self::Literal::exact(bytes.to_vec()));

0 commit comments

Comments
 (0)