Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(combinator): try_fold and verify_fold #685

Merged
merged 2 commits into from
Jan 10, 2025
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
fix(combinator): Apply epage PR review
- Rename {try,verify}_fold_impl functions
- remove doc alias
  • Loading branch information
Altair-Bueno committed Jan 10, 2025
commit e7350dc7da3b8b8406a33b223082ce84a541c2a3
16 changes: 4 additions & 12 deletions src/combinator/multi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -342,10 +342,6 @@ where
/// assert_eq!(parser("123123"), Ok(("123123", HashSet::from([]))));
/// assert_eq!(parser(""), Ok(("", HashSet::from([]))));
/// ```
#[doc(alias = "verify_fold_many0")]
#[doc(alias = "verify_fold_many1")]
#[doc(alias = "verify_fold_many_m_n")]
#[doc(alias = "verify_fold_repeat")]
#[inline(always)]
pub fn verify_fold<Init, Op, Result>(
mut self,
Expand All @@ -361,7 +357,7 @@ where
end_inclusive,
} = self.occurrences;
trace("repeat_verify_fold", move |input: &mut Input| {
verify_fold_impl(
verify_fold_m_n(
start_inclusive,
end_inclusive.unwrap_or(usize::MAX),
&mut self.parser,
Expand Down Expand Up @@ -419,10 +415,6 @@ where
/// assert_eq!(parser("abc123"), Ok(("123", b"abc".to_vec())));
/// assert_eq!(parser("123123"), Ok(("123123", vec![])));
/// assert_eq!(parser(""), Ok(("", vec![])));
#[doc(alias = "try_fold_many0")]
#[doc(alias = "try_fold_many1")]
#[doc(alias = "try_fold_many_m_n")]
#[doc(alias = "try_fold_repeat")]
#[inline(always)]
pub fn try_fold<Init, Op, OpError, Result>(
mut self,
Expand All @@ -439,7 +431,7 @@ where
end_inclusive,
} = self.occurrences;
trace("repeat_try_fold", move |input: &mut Input| {
try_fold_impl(
try_fold_m_n(
start_inclusive,
end_inclusive.unwrap_or(usize::MAX),
&mut self.parser,
Expand Down Expand Up @@ -1515,7 +1507,7 @@ where
}

#[inline(always)]
fn verify_fold_impl<I, O, E, F, G, H, R>(
fn verify_fold_m_n<I, O, E, F, G, H, R>(
min: usize,
max: usize,
parse: &mut F,
Expand Down Expand Up @@ -1580,7 +1572,7 @@ where
}

#[inline(always)]
fn try_fold_impl<I, O, E, F, G, H, R, GE>(
fn try_fold_m_n<I, O, E, F, G, H, R, GE>(
min: usize,
max: usize,
parse: &mut F,
Expand Down
Loading