pub struct CstParser<'a> { /* private fields */ }Expand description
A parser that builds a Cst automatically.
Mirrors the push/finish pattern of generated parsers.
Implementations§
Source§impl<'a> CstParser<'a>
impl<'a> CstParser<'a>
Sourcepub fn push(&mut self, token: Token) -> Result<(), ParseError>
pub fn push(&mut self, token: Token) -> Result<(), ParseError>
Push a token, performing any pending reductions.
Sourcepub fn finish(self) -> Result<Cst, (Self, ParseError)>
pub fn finish(self) -> Result<Cst, (Self, ParseError)>
Finish parsing and return the parse tree.
Sourcepub fn format_error(
&self,
terminal: SymbolId,
ctx: &impl ErrorContext,
display_names: Option<&[(&str, &str)]>,
tokens: Option<&[&str]>,
) -> String
pub fn format_error( &self, terminal: SymbolId, ctx: &impl ErrorContext, display_names: Option<&[(&str, &str)]>, tokens: Option<&[&str]>, ) -> String
Format a parse error into a detailed message.
Auto Trait Implementations§
impl<'a> Freeze for CstParser<'a>
impl<'a> RefUnwindSafe for CstParser<'a>
impl<'a> Send for CstParser<'a>
impl<'a> Sync for CstParser<'a>
impl<'a> Unpin for CstParser<'a>
impl<'a> UnsafeUnpin for CstParser<'a>
impl<'a> UnwindSafe for CstParser<'a>
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