Advertisement
Guest User

Untitled

a guest
Nov 27th, 2015
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.09 KB | None | 0 0
  1. diff --git a/src/macros.rs b/src/macros.rs
  2. index 7ea9fbd..607ab25 100644
  3. --- a/src/macros.rs
  4. +++ b/src/macros.rs
  5. @@ -1712,14 +1712,27 @@ macro_rules! many1(
  6. {
  7. let mut res = Vec::new();
  8. let mut input = $i;
  9. - while let $crate::IResult::Done(i,o) = $submac!(input, $($args)*) {
  10. - if i.len() == input.len() {
  11. - break;
  12. + let mut incomplete = None;
  13. + loop {
  14. + match $submac!(input, $($args)*) {
  15. + $crate::IResult::Done(i,o) => {
  16. + if i.len() == input.len() {
  17. + break;
  18. + }
  19. + res.push(o);
  20. + input = i;
  21. + },
  22. + $crate::IResult::Incomplete(n) => {
  23. + incomplete = Some(n);
  24. +
  25. + break
  26. + },
  27. + _ => break,
  28. }
  29. - res.push(o);
  30. - input = i;
  31. }
  32. - if res.is_empty() {
  33. + if let Some(n) = incomplete {
  34. + $crate::IResult::Incomplete(n)
  35. + } else if res.is_empty() {
  36. $crate::IResult::Error($crate::Err::Position($crate::ErrorKind::Many1,$i))
  37. } else {
  38. $crate::IResult::Done(input, res)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement