pub struct PrattParser<L: Language> { /* private fields */ }Expand description
Pratt parser: supports prefix/infix/postfix (postfix left for language layer special handling)
Implementations§
Source§impl<L: Language> PrattParser<L>
impl<L: Language> PrattParser<L>
Sourcepub fn prefix(
&mut self,
op: L::SyntaxKind,
info: OperatorInfo,
node_kind: L::SyntaxKind,
) -> &mut Self
pub fn prefix( &mut self, op: L::SyntaxKind, info: OperatorInfo, node_kind: L::SyntaxKind, ) -> &mut Self
Registers a prefix operator
Sourcepub fn infix(
&mut self,
op: L::SyntaxKind,
info: OperatorInfo,
node_kind: L::SyntaxKind,
) -> &mut Self
pub fn infix( &mut self, op: L::SyntaxKind, info: OperatorInfo, node_kind: L::SyntaxKind, ) -> &mut Self
Registers an infix operator
Sourcepub fn parse<S, F>(
&self,
state: &mut ParserState<'_, S, L>,
min_bp: Precedence,
primary: &F,
) -> Arc<GreenNode<L::SyntaxKind>>
pub fn parse<S, F>( &self, state: &mut ParserState<'_, S, L>, min_bp: Precedence, primary: &F, ) -> Arc<GreenNode<L::SyntaxKind>>
Parses expressions using the Pratt algorithm
min_bp: Minimum binding strength (precedence)primary: Primary expression parser provided by language layer (includes parentheses, literals, identifiers, and high-binding suffixes like calls/fields)
Auto Trait Implementations§
impl<L> Freeze for PrattParser<L>
impl<L> RefUnwindSafe for PrattParser<L>
impl<L> Send for PrattParser<L>
impl<L> Sync for PrattParser<L>
impl<L> Unpin for PrattParser<L>
impl<L> UnwindSafe for PrattParser<L>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more