File tree Expand file tree Collapse file tree 3 files changed +7
-6
lines changed
regex-automata/src/nfa/thompson Expand file tree Collapse file tree 3 files changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -1045,7 +1045,7 @@ impl Compiler {
10451045 & self ,
10461046 lookaround : & LookAround ,
10471047 ) -> Result < ThompsonRef , BuildError > {
1048- let sub = self . c ( lookaround. sub ( ) ) ;
1048+ let sub = self . c ( lookaround. sub ( ) ) ? ;
10491049 let pos = match lookaround {
10501050 LookAround :: NegativeLookBehind ( _) => false ,
10511051 LookAround :: PositiveLookBehind ( _) => true ,
Original file line number Diff line number Diff line change @@ -1102,7 +1102,7 @@ impl NFA {
11021102
11031103 /// Returns how many look-around sub-expressions this nfa contains
11041104 #[ inline]
1105- pub fn lookaround_count ( & self ) -> SmallIndex {
1105+ pub fn lookaround_count ( & self ) -> usize {
11061106 self . 0 . lookaround_count
11071107 }
11081108
@@ -1269,7 +1269,7 @@ pub(super) struct Inner {
12691269 /// How many look-around expression this NFA contains.
12701270 /// This is needed to initialize the table for storing the result of
12711271 /// look-around evaluation
1272- lookaround_count : SmallIndex ,
1272+ lookaround_count : usize ,
12731273 /// Heap memory used indirectly by NFA states and other things (like the
12741274 /// various capturing group representations above). Since each state
12751275 /// might use a different amount of heap, we need to keep track of this
@@ -1387,7 +1387,8 @@ impl Inner {
13871387 }
13881388 State :: CheckLookAround { lookaround_idx : look_idx, .. }
13891389 | State :: WriteLookAround { lookaround_idx : look_idx } => {
1390- self . lookaround_count = self . lookaround_count . max ( look_idx) ;
1390+ self . lookaround_count =
1391+ self . lookaround_count . max ( look_idx. as_usize ( ) + 1 ) ;
13911392 }
13921393 State :: Union { .. }
13931394 | State :: BinaryUnion { .. }
Original file line number Diff line number Diff line change @@ -1216,7 +1216,7 @@ impl PikeVM {
12161216}
12171217
12181218impl PikeVM {
1219- fn lookaround_count ( & self ) -> SmallIndex {
1219+ fn lookaround_count ( & self ) -> usize {
12201220 self . nfa . lookaround_count ( )
12211221 }
12221222
@@ -1992,7 +1992,7 @@ impl Cache {
19921992 stack : vec ! [ ] ,
19931993 curr : ActiveStates :: new ( re) ,
19941994 next : ActiveStates :: new ( re) ,
1995- lookaround : vec ! [ None ; re. lookaround_count( ) . as_usize ( ) ] ,
1995+ lookaround : vec ! [ None ; re. lookaround_count( ) ] ,
19961996 }
19971997 }
19981998
You can’t perform that action at this time.
0 commit comments