Skip to content

Commit

Permalink
doc-time: make PrattParser nameless
Browse files Browse the repository at this point in the history
  • Loading branch information
Zij-IT committed Jul 8, 2023
1 parent f483324 commit d46bca0
Showing 1 changed file with 16 additions and 12 deletions.
28 changes: 16 additions & 12 deletions src/pratt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -241,20 +241,24 @@ type PrefixBuilder<E> = fn(rhs: E) -> E;

type PostfixBuilder<E> = fn(rhs: E) -> E;

/// Privitize me you coward!
pub trait PrattParser<'a, I, Expr, E>
where
I: Input<'a>,
E: ParserExtra<'a, I>,
{
/// This function drives the [`Pratt`] parser.
fn pratt_parse<M: Mode>(
&self,
inp: &mut InputRef<'a, '_, I, E>,
min_strength: Option<Strength>,
) -> PResult<M, Expr>;
mod nameless_trait {
use super::*;

pub trait PrattParser<'a, I, Expr, E>
where
I: Input<'a>,
E: ParserExtra<'a, I>,
{
fn pratt_parse<M: Mode>(
&self,
inp: &mut InputRef<'a, '_, I, E>,
min_strength: Option<Strength>,
) -> PResult<M, Expr>;
}
}

use nameless_trait::PrattParser;

impl<'a, I, O, E, Atom, InfixOps, InfixOpsOut> PrattParser<'a, I, O, E>
for Pratt<I, O, E, Atom, Infix<InfixOps, InfixOpsOut>>
where
Expand Down

0 comments on commit d46bca0

Please sign in to comment.