pub struct PrattParser { /* private fields */ }Expand description
Precedence-climbing parser for the Algol surface: tokenizes infix source and
parses it into LocatedExprTree forms using operator binding powers from
its PrattTable.
Implementations§
Source§impl PrattParser
impl PrattParser
Sourcepub fn new(operators: PrattTable) -> Self
pub fn new(operators: PrattTable) -> Self
Creates a parser driven by the given operator table. Use
crate::default_pratt_table for the standard arithmetic operators.
Sourcepub fn parse_text_tree(
&self,
codec: CodecId,
source_id: impl Into<String>,
source: &str,
) -> Result<LocatedExprTree>
pub fn parse_text_tree( &self, codec: CodecId, source_id: impl Into<String>, source: &str, ) -> Result<LocatedExprTree>
Parses source into a located expression tree under a default decode
budget. source_id names the input for origin tracking.
Sourcepub fn parse_text_tree_with_budget(
&self,
codec: CodecId,
source_id: impl Into<String>,
source: &str,
budget: &mut DecodeBudget,
) -> Result<LocatedExprTree>
pub fn parse_text_tree_with_budget( &self, codec: CodecId, source_id: impl Into<String>, source: &str, budget: &mut DecodeBudget, ) -> Result<LocatedExprTree>
Parses source into a located expression tree under an explicit
budget, erroring if any tokens remain after a complete expression.
Auto Trait Implementations§
impl Freeze for PrattParser
impl RefUnwindSafe for PrattParser
impl Send for PrattParser
impl Sync for PrattParser
impl Unpin for PrattParser
impl UnsafeUnpin for PrattParser
impl UnwindSafe for PrattParser
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