File tree Expand file tree Collapse file tree 3 files changed +16
-23
lines changed Expand file tree Collapse file tree 3 files changed +16
-23
lines changed Original file line number Diff line number Diff line change @@ -289,20 +289,16 @@ fn compiler(
289289 }
290290 }
291291 }
292+ // Or look-around expressions.
293+ for hir in hirs. iter ( ) {
294+ if hir. properties ( ) . contains_lookaround_expr ( ) {
295+ return Ok ( CompiledRegex :: skip ( ) ) ;
296+ }
297+ }
292298 if !configure_regex_builder ( test, & mut builder) {
293299 return Ok ( CompiledRegex :: skip ( ) ) ;
294300 }
295- let re = match builder. build_many ( regexes) {
296- Ok ( re) => re,
297- Err ( err)
298- if test. compiles ( )
299- && format ! ( "{err}" ) . contains ( "look-around" ) =>
300- {
301- return Ok ( CompiledRegex :: skip ( ) ) ;
302- }
303- Err ( err) => return Err ( err. into ( ) ) ,
304- } ;
305- create_matcher ( & builder, pre, re)
301+ create_matcher ( & builder, pre, builder. build_many ( regexes) ?)
306302 }
307303}
308304
Original file line number Diff line number Diff line change @@ -180,19 +180,16 @@ fn compiler(
180180 }
181181 }
182182 }
183+ // Or look-around expressions.
184+ for hir in hirs. iter ( ) {
185+ if hir. properties ( ) . contains_lookaround_expr ( ) {
186+ return Ok ( CompiledRegex :: skip ( ) ) ;
187+ }
188+ }
183189 if !configure_regex_builder ( test, & mut builder) {
184190 return Ok ( CompiledRegex :: skip ( ) ) ;
185191 }
186- let re = match builder. build_many ( regexes) {
187- Ok ( re) => re,
188- Err ( err)
189- if test. compiles ( )
190- && format ! ( "{err}" ) . contains ( "look-around" ) =>
191- {
192- return Ok ( CompiledRegex :: skip ( ) ) ;
193- }
194- Err ( err) => return Err ( err. into ( ) ) ,
195- } ;
192+ let re = builder. build_many ( & regexes) ?;
196193 let mut cache = re. create_cache ( ) ;
197194 Ok ( CompiledRegex :: compiled ( move |test| -> TestResult {
198195 run_test ( & re, & mut cache, test)
Original file line number Diff line number Diff line change @@ -74,7 +74,7 @@ fn min_visited_capacity() -> Result<()> {
7474 . configure ( config_thompson ( test) )
7575 . syntax ( config_syntax ( test) )
7676 . build_many ( & regexes) ?;
77- // TODO: remove once look-around is supported .
77+ // The backtracker doesn't support lookarounds, so skip if there are any .
7878 if nfa. lookaround_count ( ) > 0 {
7979 return Ok ( CompiledRegex :: skip ( ) ) ;
8080 }
@@ -109,7 +109,7 @@ fn compiler(
109109 return Ok ( CompiledRegex :: skip ( ) ) ;
110110 }
111111 let re = builder. build_many ( & regexes) ?;
112- // TODO: remove once look-around is supported .
112+ // The backtracker doesn't support lookarounds, so skip if there are any .
113113 if re. get_nfa ( ) . lookaround_count ( ) > 0 {
114114 return Ok ( CompiledRegex :: skip ( ) ) ;
115115 }
You can’t perform that action at this time.
0 commit comments