@@ -441,7 +441,7 @@ fn _match<S: StrDrive>(req: &Request<S>, state: &mut State, mut ctx: MatchContex
441
441
442
442
let mut count_ctx = ctx;
443
443
count_ctx. skip_code ( 4 ) ;
444
- if _count ( req, state, count_ctx, 1 ) == 0 {
444
+ if _count ( req, state, & mut count_ctx, 1 ) == 0 {
445
445
state. marks . pop_discard ( ) ;
446
446
break ' result false ;
447
447
}
@@ -735,13 +735,13 @@ fn _match<S: StrDrive>(req: &Request<S>, state: &mut State, mut ctx: MatchContex
735
735
736
736
state. cursor = ctx. cursor ;
737
737
738
- let mut next_ctx = ctx;
739
- next_ctx. skip_code ( 4 ) ;
740
- let count = _count ( req, state, next_ctx, max_count) ;
741
- ctx. skip_char :: < S > ( count) ;
738
+ let mut count_ctx = ctx;
739
+ count_ctx. skip_code ( 4 ) ;
740
+ let count = _count ( req, state, & mut count_ctx, max_count) ;
742
741
if count < min_count {
743
742
break ' result false ;
744
743
}
744
+ ctx. cursor = count_ctx. cursor ;
745
745
746
746
let next_code = ctx. peek_code ( req, ctx. peek_code ( req, 1 ) as usize + 1 ) ;
747
747
if next_code == SreOpcode :: SUCCESS as u32 && ctx. can_success ( req) {
@@ -768,11 +768,11 @@ fn _match<S: StrDrive>(req: &Request<S>, state: &mut State, mut ctx: MatchContex
768
768
} else {
769
769
let mut count_ctx = ctx;
770
770
count_ctx. skip_code ( 4 ) ;
771
- let count = _count ( req, state, count_ctx, min_count) ;
771
+ let count = _count ( req, state, & mut count_ctx, min_count) ;
772
772
if count < min_count {
773
773
break ' result false ;
774
774
}
775
- ctx. skip_char :: < S > ( count ) ;
775
+ ctx. cursor = count_ctx . cursor ;
776
776
count as isize
777
777
} ;
778
778
@@ -845,11 +845,11 @@ fn _match<S: StrDrive>(req: &Request<S>, state: &mut State, mut ctx: MatchContex
845
845
state. cursor = ctx. cursor ;
846
846
let mut count_ctx = ctx;
847
847
count_ctx. skip_code ( 4 ) ;
848
- let count = _count ( req, state, count_ctx, max_count) ;
848
+ let count = _count ( req, state, & mut count_ctx, max_count) ;
849
849
if count < min_count {
850
850
break ' result false ;
851
851
}
852
- ctx. skip_char :: < S > ( count ) ;
852
+ ctx. cursor = count_ctx . cursor ;
853
853
ctx. skip_code_from ( req, 1 ) ;
854
854
}
855
855
SreOpcode :: CHARSET
@@ -1324,7 +1324,7 @@ fn charset(set: &[u32], ch: u32) -> bool {
1324
1324
fn _count < S : StrDrive > (
1325
1325
req : & Request < S > ,
1326
1326
state : & mut State ,
1327
- mut ctx : MatchContext ,
1327
+ ctx : & mut MatchContext ,
1328
1328
max_count : usize ,
1329
1329
) -> usize {
1330
1330
let max_count = std:: cmp:: min ( max_count, ctx. remaining_chars ( req) ) ;
@@ -1347,28 +1347,28 @@ fn _count<S: StrDrive>(
1347
1347
}
1348
1348
}
1349
1349
SreOpcode :: LITERAL => {
1350
- general_count_literal ( req, & mut ctx, end, |code, c| code == c) ;
1350
+ general_count_literal ( req, ctx, end, |code, c| code == c) ;
1351
1351
}
1352
1352
SreOpcode :: NOT_LITERAL => {
1353
- general_count_literal ( req, & mut ctx, end, |code, c| code != c) ;
1353
+ general_count_literal ( req, ctx, end, |code, c| code != c) ;
1354
1354
}
1355
1355
SreOpcode :: LITERAL_IGNORE => {
1356
- general_count_literal ( req, & mut ctx, end, |code, c| code == lower_ascii ( c) ) ;
1356
+ general_count_literal ( req, ctx, end, |code, c| code == lower_ascii ( c) ) ;
1357
1357
}
1358
1358
SreOpcode :: NOT_LITERAL_IGNORE => {
1359
- general_count_literal ( req, & mut ctx, end, |code, c| code != lower_ascii ( c) ) ;
1359
+ general_count_literal ( req, ctx, end, |code, c| code != lower_ascii ( c) ) ;
1360
1360
}
1361
1361
SreOpcode :: LITERAL_LOC_IGNORE => {
1362
- general_count_literal ( req, & mut ctx, end, char_loc_ignore) ;
1362
+ general_count_literal ( req, ctx, end, char_loc_ignore) ;
1363
1363
}
1364
1364
SreOpcode :: NOT_LITERAL_LOC_IGNORE => {
1365
- general_count_literal ( req, & mut ctx, end, |code, c| !char_loc_ignore ( code, c) ) ;
1365
+ general_count_literal ( req, ctx, end, |code, c| !char_loc_ignore ( code, c) ) ;
1366
1366
}
1367
1367
SreOpcode :: LITERAL_UNI_IGNORE => {
1368
- general_count_literal ( req, & mut ctx, end, |code, c| code == lower_unicode ( c) ) ;
1368
+ general_count_literal ( req, ctx, end, |code, c| code == lower_unicode ( c) ) ;
1369
1369
}
1370
1370
SreOpcode :: NOT_LITERAL_UNI_IGNORE => {
1371
- general_count_literal ( req, & mut ctx, end, |code, c| code != lower_unicode ( c) ) ;
1371
+ general_count_literal ( req, ctx, end, |code, c| code != lower_unicode ( c) ) ;
1372
1372
}
1373
1373
_ => {
1374
1374
/* General case */
@@ -1383,7 +1383,7 @@ fn _count<S: StrDrive>(
1383
1383
..* state
1384
1384
} ;
1385
1385
1386
- while ctx. cursor . position < end && _match ( req, & mut sub_state, ctx) {
1386
+ while ctx. cursor . position < end && _match ( req, & mut sub_state, * ctx) {
1387
1387
ctx. advance_char :: < S > ( ) ;
1388
1388
}
1389
1389
}
0 commit comments