pub struct PrattTable { /* private fields */ }Expand description
A registry of PrattOperator entries indexed by fixity for precedence
parsing.
Implementations§
Source§impl PrattTable
impl PrattTable
Sourcepub fn register(&mut self, operator: PrattOperator)
pub fn register(&mut self, operator: PrattOperator)
Registers an operator under its fixity, replacing any prior entry for
the same symbol; Fixity::Mixfix operators are not stored.
Sourcepub fn lookup_nud(&self, token: &Token) -> Option<PrattOperator>
pub fn lookup_nud(&self, token: &Token) -> Option<PrattOperator>
Looks up the null-denotation (prefix) operator for a leading token, if any.
Sourcepub fn lookup_led(&self, token: &Token) -> Option<PrattOperator>
pub fn lookup_led(&self, token: &Token) -> Option<PrattOperator>
Looks up the left-denotation operator for a token, preferring a postfix entry over an infix one, if any.
Sourcepub fn require_infix(&self, symbol: &Symbol) -> Result<&PrattOperator>
pub fn require_infix(&self, symbol: &Symbol) -> Result<&PrattOperator>
Returns the infix operator for the symbol, or an error if none is registered.
Sourcepub fn require_prefix(&self, symbol: &Symbol) -> Result<&PrattOperator>
pub fn require_prefix(&self, symbol: &Symbol) -> Result<&PrattOperator>
Returns the prefix operator for the symbol, or an error if none is registered.
Sourcepub fn require_postfix(&self, symbol: &Symbol) -> Result<&PrattOperator>
pub fn require_postfix(&self, symbol: &Symbol) -> Result<&PrattOperator>
Returns the postfix operator for the symbol, or an error if none is registered.
Sourcepub fn operators(&self) -> Vec<PrattOperator>
pub fn operators(&self) -> Vec<PrattOperator>
Collects every registered operator across all fixities.
Trait Implementations§
Source§impl Clone for PrattTable
impl Clone for PrattTable
Source§fn clone(&self) -> PrattTable
fn clone(&self) -> PrattTable
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for PrattTable
impl Debug for PrattTable
Source§impl Default for PrattTable
impl Default for PrattTable
Source§fn default() -> PrattTable
fn default() -> PrattTable
Returns the “default value” for a type. Read more
impl Eq for PrattTable
Source§impl PartialEq for PrattTable
impl PartialEq for PrattTable
Source§fn eq(&self, other: &PrattTable) -> bool
fn eq(&self, other: &PrattTable) -> bool
Tests for
self and other values to be equal, and is used by ==.impl StructuralPartialEq for PrattTable
Auto Trait Implementations§
impl Freeze for PrattTable
impl RefUnwindSafe for PrattTable
impl Send for PrattTable
impl Sync for PrattTable
impl Unpin for PrattTable
impl UnsafeUnpin for PrattTable
impl UnwindSafe for PrattTable
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