pub struct LossyTreeSink<'a> { /* private fields */ }
Expand description
Structure to convert events to a lossy syntax tree which does not preserve whitespace.
Implementations§
Source§impl<'a> LossyTreeSink<'a>
impl<'a> LossyTreeSink<'a>
pub fn new(text: &'a str, tokens: &'a [Token]) -> Self
Sourcepub fn with_offset(
text: &'a str,
tokens: &'a [Token],
token_start: usize,
) -> Self
pub fn with_offset( text: &'a str, tokens: &'a [Token], token_start: usize, ) -> Self
Make a new tree sink but start the sink at a specific token, this is used for making completed markers into AST nodes for rules which need them.
§Panics
Panics if the token start does not line up to a token’s start index or is out of bounds
pub fn finish(self) -> (GreenNode, Vec<ParserError>)
Trait Implementations§
Source§impl<'a> Debug for LossyTreeSink<'a>
impl<'a> Debug for LossyTreeSink<'a>
Source§impl<'a> TreeSink for LossyTreeSink<'a>
impl<'a> TreeSink for LossyTreeSink<'a>
Source§fn consume_multiple_tokens(&mut self, amount: u8, kind: SyntaxKind)
fn consume_multiple_tokens(&mut self, amount: u8, kind: SyntaxKind)
Consume multiple tokens and glue them into one kind
Source§fn token(&mut self, kind: SyntaxKind)
fn token(&mut self, kind: SyntaxKind)
Adds new token to the current branch.
Source§fn start_node(&mut self, kind: SyntaxKind)
fn start_node(&mut self, kind: SyntaxKind)
Start new branch and make it current.
Source§fn finish_node(&mut self)
fn finish_node(&mut self)
Finish current branch and restore previous
branch as current.
Source§fn errors(&mut self, errors: Vec<ParserError>)
fn errors(&mut self, errors: Vec<ParserError>)
Emit errors
Auto Trait Implementations§
impl<'a> Freeze for LossyTreeSink<'a>
impl<'a> RefUnwindSafe for LossyTreeSink<'a>
impl<'a> Send for LossyTreeSink<'a>
impl<'a> Sync for LossyTreeSink<'a>
impl<'a> Unpin for LossyTreeSink<'a>
impl<'a> !UnwindSafe for LossyTreeSink<'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