wright::lexer::comments

Function try_match_single_line_comment

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

Attempt to match a sinlgle line 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 either TokenTy::InnerDocComment or TokenTy::OuterDocComment.

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.

Generally I’m trying to follow the rust comment spec here.