pub struct Parser { /* private fields */ }Expand description
Source-span-backed parser for converting formulas into an AST.
This is the canonical parser implementation. It owns the formula source and span tokens, avoiding per-token string allocation while preserving source locations for AST nodes.
Implementations§
Source§impl Parser
impl Parser
Sourcepub fn new<T: AsRef<str>>(formula: T) -> Result<Self, TokenizerError>
pub fn new<T: AsRef<str>>(formula: T) -> Result<Self, TokenizerError>
Tokenize a formula using the default Excel dialect and prepare it for parsing.
Sourcepub fn try_from_formula(formula: &str) -> Result<Self, TokenizerError>
pub fn try_from_formula(formula: &str) -> Result<Self, TokenizerError>
Compatibility alias for Parser::new.
Sourcepub fn new_with_dialect<T: AsRef<str>>(
formula: T,
dialect: FormulaDialect,
) -> Result<Self, TokenizerError>
pub fn new_with_dialect<T: AsRef<str>>( formula: T, dialect: FormulaDialect, ) -> Result<Self, TokenizerError>
Tokenize a formula with an explicit dialect and prepare it for parsing.
Sourcepub fn from_token_stream(stream: &TokenStream) -> Self
pub fn from_token_stream(stream: &TokenStream) -> Self
Build a parser from an existing source-backed token stream.
Sourcepub fn with_volatility_classifier<F>(self, f: F) -> Self
pub fn with_volatility_classifier<F>(self, f: F) -> Self
Provide a function-volatility classifier for this parser. If set, the parser will annotate ASTs with a contains_volatile bit.
pub fn parse(&mut self) -> Result<ASTNode, ParserError>
Trait Implementations§
Source§impl From<&TokenStream> for Parser
impl From<&TokenStream> for Parser
Source§fn from(stream: &TokenStream) -> Self
fn from(stream: &TokenStream) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl !RefUnwindSafe for Parser
impl !UnwindSafe for Parser
impl Freeze for Parser
impl Send for Parser
impl Sync for Parser
impl Unpin for Parser
impl UnsafeUnpin for Parser
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