tamer: parse: Rename {lower_*_while_ok=>lower_*}

The `while_ok` can just be implied with a lowering operation, and that
reduces the name complexity so that we can maybe introduce even more
specialized methods without resulting in a huge sentence as a name.

DEV-11864
main
Mike Gerwitz 2022-05-27 14:10:55 -04:00
parent b084e23497
commit f40f8bbafc
2 changed files with 6 additions and 6 deletions

View File

@ -191,7 +191,7 @@ fn load_xmlo<'a, P: AsRef<Path>, S: Escaper>(
let (mut asg, mut state) = into_iter_while_ok::<_, _, _, TameldError, _>(
XmlXirReader::new(file, escaper, ctx),
|toks| {
flat::State::<64>::parse(toks).lower_while_ok::<XmloReader, _, _>(
flat::State::<64>::parse(toks).lower::<XmloReader, _, _>(
|xmlo| {
let mut iter = xmlo.scan(false, |st, rtok| {
match st {
@ -203,11 +203,11 @@ fn load_xmlo<'a, P: AsRef<Path>, S: Escaper>(
}
});
Lower::<XmloReader, xmlo::LowerState>::lower_with_context_while_ok(
Lower::<XmloReader, xmlo::LowerState>::lower_with_context(
&mut iter,
state,
|air| {
let (_, asg) = Lower::<xmlo::LowerState, AirState>::lower_with_context_while_ok(
let (_, asg) = Lower::<xmlo::LowerState, AirState>::lower_with_context(
air,
asg,
|end| {

View File

@ -719,7 +719,7 @@ impl<S: ParseState, I: TokenStream<S::Token>> Parser<S, I> {
/// Consequently,
/// this API (likely the return type) will change.
#[inline]
pub fn lower_while_ok<LS, U, E>(
pub fn lower<LS, U, E>(
&mut self,
f: impl FnOnce(&mut LowerIter<S, Parser<S, I>, LS>) -> Result<U, E>,
) -> Result<U, E>
@ -742,7 +742,7 @@ impl<S: ParseState, I: TokenStream<S::Token>> Parser<S, I> {
/// An IR lowering operation that pipes the output of one [`Parser`] to the
/// input of another.
///
/// This is produced by [`Parser::lower_while_ok`].
/// This is produced by [`Parser::lower`].
pub struct LowerIter<'a, 'b, S, I, LS>
where
S: ParseState,
@ -790,7 +790,7 @@ where
/// This allows state to be shared among parsers.
///
/// See [`ParseState::parse_with_context`] for more information.
fn lower_with_context_while_ok<U, E>(
fn lower_with_context<U, E>(
&mut self,
ctx: LS::Context,
f: impl FnOnce(&mut LowerIter<S, Self, LS>) -> Result<U, E>,