Fix find_gaps_in_closures (#568)

This commit is contained in:
Andrea Fioraldi 2022-03-16 11:07:36 +01:00 committed by GitHub
parent 6b95361123
commit e36522cf21
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -481,9 +481,11 @@ where
} }
let mut start = index; let mut start = index;
let mut end = payload.len() - 1; let mut end = payload.len() - 1;
let mut endings = 0;
// Process every ending // Process every ending
while end > start { while end > start {
if payload[end] == Some(closing_char) { if payload[end] == Some(closing_char) {
endings += 1;
let mut candidate = GeneralizedInput::new(vec![]); let mut candidate = GeneralizedInput::new(vec![]);
candidate candidate
.bytes_mut() .bytes_mut()
@ -502,6 +504,10 @@ where
end -= 1; end -= 1;
index += 1; index += 1;
} }
if endings == 0 {
break;
}
} }
Self::trim_payload(payload); Self::trim_payload(payload);