pub struct ParserContext<K: SyntaxKind> { /* private fields */ }Implementations§
Source§impl<K: SyntaxKind> ParserContext<K>
impl<K: SyntaxKind> ParserContext<K>
pub fn new() -> Self
Sourcepub fn diagnostics(&self) -> &[ParseDiagnostic]
pub fn diagnostics(&self) -> &[ParseDiagnostic]
Returns a slice with the parse diagnostics
Sourcepub fn truncate_diagnostics(&mut self, at: usize)
pub fn truncate_diagnostics(&mut self, at: usize)
Drops all diagnostics after at.
Sourcepub fn push_token(&mut self, kind: K, end: TextSize)
pub fn push_token(&mut self, kind: K, end: TextSize)
Pushes a new token event
Sourcepub fn push_event(&mut self, event: Event<K>)
pub fn push_event(&mut self, event: Event<K>)
Pushes a parse event
Sourcepub fn is_skipping(&self) -> bool
pub fn is_skipping(&self) -> bool
Returns true if the parser is skipping a token as skipped token trivia.
Sourcepub unsafe fn split_off_events(&mut self, position: usize) -> Vec<Event<K>>
pub unsafe fn split_off_events(&mut self, position: usize) -> Vec<Event<K>>
Splits the events into two at the given position. Returns a newly allocated vector containing the
elements from [position;len].
§Safety
The method is marked as unsafe to discourage its usage. Removing events can lead to
corrupted events if not done carefully.
Sourcepub fn rewind(&mut self, checkpoint: ParserContextCheckpoint)
pub fn rewind(&mut self, checkpoint: ParserContextCheckpoint)
Rewind the parser back to a previous position in time
Sourcepub fn checkpoint(&self) -> ParserContextCheckpoint
pub fn checkpoint(&self) -> ParserContextCheckpoint
Get a checkpoint representing the progress of the parser at this point of time
pub fn finish(self) -> (Vec<Event<K>>, Vec<ParseDiagnostic>)
Trait Implementations§
Source§impl<K: SyntaxKind> Default for ParserContext<K>
impl<K: SyntaxKind> Default for ParserContext<K>
Auto Trait Implementations§
impl<K> Freeze for ParserContext<K>
impl<K> RefUnwindSafe for ParserContext<K>where
K: RefUnwindSafe,
impl<K> Send for ParserContext<K>where
K: Send,
impl<K> Sync for ParserContext<K>where
K: Sync,
impl<K> Unpin for ParserContext<K>where
K: Unpin,
impl<K> UnwindSafe for ParserContext<K>where
K: UnwindSafe,
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