Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff --git a/src/macros.rs b/src/macros.rs
- index 7ea9fbd..607ab25 100644
- --- a/src/macros.rs
- +++ b/src/macros.rs
- @@ -1712,14 +1712,27 @@ macro_rules! many1(
- {
- let mut res = Vec::new();
- let mut input = $i;
- - while let $crate::IResult::Done(i,o) = $submac!(input, $($args)*) {
- - if i.len() == input.len() {
- - break;
- + let mut incomplete = None;
- + loop {
- + match $submac!(input, $($args)*) {
- + $crate::IResult::Done(i,o) => {
- + if i.len() == input.len() {
- + break;
- + }
- + res.push(o);
- + input = i;
- + },
- + $crate::IResult::Incomplete(n) => {
- + incomplete = Some(n);
- +
- + break
- + },
- + _ => break,
- }
- - res.push(o);
- - input = i;
- }
- - if res.is_empty() {
- + if let Some(n) = incomplete {
- + $crate::IResult::Incomplete(n)
- + } else if res.is_empty() {
- $crate::IResult::Error($crate::Err::Position($crate::ErrorKind::Many1,$i))
- } else {
- $crate::IResult::Done(input, res)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement