[−][src]Function logos::skip
pub fn skip<'source, Token: Logos<'source>>(
_: &mut Lexer<'source, Token>
) -> Skip
Predefined callback that will inform the Lexer
to skip a definition.
Example
use logos::Logos; #[derive(Logos, Debug, PartialEq)] enum Token<'a> { // We will treat "abc" as if it was whitespace #[regex(" |abc", logos::skip)] #[error] Error, #[regex("[a-zA-Z]+")] Text(&'a str), } let tokens: Vec<_> = Token::lexer("Hello abc world").collect(); assert_eq!( tokens, &[ Token::Text("Hello"), Token::Text("world"), ], );