pub struct PrattDef {
pub operand: Box<Option<Combinator>>,
pub prefix_ops: Vec<PrefixOp>,
pub infix_ops: Vec<InfixOp>,
pub postfix_ops: Vec<PostfixOp>,
pub ternary: Option<TernaryOp>,
}Expand description
Pratt parsing definition for expression parsing Pratt expression parser definition.
IMPORTANT: The parser generator does NOT handle whitespace automatically. All whitespace handling must be done explicitly in the grammar DSL. This includes whitespace between operators and operands.
For expressions with postfix operators followed by infix operators (e.g., “a.x * b”), the grammar must ensure whitespace is consumed. Common patterns:
- Have the operand rule consume surrounding whitespace
- Use pattern-based operators that include whitespace in their patterns
- Structure the grammar so postfix chains are parsed as complete units
DO NOT add automatic/hardcoded whitespace handling to the parser generator.
Fields§
§operand: Box<Option<Combinator>>The operand parser (primary expressions)
prefix_ops: Vec<PrefixOp>Prefix operators
infix_ops: Vec<InfixOp>Infix operators
postfix_ops: Vec<PostfixOp>Postfix operators
ternary: Option<TernaryOp>Ternary operator (if any)
Trait Implementations§
Auto Trait Implementations§
impl Freeze for PrattDef
impl RefUnwindSafe for PrattDef
impl Send for PrattDef
impl Sync for PrattDef
impl Unpin for PrattDef
impl UnsafeUnpin for PrattDef
impl UnwindSafe for PrattDef
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