Skip to content
This repository was archived by the owner on Mar 22, 2024. It is now read-only.

Commit 76c95ab

Browse files
committed
impl Match.lastgroup
1 parent 33ef823 commit 76c95ab

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

interp.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ pub(crate) fn search(
150150
) -> Option<Match> {
151151
// TODO: optimize by op info and skip prefix
152152
let end = std::cmp::min(end, string.char_len());
153-
for i in start..end {
153+
for i in start..end + 1 {
154154
if let Some(m) = pymatch(string.clone(), i, end, pattern.clone()) {
155155
return Some(m);
156156
}
@@ -1382,6 +1382,13 @@ impl OpcodeExecutor for OpRepeatOne {
13821382
drive.ctx_mut().has_matched = Some(true);
13831383
return None;
13841384
}
1385+
if self.count <= self.mincount as isize {
1386+
drive.state.marks_pop_discard();
1387+
drive.ctx_mut().has_matched = Some(false);
1388+
return None;
1389+
}
1390+
1391+
// TODO: unnesscary double check
13851392
drive.back_skip_char(1);
13861393
self.count -= 1;
13871394
drive.state.marks_pop_keep();

0 commit comments

Comments
 (0)