pub struct TriviaLexer { /* private fields */ }Expand description
A lexer wrapper that preserves trivia.
Wraps the Perl lexer to collect comments and whitespace as trivia tokens.
Implementations§
Source§impl TriviaLexer
impl TriviaLexer
Sourcepub fn new(source: String) -> TriviaLexer
pub fn new(source: String) -> TriviaLexer
Create a new trivia-preserving lexer
Sourcepub fn next_token_with_trivia(&mut self) -> Option<(Token, Vec<TriviaToken>)>
pub fn next_token_with_trivia(&mut self) -> Option<(Token, Vec<TriviaToken>)>
Get the next token, collecting any preceding trivia.
Returns the token along with any whitespace or comments that precede it.
Auto Trait Implementations§
impl Freeze for TriviaLexer
impl RefUnwindSafe for TriviaLexer
impl Send for TriviaLexer
impl Sync for TriviaLexer
impl Unpin for TriviaLexer
impl UnsafeUnpin for TriviaLexer
impl UnwindSafe for TriviaLexer
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