wright::lexer::comments

Function try_match_block_comment

Source
pub fn try_match_block_comment(lexer: &Lexer) -> (usize, Option<TokenTy>)
Available on crate feature lexer only.
Expand description

Attempt to match a block comment from the start of the Lexer::remaining fragment. Return a usize and optionally a TokenTy. The usize indicates how many bytes were in the comment. The TokenTy (if it’s not None) should be TokenTy::InnerBlockDocComment, TokenTy::OuterBlockDocComment, or TokenTy::UnterminatedBlockComment.

If the TokenTy is not None, the lexer should consume the specified number of bytes (by the usize) and Produce a token with the variant from this function.